Re: [PATCH v12 06/10] net: ti: icssg-prueth: Add ICSSG ethernet driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;



[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux