iPXE
Functions | Variables
smsc95xx.c File Reference

SMSC LAN95xx USB Ethernet driver. More...

#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <byteswap.h>
#include <ipxe/ethernet.h>
#include <ipxe/usb.h>
#include <ipxe/usbnet.h>
#include <ipxe/profile.h>
#include <ipxe/base16.h>
#include <ipxe/smbios.h>
#include "smsc95xx.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
static int smsc95xx_vm3_fetch_mac (struct smscusb_device *smscusb)
 Construct MAC address for Honeywell VM3. More...
 
static int smsc95xx_fetch_mac (struct smscusb_device *smscusb)
 Fetch MAC address. More...
 
static int smsc95xx_dump_statistics (struct smscusb_device *smscusb)
 Dump statistics (for debugging) More...
 
static int smsc95xx_reset (struct smscusb_device *smscusb)
 Reset device. More...
 
static void smsc95xx_in_complete (struct usb_endpoint *ep, struct io_buffer *iobuf, int rc)
 Complete bulk IN transfer. More...
 
static int smsc95xx_out_transmit (struct smscusb_device *smscusb, struct io_buffer *iobuf)
 Transmit packet. More...
 
static int smsc95xx_open (struct net_device *netdev)
 Open network device. More...
 
static void smsc95xx_close (struct net_device *netdev)
 Close network device. More...
 
static int smsc95xx_transmit (struct net_device *netdev, struct io_buffer *iobuf)
 Transmit packet. More...
 
static void smsc95xx_poll (struct net_device *netdev)
 Poll for completed and received packets. More...
 
static int smsc95xx_probe (struct usb_function *func, struct usb_configuration_descriptor *config)
 Probe device. More...
 
static void smsc95xx_remove (struct usb_function *func)
 Remove device. More...
 

Variables

static struct profiler smsc95xx_in_profiler __profiler
 Bulk IN completion profiler. More...
 
static struct usb_endpoint_driver_operations smsc95xx_in_operations
 Bulk IN endpoint operations. More...
 
static struct net_device_operations smsc95xx_operations
 SMSC95xx network device operations. More...
 
static struct usb_device_id smsc95xx_ids []
 SMSC95xx device IDs. More...
 
struct usb_driver smsc95xx_driver __usb_driver
 SMSC LAN95xx driver. More...
 

Detailed Description

SMSC LAN95xx USB Ethernet driver.

Definition in file smsc95xx.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ smsc95xx_vm3_fetch_mac()

static int smsc95xx_vm3_fetch_mac ( struct smscusb_device smscusb)
static

Construct MAC address for Honeywell VM3.

Parameters
smscusbSMSC USB device
Return values
rcReturn status code

Definition at line 65 of file smsc95xx.c.

65  {
66  struct net_device *netdev = smscusb->netdev;
67  struct smbios_structure structure;
69  struct {
70  char manufacturer[ 10 /* "Honeywell" + NUL */ ];
71  char product[ 4 /* "VM3" + NUL */ ];
72  char mac[ base16_encoded_len ( ETH_ALEN ) + 1 /* NUL */ ];
73  } strings;
74  int len;
75  int rc;
76 
77  /* Find system information */
79  &structure ) ) != 0 ) {
80  DBGC ( smscusb, "SMSC95XX %p could not find system "
81  "information: %s\n", smscusb, strerror ( rc ) );
82  return rc;
83  }
84 
85  /* Read system information */
86  if ( ( rc = read_smbios_structure ( &structure, &system,
87  sizeof ( system ) ) ) != 0 ) {
88  DBGC ( smscusb, "SMSC95XX %p could not read system "
89  "information: %s\n", smscusb, strerror ( rc ) );
90  return rc;
91  }
92 
93  /* NUL-terminate all strings to be fetched */
94  memset ( &strings, 0, sizeof ( strings ) );
95 
96  /* Fetch system manufacturer name */
97  len = read_smbios_string ( &structure, system.manufacturer,
98  strings.manufacturer,
99  ( sizeof ( strings.manufacturer ) - 1 ) );
100  if ( len < 0 ) {
101  rc = len;
102  DBGC ( smscusb, "SMSC95XX %p could not read manufacturer "
103  "name: %s\n", smscusb, strerror ( rc ) );
104  return rc;
105  }
106 
107  /* Fetch system product name */
108  len = read_smbios_string ( &structure, system.product, strings.product,
109  ( sizeof ( strings.product ) - 1 ) );
110  if ( len < 0 ) {
111  rc = len;
112  DBGC ( smscusb, "SMSC95XX %p could not read product name: "
113  "%s\n", smscusb, strerror ( rc ) );
114  return rc;
115  }
116 
117  /* Ignore non-VM3 devices */
118  if ( ( strcmp ( strings.manufacturer, "Honeywell" ) != 0 ) ||
119  ( strcmp ( strings.product, "VM3" ) != 0 ) )
120  return -ENOTTY;
121 
122  /* Find OEM strings */
124  &structure ) ) != 0 ) {
125  DBGC ( smscusb, "SMSC95XX %p could not find OEM strings: %s\n",
126  smscusb, strerror ( rc ) );
127  return rc;
128  }
129 
130  /* Fetch MAC address */
132  strings.mac, ( sizeof ( strings.mac ) - 1 ));
133  if ( len < 0 ) {
134  rc = len;
135  DBGC ( smscusb, "SMSC95XX %p could not read OEM string: %s\n",
136  smscusb, strerror ( rc ) );
137  return rc;
138  }
139 
140  /* Sanity check */
141  if ( len != ( ( int ) ( sizeof ( strings.mac ) - 1 ) ) ) {
142  DBGC ( smscusb, "SMSC95XX %p invalid MAC address \"%s\"\n",
143  smscusb, strings.mac );
144  return -EINVAL;
145  }
146 
147  /* Decode MAC address */
148  len = base16_decode ( strings.mac, netdev->hw_addr, ETH_ALEN );
149  if ( len < 0 ) {
150  rc = len;
151  DBGC ( smscusb, "SMSC95XX %p invalid MAC address \"%s\"\n",
152  smscusb, strings.mac );
153  return rc;
154  }
155 
156  DBGC ( smscusb, "SMSC95XX %p using VM3 MAC %s\n",
157  smscusb, eth_ntoa ( netdev->hw_addr ) );
158  return 0;
159 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
#define SMSC95XX_VM3_OEM_STRING_MAC
Honeywell VM3 MAC address OEM string index.
Definition: smsc95xx.h:178
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
uint8_t product
Product string.
Definition: smbios.h:105
#define DBGC(...)
Definition: compiler.h:505
int read_smbios_structure(struct smbios_structure *structure, void *data, size_t len)
Copy SMBIOS structure.
Definition: smbios.c:184
uint8_t mac[ETH_ALEN]
MAC address.
Definition: ena.h:24
static size_t base16_encoded_len(size_t raw_len)
Calculate length of base16-encoded data.
Definition: base16.h:21
#define SMBIOS_TYPE_OEM_STRINGS
SMBIOS OEM strings structure type.
Definition: smbios.h:156
int find_smbios_structure(unsigned int type, unsigned int instance, struct smbios_structure *structure)
Find specific structure type within SMBIOS.
Definition: smbios.c:118
static struct net_device * netdev
Definition: gdbudp.c:52
int read_smbios_string(struct smbios_structure *structure, unsigned int index, void *data, size_t len)
Find indexed string within SMBIOS structure.
Definition: smbios.c:204
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
Definition: ethernet.c:175
A network device.
Definition: netdevice.h:348
#define ETH_ALEN
Definition: if_ether.h:8
SMBIOS system information structure.
Definition: smbios.h:99
uint32_t len
Length.
Definition: ena.h:14
#define ENOTTY
Inappropriate I/O control operation.
Definition: errno.h:594
int strcmp(const char *first, const char *second)
Compare strings.
Definition: string.c:157
uint8_t manufacturer
Manufacturer string.
Definition: smbios.h:103
struct net_device * netdev
Network device.
Definition: smscusb.h:153
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
Definition: netdevice.h:375
SMBIOS structure descriptor.
Definition: smbios.h:89
#define SMBIOS_TYPE_SYSTEM_INFORMATION
SMBIOS system information structure type.
Definition: smbios.h:117
uint8_t system[ETH_ALEN]
System identifier.
Definition: eth_slow.h:24
void * memset(void *dest, int character, size_t len) __nonnull

