usb_ethernet.h (185948) | usb_ethernet.h (188412) |
---|---|
1/* $FreeBSD: head/sys/dev/usb2/ethernet/usb2_ethernet.h 185948 2008-12-11 23:13:02Z thompsa $ */ | 1/* $FreeBSD: head/sys/dev/usb2/ethernet/usb2_ethernet.h 188412 2009-02-09 22:02:38Z thompsa $ */ |
2/*- 3 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. --- 19 unchanged lines hidden (view full) --- 29 30#include "opt_inet.h" 31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/mbuf.h> 35#include <sys/socket.h> 36#include <sys/sockio.h> | 2/*- 3 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. --- 19 unchanged lines hidden (view full) --- 29 30#include "opt_inet.h" 31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/mbuf.h> 35#include <sys/socket.h> 36#include <sys/sockio.h> |
37#include <sys/limits.h> |
|
37 38#include <net/if.h> 39#include <net/if_arp.h> 40#include <net/if_dl.h> 41#include <net/if_media.h> 42#include <net/if_types.h> 43#include <net/bpf.h> 44#include <net/ethernet.h> 45 46#include "miibus_if.h" 47 48#include <dev/mii/mii.h> 49#include <dev/mii/miivar.h> 50 | 38 39#include <net/if.h> 40#include <net/if_arp.h> 41#include <net/if_dl.h> 42#include <net/if_media.h> 43#include <net/if_types.h> 44#include <net/bpf.h> 45#include <net/ethernet.h> 46 47#include "miibus_if.h" 48 49#include <dev/mii/mii.h> 50#include <dev/mii/miivar.h> 51 |
51#define USB_ETHER_HASH_MAX 64 /* bytes */ | 52struct usb2_ether; 53struct usb2_device_request; |
52 | 54 |
53struct usb2_ether_cc { 54 uint32_t if_flags; 55 uint16_t if_rxfilt; 56 uint8_t if_lladdr[ETHER_ADDR_LEN]; 57 uint8_t if_mhash; 58 uint8_t if_nhash; 59 uint8_t if_hash[USB_ETHER_HASH_MAX]; | 55typedef void (usb2_ether_fn_t)(struct usb2_ether *); 56 57struct usb2_ether_methods { 58 usb2_ether_fn_t *ue_attach_post; 59 usb2_ether_fn_t *ue_start; 60 usb2_ether_fn_t *ue_init; 61 usb2_ether_fn_t *ue_stop; 62 usb2_ether_fn_t *ue_setmulti; 63 usb2_ether_fn_t *ue_setpromisc; 64 usb2_ether_fn_t *ue_tick; 65 int (*ue_mii_upd)(struct ifnet *); 66 void (*ue_mii_sts)(struct ifnet *, 67 struct ifmediareq *); 68 int (*ue_ioctl)(struct ifnet *, u_long, caddr_t); 69 |
60}; 61 | 70}; 71 |
62typedef void (usb2_ether_mchash_t)(struct usb2_ether_cc *cc, const uint8_t *ptr); | 72struct usb2_ether_cfg_task { 73 struct usb2_proc_msg hdr; 74 struct usb2_ether *ue; 75}; |
63 | 76 |
64struct mbuf *usb2_ether_get_mbuf(void); 65void usb2_ether_cc(struct ifnet *ifp, usb2_ether_mchash_t *fhash, 66 struct usb2_ether_cc *cc); | 77struct usb2_ether { 78 /* NOTE: the "ue_ifp" pointer must be first --hps */ 79 struct ifnet *ue_ifp; 80 struct mtx *ue_mtx; 81 const struct usb2_ether_methods *ue_methods; 82 struct sysctl_oid *ue_sysctl_oid; 83 void *ue_sc; 84 struct usb2_device *ue_udev; /* used by usb2_ether_do_request() */ 85 device_t ue_dev; 86 device_t ue_miibus; |
67 | 87 |
88 struct usb2_process ue_tq; 89 struct sysctl_ctx_list ue_sysctl_ctx; 90 struct ifqueue ue_rxq; 91 struct usb2_callout ue_watchdog; 92 struct usb2_ether_cfg_task ue_sync_task[2]; 93 struct usb2_ether_cfg_task ue_media_task[2]; 94 struct usb2_ether_cfg_task ue_multi_task[2]; 95 struct usb2_ether_cfg_task ue_promisc_task[2]; 96 struct usb2_ether_cfg_task ue_tick_task[2]; 97 98 int ue_unit; 99 100 /* ethernet address from eeprom */ 101 uint8_t ue_eaddr[ETHER_ADDR_LEN]; 102}; 103 104#define usb2_ether_do_request(ue,req,data,timo) \ 105 usb2_do_request_proc((ue)->ue_udev,&(ue)->ue_tq,req,data,0,NULL,timo) 106 107uint8_t usb2_ether_pause(struct usb2_ether *, unsigned int); 108struct ifnet *usb2_ether_getifp(struct usb2_ether *); 109struct mii_data *usb2_ether_getmii(struct usb2_ether *); 110void *usb2_ether_getsc(struct usb2_ether *); 111int usb2_ether_ifattach(struct usb2_ether *); 112void usb2_ether_ifdetach(struct usb2_ether *); 113int usb2_ether_ioctl(struct ifnet *, u_long, caddr_t); 114int usb2_ether_rxmbuf(struct usb2_ether *, struct mbuf *, 115 unsigned int); 116int usb2_ether_rxbuf(struct usb2_ether *, 117 struct usb2_page_cache *, 118 unsigned int, unsigned int); 119void usb2_ether_rxflush(struct usb2_ether *); 120void usb2_ether_ifshutdown(struct usb2_ether *); 121uint8_t usb2_ether_is_gone(struct usb2_ether *); |
|
68#endif /* _USB2_ETHERNET_H_ */ | 122#endif /* _USB2_ETHERNET_H_ */ |