History

udp_tunnel: add central NIC RX port offload infrastructure

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.

Jakub Kicinski committed 6 years ago

Commit cc4e3831 parent 84a41608 files · +983 −5Browse files

Showing the changes to include/linux (1 of 8 files). Show all

Unified · Split

include/linux/netdevice.h+8−0
@@ -65,6 +65,8 @@ struct wpan_dev; · 64 unmodified lines
6565 struct mpls_dev;
6666 /* UDP Tunnel offloads */
6767 struct udp_tunnel_info;
68+struct udp_tunnel_nic_info;
69+struct udp_tunnel_nic;
6870 struct bpf_prog;
6971 struct xdp_buff;
7072
@@ -1836,6 +1838,10 @@ enum netdev_priv_flags { · 1765 unmodified lines
18361838 *
18371839 * @macsec_ops: MACsec offloading ops
18381840 *
1841+ * @udp_tunnel_nic_info: static structure describing the UDP tunnel
1842+ * offload capabilities of the device
1843+ * @udp_tunnel_nic: UDP tunnel offload state
1844+ *
18391845 * FIXME: cleanup struct net_device such that network protocol info
18401846 * moves out.
18411847 */
@@ -2134,6 +2140,8 @@ struct net_device { · 292 unmodified lines
21342140 /* MACsec management functions */
21352141 const struct macsec_ops *macsec_ops;
21362142 #endif
2143+ const struct udp_tunnel_nic_info *udp_tunnel_nic_info;
2144+ struct udp_tunnel_nic *udp_tunnel_nic;
21372145 };
21382146 #define to_net_dev(d) container_of(d, struct net_device, dev)
21392147