References base16_encoded_len(), DBGC, EINVAL, ENOTTY, ETH_ALEN, eth_ntoa(), find_smbios_structure(), net_device::hw_addr, len, mac, smbios_system_information::manufacturer, memset(), netdev, smscusb_device::netdev, smbios_system_information::product, rc, read_smbios_string(), read_smbios_structure(), SMBIOS_TYPE_OEM_STRINGS, SMBIOS_TYPE_SYSTEM_INFORMATION, SMSC95XX_VM3_OEM_STRING_MAC, strcmp(), strerror(), and system.

Referenced by smsc95xx_fetch_mac().

◆ smsc95xx_fetch_mac()

static int smsc95xx_fetch_mac ( struct smscusb_device smscusb)
static

Fetch MAC address.

Parameters
smscusbSMSC USB device
Return values
rcReturn status code

Definition at line 167 of file smsc95xx.c.

167  {
168  struct net_device *netdev = smscusb->netdev;
169  int rc;
170 
171  /* Read MAC address from EEPROM, if present */
172  if ( ( rc = smscusb_eeprom_fetch_mac ( smscusb,
173  SMSC95XX_E2P_BASE ) ) == 0 )
174  return 0;
175 
176  /* Read MAC address from device tree, if present */
177  if ( ( rc = smscusb_fdt_fetch_mac ( smscusb ) ) == 0 )
178  return 0;
179 
180  /* Construct MAC address for Honeywell VM3, if applicable */
181  if ( ( rc = smsc95xx_vm3_fetch_mac ( smscusb ) ) == 0 )
182  return 0;
183 
184  /* Otherwise, generate a random MAC address */
186  DBGC ( smscusb, "SMSC95XX %p using random MAC %s\n",
187  smscusb, eth_ntoa ( netdev->hw_addr ) );
188  return 0;
189 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define DBGC(...)
Definition: compiler.h:505
#define SMSC95XX_E2P_BASE
EEPROM register base.
Definition: smsc95xx.h:41
static struct net_device * netdev
Definition: gdbudp.c:52
int smscusb_eeprom_fetch_mac(struct smscusb_device *smscusb, unsigned int e2p_base)
Fetch MAC address from EEPROM.
Definition: smscusb.c:215
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
Definition: ethernet.c:175
A network device.
Definition: netdevice.h:348
static int smsc95xx_vm3_fetch_mac(struct smscusb_device *smscusb)
Construct MAC address for Honeywell VM3.
Definition: smsc95xx.c:65
struct net_device * netdev
Network device.
Definition: smscusb.h:153
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
Definition: netdevice.h:375
int smscusb_fdt_fetch_mac(struct smscusb_device *smscusb)
Fetch MAC address from device tree.
Definition: smscusb.c:456
void eth_random_addr(void *hw_addr)
Generate random Ethernet address.
Definition: ethernet.c:159

References DBGC, eth_ntoa(), eth_random_addr(), net_device::hw_addr, netdev, smscusb_device::netdev, rc, SMSC95XX_E2P_BASE, smsc95xx_vm3_fetch_mac(), smscusb_eeprom_fetch_mac(), and smscusb_fdt_fetch_mac().

Referenced by smsc95xx_probe().

◆ smsc95xx_dump_statistics()

static int smsc95xx_dump_statistics ( struct smscusb_device smscusb)
static

Dump statistics (for debugging)

Parameters
smscusbSMSC USB device
Return values
rcReturn status code

Definition at line 204 of file smsc95xx.c.

204  {
205  struct smsc95xx_rx_statistics rx;
206  struct smsc95xx_tx_statistics tx;
207  int rc;
208 
209  /* Do nothing unless debugging is enabled */
210  if ( ! DBG_LOG )
211  return 0;
212 
213  /* Get RX statistics */
215  &rx, sizeof ( rx ) ) ) != 0 ) {
216  DBGC ( smscusb, "SMSC95XX %p could not get RX statistics: "
217  "%s\n", smscusb, strerror ( rc ) );
218  return rc;
219  }
220 
221  /* Get TX statistics */
223  &tx, sizeof ( tx ) ) ) != 0 ) {
224  DBGC ( smscusb, "SMSC95XX %p could not get TX statistics: "
225  "%s\n", smscusb, strerror ( rc ) );
226  return rc;
227  }
228 
229  /* Dump statistics */
230  DBGC ( smscusb, "SMSC95XX %p RX good %d bad %d crc %d und %d aln %d "
231  "ovr %d lat %d drp %d\n", smscusb, le32_to_cpu ( rx.good ),
232  le32_to_cpu ( rx.bad ), le32_to_cpu ( rx.crc ),
233  le32_to_cpu ( rx.undersize ), le32_to_cpu ( rx.alignment ),
234  le32_to_cpu ( rx.oversize ), le32_to_cpu ( rx.late ),
235  le32_to_cpu ( rx.dropped ) );
236  DBGC ( smscusb, "SMSC95XX %p TX good %d bad %d pau %d sgl %d mul %d "
237  "exc %d lat %d und %d def %d car %d\n", smscusb,
238  le32_to_cpu ( tx.good ), le32_to_cpu ( tx.bad ),
239  le32_to_cpu ( tx.pause ), le32_to_cpu ( tx.single ),
240  le32_to_cpu ( tx.multiple ), le32_to_cpu ( tx.excessive ),
241  le32_to_cpu ( tx.late ), le32_to_cpu ( tx.underrun ),
242  le32_to_cpu ( tx.deferred ), le32_to_cpu ( tx.carrier ) );
243 
244  return 0;
245 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
Receive statistics.
Definition: smsc95xx.h:113
#define le32_to_cpu(value)
Definition: byteswap.h:113
Transmit statistics.
Definition: smsc95xx.h:136
#define DBGC(...)
Definition: compiler.h:505
uint32_t rx
Maximum number of receive queues.
Definition: intelvf.h:16
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
uint32_t tx
Maximum number of transmit queues.
Definition: intelvf.h:14
#define SMSC95XX_RX_STATISTICS
Receive statistics.
Definition: smsc95xx.h:133
static int smscusb_get_statistics(struct smscusb_device *smscusb, unsigned int index, void *data, size_t len)
Get statistics.
Definition: smscusb.h:225
#define DBG_LOG
Definition: compiler.h:317
#define SMSC95XX_TX_STATISTICS
Transmit statistics.
Definition: smsc95xx.h:160

