bca6d06bf2
https://source.android.com/security/bulletin/2021-07-01 No kernel CVEs * tag 'ASB-2021-07-05_4.19-stable' of https://github.com/aosp-mirror/kernel_common: Linux 4.19.196 i2c: robotfuzz-osif: fix control-request directions nilfs2: fix memory leak in nilfs_sysfs_delete_device_group pinctrl: stm32: fix the reported number of GPIO lines per bank net: ll_temac: Avoid ndo_start_xmit returning NETDEV_TX_BUSY PCI: Add AMD RS690 quirk to enable 64-bit DMA net: qed: Fix memcpy() overflow of qed_dcbx_params() KVM: selftests: Fix kvm_check_cap() assertion r8169: Avoid memcpy() over-reading of ETH_SS_STATS sh_eth: Avoid memcpy() over-reading of ETH_SS_STATS r8152: Avoid memcpy() over-reading of ETH_SS_STATS net/packet: annotate accesses to po->ifindex net/packet: annotate accesses to po->bind net: caif: fix memory leak in ldisc_open inet: annotate date races around sk->sk_txhash ping: Check return value of function 'ping_queue_rcv_skb' net: ethtool: clear heap allocations for ethtool function mac80211: drop multicast fragments cfg80211: call cfg80211_leave_ocb when switching away from OCB mac80211: remove warning in ieee80211_get_sband() Revert "PCI: PM: Do not read power state in pci_enable_device_flags()" MIPS: generic: Update node names to avoid unit addresses Makefile: Move -Wno-unused-but-set-variable out of GCC only block ARM: 9081/1: fix gcc-10 thumb2-kernel regression drm/radeon: wait for moving fence after pinning drm/nouveau: wait for moving fence after pinning v2 module: limit enabling module.sig_enforce x86/fpu: Reset state for all signal restore failures usb: dwc3: core: fix kernel panic when do reboot usb: dwc3: debugfs: Add and remove endpoint dirs dynamically inet: use bigger hash table for IP ID generation can: bcm/raw/isotp: use per module netdevice notifier KVM: arm/arm64: Fix KVM_VGIC_V3_ADDR_TYPE_REDIST read tools headers UAPI: Sync linux/in.h copy with the kernel sources net: fec_ptp: add clock rate zero check mm/slub.c: include swab.h mm/slub: clarify verification reporting net: bridge: fix vlan tunnel dst refcnt when egressing net: bridge: fix vlan tunnel dst null pointer dereference cfg80211: make certificate generation more robust dmaengine: pl330: fix wrong usage of spinlock flags in dma_cyclc ARCv2: save ABI registers across signal handling PCI: Work around Huawei Intelligent NIC VF FLR erratum PCI: Add ACS quirk for Broadcom BCM57414 NIC PCI: Mark some NVIDIA GPUs to avoid bus reset PCI: Mark TI C667X to avoid bus reset tracing: Do no increment trace_clock_global() by one tracing: Do not stop recording comms if the trace file is being read tracing: Do not stop recording cmdlines when tracing is off usb: core: hub: Disable autosuspend for Cypress CY7C65632 can: mcba_usb: fix memory leak in mcba_usb can: bcm: fix infoleak in struct bcm_msg_head hwmon: (scpi-hwmon) shows the negative temperature properly radeon: use memcpy_to/fromio for UVD fw upload pinctrl: ralink: rt2880: avoid to error in calls is pin is already enabled ASoC: rt5659: Fix the lost powers for the HDA header net: ethernet: fix potential use-after-free in ec_bhf_remove icmp: don't send out ICMP messages with a source address of 0.0.0.0 net: cdc_eem: fix tx fixup skb leak net: hamradio: fix memory leak in mkiss_close be2net: Fix an error handling path in 'be_probe()' net/af_unix: fix a data-race in unix_dgram_sendmsg / unix_release_sock net: ipv4: fix memory leak in ip_mc_add1_src net: fec_ptp: fix issue caused by refactor the fec_devtype net: usb: fix possible use-after-free in smsc75xx_bind net: cdc_ncm: switch to eth%d interface naming ptp: improve max_adj check against unreasonable values ptp: ptp_clock: Publish scaled_ppm_to_ppb net: qrtr: fix OOB Read in qrtr_endpoint_post netxen_nic: Fix an error handling path in 'netxen_nic_probe()' qlcnic: Fix an error handling path in 'qlcnic_probe()' net: make get_net_ns return error if NET_NS is disabled net: add documentation to socket.c net: stmmac: dwmac1000: Fix extended MAC address registers definition alx: Fix an error handling path in 'alx_probe()' sch_cake: Fix out of bounds when parsing TCP options and header netfilter: synproxy: Fix out of bounds when parsing TCP options net/mlx5e: Block offload of outer header csum for UDP tunnels net/mlx5e: Remove dependency in IPsec initialization flows rtnetlink: Fix regression in bridge VLAN configuration udp: fix race between close() and udp_abort() net: rds: fix memory leak in rds_recvmsg net: ipv4: fix memory leak in netlbl_cipsov4_add_std batman-adv: Avoid WARN_ON timing related checks mm/memory-failure: make sure wait for page writeback in memory_failure afs: Fix an IS_ERR() vs NULL check dmaengine: stedma40: add missing iounmap() on error in d40_probe() dmaengine: QCOM_HIDMA_MGMT depends on HAS_IOMEM dmaengine: ALTERA_MSGDMA depends on HAS_IOMEM fib: Return the correct errno code net: Return the correct errno code net/x25: Return the correct errno code rtnetlink: Fix missing error code in rtnl_bridge_notify() net: ipconfig: Don't override command-line hostnames or domains nvme-loop: check for NVME_LOOP_Q_LIVE in nvme_loop_destroy_admin_queue() nvme-loop: clear NVME_LOOP_Q_LIVE when nvme_loop_configure_admin_queue() fails nvme-loop: reset queue count to 1 in nvme_loop_destroy_io_queues() scsi: scsi_devinfo: Add blacklist entry for HPE OPEN-V ethernet: myri10ge: Fix missing error code in myri10ge_probe() scsi: target: core: Fix warning on realtime kernels gfs2: Fix use-after-free in gfs2_glock_shrink_scan HID: gt683r: add missing MODULE_DEVICE_TABLE gfs2: Prevent direct-I/O write fallback errors from getting lost ARM: OMAP2+: Fix build warning when mmc_omap is not built HID: usbhid: fix info leak in hid_submit_ctrl HID: Add BUS_VIRTUAL to hid_connect logging HID: hid-sensor-hub: Return error for hid_set_field() failure HID: quirks: Set INCREMENT_USAGE_ON_DUPLICATE for Saitek X65 net: ieee802154: fix null deref in parse dev addr FROMGIT: bpf: Do not change gso_size during bpf_skb_change_proto() ANDROID: gki_config: disable per-cgroup pressure tracking BACKPORT: cgroup: make per-cgroup pressure stall tracking configurable ANDROID: selinux: modify RTM_GETNEIGH{TBL} BACKPORT: x86, lto: Pass -stack-alignment only on LLD < 13.0.0 ANDROID: Add CONFIG_LLD_VERSION ANDROID: GKI: Update the ABI XML ANDROID: GKI: Update the symbol list Revert "perf/core: Fix endless multiplex timer" Linux 4.19.195 proc: only require mm_struct for writing tracing: Correct the length check which causes memory corruption ftrace: Do not blindly read the ip address in ftrace_bug() scsi: core: Only put parent device if host state differs from SHOST_CREATED scsi: core: Put .shost_dev in failure path if host state changes to RUNNING scsi: core: Fix error handling of scsi_host_alloc() NFSv4: nfs4_proc_set_acl needs to restore NFS_CAP_UIDGID_NOMAP on error. NFSv4: Fix second deadlock in nfs4_evict_inode() NFS: Fix use-after-free in nfs4_init_client() kvm: fix previous commit for 32-bit builds perf session: Correct buffer copying when peeking events NFSv4: Fix deadlock between nfs4_evict_inode() and nfs4_opendata_get_inode() NFS: Fix a potential NULL dereference in nfs_get_client() IB/mlx5: Fix initializing CQ fragments buffer sched/fair: Make sure to update tg contrib for blocked load perf: Fix data race between pin_count increment/decrement vmlinux.lds.h: Avoid orphan section with !SMP RDMA/mlx4: Do not map the core_clock page to user space unless enabled regulator: max77620: Use device_set_of_node_from_dev() regulator: core: resolve supply for boot-on/always-on regulators usb: fix various gadget panics on 10gbps cabling usb: fix various gadgets null ptr deref on 10gbps cabling. usb: gadget: eem: fix wrong eem header operation USB: serial: cp210x: fix alternate function for CP2102N QFN20 USB: serial: quatech2: fix control-request directions USB: serial: omninet: add device id for Zyxel Omni 56K Plus USB: serial: ftdi_sio: add NovaTech OrionMX product ID usb: gadget: f_fs: Ensure io_completion_wq is idle during unbind usb: typec: ucsi: Clear PPM capability data in ucsi_init() error path usb: dwc3: ep0: fix NULL pointer exception usb: pd: Set PD_T_SINK_WAIT_CAP to 310ms usb: f_ncm: only first packet of aggregate needs to start timer USB: f_ncm: ncm_bitrate (speed) is unsigned cgroup1: don't allow '\n' in renaming btrfs: return value from btrfs_mark_extent_written() in case of error staging: rtl8723bs: Fix uninitialized variables kvm: avoid speculation-based attacks from out-of-range memslot accesses drm: Lock pointer access in drm_master_release() drm: Fix use-after-free read in drm_getunique() ARM: dts: imx6q-dhcom: Add PU,VDD1P1,VDD2P5 regulators ARM: dts: imx6qdl-sabresd: Assign corresponding power supply for LDOs i2c: mpc: implement erratum A-004447 workaround i2c: mpc: Make use of i2c_recover_bus() powerpc/fsl: set fsl,i2c-erratum-a004447 flag for P1010 i2c controllers powerpc/fsl: set fsl,i2c-erratum-a004447 flag for P2041 i2c controllers bnx2x: Fix missing error code in bnx2x_iov_init_one() MIPS: Fix kernel hang under FUNCTION_GRAPH_TRACER and PREEMPT_TRACER nvme-fabrics: decode host pathing error for connect net: appletalk: cops: Fix data race in cops_probe1 net: macb: ensure the device is available before accessing GEMGXL control registers scsi: target: qla2xxx: Wait for stop_phase1 at WWN removal scsi: vmw_pvscsi: Set correct residual data length scsi: bnx2fc: Return failure if io_req is already in ABTS processing RDS tcp loopback connection can hang net/qla3xxx: fix schedule while atomic in ql_sem_spinlock wq: handle VM suspension in stall detection cgroup: disable controllers at parse time net: mdiobus: get rid of a BUG_ON() netlink: disable IRQs for netlink_lock_table() bonding: init notify_work earlier to avoid uninitialized use isdn: mISDN: netjet: Fix crash in nj_probe: ASoC: sti-sas: add missing MODULE_DEVICE_TABLE ASoC: Intel: bytcr_rt5640: Add quirk for the Lenovo Miix 3-830 tablet ASoC: Intel: bytcr_rt5640: Add quirk for the Glavey TM800A550L tablet net/nfc/rawsock.c: fix a permission check bug proc: Track /proc/$pid/attr/ opener mm_struct perf/core: Fix endless multiplex timer Revert "perf/cgroups: Don't rotate events for cgroups unnecessarily" Revert "perf/core: Fix corner case in perf_rotate_context()" Linux 4.19.194 xen-pciback: redo VF placement in the virtual topology sched/fair: Optimize select_idle_cpu ACPI: EC: Look for ECDT EC after calling acpi_load_tables() ACPI: probe ECDT before loading AML tables regardless of module-level code flag KVM: arm64: Fix debug register indexing KVM: SVM: Truncate GPR value for DR and CR accesses in !64-bit mode btrfs: fix unmountable seed device after fstrim perf/core: Fix corner case in perf_rotate_context() perf/cgroups: Don't rotate events for cgroups unnecessarily bnxt_en: Remove the setting of dev_port. selftests/bpf: Avoid running unprivileged tests with alignment requirements selftests/bpf: add "any alignment" annotation for some tests bpf: Apply F_NEEDS_EFFICIENT_UNALIGNED_ACCESS to more ACCEPT test cases. bpf: Make more use of 'any' alignment in test_verifier.c bpf: Adjust F_NEEDS_EFFICIENT_UNALIGNED_ACCESS handling in test_verifier.c bpf: Add BPF_F_ANY_ALIGNMENT. selftests/bpf: Generalize dummy program types bpf: test make sure to run unpriv test cases in test_verifier bpf: fix test suite to enable all unpriv program types mm, hugetlb: fix simple resv_huge_pages underflow on UFFDIO_COPY btrfs: fixup error handling in fixup_inode_link_counts btrfs: return errors from btrfs_del_csums in cleanup_ref_head btrfs: fix error handling in btrfs_del_csums btrfs: mark ordered extent and inode with error if we fail to finish x86/apic: Mark _all_ legacy interrupts when IO/APIC is missing nfc: fix NULL ptr dereference in llcp_sock_getname() after failed connect ocfs2: fix data corruption by fallocate pid: take a reference when initializing `cad_pid` usb: dwc2: Fix build in periphal-only mode ext4: fix bug on in ext4_es_cache_extent as ext4_split_extent_at failed ALSA: hda: Fix for mute key LED for HP Pavilion 15-CK0xx ALSA: timer: Fix master timer notification HID: multitouch: require Finger field to mark Win8 reports as MT net: caif: fix memory leak in cfusbl_device_notify net: caif: fix memory leak in caif_device_notify net: caif: add proper error handling net: caif: added cfserl_release function Bluetooth: use correct lock to prevent UAF of hdev object Bluetooth: fix the erroneous flush_work() order tipc: fix unique bearer names sanity check tipc: add extack messages for bearer/media failure ixgbevf: add correct exception tracing for XDP ieee802154: fix error return code in ieee802154_llsec_getparams() ieee802154: fix error return code in ieee802154_add_iface() netfilter: nfnetlink_cthelper: hit EBUSY on updates if size mismatches HID: i2c-hid: fix format string mismatch HID: pidff: fix error return code in hid_pidff_init() ipvs: ignore IP_VS_SVC_F_HASHED flag when adding service vfio/platform: fix module_put call in error flow samples: vfio-mdev: fix error handing in mdpy_fb_probe() vfio/pci: zap_vma_ptes() needs MMU vfio/pci: Fix error return code in vfio_ecap_init() efi: cper: fix snprintf() use in cper_dimm_err_location() efi: Allow EFI_MEMORY_XP and EFI_MEMORY_RO both to be cleared nl80211: validate key indexes for cfg80211_registered_device ALSA: usb: update old-style static const declaration net: usb: cdc_ncm: don't spew notifications Change-Id: I82440e74ed3193208e75ee030e5f5bd24671ae1b Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com> Conflicts: drivers/usb/dwc3/core.c drivers/usb/dwc3/debugfs.c drivers/usb/gadget/function/f_fs.c include/linux/usb/usbnet.h kernel/sched/fair.c kernel/workqueue.c net/qrtr/qrtr.c
297 lines
10 KiB
C
297 lines
10 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* USB Networking Link Interface
|
|
*
|
|
* Copyright (C) 2000-2005 by David Brownell <dbrownell@users.sourceforge.net>
|
|
* Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
|
|
#ifndef __LINUX_USB_USBNET_H
|
|
#define __LINUX_USB_USBNET_H
|
|
|
|
/* interface from usbnet core to each USB networking link we handle */
|
|
struct usbnet {
|
|
/* housekeeping */
|
|
struct usb_device *udev;
|
|
struct usb_interface *intf;
|
|
struct driver_info *driver_info;
|
|
const char *driver_name;
|
|
void *driver_priv;
|
|
wait_queue_head_t wait;
|
|
struct mutex phy_mutex;
|
|
unsigned char suspend_count;
|
|
unsigned char pkt_cnt, pkt_err;
|
|
unsigned short rx_qlen, tx_qlen;
|
|
unsigned can_dma_sg:1;
|
|
|
|
/* i/o info: pipes etc */
|
|
unsigned in, out;
|
|
struct usb_host_endpoint *status;
|
|
unsigned maxpacket;
|
|
struct timer_list delay;
|
|
const char *padding_pkt;
|
|
|
|
/* protocol/interface state */
|
|
struct net_device *net;
|
|
int msg_enable;
|
|
unsigned long data[5];
|
|
u32 xid;
|
|
u32 hard_mtu; /* count any extra framing */
|
|
size_t rx_urb_size; /* size for rx urbs */
|
|
struct mii_if_info mii;
|
|
|
|
/* various kinds of pending driver work */
|
|
struct sk_buff_head rxq;
|
|
struct sk_buff_head txq;
|
|
struct sk_buff_head done;
|
|
struct sk_buff_head rxq_pause;
|
|
struct urb *interrupt;
|
|
unsigned interrupt_count;
|
|
struct mutex interrupt_mutex;
|
|
struct usb_anchor deferred;
|
|
struct tasklet_struct bh;
|
|
|
|
struct pcpu_sw_netstats __percpu *stats64;
|
|
|
|
struct work_struct kevent;
|
|
unsigned long flags;
|
|
# define EVENT_TX_HALT 0
|
|
# define EVENT_RX_HALT 1
|
|
# define EVENT_RX_MEMORY 2
|
|
# define EVENT_STS_SPLIT 3
|
|
# define EVENT_LINK_RESET 4
|
|
# define EVENT_RX_PAUSED 5
|
|
# define EVENT_DEV_ASLEEP 6
|
|
# define EVENT_DEV_OPEN 7
|
|
# define EVENT_DEVICE_REPORT_IDLE 8
|
|
# define EVENT_NO_RUNTIME_PM 9
|
|
# define EVENT_RX_KILL 10
|
|
# define EVENT_LINK_CHANGE 11
|
|
# define EVENT_SET_RX_MODE 12
|
|
# define EVENT_NO_IP_ALIGN 13
|
|
u32 rx_speed; /* in bps - NOT Mbps */
|
|
u32 tx_speed; /* in bps - NOT Mbps */
|
|
|
|
ANDROID_KABI_RESERVE(1);
|
|
ANDROID_KABI_RESERVE(2);
|
|
ANDROID_KABI_RESERVE(3);
|
|
ANDROID_KABI_RESERVE(4);
|
|
};
|
|
|
|
static inline struct usb_driver *driver_of(struct usb_interface *intf)
|
|
{
|
|
return to_usb_driver(intf->dev.driver);
|
|
}
|
|
|
|
/* interface from the device/framing level "minidriver" to core */
|
|
struct driver_info {
|
|
char *description;
|
|
|
|
int flags;
|
|
/* framing is CDC Ethernet, not writing ZLPs (hw issues), or optionally: */
|
|
#define FLAG_FRAMING_NC 0x0001 /* guard against device dropouts */
|
|
#define FLAG_FRAMING_GL 0x0002 /* genelink batches packets */
|
|
#define FLAG_FRAMING_Z 0x0004 /* zaurus adds a trailer */
|
|
#define FLAG_FRAMING_RN 0x0008 /* RNDIS batches, plus huge header */
|
|
|
|
#define FLAG_NO_SETINT 0x0010 /* device can't set_interface() */
|
|
#define FLAG_ETHER 0x0020 /* maybe use "eth%d" names */
|
|
|
|
#define FLAG_FRAMING_AX 0x0040 /* AX88772/178 packets */
|
|
#define FLAG_WLAN 0x0080 /* use "wlan%d" names */
|
|
#define FLAG_AVOID_UNLINK_URBS 0x0100 /* don't unlink urbs at usbnet_stop() */
|
|
#define FLAG_SEND_ZLP 0x0200 /* hw requires ZLPs are sent */
|
|
#define FLAG_WWAN 0x0400 /* use "wwan%d" names */
|
|
|
|
#define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */
|
|
|
|
#define FLAG_POINTTOPOINT 0x1000 /* possibly use "usb%d" names */
|
|
|
|
/*
|
|
* Indicates to usbnet, that USB driver accumulates multiple IP packets.
|
|
* Affects statistic (counters) and short packet handling.
|
|
*/
|
|
#define FLAG_MULTI_PACKET 0x2000
|
|
#define FLAG_RX_ASSEMBLE 0x4000 /* rx packets may span >1 frames */
|
|
#define FLAG_NOARP 0x8000 /* device can't do ARP */
|
|
|
|
/* init device ... can sleep, or cause probe() failure */
|
|
int (*bind)(struct usbnet *, struct usb_interface *);
|
|
|
|
/* cleanup device ... can sleep, but can't fail */
|
|
void (*unbind)(struct usbnet *, struct usb_interface *);
|
|
|
|
/* reset device ... can sleep */
|
|
int (*reset)(struct usbnet *);
|
|
|
|
/* stop device ... can sleep */
|
|
int (*stop)(struct usbnet *);
|
|
|
|
/* see if peer is connected ... can sleep */
|
|
int (*check_connect)(struct usbnet *);
|
|
|
|
/* (dis)activate runtime power management */
|
|
int (*manage_power)(struct usbnet *, int);
|
|
|
|
/* for status polling */
|
|
void (*status)(struct usbnet *, struct urb *);
|
|
|
|
/* link reset handling, called from defer_kevent */
|
|
int (*link_reset)(struct usbnet *);
|
|
|
|
/* fixup rx packet (strip framing) */
|
|
int (*rx_fixup)(struct usbnet *dev, struct sk_buff *skb);
|
|
|
|
/* fixup tx packet (add framing) */
|
|
struct sk_buff *(*tx_fixup)(struct usbnet *dev,
|
|
struct sk_buff *skb, gfp_t flags);
|
|
|
|
/* recover from timeout */
|
|
void (*recover)(struct usbnet *dev);
|
|
|
|
/* early initialization code, can sleep. This is for minidrivers
|
|
* having 'subminidrivers' that need to do extra initialization
|
|
* right after minidriver have initialized hardware. */
|
|
int (*early_init)(struct usbnet *dev);
|
|
|
|
/* called by minidriver when receiving indication */
|
|
void (*indication)(struct usbnet *dev, void *ind, int indlen);
|
|
|
|
/* rx mode change (device changes address list filtering) */
|
|
void (*set_rx_mode)(struct usbnet *dev);
|
|
|
|
/* for new devices, use the descriptor-reading code instead */
|
|
int in; /* rx endpoint */
|
|
int out; /* tx endpoint */
|
|
|
|
unsigned long data; /* Misc driver specific data */
|
|
};
|
|
|
|
/* Minidrivers are just drivers using the "usbnet" core as a powerful
|
|
* network-specific subroutine library ... that happens to do pretty
|
|
* much everything except custom framing and chip-specific stuff.
|
|
*/
|
|
extern int usbnet_probe(struct usb_interface *, const struct usb_device_id *);
|
|
extern int usbnet_suspend(struct usb_interface *, pm_message_t);
|
|
extern int usbnet_resume(struct usb_interface *);
|
|
extern void usbnet_disconnect(struct usb_interface *);
|
|
extern void usbnet_device_suggests_idle(struct usbnet *dev);
|
|
|
|
extern int usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
|
|
u16 value, u16 index, void *data, u16 size);
|
|
extern int usbnet_write_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
|
|
u16 value, u16 index, const void *data, u16 size);
|
|
extern int usbnet_read_cmd_nopm(struct usbnet *dev, u8 cmd, u8 reqtype,
|
|
u16 value, u16 index, void *data, u16 size);
|
|
extern int usbnet_write_cmd_nopm(struct usbnet *dev, u8 cmd, u8 reqtype,
|
|
u16 value, u16 index, const void *data, u16 size);
|
|
extern int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype,
|
|
u16 value, u16 index, const void *data, u16 size);
|
|
|
|
/* Drivers that reuse some of the standard USB CDC infrastructure
|
|
* (notably, using multiple interfaces according to the CDC
|
|
* union descriptor) get some helper code.
|
|
*/
|
|
struct cdc_state {
|
|
struct usb_cdc_header_desc *header;
|
|
struct usb_cdc_union_desc *u;
|
|
struct usb_cdc_ether_desc *ether;
|
|
struct usb_interface *control;
|
|
struct usb_interface *data;
|
|
};
|
|
|
|
extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *);
|
|
extern int usbnet_ether_cdc_bind(struct usbnet *dev, struct usb_interface *intf);
|
|
extern int usbnet_cdc_bind(struct usbnet *, struct usb_interface *);
|
|
extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *);
|
|
extern void usbnet_cdc_status(struct usbnet *, struct urb *);
|
|
|
|
/* CDC and RNDIS support the same host-chosen packet filters for IN transfers */
|
|
#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \
|
|
|USB_CDC_PACKET_TYPE_ALL_MULTICAST \
|
|
|USB_CDC_PACKET_TYPE_PROMISCUOUS \
|
|
|USB_CDC_PACKET_TYPE_DIRECTED)
|
|
|
|
|
|
/* we record the state for each of our queued skbs */
|
|
enum skb_state {
|
|
illegal = 0,
|
|
tx_start, tx_done,
|
|
rx_start, rx_done, rx_cleanup,
|
|
unlink_start
|
|
};
|
|
|
|
struct skb_data { /* skb->cb is one of these */
|
|
struct urb *urb;
|
|
struct usbnet *dev;
|
|
enum skb_state state;
|
|
long length;
|
|
unsigned long packets;
|
|
};
|
|
|
|
/* Drivers that set FLAG_MULTI_PACKET must call this in their
|
|
* tx_fixup method before returning an skb.
|
|
*/
|
|
static inline void
|
|
usbnet_set_skb_tx_stats(struct sk_buff *skb,
|
|
unsigned long packets, long bytes_delta)
|
|
{
|
|
struct skb_data *entry = (struct skb_data *) skb->cb;
|
|
|
|
entry->packets = packets;
|
|
entry->length = bytes_delta;
|
|
}
|
|
|
|
extern int usbnet_open(struct net_device *net);
|
|
extern int usbnet_stop(struct net_device *net);
|
|
extern netdev_tx_t usbnet_start_xmit(struct sk_buff *skb,
|
|
struct net_device *net);
|
|
extern void usbnet_tx_timeout(struct net_device *net);
|
|
extern int usbnet_change_mtu(struct net_device *net, int new_mtu);
|
|
|
|
extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *);
|
|
extern int usbnet_get_ethernet_addr(struct usbnet *, int);
|
|
extern void usbnet_defer_kevent(struct usbnet *, int);
|
|
extern void usbnet_skb_return(struct usbnet *, struct sk_buff *);
|
|
extern void usbnet_unlink_rx_urbs(struct usbnet *);
|
|
|
|
extern void usbnet_pause_rx(struct usbnet *);
|
|
extern void usbnet_resume_rx(struct usbnet *);
|
|
extern void usbnet_purge_paused_rxq(struct usbnet *);
|
|
|
|
extern int usbnet_get_link_ksettings(struct net_device *net,
|
|
struct ethtool_link_ksettings *cmd);
|
|
extern int usbnet_set_link_ksettings(struct net_device *net,
|
|
const struct ethtool_link_ksettings *cmd);
|
|
extern u32 usbnet_get_link(struct net_device *net);
|
|
extern u32 usbnet_get_msglevel(struct net_device *);
|
|
extern void usbnet_set_msglevel(struct net_device *, u32);
|
|
extern void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *);
|
|
extern int usbnet_nway_reset(struct net_device *net);
|
|
|
|
extern int usbnet_manage_power(struct usbnet *, int);
|
|
extern void usbnet_link_change(struct usbnet *, bool, bool);
|
|
|
|
extern int usbnet_status_start(struct usbnet *dev, gfp_t mem_flags);
|
|
extern void usbnet_status_stop(struct usbnet *dev);
|
|
|
|
extern void usbnet_update_max_qlen(struct usbnet *dev);
|
|
extern void usbnet_get_stats64(struct net_device *dev,
|
|
struct rtnl_link_stats64 *stats);
|
|
|
|
#endif /* __LINUX_USB_USBNET_H */
|