]> git.itanic.dy.fi Git - linux-stable/commitdiff
net: dsa: tag_sja1105: fix MAC DA patching from meta frames
authorVladimir Oltean <vladimir.oltean@nxp.com>
Mon, 3 Jul 2023 22:05:44 +0000 (01:05 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 4 Jul 2023 18:42:27 +0000 (19:42 +0100)
The SJA1105 manual says that at offset 4 into the meta frame payload we
have "MAC destination byte 2" and at offset 5 we have "MAC destination
byte 1". These are counted from the LSB, so byte 1 is h_dest[ETH_HLEN-2]
aka h_dest[4] and byte 2 is h_dest[ETH_HLEN-3] aka h_dest[3].

The sja1105_meta_unpack() function decodes these the other way around,
so a frame with MAC DA 01:80:c2:11:22:33 is received by the network
stack as having 01:80:c2:22:11:33.

Fixes: e53e18a6fe4d ("net: dsa: sja1105: Receive and decode meta frames")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/tag_sja1105.c

index db0a6ac6747083b18119c73588d813fb849277de..ec48165673edb3695fb59e2cb8eda4481b4c089c 100644 (file)
@@ -118,8 +118,8 @@ static void sja1105_meta_unpack(const struct sk_buff *skb,
         * a unified unpacking command for both device series.
         */
        packing(buf,     &meta->tstamp,     31, 0, 4, UNPACK, 0);
-       packing(buf + 4, &meta->dmac_byte_4, 7, 0, 1, UNPACK, 0);
-       packing(buf + 5, &meta->dmac_byte_3, 7, 0, 1, UNPACK, 0);
+       packing(buf + 4, &meta->dmac_byte_3, 7, 0, 1, UNPACK, 0);
+       packing(buf + 5, &meta->dmac_byte_4, 7, 0, 1, UNPACK, 0);
        packing(buf + 6, &meta->source_port, 7, 0, 1, UNPACK, 0);
        packing(buf + 7, &meta->switch_id,   7, 0, 1, UNPACK, 0);
 }