References DBG_LOG, DBGC, le32_to_cpu, rc, rx, SMSC95XX_RX_STATISTICS, SMSC95XX_TX_STATISTICS, smscusb_get_statistics(), strerror(), and tx.

Referenced by smsc95xx_close().

◆ smsc95xx_reset()

static int smsc95xx_reset ( struct smscusb_device smscusb)
static

Reset device.

Parameters
smscusbSMSC USB device
Return values
rcReturn status code

Definition at line 260 of file smsc95xx.c.

260  {
261  uint32_t hw_cfg;
262  uint32_t led_gpio_cfg;
263  int rc;
264 
265  /* Reset device */
266  if ( ( rc = smscusb_writel ( smscusb, SMSC95XX_HW_CFG,
267  SMSC95XX_HW_CFG_LRST ) ) != 0 )
268  return rc;
269 
270  /* Wait for reset to complete */
272 
273  /* Check that reset has completed */
274  if ( ( rc = smscusb_readl ( smscusb, SMSC95XX_HW_CFG, &hw_cfg ) ) != 0 )
275  return rc;
276  if ( hw_cfg & SMSC95XX_HW_CFG_LRST ) {
277  DBGC ( smscusb, "SMSC95XX %p failed to reset\n", smscusb );
278  return -ETIMEDOUT;
279  }
280 
281  /* Configure LEDs */
282  led_gpio_cfg = ( SMSC95XX_LED_GPIO_CFG_GPCTL2_NSPD_LED |
285  if ( ( rc = smscusb_writel ( smscusb, SMSC95XX_LED_GPIO_CFG,
286  led_gpio_cfg ) ) != 0 ) {
287  DBGC ( smscusb, "SMSC95XX %p could not configure LEDs: %s\n",
288  smscusb, strerror ( rc ) );
289  /* Ignore error and continue */
290  }
291 
292  return 0;
293 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define SMSC95XX_HW_CFG
Hardware configuration register.
Definition: smsc95xx.h:24
#define DBGC(...)
Definition: compiler.h:505
#define SMSC95XX_LED_GPIO_CFG_GPCTL0_NFDX_LED
Full-duplex LED.
Definition: smsc95xx.h:37
#define SMSC95XX_LED_GPIO_CFG_GPCTL1_NLNKA_LED
Activity LED.
Definition: smsc95xx.h:34
static int smscusb_writel(struct smscusb_device *smscusb, unsigned int address, uint32_t value)
Write register.
Definition: smscusb.h:182
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:60
static int smscusb_readl(struct smscusb_device *smscusb, unsigned int address, uint32_t *value)
Read register.
Definition: smscusb.h:203
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
unsigned int uint32_t
Definition: stdint.h:12
#define SMSC95XX_HW_CFG_LRST
Soft lite reset.
Definition: smsc95xx.h:26
#define SMSC95XX_RESET_DELAY_US
Reset delay (in microseconds)
Definition: smsc95xx.h:163
#define ETIMEDOUT
Connection timed out.
Definition: errno.h:669
#define SMSC95XX_LED_GPIO_CFG
LED GPIO configuration register.
Definition: smsc95xx.h:29
#define SMSC95XX_LED_GPIO_CFG_GPCTL2_NSPD_LED
Link speed LED.
Definition: smsc95xx.h:31

References DBGC, ETIMEDOUT, rc, SMSC95XX_HW_CFG, SMSC95XX_HW_CFG_LRST, SMSC95XX_LED_GPIO_CFG, SMSC95XX_LED_GPIO_CFG_GPCTL0_NFDX_LED, SMSC95XX_LED_GPIO_CFG_GPCTL1_NLNKA_LED, SMSC95XX_LED_GPIO_CFG_GPCTL2_NSPD_LED, SMSC95XX_RESET_DELAY_US, smscusb_readl(), smscusb_writel(), strerror(), and udelay().

Referenced by smsc95xx_close(), smsc95xx_open(), and smsc95xx_probe().

◆ smsc95xx_in_complete()

static void smsc95xx_in_complete ( struct usb_endpoint ep,
struct io_buffer iobuf,
int  rc 
)
static

Complete bulk IN transfer.

Parameters
epUSB endpoint
iobufI/O buffer
rcCompletion status code

Definition at line 309 of file smsc95xx.c.

310  {
311  struct smscusb_device *smscusb =
312  container_of ( ep, struct smscusb_device, usbnet.in );
313  struct net_device *netdev = smscusb->netdev;
314  struct smsc95xx_rx_header *header;
315 
316  /* Profile completions */
317  profile_start ( &smsc95xx_in_profiler );
318 
319  /* Ignore packets cancelled when the endpoint closes */
320  if ( ! ep->open ) {
321  free_iob ( iobuf );
322  return;
323  }
324 
325  /* Record USB errors against the network device */
326  if ( rc != 0 ) {
327  DBGC ( smscusb, "SMSC95XX %p bulk IN failed: %s\n",
328  smscusb, strerror ( rc ) );
329  goto err;
330  }
331 
332  /* Sanity check */
333  if ( iob_len ( iobuf ) < ( sizeof ( *header ) + 4 /* CRC */ ) ) {
334  DBGC ( smscusb, "SMSC95XX %p underlength bulk IN\n",
335  smscusb );
336  DBGC_HDA ( smscusb, 0, iobuf->data, iob_len ( iobuf ) );
337  rc = -EINVAL;
338  goto err;
339  }
340 
341  /* Strip header and CRC */
342  header = iobuf->data;
343  iob_pull ( iobuf, sizeof ( *header ) );
344  iob_unput ( iobuf, 4 /* CRC */ );
345 
346  /* Check for errors */
347  if ( header->command & cpu_to_le32 ( SMSC95XX_RX_RUNT |
349  SMSC95XX_RX_CRC ) ) {
350  DBGC ( smscusb, "SMSC95XX %p receive error (%08x):\n",
351  smscusb, le32_to_cpu ( header->command ) );
352  DBGC_HDA ( smscusb, 0, iobuf->data, iob_len ( iobuf ) );
353  rc = -EIO;
354  goto err;
355  }
356 
357  /* Hand off to network stack */
358  netdev_rx ( netdev, iob_disown ( iobuf ) );
359 
360  profile_stop ( &smsc95xx_in_profiler );
361  return;
362 
363  err:
364  /* Hand off to network stack */
365  netdev_rx_err ( netdev, iob_disown ( iobuf ), rc );
366 }
#define iob_pull(iobuf, len)
Definition: iobuf.h:98
#define EINVAL
Invalid argument.
Definition: errno.h:428
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
Definition: netdevice.c:501
Receive packet header.
Definition: smsc95xx.h:81
#define le32_to_cpu(value)
Definition: byteswap.h:113
An SMSC USB device.
Definition: smscusb.h:147
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:145
#define SMSC95XX_RX_LATE
Late collision.
Definition: smsc95xx.h:90
#define DBGC(...)
Definition: compiler.h:505
int open
Endpoint is open.
Definition: usb.h:404
static void profile_stop(struct profiler *profiler)
Stop profiling.
Definition: profile.h:171
#define iob_disown(iobuf)
Disown an I/O buffer.
Definition: iobuf.h:208
struct usbnet_device usbnet
USB network device.
Definition: smscusb.h:155
#define container_of(ptr, type, field)
Get containing structure.
Definition: stddef.h:35
#define DBGC_HDA(...)
Definition: compiler.h:506
static struct net_device * netdev
Definition: gdbudp.c:52
static void profile_start(struct profiler *profiler)
Start profiling.
Definition: profile.h:158
#define cpu_to_le32(value)
Definition: byteswap.h:107
#define iob_unput(iobuf, len)
Definition: iobuf.h:131
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:151
A network device.
Definition: netdevice.h:348
struct usb_endpoint in
Bulk IN endpoint.
Definition: usbnet.h:29
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
Definition: netdevice.c:470
void * data
Start of data.
Definition: iobuf.h:44
#define EIO
Input/output error.
Definition: errno.h:433
struct ena_aq_header header
Header.
Definition: ena.h:12
#define SMSC95XX_RX_CRC
CRC error.
Definition: smsc95xx.h:93
struct net_device * netdev
Network device.
Definition: smscusb.h:153
#define SMSC95XX_RX_RUNT
Runt frame.
Definition: smsc95xx.h:87

References container_of, cpu_to_le32, io_buffer::data, DBGC, DBGC_HDA, EINVAL, EIO, free_iob(), header, usbnet_device::in, iob_disown, iob_len(), iob_pull, iob_unput, le32_to_cpu, netdev, smscusb_device::netdev, netdev_rx(), netdev_rx_err(), usb_endpoint::open, profile_start(), profile_stop(), rc, SMSC95XX_RX_CRC, SMSC95XX_RX_LATE, SMSC95XX_RX_RUNT, strerror(), and smscusb_device::usbnet.

◆ smsc95xx_out_transmit()

static int smsc95xx_out_transmit ( struct smscusb_device smscusb,
struct io_buffer iobuf 
)
static

Transmit packet.

Parameters
smscusbSMSC USB device
iobufI/O buffer
Return values
rcReturn status code

Definition at line 380 of file smsc95xx.c.

381  {
382  struct smsc95xx_tx_header *header;
383  size_t len = iob_len ( iobuf );
384  int rc;
385 
386  /* Profile transmissions */
387  profile_start ( &smsc95xx_out_profiler );
388 
389  /* Prepend header */
390  if ( ( rc = iob_ensure_headroom ( iobuf, sizeof ( *header ) ) ) != 0 )
391  return rc;
392  header = iob_push ( iobuf, sizeof ( *header ) );
394  SMSC95XX_TX_LEN ( len ) );
395  header->len = cpu_to_le32 ( len );
396 
397  /* Enqueue I/O buffer */
398  if ( ( rc = usb_stream ( &smscusb->usbnet.out, iobuf, 0 ) ) != 0 )
399  return rc;
400 
401  profile_stop ( &smsc95xx_out_profiler );
402  return 0;
403 }
Transmit packet header.
Definition: smsc95xx.h:96
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define iob_push(iobuf, len)
Definition: iobuf.h:80
int usb_stream(struct usb_endpoint *ep, struct io_buffer *iobuf, int terminate)
Enqueue USB stream transfer.
Definition: usb.c:528
#define SMSC95XX_TX_LAST
Last segment.
Definition: smsc95xx.h:107
static void profile_stop(struct profiler *profiler)
Stop profiling.
Definition: profile.h:171
#define SMSC95XX_TX_LEN(len)
Buffer size.
Definition: smsc95xx.h:110
struct usb_endpoint out
Bulk OUT endpoint.
Definition: usbnet.h:31
struct usbnet_device usbnet
USB network device.
Definition: smscusb.h:155
static void profile_start(struct profiler *profiler)
Start profiling.
Definition: profile.h:158
#define cpu_to_le32(value)
Definition: byteswap.h:107
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:151
uint32_t len
Length.
Definition: ena.h:14
struct ena_aq_header header
Header.
Definition: ena.h:12
int iob_ensure_headroom(struct io_buffer *iobuf, size_t len)
Ensure I/O buffer has sufficient headroom.
Definition: iobuf.c:183
#define SMSC95XX_TX_FIRST
First segment.
Definition: smsc95xx.h:104

References cpu_to_le32, header, iob_ensure_headroom(), iob_len(), iob_push, len, usbnet_device::out, profile_start(), profile_stop(), rc, SMSC95XX_TX_FIRST, SMSC95XX_TX_LAST, SMSC95XX_TX_LEN, usb_stream(), and smscusb_device::usbnet.

Referenced by smsc95xx_transmit().

◆ smsc95xx_open()

static int smsc95xx_open ( struct net_device netdev)
static

Open network device.

Parameters
netdevNetwork device
Return values
rcReturn status code

Definition at line 418 of file smsc95xx.c.

418  {
419  struct smscusb_device *smscusb = netdev->priv;
420  int rc;
421 
422  /* Clear stored interrupt status */
423  smscusb->int_sts = 0;
424 
425  /* Configure bulk IN empty response */
426  if ( ( rc = smscusb_writel ( smscusb, SMSC95XX_HW_CFG,
427  SMSC95XX_HW_CFG_BIR ) ) != 0 )
428  goto err_hw_cfg;
429 
430  /* Open USB network device */
431  if ( ( rc = usbnet_open ( &smscusb->usbnet ) ) != 0 ) {
432  DBGC ( smscusb, "SMSC95XX %p could not open: %s\n",
433  smscusb, strerror ( rc ) );
434  goto err_open;
435  }
436 
437  /* Configure interrupt endpoint */
438  if ( ( rc = smscusb_writel ( smscusb, SMSC95XX_INT_EP_CTL,
440  SMSC95XX_INT_EP_CTL_PHY_EN ) ) ) != 0 )
441  goto err_int_ep_ctl;
442 
443  /* Configure bulk IN delay */
444  if ( ( rc = smscusb_writel ( smscusb, SMSC95XX_BULK_IN_DLY,
445  SMSC95XX_BULK_IN_DLY_SET ( 0 ) ) ) != 0 )
446  goto err_bulk_in_dly;
447 
448  /* Configure MAC */
449  if ( ( rc = smscusb_writel ( smscusb, SMSC95XX_MAC_CR,
456  SMSC95XX_MAC_CR_RXEN ) ) ) != 0 )
457  goto err_mac_cr;
458 
459  /* Configure transmit datapath */
460  if ( ( rc = smscusb_writel ( smscusb, SMSC95XX_TX_CFG,
461  SMSC95XX_TX_CFG_ON ) ) != 0 )
462  goto err_tx_cfg;
463 
464  /* Set MAC address */
465  if ( ( rc = smscusb_set_address ( smscusb, SMSC95XX_ADDR_BASE ) ) != 0 )
466  goto err_set_address;
467 
468  /* Enable PHY interrupts and update link status */
469  if ( ( rc = smscusb_mii_open ( smscusb, SMSC95XX_MII_PHY_INTR_MASK,
471  SMSC95XX_PHY_INTR_LINK_DOWN ) ) ) != 0)
472  goto err_mii_open;
473 
474  return 0;
475 
476  err_mii_open:
477  err_set_address:
478  err_tx_cfg:
479  err_mac_cr:
480  err_bulk_in_dly:
481  err_int_ep_ctl:
482  usbnet_close ( &smscusb->usbnet );
483  err_open:
484  err_hw_cfg:
485  smsc95xx_reset ( smscusb );
486  return rc;
487 }
int smscusb_set_address(struct smscusb_device *smscusb, unsigned int addr_base)
Set receive address.
Definition: smscusb.c:686
#define SMSC95XX_INT_EP_CTL_RXDF_EN
RX FIFO overflow.
Definition: smsc95xx.h:45
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define SMSC95XX_PHY_INTR_LINK_DOWN
PHY interrupt: link down.
Definition: smsc95xx.h:78
An SMSC USB device.
Definition: smscusb.h:147
#define SMSC95XX_ADDR_BASE
MAC address register base.
Definition: smsc95xx.h:63
#define SMSC95XX_HW_CFG
Hardware configuration register.
Definition: smsc95xx.h:24
#define DBGC(...)
Definition: compiler.h:505
#define SMSC95XX_BULK_IN_DLY
Bulk IN delay register.
Definition: smsc95xx.h:49
static int smscusb_writel(struct smscusb_device *smscusb, unsigned int address, uint32_t value)
Write register.
Definition: smscusb.h:182
#define SMSC95XX_HW_CFG_BIR
Bulk IN use NAK.
Definition: smsc95xx.h:25
#define SMSC95XX_TX_CFG_ON
TX enable.
Definition: smsc95xx.h:21
int smscusb_mii_open(struct smscusb_device *smscusb, unsigned int phy_mask, unsigned int intrs)
Enable PHY interrupts and update link status.
Definition: smscusb.c:655
#define SMSC95XX_MAC_CR_MCPAS
All multicast.
Definition: smsc95xx.h:56
uint32_t int_sts
Interrupt status.
Definition: smscusb.h:165
#define SMSC95XX_PHY_INTR_ANEG_DONE
PHY interrupt: auto-negotiation complete.
Definition: smsc95xx.h:75
struct usbnet_device usbnet
USB network device.
Definition: smscusb.h:155
#define SMSC95XX_MAC_CR
MAC control register.
Definition: smsc95xx.h:53
void * priv
Driver private data.
Definition: netdevice.h:425
#define SMSC95XX_INT_EP_CTL
Interrupt endpoint control register.
Definition: smsc95xx.h:44
static struct net_device * netdev
Definition: gdbudp.c:52
#define SMSC95XX_TX_CFG
Transmit configuration register.
Definition: smsc95xx.h:20
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
#define SMSC95XX_MAC_CR_TXEN
TX enabled.
Definition: smsc95xx.h:59
#define SMSC95XX_INT_EP_CTL_PHY_EN
PHY interrupt.
Definition: smsc95xx.h:46
#define SMSC95XX_MAC_CR_PRMS
Promiscuous.
Definition: smsc95xx.h:57
#define SMSC95XX_MAC_CR_FDPX
Full duplex.
Definition: smsc95xx.h:55
#define SMSC95XX_BULK_IN_DLY_SET(ticks)
Delay / 16.7ns.
Definition: smsc95xx.h:50
#define SMSC95XX_MAC_CR_PASSBAD
Pass bad frames.
Definition: smsc95xx.h:58
static int smsc95xx_reset(struct smscusb_device *smscusb)
Reset device.
Definition: smsc95xx.c:260
void usbnet_close(struct usbnet_device *usbnet)
Close USB network device.
Definition: usbnet.c:127
#define SMSC95XX_MAC_CR_RXEN
RX enabled.
Definition: smsc95xx.h:60
#define SMSC95XX_MII_PHY_INTR_MASK
PHY interrupt mask MII register.
Definition: smsc95xx.h:72
#define SMSC95XX_MAC_CR_RXALL
Receive all.
Definition: smsc95xx.h:54
int usbnet_open(struct usbnet_device *usbnet)
Open USB network device.
Definition: usbnet.c:54

