drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c- Extension
.c- Size
- 67131 bytes
- Lines
- 2314
- 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
bnx2x.hbnx2x_cmn.hlinux/crc32.h
Detected Declarations
function bnx2x_add_tlvfunction bnx2x_vfpf_prepfunction bnx2x_vfpf_finalizefunction bnx2x_dp_tlv_listfunction bnx2x_tlv_supportedfunction bnx2x_pfvf_status_codesfunction bnx2x_send_msg2pffunction bnx2x_get_vf_idfunction bnx2x_vfpf_acquirefunction bnx2x_vfpf_releasefunction bnx2x_vfpf_initfunction bnx2x_vfpf_close_vffunction bnx2x_leading_vfq_initfunction bnx2x_vfpf_setup_qfunction bnx2x_vfpf_teardown_queuefunction bnx2x_vfpf_config_macfunction bnx2x_vfpf_config_rssfunction bnx2x_vfpf_set_mcastfunction netdev_for_each_mc_addrfunction bnx2x_vfpf_update_vlanfunction bnx2x_vfpf_storm_rx_modefunction storm_memset_vf_mbx_ackfunction storm_memset_vf_mbx_validfunction bnx2x_vf_enable_mbxfunction bnx2x_copy32_vf_dmaefunction bnx2x_vf_mbx_resp_single_tlvfunction bnx2x_vf_mbx_resp_send_msgfunction bnx2x_vf_mbx_respfunction bnx2x_vf_mbx_resp_phys_portfunction bnx2x_vf_mbx_resp_fp_hsi_verfunction bnx2x_vf_mbx_acquire_respfunction for_each_vf_sbfunction bnx2x_vf_mbx_is_windows_vmfunction bnx2x_vf_mbx_acquire_chk_dorqfunction bnx2x_vf_mbx_acquirefunction bnx2x_vf_mbx_init_vffunction bnx2x_vf_mbx_set_q_flagsfunction bnx2x_vf_mbx_setup_qfunction bnx2x_vf_mbx_macvlan_listfunction bnx2x_vf_filters_containfunction bnx2x_vf_mbx_dp_q_filterfunction bnx2x_vf_mbx_dp_q_filtersfunction bnx2x_vf_mbx_qfiltersfunction bnx2x_filters_validate_macfunction bnx2x_filters_validate_vlanfunction bnx2x_vf_mbx_set_q_filtersfunction bnx2x_vf_mbx_teardown_qfunction bnx2x_vf_mbx_close_vf
Annotated Snippet
if (!tlv->length) {
BNX2X_ERR("Found TLV with length 0\n");
return NULL;
}
tlvs_list += tlv->length;
tlv = (struct channel_tlv *)tlvs_list;
} while (tlv->type != CHANNEL_TLV_LIST_END);
DP(BNX2X_MSG_IOV, "TLV list does not contain %d TLV\n", req_tlv);
return NULL;
}
/* list the types and lengths of the tlvs on the buffer */
static void bnx2x_dp_tlv_list(struct bnx2x *bp, void *tlvs_list)
{
int i = 1;
struct channel_tlv *tlv = (struct channel_tlv *)tlvs_list;
while (tlv->type != CHANNEL_TLV_LIST_END) {
/* output tlv */
DP(BNX2X_MSG_IOV, "TLV number %d: type %d, length %d\n", i,
tlv->type, tlv->length);
/* advance to next tlv */
tlvs_list += tlv->length;
/* cast general tlv list pointer to channel tlv header*/
tlv = (struct channel_tlv *)tlvs_list;
i++;
/* break condition for this loop */
if (i > MAX_TLVS_IN_LIST) {
WARN(true, "corrupt tlvs");
return;
}
}
/* output last tlv */
DP(BNX2X_MSG_IOV, "TLV number %d: type %d, length %d\n", i,
tlv->type, tlv->length);
}
/* test whether we support a tlv type */
bool bnx2x_tlv_supported(u16 tlvtype)
{
return CHANNEL_TLV_NONE < tlvtype && tlvtype < CHANNEL_TLV_MAX;
}
static inline int bnx2x_pfvf_status_codes(int rc)
{
switch (rc) {
case 0:
return PFVF_STATUS_SUCCESS;
case -ENOMEM:
return PFVF_STATUS_NO_RESOURCE;
default:
return PFVF_STATUS_FAILURE;
}
}
static int bnx2x_send_msg2pf(struct bnx2x *bp, u8 *done, dma_addr_t msg_mapping)
{
struct cstorm_vf_zone_data __iomem *zone_data =
REG_ADDR(bp, PXP_VF_ADDR_CSDM_GLOBAL_START);
int tout = 100, interval = 100; /* wait for 10 seconds */
if (*done) {
BNX2X_ERR("done was non zero before message to pf was sent\n");
WARN_ON(true);
return -EINVAL;
}
/* if PF indicated channel is down avoid sending message. Return success
* so calling flow can continue
*/
bnx2x_sample_bulletin(bp);
if (bp->old_bulletin.valid_bitmap & 1 << CHANNEL_DOWN) {
DP(BNX2X_MSG_IOV, "detecting channel down. Aborting message\n");
*done = PFVF_STATUS_SUCCESS;
return -EINVAL;
}
/* Write message address */
writel(U64_LO(msg_mapping),
&zone_data->non_trigger.vf_pf_channel.msg_addr_lo);
writel(U64_HI(msg_mapping),
&zone_data->non_trigger.vf_pf_channel.msg_addr_hi);
Annotation
- Immediate include surface: `bnx2x.h`, `bnx2x_cmn.h`, `linux/crc32.h`.
- Detected declarations: `function bnx2x_add_tlv`, `function bnx2x_vfpf_prep`, `function bnx2x_vfpf_finalize`, `function bnx2x_dp_tlv_list`, `function bnx2x_tlv_supported`, `function bnx2x_pfvf_status_codes`, `function bnx2x_send_msg2pf`, `function bnx2x_get_vf_id`, `function bnx2x_vfpf_acquire`, `function bnx2x_vfpf_release`.
- 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.