28 Jul, 2020

5 commits

  • DAN-P (Dual Attached Nodes PRP) nodes are expected to receive
    traditional IP packets as well as PRP (Parallel Redundancy
    Protocol) tagged (trailer) packets. PRP trailer is 6 bytes
    of PRP protocol unit called RCT, Redundancy Control Trailer
    (RCT) similar to HSR tag. PRP network can have traditional
    devices such as bridges/switches or PC attached to it and
    should be able to communicate. Regular Ethernet devices treat
    the RCT as pads. This patch adds logic to format L2 frames
    from network stack to add a trailer (RCT) and send it as
    duplicates over the slave interfaces when the protocol is
    PRP as per IEC 62439-3. At the ingress, it strips the trailer,
    do duplicate detection and rejection and forward a stripped
    frame up the network stack. PRP device should accept frames
    from Singly Attached Nodes (SAN) and thus the driver mark
    the link where the frame came from in the node table.

    Signed-off-by: Murali Karicheri
    Signed-off-by: David S. Miller

    Murali Karicheri
     
  • As a preparatory patch to introduce PRP, refactor the code specific to
    handling HSR frames into separate functions and call them through
    proto_ops function pointers.

    Signed-off-by: Murali Karicheri
    Signed-off-by: David S. Miller

    Murali Karicheri
     
  • Add support for generation of PRP supervision frames. For PRP,
    supervision frame format is similar to HSR version 0, but have
    a PRP Redundancy Control Trailer (RCT) added and uses a different
    message type, PRP_TLV_LIFE_CHECK_DD. Also update
    is_supervision_frame() to include the new message type used for
    PRP supervision frame.

    Signed-off-by: Murali Karicheri
    Signed-off-by: David S. Miller

    Murali Karicheri
     
  • As a preparatory patch to introduce support for PRP protocol, add a
    protocol ops ptr in the private hsr structure to hold function
    pointers as some of the functions at protocol level packet
    handling is different for HSR vs PRP. It is expected that PRP will
    add its of set of functions for protocol handling. Modify existing
    hsr_announce() function to call proto_ops->send_sv_frame() to send
    supervision frame for HSR. This is expected to be different for PRP.
    So introduce a ops function ptr, send_sv_frame() for the same and
    initialize it to send_hsr_supervsion_frame(). Modify hsr_announce()
    to call proto_ops->send_sv_frame().

    Signed-off-by: Murali Karicheri
    Signed-off-by: David S. Miller

    Murali Karicheri
     
  • Parallel Redundancy Protocol (PRP) is another redundancy protocol
    introduced by IEC 63439 standard. It is similar to HSR in many
    aspects:-

    - Use a pair of Ethernet interfaces to created the PRP device
    - Use a 6 byte redundancy protocol part (RCT, Redundancy Check
    Trailer) similar to HSR Tag.
    - Has Link Redundancy Entity (LRE) that works with RCT to implement
    redundancy.

    Key difference is that the protocol unit is a trailer instead of a
    prefix as in HSR. That makes it inter-operable with tradition network
    components such as bridges/switches which treat it as pad bytes,
    whereas HSR nodes requires some kind of translators (Called redbox) to
    talk to regular network devices. This features allows regular linux box
    to be converted to a DAN-P box. DAN-P stands for Dual Attached Node - PRP
    similar to DAN-H (Dual Attached Node - HSR).

    Add a comment at the header/source code to explicitly state that the
    driver files also handles PRP protocol as well.

    Signed-off-by: Murali Karicheri
    Signed-off-by: David S. Miller

    Murali Karicheri
     

30 Apr, 2020

1 commit


01 Mar, 2020

1 commit


20 Jan, 2020

1 commit

  • A compliation error happen when building branch 5.5-rc7

    In file included from net/hsr/hsr_main.c:12:0:
    net/hsr/hsr_main.h:194:20: error: two or more data types in declaration specifiers
    static inline void void hsr_debugfs_rename(struct net_device *dev)

    So Removed one void.

    Fixes: 4c2d5e33dcd3 ("hsr: rename debugfs file when interface name is changed")
    Signed-off-by: xiaofeng.yan
    Acked-by: Taehee Yoo
    Signed-off-by: David S. Miller

    xiaofeng.yan
     

26 Dec, 2019

