drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c- Extension
.c- Size
- 31390 bytes
- Lines
- 1174
- 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.
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/err.hlinux/gfp.hlinux/kernel.hlinux/list.hlinux/netlink.hlinux/rtnetlink.hlinux/slab.hnet/inet_ecn.hnet/ipv6.hreg.hspectrum.hspectrum_nve.h
Detected Declarations
struct mlxsw_sp_nve_mc_entrystruct mlxsw_sp_nve_mc_recordstruct mlxsw_sp_nve_mc_liststruct mlxsw_sp_nve_mc_record_opsstruct mlxsw_sp_nve_mc_list_keystruct mlxsw_sp_nve_mc_ipv6_entrystruct mlxsw_sp_nve_mc_entrystruct mlxsw_sp_nve_mc_recordstruct mlxsw_sp_nve_mc_liststruct mlxsw_sp_nve_ipv6_ht_keystruct mlxsw_sp_nve_ipv6_ht_nodefunction mlxsw_sp_nve_mc_record_ipv4_entry_addfunction mlxsw_sp_nve_mc_record_ipv4_entry_delfunction mlxsw_sp_nve_mc_record_ipv4_entry_comparefunction mlxsw_sp_nve_mc_record_ipv6_entry_addfunction mlxsw_sp_nve_mc_record_ipv6_entry_delfunction mlxsw_sp_nve_mc_record_ipv6_entry_setfunction mlxsw_sp_nve_mc_record_ipv6_entry_comparefunction mlxsw_sp_nve_learned_ip_resolvefunction mlxsw_sp_nve_mc_list_findfunction mlxsw_sp_nve_mc_list_createfunction mlxsw_sp_nve_mc_list_destroyfunction mlxsw_sp_nve_mc_list_getfunction mlxsw_sp_nve_mc_list_putfunction mlxsw_sp_nve_mc_record_createfunction mlxsw_sp_nve_mc_record_destroyfunction mlxsw_sp_nve_mc_record_getfunction list_for_each_entry_reversefunction mlxsw_sp_nve_mc_record_putfunction mlxsw_sp_nve_mc_free_entry_findfunction mlxsw_sp_nve_mc_record_refreshfunction mlxsw_sp_nve_mc_record_is_firstfunction mlxsw_sp_nve_mc_entry_findfunction mlxsw_sp_nve_mc_record_ip_addfunction mlxsw_sp_nve_mc_record_entry_delfunction mlxsw_sp_nve_mc_record_findfunction list_for_each_entryfunction mlxsw_sp_nve_mc_list_ip_addfunction mlxsw_sp_nve_mc_list_ip_delfunction mlxsw_sp_nve_fid_flood_index_setfunction mlxsw_sp_nve_fid_flood_index_clearfunction mlxsw_sp_nve_flood_ip_addfunction mlxsw_sp_nve_flood_ip_delfunction mlxsw_sp_nve_mc_record_deletefunction mlxsw_sp_nve_flood_ip_flushfunction mlxsw_sp_nve_tunnel_initfunction mlxsw_sp_nve_tunnel_finifunction mlxsw_sp_nve_fdb_flush_by_fid
Annotated Snippet
struct mlxsw_sp_nve_mc_record_ops {
enum mlxsw_reg_tnumt_record_type type;
int (*entry_add)(struct mlxsw_sp_nve_mc_record *mc_record,
struct mlxsw_sp_nve_mc_entry *mc_entry,
const union mlxsw_sp_l3addr *addr);
void (*entry_del)(const struct mlxsw_sp_nve_mc_record *mc_record,
const struct mlxsw_sp_nve_mc_entry *mc_entry);
void (*entry_set)(const struct mlxsw_sp_nve_mc_record *mc_record,
const struct mlxsw_sp_nve_mc_entry *mc_entry,
char *tnumt_pl, unsigned int entry_index);
bool (*entry_compare)(const struct mlxsw_sp_nve_mc_record *mc_record,
const struct mlxsw_sp_nve_mc_entry *mc_entry,
const union mlxsw_sp_l3addr *addr);
};
struct mlxsw_sp_nve_mc_list_key {
u16 fid_index;
};
struct mlxsw_sp_nve_mc_ipv6_entry {
struct in6_addr addr6;
u32 addr6_kvdl_index;
};
struct mlxsw_sp_nve_mc_entry {
union {
__be32 addr4;
struct mlxsw_sp_nve_mc_ipv6_entry ipv6_entry;
};
u8 valid:1;
};
struct mlxsw_sp_nve_mc_record {
struct list_head list;
enum mlxsw_sp_l3proto proto;
unsigned int num_entries;
struct mlxsw_sp *mlxsw_sp;
struct mlxsw_sp_nve_mc_list *mc_list;
const struct mlxsw_sp_nve_mc_record_ops *ops;
u32 kvdl_index;
struct mlxsw_sp_nve_mc_entry entries[];
};
struct mlxsw_sp_nve_mc_list {
struct list_head records_list;
struct rhash_head ht_node;
struct mlxsw_sp_nve_mc_list_key key;
};
static const struct rhashtable_params mlxsw_sp_nve_mc_list_ht_params = {
.key_len = sizeof(struct mlxsw_sp_nve_mc_list_key),
.key_offset = offsetof(struct mlxsw_sp_nve_mc_list, key),
.head_offset = offsetof(struct mlxsw_sp_nve_mc_list, ht_node),
};
static int
mlxsw_sp_nve_mc_record_ipv4_entry_add(struct mlxsw_sp_nve_mc_record *mc_record,
struct mlxsw_sp_nve_mc_entry *mc_entry,
const union mlxsw_sp_l3addr *addr)
{
mc_entry->addr4 = addr->addr4;
return 0;
}
static void
mlxsw_sp_nve_mc_record_ipv4_entry_del(const struct mlxsw_sp_nve_mc_record *mc_record,
const struct mlxsw_sp_nve_mc_entry *mc_entry)
{
}
static void
mlxsw_sp_nve_mc_record_ipv4_entry_set(const struct mlxsw_sp_nve_mc_record *mc_record,
const struct mlxsw_sp_nve_mc_entry *mc_entry,
char *tnumt_pl, unsigned int entry_index)
{
u32 udip = be32_to_cpu(mc_entry->addr4);
mlxsw_reg_tnumt_udip_set(tnumt_pl, entry_index, udip);
}
static bool
mlxsw_sp_nve_mc_record_ipv4_entry_compare(const struct mlxsw_sp_nve_mc_record *mc_record,
const struct mlxsw_sp_nve_mc_entry *mc_entry,
const union mlxsw_sp_l3addr *addr)
{
return mc_entry->addr4 == addr->addr4;
}
static const struct mlxsw_sp_nve_mc_record_ops
Annotation
- Immediate include surface: `linux/err.h`, `linux/gfp.h`, `linux/kernel.h`, `linux/list.h`, `linux/netlink.h`, `linux/rtnetlink.h`, `linux/slab.h`, `net/inet_ecn.h`.
- Detected declarations: `struct mlxsw_sp_nve_mc_entry`, `struct mlxsw_sp_nve_mc_record`, `struct mlxsw_sp_nve_mc_list`, `struct mlxsw_sp_nve_mc_record_ops`, `struct mlxsw_sp_nve_mc_list_key`, `struct mlxsw_sp_nve_mc_ipv6_entry`, `struct mlxsw_sp_nve_mc_entry`, `struct mlxsw_sp_nve_mc_record`, `struct mlxsw_sp_nve_mc_list`, `struct mlxsw_sp_nve_ipv6_ht_key`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.