drivers/usb/usbip/vhci.h
Source file repositories/reference/linux-study-clean/drivers/usb/usbip/vhci.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/usbip/vhci.h- Extension
.h- Size
- 3601 bytes
- Lines
- 175
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/list.hlinux/spinlock.hlinux/sysfs.hlinux/types.hlinux/usb.hlinux/usb/hcd.hlinux/wait.h
Detected Declarations
struct vhci_devicestruct vhci_privstruct vhci_unlinkstruct vhcistruct vhci_hcdenum hub_speedfunction port_to_rhportfunction port_to_pdev_nr
Annotated Snippet
struct vhci_device {
struct usb_device *udev;
/*
* devid specifies a remote usb device uniquely instead
* of combination of busnum and devnum.
*/
__u32 devid;
/* speed of a remote device */
enum usb_device_speed speed;
/* vhci root-hub port to which this device is attached */
__u32 rhport;
struct usbip_device ud;
/* lock for the below link lists */
spinlock_t priv_lock;
/* vhci_priv is linked to one of them. */
struct list_head priv_tx;
struct list_head priv_rx;
/* vhci_unlink is linked to one of them */
struct list_head unlink_tx;
struct list_head unlink_rx;
/* vhci_tx thread sleeps for this queue */
wait_queue_head_t waitq_tx;
};
/* urb->hcpriv, use container_of() */
struct vhci_priv {
unsigned long seqnum;
struct list_head list;
struct vhci_device *vdev;
struct urb *urb;
};
struct vhci_unlink {
/* seqnum of this request */
unsigned long seqnum;
struct list_head list;
/* seqnum of the unlink target */
unsigned long unlink_seqnum;
};
enum hub_speed {
HUB_SPEED_HIGH = 0,
HUB_SPEED_SUPER,
};
/* Number of supported ports. Value has an upperbound of USB_MAXCHILDREN */
#ifdef CONFIG_USBIP_VHCI_HC_PORTS
#define VHCI_HC_PORTS CONFIG_USBIP_VHCI_HC_PORTS
#else
#define VHCI_HC_PORTS 8
#endif
/* Each VHCI has 2 hubs (USB2 and USB3), each has VHCI_HC_PORTS ports */
#define VHCI_PORTS (VHCI_HC_PORTS*2)
#ifdef CONFIG_USBIP_VHCI_NR_HCS
#define VHCI_NR_HCS CONFIG_USBIP_VHCI_NR_HCS
#else
#define VHCI_NR_HCS 1
#endif
#define MAX_STATUS_NAME 16
struct vhci {
spinlock_t lock;
struct platform_device *pdev;
struct vhci_hcd *vhci_hcd_hs;
struct vhci_hcd *vhci_hcd_ss;
};
/* for usb_hcd.hcd_priv[0] */
struct vhci_hcd {
struct vhci *vhci;
u32 port_status[VHCI_HC_PORTS];
unsigned resuming:1;
Annotation
- Immediate include surface: `linux/device.h`, `linux/list.h`, `linux/spinlock.h`, `linux/sysfs.h`, `linux/types.h`, `linux/usb.h`, `linux/usb/hcd.h`, `linux/wait.h`.
- Detected declarations: `struct vhci_device`, `struct vhci_priv`, `struct vhci_unlink`, `struct vhci`, `struct vhci_hcd`, `enum hub_speed`, `function port_to_rhport`, `function port_to_pdev_nr`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source 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.