4 commits

  • hsr nodes are protected by RCU and there is no write side lock.
    But node insertions and deletions could be being operated concurrently.
    So write side locking is needed.

    Test commands:
    ip netns add nst
    ip link add veth0 type veth peer name veth1
    ip link add veth2 type veth peer name veth3
    ip link set veth1 netns nst
    ip link set veth3 netns nst
    ip link set veth0 up
    ip link set veth2 up
    ip link add hsr0 type hsr slave1 veth0 slave2 veth2
    ip a a 192.168.100.1/24 dev hsr0
    ip link set hsr0 up
    ip netns exec nst ip link set veth1 up
    ip netns exec nst ip link set veth3 up
    ip netns exec nst ip link add hsr1 type hsr slave1 veth1 slave2 veth3
    ip netns exec nst ip a a 192.168.100.2/24 dev hsr1
    ip netns exec nst ip link set hsr1 up

    for i in {0..9}
    do
    for j in {0..9}
    do
    for k in {0..9}
    do
    for l in {0..9}
    do
    arping 192.168.100.2 -I hsr0 -s 00:01:3$i:4$j:5$k:6$l -c1 &
    done
    done
    done
    done

    Splat looks like:
    [ 236.066091][ T3286] list_add corruption. next->prev should be prev (ffff8880a5940300), but was ffff8880a5940d0.
    [ 236.069617][ T3286] ------------[ cut here ]------------
    [ 236.070545][ T3286] kernel BUG at lib/list_debug.c:25!
    [ 236.071391][ T3286] invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN PTI
    [ 236.072343][ T3286] CPU: 0 PID: 3286 Comm: arping Tainted: G W 5.5.0-rc1+ #209
    [ 236.073463][ T3286] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
    [ 236.074695][ T3286] RIP: 0010:__list_add_valid+0x74/0xd0
    [ 236.075499][ T3286] Code: 48 39 da 75 27 48 39 f5 74 36 48 39 dd 74 31 48 83 c4 08 b8 01 00 00 00 5b 5d c3 48 b
    [ 236.078277][ T3286] RSP: 0018:ffff8880aaa97648 EFLAGS: 00010286
    [ 236.086991][ T3286] RAX: 0000000000000075 RBX: ffff8880d4624c20 RCX: 0000000000000000
    [ 236.088000][ T3286] RDX: 0000000000000075 RSI: 0000000000000008 RDI: ffffed1015552ebf
    [ 236.098897][ T3286] RBP: ffff88809b53d200 R08: ffffed101b3c04f9 R09: ffffed101b3c04f9
    [ 236.099960][ T3286] R10: 00000000308769a1 R11: ffffed101b3c04f8 R12: ffff8880d4624c28
    [ 236.100974][ T3286] R13: ffff8880d4624c20 R14: 0000000040310100 R15: ffff8880ce17ee02
    [ 236.138967][ T3286] FS: 00007f23479fa680(0000) GS:ffff8880d9c00000(0000) knlGS:0000000000000000
    [ 236.144852][ T3286] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 236.145720][ T3286] CR2: 00007f4a14bab210 CR3: 00000000a61c6001 CR4: 00000000000606f0
    [ 236.146776][ T3286] Call Trace:
    [ 236.147222][ T3286] hsr_add_node+0x314/0x490 [hsr]
    [ 236.153633][ T3286] hsr_forward_skb+0x2b6/0x1bc0 [hsr]
    [ 236.154362][ T3286] ? rcu_read_lock_sched_held+0x90/0xc0
    [ 236.155091][ T3286] ? rcu_read_lock_bh_held+0xa0/0xa0
    [ 236.156607][ T3286] hsr_dev_xmit+0x70/0xd0 [hsr]
    [ 236.157254][ T3286] dev_hard_start_xmit+0x160/0x740
    [ 236.157941][ T3286] __dev_queue_xmit+0x1961/0x2e10
    [ 236.158565][ T3286] ? netdev_core_pick_tx+0x2e0/0x2e0
    [ ... ]

    Reported-by: syzbot+3924327f9ad5f4d2b343@syzkaller.appspotmail.com
    Fixes: f421436a591d ("net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)")
    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo
     
  • hsr interface has own debugfs file, which name is same with interface name.
    So, interface name is changed, debugfs file name should be changed too.

    Fixes: fc4ecaeebd26 ("net: hsr: add debugfs support for display node list")
    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo
     
  • In current hsr code, when hsr interface is created, it creates debugfs
    directory /sys/kernel/debug/.
    If there is same directory or file name in there, it fails.
    In order to reduce possibility of failure of creation of debugfs,
    this patch adds root directory.

    Test commands:
    ip link add dummy0 type dummy
    ip link add dummy1 type dummy
    ip link add hsr0 type hsr slave1 dummy0 slave2 dummy1

    Before this patch:
    /sys/kernel/debug/hsr0/node_table

    After this patch:
    /sys/kernel/debug/hsr/hsr0/node_table

    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo
     
  • hsr_dev_finalize() is called to create new hsr interface.
    There are some wrong error handling codes.

    1. wrong checking return value of debugfs_create_{dir/file}.
    These function doesn't return NULL. If error occurs in there,
    it returns error pointer.
    So, it should check error pointer instead of NULL.

    2. It doesn't unregister interface if it fails to setup hsr interface.
    If it fails to initialize hsr interface after register_netdevice(),
    it should call unregister_netdevice().

    3. Ignore failure of creation of debugfs
    If creating of debugfs dir and file is failed, creating hsr interface
    will be failed. But debugfs doesn't affect actual logic of hsr module.
    So, ignoring this is more correct and this behavior is more general.

    Fixes: c5a759117210 ("net/hsr: Use list_head (and rcu) instead of array for slave devices.")
    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo
     

16 Apr, 2019

2 commits


07 Apr, 2019

7 commits


16 Apr, 2016

1 commit

  • This patch adds support for the newer version 1 of the HSR
    networking standard. Version 0 is still default and the new
    version has to be selected via iproute2.

    Main changes are in the supervision frame handling and its
    ethertype field.

    Signed-off-by: Peter Heise
    Signed-off-by: David S. Miller

    Peter Heise
     

09 Jul, 2014

5 commits


04 Nov, 2013

1 commit

  • High-availability Seamless Redundancy ("HSR") provides instant failover
    redundancy for Ethernet networks. It requires a special network topology where
    all nodes are connected in a ring (each node having two physical network
    interfaces). It is suited for applications that demand high availability and
    very short reaction time.

    HSR acts on the Ethernet layer, using a registered Ethernet protocol type to
    send special HSR frames in both directions over the ring. The driver creates
    virtual network interfaces that can be used just like any ordinary Linux
    network interface, for IP/TCP/UDP traffic etc. All nodes in the network ring
    must be HSR capable.

    This code is a "best effort" to comply with the HSR standard as described in
    IEC 62439-3:2010 (HSRv0).

    Signed-off-by: Arvid Brodin
    Signed-off-by: David S. Miller

    Arvid Brodin