From 0b6b54eca939a2cb757f854594863548fb93f21f Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 20 Jun 2024 01:05:51 +0200 Subject: [PATCH] ipq40xx: net/ipqess: fix outbound port tag computation Since the introduction of out-of-band tagging, writing the outbound tag had been completely broken: First, in place of a port mask containing the port number, just the port number itself was set in the register value. Just after that, the full port mask 0x3e (all 5 external ports) was set unconditionally. This remained unnoticed because the switch would then use the FDB to decide where to send unicast packets; broadcast and multicast packets were however sent to every port. Fix the port tag computation and only use the full port mask as a fallback for non-DSA mode, as it was done in the older driver patches used on Linux 5.15. Fixes: cd9c7211241e ("ipq40xx: 6.1: use latest DSA and ethernet patches") Signed-off-by: Matthias Schiffer Signed-off-by: Robert Marko --- ...-Add-out-of-band-DSA-tagging-support.patch | 19 ++++++++++++------- ...qess-enable-threaded-NAPI-by-default.patch | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/target/linux/ipq40xx/patches-6.6/702-net-ipqess-Add-out-of-band-DSA-tagging-support.patch b/target/linux/ipq40xx/patches-6.6/702-net-ipqess-Add-out-of-band-DSA-tagging-support.patch index fe6b59d18f..bc755bf728 100644 --- a/target/linux/ipq40xx/patches-6.6/702-net-ipqess-Add-out-of-band-DSA-tagging-support.patch +++ b/target/linux/ipq40xx/patches-6.6/702-net-ipqess-Add-out-of-band-DSA-tagging-support.patch @@ -15,6 +15,8 @@ done on the TX side, where the driver pulls the tag from the skb and builds the descriptor accordingly. Signed-off-by: Maxime Chevallier +[Matthias Schiffer: Fixed outbound port tag computation] +Signed-off-by: Matthias Schiffer --- drivers/net/ethernet/qualcomm/Kconfig | 1 + drivers/net/ethernet/qualcomm/ipqess/ipqess.c | 64 ++++++++++++++++++- @@ -70,7 +72,7 @@ Signed-off-by: Maxime Chevallier napi_gro_receive(&rx_ring->napi_rx, skb); rx_ring->ess->stats.rx_packets++; -@@ -706,6 +715,23 @@ static void ipqess_rollback_tx(struct ip +@@ -706,6 +715,26 @@ static void ipqess_rollback_tx(struct ip tx_ring->head = start_index; } @@ -80,21 +82,24 @@ Signed-off-by: Maxime Chevallier + struct dsa_oob_tag_info *tag_info; + + if (unlikely(!ess->dsa_ports)) -+ return; ++ goto no_dsa; + + tag_info = skb_ext_find(skb, SKB_EXT_DSA_OOB); + if (!tag_info) -+ return; ++ goto no_dsa; + -+ *word3 |= tag_info->port << IPQESS_TPD_PORT_BITMAP_SHIFT; ++ *word3 |= BIT(tag_info->port) << IPQESS_TPD_PORT_BITMAP_SHIFT; + *word3 |= BIT(IPQESS_TPD_FROM_CPU_SHIFT); ++ return; ++ ++no_dsa: + *word3 |= 0x3e << IPQESS_TPD_PORT_BITMAP_SHIFT; +} + static int ipqess_tx_map_and_fill(struct ipqess_tx_ring *tx_ring, struct sk_buff *skb) { -@@ -716,6 +742,8 @@ static int ipqess_tx_map_and_fill(struct +@@ -716,6 +745,8 @@ static int ipqess_tx_map_and_fill(struct u16 len; int i; @@ -103,7 +108,7 @@ Signed-off-by: Maxime Chevallier if (skb_is_gso(skb)) { if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) { lso_word1 |= IPQESS_TPD_IPV4_EN; -@@ -917,6 +945,33 @@ static const struct net_device_ops ipqes +@@ -917,6 +948,33 @@ static const struct net_device_ops ipqes .ndo_tx_timeout = ipqess_tx_timeout, }; @@ -137,7 +142,7 @@ Signed-off-by: Maxime Chevallier static void ipqess_hw_stop(struct ipqess *ess) { int i; -@@ -1184,12 +1239,19 @@ static int ipqess_axi_probe(struct platf +@@ -1184,12 +1242,19 @@ static int ipqess_axi_probe(struct platf netif_napi_add(netdev, &ess->rx_ring[i].napi_rx, ipqess_rx_napi); } diff --git a/target/linux/ipq40xx/patches-6.6/704-net-qualcomm-ipqess-enable-threaded-NAPI-by-default.patch b/target/linux/ipq40xx/patches-6.6/704-net-qualcomm-ipqess-enable-threaded-NAPI-by-default.patch index cd58677284..322be36678 100644 --- a/target/linux/ipq40xx/patches-6.6/704-net-qualcomm-ipqess-enable-threaded-NAPI-by-default.patch +++ b/target/linux/ipq40xx/patches-6.6/704-net-qualcomm-ipqess-enable-threaded-NAPI-by-default.patch @@ -38,7 +38,7 @@ Signed-off-by: Robert Marko } return IRQ_HANDLED; -@@ -1261,6 +1261,8 @@ static int ipqess_axi_probe(struct platf +@@ -1264,6 +1264,8 @@ static int ipqess_axi_probe(struct platf if (err) goto err_notifier_unregister; -- 2.30.2