38#ifdef USB_GLOBAL_INCLUDE_FILE
39#include USB_GLOBAL_INCLUDE_FILE
42#include <sys/kernel.h>
45#include <sys/malloc.h>
47#include <sys/socket.h>
48#include <sys/sockio.h>
50#include <net/if_var.h>
51#include <net/if_types.h>
52#include <net/if_clone.h>
54#include <sys/sysctl.h>
71static int usbpf_ioctl(
struct ifnet *, u_long, caddr_t);
110 error = devclass_get_devices(dc, &devlp, &devlcnt);
113 for (i = 0; i < devlcnt; i++) {
114 ubus = device_get_softc(devlp[i]);
115 if (ubus != NULL && ubus->
ifp != NULL)
139 error = ifc_name2unit(ifname, &unit);
140 if (
error || unit < 0)
145 dev = devclass_get_device(dc, unit);
149 return (device_get_softc(
dev));
160 if (ubus->
ifp != NULL)
183 if (ubus->
ifp != NULL)
186 error = ifc_alloc_unit(ifc, &unit);
188 device_printf(ubus->
parent,
"usbpf: Could not allocate "
192 ifp = ubus->
ifp = if_alloc(IFT_USB);
194 ifc_free_unit(ifc, unit);
195 device_printf(ubus->
parent,
"usbpf: Could not allocate "
199 strlcpy(
ifp->if_xname,
name,
sizeof(
ifp->if_xname));
200 ifp->if_softc = ubus;
202 ifp->if_dunit = unit;
205 ifp->if_flags |= IFF_UP;
223 ubus =
ifp->if_softc;
224 unit =
ifp->if_dunit;
236 ifc_free_unit(ifc, unit);
246 device_printf(ubus->
parent,
"usbpf: Attached\n");
253 if (ubus->
ifp != NULL)
256 device_printf(ubus->
parent,
"usbpf: Detached\n");
290 if (flags->
open == 1)
317 if (flags->bdma_enable == 1)
319 if (flags->bdma_no_post_sync == 1)
321 if (flags->bdma_setup == 1)
372 for (x = 0; x != nframes; x++) {
406 if (
bus->ifp == NULL ||
bus->ifp->if_bpf == NULL)
408 if (!bpf_peers_present(
bus->ifp->if_bpf))
424 buf = ptr = malloc(totlen, M_TEMP, M_NOWAIT);
426 device_printf(
bus->parent,
"usbpf: Out of memory\n");
434 temp = device_get_unit(
bus->bdev);
469 for (x = 0; x != nframes; x++) {
492 uf->
flags |= htole32(
499 uf->
flags |= htole32(
531 bpf_tap(
bus->ifp->if_bpf, buf, totlen);
struct usb_endpoint_descriptor * edesc
enum usb_hc_mode usb_mode
uint8_t bandwidth_reclaimed
usb_frlength_t * frlengths
struct usb_page_cache * frbuffers
struct usb_endpoint * endpoint
struct usb_xfer_flags_int flags_int
struct usb_xfer_flags flags
struct usb_xfer_root * xroot
void usbd_copy_out(struct usb_page_cache *cache, usb_frlength_t offset, void *ptr, usb_frlength_t len)
#define USB_GET_DATA_ISREAD(xfer)
#define USB_BUS_UNLOCK(_b)
void usbpf_attach(struct usb_bus *ubus)
static struct usb_bus * usbpf_ifname2ubus(const char *)
static void usbpf_uninit(void *)
static const char usbusname[]
void usbpf_xfertap(struct usb_xfer *xfer, int type)
static uint32_t usbpf_xfer_precompute_size(struct usb_xfer *, int)
static struct if_clone * usbpf_cloner
static int usbpf_xfer_frame_is_read(struct usb_xfer *, uint32_t)
static uint32_t usbpf_aggregate_xferflags(struct usb_xfer_flags *)
SYSUNINIT(usbpf_uninit, SI_SUB_PSEUDO, SI_ORDER_MIDDLE, usbpf_uninit, NULL)
static int usbpf_clone_create(struct if_clone *, char *, size_t, caddr_t)
static void usbpf_init(void *)
void usbpf_detach(struct usb_bus *ubus)
static int usbpf_ioctl(struct ifnet *, u_long, caddr_t)
static int usbpf_clone_destroy(struct if_clone *, struct ifnet *)
static int usbpf_clone_match(struct if_clone *, const char *)
SYSINIT(usbpf_init, SI_SUB_PSEUDO, SI_ORDER_MIDDLE, usbpf_init, NULL)
static uint32_t usbpf_aggregate_status(struct usb_xfer_flags_int *)
#define USBPF_STATUS_DID_CLOSE
#define USBPF_STATUS_CAN_CANCEL_IMMED
#define USBPF_FRAME_ALIGN(x)
#define USBPF_STATUS_CONTROL_XFR
#define USBPF_FLAG_FORCE_SHORT_XFER
#define USBPF_STATUS_CONTROL_ACT
#define USBPF_STATUS_SHORT_FRAMES_OK
#define USBPF_STATUS_DID_DMA_DELAY
#define USBPF_STATUS_CURR_DMA_SET
#define USBPF_STATUS_DRAINING
#define USBPF_STATUS_BDMA_ENABLE
#define USBPF_STATUS_BW_RECLAIMED
#define USBPF_STATUS_CONTROL_STALL
#define USBPF_FLAG_SHORT_XFER_OK
#define USBPF_MODE_DEVICE
#define USBPF_FRAME_HDR_LEN
#define USBPF_STATUS_ISOCHRONOUS_XFR
#define USBPF_FLAG_PROXY_BUFFER
#define USBPF_STATUS_DOING_CALLBACK
#define USBPF_FRAMEFLAG_READ
#define USBPF_STATUS_SHORT_XFER_OK
#define USBPF_FLAG_SHORT_FRAMES_OK
#define USBPF_STATUS_BDMA_SETUP
#define USBPF_STATUS_BDMA_NO_POST_SYNC
#define USBPF_STATUS_STARTED
#define USBPF_XFERTAP_SUBMIT
#define USBPF_STATUS_CONTROL_HDR
#define USBPF_STATUS_TRANSFERRING
#define USBPF_FLAG_PIPE_BOF
#define USBPF_FLAG_NO_PIPE_OK
#define USBPF_FLAG_STALL_PIPE
#define USBPF_FRAMEFLAG_DATA_FOLLOWS
#define USBPF_FLAG_EXT_BUFFER
#define USBPF_STATUS_OPEN
#define USBPF_FLAG_MANUAL_STATUS
usb_frlength_t usbd_xfer_old_frame_length(struct usb_xfer *xfer, usb_frcount_t frindex)