#include "usbatm.h"
#include <linux/uaccess.h>
#include <linux/crc32.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/netdevice.h>
#include <linux/proc_fs.h>
#include <linux/sched/signal.h>
#include <linux/signal.h>
#include <linux/slab.h>
#include <linux/stat.h>
#include <linux/timer.h>
#include <linux/wait.h>
#include <linux/kthread.h>
#include <linux/ratelimit.h>
#ifdef VERBOSE_DEBUG
static int usbatm_print_packet(struct usbatm_data *instance, const unsigned char *data, int len);
#define PACKETDEBUG …
#define vdbg …
#else
#define PACKETDEBUG(arg...) …
#define vdbg(arg...) …
#endif
#define DRIVER_AUTHOR …
#define DRIVER_DESC …
static const char usbatm_driver_name[] = …;
#define UDSL_MAX_RCV_URBS …
#define UDSL_MAX_SND_URBS …
#define UDSL_MAX_BUF_SIZE …
#define UDSL_DEFAULT_RCV_URBS …
#define UDSL_DEFAULT_SND_URBS …
#define UDSL_DEFAULT_RCV_BUF_SIZE …
#define UDSL_DEFAULT_SND_BUF_SIZE …
#define ATM_CELL_HEADER …
#define THROTTLE_MSECS …
static unsigned int num_rcv_urbs = …;
static unsigned int num_snd_urbs = …;
static unsigned int rcv_buf_bytes = …;
static unsigned int snd_buf_bytes = …;
module_param(num_rcv_urbs, uint, S_IRUGO);
MODULE_PARM_DESC(…) …;
module_param(num_snd_urbs, uint, S_IRUGO);
MODULE_PARM_DESC(…) …;
module_param(rcv_buf_bytes, uint, S_IRUGO);
MODULE_PARM_DESC(…) …;
module_param(snd_buf_bytes, uint, S_IRUGO);
MODULE_PARM_DESC(…) …;
struct usbatm_vcc_data { … };
struct usbatm_control { … };
#define UDSL_SKB(x) …
static void usbatm_atm_dev_close(struct atm_dev *atm_dev);
static int usbatm_atm_open(struct atm_vcc *vcc);
static void usbatm_atm_close(struct atm_vcc *vcc);
static int usbatm_atm_ioctl(struct atm_dev *atm_dev, unsigned int cmd, void __user *arg);
static int usbatm_atm_send(struct atm_vcc *vcc, struct sk_buff *skb);
static int usbatm_atm_proc_read(struct atm_dev *atm_dev, loff_t *pos, char *page);
static const struct atmdev_ops usbatm_atm_devops = …;
static inline unsigned int usbatm_pdu_length(unsigned int length)
{ … }
static inline void usbatm_pop(struct atm_vcc *vcc, struct sk_buff *skb)
{ … }
static struct urb *usbatm_pop_urb(struct usbatm_channel *channel)
{ … }
static int usbatm_submit_urb(struct urb *urb)
{ … }
static void usbatm_complete(struct urb *urb)
{ … }
static inline struct usbatm_vcc_data *usbatm_find_vcc(struct usbatm_data *instance,
short vpi, int vci)
{ … }
static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char *source)
{ … }
static void usbatm_extract_cells(struct usbatm_data *instance,
unsigned char *source, unsigned int avail_data)
{ … }
static unsigned int usbatm_write_cells(struct usbatm_data *instance,
struct sk_buff *skb,
u8 *target, unsigned int avail_space)
{ … }
static void usbatm_rx_process(struct tasklet_struct *t)
{ … }
static void usbatm_tx_process(struct tasklet_struct *t)
{ … }
static void usbatm_cancel_send(struct usbatm_data *instance,
struct atm_vcc *vcc)
{ … }
static int usbatm_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
{ … }
static void usbatm_destroy_instance(struct kref *kref)
{ … }
static void usbatm_get_instance(struct usbatm_data *instance)
{ … }
static void usbatm_put_instance(struct usbatm_data *instance)
{ … }
static void usbatm_atm_dev_close(struct atm_dev *atm_dev)
{ … }
static int usbatm_atm_proc_read(struct atm_dev *atm_dev, loff_t *pos, char *page)
{ … }
static int usbatm_atm_open(struct atm_vcc *vcc)
{ … }
static void usbatm_atm_close(struct atm_vcc *vcc)
{ … }
static int usbatm_atm_ioctl(struct atm_dev *atm_dev, unsigned int cmd,
void __user *arg)
{ … }
static int usbatm_atm_init(struct usbatm_data *instance)
{ … }
static int usbatm_do_heavy_init(void *arg)
{ … }
static int usbatm_heavy_init(struct usbatm_data *instance)
{ … }
static void usbatm_tasklet_schedule(struct timer_list *t)
{ … }
static void usbatm_init_channel(struct usbatm_channel *channel)
{ … }
int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id,
struct usbatm_driver *driver)
{ … }
EXPORT_SYMBOL_GPL(…);
void usbatm_usb_disconnect(struct usb_interface *intf)
{ … }
EXPORT_SYMBOL_GPL(…);
static int __init usbatm_usb_init(void)
{ … }
module_init(…) …;
static void __exit usbatm_usb_exit(void)
{ … }
module_exit(usbatm_usb_exit);
MODULE_AUTHOR(…);
MODULE_DESCRIPTION(…);
MODULE_LICENSE(…) …;
#ifdef VERBOSE_DEBUG
static int usbatm_print_packet(struct usbatm_data *instance,
const unsigned char *data, int len)
{
unsigned char buffer[256];
int i = 0, j = 0;
for (i = 0; i < len;) {
buffer[0] = '\0';
sprintf(buffer, "%.3d :", i);
for (j = 0; (j < 16) && (i < len); j++, i++)
sprintf(buffer, "%s %2.2x", buffer, data[i]);
dev_dbg(&instance->usb_intf->dev, "%s", buffer);
}
return i;
}
#endif