References DBGC, smscusb_device::int_sts, netdev, net_device::priv, rc, SMSC95XX_ADDR_BASE, SMSC95XX_BULK_IN_DLY, SMSC95XX_BULK_IN_DLY_SET, SMSC95XX_HW_CFG, SMSC95XX_HW_CFG_BIR, SMSC95XX_INT_EP_CTL, SMSC95XX_INT_EP_CTL_PHY_EN, SMSC95XX_INT_EP_CTL_RXDF_EN, SMSC95XX_MAC_CR, SMSC95XX_MAC_CR_FDPX, SMSC95XX_MAC_CR_MCPAS, SMSC95XX_MAC_CR_PASSBAD, SMSC95XX_MAC_CR_PRMS, SMSC95XX_MAC_CR_RXALL, SMSC95XX_MAC_CR_RXEN, SMSC95XX_MAC_CR_TXEN, SMSC95XX_MII_PHY_INTR_MASK, SMSC95XX_PHY_INTR_ANEG_DONE, SMSC95XX_PHY_INTR_LINK_DOWN, smsc95xx_reset(), SMSC95XX_TX_CFG, SMSC95XX_TX_CFG_ON, smscusb_mii_open(), smscusb_set_address(), smscusb_writel(), strerror(), smscusb_device::usbnet, usbnet_close(), and usbnet_open().

