linux/drivers/net/usb/cdc_ether.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * CDC Ethernet based networking peripherals
 * Copyright (C) 2003-2005 by David Brownell
 * Copyright (C) 2006 by Ole Andre Vadla Ravnas (ActiveSync)
 */

// #define	DEBUG			// error path messages, extra info
// #define	VERBOSE			// more; success messages

#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/workqueue.h>
#include <linux/mii.h>
#include <linux/usb.h>
#include <linux/usb/cdc.h>
#include <linux/usb/usbnet.h>


#if IS_ENABLED(CONFIG_USB_NET_RNDIS_HOST)

static int is_rndis(struct usb_interface_descriptor *desc)
{}

static int is_activesync(struct usb_interface_descriptor *desc)
{}

static int is_wireless_rndis(struct usb_interface_descriptor *desc)
{}

static int is_novatel_rndis(struct usb_interface_descriptor *desc)
{}

#else

#define is_rndis
#define is_activesync
#define is_wireless_rndis
#define is_novatel_rndis

#endif

static const u8 mbm_guid[16] =;

void usbnet_cdc_update_filter(struct usbnet *dev)
{}
EXPORT_SYMBOL_GPL();

/* We need to override usbnet_*_link_ksettings in bind() */
static const struct ethtool_ops cdc_ether_ethtool_ops =;

/* probes control interface, claims data interface, collects the bulk
 * endpoints, activates data interface (if needed), maybe sets MTU.
 * all pure cdc, except for certain firmware workarounds, and knowing
 * that rndis uses one different rule.
 */
int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
{}
EXPORT_SYMBOL_GPL();


/* like usbnet_generic_cdc_bind() but handles filter initialization
 * correctly
 */
int usbnet_ether_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
{}
EXPORT_SYMBOL_GPL();

void usbnet_cdc_unbind(struct usbnet *dev, struct usb_interface *intf)
{}
EXPORT_SYMBOL_GPL();

/* Communications Device Class, Ethernet Control model
 *
 * Takes two interfaces.  The DATA interface is inactive till an altsetting
 * is selected.  Configuration data includes class descriptors.  There's
 * an optional status endpoint on the control interface.
 *
 * This should interop with whatever the 2.4 "CDCEther.c" driver
 * (by Brad Hards) talked with, with more functionality.
 */

static void speed_change(struct usbnet *dev, __le32 *speeds)
{}

void usbnet_cdc_status(struct usbnet *dev, struct urb *urb)
{}
EXPORT_SYMBOL_GPL();

int usbnet_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
{}
EXPORT_SYMBOL_GPL();

static int usbnet_cdc_zte_bind(struct usbnet *dev, struct usb_interface *intf)
{}

/* Make sure packets have correct destination MAC address
 *
 * A firmware bug observed on some devices (ZTE MF823/831/910) is that the
 * device sends packets with a static, bogus, random MAC address (event if
 * device MAC address has been updated). Always set MAC address to that of the
 * device.
 */
int usbnet_cdc_zte_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
{}
EXPORT_SYMBOL_GPL();

/* Ensure correct link state
 *
 * Some devices (ZTE MF823/831/910) export two carrier on notifications when
 * connected. This causes the link state to be incorrect. Work around this by
 * always setting the state to off, then on.
 */
static void usbnet_cdc_zte_status(struct usbnet *dev, struct urb *urb)
{}

static const struct driver_info	cdc_info =;

static const struct driver_info	zte_cdc_info =;

static const struct driver_info wwan_info =;

/*-------------------------------------------------------------------------*/

#define HUAWEI_VENDOR_ID
#define NOVATEL_VENDOR_ID
#define ZTE_VENDOR_ID
#define DELL_VENDOR_ID
#define REALTEK_VENDOR_ID
#define SAMSUNG_VENDOR_ID
#define LENOVO_VENDOR_ID
#define LINKSYS_VENDOR_ID
#define NVIDIA_VENDOR_ID
#define HP_VENDOR_ID
#define MICROSOFT_VENDOR_ID
#define UBLOX_VENDOR_ID
#define TPLINK_VENDOR_ID
#define AQUANTIA_VENDOR_ID
#define ASIX_VENDOR_ID

static const struct usb_device_id	products[] =;
MODULE_DEVICE_TABLE(usb, products);

static struct usb_driver cdc_driver =;

module_usb_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();