drivers/net/usb/ax88179_178a.c
Source file repositories/reference/linux-study-clean/drivers/net/usb/ax88179_178a.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/usb/ax88179_178a.c- Extension
.c- Size
- 50602 bytes
- Lines
- 1953
- 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.
- 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/module.hlinux/etherdevice.hlinux/mii.hlinux/usb.hlinux/crc32.hlinux/usb/usbnet.huapi/linux/mdio.hlinux/mdio.h
Detected Declarations
struct ax88179_datastruct ax88179_int_datafunction ax88179_set_pm_modefunction ax88179_in_pmfunction __ax88179_read_cmdfunction __ax88179_write_cmdfunction ax88179_write_cmd_asyncfunction ax88179_read_cmdfunction ax88179_write_cmdfunction ax88179_statusfunction ax88179_mdio_readfunction ax88179_mdio_writefunction ax88179_phy_mmd_indirectfunction ax88179_phy_read_mmd_indirectfunction ax88179_phy_write_mmd_indirectfunction ax88179_suspendfunction ax88179_auto_detachfunction ax88179_resumefunction ax88179_disconnectfunction ax88179_get_wolfunction ax88179_set_wolfunction ax88179_get_eeprom_lenfunction ax88179_get_eepromfunction ax88179_set_eepromfunction ax88179_get_link_ksettingsfunction ax88179_set_link_ksettingsfunction ax88179_ethtool_get_eeefunction ax88179_ethtool_set_eeefunction ax88179_chk_eeefunction ax88179_disable_eeefunction ax88179_enable_eeefunction ax88179_get_eeefunction ax88179_set_eeefunction ax88179_set_multicastfunction netdev_mc_countfunction netdev_for_each_mc_addrfunction ax88179_set_featuresfunction ax88179_change_mtufunction ax88179_set_mac_addrfunction ax88179_check_eepromfunction ax88179_check_efusefunction ax88179_convert_old_ledfunction ax88179_led_settingfunction ax88179_get_mac_addrfunction ax88179_bindfunction ax88179_unbindfunction ax88179_rx_checksumfunction ax88179_rx_fixup
Annotated Snippet
static const struct net_device_ops ax88179_netdev_ops = {
.ndo_open = usbnet_open,
.ndo_stop = usbnet_stop,
.ndo_start_xmit = usbnet_start_xmit,
.ndo_tx_timeout = usbnet_tx_timeout,
.ndo_get_stats64 = dev_get_tstats64,
.ndo_change_mtu = ax88179_change_mtu,
.ndo_set_mac_address = ax88179_set_mac_addr,
.ndo_validate_addr = eth_validate_addr,
.ndo_eth_ioctl = usbnet_mii_ioctl,
.ndo_set_rx_mode = ax88179_set_multicast,
.ndo_set_features = ax88179_set_features,
};
static int ax88179_check_eeprom(struct usbnet *dev)
{
u8 i, buf, eeprom[20];
u16 csum, delay = HZ / 10;
unsigned long jtimeout;
/* Read EEPROM content */
for (i = 0; i < 6; i++) {
buf = i;
if (ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_SROM_ADDR,
1, 1, &buf) < 0)
return -EINVAL;
buf = EEP_RD;
if (ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_SROM_CMD,
1, 1, &buf) < 0)
return -EINVAL;
jtimeout = jiffies + delay;
do {
ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_SROM_CMD,
1, 1, &buf);
if (time_after(jiffies, jtimeout))
return -EINVAL;
} while (buf & EEP_BUSY);
__ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_SROM_DATA_LOW,
2, 2, &eeprom[i * 2]);
if ((i == 0) && (eeprom[0] == 0xFF))
return -EINVAL;
}
csum = eeprom[6] + eeprom[7] + eeprom[8] + eeprom[9];
csum = (csum >> 8) + (csum & 0xff);
if ((csum + eeprom[10]) != 0xff)
return -EINVAL;
return 0;
}
static int ax88179_check_efuse(struct usbnet *dev, u16 *ledmode)
{
u8 i;
u8 efuse[64];
u16 csum = 0;
if (ax88179_read_cmd(dev, AX_ACCESS_EFUS, 0, 64, 64, efuse) < 0)
return -EINVAL;
if (*efuse == 0xFF)
return -EINVAL;
for (i = 0; i < 64; i++)
csum = csum + efuse[i];
while (csum > 255)
csum = (csum & 0x00FF) + ((csum >> 8) & 0x00FF);
if (csum != 0xFF)
return -EINVAL;
*ledmode = (efuse[51] << 8) | efuse[52];
return 0;
}
static int ax88179_convert_old_led(struct usbnet *dev, u16 *ledvalue)
{
u16 led;
/* Loaded the old eFuse LED Mode */
if (ax88179_read_cmd(dev, AX_ACCESS_EEPROM, 0x3C, 1, 2, &led) < 0)
return -EINVAL;
Annotation
- Immediate include surface: `linux/module.h`, `linux/etherdevice.h`, `linux/mii.h`, `linux/usb.h`, `linux/crc32.h`, `linux/usb/usbnet.h`, `uapi/linux/mdio.h`, `linux/mdio.h`.
- Detected declarations: `struct ax88179_data`, `struct ax88179_int_data`, `function ax88179_set_pm_mode`, `function ax88179_in_pm`, `function __ax88179_read_cmd`, `function __ax88179_write_cmd`, `function ax88179_write_cmd_async`, `function ax88179_read_cmd`, `function ax88179_write_cmd`, `function ax88179_status`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
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.