◆ smsc95xx_close()

static void smsc95xx_close ( struct net_device netdev)
static

Close network device.

Parameters
netdevNetwork device

Definition at line 494 of file smsc95xx.c.

494  {
495  struct smscusb_device *smscusb = netdev->priv;
496 
497  /* Close USB network device */
498  usbnet_close ( &smscusb->usbnet );
499 
500  /* Dump statistics (for debugging) */
501  smsc95xx_dump_statistics ( smscusb );
502 
503  /* Reset device */
504  smsc95xx_reset ( smscusb );
505 }
An SMSC USB device.
Definition: smscusb.h:147
struct usbnet_device usbnet
USB network device.
Definition: smscusb.h:155
void * priv
Driver private data.
Definition: netdevice.h:425
static struct net_device * netdev
Definition: gdbudp.c:52
static int smsc95xx_dump_statistics(struct smscusb_device *smscusb)
Dump statistics (for debugging)
Definition: smsc95xx.c:204
static int smsc95xx_reset(struct smscusb_device *smscusb)
Reset device.
Definition: smsc95xx.c:260
void usbnet_close(struct usbnet_device *usbnet)
Close USB network device.
Definition: usbnet.c:127

References netdev, net_device::priv, smsc95xx_dump_statistics(), smsc95xx_reset(), smscusb_device::usbnet, and usbnet_close().

