1. Dec 08, 2018
  2. Dec 07, 2018
    • David S. Miller's avatar
      Merge branch 'Pass-extack-to-NETDEV_PRE_UP' · ef2df7fc
      David S. Miller authored
      
      
      Petr Machata says:
      
      ====================
      Pass extack to NETDEV_PRE_UP
      
      Drivers may need to validate configuration of a device that's about to
      be upped. An example is mlxsw, which needs to check the configuration of
      a VXLAN device attached to an offloaded bridge. Should the validation
      fail, there's currently no way to communicate details of the failure to
      the user, beyond an error number.
      
      Therefore this patch set extends the NETDEV_PRE_UP event to include
      extack, if available.
      
      There are three vectors through which NETDEV_PRE_UP invocation can be
      reached. The two major ones are dev_open() and dev_change_flags(), the
      last is then __dev_change_flags().
      
      In patch #1, the first access vector, dev_open() is addressed. An extack
      parameter is added and all users converted to use it.
      
      Before addressing the second vector, two preparatory patches propagate
      extack argument to the proximity of the dev_change_flags() call in VRF
      and IPVLAN drivers. That happens in patches #2 and #3. Then in patch #4,
      dev_change_flags() is treated similarly to dev_open().
      
      Likewise in patch #5, __dev_change_flags() is extended.
      
      Then in patches #6 and #7, the extack is finally propagated all the way
      to the point where the notification is emitted.
      
      This change allows particularly mlxsw (which already has code to
      leverage extack if available) to communicate to the user error messages
      regarding VXLAN configuration. In patch #8, add a test case that
      exercises this code and checks that an error message is propagated.
      
      For example:
      
      	local 192.0.2.17 remote 192.0.2.18 \
      	dstport 4789 nolearning noudpcsum tos inherit ttl 100
      	local 192.0.2.17 remote 192.0.2.18 \
      	dstport 4789 nolearning noudpcsum tos inherit ttl 100
      Error: mlxsw_spectrum: Conflicting NVE tunnels configuration.
      
      v2:
      - Add David Ahern's tags.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ef2df7fc
    • Petr Machata's avatar
      selftests: mlxsw: Add a new test extack.sh · 1ba1daed
      Petr Machata authored
      
      
      Add a testsuite dedicated to testing extack propagation and related
      functionality.
      
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1ba1daed
    • Petr Machata's avatar
      net: core: dev: Attach extack to NETDEV_PRE_UP · 40c900aa
      Petr Machata authored
      
      
      Drivers may need to validate configuration of a device that's about to
      be upped. Should the validation fail, there's currently no way to
      communicate details of the failure to the user, beyond an error number.
      
      To mend that, change __dev_open() to take an extack argument and pass it
      from __dev_change_flags() and dev_open(), where it was propagated in the
      previous patches.
      
      Change __dev_open() to call call_netdevice_notifiers_extack() so that
      the passed-in extack is attached to the NETDEV_PRE_UP notifier.
      
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      40c900aa
    • Petr Machata's avatar
      net: core: dev: Add call_netdevice_notifiers_extack() · 26372605
      Petr Machata authored
      
      
      In order to propagate extack through NETDEV_PRE_UP, add a new function
      call_netdevice_notifiers_extack() that primes the extack field of the
      notifier info. Convert call_netdevice_notifiers() to a simple wrapper
      around the new function that passes NULL for extack.
      
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      26372605
    • Petr Machata's avatar
      net: core: dev: Add extack argument to __dev_change_flags() · 6d040321
      Petr Machata authored
      
      
      In order to pass extack together with NETDEV_PRE_UP notifications, it's
      necessary to route the extack to __dev_open() from diverse (possibly
      indirect) callers. The last missing API is __dev_change_flags().
      
      Therefore extend __dev_change_flags() with and extra extack argument and
      update the two existing users.
      
      Since the function declaration line is changed anyway, name the struct
      net_device argument to placate checkpatch.
      
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6d040321