FreeBSD kernel usb device Code
|
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/condvar.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <sys/sysctl.h>
#include <sys/sx.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/ethernet.h>
#include <net/if_types.h>
#include <net/if_media.h>
#include <net/if_vlan_var.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usb_process.h>
#include <dev/usb/net/usb_ethernet.h>
Go to the source code of this file.
Macros | |
#define | UE_LOCK(_ue) mtx_lock((_ue)->ue_mtx) |
#define | UE_UNLOCK(_ue) mtx_unlock((_ue)->ue_mtx) |
#define | UE_LOCK_ASSERT(_ue, t) mtx_assert((_ue)->ue_mtx, t) |
Functions | |
__FBSDID ("$FreeBSD$") | |
static | SYSCTL_NODE (_net, OID_AUTO, ue, CTLFLAG_RD|CTLFLAG_MPSAFE, 0, "USB Ethernet parameters") |
MODULE_DEPEND (uether, usb, 1, 1, 1) | |
MODULE_DEPEND (uether, miibus, 1, 1, 1) | |
static void | ue_init (void *) |
static void | ue_start (struct ifnet *) |
static int | ue_ifmedia_upd (struct ifnet *) |
static void | ue_watchdog (void *) |
uint8_t | uether_pause (struct usb_ether *ue, unsigned int _ticks) |
static void | ue_queue_command (struct usb_ether *ue, usb_proc_callback_t *fn, struct usb_proc_msg *t0, struct usb_proc_msg *t1) |
struct ifnet * | uether_getifp (struct usb_ether *ue) |
struct mii_data * | uether_getmii (struct usb_ether *ue) |
void * | uether_getsc (struct usb_ether *ue) |
static int | ue_sysctl_parent (SYSCTL_HANDLER_ARGS) |
int | uether_ifattach (struct usb_ether *ue) |
void | uether_ifattach_wait (struct usb_ether *ue) |
static void | ue_attach_post_task (struct usb_proc_msg *_task) |
void | uether_ifdetach (struct usb_ether *ue) |
uint8_t | uether_is_gone (struct usb_ether *ue) |
void | uether_init (void *arg) |
static void | ue_start_task (struct usb_proc_msg *_task) |
static void | ue_stop_task (struct usb_proc_msg *_task) |
void | uether_start (struct ifnet *ifp) |
static void | ue_promisc_task (struct usb_proc_msg *_task) |
static void | ue_setmulti_task (struct usb_proc_msg *_task) |
int | uether_ifmedia_upd (struct ifnet *ifp) |
static void | ue_ifmedia_task (struct usb_proc_msg *_task) |
static void | ue_tick_task (struct usb_proc_msg *_task) |
int | uether_ioctl (struct ifnet *ifp, u_long command, caddr_t data) |
static int | uether_modevent (module_t mod, int type, void *data) |
struct mbuf * | uether_newbuf (void) |
int | uether_rxmbuf (struct usb_ether *ue, struct mbuf *m, unsigned int len) |
int | uether_rxbuf (struct usb_ether *ue, struct usb_page_cache *pc, unsigned int offset, unsigned int len) |
void | uether_rxflush (struct usb_ether *ue) |
DECLARE_MODULE (uether, uether_mod, SI_SUB_DRIVERS, SI_ORDER_ANY) | |
MODULE_VERSION (uether, 1) | |
Variables | |
static struct unrhdr * | ueunit |
static usb_proc_callback_t | ue_attach_post_task |
static usb_proc_callback_t | ue_promisc_task |
static usb_proc_callback_t | ue_setmulti_task |
static usb_proc_callback_t | ue_ifmedia_task |
static usb_proc_callback_t | ue_tick_task |
static usb_proc_callback_t | ue_start_task |
static usb_proc_callback_t | ue_stop_task |
static moduledata_t | uether_mod |
#define UE_LOCK | ( | _ue | ) | mtx_lock((_ue)->ue_mtx) |
Definition at line 66 of file usb_ethernet.c.
#define UE_LOCK_ASSERT | ( | _ue, | |
t | |||
) | mtx_assert((_ue)->ue_mtx, t) |
Definition at line 68 of file usb_ethernet.c.
#define UE_UNLOCK | ( | _ue | ) | mtx_unlock((_ue)->ue_mtx) |
Definition at line 67 of file usb_ethernet.c.
__FBSDID | ( | "$FreeBSD$" | ) |
DECLARE_MODULE | ( | uether | , |
uether_mod | , | ||
SI_SUB_DRIVERS | , | ||
SI_ORDER_ANY | |||
) |
MODULE_DEPEND | ( | uether | , |
miibus | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | uether | , |
usb | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_VERSION | ( | uether | , |
1 | |||
) |
|
static |
|
static |
Definition at line 205 of file usb_ethernet.c.
References error, fail, usb_ether_cfg_task::ue, usb_ether_methods::ue_attach_post, usb_ether_methods::ue_attach_post_sub, usb_ether::ue_dev, usb_ether::ue_eaddr, ue_ifmedia_upd(), usb_ether::ue_ifp, ue_init(), usb_ether_methods::ue_ioctl, UE_LOCK, usb_ether::ue_methods, usb_ether_methods::ue_mii_sts, usb_ether_methods::ue_mii_upd, usb_ether::ue_miibus, usb_ether::ue_mtx, usb_ether::ue_rxq, ue_start(), usb_ether::ue_sysctl_ctx, usb_ether::ue_sysctl_oid, ue_sysctl_parent(), usb_ether::ue_unit, UE_UNLOCK, usb_ether::ue_watchdog, uether_ioctl(), ueunit, and usb_callout_init_mtx.
|
static |
Definition at line 472 of file usb_ethernet.c.
References usb_ether_cfg_task::ue, usb_ether::ue_ifp, usb_ether::ue_methods, and usb_ether_methods::ue_mii_upd.
|
static |
Definition at line 457 of file usb_ethernet.c.
References usb_ether_cfg_task::hdr, ue_ifmedia_task, UE_LOCK, usb_ether::ue_media_task, ue_queue_command(), and UE_UNLOCK.
Referenced by ue_attach_post_task(), and uether_ifmedia_upd().
|
static |
Definition at line 365 of file usb_ethernet.c.
References usb_ether_cfg_task::hdr, UE_LOCK, ue_queue_command(), ue_start_task, usb_ether::ue_sync_task, and UE_UNLOCK.
Referenced by ue_attach_post_task(), and uether_init().
|
static |
Definition at line 430 of file usb_ethernet.c.
References usb_ether_cfg_task::ue, usb_ether::ue_methods, and usb_ether_methods::ue_setpromisc.
|
static |
Definition at line 105 of file usb_ethernet.c.
References usb_ether_cfg_task::hdr, usb_proc_msg::pm_callback, usb_ether_cfg_task::ue, UE_LOCK_ASSERT, ue_start_task, ue_stop_task, usb_ether::ue_tq, usb_proc_is_gone(), usb_proc_msignal(), and usb_proc_mwait().
Referenced by ue_ifmedia_upd(), ue_init(), ue_watchdog(), uether_ifattach(), and uether_ioctl().
|
static |
Definition at line 440 of file usb_ethernet.c.
References usb_ether_cfg_task::ue, usb_ether::ue_methods, and usb_ether_methods::ue_setmulti.
|
static |
Definition at line 417 of file usb_ethernet.c.
References UE_LOCK, usb_ether::ue_methods, usb_ether_methods::ue_start, and UE_UNLOCK.
Referenced by ue_attach_post_task(), and uether_start().
|
static |
Definition at line 377 of file usb_ethernet.c.
References usb_ether_cfg_task::ue, usb_ether::ue_ifp, usb_ether_methods::ue_init, UE_LOCK_ASSERT, usb_ether::ue_methods, usb_ether_methods::ue_tick, ue_watchdog(), usb_ether::ue_watchdog, and usb_callout_reset.
|
static |
Definition at line 396 of file usb_ethernet.c.
References usb_ether_cfg_task::ue, UE_LOCK_ASSERT, usb_ether::ue_methods, usb_ether_methods::ue_stop, usb_ether::ue_watchdog, and usb_callout_stop.
|
static |
Definition at line 154 of file usb_ethernet.c.
References name, req, and usb_ether::ue_dev.
Referenced by ue_attach_post_task().
|
static |
Definition at line 499 of file usb_ethernet.c.
References usb_ether_cfg_task::ue, usb_ether::ue_ifp, usb_ether::ue_methods, and usb_ether_methods::ue_tick.
|
static |
Definition at line 483 of file usb_ethernet.c.
References usb_ether_cfg_task::hdr, usb_ether::ue_ifp, ue_queue_command(), ue_tick_task, usb_ether::ue_tick_task, ue_watchdog(), usb_ether::ue_watchdog, and usb_callout_reset.
Referenced by ue_start_task(), and ue_watchdog().
struct ifnet * uether_getifp | ( | struct usb_ether * | ue | ) |
Definition at line 136 of file usb_ethernet.c.
References usb_ether::ue_ifp.
Referenced by aue_bulk_read_callback(), aue_bulk_write_callback(), aue_init(), aue_intr_callback(), aue_setmulti(), aue_setpromisc(), aue_stop(), axe_bulk_write_callback(), axe_csum_cfg(), axe_init(), axe_miibus_statchg(), axe_setmulti(), axe_setpromisc(), axe_stop(), axge_bulk_write_callback(), axge_csum_cfg(), axge_init(), axge_miibus_statchg(), axge_rxfilter(), axge_stop(), cdce_attach_post_sub(), cdce_bulk_write_callback(), cdce_init(), cdce_intr_read_callback(), cdce_set_filter(), cdce_stop(), cdceem_bulk_write_callback(), cdceem_handle_data(), cdceem_init(), cdceem_send_data(), cdceem_stop(), cue_bulk_read_callback(), cue_bulk_write_callback(), cue_init(), cue_setmulti(), cue_setpromisc(), cue_stop(), cue_tick(), ipheth_bulk_write_callback(), ipheth_init(), kue_bulk_read_callback(), kue_bulk_write_callback(), kue_init(), kue_setmulti(), kue_setpromisc(), kue_stop(), lan78xx_miibus_statchg(), mos_bulk_read_callback(), mos_bulk_write_callback(), mos_init(), mos_intr_callback(), mos_setmulti(), mos_setpromisc(), mos_stop(), muge_bulk_read_callback(), muge_bulk_write_callback(), muge_init(), muge_sethwcsum(), muge_setmulti(), muge_setpromisc(), muge_stop(), rue_bulk_read_callback(), rue_bulk_write_callback(), rue_init(), rue_intr_callback(), rue_setmulti(), rue_setpromisc(), rue_stop(), smsc_bulk_read_callback(), smsc_bulk_write_callback(), smsc_init(), smsc_miibus_statchg(), smsc_sethwcsum(), smsc_setmulti(), smsc_setpromisc(), smsc_stop(), udav_bulk_read_callback(), udav_bulk_write_callback(), udav_init(), udav_setmulti(), udav_setpromisc(), udav_stop(), ure_bulk_read_callback(), ure_bulk_write_callback(), ure_init(), ure_link_state(), ure_miibus_statchg(), ure_rtl8153b_nic_reset(), ure_rxfilter(), ure_stop(), ure_tick(), urndis_bulk_read_callback(), urndis_bulk_write_callback(), urndis_init(), and urndis_stop().
struct mii_data * uether_getmii | ( | struct usb_ether * | ue | ) |
Definition at line 142 of file usb_ethernet.c.
References usb_ether::ue_miibus.
Referenced by lan78xx_miibus_statchg(), muge_ifmedia_sts(), muge_ifmedia_upd(), muge_tick(), smsc_ifmedia_sts(), smsc_ifmedia_upd(), smsc_miibus_statchg(), and smsc_tick().
void * uether_getsc | ( | struct usb_ether * | ue | ) |
Definition at line 148 of file usb_ethernet.c.
References usb_ether::ue_sc.
Referenced by aue_attach_post(), aue_init(), aue_setmulti(), aue_setpromisc(), aue_start(), aue_stop(), aue_tick(), axe_attach_post(), axe_attach_post_sub(), axe_csum_cfg(), axe_init(), axe_ioctl(), axe_rx_frame(), axe_setmulti(), axe_setpromisc(), axe_start(), axe_stop(), axe_tick(), axge_attach_post(), axge_csum_cfg(), axge_init(), axge_ioctl(), axge_rxfilter(), axge_start(), axge_stop(), axge_tick(), cdce_attach_post_sub(), cdce_init(), cdce_ioctl(), cdce_set_filter(), cdce_start(), cdce_stop(), cdceem_init(), cdceem_start(), cdceem_stop(), cue_attach_post(), cue_init(), cue_setmulti(), cue_setpromisc(), cue_start(), cue_stop(), cue_tick(), ipheth_init(), ipheth_start(), ipheth_stop(), ipheth_tick(), kue_attach_post(), kue_init(), kue_setmulti(), kue_setpromisc(), kue_start(), kue_stop(), mos_attach_post(), mos_init(), mos_setmulti(), mos_setpromisc(), mos_start(), mos_stop(), mos_tick(), muge_attach_post(), muge_attach_post_sub(), muge_init(), muge_ioctl(), muge_set_leds(), muge_set_mac_addr(), muge_setmulti(), muge_setpromisc(), muge_start(), muge_stop(), muge_tick(), rue_attach_post(), rue_init(), rue_setmulti(), rue_setpromisc(), rue_start(), rue_stop(), rue_tick(), smsc_attach_post(), smsc_attach_post_sub(), smsc_init(), smsc_ioctl(), smsc_setmulti(), smsc_setpromisc(), smsc_start(), smsc_stop(), smsc_tick(), udav_attach_post(), ure_attach_post(), ure_attach_post_sub(), ure_init(), ure_ioctl(), ure_rxfilter(), ure_start(), ure_stop(), ure_tick(), urndis_init(), urndis_start(), and urndis_stop().
int uether_ifattach | ( | struct usb_ether * | ue | ) |
Definition at line 164 of file usb_ethernet.c.
References error, usb_ether_cfg_task::hdr, ue_attach_post_task, usb_ether::ue_dev, UE_LOCK, usb_ether::ue_methods, usb_ether::ue_mtx, ue_queue_command(), usb_ether::ue_sync_task, usb_ether::ue_tq, usb_ether::ue_udev, UE_UNLOCK, USB_PRI_MED, and usb_proc_create().
Referenced by aue_attach(), axe_attach(), axge_attach(), cdce_attach(), cdceem_attach(), cue_attach(), ipheth_attach(), kue_attach(), mos_attach(), muge_attach(), rue_attach(), smsc_attach(), udav_attach(), ure_attach(), and urndis_attach().
void uether_ifattach_wait | ( | struct usb_ether * | ue | ) |
Definition at line 194 of file usb_ethernet.c.
References usb_ether_cfg_task::hdr, UE_LOCK, usb_ether::ue_sync_task, usb_ether::ue_tq, UE_UNLOCK, and usb_proc_mwait().
Referenced by muge_attach().
void uether_ifdetach | ( | struct usb_ether * | ue | ) |
Definition at line 302 of file usb_ethernet.c.
References usb_ether::ue_dev, usb_ether::ue_ifp, UE_LOCK, usb_ether::ue_miibus, usb_ether::ue_rxq, usb_ether::ue_sysctl_ctx, usb_ether::ue_tq, usb_ether::ue_unit, UE_UNLOCK, usb_ether::ue_watchdog, ueunit, usb_callout_drain, usb_proc_drain(), and usb_proc_free().
Referenced by aue_detach(), axe_detach(), axge_detach(), cdce_detach(), cdceem_detach(), cue_detach(), ipheth_detach(), kue_detach(), mos_detach(), muge_attach(), muge_detach(), rue_detach(), smsc_detach(), udav_detach(), ure_detach(), and urndis_detach().
int uether_ifmedia_upd | ( | struct ifnet * | ifp | ) |
Definition at line 450 of file usb_ethernet.c.
References ue_ifmedia_upd().
Referenced by axe_attach_post_sub(), axge_attach_post_sub(), muge_attach_post_sub(), smsc_attach_post_sub(), and ure_attach_post_sub().
void uether_init | ( | void * | arg | ) |
Definition at line 358 of file usb_ethernet.c.
References ue_init().
Referenced by axe_attach_post_sub(), axe_ioctl(), axge_attach_post_sub(), axge_ioctl(), cdce_attach_post_sub(), muge_attach_post_sub(), muge_ioctl(), smsc_attach_post_sub(), smsc_ioctl(), ure_attach_post_sub(), and ure_ioctl().
int uether_ioctl | ( | struct ifnet * | ifp, |
u_long | command, | ||
caddr_t | data | ||
) |
Definition at line 513 of file usb_ethernet.c.
References data, error, usb_ether_cfg_task::hdr, UE_LOCK, usb_ether::ue_miibus, usb_ether::ue_multi_task, ue_promisc_task, usb_ether::ue_promisc_task, ue_queue_command(), ue_setmulti_task, ue_start_task, ue_stop_task, usb_ether::ue_sync_task, and UE_UNLOCK.
Referenced by axe_ioctl(), axge_ioctl(), cdce_ioctl(), muge_ioctl(), smsc_ioctl(), ue_attach_post_task(), and ure_ioctl().
uint8_t uether_is_gone | ( | struct usb_ether * | ue | ) |
Definition at line 352 of file usb_ethernet.c.
References usb_ether::ue_tq, and usb_proc_is_gone().
|
static |
Definition at line 563 of file usb_ethernet.c.
struct mbuf * uether_newbuf | ( | void | ) |
Definition at line 584 of file usb_ethernet.c.
Referenced by cdce_bulk_read_callback(), cdceem_handle_data(), ipheth_bulk_read_callback(), muge_bulk_read_callback(), smsc_bulk_read_callback(), and uether_rxbuf().
uint8_t uether_pause | ( | struct usb_ether * | ue, |
unsigned int | _ticks | ||
) |
Definition at line 94 of file usb_ethernet.c.
References usb_ether::ue_mtx, usb_ether::ue_tq, usb_pause_mtx(), and usb_proc_is_gone().
Referenced by aue_eeprom_getword(), aue_miibus_readreg(), aue_miibus_writereg(), aue_reset(), axe_ax88178_init(), axe_ax88772_init(), axe_ax88772_phywake(), axe_reset(), axge_chip_init(), axge_reset(), cue_reset(), kue_reset(), lan78xx_eeprom_read_raw(), lan78xx_phy_init(), lan78xx_wait_for_bits(), muge_reset(), rue_reset(), smsc_eeprom_read(), smsc_phy_init(), smsc_reset(), smsc_wait_for_bits(), udav_reset(), ure_enable_aldps(), ure_init(), ure_phy_status(), ure_reset(), ure_rtl8152_nic_reset(), ure_rtl8153_init(), ure_rtl8153b_init(), and ure_rtl8153b_nic_reset().
int uether_rxbuf | ( | struct usb_ether * | ue, |
struct usb_page_cache * | pc, | ||
unsigned int | offset, | ||
unsigned int | len | ||
) |
Definition at line 616 of file usb_ethernet.c.
References len, offset, usb_ether::ue_ifp, UE_LOCK_ASSERT, usb_ether::ue_rxq, uether_newbuf(), and usbd_copy_out().
Referenced by aue_bulk_read_callback(), cue_bulk_read_callback(), kue_bulk_read_callback(), mos_bulk_read_callback(), rue_bulk_read_callback(), and udav_bulk_read_callback().
void uether_rxflush | ( | struct usb_ether * | ue | ) |
Definition at line 646 of file usb_ethernet.c.
References n, usb_ether::ue_ifp, UE_LOCK, UE_LOCK_ASSERT, usb_ether::ue_rxq, and UE_UNLOCK.
Referenced by aue_bulk_read_callback(), axe_bulk_read_callback(), axge_bulk_read_callback(), cdce_bulk_read_callback(), cdceem_bulk_read_callback(), cue_bulk_read_callback(), ipheth_bulk_read_callback(), kue_bulk_read_callback(), mos_bulk_read_callback(), muge_bulk_read_callback(), rue_bulk_read_callback(), smsc_bulk_read_callback(), udav_bulk_read_callback(), ure_bulk_read_callback(), and urndis_bulk_read_callback().
int uether_rxmbuf | ( | struct usb_ether * | ue, |
struct mbuf * | m, | ||
unsigned int | len | ||
) |
Definition at line 598 of file usb_ethernet.c.
References len, usb_ether::ue_ifp, UE_LOCK_ASSERT, and usb_ether::ue_rxq.
Referenced by cdce_bulk_read_callback(), cdceem_handle_data(), ipheth_bulk_read_callback(), muge_bulk_read_callback(), smsc_bulk_read_callback(), ure_bulk_read_callback(), and urndis_bulk_read_callback().
void uether_start | ( | struct ifnet * | ifp | ) |
Definition at line 410 of file usb_ethernet.c.
References ue_start().
Referenced by axe_attach_post_sub(), axge_attach_post_sub(), cdce_attach_post_sub(), muge_attach_post_sub(), smsc_attach_post_sub(), and ure_attach_post_sub().
|
static |
Definition at line 75 of file usb_ethernet.c.
Referenced by uether_ifattach().
|
static |
Definition at line 78 of file usb_ethernet.c.
Referenced by ue_ifmedia_upd().
|
static |
Definition at line 76 of file usb_ethernet.c.
Referenced by uether_ioctl().
|
static |
Definition at line 77 of file usb_ethernet.c.
Referenced by uether_ioctl().
|
static |
Definition at line 80 of file usb_ethernet.c.
Referenced by ue_init(), ue_queue_command(), and uether_ioctl().
|
static |
Definition at line 81 of file usb_ethernet.c.
Referenced by ue_queue_command(), and uether_ioctl().
|
static |
Definition at line 79 of file usb_ethernet.c.
Referenced by ue_watchdog().
|
static |
Definition at line 577 of file usb_ethernet.c.
|
static |
Definition at line 73 of file usb_ethernet.c.
Referenced by ue_attach_post_task(), uether_ifdetach(), and uether_modevent().