drivers/net/usb/asix_common.c
Source file repositories/reference/linux-study-clean/drivers/net/usb/asix_common.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/usb/asix_common.c- Extension
.c- Size
- 18749 bytes
- Lines
- 757
- 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.
- 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
asix.h
Detected Declarations
function Copyrightfunction asix_write_cmdfunction asix_write_cmd_asyncfunction asix_set_sw_miifunction asix_set_hw_miifunction asix_check_host_enablefunction reset_asix_rx_fixup_infofunction asix_rx_fixup_internalfunction asix_rx_fixup_commonfunction asix_rx_fixup_common_freefunction endfunction asix_read_phy_addrfunction asix_sw_resetfunction asix_read_rx_ctlfunction asix_write_rx_ctlfunction asix_read_medium_statusfunction asix_write_medium_modefunction asix_write_gpiofunction asix_set_multicastfunction netdev_mc_countfunction netdev_for_each_mc_addrfunction __asix_mdio_readfunction asix_mdio_readfunction __asix_mdio_writefunction asix_mdio_writefunction asix_mdio_bus_readfunction asix_mdio_bus_writefunction asix_mdio_read_nopmfunction asix_mdio_write_nopmfunction asix_get_wolfunction asix_set_wolfunction asix_get_eeprom_lenfunction asix_get_eepromfunction asix_set_eepromfunction asix_set_mac_address
Annotated Snippet
if (size != ((~rx->header >> 16) & 0x7ff)) {
netdev_err(dev->net, "asix_rx_fixup() Data Header synchronisation was lost, remaining %d\n",
rx->remaining);
reset_asix_rx_fixup_info(rx);
}
}
while (offset + sizeof(u16) <= skb->len) {
u16 copy_length;
if (!rx->remaining) {
if (skb->len - offset == sizeof(u16)) {
rx->header = get_unaligned_le16(
skb->data + offset);
rx->split_head = true;
offset += sizeof(u16);
break;
}
if (rx->split_head == true) {
rx->header |= (get_unaligned_le16(
skb->data + offset) << 16);
rx->split_head = false;
offset += sizeof(u16);
} else {
rx->header = get_unaligned_le32(skb->data +
offset);
offset += sizeof(u32);
}
/* take frame length from Data header 32-bit word */
size = (u16)(rx->header & 0x7ff);
if (size != ((~rx->header >> 16) & 0x7ff)) {
netdev_err(dev->net, "asix_rx_fixup() Bad Header Length 0x%x, offset %d\n",
rx->header, offset);
reset_asix_rx_fixup_info(rx);
return 0;
}
if (size > dev->net->mtu + ETH_HLEN + VLAN_HLEN) {
netdev_dbg(dev->net, "asix_rx_fixup() Bad RX Length %d\n",
size);
reset_asix_rx_fixup_info(rx);
return 0;
}
/* Sometimes may fail to get a netdev socket buffer but
* continue to process the URB socket buffer so that
* synchronisation of the Ethernet frame Data header
* word is maintained.
*/
rx->ax_skb = netdev_alloc_skb_ip_align(dev->net, size);
rx->remaining = size;
}
if (rx->remaining > skb->len - offset) {
copy_length = skb->len - offset;
rx->remaining -= copy_length;
} else {
copy_length = rx->remaining;
rx->remaining = 0;
}
if (rx->ax_skb) {
skb_put_data(rx->ax_skb, skb->data + offset,
copy_length);
if (!rx->remaining) {
usbnet_skb_return(dev, rx->ax_skb);
rx->ax_skb = NULL;
}
}
offset += (copy_length + 1) & 0xfffe;
}
if (skb->len != offset) {
netdev_err(dev->net, "asix_rx_fixup() Bad SKB Length %d, %d\n",
skb->len, offset);
reset_asix_rx_fixup_info(rx);
return 0;
}
return 1;
}
int asix_rx_fixup_common(struct usbnet *dev, struct sk_buff *skb)
{
struct asix_common_private *dp = dev->driver_priv;
struct asix_rx_fixup_info *rx = &dp->rx_fixup_info;
Annotation
- Immediate include surface: `asix.h`.
- Detected declarations: `function Copyright`, `function asix_write_cmd`, `function asix_write_cmd_async`, `function asix_set_sw_mii`, `function asix_set_hw_mii`, `function asix_check_host_enable`, `function reset_asix_rx_fixup_info`, `function asix_rx_fixup_internal`, `function asix_rx_fixup_common`, `function asix_rx_fixup_common_free`.
- 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.
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.