X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fnet%2Fwan%2Ffarsync.c;h=c45d6a83339d187e6c999427a1d42573e6e7f039;hb=a2f44b27303a5353859d77a3e96a1d3f33f56ab7;hp=543ac790072be7f2685f3feb558fe0ae7e6e9a84;hpb=70790a4b5cd6c0291e5b1a2836e2832d46036ac6;p=linux-2.6.git diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index 543ac7900..c45d6a833 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c @@ -33,11 +33,6 @@ */ MODULE_AUTHOR("R.J.Dunlop "); MODULE_DESCRIPTION("FarSync T-Series WAN driver. FarSite Communications Ltd."); -MODULE_PARM(fst_txq_low, "i"); -MODULE_PARM(fst_txq_high, "i"); -MODULE_PARM(fst_max_reads, "i"); -MODULE_PARM(fst_excluded_cards, "i"); -MODULE_PARM(fst_excluded_list, "0-32i"); MODULE_LICENSE("GPL"); /* Driver configuration and global parameters @@ -79,11 +74,17 @@ MODULE_LICENSE("GPL"); /* * Modules parameters and associated varaibles */ -int fst_txq_low = FST_LOW_WATER_MARK; -int fst_txq_high = FST_HIGH_WATER_MARK; -int fst_max_reads = 7; -int fst_excluded_cards = 0; -int fst_excluded_list[FST_MAX_CARDS]; +static int fst_txq_low = FST_LOW_WATER_MARK; +static int fst_txq_high = FST_HIGH_WATER_MARK; +static int fst_max_reads = 7; +static int fst_excluded_cards = 0; +static int fst_excluded_list[FST_MAX_CARDS]; + +module_param(fst_txq_low, int, 0); +module_param(fst_txq_high, int, 0); +module_param(fst_max_reads, int, 0); +module_param(fst_excluded_cards, int, 0); +module_param_array(fst_excluded_list, int, NULL, 0); /* Card shared memory layout * ========================= @@ -411,7 +412,7 @@ struct buf_window { }; /* Calculate offset of a buffer object within the shared memory window */ -#define BUF_OFFSET(X) ((unsigned int)&(((struct buf_window *)BFM_BASE)->X)) +#define BUF_OFFSET(X) (BFM_BASE + offsetof(struct buf_window, X)) #pragma pack() @@ -443,8 +444,8 @@ struct fst_port_info { /* Per card information */ struct fst_card_info { - char *mem; /* Card memory mapped to kernel space */ - char *ctlmem; /* Control memory for PCI cards */ + char __iomem *mem; /* Card memory mapped to kernel space */ + char __iomem *ctlmem; /* Control memory for PCI cards */ unsigned int phys_mem; /* Physical memory window address */ unsigned int phys_ctlmem; /* Physical control memory address */ unsigned int irq; /* Interrupt request line number */ @@ -571,13 +572,13 @@ static void do_bottom_half_rx(struct fst_card_info *card); static void fst_process_tx_work_q(unsigned long work_q); static void fst_process_int_work_q(unsigned long work_q); -DECLARE_TASKLET(fst_tx_task, fst_process_tx_work_q, 0); -DECLARE_TASKLET(fst_int_task, fst_process_int_work_q, 0); +static DECLARE_TASKLET(fst_tx_task, fst_process_tx_work_q, 0); +static DECLARE_TASKLET(fst_int_task, fst_process_int_work_q, 0); -struct fst_card_info *fst_card_array[FST_MAX_CARDS]; -spinlock_t fst_work_q_lock; -u64 fst_work_txq; -u64 fst_work_intq; +static struct fst_card_info *fst_card_array[FST_MAX_CARDS]; +static spinlock_t fst_work_q_lock; +static u64 fst_work_txq; +static u64 fst_work_intq; static void fst_q_work_item(u64 * queue, int card_index) @@ -781,7 +782,7 @@ fst_disable_intr(struct fst_card_info *card) } } -/* Process the result of trying to pass a recieved frame up the stack +/* Process the result of trying to pass a received frame up the stack */ static void fst_process_rx_status(int rx_status, char *name) @@ -857,6 +858,17 @@ fst_tx_dma_complete(struct fst_card_info *card, struct fst_port_info *port, dev->trans_start = jiffies; } +/* + * Mark it for our own raw sockets interface + */ +static __be16 farsync_type_trans(struct sk_buff *skb, struct net_device *dev) +{ + skb->dev = dev; + skb->mac.raw = skb->data; + skb->pkt_type = PACKET_HOST; + return htons(ETH_P_CUST); +} + /* Rx dma complete interrupt */ static void @@ -881,17 +893,10 @@ fst_rx_dma_complete(struct fst_card_info *card, struct fst_port_info *port, /* Push upstream */ dbg(DBG_RX, "Pushing the frame up the stack\n"); - skb->mac.raw = skb->data; - skb->dev = dev; - if (port->mode == FST_RAW) { - /* - * Mark it for our own raw sockets interface - */ - skb->protocol = htons(ETH_P_CUST); - skb->pkt_type = PACKET_HOST; - } else { - skb->protocol = hdlc_type_trans(skb, skb->dev); - } + if (port->mode == FST_RAW) + skb->protocol = farsync_type_trans(skb, dev); + else + skb->protocol = hdlc_type_trans(skb, dev); rx_status = netif_rx(skb); fst_process_rx_status(rx_status, port_to_dev(port)->name); if (rx_status == NET_RX_DROP) @@ -975,7 +980,7 @@ fst_issue_cmd(struct fst_port_info *port, unsigned short cmd) /* Wait for any previous command to complete */ while (mbval > NAK) { spin_unlock_irqrestore(&card->card_lock, flags); - schedule_timeout(1); + schedule_timeout_uninterruptible(1); spin_lock_irqsave(&card->card_lock, flags); if (++safety > 2000) { @@ -1316,17 +1321,10 @@ fst_intr_rx(struct fst_card_info *card, struct fst_port_info *port) /* Push upstream */ dbg(DBG_RX, "Pushing frame up the stack\n"); - skb->mac.raw = skb->data; - skb->dev = dev; - if (port->mode == FST_RAW) { - /* - * Mark it for our own raw sockets interface - */ - skb->protocol = htons(ETH_P_CUST); - skb->pkt_type = PACKET_HOST; - } else { - skb->protocol = hdlc_type_trans(skb, skb->dev); - } + if (port->mode == FST_RAW) + skb->protocol = farsync_type_trans(skb, dev); + else + skb->protocol = hdlc_type_trans(skb, dev); rx_status = netif_rx(skb); fst_process_rx_status(rx_status, port_to_dev(port)->name); if (rx_status == NET_RX_DROP) { @@ -1499,8 +1497,8 @@ do_bottom_half_rx(struct fst_card_info *card) * The interrupt service routine * Dev_id is our fst_card_info pointer */ -irqreturn_t -fst_intr(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t +fst_intr(int irq, void *dev_id) { struct fst_card_info *card; struct fst_port_info *port; @@ -2521,7 +2519,7 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) dbg(DBG_PCI, "kernel mem %p, ctlmem %p\n", card->mem, card->ctlmem); /* Register the interrupt handler */ - if (request_irq(pdev->irq, fst_intr, SA_SHIRQ, FST_DEV_NAME, card)) { + if (request_irq(pdev->irq, fst_intr, IRQF_SHARED, FST_DEV_NAME, card)) { printk_err("Unable to register interrupt %d\n", card->irq); pci_release_regions(pdev); pci_disable_device(pdev); @@ -2699,7 +2697,7 @@ fst_init(void) for (i = 0; i < FST_MAX_CARDS; i++) fst_card_array[i] = NULL; spin_lock_init(&fst_work_q_lock); - return pci_module_init(&fst_driver); + return pci_register_driver(&fst_driver); } static void __exit