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 <mschiffer@universe-factory.net>
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Matthias Schiffer 2024-06-20 01:05:51 +02:00 committed by Robert Marko
parent b004feaafb
commit 0b6b54eca9
2 changed files with 13 additions and 8 deletions

View File

@ -15,6 +15,8 @@ done on the TX side, where the driver pulls the tag from the skb and
builds the descriptor accordingly. builds the descriptor accordingly.
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com> 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/Kconfig | 1 +
drivers/net/ethernet/qualcomm/ipqess/ipqess.c | 64 ++++++++++++++++++- 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); napi_gro_receive(&rx_ring->napi_rx, skb);
rx_ring->ess->stats.rx_packets++; 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; 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; + struct dsa_oob_tag_info *tag_info;
+ +
+ if (unlikely(!ess->dsa_ports)) + if (unlikely(!ess->dsa_ports))
+ return; + goto no_dsa;
+ +
+ tag_info = skb_ext_find(skb, SKB_EXT_DSA_OOB); + tag_info = skb_ext_find(skb, SKB_EXT_DSA_OOB);
+ if (!tag_info) + 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); + *word3 |= BIT(IPQESS_TPD_FROM_CPU_SHIFT);
+ return;
+
+no_dsa:
+ *word3 |= 0x3e << IPQESS_TPD_PORT_BITMAP_SHIFT; + *word3 |= 0x3e << IPQESS_TPD_PORT_BITMAP_SHIFT;
+} +}
+ +
static int ipqess_tx_map_and_fill(struct ipqess_tx_ring *tx_ring, static int ipqess_tx_map_and_fill(struct ipqess_tx_ring *tx_ring,
struct sk_buff *skb) 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; u16 len;
int i; int i;
@ -103,7 +108,7 @@ Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
if (skb_is_gso(skb)) { if (skb_is_gso(skb)) {
if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) { if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) {
lso_word1 |= IPQESS_TPD_IPV4_EN; 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, .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) static void ipqess_hw_stop(struct ipqess *ess)
{ {
int i; 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); netif_napi_add(netdev, &ess->rx_ring[i].napi_rx, ipqess_rx_napi);
} }

View File

@ -38,7 +38,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
} }
return IRQ_HANDLED; 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) if (err)
goto err_notifier_unregister; goto err_notifier_unregister;