Skip to content

Commit 1884fc8

Browse files
MeghanaMalladiTIkuba-moo
authored andcommitted
net: ti: icssg-prueth: Report BQL before sending XDP packets
When sending out any kind of traffic, it is essential that the driver keeps reporting BQL of the number of bytes that have been sent so that BQL can track the amount of data in the queue and prevents it from overflowing. If BQL is not reported, the driver may continue sending packets even when the queue is full, leading to packet loss, congestion and decreased network performance. Currently this is missing in emac_xmit_xdp_frame() and this patch fixes it. Fixes: 62aa324 ("net: ti: icssg-prueth: Add XDP support") Signed-off-by: Meghana Malladi <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8b3fae3 commit 1884fc8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/net/ethernet/ti/icssg/icssg_common.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ int emac_tx_complete_packets(struct prueth_emac *emac, int chn,
187187
xdp_return_frame(xdpf);
188188
break;
189189
default:
190-
netdev_err(ndev, "tx_complete: invalid swdata type %d\n", swdata->type);
191190
prueth_xmit_free(tx_chn, desc_tx);
192191
ndev->stats.tx_dropped++;
193192
continue;
@@ -567,6 +566,7 @@ u32 emac_xmit_xdp_frame(struct prueth_emac *emac,
567566
{
568567
struct cppi5_host_desc_t *first_desc;
569568
struct net_device *ndev = emac->ndev;
569+
struct netdev_queue *netif_txq;
570570
struct prueth_tx_chn *tx_chn;
571571
dma_addr_t desc_dma, buf_dma;
572572
struct prueth_swdata *swdata;
@@ -620,12 +620,17 @@ u32 emac_xmit_xdp_frame(struct prueth_emac *emac,
620620
swdata->data.xdpf = xdpf;
621621
}
622622

623+
/* Report BQL before sending the packet */
624+
netif_txq = netdev_get_tx_queue(ndev, tx_chn->id);
625+
netdev_tx_sent_queue(netif_txq, xdpf->len);
626+
623627
cppi5_hdesc_set_pktlen(first_desc, xdpf->len);
624628
desc_dma = k3_cppi_desc_pool_virt2dma(tx_chn->desc_pool, first_desc);
625629

626630
ret = k3_udma_glue_push_tx_chn(tx_chn->tx_chn, first_desc, desc_dma);
627631
if (ret) {
628632
netdev_err(ndev, "xdp tx: push failed: %d\n", ret);
633+
netdev_tx_completed_queue(netif_txq, 1, xdpf->len);
629634
goto drop_free_descs;
630635
}
631636

@@ -984,6 +989,7 @@ enum netdev_tx icssg_ndo_start_xmit(struct sk_buff *skb, struct net_device *ndev
984989
ret = k3_udma_glue_push_tx_chn(tx_chn->tx_chn, first_desc, desc_dma);
985990
if (ret) {
986991
netdev_err(ndev, "tx: push failed: %d\n", ret);
992+
netdev_tx_completed_queue(netif_txq, 1, pkt_len);
987993
goto drop_free_descs;
988994
}
989995

0 commit comments

Comments
 (0)