]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: ti: icssg: Use undirected TX tag for XDP zero copy in HSR offload mode
authorMeghana Malladi <m-malladi@ti.com>
Thu, 11 Jun 2026 18:57:43 +0000 (00:27 +0530)
committerJakub Kicinski <kuba@kernel.org>
Mon, 15 Jun 2026 23:22:16 +0000 (16:22 -0700)
emac_xsk_xmit_zc() has the same issue as the fixed emac_xmit_xdp_frame():
it always sets the CPPI5 descriptor destination tag to emac->port_id,
which directs the PRU firmware to transmit on only one slave port in HSR
mode, breaking redundancy.

Apply the same fix: in HSR offload mode when NETIF_F_HW_HSR_DUP is set,
use PRUETH_UNDIRECTED_PKT_DST_TAG (port 0) so the PRU duplicates frames
to both ports. Also set PRUETH_UNDIRECTED_PKT_TAG_INS when
NETIF_F_HW_HSR_TAG_INS is set so the PRU re-inserts the HSR sequence tag
that was stripped by the PRU on RX before the XDP program saw the frame.

This ensures XSK XDP_TX frames in HSR mode are treated identically to
skb TX via hsr0.

Fixes: 8756ef2eb078 ("net: ti: icssg-prueth: Add AF_XDP zero copy for TX")
Signed-off-by: Meghana Malladi <m-malladi@ti.com>
Link: https://patch.msgid.link/20260611185744.2498070-4-m-malladi@ti.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/ti/icssg/icssg_common.c

index ede32f266729ee97068e5157cd986fcfa4ebb600..82ddef9c17d54e70006ba92d90c0ceed6920c4ad 100644 (file)
@@ -105,6 +105,7 @@ static int emac_xsk_xmit_zc(struct prueth_emac *emac,
        struct xdp_desc xdp_desc;
        int num_tx = 0, pkt_len;
        int descs_avail, ret;
+       u32 dst_tag_id;
        u32 *epib;
        int i;
 
@@ -137,9 +138,17 @@ static int emac_xsk_xmit_zc(struct prueth_emac *emac,
                epib[0] = 0;
                epib[1] = 0;
                cppi5_hdesc_set_pktlen(host_desc, pkt_len);
-               cppi5_desc_set_tags_ids(&host_desc->hdr, 0,
-                                       (emac->port_id | (q_idx << 8)));
+               dst_tag_id = emac->port_id | (q_idx << 8);
+
+               if (emac->prueth->is_hsr_offload_mode &&
+                   (ndev->features & NETIF_F_HW_HSR_DUP))
+                       dst_tag_id = PRUETH_UNDIRECTED_PKT_DST_TAG;
+
+               if (emac->prueth->is_hsr_offload_mode &&
+                   (ndev->features & NETIF_F_HW_HSR_TAG_INS))
+                       epib[1] |= PRUETH_UNDIRECTED_PKT_TAG_INS;
 
+               cppi5_desc_set_tags_ids(&host_desc->hdr, 0, dst_tag_id);
                k3_udma_glue_tx_dma_to_cppi5_addr(tx_chn->tx_chn, &dma_buf);
                cppi5_hdesc_attach_buf(host_desc, dma_buf, pkt_len, dma_buf,
                                       pkt_len);