#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/skbuff.h>
#include <linux/atmdev.h>
#include <linux/atm.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/timer.h>
#include <linux/interrupt.h>
#include <linux/bitops.h>
#include <linux/slab.h>
#include <linux/idr.h>
#include <asm/io.h>
#include <linux/uaccess.h>
#include <linux/atomic.h>
#include <linux/etherdevice.h>
#include "nicstar.h"
#ifdef CONFIG_ATM_NICSTAR_USE_SUNI
#include "suni.h"
#endif
#ifdef CONFIG_ATM_NICSTAR_USE_IDT77105
#include "idt77105.h"
#endif
#include "nicstarmac.c"
#undef PHY_LOOPBACK
#undef TX_DEBUG
#undef RX_DEBUG
#undef GENERAL_DEBUG
#undef EXTRA_DEBUG
#ifdef TX_DEBUG
#define TXPRINTK …
#else
#define TXPRINTK(args...) …
#endif
#ifdef RX_DEBUG
#define RXPRINTK …
#else
#define RXPRINTK(args...) …
#endif
#ifdef GENERAL_DEBUG
#define PRINTK …
#else
#define PRINTK(args...) …
#endif
#ifdef EXTRA_DEBUG
#define XPRINTK …
#else
#define XPRINTK(args...) …
#endif
#define CMD_BUSY(card) …
#define NS_DELAY …
#define PTR_DIFF(a, b) …
#ifndef ATM_SKB
#define ATM_SKB …
#endif
#define scq_virt_to_bus(scq, p) …
static u32 ns_read_sram(ns_dev * card, u32 sram_address);
static void ns_write_sram(ns_dev * card, u32 sram_address, u32 * value,
int count);
static int ns_init_card(int i, struct pci_dev *pcidev);
static void ns_init_card_error(ns_dev * card, int error);
static scq_info *get_scq(ns_dev *card, int size, u32 scd);
static void free_scq(ns_dev *card, scq_info * scq, struct atm_vcc *vcc);
static void push_rxbufs(ns_dev *, struct sk_buff *);
static irqreturn_t ns_irq_handler(int irq, void *dev_id);
static int ns_open(struct atm_vcc *vcc);
static void ns_close(struct atm_vcc *vcc);
static void fill_tst(ns_dev * card, int n, vc_map * vc);
static int ns_send(struct atm_vcc *vcc, struct sk_buff *skb);
static int ns_send_bh(struct atm_vcc *vcc, struct sk_buff *skb);
static int push_scqe(ns_dev * card, vc_map * vc, scq_info * scq, ns_scqe * tbd,
struct sk_buff *skb, bool may_sleep);
static void process_tsq(ns_dev * card);
static void drain_scq(ns_dev * card, scq_info * scq, int pos);
static void process_rsq(ns_dev * card);
static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe);
static void recycle_rx_buf(ns_dev * card, struct sk_buff *skb);
static void recycle_iovec_rx_bufs(ns_dev * card, struct iovec *iov, int count);
static void recycle_iov_buf(ns_dev * card, struct sk_buff *iovb);
static void dequeue_sm_buf(ns_dev * card, struct sk_buff *sb);
static void dequeue_lg_buf(ns_dev * card, struct sk_buff *lb);
static int ns_proc_read(struct atm_dev *dev, loff_t * pos, char *page);
static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void __user * arg);
#ifdef EXTRA_DEBUG
static void which_list(ns_dev * card, struct sk_buff *skb);
#endif
static void ns_poll(struct timer_list *unused);
static void ns_phy_put(struct atm_dev *dev, unsigned char value,
unsigned long addr);
static unsigned char ns_phy_get(struct atm_dev *dev, unsigned long addr);
static struct ns_dev *cards[NS_MAX_CARDS];
static unsigned num_cards;
static const struct atmdev_ops atm_ops = …;
static struct timer_list ns_timer;
static char *mac[NS_MAX_CARDS];
module_param_array(…);
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
static int nicstar_init_one(struct pci_dev *pcidev,
const struct pci_device_id *ent)
{ … }
static void nicstar_remove_one(struct pci_dev *pcidev)
{ … }
static const struct pci_device_id nicstar_pci_tbl[] = …;
MODULE_DEVICE_TABLE(pci, nicstar_pci_tbl);
static struct pci_driver nicstar_driver = …;
static int __init nicstar_init(void)
{ … }
static void __exit nicstar_cleanup(void)
{ … }
static u32 ns_read_sram(ns_dev * card, u32 sram_address)
{ … }
static void ns_write_sram(ns_dev * card, u32 sram_address, u32 * value,
int count)
{ … }
static int ns_init_card(int i, struct pci_dev *pcidev)
{ … }
static void ns_init_card_error(ns_dev *card, int error)
{ … }
static scq_info *get_scq(ns_dev *card, int size, u32 scd)
{ … }
static void free_scq(ns_dev *card, scq_info *scq, struct atm_vcc *vcc)
{ … }
static void push_rxbufs(ns_dev * card, struct sk_buff *skb)
{ … }
static irqreturn_t ns_irq_handler(int irq, void *dev_id)
{ … }
static int ns_open(struct atm_vcc *vcc)
{ … }
static void ns_close(struct atm_vcc *vcc)
{ … }
static void fill_tst(ns_dev * card, int n, vc_map * vc)
{ … }
static int _ns_send(struct atm_vcc *vcc, struct sk_buff *skb, bool may_sleep)
{ … }
static int ns_send(struct atm_vcc *vcc, struct sk_buff *skb)
{ … }
static int ns_send_bh(struct atm_vcc *vcc, struct sk_buff *skb)
{ … }
static int push_scqe(ns_dev * card, vc_map * vc, scq_info * scq, ns_scqe * tbd,
struct sk_buff *skb, bool may_sleep)
{ … }
static void process_tsq(ns_dev * card)
{ … }
static void drain_scq(ns_dev * card, scq_info * scq, int pos)
{ … }
static void process_rsq(ns_dev * card)
{ … }
static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
{ … }
static void recycle_rx_buf(ns_dev * card, struct sk_buff *skb)
{ … }
static void recycle_iovec_rx_bufs(ns_dev * card, struct iovec *iov, int count)
{ … }
static void recycle_iov_buf(ns_dev * card, struct sk_buff *iovb)
{ … }
static void dequeue_sm_buf(ns_dev * card, struct sk_buff *sb)
{ … }
static void dequeue_lg_buf(ns_dev * card, struct sk_buff *lb)
{ … }
static int ns_proc_read(struct atm_dev *dev, loff_t * pos, char *page)
{ … }
static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void __user * arg)
{ … }
#ifdef EXTRA_DEBUG
static void which_list(ns_dev * card, struct sk_buff *skb)
{
printk("skb buf_type: 0x%08x\n", NS_PRV_BUFTYPE(skb));
}
#endif
static void ns_poll(struct timer_list *unused)
{ … }
static void ns_phy_put(struct atm_dev *dev, unsigned char value,
unsigned long addr)
{ … }
static unsigned char ns_phy_get(struct atm_dev *dev, unsigned long addr)
{ … }
module_init(…) …;
module_exit(nicstar_cleanup);