drivers/net/ethernet/mellanox/mlx4/port.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx4/port.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx4/port.c- Extension
.c- Size
- 62201 bytes
- Lines
- 2210
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/errno.hlinux/if_ether.hlinux/if_vlan.hlinux/export.hlinux/mlx4/cmd.hmlx4.hmlx4_stats.h
Detected Declarations
struct mlx4_set_port_vxlan_contextstruct mlx4_cable_infoenum cable_info_errfunction Copyrightfunction mlx4_init_vlan_tablefunction mlx4_init_roce_gid_tablefunction validate_indexfunction find_indexfunction mlx4_set_port_mac_tablefunction mlx4_need_mf_bondfunction __mlx4_register_macfunction mlx4_register_macfunction mlx4_get_base_qpnfunction __mlx4_unregister_macfunction mlx4_unregister_macfunction __mlx4_replace_macfunction mlx4_set_port_vlan_tablefunction mlx4_find_cached_vlanfunction __mlx4_register_vlanfunction mlx4_register_vlanfunction __mlx4_unregister_vlanfunction mlx4_unregister_vlanfunction mlx4_bond_mac_tablefunction mlx4_unbond_mac_tablefunction mlx4_bond_vlan_tablefunction mlx4_unbond_vlan_tablefunction mlx4_get_port_ib_capsfunction mlx4_get_slave_num_gidsfunction mlx4_get_base_gid_ixfunction mlx4_reset_roce_port_gidsfunction mlx4_reset_roce_gidsfunction mlx4_en_set_port_mtufunction mlx4_en_set_port_user_mtufunction mlx4_en_set_port_global_pausefunction mlx4_common_set_portfunction mlx4_SET_PORT_wrapperfunction mlx4_SET_PORTfunction mlx4_SET_PORT_generalfunction mlx4_SET_PORT_qpn_calcfunction mlx4_SET_PORT_user_mtufunction mlx4_SET_PORT_user_macfunction mlx4_SET_PORT_fcs_checkfunction mlx4_SET_PORT_VXLANfunction mlx4_SET_PORT_BEACONfunction mlx4_SET_MCAST_FLTR_wrapperfunction mlx4_SET_MCAST_FLTRfunction mlx4_SET_VLAN_FLTR_wrapperfunction mlx4_DUMP_ETH_STATS_wrapper
Annotated Snippet
struct mlx4_set_port_vxlan_context {
u32 reserved1;
u8 modify_flags;
u8 reserved2;
u8 enable_flags;
u8 steering;
};
int mlx4_SET_PORT_VXLAN(struct mlx4_dev *dev, u8 port, u8 steering, int enable)
{
int err;
u32 in_mod;
struct mlx4_cmd_mailbox *mailbox;
struct mlx4_set_port_vxlan_context *context;
mailbox = mlx4_alloc_cmd_mailbox(dev);
if (IS_ERR(mailbox))
return PTR_ERR(mailbox);
context = mailbox->buf;
memset(context, 0, sizeof(*context));
context->modify_flags = VXLAN_ENABLE_MODIFY | VXLAN_STEERING_MODIFY;
if (enable)
context->enable_flags = VXLAN_ENABLE;
context->steering = steering;
in_mod = MLX4_SET_PORT_VXLAN << 8 | port;
err = mlx4_cmd(dev, mailbox->dma, in_mod, MLX4_SET_PORT_ETH_OPCODE,
MLX4_CMD_SET_PORT, MLX4_CMD_TIME_CLASS_B,
MLX4_CMD_NATIVE);
mlx4_free_cmd_mailbox(dev, mailbox);
return err;
}
EXPORT_SYMBOL(mlx4_SET_PORT_VXLAN);
int mlx4_SET_PORT_BEACON(struct mlx4_dev *dev, u8 port, u16 time)
{
int err;
struct mlx4_cmd_mailbox *mailbox;
mailbox = mlx4_alloc_cmd_mailbox(dev);
if (IS_ERR(mailbox))
return PTR_ERR(mailbox);
*((__be32 *)mailbox->buf) = cpu_to_be32(time);
err = mlx4_cmd(dev, mailbox->dma, port, MLX4_SET_PORT_BEACON_OPCODE,
MLX4_CMD_SET_PORT, MLX4_CMD_TIME_CLASS_B,
MLX4_CMD_NATIVE);
mlx4_free_cmd_mailbox(dev, mailbox);
return err;
}
EXPORT_SYMBOL(mlx4_SET_PORT_BEACON);
int mlx4_SET_MCAST_FLTR_wrapper(struct mlx4_dev *dev, int slave,
struct mlx4_vhcr *vhcr,
struct mlx4_cmd_mailbox *inbox,
struct mlx4_cmd_mailbox *outbox,
struct mlx4_cmd_info *cmd)
{
int err = 0;
return err;
}
int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port,
u64 mac, u64 clear, u8 mode)
{
return mlx4_cmd(dev, (mac | (clear << 63)), port, mode,
MLX4_CMD_SET_MCAST_FLTR, MLX4_CMD_TIME_CLASS_B,
MLX4_CMD_WRAPPED);
}
EXPORT_SYMBOL(mlx4_SET_MCAST_FLTR);
int mlx4_SET_VLAN_FLTR_wrapper(struct mlx4_dev *dev, int slave,
struct mlx4_vhcr *vhcr,
struct mlx4_cmd_mailbox *inbox,
struct mlx4_cmd_mailbox *outbox,
struct mlx4_cmd_info *cmd)
{
int err = 0;
return err;
}
int mlx4_DUMP_ETH_STATS_wrapper(struct mlx4_dev *dev, int slave,
struct mlx4_vhcr *vhcr,
struct mlx4_cmd_mailbox *inbox,
Annotation
- Immediate include surface: `linux/errno.h`, `linux/if_ether.h`, `linux/if_vlan.h`, `linux/export.h`, `linux/mlx4/cmd.h`, `mlx4.h`, `mlx4_stats.h`.
- Detected declarations: `struct mlx4_set_port_vxlan_context`, `struct mlx4_cable_info`, `enum cable_info_err`, `function Copyright`, `function mlx4_init_vlan_table`, `function mlx4_init_roce_gid_table`, `function validate_index`, `function find_index`, `function mlx4_set_port_mac_table`, `function mlx4_need_mf_bond`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.