1. 10 Sep, 2020 9 commits
    • Jakub Kicinski's avatar
      net: remove napi_hash_del() from driver-facing API · 5198d545
      Jakub Kicinski authored
      We allow drivers to call napi_hash_del() before calling
      netif_napi_del() to batch RCU grace periods. This makes
      the API asymmetric and leaks internal implementation details.
      Soon we will want the grace period to protect more than just
      the NAPI hash table.
      
      Restructure the API and have drivers call a new function -
      __netif_napi_del() if they want to take care of RCU waits.
      
      Note that only core was checking the return status from
      napi_hash_del() so the new helper does not report if the
      NAPI was actually deleted.
      
      Some notes on driver oddness:
       - veth observed the grace period before calling netif_napi_del()
         but that should not matter
       - myri10ge observed normal RCU flavor
       - bnx2x and enic did not actually observe the grace period
         (unless they did so implicitly)
       - virtio_net and enic only unhashed Rx NAPIs
      
      The last two points seem to indicate that the calls to
      napi_hash_del() were a left over rather than an optimization.
      Regardless, it's easy enough to correct them.
      
      This patch may introduce extra synchronize_net() calls for
      interfaces which set NAPI_STATE_NO_BUSY_POLL and depend on
      free_netdev() to call netif_napi_del(). This seems inevitable
      since we want to use RCU for netpoll dev->napi_list traversal,
      and almost no drivers set IFF_DISABLE_NETPOLL.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5198d545
    • David S. Miller's avatar
      Merge branch 'mlx4-avoid-devlink-port-type-not-set-warnings' · 8b40f21b
      David S. Miller authored
      Jakub Kicinski says:
      
      ====================
      mlx4: avoid devlink port type not set warnings
      
      This small set addresses the issue of mlx4 potentially not setting
      devlink port type when Ethernet or IB driver is not built, but
      port has that type.
      
      v2:
       - add patch 1
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8b40f21b
    • Jakub Kicinski's avatar
      mlx4: make sure to always set the port type · 0313c7c2
      Jakub Kicinski authored
      Even tho mlx4_core registers the devlink ports, it's mlx4_en
      and mlx4_ib which set their type. In situations where one of
      the two is not built yet the machine has ports of given type
      we see the devlink warning from devlink_port_type_warn() trigger.
      
      Having ports of a type not supported by the kernel may seem
      surprising, but it does occur in practice - when the unsupported
      port is not plugged in to a switch anyway users are more than happy
      not to see it (and potentially allocate any resources to it).
      
      Set the type in mlx4_core if type-specific driver is not built.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Reviewed-by: default avatarTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0313c7c2
    • Jakub Kicinski's avatar
      devlink: don't crash if netdev is NULL · 3ea87ca7
      Jakub Kicinski authored
      Following change will add support for a corner case where
      we may not have a netdev to pass to devlink_port_type_eth_set()
      but we still want to set port type.
      
      This is definitely a corner case, and drivers should not normally
      pass NULL netdev - print a warning message when this happens.
      
      Sadly for other port types (ib) switches don't have a device
      reference, the way we always do for Ethernet, so we can't put
      the warning in __devlink_port_type_set().
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3ea87ca7
    • Lorenzo Bianconi's avatar
      net: mvneta: rely on MVNETA_MAX_RX_BUF_SIZE for pkt split in mvneta_swbm_rx_frame() · 6eb8b7fb
      Lorenzo Bianconi authored
      In order to easily change the rx buffer size, rely on
      MVNETA_MAX_RX_BUF_SIZE instead of PAGE_SIZE in mvneta_swbm_rx_frame
      routine for rx buffer split. Currently this is not an issue since we set
      MVNETA_MAX_RX_BUF_SIZE to PAGE_SIZE - MVNETA_SKB_PAD but it is a good to
      have to configure a different rx buffer size.
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6eb8b7fb
    • David S. Miller's avatar
      Merge branch 'Allow-more-than-255-IPv4-multicast-interfaces' · 8c5c49a6
      David S. Miller authored
      Paul Davey says:
      
      ====================
      Allow more than 255 IPv4 multicast interfaces
      
      Currently it is not possible to use more than 255 multicast interfaces
      for IPv4 due to the format of the igmpmsg header which only has 8 bits
      available for the VIF ID.  There is space available in the igmpmsg
      header to store the full VIF ID in the form of an unused byte following
      the VIF ID field.  There is also enough space for the full VIF ID in
      the Netlink cache notifications, however the value is currently taken
      directly from the igmpmsg header and has thus already been truncated.
      
      Adding the high byte of the VIF ID into the unused3 byte of igmpmsg
      allows use of more than 255 IPv4 multicast interfaces. The full VIF ID
      is  also available in the Netlink notification by assembling it from
      both bytes from the igmpmsg.
      
      Additionally this reveals a deficiency in the Netlink cache report
      notifications, they lack any means for differentiating cache reports
      relating to different multicast routing tables.  This is easily
      resolved by adding the multicast route table ID to the cache reports.
      
      changes in v2:
       - Added high byte of VIF ID to igmpmsg struct replacing unused3
         member.
       - Assemble VIF ID in Netlink notification from both bytes in igmpmsg
         header.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8c5c49a6
    • Paul Davey's avatar
      ipmr: Use full VIF ID in netlink cache reports · bb82067c
      Paul Davey authored
      Insert the full 16 bit VIF ID into ipmr Netlink cache reports.
      
      The VIF_ID attribute has 32 bits of space so can store the full VIF ID
      extracted from the high and low byte fields in the igmpmsg.
      Signed-off-by: default avatarPaul Davey <paul.davey@alliedtelesis.co.nz>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bb82067c
    • Paul Davey's avatar
      ipmr: Add high byte of VIF ID to igmpmsg · c8715a8e
      Paul Davey authored
      Use the unused3 byte in struct igmpmsg to hold the high 8 bits of the
      VIF ID.
      
      If using more than 255 IPv4 multicast interfaces it is necessary to have
      access to a VIF ID for cache reports that is wider than 8 bits, the VIF
      ID present in the igmpmsg reports sent to mroute_sk was only 8 bits wide
      in the igmpmsg header.  Adding the high 8 bits of the 16 bit VIF ID in
      the unused byte allows use of more than 255 IPv4 multicast interfaces.
      Signed-off-by: default avatarPaul Davey <paul.davey@alliedtelesis.co.nz>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c8715a8e
    • Paul Davey's avatar
      ipmr: Add route table ID to netlink cache reports · 501cb008
      Paul Davey authored
      Insert the multicast route table ID as a Netlink attribute to Netlink
      cache report notifications.
      
      When multiple route tables are in use it is necessary to have a way to
      determine which route table a given cache report belongs to when
      receiving the cache report.
      Signed-off-by: default avatarPaul Davey <paul.davey@alliedtelesis.co.nz>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      501cb008
  2. 09 Sep, 2020 31 commits