drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c- Extension
.c- Size
- 7308 bytes
- Lines
- 285
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
qlcnic.hqlcnic_hw.h
Detected Declarations
function Copyrightfunction qlcnic_83xx_disable_vnic_modefunction qlcnic_83xx_set_vnic_opmodefunction qlcnic_83xx_config_vnic_buff_descriptorsfunction qlcnic_83xx_init_privileged_vnicfunction qlcnic_83xx_init_non_privileged_vnicfunction qlcnic_83xx_config_vnic_opmodefunction qlcnic_83xx_check_vnic_statefunction qlcnic_83xx_set_port_eswitch_status
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* QLogic qlcnic NIC Driver
* Copyright (c) 2009-2013 QLogic Corporation
*/
#include "qlcnic.h"
#include "qlcnic_hw.h"
static int qlcnic_83xx_enable_vnic_mode(struct qlcnic_adapter *adapter, int lock)
{
if (lock) {
if (qlcnic_83xx_lock_driver(adapter))
return -EBUSY;
}
QLCWRX(adapter->ahw, QLC_83XX_VNIC_STATE, QLCNIC_DEV_NPAR_OPER);
if (lock)
qlcnic_83xx_unlock_driver(adapter);
return 0;
}
int qlcnic_83xx_disable_vnic_mode(struct qlcnic_adapter *adapter, int lock)
{
struct qlcnic_hardware_context *ahw = adapter->ahw;
if (lock) {
if (qlcnic_83xx_lock_driver(adapter))
return -EBUSY;
}
QLCWRX(adapter->ahw, QLC_83XX_VNIC_STATE, QLCNIC_DEV_NPAR_NON_OPER);
ahw->idc.vnic_state = QLCNIC_DEV_NPAR_NON_OPER;
if (lock)
qlcnic_83xx_unlock_driver(adapter);
return 0;
}
int qlcnic_83xx_set_vnic_opmode(struct qlcnic_adapter *adapter)
{
u8 id;
int ret = -EBUSY;
u32 data = QLCNIC_MGMT_FUNC;
struct qlcnic_hardware_context *ahw = adapter->ahw;
if (qlcnic_83xx_lock_driver(adapter))
return ret;
id = ahw->pci_func;
data = QLCRDX(adapter->ahw, QLC_83XX_DRV_OP_MODE);
data = (data & ~QLC_83XX_SET_FUNC_OPMODE(0x3, id)) |
QLC_83XX_SET_FUNC_OPMODE(QLCNIC_MGMT_FUNC, id);
QLCWRX(adapter->ahw, QLC_83XX_DRV_OP_MODE, data);
qlcnic_83xx_unlock_driver(adapter);
return 0;
}
static void
qlcnic_83xx_config_vnic_buff_descriptors(struct qlcnic_adapter *adapter)
{
struct qlcnic_hardware_context *ahw = adapter->ahw;
if (ahw->port_type == QLCNIC_XGBE) {
adapter->num_rxd = DEFAULT_RCV_DESCRIPTORS_VF;
adapter->max_rxd = MAX_RCV_DESCRIPTORS_VF;
adapter->num_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_10G;
adapter->max_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_10G;
} else if (ahw->port_type == QLCNIC_GBE) {
adapter->num_rxd = DEFAULT_RCV_DESCRIPTORS_1G;
adapter->num_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_1G;
adapter->max_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_1G;
adapter->max_rxd = MAX_RCV_DESCRIPTORS_1G;
}
adapter->num_txd = MAX_CMD_DESCRIPTORS;
adapter->max_rds_rings = MAX_RDS_RINGS;
}
/**
* qlcnic_83xx_init_mgmt_vnic
*
* @adapter: adapter structure
* Management virtual NIC sets the operational mode of other vNIC's and
* configures embedded switch (ESWITCH).
Annotation
- Immediate include surface: `qlcnic.h`, `qlcnic_hw.h`.
- Detected declarations: `function Copyright`, `function qlcnic_83xx_disable_vnic_mode`, `function qlcnic_83xx_set_vnic_opmode`, `function qlcnic_83xx_config_vnic_buff_descriptors`, `function qlcnic_83xx_init_privileged_vnic`, `function qlcnic_83xx_init_non_privileged_vnic`, `function qlcnic_83xx_config_vnic_opmode`, `function qlcnic_83xx_check_vnic_state`, `function qlcnic_83xx_set_port_eswitch_status`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- 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.