[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230731095159.3b7e3b75@kernel.org>
Date: Mon, 31 Jul 2023 09:51:59 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Md Danish Anwar <a0501179@...com>
Cc: MD Danish Anwar <danishanwar@...com>, Randy Dunlap
<rdunlap@...radead.org>, Roger Quadros <rogerq@...nel.org>, Simon Horman
<simon.horman@...igine.com>, Vignesh Raghavendra <vigneshr@...com>, Andrew
Lunn <andrew@...n.ch>, Richard Cochran <richardcochran@...il.com>, Conor
Dooley <conor+dt@...nel.org>, Krzysztof Kozlowski
<krzysztof.kozlowski+dt@...aro.org>, Rob Herring <robh+dt@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Eric Dumazet <edumazet@...gle.com>, "David
S. Miller" <davem@...emloft.net>, <nm@...com>, <srk@...com>,
<linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>,
<netdev@...r.kernel.org>, <linux-omap@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v12 06/10] net: ti: icssg-prueth: Add ICSSG ethernet
driver
On Mon, 31 Jul 2023 16:49:59 +0530 Md Danish Anwar wrote:
> There are five error handling cases in xmit().
>
> 1. DMA Mapping the linear buffer -- If we fail to map dma, we will return
> NETDEV_TX_OK and goto drop_free_skb which will free the skb and drop the packet.
>
> 2. Allocating descriptor for linear buffer -- If we fail to allocate descriptor
> this means it is a occupancy issue and we will goto drop_stop_q_busy which will
> stop queue and return NETDEV_TX_BUSY.
>
> 3. Allocating descriptor when skb is fragmented. -- If we fail to allocate
> descriptor when skb is fragmented, we will goto drop_stop_q which will stop the
> queue, free the descriptor, free the skb, drop the packet and return NETDEV_TX_OK.
This one should be BUSY, right? goto free_desc_stop_q_busy
> 4. DMA mapping for fragment. -- If DMA mapping for fragment fails, we will go
> to drop_free_descs which will free the descriptor, free the skb, drop the
> packet and return NETDEV_TX_OK.
>
> 5. Tx push failed. -- If tx push fails we will goto drop_free_descs which will
> free the descriptor, free the skb, drop the packet and return.
>
> We will only stop queue in case 2 and 3 where we failed to allocate descriptor.
> In case 1, 4 and 5 we are encountering dma mapping error, so for these cases we
> will not stop the queue.
>
> Below will be my goto labels.
>
> drop_stop_q:
> netif_tx_stop_queue(netif_txq);
>
> drop_free_descs:
> prueth_xmit_free(tx_chn, first_desc);
>
> drop_free_skb:
> dev_kfree_skb_any(skb);
>
> /* error */
> ndev->stats.tx_dropped++;
> netdev_err(ndev, "tx: error: %d\n", ret);
>
> return ret;
free_desc_stop_q_busy:
prueth_xmit_free(tx_chn, first_desc);
> drop_stop_q_busy:
> netif_tx_stop_queue(netif_txq);
> return NETDEV_TX_BUSY;
Powered by blists - more mailing lists