Re: [PATCH v4 1/1] scsi: ufs: core: Add support to notify userspace of UniPro QoS events

From: Peter Wang (王信友)

Date: Fri Mar 06 2026 - 02:11:46 EST


On Thu, 2026-03-05 at 03:08 -0800, Can Guo wrote:
> The UniPro stack manages to repair many potential Link problems
> without the
> need to notify the Application Layer. Repair mechanisms of the stack
> include L2 re-transmission and successful handling of PA_INIT.req.
> Nevertheless, any successful repair sequence requires Link bandwidth
> that
> is no longer vailable for the Application. Therefore, it may be
> useful for
> an Application to understand how often such repair attempts are made.
>
> The DME implements Quality of Service monitoring using a simple
> counting
> scheme, counting error events and comparing them against the number
> of
> correctly received or transmitted bytes. When the error counter
> exceeds a
> programmed threshold before the byte counter overflows, a DME_QoS.ind
> is
> issued to the Application and both counters are reset. When the byte
> counter overflows before the error counter has reached the programmed
> threshold, both counters are reset without triggering a DME_QoS.ind.
>
> The DME provides Link quality monitoring for the following purposes:
> 1. Detection of re-occurring repaired fatal error conditions on the
> Link
>    (PA_INIT loop). This kind of detection is useful if capabilities
>    exchanged between local and peer permit a potential operation at a
>    higher M-PHY Gear, but the physical interconnect between local and
> peer
>    Device does not, or, after Line quality degradation, no longer
> satisfies
>    channel characteristics.
> 2. Detection of degraded inbound or outbound Link quality, to allow
> an
>    Application to issue an ADAPT sequence for a Link running in HS-G4
> or
>    higher HS Gears. This kind of detection is used to monitor a
> slowly
>    degrading Link quality, e.g., one being affected by temperature
> and
>    voltage variations, against the expected M-PHY bit error rate.
>
> Userspace can configure and enable UniPro QoS via UniPro QoS
> Attributes
> (via UFS BSG) and get notified by dme_qos_notification without
> polling
> UniPro QoS Status attribute. The dme_qos_notification attribute is a
> bitfield with the following bit assignments:
>
> Bit     Description
> ===     ======================================
> 0       DME QoS Monitor has been reset by host
> 1       QoS from TX is detected
> 2       QoS from RX is detected
> 3       QoS from PA_INIT is detected
>
> Signed-off-by: Can Guo <can.guo@xxxxxxxxxxxxxxxx>

Reviewed-by: Peter Wang <peter.wang@xxxxxxxxxxxx>