drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c- Extension
.c- Size
- 186342 bytes
- Lines
- 6564
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/module.hlinux/crc32.hlinux/netdevice.hlinux/etherdevice.hlinux/crc32c.hbnx2x.hbnx2x_cmn.hbnx2x_sp.h
Detected Declarations
struct bnx2x_mcast_mac_elemstruct bnx2x_mcast_bin_elemstruct bnx2x_mcast_elem_groupstruct bnx2x_pending_mcast_cmdfunction Copyrightfunction bnx2x_exe_queue_free_elemfunction bnx2x_exe_queue_lengthfunction bnx2x_exe_queue_addfunction __bnx2x_exe_queue_reset_pendingfunction bnx2x_exe_queue_stepfunction bnx2x_exe_queue_emptyfunction bnx2x_raw_check_pendingfunction bnx2x_raw_clear_pendingfunction bnx2x_raw_set_pendingfunction bnx2x_state_waitfunction bnx2x_raw_waitfunction bnx2x_get_cam_offset_macfunction bnx2x_get_credit_macfunction bnx2x_get_cam_offset_vlanfunction bnx2x_get_credit_vlanfunction bnx2x_get_credit_vlan_macfunction bnx2x_put_cam_offset_macfunction bnx2x_put_credit_macfunction bnx2x_put_cam_offset_vlanfunction bnx2x_put_credit_vlanfunction bnx2x_put_credit_vlan_macfunction __bnx2x_vlan_mac_h_write_trylockfunction __bnx2x_vlan_mac_h_exec_pendingfunction __bnx2x_vlan_mac_h_pendfunction __bnx2x_vlan_mac_h_write_unlockfunction __bnx2x_vlan_mac_h_read_lockfunction bnx2x_vlan_mac_h_read_lockfunction __bnx2x_vlan_mac_h_read_unlockfunction bnx2x_vlan_mac_h_read_unlockfunction bnx2x_get_n_elementsfunction bnx2x_check_mac_addfunction bnx2x_check_vlan_addfunction bnx2x_check_vlan_mac_addfunction bnx2x_check_mac_delfunction bnx2x_check_vlan_delfunction bnx2x_check_vlan_mac_delfunction bnx2x_check_movefunction bnx2x_check_move_always_errfunction bnx2x_vlan_mac_get_rx_tx_flagfunction bnx2x_set_mac_in_nigfunction bnx2x_vlan_mac_set_cmd_hdr_e2function bnx2x_vlan_mac_set_rdata_hdr_e2function bnx2x_set_one_mac_e2
Annotated Snippet
struct bnx2x_mcast_mac_elem {
struct list_head link;
u8 mac[ETH_ALEN];
u8 pad[2]; /* For a natural alignment of the following buffer */
};
struct bnx2x_mcast_bin_elem {
struct list_head link;
int bin;
int type; /* BNX2X_MCAST_CMD_SET_{ADD, DEL} */
};
union bnx2x_mcast_elem {
struct bnx2x_mcast_bin_elem bin_elem;
struct bnx2x_mcast_mac_elem mac_elem;
};
struct bnx2x_mcast_elem_group {
struct list_head mcast_group_link;
union bnx2x_mcast_elem mcast_elems[];
};
#define MCAST_MAC_ELEMS_PER_PG \
((PAGE_SIZE - sizeof(struct bnx2x_mcast_elem_group)) / \
sizeof(union bnx2x_mcast_elem))
struct bnx2x_pending_mcast_cmd {
struct list_head link;
struct list_head group_head;
int type; /* BNX2X_MCAST_CMD_X */
union {
struct list_head macs_head;
u32 macs_num; /* Needed for DEL command */
int next_bin; /* Needed for RESTORE flow with aprox match */
} data;
bool set_convert; /* in case type == BNX2X_MCAST_CMD_SET, this is set
* when macs_head had been converted to a list of
* bnx2x_mcast_bin_elem.
*/
bool done; /* set to true, when the command has been handled,
* practically used in 57712 handling only, where one pending
* command may be handled in a few operations. As long as for
* other chips every operation handling is completed in a
* single ramrod, there is no need to utilize this field.
*/
};
static int bnx2x_mcast_wait(struct bnx2x *bp,
struct bnx2x_mcast_obj *o)
{
if (bnx2x_state_wait(bp, o->sched_state, o->raw.pstate) ||
o->raw.wait_comp(bp, &o->raw))
return -EBUSY;
return 0;
}
static void bnx2x_free_groups(struct list_head *mcast_group_list)
{
struct bnx2x_mcast_elem_group *current_mcast_group;
while (!list_empty(mcast_group_list)) {
current_mcast_group = list_first_entry(mcast_group_list,
struct bnx2x_mcast_elem_group,
mcast_group_link);
list_del(¤t_mcast_group->mcast_group_link);
free_page((unsigned long)current_mcast_group);
}
}
static int bnx2x_mcast_enqueue_cmd(struct bnx2x *bp,
struct bnx2x_mcast_obj *o,
struct bnx2x_mcast_ramrod_params *p,
enum bnx2x_mcast_cmd cmd)
{
struct bnx2x_pending_mcast_cmd *new_cmd;
struct bnx2x_mcast_list_elem *pos;
struct bnx2x_mcast_elem_group *elem_group;
struct bnx2x_mcast_mac_elem *mac_elem;
int total_elems = 0, macs_list_len = 0, offset = 0;
/* When adding MACs we'll need to store their values */
if (cmd == BNX2X_MCAST_CMD_ADD || cmd == BNX2X_MCAST_CMD_SET)
macs_list_len = p->mcast_list_len;
/* If the command is empty ("handle pending commands only"), break */
if (!p->mcast_list_len)
return 0;
Annotation
- Immediate include surface: `linux/module.h`, `linux/crc32.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `linux/crc32c.h`, `bnx2x.h`, `bnx2x_cmn.h`, `bnx2x_sp.h`.
- Detected declarations: `struct bnx2x_mcast_mac_elem`, `struct bnx2x_mcast_bin_elem`, `struct bnx2x_mcast_elem_group`, `struct bnx2x_pending_mcast_cmd`, `function Copyright`, `function bnx2x_exe_queue_free_elem`, `function bnx2x_exe_queue_length`, `function bnx2x_exe_queue_add`, `function __bnx2x_exe_queue_reset_pending`, `function bnx2x_exe_queue_step`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.