1. 29 Mar, 2017 34 commits
  2. 28 Mar, 2017 6 commits
    • David S. Miller's avatar
      Merge tag 'mlx5e-failsafe' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux · cc628c96
      David S. Miller authored
      Saeed Mahameed says:
      
      ====================
      mlx5e-failsafe 27-03-2017
      
      This series provides a fail-safe mechanism to allow safely re-configuring
      mlx5e netdevice and provides a resiliency against sporadic
      configuration failures.
      
      To enable this we do some refactoring and code reorganizing to allow
      breaking the drivers open/close flows to stages:
            open -> activate -> deactivate -> close.
      
      In addition we need to allow creating fresh HW ring resources
      (mlx5e_channels) with their own "new" set of parameters, while keeping
      the current ones running and active until the new channels are
      successfully created with the new configuration, and only then we can
      safly replace (switch) old channels with new ones.
      
      For that we introduce mlx5e_channels object and an API to manage it:
       - channels = open_channels(new_params):
         open fresh TX/RX channels
       - activate_channels(channels):
         redirect traffic to them and attach them to the netdev
       - deactivate_channes(channels)
         stop traffic and detach from netdev
       - close(channels)
         Free the TX/RX HW resources of those channels
      
      With the above strategy it is straightforward to achieve the desired
      behavior of fail-safe configuration.  In pseudo code:
      
      make_new_config(new_params)
      {
      	old_channels = current_active_channels;
      	new_channels = create_channels(new_params);
      	if (!new_channels)
      		return "Failed, but current channels are still active :)"
      
      	deactivate_channels(old_channels); /* Can't fail */
      	set_hw_new_state();                /* If needed  */
      	activate_channels(new_channels);   /* Can't fail */
      	close_channels(old_channels);
      	current_active_channels = new_channels;
      
              return "SUCCESS";
      }
      
      At the top of this series, we change the following flows to be fail-safe:
      ethtool:
         - ring parameters
         - coalesce parameters
         - tx copy break parameters
         - cqe compressing/moderation mode setting (priv flags)
      ndos:
         - tc setup
         - set features: LRO
         - change mtu
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cc628c96
    • David S. Miller's avatar
      Merge branch 'bond-link-status-fixes' · 95ed0edd
      David S. Miller authored
      Mahesh Bandewar says:
      
      ====================
      link-status fixes for mii-monitoring
      
      The mii monitoring is divided into two phases - inspect and commit. The
      inspect phase technically should not make any changes to the state and
      defer it to the commit phase. However detected link state inconsistencies
      on several machines and discovered that it's the result of some
      inconsistent update to link states and assumption that you *always* get
      rtnl-mutex. In reality when trylock() fails to acquire rtnl-mutex, the
      commit phase is postponed until next mii-mon run. At the next round
      because of the state change performed in the previous inspect-run, this
      round does not detect any changes and would skip calling commit phase.
      This would result in an inconsistent state until next link event happens
      (if it ever happens).
      
      During the the commit phase, it's always assumed that speed and duplex
      fetch is always successful, but that's always not the case. However the
      slave state is marked UP irrespective of speed / duplex fetch operation.
      If the speed / duplex fetch operation results in insane values for either
      of these two fields, then keeping internal link state UP is not going to
      provide fruitful results either.
      
      Please see into individual patches for more details.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      95ed0edd
    • Mahesh Bandewar's avatar
    • Mahesh Bandewar's avatar
      bonding: correctly update link status during mii-commit phase · b5bf0f5b
      Mahesh Bandewar authored
      bond_miimon_commit() marks the link UP after attempting to get the speed
      and duplex settings for the link. There is a possibility that
      bond_update_speed_duplex() could fail. This is another place where it
      could result into an inconsistent bonding link state.
      
      With this patch the link will be marked UP only if the speed and duplex
      values retrieved have sane values and processed further.
      Signed-off-by: default avatarMahesh Bandewar <maheshb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b5bf0f5b
    • Mahesh Bandewar's avatar
      bonding: make speed, duplex setting consistent with link state · c4adfc82
      Mahesh Bandewar authored
      bond_update_speed_duplex() retrieves speed and duplex settings. There
      is a possibility of failure in retrieving these values but caller has
      to assume it's always successful. This leads to having inconsistent
      slave link settings. If these (speed, duplex) values cannot be
      retrieved, then keeping the link UP causes problems.
      
      The updated bond_update_speed_duplex() returns 0 on success if it
      retrieves sane values for speed and duplex. On failure it returns 1
      and marks the link down.
      Signed-off-by: default avatarMahesh Bandewar <maheshb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c4adfc82
    • Mahesh Bandewar's avatar
      bonding: improve link-status update in mii-monitoring · de77ecd4
      Mahesh Bandewar authored
      The primary issue is that mii-inspect phase updates link-state and
      expects changes to be committed during the mii-commit phase. After
      the inspect phase if it fails to acquire rtnl-mutex, the commit
      phase (bond_mii_commit) doesn't get to run. This partially updated
      state stays and makes the internal-state inconsistent.
      
      e.g. setup bond0 => slaves: eth1, eth2
      eth1 goes DOWN -> UP
         mii_monitor()
      	mii-inspect()
      	    bond_set_slave_link_state(eth1, UP, DontNotify)
      	rtnl_trylock() <- fails!
      
      Next mii-monitor round
      eth1: No change
         mii_monitor()
      	mii-inspect()
      	    eth1->link == current-status (ethtool_ops->get_link)
      	    no-change-detected
      
      End result:
          eth1:
            Link = BOND_LINK_UP
            Speed = 0xfffff  [SpeedUnknown]
            Duplex = 0xff    [DuplexUnknown]
      
      This doesn't always happen but for some unlucky machines in a large set
      of machines it creates problems.
      
      The fix for this is to avoid making changes during inspect phase and
      postpone them until acquiring the rtnl-mutex / invoking commit phase.
      Signed-off-by: default avatarMahesh Bandewar <maheshb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      de77ecd4