1. 29 8月, 2017 1 次提交
    • S
      net/ncsi: Configure VLAN tag filter · 21acf630
      Samuel Mendoza-Jonas 提交于
      Make use of the ndo_vlan_rx_{add,kill}_vid callbacks to have the NCSI
      stack process new VLAN tags and configure the channel VLAN filter
      appropriately.
      Several VLAN tags can be set and a "Set VLAN Filter" packet must be sent
      for each one, meaning the ncsi_dev_state_config_svf state must be
      repeated. An internal list of VLAN tags is maintained, and compared
      against the current channel's ncsi_channel_filter in order to keep track
      within the state. VLAN filters are removed in a similar manner, with the
      introduction of the ncsi_dev_state_config_clear_vids state. The maximum
      number of VLAN tag filters is determined by the "Get Capabilities"
      response from the channel.
      Signed-off-by: NSamuel Mendoza-Jonas <sam@mendozajonas.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      21acf630
  2. 20 10月, 2016 3 次提交
    • G
      net/ncsi: Choose hot channel as active one if necessary · bbc7c01e
      Gavin Shan 提交于
      The issue was found on BCM5718 which has two NCSI channels in one
      package: C0 and C1. C0 is in link-up state while C1 is in link-down
      state. C0 is chosen as active channel until unplugging and plugging
      C0's cable:  On unplugging C0's cable, LSC (Link State Change) AEN
      packet received on C0 to report link-down event. After that, C1 is
      chosen as active channel. LSC AEN for link-up event is lost on C0
      when plugging C0's cable back. We lose the network even C0 is usable.
      
      This resolves the issue by recording the (hot) channel that was ever
      chosen as active one. The hot channel is chosen to be active one
      if none of available channels in link-up state. With this, C0 is still
      the active one after unplugging C0's cable. LSC AEN packet received
      on C0 when plugging its cable back.
      Signed-off-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bbc7c01e
    • G
      net/ncsi: Fix stale link state of inactive channels on failover · 008a424a
      Gavin Shan 提交于
      The issue was found on BCM5718 which has two NCSI channels in one
      package: C0 and C1. Both of them are connected to different LANs,
      means they are in link-up state and C0 is chosen as the active one
      until resetting BCM5718 happens as below.
      
      Resetting BCM5718 results in LSC (Link State Change) AEN packet
      received on C0, meaning LSC AEN is missed on C1. When LSC AEN packet
      received on C0 to report link-down, it fails over to C1 because C1
      is in link-up state as software can see. However, C1 is in link-down
      state in hardware. It means the link state is out of synchronization
      between hardware and software, resulting in inappropriate channel (C1)
      selected as active one.
      
      This resolves the issue by sending separate GLS (Get Link Status)
      commands to all channels in the package before trying to do failover.
      The last link states of all channels in the package are retrieved.
      With it, C0 (not C1) is selected as active one as expected.
      Signed-off-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      008a424a
    • G
      net/ncsi: Avoid if statements in ncsi_suspend_channel() · 7ba5c003
      Gavin Shan 提交于
      There are several if/else statements in the state machine implemented
      by switch/case in ncsi_suspend_channel() to avoid duplicated code. It
      makes the code a bit hard to be understood.
      
      This drops if/else statements in ncsi_suspend_channel() to improve the
      code readability as Joel Stanley suggested. Also, it becomes easy to
      add more states in the state machine without affecting current code.
      No logical changes introduced by this.
      Suggested-by: NJoel Stanley <joel@jms.id.au>
      Signed-off-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7ba5c003
  3. 04 10月, 2016 7 次提交
  4. 26 7月, 2016 1 次提交
    • A
      net/ncsi: avoid maybe-uninitialized warning · a1b43edd
      Arnd Bergmann 提交于
      gcc-4.9 and higher warn about the newly added NSCI code:
      
      net/ncsi/ncsi-manage.c: In function 'ncsi_process_next_channel':
      net/ncsi/ncsi-manage.c:1003:2: error: 'old_state' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      
      The warning is a false positive and therefore harmless, but it would be good to
      avoid it anyway. I have determined that the barrier in the spin_unlock_irqsave()
      is what confuses gcc to the point that it cannot track whether the variable
      was unused or not.
      
      This rearranges the code in a way that makes it obvious to gcc that old_state
      is always initialized at the time of use, functionally this should not
      change anything.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a1b43edd
  5. 20 7月, 2016 2 次提交
    • G
      net/ncsi: Package and channel management · e6f44ed6
      Gavin Shan 提交于
      This manages NCSI packages and channels:
      
       * The available packages and channels are enumerated in the first
         time of calling ncsi_start_dev(). The channels' capabilities are
         probed in the meanwhile. The NCSI network topology won't change
         until the NCSI device is destroyed.
       * There in a queue in every NCSI device. The element in the queue,
         channel, is waiting for configuration (bringup) or suspending
         (teardown). The channel's state (inactive/active) indicates the
         futher action (configuration or suspending) will be applied on the
         channel. Another channel's state (invisible) means the requested
         action is being applied.
       * The hardware arbitration will be enabled if all available packages
         and channels support it. All available channels try to provide
         service when hardware arbitration is enabled. Otherwise, one channel
         is selected as the active one at once.
       * When channel is in active state, meaning it's providing service, a
         timer started to retrieve the channe's link status. If the channel's
         link status fails to be updated in the determined period, the channel
         is going to be reconfigured. It's the error handling implementation
         as defined in NCSI spec.
      Signed-off-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      Acked-by: NJoel Stanley <joel@jms.id.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e6f44ed6
    • G
      net/ncsi: Resource management · 2d283bdd
      Gavin Shan 提交于
      NCSI spec (DSP0222) defines several objects: package, channel, mode,
      filter, version and statistics etc. This introduces the data structs
      to represent those objects and implement functions to manage them.
      Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
      stack.
      
         * The user (e.g. netdev driver) dereference NCSI device by
           "struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
           The later one is used by NCSI stack internally.
         * Every NCSI device can have multiple packages simultaneously, up
           to 8 packages. It's represented by "struct ncsi_package" and
           identified by 3-bits ID.
         * Every NCSI package can have multiple channels, up to 32. It's
           represented by "struct ncsi_channel" and identified by 5-bits ID.
         * Every NCSI channel has version, statistics, various modes and
           filters. They are represented by "struct ncsi_channel_version",
           "struct ncsi_channel_stats", "struct ncsi_channel_mode" and
           "struct ncsi_channel_filter" separately.
         * Apart from AEN (Asynchronous Event Notification), the NCSI stack
           works in terms of command and response. This introduces "struct
           ncsi_req" to represent a complete NCSI transaction made of NCSI
           request and response.
      
      link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdfSigned-off-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      Acked-by: NJoel Stanley <joel@jms.id.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2d283bdd