lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 23 Nov 2022 16:51:16 +0100
From:   Alexander Lobakin <alexandr.lobakin@...el.com>
To:     Vladimir Oltean <vladimir.oltean@....com>
Cc:     Alexander Lobakin <alexandr.lobakin@...el.com>,
        netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Claudiu Manoil <claudiu.manoil@....com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH net] net: enetc: preserve TX ring priority across reconfiguration

From: Vladimir Oltean <vladimir.oltean@....com>
Date: Tue, 22 Nov 2022 15:09:36 +0200

> In the blamed commit, a rudimentary reallocation procedure for RX buffer
> descriptors was implemented, for the situation when their format changes
> between normal (no PTP) and extended (PTP).
> 
> enetc_hwtstamp_set() calls enetc_close() and enetc_open() in a sequence,
> and this sequence loses information which was previously configured in
> the TX BDR Mode Register, specifically via the enetc_set_bdr_prio() call.
> The TX ring priority is configured by tc-mqprio and tc-taprio, and
> affects important things for TSN such as the TX time of packets. The
> issue manifests itself most visibly by the fact that isochron --txtime
> reports premature packet transmissions when PTP is first enabled on an
> enetc interface.
> 
> Save the TX ring priority in a new field in struct enetc_bdr (occupies a
> 2 byte hole on arm64) in order to make this survive a ring reconfiguration.
> 
> Fixes: 434cebabd3a2 ("enetc: Add dynamic allocation of extended Rx BD rings")
> Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
> ---
>  drivers/net/ethernet/freescale/enetc/enetc.c  |  8 ++++---
>  drivers/net/ethernet/freescale/enetc/enetc.h  |  1 +
>  .../net/ethernet/freescale/enetc/enetc_qos.c  | 21 ++++++++++++-------
>  3 files changed, 19 insertions(+), 11 deletions(-)

[...]

>  	err = enetc_setup_taprio(ndev, taprio);
> -
> -	if (err)
> -		for (i = 0; i < priv->num_tx_rings; i++)
> -			enetc_set_bdr_prio(hw, priv->tx_ring[i]->index,
> -					   taprio->enable ? 0 : i);
> +	if (err) {
> +		for (i = 0; i < priv->num_tx_rings; i++) {
> +			tx_ring = priv->tx_ring[i];
> +			tx_ring->prio = taprio->enable ? 0 : i;

Side note: is that `taprio ? 0 : i` correct? It's an error path
IIUC, why not just unconditional 0?
I guess it is, so

Reviewed-by: Alexander Lobakin <alexandr.lobakin@...el.com>

> +			enetc_set_bdr_prio(hw, tx_ring->index, tx_ring->prio);
> +		}
> +	}
>  
>  	return err;
>  }
> -- 
> 2.34.1

Thanks,
Olek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