diff mbox series

[net] dsa: tag_dsa: Fix mask for trunked packets

Message ID 20211003155053.2241209-1-andrew@lunn.ch (mailing list archive)
State Accepted
Commit b44d52a50bc6f191f0ae03f65de8401f3ef039b3
Delegated to: Netdev Maintainers
Headers show
Series [net] dsa: tag_dsa: Fix mask for trunked packets | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/cc_maintainers fail 2 blamed authors not CCed: olteanv@gmail.com kuba@kernel.org; 4 maintainers not CCed: olteanv@gmail.com davem@davemloft.net vivien.didelot@gmail.com kuba@kernel.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Andrew Lunn Oct. 3, 2021, 3:50 p.m. UTC
A packet received on a trunk will have bit 2 set in Forward DSA tagged
frame. Bit 1 can be either 0 or 1 and is otherwise undefined and bit 0
indicates the frame CFI. Masking with 7 thus results in frames as
being identified as being from a trunk when in fact they are not. Fix
the mask to just look at bit 2.

Fixes: 5b60dadb71db ("net: dsa: tag_dsa: Support reception of packets from LAG devices")
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 net/dsa/tag_dsa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Vladimir Oltean Oct. 3, 2021, 9:07 p.m. UTC | #1
On Sun, Oct 03, 2021 at 05:50:53PM +0200, Andrew Lunn wrote:
> A packet received on a trunk will have bit 2 set in Forward DSA tagged
> frame. Bit 1 can be either 0 or 1 and is otherwise undefined and bit 0
> indicates the frame CFI. Masking with 7 thus results in frames as
> being identified as being from a trunk when in fact they are not. Fix
> the mask to just look at bit 2.
> 
> Fixes: 5b60dadb71db ("net: dsa: tag_dsa: Support reception of packets from LAG devices")
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>

At least this appears correct on 88E6096/97, but I would expect it to be
true for the entire family.

Would like to hear Tobias' feedback too, though.
patchwork-bot+netdevbpf@kernel.org Oct. 4, 2021, 12:50 p.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Sun,  3 Oct 2021 17:50:53 +0200 you wrote:
> A packet received on a trunk will have bit 2 set in Forward DSA tagged
> frame. Bit 1 can be either 0 or 1 and is otherwise undefined and bit 0
> indicates the frame CFI. Masking with 7 thus results in frames as
> being identified as being from a trunk when in fact they are not. Fix
> the mask to just look at bit 2.
> 
> Fixes: 5b60dadb71db ("net: dsa: tag_dsa: Support reception of packets from LAG devices")
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> 
> [...]

Here is the summary with links:
  - [net] dsa: tag_dsa: Fix mask for trunked packets
    https://git.kernel.org/netdev/net/c/b44d52a50bc6

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c
index 77d0ce89ab77..e5127b7d1c6a 100644
--- a/net/dsa/tag_dsa.c
+++ b/net/dsa/tag_dsa.c
@@ -210,7 +210,7 @@  static struct sk_buff *dsa_rcv_ll(struct sk_buff *skb, struct net_device *dev,
 	cmd = dsa_header[0] >> 6;
 	switch (cmd) {
 	case DSA_CMD_FORWARD:
-		trunk = !!(dsa_header[1] & 7);
+		trunk = !!(dsa_header[1] & 4);
 		break;
 
 	case DSA_CMD_TO_CPU: