linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net-next] net: hsr: Provide fix for HSRv1 supervisor frames decoding
@ 2023-09-14 12:47 Lukasz Majewski
  2023-09-14 12:55 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 3+ messages in thread
From: Lukasz Majewski @ 2023-09-14 12:47 UTC (permalink / raw)
  To: Tristram.Ha, Eric Dumazet, davem
  Cc: Andrew Lunn, Florian Fainelli, Jakub Kicinski,
	Sebastian Andrzej Siewior, Paolo Abeni, Kristian Overskeid,
	Matthieu Baerts, netdev, linux-kernel, Lukasz Majewski

Provide fix to decode correctly supervisory frames when HSRv1 version of
the HSR protocol is used.

Without this patch console is polluted with:
ksz-switch spi1.0 lan1: hsr_addr_subst_dest: Unknown node

as a result of destination node's A MAC address equals to:
00:00:00:00:00:00.

cat /sys/kernel/debug/hsr/hsr0/node_table
Node Table entries for (HSR) device
MAC-Address-A,    MAC-Address-B,    time_in[A], time_in[B], Address-B
00:00:00:00:00:00 00:10:a1:94:77:30      400bf,       399c,	        0

It was caused by wrong frames decoding in the hsr_handle_sup_frame().

As the supervisor frame is encapsulated in HSRv1 frame:

SKB_I100000000: 01 15 4e 00 01 2d 00 10 a1 94 77 30 89 2f 00 34
SKB_I100000010: 02 59 88 fb 00 01 84 15 17 06 00 10 a1 94 77 30
SKB_I100000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SKB_I100000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SKB_I100000040: 00 00

The code had to be adjusted accordingly and the MAC-Address-A now
has the proper address (the MAC-Address-B now has all 0's).

Fixes: eafaa88b3eb7 ("net: hsr: Add support for redbox supervision frames")'

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
Changes for v2:
- Use the proper parsing code altered with eafaa88b3eb7f
---
 net/hsr/hsr_framereg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c
index b77f1189d19d..6d14d935ee82 100644
--- a/net/hsr/hsr_framereg.c
+++ b/net/hsr/hsr_framereg.c
@@ -288,13 +288,13 @@ void hsr_handle_sup_frame(struct hsr_frame_info *frame)
 
 	/* And leave the HSR tag. */
 	if (ethhdr->h_proto == htons(ETH_P_HSR)) {
-		pull_size = sizeof(struct ethhdr);
+		pull_size = sizeof(struct hsr_tag);
 		skb_pull(skb, pull_size);
 		total_pull_size += pull_size;
 	}
 
 	/* And leave the HSR sup tag. */
-	pull_size = sizeof(struct hsr_tag);
+	pull_size = sizeof(struct hsr_sup_tag);
 	skb_pull(skb, pull_size);
 	total_pull_size += pull_size;
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 net-next] net: hsr: Provide fix for HSRv1 supervisor frames decoding
  2023-09-14 12:47 [PATCH v2 net-next] net: hsr: Provide fix for HSRv1 supervisor frames decoding Lukasz Majewski
@ 2023-09-14 12:55 ` Sebastian Andrzej Siewior
  2023-09-14 13:16   ` Lukasz Majewski
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Andrzej Siewior @ 2023-09-14 12:55 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: Tristram.Ha, Eric Dumazet, davem, Andrew Lunn, Florian Fainelli,
	Jakub Kicinski, Paolo Abeni, Kristian Overskeid, Matthieu Baerts,
	netdev, linux-kernel

On 2023-09-14 14:47:30 [+0200], Lukasz Majewski wrote:
> Provide fix to decode correctly supervisory frames when HSRv1 version of
> the HSR protocol is used.

I'm going take this, reword the commit message and send it along with
fixes to the test suite we actually have…

Sebastian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 net-next] net: hsr: Provide fix for HSRv1 supervisor frames decoding
  2023-09-14 12:55 ` Sebastian Andrzej Siewior
@ 2023-09-14 13:16   ` Lukasz Majewski
  0 siblings, 0 replies; 3+ messages in thread
From: Lukasz Majewski @ 2023-09-14 13:16 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: Tristram.Ha, Eric Dumazet, davem, Andrew Lunn, Florian Fainelli,
	Jakub Kicinski, Paolo Abeni, Kristian Overskeid, Matthieu Baerts,
	netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 601 bytes --]

Hi Sebastian Andrzej,

> On 2023-09-14 14:47:30 [+0200], Lukasz Majewski wrote:
> > Provide fix to decode correctly supervisory frames when HSRv1
> > version of the HSR protocol is used.  
> 
> I'm going take this, reword the commit message and send it along with
> fixes to the test suite we actually have…
> 

+1

> Sebastian

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-14 13:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-14 12:47 [PATCH v2 net-next] net: hsr: Provide fix for HSRv1 supervisor frames decoding Lukasz Majewski
2023-09-14 12:55 ` Sebastian Andrzej Siewior
2023-09-14 13:16   ` Lukasz Majewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).