ipq40xx: net/ipqess: fix outbound port tag computation
authorMatthias Schiffer <mschiffer@universe-factory.net>
Wed, 19 Jun 2024 23:05:51 +0000 (01:05 +0200)
committerRobert Marko <robimarko@gmail.com>
Thu, 20 Jun 2024 08:52:26 +0000 (10:52 +0200)
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 <mschiffer@universe-factory.net>
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/ipq40xx/patches-6.6/702-net-ipqess-Add-out-of-band-DSA-tagging-support.patch
target/linux/ipq40xx/patches-6.6/704-net-qualcomm-ipqess-enable-threaded-NAPI-by-default.patch

index fe6b59d18f069efdbbe344f4233498edd3f5aeea..bc755bf728b11b3301b4c463e90f19649fc06f57 100644 (file)
@@ -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 <maxime.chevallier@bootlin.com>
+[Matthias Schiffer: Fixed outbound port tag computation]
+Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
 ---
  drivers/net/ethernet/qualcomm/Kconfig         |  1 +
  drivers/net/ethernet/qualcomm/ipqess/ipqess.c | 64 ++++++++++++++++++-
@@ -70,7 +72,7 @@ Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
                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 <maxime.chevallier@bootlin.com>
 +      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 <maxime.chevallier@bootlin.com>
        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 <maxime.chevallier@bootlin.com>
  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);
        }
  
index cd586772846904d9aaf47d72a0beb537508f0bc7..322be36678b8c59bccf38656a380a152b4b22b47 100644 (file)
@@ -38,7 +38,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
        }
  
        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;