drivers/net/ethernet/wangxun/libwx/wx_vf_common.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/wangxun/libwx/wx_vf_common.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/wangxun/libwx/wx_vf_common.c- Extension
.c- Size
- 9670 bytes
- Lines
- 422
- 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.
- 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
linux/etherdevice.hlinux/pci.hwx_type.hwx_mbx.hwx_lib.hwx_vf.hwx_vf_lib.hwx_vf_common.h
Detected Declarations
function wxvf_suspendfunction wxvf_shutdownfunction wxvf_resumefunction wxvf_removefunction wx_msix_misc_vffunction wx_request_msix_irqs_vffunction wx_negotiate_api_vffunction wx_reset_vffunction wx_set_rx_mode_vffunction wx_configure_rx_vffunction wx_configure_vffunction wx_set_mac_vffunction wxvf_watchdog_update_linkfunction wxvf_irq_enablefunction wxvf_up_completefunction wxvf_openfunction wxvf_downfunction wxvf_reinit_lockedfunction wxvf_reset_subtaskfunction test_bitfunction wxvf_closefunction wxvf_link_config_subtaskfunction wxvf_service_taskfunction wxvf_init_serviceexport wxvf_suspendexport wxvf_shutdownexport wxvf_resumeexport wxvf_removeexport wx_request_msix_irqs_vfexport wx_negotiate_api_vfexport wx_reset_vfexport wx_set_rx_mode_vfexport wx_configure_vfexport wx_set_mac_vfexport wxvf_watchdog_update_linkexport wxvf_openexport wxvf_closeexport wxvf_init_service
Annotated Snippet
if (err) {
wx_err(wx, "request_irq failed for MSIX interrupt %s Error: %d\n",
q_vector->name, err);
goto free_queue_irqs;
}
}
err = request_irq(wx->msix_entry->vector, wx_msix_misc_vf,
0, netdev->name, wx);
if (err) {
wx_err(wx, "request_irq for msix_other failed: %d\n", err);
goto free_queue_irqs;
}
return 0;
free_queue_irqs:
while (vector) {
vector--;
free_irq(wx->msix_q_entries[vector].vector,
wx->q_vector[vector]);
}
wx_reset_interrupt_capability(wx);
return err;
}
EXPORT_SYMBOL(wx_request_msix_irqs_vf);
void wx_negotiate_api_vf(struct wx *wx)
{
int api[] = {
wx_mbox_api_13,
wx_mbox_api_null};
int err = 0, idx = 0;
spin_lock_bh(&wx->mbx.mbx_lock);
while (api[idx] != wx_mbox_api_null) {
err = wx_negotiate_api_version(wx, api[idx]);
if (!err)
break;
idx++;
}
spin_unlock_bh(&wx->mbx.mbx_lock);
}
EXPORT_SYMBOL(wx_negotiate_api_vf);
void wx_reset_vf(struct wx *wx)
{
struct net_device *netdev = wx->netdev;
int ret = 0;
ret = wx_reset_hw_vf(wx);
if (!ret)
wx_init_hw_vf(wx);
wx_negotiate_api_vf(wx);
if (is_valid_ether_addr(wx->mac.addr)) {
eth_hw_addr_set(netdev, wx->mac.addr);
ether_addr_copy(netdev->perm_addr, wx->mac.addr);
}
}
EXPORT_SYMBOL(wx_reset_vf);
void wx_set_rx_mode_vf(struct net_device *netdev)
{
struct wx *wx = netdev_priv(netdev);
unsigned int flags = netdev->flags;
int xcast_mode;
xcast_mode = (flags & IFF_ALLMULTI) ? WXVF_XCAST_MODE_ALLMULTI :
(flags & (IFF_BROADCAST | IFF_MULTICAST)) ?
WXVF_XCAST_MODE_MULTI : WXVF_XCAST_MODE_NONE;
/* request the most inclusive mode we need */
if (flags & IFF_PROMISC)
xcast_mode = WXVF_XCAST_MODE_PROMISC;
else if (flags & IFF_ALLMULTI)
xcast_mode = WXVF_XCAST_MODE_ALLMULTI;
else if (flags & (IFF_BROADCAST | IFF_MULTICAST))
xcast_mode = WXVF_XCAST_MODE_MULTI;
else
xcast_mode = WXVF_XCAST_MODE_NONE;
spin_lock_bh(&wx->mbx.mbx_lock);
wx_update_xcast_mode_vf(wx, xcast_mode);
wx_update_mc_addr_list_vf(wx, netdev);
wx_write_uc_addr_list_vf(netdev);
spin_unlock_bh(&wx->mbx.mbx_lock);
}
EXPORT_SYMBOL(wx_set_rx_mode_vf);
/**
* wx_configure_rx_vf - Configure Receive Unit after Reset
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/pci.h`, `wx_type.h`, `wx_mbx.h`, `wx_lib.h`, `wx_vf.h`, `wx_vf_lib.h`, `wx_vf_common.h`.
- Detected declarations: `function wxvf_suspend`, `function wxvf_shutdown`, `function wxvf_resume`, `function wxvf_remove`, `function wx_msix_misc_vf`, `function wx_request_msix_irqs_vf`, `function wx_negotiate_api_vf`, `function wx_reset_vf`, `function wx_set_rx_mode_vf`, `function wx_configure_rx_vf`.
- 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.
- 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.