Commit 1884fc85 authored by Meghana Malladi's avatar Meghana Malladi Committed by Jakub Kicinski
Browse files

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: 62aa3246 ("net: ti: icssg-prueth: Add XDP support")
Signed-off-by: default avatarMeghana Malladi <m-malladi@ti.com>
Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20250506110546.4065715-4-m-malladi@ti.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 8b3fae3e
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -187,7 +187,6 @@ int emac_tx_complete_packets(struct prueth_emac *emac, int chn,
			xdp_return_frame(xdpf);
			break;
		default:
			netdev_err(ndev, "tx_complete: invalid swdata type %d\n", swdata->type);
			prueth_xmit_free(tx_chn, desc_tx);
			ndev->stats.tx_dropped++;
			continue;
@@ -567,6 +566,7 @@ u32 emac_xmit_xdp_frame(struct prueth_emac *emac,
{
	struct cppi5_host_desc_t *first_desc;
	struct net_device *ndev = emac->ndev;
	struct netdev_queue *netif_txq;
	struct prueth_tx_chn *tx_chn;
	dma_addr_t desc_dma, buf_dma;
	struct prueth_swdata *swdata;
@@ -620,12 +620,17 @@ u32 emac_xmit_xdp_frame(struct prueth_emac *emac,
		swdata->data.xdpf = xdpf;
	}

	/* Report BQL before sending the packet */
	netif_txq = netdev_get_tx_queue(ndev, tx_chn->id);
	netdev_tx_sent_queue(netif_txq, xdpf->len);

	cppi5_hdesc_set_pktlen(first_desc, xdpf->len);
	desc_dma = k3_cppi_desc_pool_virt2dma(tx_chn->desc_pool, first_desc);

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

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