[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231003102732.GB32191@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net>
Date: Tue, 3 Oct 2023 03:27:32 -0700
From: Shradha Gupta <shradhagupta@...ux.microsoft.com>
To: Haiyang Zhang <haiyangz@...rosoft.com>
Cc: linux-hyperv@...r.kernel.org, netdev@...r.kernel.org,
decui@...rosoft.com, stephen@...workplumber.org, kys@...rosoft.com,
paulros@...rosoft.com, olaf@...fle.de, vkuznets@...hat.com,
davem@...emloft.net, wei.liu@...nel.org, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, leon@...nel.org,
longli@...rosoft.com, ssengar@...ux.microsoft.com,
linux-rdma@...r.kernel.org, daniel@...earbox.net,
john.fastabend@...il.com, bpf@...r.kernel.org, ast@...nel.org,
sharmaajay@...rosoft.com, hawk@...nel.org, tglx@...utronix.de,
linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH net,v2, 1/3] net: mana: Fix TX CQE error handling
On Fri, Sep 29, 2023 at 01:42:25PM -0700, Haiyang Zhang wrote:
> For an unknown TX CQE error type (probably from a newer hardware),
> still free the SKB, update the queue tail, etc., otherwise the
> accounting will be wrong.
>
> Also, TX errors can be triggered by injecting corrupted packets, so
> replace the WARN_ONCE to ratelimited error logging.
>
> Cc: stable@...r.kernel.org
> Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
> Signed-off-by: Haiyang Zhang <haiyangz@...rosoft.com>
> Reviewed-by: Simon Horman <horms@...nel.org>
> ---
> drivers/net/ethernet/microsoft/mana/mana_en.c | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
> index 4a16ebff3d1d..5cdcf7561b38 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_en.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
> @@ -1317,19 +1317,23 @@ static void mana_poll_tx_cq(struct mana_cq *cq)
> case CQE_TX_VPORT_IDX_OUT_OF_RANGE:
> case CQE_TX_VPORT_DISABLED:
> case CQE_TX_VLAN_TAGGING_VIOLATION:
> - WARN_ONCE(1, "TX: CQE error %d: ignored.\n",
> - cqe_oob->cqe_hdr.cqe_type);
> + if (net_ratelimit())
> + netdev_err(ndev, "TX: CQE error %d\n",
> + cqe_oob->cqe_hdr.cqe_type);
> +
> apc->eth_stats.tx_cqe_err++;
> break;
>
> default:
> - /* If the CQE type is unexpected, log an error, assert,
> - * and go through the error path.
> + /* If the CQE type is unknown, log an error,
> + * and still free the SKB, update tail, etc.
> */
> - WARN_ONCE(1, "TX: Unexpected CQE type %d: HW BUG?\n",
> - cqe_oob->cqe_hdr.cqe_type);
> + if (net_ratelimit())
> + netdev_err(ndev, "TX: unknown CQE type %d\n",
> + cqe_oob->cqe_hdr.cqe_type);
> +
> apc->eth_stats.tx_cqe_unknown_type++;
> - return;
> + break;
> }
>
> if (WARN_ON_ONCE(txq->gdma_txq_id != completions[i].wq_num))
> --
> 2.25.1
Reviewed-by: Shradha Gupta <shradhagupta@...ux.microsoft.com>
Powered by blists - more mailing lists