udp_tunnel.h (0ea8a56de21be24cb79abb03dee79aabcd60a316) | udp_tunnel.h (74cc6d182d038cbba6c6d91beb1b2bab926b618b) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef __NET_UDP_TUNNEL_H 3#define __NET_UDP_TUNNEL_H 4 5#include <net/ip_tunnels.h> 6#include <net/udp.h> 7 8#if IS_ENABLED(CONFIG_IPV6) --- 186 unchanged lines hidden (view full) --- 195 UDP_TUNNEL_NIC_INFO_IPV4_ONLY = BIT(2), 196 /* Device has hard-coded the IANA VXLAN port (4789) as VXLAN. 197 * This port must not be counted towards n_entries of any table. 198 * Driver will not receive any callback associated with port 4789. 199 */ 200 UDP_TUNNEL_NIC_INFO_STATIC_IANA_VXLAN = BIT(3), 201}; 202 | 1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef __NET_UDP_TUNNEL_H 3#define __NET_UDP_TUNNEL_H 4 5#include <net/ip_tunnels.h> 6#include <net/udp.h> 7 8#if IS_ENABLED(CONFIG_IPV6) --- 186 unchanged lines hidden (view full) --- 195 UDP_TUNNEL_NIC_INFO_IPV4_ONLY = BIT(2), 196 /* Device has hard-coded the IANA VXLAN port (4789) as VXLAN. 197 * This port must not be counted towards n_entries of any table. 198 * Driver will not receive any callback associated with port 4789. 199 */ 200 UDP_TUNNEL_NIC_INFO_STATIC_IANA_VXLAN = BIT(3), 201}; 202 |
203struct udp_tunnel_nic; 204 205#define UDP_TUNNEL_NIC_MAX_SHARING_DEVICES (U16_MAX / 2) 206 207struct udp_tunnel_nic_shared { 208 struct udp_tunnel_nic *udp_tunnel_nic_info; 209 210 struct list_head devices; 211}; 212 213struct udp_tunnel_nic_shared_node { 214 struct net_device *dev; 215 struct list_head list; 216}; 217 |
|
203/** 204 * struct udp_tunnel_nic_info - driver UDP tunnel offload information 205 * @set_port: callback for adding a new port 206 * @unset_port: callback for removing a port 207 * @sync_table: callback for syncing the entire port table at once | 218/** 219 * struct udp_tunnel_nic_info - driver UDP tunnel offload information 220 * @set_port: callback for adding a new port 221 * @unset_port: callback for removing a port 222 * @sync_table: callback for syncing the entire port table at once |
223 * @shared: reference to device global state (optional) |
|
208 * @flags: device flags from enum udp_tunnel_nic_info_flags 209 * @tables: UDP port tables this device has 210 * @tables.n_entries: number of entries in this table 211 * @tables.tunnel_types: types of tunnels this table accepts 212 * 213 * Drivers are expected to provide either @set_port and @unset_port callbacks 214 * or the @sync_table callback. Callbacks are invoked with rtnl lock held. 215 * | 224 * @flags: device flags from enum udp_tunnel_nic_info_flags 225 * @tables: UDP port tables this device has 226 * @tables.n_entries: number of entries in this table 227 * @tables.tunnel_types: types of tunnels this table accepts 228 * 229 * Drivers are expected to provide either @set_port and @unset_port callbacks 230 * or the @sync_table callback. Callbacks are invoked with rtnl lock held. 231 * |
232 * Devices which (misguidedly) share the UDP tunnel port table across multiple 233 * netdevs should allocate an instance of struct udp_tunnel_nic_shared and 234 * point @shared at it. 235 * There must never be more than %UDP_TUNNEL_NIC_MAX_SHARING_DEVICES devices 236 * sharing a table. 237 * |
|
216 * Known limitations: 217 * - UDP tunnel port notifications are fundamentally best-effort - 218 * it is likely the driver will both see skbs which use a UDP tunnel port, 219 * while not being a tunneled skb, and tunnel skbs from other ports - 220 * drivers should only use these ports for non-critical RX-side offloads, 221 * e.g. the checksum offload; 222 * - none of the devices care about the socket family at present, so we don't 223 * track it. Please extend this code if you care. --- 5 unchanged lines hidden (view full) --- 229 struct udp_tunnel_info *ti); 230 int (*unset_port)(struct net_device *dev, 231 unsigned int table, unsigned int entry, 232 struct udp_tunnel_info *ti); 233 234 /* all at once */ 235 int (*sync_table)(struct net_device *dev, unsigned int table); 236 | 238 * Known limitations: 239 * - UDP tunnel port notifications are fundamentally best-effort - 240 * it is likely the driver will both see skbs which use a UDP tunnel port, 241 * while not being a tunneled skb, and tunnel skbs from other ports - 242 * drivers should only use these ports for non-critical RX-side offloads, 243 * e.g. the checksum offload; 244 * - none of the devices care about the socket family at present, so we don't 245 * track it. Please extend this code if you care. --- 5 unchanged lines hidden (view full) --- 251 struct udp_tunnel_info *ti); 252 int (*unset_port)(struct net_device *dev, 253 unsigned int table, unsigned int entry, 254 struct udp_tunnel_info *ti); 255 256 /* all at once */ 257 int (*sync_table)(struct net_device *dev, unsigned int table); 258 |
259 struct udp_tunnel_nic_shared *shared; 260 |
|
237 unsigned int flags; 238 239 struct udp_tunnel_nic_table_info { 240 unsigned int n_entries; 241 unsigned int tunnel_types; 242 } tables[UDP_TUNNEL_NIC_MAX_TABLES]; 243}; 244 --- 103 unchanged lines hidden --- | 261 unsigned int flags; 262 263 struct udp_tunnel_nic_table_info { 264 unsigned int n_entries; 265 unsigned int tunnel_types; 266 } tables[UDP_TUNNEL_NIC_MAX_TABLES]; 267}; 268 --- 103 unchanged lines hidden --- |