Skip to contentSkip to conversation

HSR: Standard breaks alignment. Solution?

DISCUSSION Arvid Brodin 3 participants 4 messages Jan 16, 2012 – Jan 20, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

As I've written before here, I'm trying to add support for the HSR protocol ("High-availability Seamless Redundancy") to the linux kernel. The protocol is specified in IEC-62439-3, and involves adding a protocol tag after the ethhdr on outgoing frames, and stripping it again on reception, much like VLAN.

This HSR tag is 6 bytes long, which breaks 32-bit header alignment and causes an Oops and a kernel panic in icmp_echo on the receiving side of pings (here,
exactly: http://lxr.linux.no/#linux+v2.6.37/net/ipv4/icmp.c#L838 )

If I add two bytes of padding to the HSR tag everything works beautifully. But of course that breaks any pretense of standard compliance.

Is there some way to fix this without having to memmove the whole frame payload 2 bytes on reception?

Or is this alignment-breaking specification crappy enough to break it and keep the padding? (I don't really care, I only need this to work between linux machines.) A "HSR-like" redundancy protocol. :-|

Signature · 2 lines
Arvid Brodin
Enea Services Stockholm AB
#1 lore raw
Quoted 9 lines · Arvid Brodin

As I've written before here, I'm trying to add support for the HSR protocol ("High-availability Seamless Redundancy") to the linux kernel. The protocol is specified in IEC-62439-3, and involves adding a protocol tag after the ethhdr on outgoing frames, and stripping it again on reception, much like VLAN.

This HSR tag is 6 bytes long, which breaks 32-bit header alignment and causes an Oops and a kernel panic in icmp_echo on the receiving side of pings (here,
exactly: http://lxr.linux.no/#linux+v2.6.37/net/ipv4/icmp.c#L838 )

Quoted 5 lines

If I add two bytes of padding to the HSR tag everything works beautifully. But of course that breaks any pretense of standard compliance.

Is there some way to fix this without having to memmove the whole frame payload 2 bytes on reception?

I don't think there's any other choice, but you can use CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS to see whether you actually need to do it.

johannes

#2 lore raw
Quoted 13 lines · Johannes Berg
Quoted 12 lines · Arvid Brodin

As I've written before here, I'm trying to add support for the HSR protocol ("High-availability Seamless Redundancy") to the linux kernel. The protocol is specified in IEC-62439-3, and involves adding a protocol tag after the ethhdr on outgoing frames, and stripping it again on reception, much like VLAN.

This HSR tag is 6 bytes long, which breaks 32-bit header alignment and causes an Oops and a kernel panic in icmp_echo on the receiving side of pings (here,
exactly: http://lxr.linux.no/#linux+v2.6.37/net/ipv4/icmp.c#L838 )

If I add two bytes of padding to the HSR tag everything works beautifully. But of course that breaks any pretense of standard compliance.

Quoted 6 lines
Quoted 2 lines

Is there some way to fix this without having to memmove the whole frame payload 2 bytes on reception?

I don't think there's any other choice, but you can use CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS to see whether you actually need to do it.

Or test if NET_IP_ALIGN is 0, it might be more explicit.

#3 lore raw
Quoted 14 lines · Eric Dumazet
Quoted 13 lines · Johannes Berg
Quoted 12 lines · Arvid Brodin

As I've written before here, I'm trying to add support for the HSR protocol ("High-availability Seamless Redundancy") to the linux kernel. The protocol is specified in IEC-62439-3, and involves adding a protocol tag after the ethhdr on outgoing frames, and stripping it again on reception, much like VLAN.

This HSR tag is 6 bytes long, which breaks 32-bit header alignment and causes an Oops and a kernel panic in icmp_echo on the receiving side of pings (here,
exactly: http://lxr.linux.no/#linux+v2.6.37/net/ipv4/icmp.c#L838 )

If I add two bytes of padding to the HSR tag everything works beautifully. But of course that breaks any pretense of standard compliance.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Is there some way to fix this without having to memmove the whole frame payload 2 bytes on reception?

I don't think there's any other choice, but you can use CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS to see whether you actually need to do it.

Or test if NET_IP_ALIGN is 0, it might be more explicit.

Thanks guys!

Signature · 2 lines
Arvid Brodin
Enea Services Stockholm AB