drivers/net/ethernet/qlogic/qed/qed_dev.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/qlogic/qed/qed_dev.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/qlogic/qed/qed_dev.c- Extension
.c- Size
- 147646 bytes
- Lines
- 5505
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/types.hasm/byteorder.hlinux/io.hlinux/delay.hlinux/dma-mapping.hlinux/errno.hlinux/kernel.hlinux/mutex.hlinux/pci.hlinux/slab.hlinux/string.hlinux/vmalloc.hlinux/etherdevice.hlinux/qed/qed_chain.hlinux/qed/qed_if.hqed.hqed_cxt.hqed_dcbx.hqed_dev_api.hqed_fcoe.hqed_hsi.hqed_iro_hsi.hqed_hw.hqed_init_ops.hqed_int.hqed_iscsi.hqed_ll2.hqed_mcp.hqed_ooo.hqed_reg_addr.hqed_sp.hqed_sriov.h
Detected Declarations
struct qed_db_recovery_entrystruct qed_llh_mac_filterstruct qed_llh_protocol_filterstruct qed_llh_filter_infostruct qed_llh_infostruct qed_llh_filter_detailsenum qed_llh_filter_typeenum QED_ROCE_EDPM_MODEfunction qed_db_recovery_dp_entryfunction qed_db_rec_sanityfunction qed_db_recovery_addfunction qed_db_recovery_delfunction qed_db_recovery_setupfunction qed_db_recovery_teardownfunction qed_db_recovery_ringfunction qed_db_recovery_executefunction qed_llh_freefunction qed_llh_allocfunction qed_llh_shadow_sanityfunction qed_llh_shadow_search_filterfunction qed_llh_shadow_get_free_idxfunction __qed_llh_shadow_add_filterfunction qed_llh_shadow_add_filterfunction __qed_llh_shadow_remove_filterfunction qed_llh_shadow_remove_filterfunction qed_llh_abs_ppfidfunction qed_llh_set_engine_affinfunction qed_llh_hw_init_pffunction qed_llh_get_num_ppfidfunction qed_llh_set_ppfid_affinityfunction qed_llh_set_roce_affinityfunction qed_llh_access_filterfunction qed_llh_add_filterfunction qed_llh_remove_filterfunction qed_llh_add_mac_filterfunction qed_llh_protocol_filter_stringifyfunction qed_llh_protocol_filter_to_hilofunction qed_llh_add_protocol_filterfunction qed_llh_remove_mac_filterfunction qed_llh_remove_protocol_filterfunction qed_hw_bar_sizefunction qed_init_dpfunction qed_init_structfunction qed_qm_info_freefunction qed_dbg_user_data_freefunction qed_resc_freefunction for_each_hwfnfunction qed_get_pq_flags
Annotated Snippet
struct qed_db_recovery_entry {
struct list_head list_entry;
void __iomem *db_addr;
void *db_data;
enum qed_db_rec_width db_width;
enum qed_db_rec_space db_space;
u8 hwfn_idx;
};
/* Display a single doorbell recovery entry */
static void qed_db_recovery_dp_entry(struct qed_hwfn *p_hwfn,
struct qed_db_recovery_entry *db_entry,
char *action)
{
DP_VERBOSE(p_hwfn,
QED_MSG_SPQ,
"(%s: db_entry %p, addr %p, data %p, width %s, %s space, hwfn %d)\n",
action,
db_entry,
db_entry->db_addr,
db_entry->db_data,
db_entry->db_width == DB_REC_WIDTH_32B ? "32b" : "64b",
db_entry->db_space == DB_REC_USER ? "user" : "kernel",
db_entry->hwfn_idx);
}
/* Doorbell address sanity (address within doorbell bar range) */
static bool qed_db_rec_sanity(struct qed_dev *cdev,
void __iomem *db_addr,
enum qed_db_rec_width db_width,
void *db_data)
{
u32 width = (db_width == DB_REC_WIDTH_32B) ? 32 : 64;
/* Make sure doorbell address is within the doorbell bar */
if (db_addr < cdev->doorbells ||
(u8 __iomem *)db_addr + width >
(u8 __iomem *)cdev->doorbells + cdev->db_size) {
WARN(true,
"Illegal doorbell address: %p. Legal range for doorbell addresses is [%p..%p]\n",
db_addr,
cdev->doorbells,
(u8 __iomem *)cdev->doorbells + cdev->db_size);
return false;
}
/* ake sure doorbell data pointer is not null */
if (!db_data) {
WARN(true, "Illegal doorbell data pointer: %p", db_data);
return false;
}
return true;
}
/* Find hwfn according to the doorbell address */
static struct qed_hwfn *qed_db_rec_find_hwfn(struct qed_dev *cdev,
void __iomem *db_addr)
{
struct qed_hwfn *p_hwfn;
/* In CMT doorbell bar is split down the middle between engine 0 and enigne 1 */
if (cdev->num_hwfns > 1)
p_hwfn = db_addr < cdev->hwfns[1].doorbells ?
&cdev->hwfns[0] : &cdev->hwfns[1];
else
p_hwfn = QED_LEADING_HWFN(cdev);
return p_hwfn;
}
/* Add a new entry to the doorbell recovery mechanism */
int qed_db_recovery_add(struct qed_dev *cdev,
void __iomem *db_addr,
void *db_data,
enum qed_db_rec_width db_width,
enum qed_db_rec_space db_space)
{
struct qed_db_recovery_entry *db_entry;
struct qed_hwfn *p_hwfn;
/* Shortcircuit VFs, for now */
if (IS_VF(cdev)) {
DP_VERBOSE(cdev,
QED_MSG_IOV, "db recovery - skipping VF doorbell\n");
return 0;
}
/* Sanitize doorbell address */
if (!qed_db_rec_sanity(cdev, db_addr, db_width, db_data))
Annotation
- Immediate include surface: `linux/types.h`, `asm/byteorder.h`, `linux/io.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/errno.h`, `linux/kernel.h`, `linux/mutex.h`.
- Detected declarations: `struct qed_db_recovery_entry`, `struct qed_llh_mac_filter`, `struct qed_llh_protocol_filter`, `struct qed_llh_filter_info`, `struct qed_llh_info`, `struct qed_llh_filter_details`, `enum qed_llh_filter_type`, `enum QED_ROCE_EDPM_MODE`, `function qed_db_recovery_dp_entry`, `function qed_db_rec_sanity`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.