◆ smsc95xx_transmit()

static int smsc95xx_transmit ( struct net_device netdev,
struct io_buffer iobuf 
)
static

Transmit packet.

Parameters
netdevNetwork device
iobufI/O buffer
Return values
rcReturn status code

Definition at line 514 of file smsc95xx.c.

515  {
516  struct smscusb_device *smscusb = netdev->priv;
517  int rc;
518 
519  /* Transmit packet */
520  if ( ( rc = smsc95xx_out_transmit ( smscusb, iobuf ) ) != 0 )
521  return rc;
522 
523  return 0;
524 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static int smsc95xx_out_transmit(struct smscusb_device *smscusb, struct io_buffer *iobuf)
Transmit packet.
Definition: smsc95xx.c:380
An SMSC USB device.
Definition: smscusb.h:147
void * priv
Driver private data.
Definition: netdevice.h:425
static struct net_device * netdev
Definition: gdbudp.c:52

References netdev, net_device::priv, rc, and smsc95xx_out_transmit().

◆ smsc95xx_poll()

static void smsc95xx_poll ( struct net_device netdev)
static

Poll for completed and received packets.

Parameters
netdevNetwork device

Definition at line 531 of file smsc95xx.c.

531  {
532  struct smscusb_device *smscusb = netdev->priv;
534  int rc;
535 
536  /* Poll USB bus */
537  usb_poll ( smscusb->bus );
538 
539  /* Refill endpoints */
540  if ( ( rc = usbnet_refill ( &smscusb->usbnet ) ) != 0 )
541  netdev_rx_err ( netdev, NULL, rc );
542 
543  /* Do nothing more unless there are interrupts to handle */
544  int_sts = smscusb->int_sts;
545  if ( ! int_sts )
546  return;
547 
548  /* Check link status if applicable */
550  smscusb_mii_check_link ( smscusb );
552  }
553 
554  /* Record RX FIFO overflow if applicable */
556  DBGC2 ( smscusb, "SMSC95XX %p RX FIFO overflowed\n",
557  smscusb );
560  }
561 
562  /* Check for unexpected interrupts */
563  if ( int_sts ) {
564  DBGC ( smscusb, "SMSC95XX %p unexpected interrupt %#08x\n",
565  smscusb, int_sts );
567  }
568 
569  /* Clear interrupts */
570  if ( ( rc = smscusb_writel ( smscusb, SMSC95XX_INT_STS,
571  smscusb->int_sts ) ) != 0 )
572  netdev_rx_err ( netdev, NULL, rc );
573  smscusb->int_sts = 0;
574 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
Definition: netdevice.c:501
An SMSC USB device.
Definition: smscusb.h:147
#define DBGC(...)
Definition: compiler.h:505
#define SMSC95XX_INT_STS
Interrupt status register.
Definition: smsc95xx.h:15
static int smscusb_writel(struct smscusb_device *smscusb, unsigned int address, uint32_t value)
Write register.
Definition: smscusb.h:182
uint32_t int_sts
Interrupt status.
Definition: smscusb.h:165
struct usbnet_device usbnet
USB network device.
Definition: smscusb.h:155
void * priv
Driver private data.
Definition: netdevice.h:425
static struct net_device * netdev
Definition: gdbudp.c:52
int usbnet_refill(struct usbnet_device *usbnet)
Refill USB network device bulk IN and interrupt endpoints.
Definition: usbnet.c:151
#define SMSC95XX_INT_STS_PHY_INT
PHY interrupt.
Definition: smsc95xx.h:17
static void usb_poll(struct usb_bus *bus)
Poll USB bus.
Definition: usb.h:1049
#define SMSC95XX_INT_STS_RXDF_INT
RX FIFO overflow.
Definition: smsc95xx.h:16
unsigned int uint32_t
Definition: stdint.h:12
#define ENOBUFS
No buffer space available.
Definition: errno.h:498
#define DBGC2(...)
Definition: compiler.h:522
#define ENOTTY
Inappropriate I/O control operation.
Definition: errno.h:594
int smscusb_mii_check_link(struct smscusb_device *smscusb)
Check link status.
Definition: smscusb.c:613
struct usb_bus * bus
USB bus.
Definition: smscusb.h:151
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References smscusb_device::bus, DBGC, DBGC2, ENOBUFS, ENOTTY, smscusb_device::int_sts, netdev, netdev_rx_err(), NULL, net_device::priv, rc, SMSC95XX_INT_STS, SMSC95XX_INT_STS_PHY_INT, SMSC95XX_INT_STS_RXDF_INT, smscusb_mii_check_link(), smscusb_writel(), usb_poll(), smscusb_device::usbnet, and usbnet_refill().

