drivers/net/vxlan/vxlan_mdb.c

Source file repositories/reference/linux-study-clean/drivers/net/vxlan/vxlan_mdb.c

File Facts

System
Linux kernel
Corpus path
drivers/net/vxlan/vxlan_mdb.c
Extension
.c
Size
44829 bytes
Lines
1747
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct vxlan_mdb_entry_key {
	union vxlan_addr src;
	union vxlan_addr dst;
	__be32 vni;
};

struct vxlan_mdb_entry {
	struct rhash_head rhnode;
	struct list_head remotes;
	struct vxlan_mdb_entry_key key;
	struct hlist_node mdb_node;
	struct rcu_head rcu;
};

#define VXLAN_MDB_REMOTE_F_BLOCKED	BIT(0)

struct vxlan_mdb_remote {
	struct list_head list;
	struct vxlan_rdst __rcu *rd;
	u8 flags;
	u8 filter_mode;
	u8 rt_protocol;
	struct hlist_head src_list;
	struct rcu_head rcu;
};

#define VXLAN_SGRP_F_DELETE	BIT(0)

struct vxlan_mdb_src_entry {
	struct hlist_node node;
	union vxlan_addr addr;
	u8 flags;
};

struct vxlan_mdb_dump_ctx {
	long reserved;
	long entry_idx;
	long remote_idx;
};

struct vxlan_mdb_config_src_entry {
	union vxlan_addr addr;
	struct list_head node;
};

struct vxlan_mdb_config {
	struct vxlan_dev *vxlan;
	struct vxlan_mdb_entry_key group;
	struct list_head src_list;
	union vxlan_addr remote_ip;
	u32 remote_ifindex;
	__be32 remote_vni;
	__be16 remote_port;
	u16 nlflags;
	u8 flags;
	u8 filter_mode;
	u8 rt_protocol;
};

struct vxlan_mdb_flush_desc {
	union vxlan_addr remote_ip;
	__be32 src_vni;
	__be32 remote_vni;
	__be16 remote_port;
	u8 rt_protocol;
};

static const struct rhashtable_params vxlan_mdb_rht_params = {
	.head_offset = offsetof(struct vxlan_mdb_entry, rhnode),
	.key_offset = offsetof(struct vxlan_mdb_entry, key),
	.key_len = sizeof(struct vxlan_mdb_entry_key),
	.automatic_shrinking = true,
};

static int __vxlan_mdb_add(const struct vxlan_mdb_config *cfg,
			   struct netlink_ext_ack *extack);
static int __vxlan_mdb_del(const struct vxlan_mdb_config *cfg,
			   struct netlink_ext_ack *extack);

static void vxlan_br_mdb_entry_fill(const struct vxlan_dev *vxlan,
				    const struct vxlan_mdb_entry *mdb_entry,
				    const struct vxlan_mdb_remote *remote,
				    struct br_mdb_entry *e)
{
	const union vxlan_addr *dst = &mdb_entry->key.dst;

	memset(e, 0, sizeof(*e));
	e->ifindex = vxlan->dev->ifindex;
	e->state = MDB_PERMANENT;

Annotation

Implementation Notes