#include <linux/kernel.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/etherdevice.h>
#include <linux/crc32.h>
#include <linux/usb/cdc.h>
#include "u_ether.h"
#include "u_ether_configfs.h"
#include "u_ncm.h"
#include "configfs.h"
#define NCM_NDP_HDR_CRC …
enum ncm_notify_state { … };
struct f_ncm { … };
static inline struct f_ncm *func_to_ncm(struct usb_function *f)
{ … }
#define NTB_DEFAULT_IN_SIZE …
#define NTB_OUT_SIZE …
#define TX_MAX_NUM_DPE …
#define TX_TIMEOUT_NSECS …
#define MAX_DATAGRAM_SIZE …
#define FORMATS_SUPPORTED …
static struct usb_cdc_ncm_ntb_parameters ntb_parameters = …;
#define NCM_STATUS_INTERVAL_MS …
#define NCM_STATUS_BYTECOUNT …
static struct usb_interface_assoc_descriptor ncm_iad_desc = …;
static struct usb_interface_descriptor ncm_control_intf = …;
static struct usb_cdc_header_desc ncm_header_desc = …;
static struct usb_cdc_union_desc ncm_union_desc = …;
static struct usb_cdc_ether_desc ecm_desc = …;
#define NCAPS …
static struct usb_cdc_ncm_desc ncm_desc = …;
static struct usb_interface_descriptor ncm_data_nop_intf = …;
static struct usb_interface_descriptor ncm_data_intf = …;
static struct usb_endpoint_descriptor fs_ncm_notify_desc = …;
static struct usb_endpoint_descriptor fs_ncm_in_desc = …;
static struct usb_endpoint_descriptor fs_ncm_out_desc = …;
static struct usb_descriptor_header *ncm_fs_function[] = …;
static struct usb_endpoint_descriptor hs_ncm_notify_desc = …;
static struct usb_endpoint_descriptor hs_ncm_in_desc = …;
static struct usb_endpoint_descriptor hs_ncm_out_desc = …;
static struct usb_descriptor_header *ncm_hs_function[] = …;
static struct usb_endpoint_descriptor ss_ncm_notify_desc = …;
static struct usb_ss_ep_comp_descriptor ss_ncm_notify_comp_desc = …;
static struct usb_endpoint_descriptor ss_ncm_in_desc = …;
static struct usb_endpoint_descriptor ss_ncm_out_desc = …;
static struct usb_ss_ep_comp_descriptor ss_ncm_bulk_comp_desc = …;
static struct usb_descriptor_header *ncm_ss_function[] = …;
#define STRING_CTRL_IDX …
#define STRING_MAC_IDX …
#define STRING_DATA_IDX …
#define STRING_IAD_IDX …
static struct usb_string ncm_string_defs[] = …;
static struct usb_gadget_strings ncm_string_table = …;
static struct usb_gadget_strings *ncm_strings[] = …;
struct ndp_parser_opts { … };
static const struct ndp_parser_opts ndp16_opts = …;
static const struct ndp_parser_opts ndp32_opts = …;
static inline void put_ncm(__le16 **p, unsigned size, unsigned val)
{ … }
static inline unsigned get_ncm(__le16 **p, unsigned size)
{ … }
static inline void ncm_reset_values(struct f_ncm *ncm)
{ … }
static void ncm_do_notify(struct f_ncm *ncm)
{ … }
static void ncm_notify(struct f_ncm *ncm)
{ … }
static void ncm_notify_complete(struct usb_ep *ep, struct usb_request *req)
{ … }
static void ncm_ep0out_complete(struct usb_ep *ep, struct usb_request *req)
{ … }
static int ncm_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
{ … }
static int ncm_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
{ … }
static int ncm_get_alt(struct usb_function *f, unsigned intf)
{ … }
static struct sk_buff *package_for_tx(struct f_ncm *ncm)
{ … }
static struct sk_buff *ncm_wrap_ntb(struct gether *port,
struct sk_buff *skb)
{ … }
static enum hrtimer_restart ncm_tx_timeout(struct hrtimer *data)
{ … }
static int ncm_unwrap_ntb(struct gether *port,
struct sk_buff *skb,
struct sk_buff_head *list)
{ … }
static void ncm_disable(struct usb_function *f)
{ … }
static void ncm_open(struct gether *geth)
{ … }
static void ncm_close(struct gether *geth)
{ … }
static int ncm_bind(struct usb_configuration *c, struct usb_function *f)
{ … }
static inline struct f_ncm_opts *to_f_ncm_opts(struct config_item *item)
{ … }
USB_ETHERNET_CONFIGFS_ITEM(…);
USB_ETHERNET_CONFIGFS_ITEM_ATTR_DEV_ADDR(…);
USB_ETHERNET_CONFIGFS_ITEM_ATTR_HOST_ADDR(…);
USB_ETHERNET_CONFIGFS_ITEM_ATTR_QMULT(…);
USB_ETHERNET_CONFIGFS_ITEM_ATTR_IFNAME(…);
static ssize_t ncm_opts_max_segment_size_show(struct config_item *item,
char *page)
{ … }
static ssize_t ncm_opts_max_segment_size_store(struct config_item *item,
const char *page, size_t len)
{ … }
CONFIGFS_ATTR(…);
static struct configfs_attribute *ncm_attrs[] = …;
static const struct config_item_type ncm_func_type = …;
static void ncm_free_inst(struct usb_function_instance *f)
{ … }
static struct usb_function_instance *ncm_alloc_inst(void)
{ … }
static void ncm_free(struct usb_function *f)
{ … }
static void ncm_unbind(struct usb_configuration *c, struct usb_function *f)
{ … }
static struct usb_function *ncm_alloc(struct usb_function_instance *fi)
{ … }
DECLARE_USB_FUNCTION_INIT(ncm, ncm_alloc_inst, ncm_alloc);
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;