◆ smsc95xx_probe()

static int smsc95xx_probe ( struct usb_function func,
struct usb_configuration_descriptor config 
)
static

Probe device.

Parameters
funcUSB function
configConfiguration descriptor
Return values
rcReturn status code

Definition at line 598 of file smsc95xx.c.

599  {
600  struct net_device *netdev;
601  struct smscusb_device *smscusb;
602  int rc;
603 
604  /* Allocate and initialise structure */
605  netdev = alloc_etherdev ( sizeof ( *smscusb ) );
606  if ( ! netdev ) {
607  rc = -ENOMEM;
608  goto err_alloc;
609  }
611  netdev->dev = &func->dev;
612  smscusb = netdev->priv;
613  memset ( smscusb, 0, sizeof ( *smscusb ) );
614  smscusb_init ( smscusb, netdev, func, &smsc95xx_in_operations );
617  usb_refill_init ( &smscusb->usbnet.in,
618  ( sizeof ( struct smsc95xx_tx_header ) -
619  sizeof ( struct smsc95xx_rx_header ) ),
621  DBGC ( smscusb, "SMSC95XX %p on %s\n", smscusb, func->name );
622 
623  /* Describe USB network device */
624  if ( ( rc = usbnet_describe ( &smscusb->usbnet, config ) ) != 0 ) {
625  DBGC ( smscusb, "SMSC95XX %p could not describe: %s\n",
626  smscusb, strerror ( rc ) );
627  goto err_describe;
628  }
629 
630  /* Reset device */
631  if ( ( rc = smsc95xx_reset ( smscusb ) ) != 0 )
632  goto err_reset;
633 
634  /* Read MAC address */
635  if ( ( rc = smsc95xx_fetch_mac ( smscusb ) ) != 0 )
636  goto err_fetch_mac;
637 
638  /* Register network device */
639  if ( ( rc = register_netdev ( netdev ) ) != 0 )
640  goto err_register;
641 
642  usb_func_set_drvdata ( func, netdev );
643  return 0;
644 
646  err_register:
647  err_fetch_mac:
648  err_reset:
649  err_describe:
651  netdev_put ( netdev );
652  err_alloc:
653  return rc;
654 }
Transmit packet header.
Definition: smsc95xx.h:96
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
Receive packet header.
Definition: smsc95xx.h:81
const char * name
Name.
Definition: usb.h:659
An SMSC USB device.
Definition: smscusb.h:147
static void smscusb_init(struct smscusb_device *smscusb, struct net_device *netdev, struct usb_function *func, struct usb_endpoint_driver_operations *in)
Initialise SMSC USB device.
Definition: smscusb.h:259
#define DBGC(...)
Definition: compiler.h:505
static struct net_device_operations smsc95xx_operations
SMSC95xx network device operations.
Definition: smsc95xx.c:577
static void smscusb_mii_init(struct smscusb_device *smscusb, unsigned int mii_base, unsigned int phy_source)
Initialise SMSC USB device MII interface.
Definition: smscusb.h:280
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
Definition: netdevice.h:498
#define ENOMEM
Not enough space.
Definition: errno.h:534
struct usbnet_device usbnet
USB network device.
Definition: smscusb.h:155
#define SMSC95XX_IN_MTU
Bulk IN buffer size.
Definition: smsc95xx.h:172
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
Definition: netdevice.h:555
void * priv
Driver private data.
Definition: netdevice.h:425
static void usb_refill_init(struct usb_endpoint *ep, size_t reserve, size_t len, unsigned int max)
Initialise USB endpoint refill.
Definition: usb.h:601
static struct net_device * netdev
Definition: gdbudp.c:52
#define SMSC95XX_IN_MAX_FILL
Bulk IN maximum fill level.
Definition: smsc95xx.h:169
static void usb_func_set_drvdata(struct usb_function *func, void *priv)
Set USB function driver private data.
Definition: usb.h:690
void unregister_netdev(struct net_device *netdev)
Unregister network device.
Definition: netdevice.c:844
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
int register_netdev(struct net_device *netdev)
Register network device.
Definition: netdevice.c:667
A network device.
Definition: netdevice.h:348
struct usb_endpoint in
Bulk IN endpoint.
Definition: usbnet.h:29
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
Definition: netdevice.h:511
struct device * dev
Underlying hardware device.
Definition: netdevice.h:360
static int smsc95xx_fetch_mac(struct smscusb_device *smscusb)
Fetch MAC address.
Definition: smsc95xx.c:167
static struct usb_endpoint_driver_operations smsc95xx_in_operations
Bulk IN endpoint operations.
Definition: smsc95xx.c:369
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
Definition: ethernet.c:264
static int smsc95xx_reset(struct smscusb_device *smscusb)
Reset device.
Definition: smsc95xx.c:260
int usbnet_describe(struct usbnet_device *usbnet, struct usb_configuration_descriptor *config)
Describe USB network device interfaces.
Definition: usbnet.c:277
struct device dev
Generic device.
Definition: usb.h:665
#define SMSC95XX_MII_BASE
MII register base.
Definition: smsc95xx.h:66
#define SMSC95XX_MII_PHY_INTR_SOURCE
PHY interrupt source MII register.
Definition: smsc95xx.h:69
void * memset(void *dest, int character, size_t len) __nonnull

References alloc_etherdev(), DBGC, net_device::dev, usb_function::dev, ENOMEM, usbnet_device::in, memset(), usb_function::name, netdev, netdev_init(), netdev_nullify(), netdev_put(), net_device::priv, rc, register_netdev(), smsc95xx_fetch_mac(), SMSC95XX_IN_MAX_FILL, SMSC95XX_IN_MTU, smsc95xx_in_operations, SMSC95XX_MII_BASE, SMSC95XX_MII_PHY_INTR_SOURCE, smsc95xx_operations, smsc95xx_reset(), smscusb_init(), smscusb_mii_init(), strerror(), unregister_netdev(), usb_func_set_drvdata(), usb_refill_init(), smscusb_device::usbnet, and usbnet_describe().

◆ smsc95xx_remove()

static void smsc95xx_remove ( struct usb_function func)
static

Remove device.

Parameters
funcUSB function

Definition at line 661 of file smsc95xx.c.

661  {
662  struct net_device *netdev = usb_func_get_drvdata ( func );
663 
666  netdev_put ( netdev );
667 }
static void * usb_func_get_drvdata(struct usb_function *func)
Get USB function driver private data.
Definition: usb.h:701
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
Definition: netdevice.h:555
static struct net_device * netdev
Definition: gdbudp.c:52
void unregister_netdev(struct net_device *netdev)
Unregister network device.
Definition: netdevice.c:844
A network device.
Definition: netdevice.h:348
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
Definition: netdevice.h:511

References netdev, netdev_nullify(), netdev_put(), unregister_netdev(), and usb_func_get_drvdata().

Variable Documentation

◆ __profiler

struct profiler smsc95xx_out_profiler __profiler
static
Initial value:
=
{ .name = "smsc95xx.in" }

Bulk IN completion profiler.

Bulk OUT profiler.

Definition at line 45 of file smsc95xx.c.

◆ smsc95xx_in_operations

struct usb_endpoint_driver_operations smsc95xx_in_operations
static
Initial value:
= {
.complete = smsc95xx_in_complete,
}
static void smsc95xx_in_complete(struct usb_endpoint *ep, struct io_buffer *iobuf, int rc)
Complete bulk IN transfer.
Definition: smsc95xx.c:309

Bulk IN endpoint operations.

Definition at line 369 of file smsc95xx.c.

Referenced by smsc95xx_probe().

◆ smsc95xx_operations

struct net_device_operations smsc95xx_operations
static
Initial value:
= {
.open = smsc95xx_open,
.close = smsc95xx_close,
.transmit = smsc95xx_transmit,
.poll = smsc95xx_poll,
}
static int smsc95xx_open(struct net_device *netdev)
Open network device.
Definition: smsc95xx.c:418
static void smsc95xx_close(struct net_device *netdev)
Close network device.
Definition: smsc95xx.c:494
static void smsc95xx_poll(struct net_device *netdev)
Poll for completed and received packets.
Definition: smsc95xx.c:531
static int smsc95xx_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
Definition: smsc95xx.c:514

SMSC95xx network device operations.

Definition at line 577 of file smsc95xx.c.

Referenced by smsc95xx_probe().

◆ smsc95xx_ids

struct usb_device_id smsc95xx_ids[]
static

SMSC95xx device IDs.

Definition at line 670 of file smsc95xx.c.

◆ __usb_driver

struct usb_driver smsc95xx_driver __usb_driver
Initial value:
= {
.ids = smsc95xx_ids,
.id_count = ( sizeof ( smsc95xx_ids ) / sizeof ( smsc95xx_ids[0] ) ),
.class = USB_CLASS_ID ( 0xff, 0x00, 0xff ),
.score = USB_SCORE_NORMAL,
.probe = smsc95xx_probe,
.remove = smsc95xx_remove,
}
static struct usb_device_id smsc95xx_ids[]
SMSC95xx device IDs.
Definition: smsc95xx.c:670
static int smsc95xx_probe(struct usb_function *func, struct usb_configuration_descriptor *config)
Probe device.
Definition: smsc95xx.c:598
#define USB_CLASS_ID(base, subclass, protocol)
Construct USB class ID.
Definition: usb.h:1345
Normal driver.
Definition: usb.h:1406
static void smsc95xx_remove(struct usb_function *func)
Remove device.
Definition: smsc95xx.c:661

SMSC LAN95xx driver.

Definition at line 764 of file smsc95xx.c.