1. 10 Jul, 2020 4 commits
    • Jakub Kicinski's avatar
      ethtool: add tunnel info interface · c7d759eb
      Jakub Kicinski authored
      Add an interface to report offloaded UDP ports via ethtool netlink.
      
      Now that core takes care of tracking which UDP tunnel ports the NICs
      are aware of we can quite easily export this information out to
      user space.
      
      The responsibility of writing the netlink dumps is split between
      ethtool code and udp_tunnel_nic.c - since udp_tunnel module may
      not always be loaded, yet we should always report the capabilities
      of the NIC.
      
      $ ethtool --show-tunnels eth0
      Tunnel information for eth0:
        UDP port table 0:
          Size: 4
          Types: vxlan
          No entries
        UDP port table 1:
          Size: 4
          Types: geneve, vxlan-gpe
          Entries (1):
              port 1230, vxlan-gpe
      
      v4:
       - back to v2, build fix is now directly in udp_tunnel.h
      v3:
       - don't compile ETHTOOL_MSG_TUNNEL_INFO_GET in if CONFIG_INET
         not set.
      v2:
       - fix string set count,
       - reorder enums in the uAPI,
       - fix type of ETHTOOL_A_TUNNEL_UDP_TABLE_TYPES to bitset
         in docs and comments.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c7d759eb
    • Jakub Kicinski's avatar
      udp_tunnel: add central NIC RX port offload infrastructure · cc4e3835
      Jakub Kicinski authored
      Cater to devices which:
       (a) may want to sleep in the callbacks;
       (b) only have IPv4 support;
       (c) need all the programming to happen while the netdev is up.
      
      Drivers attach UDP tunnel offload info struct to their netdevs,
      where they declare how many UDP ports of various tunnel types
      they support. Core takes care of tracking which ports to offload.
      
      Use a fixed-size array since this matches what almost all drivers
      do, and avoids a complexity and uncertainty around memory allocations
      in an atomic context.
      
      Make sure that tunnel drivers don't try to replay the ports when
      new NIC netdev is registered. Automatic replays would mess up
      reference counting, and will be removed completely once all drivers
      are converted.
      
      v4:
       - use a #define NULL to avoid build issues with CONFIG_INET=n.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cc4e3835
    • Jakub Kicinski's avatar
      udp_tunnel: re-number the offload tunnel types · 84a4160e
      Jakub Kicinski authored
      Make it possible to use tunnel types as flags more easily.
      There doesn't appear to be any user using the type as an
      array index, so this should make no difference.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      84a4160e
    • Jakub Kicinski's avatar
      debugfs: make sure we can remove u32_array files cleanly · a2b992c8
      Jakub Kicinski authored
      debugfs_create_u32_array() allocates a small structure to wrap
      the data and size information about the array. If users ever
      try to remove the file this leads to a leak since nothing ever
      frees this wrapper.
      
      That said there are no upstream users of debugfs_create_u32_array()
      that'd remove a u32 array file (we only have one u32 array user in
      CMA), so there is no real bug here.
      
      Make callers pass a wrapper they allocated. This way the lifetime
      management of the wrapper is on the caller, and we can avoid the
      potential leak in debugfs.
      
      CC: Chucheng Luo <luochucheng@vivo.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a2b992c8
  2. 09 Jul, 2020 18 commits
  3. 08 Jul, 2020 18 commits