1. 27 Apr, 2020 21 commits
    • Jiri Pirko's avatar
      mlxsw: spectrum: Push flow_block related functions into a separate file · d52238eb
      Jiri Pirko authored
      The code around flow_block is currently mixed in spectrum_acl.c.
      However, as it really does not directly relate to ACL part only,
      push the bits into a separate file.
      Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d52238eb
    • Jiri Pirko's avatar
      mlxsw: spectrum: Rename acl_block to flow_block · 3bc3ffb6
      Jiri Pirko authored
      The acl_block structure is going to be used for non-acl case - matchall
      offload. So rename it accordingly.
      Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3bc3ffb6
    • Jiri Pirko's avatar
      mlxsw: spectrum_acl: Move block helpers into inline header functions · 49c958cc
      Jiri Pirko authored
      The struct is defined in the header, no need to have the helpers
      in the c file. Move the helpers to the header.
      Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      49c958cc
    • David S. Miller's avatar
      Merge branch 'r8169-improve-chip-config-handling' · 6488f11f
      David S. Miller authored
      Heiner Kallweit says:
      
      ====================
      r8169: improve chip config handling
      
      Series includes two improvements for chip configuration handling.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6488f11f
    • Heiner Kallweit's avatar
      r8169: improve configuring RxConfig register · 10478283
      Heiner Kallweit authored
      Two bits in RxConfig are controlled by the following dev->feature's:
      - NETIF_F_RXALL
      - NETIF_F_HW_VLAN_CTAG_RX (since RTL8125)
      
      We have to take care that RxConfig gets fully configured in
      rtl_hw_start() after e.g. resume from hibernation. Therefore:
      
      - Factor out setting the feature-controlled RxConfig bits to a new
        function rtl_set_rx_config_features() that is called from
        rtl8169_set_features() and rtl_hw_start().
      - Don't deal with RX_VLAN_8125 in rtl_init_rxcfg(), it will be set
        by rtl_set_rx_config_features().
      - Don't handle NETIF_F_RXALL in rtl_set_rx_mode().
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      10478283
    • Heiner Kallweit's avatar
      r8169: improve handling CPCMD_MASK · 975e8505
      Heiner Kallweit authored
      It's sufficient to do the masking once in probe() for clearing
      unwanted bits that may have been set by the BIOS.
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      975e8505
    • David S. Miller's avatar
      Merge branch 'net-bridge-mrp' · 45c9cbec
      David S. Miller authored
      Horatiu Vultur says:
      
      ====================
      net: bridge: mrp: Add support for Media Redundancy Protocol(MRP)
      
      Media Redundancy Protocol is a data network protocol standardized by
      International Electrotechnical Commission as IEC 62439-2. It allows rings of
      Ethernet switches to overcome any single failure with recovery time faster than
      STP. It is primarily used in Industrial Ethernet applications.
      
      Based on the previous RFC[1][2][3][4][5], and patches[6][7][8], the MRP state
      machine and all the timers were moved to userspace, except for the timers used
      to generate MRP Test frames.  In this way the userspace doesn't know and should
      not know if the HW or the kernel will generate the MRP Test frames. The
      following changes were added to the bridge to support the MRP:
      - the existing netlink interface was extended with MRP support,
      - allow to detect when a MRP frame was received on a MRP ring port
      - allow MRP instance to forward/terminate MRP frames
      - generate MRP Test frames in case the HW doesn't have support for this
      
      To be able to offload MRP support to HW, the switchdev API  was extend.
      
      With these changes the userspace doesn't do the following because already the
      kernel/HW will do:
      - doesn't need to forward/terminate MRP frames
      - doesn't need to generate MRP Test frames
      - doesn't need to detect when the ring is open/closed.
      
      The userspace application that is using the new netlink can be found here[9].
      
      The current implementation both in kernel and userspace supports only 2 roles:
        MRM - this one is responsible to send MRP_Test and MRP_Topo frames on both
        ring ports. It needs to process MRP_Test to know if the ring is open or
        closed. This operation is desired to be offloaded to the HW because it
        requires to generate and process up to 4000 frames per second. Whenever it
        detects that the ring is open it sends MRP_Topo frames to notify all MRC about
        changes in the topology. MRM needs also to process MRP_LinkChange frames,
        these frames are generated by the MRC. When the ring is open then the state
        of both ports is to forward frames and when the ring is closed then the
        secondary port is blocked.
      
        MRC - this one is responsible to forward MRP frames between the ring ports.
        In case one of the ring ports gets a link down or up, then MRC will generate
        a MRP_LinkChange frames. This node should also process MRP_Topo frames and to
        clear its FDB when it receives this frame.
      
       Userspace
                     Deamon +----------+ Client
                      +
                      |
       +--------------|-----------------------------------------+
        Kernel        |
                      + Netlink
      
                      |                              + Interrupt
                      |                              |
       +--------------|------------------------------|----------+
        HW            | Switchdev                    |
                      +                              |
      
      The user interacts using the client (called 'mrp'), the client talks to the
      deamon (called 'mrp_server'), which talks with the kernel using netlink. The
      kernel will try to offload the requests to the HW via switchdev API.
      
      If this will be accepted then in the future the netlink interface can be
      expended with multiple attributes which are required by different roles of the
      MRP. Like Media Redundancy Automanager(MRA), Media Interconnect Manager(MIM) and
      Media Interconnect Client(MIC).
      
      [1] https://www.spinics.net/lists/netdev/msg623647.html
      [2] https://www.spinics.net/lists/netdev/msg624378.html
      [3] https://www.spinics.net/lists/netdev/msg627500.html
      [4] https://www.spinics.net/lists/netdev/msg641005.html
      [5] https://www.spinics.net/lists/netdev/msg643991.html
      [6] https://www.spinics.net/lists/netdev/msg645378.html
      [7] https://www.spinics.net/lists/kernel/msg3484685.html
      [8] https://www.spinics.net/lists/netdev/msg646202.html
      [9] https://github.com/microchip-ung/mrp/tree/patch-v9
      
      -v4:
        - fix comments in br_mrp.c
        - use skb_header_pointer to get br_mrp_tlv_hdr
        - fix line over 80 characters
      
      -v3:
        - fix unused variables
      
      -v2:
        - drop patch 4
        - add port flag BR_MRP_LOST_CONT;
        - another fix for bisectability
      
      -v1:
        - fix bisectability issues
        - in case of errors use extack
      
      -RFC v5:
        - use nla_parse_nested
        - rework the usage of the rcu in br_mrp
        - reorder patches
        - few other small issues raised by Nikolay
      
      -RFC v4:
        - extend existing netlink interface to add mrp support
        - use rcu locks
      
      -RFC v3:
        - move MRP state machine in userspace
        - create generic netlink interface for configuring the HW using switchdev API
      
      -RFC v2:
        - extend switchdev API to offload to HW
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      45c9cbec
    • Horatiu Vultur's avatar
      net: bridge: Add checks for enabling the STP. · 419dba8a
      Horatiu Vultur authored
      It is not possible to have the MRP and STP running at the same time on the
      bridge, therefore add check when enabling the STP to check if MRP is already
      enabled. In that case return error.
      Reviewed-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      419dba8a
    • Horatiu Vultur's avatar
      bridge: mrp: Integrate MRP into the bridge · 65369933
      Horatiu Vultur authored
      To integrate MRP into the bridge, the bridge needs to do the following:
      - detect if the MRP frame was received on MRP ring port in that case it would be
        processed otherwise just forward it as usual.
      - enable parsing of MRP
      - before whenever the bridge was set up, it would set all the ports in
        forwarding state. Add an extra check to not set ports in forwarding state if
        the port is an MRP ring port. The reason of this change is that if the MRP
        instance initially sets the port in blocked state by setting the bridge up it
        would overwrite this setting.
      Reviewed-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      65369933
    • Horatiu Vultur's avatar
      bridge: mrp: Implement netlink interface to configure MRP · 4d02b8f0
      Horatiu Vultur authored
      Implement netlink interface to configure MRP. The implementation
      will do sanity checks over the attributes and then eventually call the MRP
      interface.
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4d02b8f0
    • Horatiu Vultur's avatar
      bridge: mrp: Connect MRP API with the switchdev API · 9a9f26e8
      Horatiu Vultur authored
      Implement the MRP API.
      
      In case the HW can't generate MRP Test frames then the SW will try to generate
      the frames. In case that also the SW will fail in generating the frames then a
      error is return to the userspace. The userspace is responsible to generate all
      the other MRP frames regardless if the test frames are generated by HW or SW.
      
      The forwarding/termination of MRP frames is happening in the kernel and is done
      by the MRP instance. The userspace application doesn't do the forwarding.
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9a9f26e8
    • Horatiu Vultur's avatar
      bridge: switchdev: mrp: Implement MRP API for switchdev · fadd4091
      Horatiu Vultur authored
      Implement the MRP api for switchdev.
      These functions will just eventually call the switchdev functions:
      switchdev_port_obj_add/del and switchdev_port_attr_set.
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fadd4091
    • Horatiu Vultur's avatar
      switchdev: mrp: Extend switchdev API to offload MRP · c284b545
      Horatiu Vultur authored
      Extend switchdev API to add support for MRP. The HW is notified in
      following cases:
      
      SWITCHDEV_OBJ_ID_MRP: This is used when a MRP instance is added/removed
        from the MRP ring.
      
      SWITCHDEV_OBJ_ID_RING_ROLE_MRP: This is used when the role of the node
        changes. The current supported roles are MRM and MRC.
      
      SWITCHDEV_OBJ_ID_RING_TEST_MRP: This is used when to start/stop sending
        MRP_Test frames on the mrp ring ports. This is called only on nodes that have
        the role MRM. In case this fails then the SW will generate the frames.
      
      SWITCHDEV_OBJ_ID_RING_STATE_STATE: This is used when the ring changes it states
        to open or closed. This is required to notify HW because the MRP_Test frame
        contains the field MRP_InState which contains this information.
      
      SWITCHDEV_ATTR_ID_MRP_PORT_STATE: This is used when the port's state is
        changed. It can be in blocking/forwarding mode.
      
      SWITCHDEV_ATTR_ID_MRP_PORT_ROLE: This is used when port's role changes. The
        roles of the port can be primary/secondary. This is required to notify HW
        because the MRP_Test frame contains the field MRP_PortRole that contains this
        information.
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c284b545
    • Horatiu Vultur's avatar
      bridge: mrp: Add MRP interface. · 2f1a11ae
      Horatiu Vultur authored
      Define the MRP interface.
      This interface is used by the netlink to update the MRP instances and by the MRP
      to make the calls to switchdev to offload it to HW.
      
      It defines an MRP instance 'struct br_mrp' which is a list of MRP instances.
      Which will be part of the 'struct net_bridge'. Each instance has 2 ring ports,
      a bridge and an ID.
      
      In case the HW can't generate MRP Test frames then the SW will generate those.
      
      br_mrp_add - adds a new MRP instance.
      
      br_mrp_del - deletes an existing MRP instance. Each instance has an ID(ring_id).
      
      br_mrp_set_port_state - changes the port state. The port can be in forwarding
        state, which means that the frames can pass through or in blocked state which
        means that the frames can't pass through except MRP frames. This will
        eventually call the switchdev API to notify the HW. This information is used
        also by the SW bridge to know how to forward frames in case the HW doesn't
        have this capability.
      
      br_mrp_set_port_role - a port role can be primary or secondary. This
        information is required to be pushed to HW in case the HW can generate
        MRP_Test frames.  Because the MRP_Test frames contains a file with this
        information. Otherwise the HW will not be able to generate the frames
        correctly.
      
      br_mrp_set_ring_state - a ring can be in state open or closed. State open means
        that the mrp port stopped receiving MRP_Test frames, while closed means that
        the mrp port received MRP_Test frames. Similar with br_mrp_port_role, this
        information is pushed in HW because the MRP_Test frames contain this
        information.
      
      br_mrp_set_ring_role - a ring can have the following roles MRM or MRC. For the
        role MRM it is expected that the HW can terminate the MRP frames, notify the
        SW that it stopped receiving MRP_Test frames and trapp all the other MRP
        frames.  While for MRC mode it is expected that the HW can forward the MRP
        frames only between the MRP ports and copy MRP_Topology frames to CPU. In
        case the HW doesn't support a role it needs to return an error code different
        than -EOPNOTSUPP.
      
      br_mrp_start_test - this starts/stops the generation of MRP_Test frames. To stop
        the generation of frames the interval needs to have a value of 0. In this case
        the userspace needs to know if the HW supports this or not. Not to have
        duplicate frames(generated by HW and SW). Because if the HW supports this then
        the SW will not generate anymore frames and will expect that the HW will
        notify when it stopped receiving MRP frames using the function
        br_mrp_port_open.
      
      br_mrp_port_open - this function is used by drivers to notify the userspace via
        a netlink callback that one of the ports stopped receiving MRP_Test frames.
        This function is called only when the node has the role MRM. It is not
        supposed to be called from userspace.
      
      br_mrp_port_switchdev_add - this corresponds to the function br_mrp_add,
        and will notify the HW that a MRP instance is added. The function gets
        as parameter the MRP instance.
      
      br_mrp_port_switchdev_del - this corresponds to the function br_mrp_del,
        and will notify the HW that a MRP instance is removed. The function
        gets as parameter the ID of the MRP instance that is removed.
      
      br_mrp_port_switchdev_set_state - this corresponds to the function
        br_mrp_set_port_state. It would notify the HW if it should block or not
        non-MRP frames.
      
      br_mrp_port_switchdev_set_port - this corresponds to the function
        br_mrp_set_port_role. It would set the port role, primary or secondary.
      
      br_mrp_switchdev_set_role - this corresponds to the function
        br_mrp_set_ring_role and would set one of the role MRM or MRC.
      
      br_mrp_switchdev_set_ring_state - this corresponds to the function
        br_mrp_set_ring_state and would set the ring to be open or closed.
      
      br_mrp_switchdev_send_ring_test - this corresponds to the function
        br_mrp_start_test. This will notify the HW to start or stop generating
        MRP_Test frames. Value 0 for the interval parameter means to stop generating
        the frames.
      
      br_mrp_port_open - this function is used to notify the userspace that the port
        lost the continuity of MRP Test frames.
      Reviewed-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2f1a11ae
    • Horatiu Vultur's avatar
      net: bridge: Add port attribute IFLA_BRPORT_MRP_RING_OPEN · 3e54442c
      Horatiu Vultur authored
      This patch adds a new port attribute, IFLA_BRPORT_MRP_RING_OPEN, which allows
      to notify the userspace when the port lost the continuite of MRP frames.
      
      This attribute is set by kernel whenever the SW or HW detects that the ring is
      being open or closed.
      Reviewed-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3e54442c
    • Horatiu Vultur's avatar
      bridge: mrp: Extend bridge interface · 4b8d7d4c
      Horatiu Vultur authored
      To integrate MRP into the bridge, first the bridge needs to be aware of ports
      that are part of an MRP ring and which rings are on the bridge.
      Therefore extend bridge interface with the following:
      - add new flag(BR_MPP_AWARE) to the net bridge ports, this bit will be
        set when the port is added to an MRP instance. In this way it knows if
        the frame was received on MRP ring port
      - add new flag(BR_MRP_LOST_CONT) to the net bridge ports, this bit will be set
        when the port lost the continuity of MRP Test frames.
      - add a list of MRP instances
      Reviewed-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4b8d7d4c
    • Horatiu Vultur's avatar
      bridge: mrp: Update Kconfig · 2cc974f8
      Horatiu Vultur authored
      Add the option BRIDGE_MRP to allow to build in or not MRP support.
      The default value is N.
      Reviewed-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2cc974f8
    • Horatiu Vultur's avatar
      bridge: uapi: mrp: Add mrp attributes. · 4714d137
      Horatiu Vultur authored
      Add new nested netlink attribute to configure the MRP. These attributes are used
      by the userspace to add/delete/configure MRP instances and by the kernel to
      notify the userspace when the MRP ring gets open/closed. MRP nested attribute
      has the following attributes:
      
      IFLA_BRIDGE_MRP_INSTANCE - the parameter type is br_mrp_instance which contains
        the instance id, and the ifindex of the two ports. The ports can't be part of
        multiple instances. This is used to create/delete MRP instances.
      
      IFLA_BRIDGE_MRP_PORT_STATE - the parameter type is u32. Which can be forwarding,
        blocking or disabled.
      
      IFLA_BRIDGE_MRP_PORT_ROLE - the parameter type is br_mrp_port_role which
        contains the instance id and the role. The role can be primary or secondary.
      
      IFLA_BRIDGE_MRP_RING_STATE - the parameter type is br_mrp_ring_state which
        contains the instance id and the state. The state can be open or closed.
      
      IFLA_BRIDGE_MRP_RING_ROLE - the parameter type is br_mrp_ring_role which
        contains the instance id and the ring role. The role can be MRM or MRC.
      
      IFLA_BRIDGE_MRP_START_TEST - the parameter type is br_mrp_start_test which
        contains the instance id, the interval at which to send the MRP_Test frames,
        how many test frames can be missed before declaring the ring open and the
        period which represent for how long to send the test frames.
      
      Also add the file include/uapi/linux/mrp_bridge.h which defines all the types
      used by MRP that are also needed by the userpace.
      Reviewed-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4714d137
    • Colin Ian King's avatar
      net: rtnetlink: remove redundant assignment to variable err · 7d311801
      Colin Ian King authored
      The variable err is being initializeed with a value that is never read
      and it is being updated later with a new value. The initialization
      is redundant and can be removed.
      
      Addresses-Coverity: ("Unused value")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7d311801
    • Oleksij Rempel's avatar
      dt-bindings: net: convert qca,ar71xx documentation to yaml · 3608a199
      Oleksij Rempel authored
      Now that we have the DT validation in place, let's convert the device tree
      bindings for the Atheros AR71XX over to a YAML schemas.
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3608a199
    • Oleksij Rempel's avatar
      net: ag71xx: extend link validation to support other SoCs · 0767ec04
      Oleksij Rempel authored
      Most (all?) QCA SoCs have two MAC with different supported link
      capabilities. Extend ag71xx_mac_validate() to properly validate this
      variants.
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0767ec04
  2. 26 Apr, 2020 19 commits