drivers/net/usb/smsc75xx.c
Source file repositories/reference/linux-study-clean/drivers/net/usb/smsc75xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/usb/smsc75xx.c- Extension
.c- Size
- 58031 bytes
- Lines
- 2340
- 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.
- 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/kmod.hlinux/netdevice.hlinux/etherdevice.hlinux/ethtool.hlinux/mii.hlinux/usb.hlinux/bitrev.hlinux/crc16.hlinux/crc32.hlinux/usb/usbnet.hlinux/slab.hlinux/of_net.hsmsc75xx.h
Detected Declarations
struct smsc75xx_privfunction __smsc75xx_read_regfunction __smsc75xx_write_regfunction smsc75xx_read_reg_nopmfunction smsc75xx_write_reg_nopmfunction smsc75xx_read_regfunction smsc75xx_write_regfunction __smsc75xx_phy_wait_not_busyfunction __smsc75xx_mdio_readfunction __smsc75xx_mdio_writefunction smsc75xx_mdio_read_nopmfunction smsc75xx_mdio_write_nopmfunction smsc75xx_mdio_readfunction smsc75xx_mdio_writefunction smsc75xx_wait_eepromfunction smsc75xx_eeprom_confirm_not_busyfunction smsc75xx_read_eepromfunction smsc75xx_write_eepromfunction smsc75xx_dataport_wait_not_busyfunction smsc75xx_dataport_writefunction smsc75xx_hashfunction smsc75xx_deferred_multicast_writefunction smsc75xx_set_multicastfunction netdev_for_each_mc_addrfunction smsc75xx_update_flowcontrolfunction smsc75xx_link_resetfunction smsc75xx_statusfunction smsc75xx_ethtool_get_eeprom_lenfunction smsc75xx_ethtool_get_eepromfunction smsc75xx_ethtool_set_eepromfunction smsc75xx_ethtool_get_wolfunction smsc75xx_ethtool_set_wolfunction smsc75xx_ioctlfunction smsc75xx_init_mac_addressfunction smsc75xx_set_mac_addressfunction smsc75xx_phy_initializefunction smsc75xx_set_rx_max_frame_lengthfunction smsc75xx_change_mtufunction smsc75xx_set_featuresfunction smsc75xx_wait_readyfunction smsc75xx_phy_gig_workaroundfunction smsc75xx_resetfunction smsc75xx_bindfunction smsc75xx_unbindfunction smsc_crcfunction smsc75xx_write_wufffunction smsc75xx_enter_suspend0function smsc75xx_enter_suspend1
Annotated Snippet
static const struct net_device_ops smsc75xx_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 = smsc75xx_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
.ndo_eth_ioctl = smsc75xx_ioctl,
.ndo_set_rx_mode = smsc75xx_set_multicast,
.ndo_set_features = smsc75xx_set_features,
};
static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf)
{
struct smsc75xx_priv *pdata = NULL;
int ret;
ret = usbnet_get_endpoints(dev, intf);
if (ret < 0) {
netdev_warn(dev->net, "usbnet_get_endpoints failed: %d\n", ret);
return ret;
}
dev->data[0] = (unsigned long) kzalloc_obj(struct smsc75xx_priv);
pdata = (struct smsc75xx_priv *)(dev->data[0]);
if (!pdata)
return -ENOMEM;
pdata->dev = dev;
spin_lock_init(&pdata->rfe_ctl_lock);
mutex_init(&pdata->dataport_mutex);
INIT_WORK(&pdata->set_multicast, smsc75xx_deferred_multicast_write);
if (DEFAULT_TX_CSUM_ENABLE)
dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
if (DEFAULT_RX_CSUM_ENABLE)
dev->net->features |= NETIF_F_RXCSUM;
dev->net->hw_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_RXCSUM;
ret = smsc75xx_wait_ready(dev, 0);
if (ret < 0) {
netdev_warn(dev->net, "device not ready in smsc75xx_bind\n");
goto free_pdata;
}
smsc75xx_init_mac_address(dev);
/* Init all registers */
ret = smsc75xx_reset(dev);
if (ret < 0) {
netdev_warn(dev->net, "smsc75xx_reset error %d\n", ret);
goto cancel_work;
}
dev->net->netdev_ops = &smsc75xx_netdev_ops;
dev->net->ethtool_ops = &smsc75xx_ethtool_ops;
dev->net->flags |= IFF_MULTICAST;
dev->net->hard_header_len += SMSC75XX_TX_OVERHEAD;
dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
dev->net->max_mtu = MAX_SINGLE_PACKET_SIZE;
return 0;
cancel_work:
cancel_work_sync(&pdata->set_multicast);
free_pdata:
kfree(pdata);
dev->data[0] = 0;
return ret;
}
static void smsc75xx_unbind(struct usbnet *dev, struct usb_interface *intf)
{
struct smsc75xx_priv *pdata = (struct smsc75xx_priv *)(dev->data[0]);
if (pdata) {
cancel_work_sync(&pdata->set_multicast);
netif_dbg(dev, ifdown, dev->net, "free pdata\n");
kfree(pdata);
dev->data[0] = 0;
}
}
static u16 smsc_crc(const u8 *buffer, size_t len)
Annotation
- Immediate include surface: `linux/module.h`, `linux/kmod.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `linux/ethtool.h`, `linux/mii.h`, `linux/usb.h`, `linux/bitrev.h`.
- Detected declarations: `struct smsc75xx_priv`, `function __smsc75xx_read_reg`, `function __smsc75xx_write_reg`, `function smsc75xx_read_reg_nopm`, `function smsc75xx_write_reg_nopm`, `function smsc75xx_read_reg`, `function smsc75xx_write_reg`, `function __smsc75xx_phy_wait_not_busy`, `function __smsc75xx_mdio_read`, `function __smsc75xx_mdio_write`.
- 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.
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.