STRUCT UDP_TUNNEL_NIC_INFO(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME 🌸

struct udp_tunnel_nic_info β€” the driver-side tea on UDP tunnel offload info πŸ’… (straight out of the Kernel API Manual, bestie, this is the real deal ✨)


✨ SYNOPSIS ✨

struct udp_tunnel_nic_info {
    int (*set_port)(struct net_device *dev, unsigned int table, unsigned int entry, struct udp_tunnel_info *ti);
    int (*unset_port)(struct net_device *dev, unsigned int table, unsigned int entry, struct udp_tunnel_info *ti);
    int (*sync_table)(struct net_device *dev, unsigned int table);
    struct udp_tunnel_nic_shared *shared;
    unsigned int flags;
    struct udp_tunnel_nic_table_info {
      unsigned int n_entries;
      unsigned int tunnel_types;
    } tables[UDP_TUNNEL_NIC_MAX_TABLES];
 };

πŸŽ€ MEMBERS πŸŽ€

okay so here's the whole cast, no skips, iykyk πŸ‘‘

  • set_port β€” the callback that adds a new port 🫢
  • unset_port β€” the callback that removes a port πŸ™ˆ
  • sync_table β€” the callback that syncs the entire port table all at once, one big slay πŸ”₯
  • shared β€” a reference to device global state, and it's optional (so lowkey you can skip it) πŸ’œ
  • flags β€” device flags, and they come from enum udp_tunnel_nic_info_flags ⭐
  • tables β€” the UDP port tables this device has πŸŽ€
  • tables.n_entries β€” how many entries live in this table, literally the count πŸ’…
  • tables.tunnel_types β€” which types of tunnels this table accepts, the vibe check of tunnels 🌈

πŸ’– DESCRIPTION πŸ’–

so the way this works: drivers are expected to provide either set_port and unset_port callbacks or the sync_table callback. like, pick a lane bestie. and heads up β€” callbacks are invoked with the rtnl lock held πŸ”’

now, devices which (misguidedly πŸ‘€) share the UDP tunnel port table across multiple netdevs should allocate an instance of struct udp_tunnel_nic_shared and point shared at it. and the rule is: there must never be more than UDP_TUNNEL_NIC_MAX_SHARING_DEVICES devices sharing a table. that's the limit, periodt πŸ’€

⚠️ Known limitations ⚠️

  • UDP tunnel port notifications are fundamentally best-effort β€” it is likely the driver will both see skbs which use a UDP tunnel port, while not being a tunneled skb, and tunnel skbs from other ports 😭 so drivers should only use these ports for non-critical RX-side offloads, e.g. the checksum offload. non-critical only, bestie, don't get cute with it πŸ™
  • none of the devices care about the socket family at present, so we don't track it. please extend this code if you care 🫢 (like, if that's your thing, go off πŸ‘‘)

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./include/net/udp_tunnel.h and udp_tunnel_nic_reset_ntf(9) β€” go read those next, they ate πŸ’…βœ¨


and that's a wrap, bestie πŸŽ€ this page lives in ./include/net, dated October 2026, and it's struct udp_tunnel_nic_info(9) in all its main character glory β€” go off, you understood the assignment πŸ’–πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from