drivers/net/fjes/fjes_main.c
Source file repositories/reference/linux-study-clean/drivers/net/fjes/fjes_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/fjes/fjes_main.c- Extension
.c- Size
- 37671 bytes
- Lines
- 1524
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/module.hlinux/types.hlinux/nls.hlinux/platform_device.hlinux/netdevice.hlinux/interrupt.hfjes.hfjes_trace.h
Detected Declarations
struct fjes_acpi_walk_contextfunction is_extended_socket_devicefunction acpi_check_extended_socket_statusfunction fjes_get_acpi_resourcefunction fjes_setup_resourcesfunction fjes_rx_irqfunction fjes_stop_req_irqfunction fjes_txrx_stop_req_irqfunction fjes_update_zone_irqfunction fjes_intrfunction fjes_request_irqfunction fjes_free_irqfunction fjes_free_resourcesfunction fjes_openfunction fjes_closefunction fjes_tx_sendfunction fjes_xmit_framefunction fjes_get_stats64function fjes_change_mtufunction fjes_tx_retryfunction fjes_vlan_rx_add_vidfunction fjes_vlan_rx_kill_vidfunction fjes_netdev_setupfunction fjes_rxframe_search_existfunction fjes_rxframe_releasefunction fjes_pollfunction fjes_sw_initfunction fjes_force_close_taskfunction fjes_tx_stall_taskfunction fjes_raise_intr_rxdata_taskfunction fjes_watch_unshare_taskfunction fjes_irq_watch_taskfunction fjes_probefunction fjes_removefunction acpi_find_extended_socket_devicefunction fjes_init_modulefunction fjes_exit_modulemodule init fjes_init_module
Annotated Snippet
static const struct net_device_ops fjes_netdev_ops = {
.ndo_open = fjes_open,
.ndo_stop = fjes_close,
.ndo_start_xmit = fjes_xmit_frame,
.ndo_get_stats64 = fjes_get_stats64,
.ndo_change_mtu = fjes_change_mtu,
.ndo_tx_timeout = fjes_tx_retry,
.ndo_vlan_rx_add_vid = fjes_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = fjes_vlan_rx_kill_vid,
};
/* fjes_netdev_setup - netdevice initialization routine */
static void fjes_netdev_setup(struct net_device *netdev)
{
ether_setup(netdev);
netdev->watchdog_timeo = FJES_TX_RETRY_INTERVAL;
netdev->netdev_ops = &fjes_netdev_ops;
fjes_set_ethtool_ops(netdev);
netdev->mtu = fjes_support_mtu[3];
netdev->min_mtu = fjes_support_mtu[0];
netdev->max_mtu = fjes_support_mtu[3];
netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
}
static int fjes_rxframe_search_exist(struct fjes_adapter *adapter,
int start_epid)
{
struct fjes_hw *hw = &adapter->hw;
enum ep_partner_status pstatus;
int max_epid, cur_epid;
int i;
max_epid = hw->max_epid;
start_epid = (start_epid + 1 + max_epid) % max_epid;
for (i = 0; i < max_epid; i++) {
cur_epid = (start_epid + i) % max_epid;
if (cur_epid == hw->my_epid)
continue;
pstatus = fjes_hw_get_partner_ep_status(hw, cur_epid);
if (pstatus == EP_PARTNER_SHARED) {
if (!fjes_hw_epbuf_rx_is_empty(
&hw->ep_shm_info[cur_epid].rx))
return cur_epid;
}
}
return -1;
}
static void *fjes_rxframe_get(struct fjes_adapter *adapter, size_t *psize,
int *cur_epid)
{
void *frame;
*cur_epid = fjes_rxframe_search_exist(adapter, *cur_epid);
if (*cur_epid < 0)
return NULL;
frame =
fjes_hw_epbuf_rx_curpkt_get_addr(
&adapter->hw.ep_shm_info[*cur_epid].rx, psize);
return frame;
}
static void fjes_rxframe_release(struct fjes_adapter *adapter, int cur_epid)
{
fjes_hw_epbuf_rx_curpkt_drop(&adapter->hw.ep_shm_info[cur_epid].rx);
}
static int fjes_poll(struct napi_struct *napi, int budget)
{
struct fjes_adapter *adapter =
container_of(napi, struct fjes_adapter, napi);
struct net_device *netdev = napi->dev;
struct fjes_hw *hw = &adapter->hw;
struct sk_buff *skb;
int work_done = 0;
int cur_epid = 0;
int epidx;
size_t frame_len;
void *frame;
spin_lock(&hw->rx_status_lock);
for (epidx = 0; epidx < hw->max_epid; epidx++) {
if (epidx == hw->my_epid)
continue;
Annotation
- Immediate include surface: `linux/module.h`, `linux/types.h`, `linux/nls.h`, `linux/platform_device.h`, `linux/netdevice.h`, `linux/interrupt.h`, `fjes.h`, `fjes_trace.h`.
- Detected declarations: `struct fjes_acpi_walk_context`, `function is_extended_socket_device`, `function acpi_check_extended_socket_status`, `function fjes_get_acpi_resource`, `function fjes_setup_resources`, `function fjes_rx_irq`, `function fjes_stop_req_irq`, `function fjes_txrx_stop_req_irq`, `function fjes_update_zone_irq`, `function fjes_intr`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern 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.