diff options
Diffstat (limited to 'drivers')
63 files changed, 998 insertions, 638 deletions
diff --git a/drivers/acorn/net/ether1.c b/drivers/acorn/net/ether1.c index d2a5ca052..b112330d3 100644 --- a/drivers/acorn/net/ether1.c +++ b/drivers/acorn/net/ether1.c @@ -70,7 +70,7 @@ static int ether1_open(struct net_device *dev); static int ether1_sendpacket(struct sk_buff *skb, struct net_device *dev); static void ether1_interrupt(int irq, void *dev_id, struct pt_regs *regs); static int ether1_close(struct net_device *dev); -static struct enet_statistics *ether1_getstats(struct net_device *dev); +static struct net_device_stats *ether1_getstats(struct net_device *dev); static void ether1_setmulticastlist(struct net_device *dev); static void ether1_timeout(struct net_device *dev); @@ -661,7 +661,7 @@ ether1_open (struct net_device *dev) return -EAGAIN; } - memset (&priv->stats, 0, sizeof (struct enet_statistics)); + memset (&priv->stats, 0, sizeof (struct net_device_stats)); if (ether1_init_for_open (dev)) { free_irq (dev->irq, dev); @@ -978,7 +978,7 @@ ether1_close (struct net_device *dev) return 0; } -static struct enet_statistics * +static struct net_device_stats * ether1_getstats (struct net_device *dev) { struct ether1_priv *priv = (struct ether1_priv *)dev->priv; diff --git a/drivers/acorn/net/ether1.h b/drivers/acorn/net/ether1.h index db64114f1..db6ba7d49 100644 --- a/drivers/acorn/net/ether1.h +++ b/drivers/acorn/net/ether1.h @@ -31,7 +31,7 @@ #define IDPROM_ADDRESS (dev->base_addr + 0x09) struct ether1_priv { - struct enet_statistics stats; + struct net_device_stats stats; unsigned int tx_link; unsigned int tx_head; volatile unsigned int tx_tail; diff --git a/drivers/acorn/net/ether3.c b/drivers/acorn/net/ether3.c index 11e382481..a73209a47 100644 --- a/drivers/acorn/net/ether3.c +++ b/drivers/acorn/net/ether3.c @@ -83,7 +83,7 @@ static int ether3_open (struct net_device *dev); static int ether3_sendpacket (struct sk_buff *skb, struct net_device *dev); static void ether3_interrupt (int irq, void *dev_id, struct pt_regs *regs); static int ether3_close (struct net_device *dev); -static struct enet_statistics *ether3_getstats (struct net_device *dev); +static struct net_device_stats *ether3_getstats (struct net_device *dev); static void ether3_setmulticastlist (struct net_device *dev); static void ether3_timeout(struct net_device *dev); @@ -338,7 +338,7 @@ ether3_init_for_open(struct net_device *dev) struct dev_priv *priv = (struct dev_priv *)dev->priv; int i; - memset(&priv->stats, 0, sizeof(struct enet_statistics)); + memset(&priv->stats, 0, sizeof(struct net_device_stats)); /* Reset the chip */ ether3_outw(CFG2_RESET, REG_CONFIG2); @@ -459,7 +459,7 @@ ether3_close(struct net_device *dev) * Get the current statistics. This may be called with the card open or * closed. */ -static struct enet_statistics *ether3_getstats(struct net_device *dev) +static struct net_device_stats *ether3_getstats(struct net_device *dev) { struct dev_priv *priv = (struct dev_priv *)dev->priv; return &priv->stats; @@ -690,7 +690,7 @@ if (next_ptr < RX_START || next_ptr >= RX_END) { } else goto dropping; } else { - struct enet_statistics *stats = &priv->stats; + struct net_device_stats *stats = &priv->stats; ether3_outw(next_ptr >> 8, REG_RECVEND); if (status & RXSTAT_OVERSIZE) stats->rx_over_errors ++; if (status & RXSTAT_CRCERROR) stats->rx_crc_errors ++; diff --git a/drivers/acorn/net/ether3.h b/drivers/acorn/net/ether3.h index 45dfd82a1..e7f5baf1b 100644 --- a/drivers/acorn/net/ether3.h +++ b/drivers/acorn/net/ether3.h @@ -154,7 +154,7 @@ struct dev_priv { unsigned char tx_head; /* buffer nr to insert next packet */ unsigned char tx_tail; /* buffer nr of transmitting packet */ unsigned int rx_head; /* address to fetch next packet from */ - struct enet_statistics stats; + struct net_device_stats stats; struct timer_list timer; int broken; /* 0 = ok, 1 = something went wrong */ }; diff --git a/drivers/block/md.c b/drivers/block/md.c index 058c001c7..651c3dd6d 100644 --- a/drivers/block/md.c +++ b/drivers/block/md.c @@ -2908,7 +2908,7 @@ int md_thread(void * arg) * many dirty RAID5 blocks. */ current->policy = SCHED_OTHER; - current->priority = 40; + current->nice = -20; // md_unlock_kernel(); up(thread->sem); @@ -3336,7 +3336,7 @@ recheck: /* * Resync has low priority. */ - current->priority = 1; + current->nice = 19; is_mddev_idle(mddev); /* this also initializes IO event counters */ for (m = 0; m < SYNC_MARKS; m++) { @@ -3412,7 +3412,7 @@ repeat: currspeed = (j-mddev->resync_mark_cnt)/((jiffies-mddev->resync_mark)/HZ +1) +1; if (currspeed > sysctl_speed_limit_min) { - current->priority = 1; + current->priority = 19; if ((currspeed > sysctl_speed_limit_max) || !is_mddev_idle(mddev)) { @@ -3422,7 +3422,7 @@ repeat: goto repeat; } } else - current->priority = 40; + current->priority = -20; } fsync_dev(read_disk); printk(KERN_INFO "md: md%d: sync done.\n",mdidx(mddev)); diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index 665514727..4435a517b 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c @@ -1,7 +1,7 @@ /* * linux/drivers/char/synclink.c * - * ==FILEDATE 19991217== + * ==FILEDATE 20000707== * * Device driver for Microgate SyncLink ISA and PCI * high speed multiprotocol serial adapters. @@ -33,6 +33,13 @@ * This driver has been tested with a slightly modified ppp.c driver * for synchronous PPP. * + * 2000/02/16 + * Added interface for syncppp.c driver (an alternate synchronous PPP + * implementation that also supports Cisco HDLC). Each device instance + * registers as a tty device AND a network device (if dosyncppp option + * is set for the device). The functionality is determined by which + * device interface is opened. + * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -73,6 +80,8 @@ #include <linux/mm.h> #include <linux/malloc.h> +#include <linux/netdevice.h> + #if LINUX_VERSION_CODE >= VERSION(2,1,0) #include <linux/vmalloc.h> #include <linux/init.h> @@ -101,6 +110,23 @@ typedef struct wait_queue *wait_queue_head_t; #define set_current_state(a) current->state = (a) #endif +#ifdef CONFIG_SYNCLINK_SYNCPPP_MODULE +#define CONFIG_SYNCLINK_SYNCPPP 1 +#endif + +#ifdef CONFIG_SYNCLINK_SYNCPPP +#if LINUX_VERSION_CODE < VERSION(2,3,43) +#include "../net/syncppp.h" +#define net_device device +#define netif_stop_queue(a) (a)->tbusy = 1 +#define netif_start_queue(a) (a)->tbusy = 0 +#define netif_wake_queue(a) (a)->tbusy = 0; mark_bh(NET_BH) +#define netif_queue_stopped(a) ((a)->tbusy) +#else +#include "../net/wan/syncppp.h" +#endif +#endif + #if LINUX_VERSION_CODE >= VERSION(2,1,4) #include <asm/segment.h> #define GET_USER(error,value,addr) error = get_user(value,addr) @@ -208,22 +234,11 @@ typedef struct _DMABUFFERENTRY /* The queue of BH actions to be performed */ -#define BH_TYPE_RECEIVE_DATA 1 -#define BH_TYPE_RECEIVE_STATUS 2 -#define BH_TYPE_RECEIVE_DMA 3 -#define BH_TYPE_TRANSMIT_DATA 4 -#define BH_TYPE_TRANSMIT_STATUS 5 -#define BH_TYPE_STATUS 6 - -typedef struct _BH_EVENT { - unsigned char type; /* Set by interrupt routines to reqst */ - u16 status; - struct _BH_EVENT *link; - -} BH_EVENT, *BH_QUEUE; /* Queue of BH actions to be done. */ +#define BH_RECEIVE 1 +#define BH_TRANSMIT 2 +#define BH_STATUS 4 -#define MAX_BH_QUEUE_ENTRIES 200 -#define IO_PIN_SHUTDOWN_LIMIT (MAX_BH_QUEUE_ENTRIES/4) +#define IO_PIN_SHUTDOWN_LIMIT 100 #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) @@ -243,6 +258,7 @@ struct _input_signal_events { */ struct mgsl_struct { + void *if_ptr; /* General purpose pointer (used by SPPP) */ int magic; int flags; int count; /* count of opens */ @@ -284,12 +300,8 @@ struct mgsl_struct { u32 max_frame_size; /* as set by device config */ - BH_EVENT bh_queue[MAX_BH_QUEUE_ENTRIES]; /* Pointer to alloc'ed block */ - BH_QUEUE bh_queue_head; /* Queue of BH actions */ - BH_QUEUE bh_queue_tail; /* Tail of above for perf. */ - BH_QUEUE free_bh_queue_head; /* Queue of Free BH */ - BH_QUEUE free_bh_queue_tail; /* Tail of above for perf. */ - BH_QUEUE bh_action; /* Action for BH */ + u32 pending_bh; + int bh_running; /* Protection from multiple */ int isr_overflow; int bh_requested; @@ -324,7 +336,8 @@ struct mgsl_struct { char device_name[25]; /* device instance name */ unsigned int bus_type; /* expansion bus type (ISA,EISA,PCI) */ - struct pci_dev *pdev; /* pointer to PCI device info */ + unsigned char bus; /* expansion bus number (zero based) */ + unsigned char function; /* PCI device number */ unsigned int io_base; /* base I/O address of adapter */ unsigned int io_addr_size; /* size of the I/O address range */ @@ -366,6 +379,20 @@ struct mgsl_struct { BOOLEAN loopmode_send_done_requested; struct _input_signal_events input_signal_events; + + /* SPPP/Cisco HDLC device parts */ + int netcount; + int dosyncppp; + spinlock_t netlock; +#ifdef CONFIG_SYNCLINK_SYNCPPP + struct ppp_device pppdev; + char netname[10]; + struct net_device *netdev; + struct net_device_stats netstats; +#if LINUX_VERSION_CODE >= VERSION(2,2,16) + struct net_device netdevice; +#endif +#endif }; #define MGSL_MAGIC 0x5401 @@ -373,8 +400,9 @@ struct mgsl_struct { /* * The size of the serial xmit buffer is 1 page, or 4096 bytes */ -/* #define SERIAL_XMIT_SIZE 4096 */ /* defined in include/linux/serial.h */ - +#ifndef SERIAL_XMIT_SIZE +#define SERIAL_XMIT_SIZE 4096 +#endif /* * These macros define the offsets used in calculating the @@ -767,6 +795,22 @@ int usc_loopmode_active( struct mgsl_struct * info); void usc_loopmode_send_done( struct mgsl_struct * info ); int usc_loopmode_send_active( struct mgsl_struct * info ); +int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long arg); + +#ifdef CONFIG_SYNCLINK_SYNCPPP +/* SPPP/HDLC stuff */ +void mgsl_sppp_init(struct mgsl_struct *info); +void mgsl_sppp_delete(struct mgsl_struct *info); +int mgsl_sppp_open(struct net_device *d); +int mgsl_sppp_close(struct net_device *d); +void mgsl_sppp_tx_timeout(struct net_device *d); +int mgsl_sppp_tx(struct sk_buff *skb, struct net_device *d); +void mgsl_sppp_rx_done(struct mgsl_struct *info, char *buf, int size); +void mgsl_sppp_tx_done(struct mgsl_struct *info); +int mgsl_sppp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); +struct net_device_stats *mgsl_net_stats(struct net_device *dev); +#endif + /* * Defines a BUS descriptor value for the PCI adapter * local bus address ranges. @@ -828,14 +872,9 @@ void mgsl_free_intermediate_rxbuffer_memory(struct mgsl_struct *info); * Bottom half interrupt handlers */ void mgsl_bh_handler(void* Context); -void mgsl_bh_receive_dma( struct mgsl_struct *info, unsigned short status ); -void mgsl_bh_transmit_data( struct mgsl_struct *info, unsigned short Datacount ); -void mgsl_bh_status_handler( struct mgsl_struct *info, unsigned short status ); - -void mgsl_format_bh_queue( struct mgsl_struct *info ); -void mgsl_bh_queue_put( struct mgsl_struct *info, unsigned char type, unsigned short status ); -int mgsl_bh_queue_get( struct mgsl_struct *info ); - +void mgsl_bh_receive(struct mgsl_struct *info); +void mgsl_bh_transmit(struct mgsl_struct *info); +void mgsl_bh_status(struct mgsl_struct *info); /* * Interrupt handler routines and dispatch table. @@ -911,7 +950,7 @@ static int irq[MAX_ISA_DEVICES] = {0,}; static int dma[MAX_ISA_DEVICES] = {0,}; static int debug_level = 0; static int maxframe[MAX_TOTAL_DEVICES] = {0,}; - +static int dosyncppp[MAX_TOTAL_DEVICES] = {0,}; #if LINUX_VERSION_CODE >= VERSION(2,1,0) MODULE_PARM(break_on_load,"i"); @@ -922,10 +961,11 @@ MODULE_PARM(irq,"1-" __MODULE_STRING(MAX_ISA_DEVICES) "i"); MODULE_PARM(dma,"1-" __MODULE_STRING(MAX_ISA_DEVICES) "i"); MODULE_PARM(debug_level,"i"); MODULE_PARM(maxframe,"1-" __MODULE_STRING(MAX_TOTAL_DEVICES) "i"); +MODULE_PARM(dosyncppp,"1-" __MODULE_STRING(MAX_TOTAL_DEVICES) "i"); #endif static char *driver_name = "SyncLink serial driver"; -static char *driver_version = "1.16"; +static char *driver_version = "1.21"; static struct tty_driver serial_driver, callout_driver; static int serial_refcount; @@ -1037,152 +1077,46 @@ static void mgsl_start(struct tty_struct *tty) * Bottom half work queue access functions */ -/* mgsl_format_bh_queue() - * - * Initialize the bottom half processing queue - * - * Arguments: info pointer to device instance data - * Return Value: None - */ -void mgsl_format_bh_queue( struct mgsl_struct *info ) -{ - BH_QUEUE bh_queue = info->bh_queue; - int i; - - /* go through sequentially tacking the little bits together */ - - for ( i=0; i < MAX_BH_QUEUE_ENTRIES; i++ ) { - if ( info->free_bh_queue_tail == NULL ) - info->free_bh_queue_head = bh_queue; - else - info->free_bh_queue_tail->link = bh_queue; - info->free_bh_queue_tail = bh_queue++; - } - - /* As a safety measure, mark the end of the chain with a NULL */ - info->free_bh_queue_tail->link = NULL; - info->isr_overflow=0; - -} /* end of mgsl_format_bh_queue() */ - -/* mgsl_bh_queue_put() - * - * Add a BH event to the BH queue - * - * Arguments: info pointer to device instance data - * type BH event type - * status BH event status - * - * Return Value: None +/* mgsl_bh_action() Return next bottom half action to perform. + * Return Value: BH action code or 0 if nothing to do. */ -void mgsl_bh_queue_put( struct mgsl_struct *info, unsigned char type, unsigned short status ) -{ - BH_EVENT *event = info->free_bh_queue_head; - - if ( event != NULL ) { - /* remove free element from head of free list */ - info->free_bh_queue_head = event->link; - event->link = NULL; - - /* file out new BH event */ - event->type = type; - event->status = status; - - /* add element to tail of pending list */ - if ( info->bh_queue_head != NULL ){ - /* BH queue is not empty, add current element to tail */ - info->bh_queue_tail->link = event; - } else { - /* the BH queue is empty so this element becomes the head of queue */ - info->bh_queue_head = event; - } - - /* the new element becomes tail of queue */ - info->bh_queue_tail = event; - } else { - /* No more free BH action elements in queue. */ - /* This happens when too many interrupts are occuring */ - /* for the mgsl_bh_handler to process so set a flag. */ - - info->isr_overflow = 1; - } - -} /* end of mgsl_bh_queue_put() */ - -/* mgsl_bh_queue_get() - * - * Free the current work item (if any) and get the - * next work item from the head of the pending work item queue. - * - * Effects: - * - * If a BH action element is available on the BH action queue - * then the head of the queue is removed and bh_action - * is set to point to the removed element. - * - * Arguments: info pointer to device instance data - * Return Value: 1 if BH action removed from queue - */ -int mgsl_bh_queue_get( struct mgsl_struct *info ) +int mgsl_bh_action(struct mgsl_struct *info) { unsigned long flags; + int rc = 0; spin_lock_irqsave(&info->irq_spinlock,flags); - if ( info->bh_action ) { - /* free the current work item */ - if ( info->free_bh_queue_head != NULL ){ - /* free queue is not empty, add current element to tail */ - info->free_bh_queue_tail->link = info->bh_action; - } else { - /* free queue is empty so this element becomes the head of queue */ - info->free_bh_queue_head = info->bh_action; - } - - /* add element to tail of free queue */ - info->free_bh_queue_tail = info->bh_action; - info->free_bh_queue_tail->link = NULL; + if (info->pending_bh & BH_RECEIVE) { + info->pending_bh &= ~BH_RECEIVE; + rc = BH_RECEIVE; + } else if (info->pending_bh & BH_TRANSMIT) { + info->pending_bh &= ~BH_TRANSMIT; + rc = BH_TRANSMIT; + } else if (info->pending_bh & BH_STATUS) { + info->pending_bh &= ~BH_STATUS; + rc = BH_STATUS; } - - /* attempt to remove element from head of queue */ - info->bh_action = info->bh_queue_head; - if ( info->bh_action != NULL ){ - /* BH queue is not empty, remove element from queue head */ - info->bh_queue_head = info->bh_action->link; - spin_unlock_irqrestore(&info->irq_spinlock,flags); - return 1; - } - - if ( info->isr_overflow ) { - if (debug_level >= DEBUG_LEVEL_BH) - printk("ISR overflow cleared.\n"); - info->isr_overflow=0; - usc_EnableMasterIrqBit(info); - usc_EnableDmaInterrupts(info,DICR_MASTER); + if (!rc) { + /* Mark BH routine as complete */ + info->bh_running = 0; + info->bh_requested = 0; } - - /* Mark BH routine as complete */ - info->bh_running = 0; - info->bh_requested = 0; spin_unlock_irqrestore(&info->irq_spinlock,flags); - return 0; - -} /* end of mgsl_bh_queue_get() */ + return rc; +} -/* mgsl_bh_handler() - * +/* * Perform bottom half processing of work items queued by ISR. - * - * Arguments: Context pointer to device instance data - * Return Value: None */ void mgsl_bh_handler(void* Context) { struct mgsl_struct *info = (struct mgsl_struct*)Context; - + int action; + if (!info) return; @@ -1192,34 +1126,27 @@ void mgsl_bh_handler(void* Context) info->bh_running = 1; - /* Attempt to clear out the BH queue */ - - while( mgsl_bh_queue_get(info) ) { + while((action = mgsl_bh_action(info)) != 0) { /* Process work item */ if ( debug_level >= DEBUG_LEVEL_BH ) printk( "%s(%d):mgsl_bh_handler() work item action=%d\n", - __FILE__,__LINE__,info->bh_action->type); + __FILE__,__LINE__,action); - switch ( info->bh_action->type ) { + switch (action) { - case BH_TYPE_RECEIVE_DMA: - mgsl_bh_receive_dma( info, info->bh_action->status ); + case BH_RECEIVE: + mgsl_bh_receive(info); break; - - case BH_TYPE_TRANSMIT_STATUS: - case BH_TYPE_TRANSMIT_DATA: - mgsl_bh_transmit_data( info, info->bh_action->status ); + case BH_TRANSMIT: + mgsl_bh_transmit(info); break; - - case BH_TYPE_STATUS: - mgsl_bh_status_handler( info, info->bh_action->status ); + case BH_STATUS: + mgsl_bh_status(info); break; - default: /* unknown work item ID */ - printk("Unknown work item ID=%08X!\n", - info->bh_action->type ); + printk("Unknown work item ID=%08X!\n", action); break; } } @@ -1227,51 +1154,27 @@ void mgsl_bh_handler(void* Context) if ( debug_level >= DEBUG_LEVEL_BH ) printk( "%s(%d):mgsl_bh_handler(%s) exit\n", __FILE__,__LINE__,info->device_name); - -} /* end of mgsl_bh_handler() */ +} -/* mgsl_bh_receive_dma() - * - * Perform bottom half processing for a receive DMA interrupt - * This occurs in HDLC mode after a DMA buffer has terminated - * or the DMA buffers have been exhausted. - * - * Arguments: - * - * info pointer to device instance data - * status status word - * - * Return Value: None - */ -void mgsl_bh_receive_dma( struct mgsl_struct *info, unsigned short status ) +void mgsl_bh_receive(struct mgsl_struct *info) { if ( debug_level >= DEBUG_LEVEL_BH ) - printk( "%s(%d):mgsl_bh_receive_dma(%s)\n", + printk( "%s(%d):mgsl_bh_receive(%s)\n", __FILE__,__LINE__,info->device_name); while( mgsl_get_rx_frame(info) ); +} -} /* end of mgsl_bh_receive_dma() */ - -/* mgsl_bh_transmit_data() - * - * Process a transmit data interrupt event - * This occurs in asynchronous communications mode. - * - * Arguments: info pointer to device instance data - * Return Value: None - */ -void mgsl_bh_transmit_data( struct mgsl_struct *info, unsigned short Datacount ) +void mgsl_bh_transmit(struct mgsl_struct *info) { struct tty_struct *tty = info->tty; unsigned long flags; if ( debug_level >= DEBUG_LEVEL_BH ) - printk( "%s(%d):mgsl_bh_transmit_data() entry on %s\n", + printk( "%s(%d):mgsl_bh_transmit() entry on %s\n", __FILE__,__LINE__,info->device_name); - - /* wakeup any waiting write requests */ - if (tty) { + + if (tty) { if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup) { if ( debug_level >= DEBUG_LEVEL_BH ) @@ -1289,49 +1192,19 @@ void mgsl_bh_transmit_data( struct mgsl_struct *info, unsigned short Datacount ) if ( !info->tx_active && info->loopmode_send_done_requested ) usc_loopmode_send_done( info ); spin_unlock_irqrestore(&info->irq_spinlock,flags); +} -} /* End Of mgsl_bh_transmit_data() */ - -/* mgsl_bh_status_handler() - * - * Peform bottom half processing for a status interrupt - * - * This event is generated when a I/O pin (serial signal) - * has a transition. If there is a pending WaitEvent call - * and the status transition is identified in the EventMast - * of the pending call then complete the pending call. - * - * Arguments: - * - * info pointer to device instance data - * status status word - * - * Return Value: None - */ -void mgsl_bh_status_handler( struct mgsl_struct *info, unsigned short status ) +void mgsl_bh_status(struct mgsl_struct *info) { if ( debug_level >= DEBUG_LEVEL_BH ) - printk( "%s(%d):mgsl_bh_status_handler() entry on %s\n", + printk( "%s(%d):mgsl_bh_status() entry on %s\n", __FILE__,__LINE__,info->device_name); - if (status & MISCSTATUS_RI_LATCHED) { - if (info->ri_chkcount) - (info->ri_chkcount)--; - } - if (status & MISCSTATUS_DSR_LATCHED) { - if (info->dsr_chkcount) - (info->dsr_chkcount)--; - } - if (status & MISCSTATUS_DCD_LATCHED) { - if (info->dcd_chkcount) - (info->dcd_chkcount)--; - } - if (status & MISCSTATUS_CTS_LATCHED) { - if (info->cts_chkcount) - (info->cts_chkcount)--; - } - -} /* End Of mgsl_bh_status_handler() */ + info->ri_chkcount = 0; + info->dsr_chkcount = 0; + info->dcd_chkcount = 0; + info->cts_chkcount = 0; +} /* mgsl_isr_receive_status() * @@ -1375,12 +1248,6 @@ void mgsl_isr_receive_status( struct mgsl_struct *info ) } if (status & RXSTATUS_OVERRUN){ -// /* Purge receive FIFO to allow DMA buffer completion -// * with overrun status stored in the receive status block. -// */ -// usc_RCmd( info, RCmd_EnterHuntmode ); -// usc_RTCmd( info, RTCmd_PurgeRxFifo ); - info->icount.rxover++; usc_process_rxoverrun_sync( info ); } @@ -1443,13 +1310,19 @@ void mgsl_isr_transmit_status( struct mgsl_struct *info ) } info->drop_rts_on_tx_done = 0; } - - if (info->tty->stopped || info->tty->hw_stopped) { - usc_stop_transmitter(info); - return; + +#ifdef CONFIG_SYNCLINK_SYNCPPP + if (info->netcount) + mgsl_sppp_tx_done(info); + else +#endif + { + if (info->tty->stopped || info->tty->hw_stopped) { + usc_stop_transmitter(info); + return; + } + info->pending_bh |= BH_TRANSMIT; } - - mgsl_bh_queue_put(info, BH_TYPE_TRANSMIT_STATUS, status); } /* end of mgsl_isr_transmit_status() */ @@ -1499,9 +1372,13 @@ void mgsl_isr_io_pin( struct mgsl_struct *info ) if ((info->dcd_chkcount)++ >= IO_PIN_SHUTDOWN_LIMIT) usc_DisablestatusIrqs(info,SICR_DCD); icount->dcd++; - if ( status & MISCSTATUS_DCD ) + if (status & MISCSTATUS_DCD) { info->input_signal_events.dcd_up++; - else +#ifdef CONFIG_SYNCLINK_SYNCPPP + if (info->netcount) + sppp_reopen(info->netdev); +#endif + } else info->input_signal_events.dcd_down++; #ifdef CONFIG_HARD_PPS if ((info->flags & ASYNC_HARDPPS_CD) && @@ -1544,23 +1421,25 @@ void mgsl_isr_io_pin( struct mgsl_struct *info ) if (status & MISCSTATUS_CTS) { if ( debug_level >= DEBUG_LEVEL_ISR ) printk("CTS tx start..."); - info->tty->hw_stopped = 0; + if (info->tty) + info->tty->hw_stopped = 0; usc_start_transmitter(info); - mgsl_bh_queue_put( info, BH_TYPE_TRANSMIT_DATA, status ); + info->pending_bh |= BH_TRANSMIT; return; } } else { if (!(status & MISCSTATUS_CTS)) { if ( debug_level >= DEBUG_LEVEL_ISR ) printk("CTS tx stop..."); - info->tty->hw_stopped = 1; + if (info->tty) + info->tty->hw_stopped = 1; usc_stop_transmitter(info); } } } } - mgsl_bh_queue_put(info, BH_TYPE_STATUS, status); + info->pending_bh |= BH_STATUS; /* for diagnostics set IRQ flag */ if ( status & MISCSTATUS_TXC_LATCHED ){ @@ -1598,7 +1477,7 @@ void mgsl_isr_transmit_data( struct mgsl_struct *info ) info->tx_active = 0; if (info->xmit_cnt < WAKEUP_CHARS) - mgsl_bh_queue_put(info, BH_TYPE_TRANSMIT_DATA, (unsigned short)(info->xmit_cnt)); + info->pending_bh |= BH_TRANSMIT; } /* end of mgsl_isr_transmit_data() */ @@ -1790,8 +1669,7 @@ void mgsl_isr_receive_dma( struct mgsl_struct *info ) printk("%s(%d):mgsl_isr_receive_dma(%s) status=%04X\n", __FILE__,__LINE__,info->device_name,status); - /* Post a receive event for BH processing. */ - mgsl_bh_queue_put( info, BH_TYPE_RECEIVE_DMA, status ); + info->pending_bh |= BH_RECEIVE; if ( status & BIT3 ) { info->rx_overflow = 1; @@ -1859,7 +1737,7 @@ static void mgsl_interrupt(int irq, void *dev_id, struct pt_regs * regs) * for it to do and the bh is not already running */ - if ( info->bh_queue_head && !info->bh_running && !info->bh_requested ) { + if ( info->pending_bh && !info->bh_running && !info->bh_requested ) { if ( debug_level >= DEBUG_LEVEL_ISR ) printk("%s(%d):%s queueing bh task.\n", __FILE__,__LINE__,info->device_name); @@ -1903,7 +1781,7 @@ static int startup(struct mgsl_struct * info) } } - mgsl_format_bh_queue(info); + info->pending_bh = 0; init_timer(&info->tx_timer); info->tx_timer.data = (unsigned long)info; @@ -1962,6 +1840,8 @@ static void shutdown(struct mgsl_struct * info) wake_up_interruptible(&info->status_event_wait_q); wake_up_interruptible(&info->event_wait_q); + del_timer(&info->tx_timer); + if (info->xmit_buf) { free_page((unsigned long) info->xmit_buf); info->xmit_buf = 0; @@ -2001,17 +1881,43 @@ static void shutdown(struct mgsl_struct * info) } /* end of shutdown() */ -/* mgsl_change_params() - * - * Reconfigure adapter based on new parameters - * - * Arguments: info pointer to device instance data - * Return Value: None +static void mgsl_program_hw(struct mgsl_struct *info) +{ + unsigned long flags; + + spin_lock_irqsave(&info->irq_spinlock,flags); + + usc_stop_receiver(info); + usc_stop_transmitter(info); + info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; + + if (info->params.mode == MGSL_MODE_HDLC || info->netcount) + usc_set_sync_mode(info); + else + usc_set_async_mode(info); + + usc_set_serial_signals(info); + + info->dcd_chkcount = 0; + info->cts_chkcount = 0; + info->ri_chkcount = 0; + info->dsr_chkcount = 0; + + usc_EnableStatusIrqs(info,SICR_CTS+SICR_DSR+SICR_DCD+SICR_RI); + usc_EnableInterrupts(info, IO_PIN); + usc_get_serial_signals(info); + + if (info->netcount || info->tty->termios->c_cflag & CREAD) + usc_start_receiver(info); + + spin_unlock_irqrestore(&info->irq_spinlock,flags); +} + +/* Reconfigure adapter based on new parameters */ static void mgsl_change_params(struct mgsl_struct *info) { unsigned cflag; - unsigned long flags; int bits_per_char; if (!info->tty || !info->tty->termios) @@ -2119,35 +2025,7 @@ static void mgsl_change_params(struct mgsl_struct *info) info->ignore_status_mask |= RXSTATUS_OVERRUN; } - /* reprogram the hardware */ - - spin_lock_irqsave(&info->irq_spinlock,flags); - - usc_stop_receiver(info); - usc_stop_transmitter(info); - info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; - - if ( info->params.mode == MGSL_MODE_HDLC ) - usc_set_sync_mode(info); - else - usc_set_async_mode(info); - - usc_set_serial_signals(info); - - info->dcd_chkcount = 0; - info->cts_chkcount = 0; - info->ri_chkcount = 0; - info->dsr_chkcount = 0; - - /* enable modem signal IRQs and read initial signal states */ - usc_EnableStatusIrqs(info,SICR_CTS+SICR_DSR+SICR_DCD+SICR_RI); - usc_EnableInterrupts(info, IO_PIN); - usc_get_serial_signals(info); - - if ( cflag & CREAD ) - usc_start_receiver(info); - - spin_unlock_irqrestore(&info->irq_spinlock,flags); + mgsl_program_hw(info); } /* end of mgsl_change_params() */ @@ -3115,11 +2993,7 @@ static void mgsl_break(struct tty_struct *tty, int break_state) static int mgsl_ioctl(struct tty_struct *tty, struct file * file, unsigned int cmd, unsigned long arg) { - int error; struct mgsl_struct * info = (struct mgsl_struct *)tty->driver_data; - struct mgsl_icount cprev, cnow; /* kernel counter temps */ - struct serial_icounter_struct *p_cuser; /* user space */ - unsigned long flags; if (debug_level >= DEBUG_LEVEL_INFO) printk("%s(%d):mgsl_ioctl %s cmd=%08X\n", __FILE__,__LINE__, @@ -3133,6 +3007,16 @@ static int mgsl_ioctl(struct tty_struct *tty, struct file * file, if (tty->flags & (1 << TTY_IO_ERROR)) return -EIO; } + + return mgsl_ioctl_common(info, cmd, arg); +} + +int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long arg) +{ + int error; + struct mgsl_icount cprev, cnow; /* kernel counter temps */ + struct serial_icounter_struct *p_cuser; /* user space */ + unsigned long flags; switch (cmd) { case TIOCMGET: @@ -3233,10 +3117,9 @@ static int mgsl_ioctl(struct tty_struct *tty, struct file * file, if (error) return error; #endif return 0; - default: return -ENOIOCTLCMD; - } + } return 0; } @@ -3662,6 +3545,7 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp) struct mgsl_struct *info; int retval, line; unsigned long page; + unsigned long flags; /* verify range of specified line number */ line = MINOR(tty->device) - tty->driver.minor_start; @@ -3717,7 +3601,15 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp) info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; #endif + spin_lock_irqsave(&info->netlock, flags); + if (info->netcount) { + retval = -EBUSY; + spin_unlock_irqrestore(&info->netlock, flags); + goto cleanup; + } info->count++; + spin_unlock_irqrestore(&info->netlock, flags); + if (info->count == 1) { /* 1st open on this device, init hardware */ retval = startup(info); @@ -3833,9 +3725,9 @@ static inline int line_info(char *buf, struct mgsl_struct *info) /* Append serial signal status to end */ ret += sprintf(buf+ret, " %s\n", stat_buf+1); - ret += sprintf(buf+ret, "txactive=%d bh_req=%d bh_run=%d bh_q=%p\n", + ret += sprintf(buf+ret, "txactive=%d bh_req=%d bh_run=%d pending_bh=%x\n", info->tx_active,info->bh_requested,info->bh_running, - info->bh_queue_head); + info->pending_bh); spin_lock_irqsave(&info->irq_spinlock,flags); { @@ -4398,6 +4290,12 @@ void mgsl_add_device( struct mgsl_struct *info ) info->line = mgsl_device_count; sprintf(info->device_name,"ttySL%d",info->line); + if (info->line < MAX_TOTAL_DEVICES) { + if (maxframe[info->line]) + info->max_frame_size = maxframe[info->line]; + info->dosyncppp = dosyncppp[info->line]; + } + mgsl_device_count++; if ( !mgsl_device_list ) @@ -4424,7 +4322,11 @@ void mgsl_add_device( struct mgsl_struct *info ) info->device_name, info->io_base, info->irq_level, info->dma_level, info->max_frame_size ); } - + +#ifdef CONFIG_SYNCLINK_SYNCPPP + if (info->dosyncppp) + mgsl_sppp_init(info); +#endif } /* end of mgsl_add_device() */ /* mgsl_allocate_device() @@ -4457,6 +4359,7 @@ struct mgsl_struct* mgsl_allocate_device() init_waitqueue_head(&info->status_event_wait_q); init_waitqueue_head(&info->event_wait_q); spin_lock_init(&info->irq_spinlock); + spin_lock_init(&info->netlock); memcpy(&info->params,&default_params,sizeof(MGSL_PARAMS)); info->idle_mode = HDLC_TXIDLE_FLAGS; } @@ -4477,7 +4380,6 @@ int mgsl_enumerate_devices() { struct mgsl_struct *info; int i; - int num_devices = 0; /* Check for user specified ISA devices */ @@ -4508,39 +4410,57 @@ int mgsl_enumerate_devices() info->io_addr_size = 16; info->irq_flags = 0; - /* override default max frame size if arg available */ - if ( num_devices < MAX_TOTAL_DEVICES && - maxframe[num_devices] ) - info->max_frame_size = maxframe[num_devices]; - - /* add new device to device list */ mgsl_add_device( info ); - - ++num_devices; } #ifdef CONFIG_PCI /* Auto detect PCI adapters */ - { + if ( pcibios_present() ) { + unsigned char bus; + unsigned char func; unsigned int shared_mem_base; unsigned int lcr_mem_base; unsigned int io_base; unsigned char irq_line; - struct pci_dev *pdev = NULL; - while ((pdev = pci_find_device( - MICROGATE_VENDOR_ID, SYNCLINK_DEVICE_ID, pdev))) { + for(i=0;;i++){ + if ( PCIBIOS_SUCCESSFUL == pcibios_find_device( + MICROGATE_VENDOR_ID, SYNCLINK_DEVICE_ID, i, &bus, &func) ) { +#if LINUX_VERSION_CODE >= VERSION(2,1,0) + struct pci_dev *pdev = pci_find_slot(bus,func); irq_line = pdev->irq; +#else + if (pcibios_read_config_byte(bus,func, + PCI_INTERRUPT_LINE,&irq_line) ) { + printk( "%s(%d):USC I/O addr not set.\n", + __FILE__,__LINE__); + continue; + } +#endif - shared_mem_base = pci_resource_start (pdev, 3); - lcr_mem_base = pci_resource_start (pdev, 0); - io_base = pci_resource_start (pdev, 2); - - if (pci_enable_device (pdev)) + if (pcibios_read_config_dword(bus,func, + PCI_BASE_ADDRESS_3,&shared_mem_base) ) { + printk( "%s(%d):Shared mem addr not set.\n", + __FILE__,__LINE__); + continue; + } + + if (pcibios_read_config_dword(bus,func, + PCI_BASE_ADDRESS_0,&lcr_mem_base) ) { + printk( "%s(%d):LCR mem addr not set.\n", + __FILE__,__LINE__); + continue; + } + + if (pcibios_read_config_dword(bus,func, + PCI_BASE_ADDRESS_2,&io_base) ) { + printk( "%s(%d):USC I/O addr not set.\n", + __FILE__,__LINE__); continue; + } info = mgsl_allocate_device(); if ( !info ) { @@ -4552,29 +4472,30 @@ int mgsl_enumerate_devices() /* Copy user configuration info to device instance data */ - info->io_base = io_base; + info->io_base = io_base & PCI_BASE_ADDRESS_IO_MASK; info->irq_level = (unsigned int)irq_line; +#if LINUX_VERSION_CODE >= VERSION(2,1,0) info->irq_level = irq_cannonicalize(info->irq_level); - info->phys_memory_base = shared_mem_base; +#else + if (info->irq_level == 2) + info->irq_level = 9; +#endif + info->phys_memory_base = shared_mem_base & PCI_BASE_ADDRESS_MEM_MASK; /* Because veremap only works on page boundaries we must map * a larger area than is actually implemented for the LCR * memory range. We map a full page starting at the page boundary. */ - info->phys_lcr_base = lcr_mem_base; + info->phys_lcr_base = lcr_mem_base & PCI_BASE_ADDRESS_MEM_MASK; info->lcr_offset = info->phys_lcr_base & (PAGE_SIZE-1); info->phys_lcr_base &= ~(PAGE_SIZE-1); info->bus_type = MGSL_BUS_TYPE_PCI; info->io_addr_size = 8; info->irq_flags = SA_SHIRQ; - info->pdev = pdev; + info->bus = bus; + info->function = func; - /* override default max frame size if arg available */ - if ( num_devices < MAX_TOTAL_DEVICES && - maxframe[num_devices] ) - info->max_frame_size = maxframe[num_devices]; - /* Store the PCI9050 misc control register value because a flaw * in the PCI9050 prevents LCR registers from being read if * BIOS assigns an LCR base address with bit 7 set. @@ -4588,6 +4509,9 @@ int mgsl_enumerate_devices() /* add new device to device list */ mgsl_add_device( info ); + } else { + break; + } } } #endif @@ -4757,6 +4681,10 @@ void cleanup_module(void) info = mgsl_device_list; while(info) { +#ifdef CONFIG_SYNCLINK_SYNCPPP + if (info->dosyncppp) + mgsl_sppp_delete(info); +#endif mgsl_release_resources(info); info = info->next_device; } @@ -6036,12 +5964,12 @@ void usc_reset( struct mgsl_struct *info ) { if ( info->bus_type == MGSL_BUS_TYPE_PCI ) { int i; - volatile u32 readval; + u32 readval; /* Set BIT30 of Misc Control Register */ /* (Local Control Register 0x50) to force reset of USC. */ - u32 *MiscCtrl = (u32 *)(info->lcr_base + 0x50); + volatile u32 *MiscCtrl = (u32 *)(info->lcr_base + 0x50); u32 *LCR0BRDR = (u32 *)(info->lcr_base + 0x28); info->misc_ctrl_value |= BIT30; @@ -6769,6 +6697,10 @@ int mgsl_get_rx_frame(struct mgsl_struct *info) else info->icount.rxcrc++; framesize = 0; +#ifdef CONFIG_SYNCLINK_SYNCPPP + info->netstats.rx_errors++; + info->netstats.rx_frame_errors++; +#endif } else { /* receive frame has no errors, get frame size. * The frame size is the starting value of the RCC (which was @@ -6797,19 +6729,14 @@ int mgsl_get_rx_frame(struct mgsl_struct *info) if (framesize > info->max_frame_size) info->icount.rxlong++; else { -#if 1 - /* - * copy contents of dma frame buffer(s) to intermediate - * rxbuffer for presentation to line discipline - */ + /* copy dma buffer(s) to contiguous intermediate buffer */ int copy_count = framesize; int index = StartIndex; unsigned char *ptmp = info->intermediate_rxbuffer; info->icount.rxok++; - while( copy_count ) - { + while(copy_count) { int partial_count; if ( copy_count > DMABUFFERSIZE ) partial_count = DMABUFFERSIZE; @@ -6823,17 +6750,19 @@ int mgsl_get_rx_frame(struct mgsl_struct *info) if ( ++index == info->rx_buffer_count ) index = 0; - } - - /* Call the line discipline receive callback directly. */ - tty->ldisc.receive_buf(tty, info->intermediate_rxbuffer, info->flag_buf, framesize); -#else - info->icount.rxok++; - pBufEntry = &(info->rx_buffer_list[StartIndex]); - /* Call the line discipline receive callback directly. */ - tty->ldisc.receive_buf(tty, pBufEntry->virt_addr, info->flag_buf, framesize); + +#ifdef CONFIG_SYNCLINK_SYNCPPP + if (info->netcount) { + /* pass frame to syncppp device */ + mgsl_sppp_rx_done(info,info->intermediate_rxbuffer,framesize); + } + else #endif + { + /* Call the line discipline receive callback directly. */ + tty->ldisc.receive_buf(tty, info->intermediate_rxbuffer, info->flag_buf, framesize); + } } } /* Free the buffers used by this frame. */ @@ -7056,8 +6985,8 @@ BOOLEAN mgsl_dma_test( struct mgsl_struct *info ) unsigned int i; char *TmpPtr; BOOLEAN rc = TRUE; - volatile unsigned short status; - volatile unsigned long EndTime; + unsigned short status; + unsigned long EndTime; unsigned long flags; MGSL_PARAMS tmp_params; @@ -7467,12 +7396,7 @@ BOOLEAN mgsl_memory_test( struct mgsl_struct *info ) void mgsl_load_pci_memory( char* TargetPtr, const char* SourcePtr, unsigned short count ) { - /*******************************************************/ - /* A load interval of 16 allows for 4 32-bit writes at */ - /* 60ns each for a maximum latency of 240ns on the */ - /* local bus. */ - /*******************************************************/ - + /* 16 32-bit writes @ 60ns each = 960ns max latency on local bus */ #define PCI_LOAD_INTERVAL 64 unsigned short Intervalcount = count / PCI_LOAD_INTERVAL; @@ -7551,7 +7475,12 @@ void mgsl_tx_timeout(unsigned long context) spin_unlock_irqrestore(&info->irq_spinlock,flags); - mgsl_bh_transmit_data(info,0); +#ifdef CONFIG_SYNCLINK_SYNCPPP + if (info->netcount) + mgsl_sppp_tx_done(info); + else +#endif + mgsl_bh_transmit(info); } /* end of mgsl_tx_timeout() */ @@ -7629,3 +7558,223 @@ int usc_loopmode_send_active( struct mgsl_struct * info ) return usc_InReg( info, CCSR ) & BIT6 ? 1 : 0 ; } +#ifdef CONFIG_SYNCLINK_SYNCPPP +/* syncppp net device routines + */ + +void mgsl_sppp_init(struct mgsl_struct *info) +{ + struct net_device *d; + + sprintf(info->netname,"mgsl%d",info->line); + +#if LINUX_VERSION_CODE < VERSION(2,2,16) + info->netdev = &info->pppdev.dev; +#else + info->if_ptr = &info->pppdev; + info->netdev = info->pppdev.dev = &info->netdevice; +#endif + sppp_attach(&info->pppdev); + + d = info->netdev; + strcpy(d->name, info->netname); + d->base_addr = info->io_base; + d->irq = info->irq_level; + d->dma = info->dma_level; + d->priv = info; + d->init = NULL; + d->open = mgsl_sppp_open; + d->stop = mgsl_sppp_close; + d->hard_start_xmit = mgsl_sppp_tx; + d->do_ioctl = mgsl_sppp_ioctl; + d->get_stats = mgsl_net_stats; +#if LINUX_VERSION_CODE >= VERSION(2,3,43) + d->tx_timeout = mgsl_sppp_tx_timeout; + d->watchdog_timeo = 10*HZ; +#endif + dev_init_buffers(d); + + if (register_netdev(d) == -1) { + printk(KERN_WARNING "%s: register_netdev failed.\n", d->name); + sppp_detach(info->netdev); + return; + } + + if (debug_level >= DEBUG_LEVEL_INFO) + printk("mgsl_sppp_init()\n"); +} + +void mgsl_sppp_delete(struct mgsl_struct *info) +{ + if (debug_level >= DEBUG_LEVEL_INFO) + printk("mgsl_sppp_delete(%s)\n",info->netname); + sppp_detach(info->netdev); + unregister_netdev(info->netdev); +} + +int mgsl_sppp_open(struct net_device *d) +{ + struct mgsl_struct *info = d->priv; + int err, flags; + + if (debug_level >= DEBUG_LEVEL_INFO) + printk("mgsl_sppp_open(%s)\n",info->netname); + + spin_lock_irqsave(&info->netlock, flags); + if (info->count != 0 || info->netcount != 0) { + printk(KERN_WARNING "%s: sppp_open returning busy\n", info->netname); + spin_unlock_irqrestore(&info->netlock, flags); + return -EBUSY; + } + info->netcount=1; + MOD_INC_USE_COUNT; + spin_unlock_irqrestore(&info->netlock, flags); + + /* claim resources and init adapter */ + if ((err = startup(info)) != 0) + goto open_fail; + + /* allow syncppp module to do open processing */ + if ((err = sppp_open(d)) != 0) { + shutdown(info); + goto open_fail; + } + + info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR; + mgsl_program_hw(info); + + d->trans_start = jiffies; + netif_start_queue(d); + return 0; + +open_fail: + spin_lock_irqsave(&info->netlock, flags); + info->netcount=0; + MOD_DEC_USE_COUNT; + spin_unlock_irqrestore(&info->netlock, flags); + return err; +} + +void mgsl_sppp_tx_timeout(struct net_device *dev) +{ + struct mgsl_struct *info = dev->priv; + int flags; + + if (debug_level >= DEBUG_LEVEL_INFO) + printk("mgsl_sppp_tx_timeout(%s)\n",info->netname); + + info->netstats.tx_errors++; + info->netstats.tx_aborted_errors++; + + spin_lock_irqsave(&info->irq_spinlock,flags); + usc_stop_transmitter(info); + spin_unlock_irqrestore(&info->irq_spinlock,flags); + + netif_wake_queue(dev); +} + +int mgsl_sppp_tx(struct sk_buff *skb, struct net_device *dev) +{ + struct mgsl_struct *info = dev->priv; + unsigned long flags; + + if (debug_level >= DEBUG_LEVEL_INFO) + printk("mgsl_sppp_tx(%s)\n",info->netname); + +#if LINUX_VERSION_CODE < VERSION(2,3,43) + if (dev->tbusy) { + if (time_before(jiffies, dev->trans_start+10*HZ)) + return -EBUSY; /* 10 seconds timeout */ + mgsl_sppp_tx_timeout(dev); + } + if (test_and_set_bit(0, (void*)&dev->tbusy) != 0) + return -EBUSY; +#else + netif_stop_queue(dev); +#endif + + info->xmit_cnt = skb->len; + mgsl_load_tx_dma_buffer(info, skb->data, skb->len); + info->netstats.tx_packets++; + info->netstats.tx_bytes += skb->len; + dev_kfree_skb(skb); + + dev->trans_start = jiffies; + + spin_lock_irqsave(&info->irq_spinlock,flags); + if (!info->tx_active) + usc_start_transmitter(info); + spin_unlock_irqrestore(&info->irq_spinlock,flags); + + return 0; +} + +int mgsl_sppp_close(struct net_device *d) +{ + struct mgsl_struct *info = d->priv; + unsigned long flags; + + if (debug_level >= DEBUG_LEVEL_INFO) + printk("mgsl_sppp_close(%s)\n",info->netname); + + /* shutdown adapter and release resources */ + shutdown(info); + + /* allow syncppp to do close processing */ + sppp_close(d); + netif_stop_queue(d); + + spin_lock_irqsave(&info->netlock, flags); + info->netcount=0; + MOD_DEC_USE_COUNT; + spin_unlock_irqrestore(&info->netlock, flags); + return 0; +} + +void mgsl_sppp_rx_done(struct mgsl_struct *info, char *buf, int size) +{ + struct sk_buff *skb = dev_alloc_skb(size); + if (debug_level >= DEBUG_LEVEL_INFO) + printk("mgsl_sppp_rx_done(%s)\n",info->netname); + if (skb == NULL) { + printk(KERN_NOTICE "%s: cant alloc skb, dropping packet\n", + info->netname); + info->netstats.rx_dropped++; + return; + } + + memcpy(skb_put(skb, size),buf,size); + + skb->protocol = htons(ETH_P_WAN_PPP); + skb->dev = info->netdev; + skb->mac.raw = skb->data; + info->netstats.rx_packets++; + info->netstats.rx_bytes += size; + netif_rx(skb); + info->netdev->trans_start = jiffies; +} + +void mgsl_sppp_tx_done(struct mgsl_struct *info) +{ + if (netif_queue_stopped(info->netdev)) + netif_wake_queue(info->netdev); +} + +struct net_device_stats *mgsl_net_stats(struct net_device *dev) +{ + struct mgsl_struct *info = dev->priv; + if (debug_level >= DEBUG_LEVEL_INFO) + printk("mgsl_net_stats(%s)\n",info->netname); + return &info->netstats; +} + +int mgsl_sppp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) +{ + struct mgsl_struct *info = (struct mgsl_struct *)dev->priv; + if (debug_level >= DEBUG_LEVEL_INFO) + printk("%s(%d):mgsl_ioctl %s cmd=%08X\n", __FILE__,__LINE__, + info->netname, cmd ); + return sppp_do_ioctl(dev, ifr, cmd); +} + +#endif /* ifdef CONFIG_SYNCLINK_SYNCPPP */ diff --git a/drivers/isdn/isdn_net.c b/drivers/isdn/isdn_net.c index 016302ab2..07279cd7b 100644 --- a/drivers/isdn/isdn_net.c +++ b/drivers/isdn/isdn_net.c @@ -1820,7 +1820,7 @@ isdn_net_close(struct net_device *dev) /* * Get statistics */ -static struct enet_statistics * +static struct net_device_stats * isdn_net_get_stats(struct net_device *dev) { isdn_net_local *lp = (isdn_net_local *) dev->priv; diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index a3d6dfe6a..9ca4a9ae8 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c @@ -1031,12 +1031,12 @@ int pmu_register_sleep_notifier(struct pmu_sleep_notifier *n) { struct list_head *list; - struct pmu_sleep_notifier *current; + struct pmu_sleep_notifier *notifier; for (list = sleep_notifiers.next; list != &sleep_notifiers; list = list->next) { - current = list_entry(list, struct pmu_sleep_notifier, list); - if (n->priority > current->priority) + notifier = list_entry(list, struct pmu_sleep_notifier, list); + if (n->priority > notifier->priority) break; } __list_add(&n->list, list->prev, list); @@ -1059,18 +1059,18 @@ broadcast_sleep(int when, int fallback) { int ret = PBOOK_SLEEP_OK; struct list_head *list; - struct pmu_sleep_notifier *current; + struct pmu_sleep_notifier *notifier; for (list = sleep_notifiers.prev; list != &sleep_notifiers; list = list->prev) { - current = list_entry(list, struct pmu_sleep_notifier, list); - ret = current->notifier_call(current, when); + notifier = list_entry(list, struct pmu_sleep_notifier, list); + ret = notifier->notifier_call(notifier, when); if (ret != PBOOK_SLEEP_OK) { printk(KERN_DEBUG "sleep %d rejected by %p (%p)\n", - when, current, current->notifier_call); + when, notifier, notifier->notifier_call); for (; list != &sleep_notifiers; list = list->next) { - current = list_entry(list, struct pmu_sleep_notifier, list); - current->notifier_call(current, fallback); + notifier = list_entry(list, struct pmu_sleep_notifier, list); + notifier->notifier_call(notifier, fallback); } return ret; } @@ -1084,12 +1084,12 @@ broadcast_wake(void) { int ret = PBOOK_SLEEP_OK; struct list_head *list; - struct pmu_sleep_notifier *current; + struct pmu_sleep_notifier *notifier; for (list = sleep_notifiers.next; list != &sleep_notifiers; list = list->next) { - current = list_entry(list, struct pmu_sleep_notifier, list); - current->notifier_call(current, PBOOK_WAKE); + notifier = list_entry(list, struct pmu_sleep_notifier, list); + notifier->notifier_call(notifier, PBOOK_WAKE); } return ret; } diff --git a/drivers/mtd/Config.in b/drivers/mtd/Config.in index 26fcfe517..e2af3489a 100644 --- a/drivers/mtd/Config.in +++ b/drivers/mtd/Config.in @@ -4,11 +4,6 @@ comment 'Memory Technology Devices (MTD)' tristate 'Memory Technology Device (MTD) support' CONFIG_MTD if [ "$CONFIG_MTD" != "n" ]; then - dep_tristate 'Common Flash Interface (CFI) support' CONFIG_MTD_CFI $CONFIG_MTD - dep_tristate 'CFI support for Intel/Sharp Extended Command Set chips' CONFIG_MTD_CFI_INTELEXT $CONFIG_CFI - dep_tristate 'CFI chips in virtual memory map' CONFIG_MTD_NORA $CONFIG_MTD_CFI - dep_tristate 'CFI chips in physical memory map' CONFIG_MTD_PHYSMAP $CONFIG_MTD_CFI - dep_tristate 'CFI chips on RPXLite PPC board' CONFIG_MTD_RPXLITE $CONFIG_MTD_CFI dep_tristate 'M-Systems Disk-On-Chip 1000 support' CONFIG_MTD_DOC1000 $CONFIG_MTD dep_tristate 'M-Systems Disk-On-Chip 2000' CONFIG_MTD_DOC2000 $CONFIG_MTD dep_tristate 'M-Systems Disk-On-Chip Millennium' CONFIG_MTD_DOC2001 $CONFIG_MTD @@ -22,22 +17,43 @@ if [ "$CONFIG_MTD" != "n" ]; then fi fi dep_tristate 'Use extra onboard system memory as MTD device' CONFIG_MTD_SLRAM $CONFIG_MTD - dep_tristate 'Octagon 5066 SBC onboard flash support' CONFIG_MTD_OCTAGON $CONFIG_MTD - dep_tristate 'Tempustech VMAX SBC301 onboard flash support' CONFIG_MTD_VMAX $CONFIG_MTD - dep_tristate 'Mixcom piggyback flash card support' CONFIG_MTD_MIXMEM $CONFIG_MTD dep_tristate 'Ramix PMC551 PCI Mezzanine ram card support' CONFIG_MTD_PMC551 $CONFIG_MTD if [ "$CONFIG_MTD_PMC551" != "n" ]; then bool 'PMC551 256M DRAM Bugfix' CONFIG_MTD_PMC551_BUGFIX fi dep_tristate 'Debugging RAM test driver' CONFIG_MTD_MTDRAM $CONFIG_MTD +mainmenu_option next_comment +comment 'MTD drivers for mapped chips' + + dep_tristate 'Common Flash Interface (CFI) support' CONFIG_MTD_CFI $CONFIG_MTD + dep_tristate 'CFI support for Intel/Sharp Extended Command Set chips' CONFIG_MTD_CFI_INTELEXT $CONFIG_CFI + define_bool CONFIG_MTD_JEDEC n + define_bool CONFIG_MTD_RAM n + define_bool CONFIG_MTD_ROM n +mainmenu_option next_comment +comment 'Drivers for chip mappings' + + dep_tristate 'Flash chip mapping in physical memory' CONFIG_MTD_PHYSMAP $CONFIG_MTD_CFI + if [ "$CONFIG_MTD_PHYSMAP" != "n" ]; then + hex ' Physical start location of flash chip mapping (0x8000000)' CONFIG_MTD_PHYSMAP_START 0x8000000 + hex ' Physical length of flash chip mapping (0x4000000)' CONFIG_MTD_PHYSMAP_LEN 0x4000000 + fi + dep_tristate 'Flash chip mapping on Mixcom piggyback card' CONFIG_MTD_MIXMEM $CONFIG_MTD_JEDEC + dep_tristate 'Flash chip mapping on Nora' CONFIG_MTD_NORA $CONFIG_MTD_CFI + dep_tristate 'Flash chip mapping on Octagon 5066 SBC' CONFIG_MTD_OCTAGON $CONFIG_MTD_JEDEC + dep_tristate 'Flash chip mapping on RPXLite PPC board' CONFIG_MTD_RPXLITE $CONFIG_MTD_CFI + dep_tristate 'Flash chip mapping on Tempustech VMAX SBC301' CONFIG_MTD_VMAX $CONFIG_MTD_JEDEC + +mainmenu_option next_comment +comment 'User modules and translation layers for MTD devices' + dep_tristate 'Direct chardevice access to MTD devices' CONFIG_MTD_CHAR $CONFIG_MTD + dep_tristate 'Pseudo-blockdevice access to MTD devices' CONFIG_MTD_BLOCK $CONFIG_MTD dep_tristate 'FTL (Flash Translation Layer) support' CONFIG_FTL $CONFIG_MTD dep_tristate 'NFTL (NAND Flash Translation Layer) support' CONFIG_NFTL $CONFIG_MTD if [ "$CONFIG_EXPERIMENTAL" = "y" -a "$CONFIG_NFTL" != "n" ]; then bool 'Write support for NFTL (EXPERIMENTAL)' CONFIG_NFTL_RW fi - dep_tristate 'Direct blockdevice access to MTD devices' CONFIG_MTD_BLOCK $CONFIG_MTD - dep_tristate 'Direct chardevice access to MTD devices' CONFIG_MTD_CHAR $CONFIG_MTD fi endmenu diff --git a/drivers/mtd/physmap.c b/drivers/mtd/physmap.c index e470a6c97..658b8bf47 100644 --- a/drivers/mtd/physmap.c +++ b/drivers/mtd/physmap.c @@ -1,5 +1,5 @@ /* - * $Id: physmap.c,v 1.1 2000/07/04 08:58:10 dwmw2 Exp $ + * $Id: physmap.c,v 1.2 2000/07/11 09:42:32 dwmw2 Exp $ * * Normal mappings of chips in physical memory */ @@ -10,10 +10,11 @@ #include <asm/io.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> +#include <linux/config.h> -#define WINDOW_ADDR 0x8000000 -#define WINDOW_SIZE 0x4000000 +#define WINDOW_ADDR CONFIG_MTD_PHYSMAP_START +#define WINDOW_SIZE CONFIG_MTD_PHYSMAP_LEN static struct mtd_info *mymtd; diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c index cea0739b0..819c49050 100644 --- a/drivers/net/3c509.c +++ b/drivers/net/3c509.c @@ -129,7 +129,7 @@ enum RxFilter { #define SKB_QUEUE_SIZE 64 struct el3_private { - struct enet_statistics stats; + struct net_device_stats stats; struct net_device *next_dev; spinlock_t lock; /* skb send-queue */ @@ -146,7 +146,7 @@ static int el3_open(struct net_device *dev); static int el3_start_xmit(struct sk_buff *skb, struct net_device *dev); static void el3_interrupt(int irq, void *dev_id, struct pt_regs *regs); static void update_stats(struct net_device *dev); -static struct enet_statistics *el3_get_stats(struct net_device *dev); +static struct net_device_stats *el3_get_stats(struct net_device *dev); static int el3_rx(struct net_device *dev); static int el3_close(struct net_device *dev); static void set_multicast_list(struct net_device *dev); @@ -789,7 +789,7 @@ el3_interrupt(int irq, void *dev_id, struct pt_regs *regs) } -static struct enet_statistics * +static struct net_device_stats * el3_get_stats(struct net_device *dev) { struct el3_private *lp = (struct el3_private *)dev->priv; diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c index 80021d00a..32e15dd44 100644 --- a/drivers/net/3c515.c +++ b/drivers/net/3c515.c @@ -310,7 +310,7 @@ struct corkscrew_private { struct sk_buff *tx_skbuff[TX_RING_SIZE]; unsigned int cur_rx, cur_tx; /* The next free ring entry */ unsigned int dirty_rx, dirty_tx;/* The ring entries to be free()ed. */ - struct enet_statistics stats; + struct net_device_stats stats; struct sk_buff *tx_skb; /* Packet being eaten by bus master ctrl. */ struct timer_list timer; /* Media selection timer. */ int capabilities ; /* Adapter capabilities word. */ @@ -384,7 +384,7 @@ static void corkscrew_interrupt(int irq, void *dev_id, struct pt_regs *regs); static int corkscrew_close(struct net_device *dev); static void update_stats(int addr, struct net_device *dev); -static struct enet_statistics *corkscrew_get_stats(struct net_device *dev); +static struct net_device_stats *corkscrew_get_stats(struct net_device *dev); static void set_rx_mode(struct net_device *dev); @@ -1505,7 +1505,7 @@ static int corkscrew_close(struct net_device *dev) return 0; } -static struct enet_statistics *corkscrew_get_stats(struct net_device *dev) +static struct net_device_stats *corkscrew_get_stats(struct net_device *dev) { struct corkscrew_private *vp = (struct corkscrew_private *) dev->priv; diff --git a/drivers/net/aironet4500.h b/drivers/net/aironet4500.h index 844f0ba03..92f2dd4c1 100644 --- a/drivers/net/aironet4500.h +++ b/drivers/net/aironet4500.h @@ -1522,7 +1522,7 @@ struct awc_private { int full_stats; int debug; - struct enet_statistics stats; + struct net_device_stats stats; struct ctl_table * proc_table; @@ -1537,7 +1537,7 @@ extern int awc_open(struct net_device *dev); extern void awc_tx_timeout(struct net_device *dev); extern int awc_start_xmit(struct sk_buff *, struct net_device *); extern void awc_interrupt(int irq, void *dev_id, struct pt_regs *regs); -extern struct enet_statistics * awc_get_stats(struct net_device *dev); +extern struct net_device_stats * awc_get_stats(struct net_device *dev); extern int awc_rx(struct net_device *dev, struct awc_fid * rx_fid); extern void awc_set_multicast_list(struct net_device *dev); extern int awc_change_mtu(struct net_device *dev, int new_mtu); diff --git a/drivers/net/aironet4500_core.c b/drivers/net/aironet4500_core.c index 8c818d46a..321893b4b 100644 --- a/drivers/net/aironet4500_core.c +++ b/drivers/net/aironet4500_core.c @@ -3118,7 +3118,7 @@ inline int awc_rx(struct net_device *dev, struct awc_fid * rx_fid) { - struct enet_statistics *awc_get_stats(struct net_device *dev) + struct net_device_stats *awc_get_stats(struct net_device *dev) { struct awc_private *priv = (struct awc_private *)dev->priv; // unsigned long flags; diff --git a/drivers/net/am79c961a.c b/drivers/net/am79c961a.c index 91f6313d1..5a5016f8e 100644 --- a/drivers/net/am79c961a.c +++ b/drivers/net/am79c961a.c @@ -322,7 +322,7 @@ am79c961_close(struct net_device *dev) * Get the current statistics. This may be called with the card open or * closed. */ -static struct enet_statistics *am79c961_getstats (struct net_device *dev) +static struct net_device_stats *am79c961_getstats (struct net_device *dev) { struct dev_priv *priv = (struct dev_priv *)dev->priv; return &priv->stats; diff --git a/drivers/net/am79c961a.h b/drivers/net/am79c961a.h index b2c549334..76c812dab 100644 --- a/drivers/net/am79c961a.h +++ b/drivers/net/am79c961a.h @@ -109,7 +109,7 @@ #define TST_BUFF 0x8000 struct dev_priv { - struct enet_statistics stats; + struct net_device_stats stats; unsigned long rxbuffer[RX_BUFFERS]; unsigned long txbuffer[TX_BUFFERS]; unsigned char txhead; diff --git a/drivers/net/appletalk/ipddp.c b/drivers/net/appletalk/ipddp.c index a089ed9e2..d334df665 100644 --- a/drivers/net/appletalk/ipddp.c +++ b/drivers/net/appletalk/ipddp.c @@ -122,10 +122,10 @@ int ipddp_init(struct net_device *dev) /* Initalize the device structure. */ dev->hard_start_xmit = ipddp_xmit; - dev->priv = kmalloc(sizeof(struct enet_statistics), GFP_KERNEL); + dev->priv = kmalloc(sizeof(struct net_device_stats), GFP_KERNEL); if(!dev->priv) return -ENOMEM; - memset(dev->priv,0,sizeof(struct enet_statistics)); + memset(dev->priv,0,sizeof(struct net_device_stats)); dev->open = ipddp_open; dev->stop = ipddp_close; diff --git a/drivers/net/arlan.c b/drivers/net/arlan.c index 8636bfa11..b1a4549de 100644 --- a/drivers/net/arlan.c +++ b/drivers/net/arlan.c @@ -94,7 +94,7 @@ static int arlan_open(struct net_device *dev); static int arlan_tx(struct sk_buff *skb, struct net_device *dev); static void arlan_interrupt(int irq, void *dev_id, struct pt_regs *regs); static int arlan_close(struct net_device *dev); -static struct enet_statistics * +static struct net_device_stats * arlan_statistics (struct net_device *dev); static void arlan_set_multicast (struct net_device *dev); static int arlan_hw_tx (struct net_device* dev, char *buf, int length ); @@ -1907,7 +1907,7 @@ static long alignLong(volatile u_char * ptr) * This may be called with the card open or closed. */ -static struct enet_statistics *arlan_statistics(struct net_device *dev) +static struct net_device_stats *arlan_statistics(struct net_device *dev) { struct arlan_private *priv = (struct arlan_private *) dev->priv; volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card; diff --git a/drivers/net/arlan.h b/drivers/net/arlan.h index 83208e4e3..e28982bdb 100644 --- a/drivers/net/arlan.h +++ b/drivers/net/arlan.h @@ -343,7 +343,7 @@ struct TxRingPoint { #define TX_RING_SIZE 2 /* Information that need to be kept for each board. */ struct arlan_private { - struct enet_statistics stats; + struct net_device_stats stats; long open_time; /* Useless example local info. */ struct arlan_shmem * card; struct arlan_shmem * conf; @@ -574,4 +574,4 @@ struct arlan_private { #define ARLAN_DEBUG_INTERRUPT 0x00080 #define ARLAN_DEBUG_STARTUP 0x00100 #define ARLAN_DEBUG_SHUTDOWN 0x00200 -
\ No newline at end of file + diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c index 67f8dbd3f..d1a6be95c 100644 --- a/drivers/net/at1700.c +++ b/drivers/net/at1700.c @@ -110,7 +110,7 @@ typedef unsigned char uchar; /* Information that need to be kept for each board. */ struct net_local { - struct enet_statistics stats; + struct net_device_stats stats; spinlock_t lock; unsigned char mc_filter[8]; uint jumpered:1; /* Set iff the board has jumper config. */ @@ -164,7 +164,7 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev); static void net_interrupt(int irq, void *dev_id, struct pt_regs *regs); static void net_rx(struct net_device *dev); static int net_close(struct net_device *dev); -static struct enet_statistics *net_get_stats(struct net_device *dev); +static struct net_device_stats *net_get_stats(struct net_device *dev); static void set_rx_mode(struct net_device *dev); static void net_tx_timeout (struct net_device *dev); @@ -796,7 +796,7 @@ static int net_close(struct net_device *dev) This may be called with the card open or closed. There are no on-chip counters, so this function is trivial. */ -static struct enet_statistics * +static struct net_device_stats * net_get_stats(struct net_device *dev) { struct net_local *lp = (struct net_local *)dev->priv; diff --git a/drivers/net/dmfe.c b/drivers/net/dmfe.c index b425513b0..c34472200 100644 --- a/drivers/net/dmfe.c +++ b/drivers/net/dmfe.c @@ -214,7 +214,7 @@ struct dmfe_board_info { u8 rx_error_cnt; /* recievd abnormal case count */ u8 dm910x_chk_mode; /* Operating mode check */ struct timer_list timer; - struct enet_statistics stats; /* statistic counter */ + struct net_device_stats stats; /* statistic counter */ unsigned char srom[128]; }; @@ -313,7 +313,7 @@ static unsigned long CrcTable[256] = static int dmfe_open(struct net_device *); static int dmfe_start_xmit(struct sk_buff *, struct net_device *); static int dmfe_stop(struct net_device *); -static struct enet_statistics *dmfe_get_stats(struct net_device *); +static struct net_device_stats *dmfe_get_stats(struct net_device *); static void dmfe_set_filter_mode(struct net_device *); static int dmfe_do_ioctl(struct net_device *, struct ifreq *, int); static u16 read_srom_word(long, int); @@ -849,7 +849,7 @@ static void dmfe_rx_packet(struct net_device *dev, struct dmfe_board_info *db) /* Get statistics from driver. */ -static struct enet_statistics *dmfe_get_stats(struct net_device *dev) +static struct net_device_stats *dmfe_get_stats(struct net_device *dev) { struct dmfe_board_info *db = (struct dmfe_board_info *) dev->priv; diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c index 324cf3934..2a5488a81 100644 --- a/drivers/net/eepro.c +++ b/drivers/net/eepro.c @@ -181,7 +181,7 @@ static unsigned int net_debug = NET_DEBUG; /* Information that need to be kept for each board. */ struct eepro_local { - struct enet_statistics stats; + struct net_device_stats stats; unsigned rx_start; unsigned tx_start; /* start of the transmit chain */ int tx_last; /* pointer to last packet in the transmit chain */ @@ -293,7 +293,7 @@ static void eepro_interrupt(int irq, void *dev_id, struct pt_regs *regs); static void eepro_rx(struct net_device *dev); static void eepro_transmit_interrupt(struct net_device *dev); static int eepro_close(struct net_device *dev); -static struct enet_statistics *eepro_get_stats(struct net_device *dev); +static struct net_device_stats *eepro_get_stats(struct net_device *dev); static void set_multicast_list(struct net_device *dev); static void eepro_tx_timeout (struct net_device *dev); @@ -1247,7 +1247,7 @@ static int eepro_close(struct net_device *dev) /* Get the current statistics. This may be called with the card open or closed. */ -static struct enet_statistics * +static struct net_device_stats * eepro_get_stats(struct net_device *dev) { struct eepro_local *lp = (struct eepro_local *)dev->priv; diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 27a6b188c..db89a18f6 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -518,7 +518,7 @@ struct speedo_private { unsigned int cur_rx, dirty_rx; /* The next free ring entry */ long last_rx_time; /* Last Rx, in jiffies, to handle Rx hang. */ const char *product_name; - struct enet_statistics stats; + struct net_device_stats stats; struct speedo_stats *lstats; dma_addr_t lstats_dma; int chip_id; @@ -585,7 +585,7 @@ static int speedo_rx(struct net_device *dev); static void speedo_tx_buffer_gc(struct net_device *dev); static void speedo_interrupt(int irq, void *dev_instance, struct pt_regs *regs); static int speedo_close(struct net_device *dev); -static struct enet_statistics *speedo_get_stats(struct net_device *dev); +static struct net_device_stats *speedo_get_stats(struct net_device *dev); static int speedo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); static void set_rx_mode(struct net_device *dev); static void speedo_show_state(struct net_device *dev); @@ -1905,7 +1905,7 @@ speedo_close(struct net_device *dev) Oh, and incoming frames are dropped while executing dump-stats! */ -static struct enet_statistics * +static struct net_device_stats * speedo_get_stats(struct net_device *dev) { struct speedo_private *sp = (struct speedo_private *)dev->priv; diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c index 9db2fca69..7be66ce89 100644 --- a/drivers/net/ibmlana.c +++ b/drivers/net/ibmlana.c @@ -1001,7 +1001,7 @@ static int ibmlana_tx(struct sk_buff *skb, struct IBMLANA_NETDEV *dev) /* return pointer to Ethernet statistics */ -static struct enet_statistics *ibmlana_stats(struct IBMLANA_NETDEV *dev) +static struct net_device_stats *ibmlana_stats(struct IBMLANA_NETDEV *dev) { ibmlana_priv *priv = (ibmlana_priv *) dev->priv; @@ -1131,7 +1131,7 @@ int ibmlana_probe(struct IBMLANA_NETDEV *dev) priv->slot = slot; priv->realirq = irq; priv->medium = medium; - memset(&(priv->stat), 0, sizeof(struct enet_statistics)); + memset(&(priv->stat), 0, sizeof(struct net_device_stats)); /* set base + irq for this device (irq not allocated so far) */ diff --git a/drivers/net/ibmlana.h b/drivers/net/ibmlana.h index e8e477d2a..58429842a 100644 --- a/drivers/net/ibmlana.h +++ b/drivers/net/ibmlana.h @@ -41,7 +41,7 @@ typedef enum { Media_10BaseT, Media_10Base5, typedef struct { unsigned int slot; /* MCA-Slot-# */ - struct enet_statistics stat; /* packet statistics */ + struct net_device_stats stat; /* packet statistics */ int realirq; /* memorizes actual IRQ, even when currently not allocated */ ibmlana_medium medium; /* physical cannector */ diff --git a/drivers/net/pcmcia/netwave_cs.c b/drivers/net/pcmcia/netwave_cs.c index 8cfbb96b5..a17ac13ae 100644 --- a/drivers/net/pcmcia/netwave_cs.c +++ b/drivers/net/pcmcia/netwave_cs.c @@ -235,7 +235,7 @@ static void netwave_watchdog(u_long); /* Transmission watchdog */ /* Statistics */ static void update_stats(struct net_device *dev); -static struct enet_statistics *netwave_get_stats(struct net_device *dev); +static struct net_device_stats *netwave_get_stats(struct net_device *dev); /* Wireless extensions */ #ifdef WIRELESS_EXT @@ -312,14 +312,14 @@ typedef struct netwave_private { spinlock_t lock; struct timer_list watchdog; /* To avoid blocking state */ struct site_survey nss; - struct enet_statistics stats; + struct net_device_stats stats; #ifdef WIRELESS_EXT struct iw_statistics iw_stats; /* Wireless stats */ #endif } netwave_private; #ifdef NETWAVE_STATS -static struct enet_statistics *netwave_get_stats(struct net_device *dev); +static struct net_device_stats *netwave_get_stats(struct net_device *dev); #endif /* @@ -1434,7 +1434,7 @@ static void netwave_watchdog(u_long a) { } /* netwave_watchdog */ -static struct enet_statistics *netwave_get_stats(struct net_device *dev) { +static struct net_device_stats *netwave_get_stats(struct net_device *dev) { netwave_private *priv = (netwave_private*)dev->priv; update_stats(dev); diff --git a/drivers/net/pcmcia/ray_cs.c b/drivers/net/pcmcia/ray_cs.c index 452b9e7ed..0408612e6 100644 --- a/drivers/net/pcmcia/ray_cs.c +++ b/drivers/net/pcmcia/ray_cs.c @@ -94,7 +94,7 @@ static void ray_detach(dev_link_t *); /***** Prototypes indicated by device structure ******************************/ static int ray_dev_close(struct net_device *dev); static int ray_dev_config(struct net_device *dev, struct ifmap *map); -static struct enet_statistics *ray_get_stats(struct net_device *dev); +static struct net_device_stats *ray_get_stats(struct net_device *dev); static int ray_dev_init(struct net_device *dev); static int ray_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); static int ray_open(struct net_device *dev); @@ -1679,13 +1679,13 @@ static int parse_addr(char *in_str, UCHAR *out) return status; } /*===========================================================================*/ -static struct enet_statistics *ray_get_stats(struct net_device *dev) +static struct net_device_stats *ray_get_stats(struct net_device *dev) { ray_dev_t *local = (ray_dev_t *)dev->priv; dev_link_t *link = local->finder; struct status *p = (struct status *)(local->sram + STATUS_BASE); if (!(link->state & DEV_PRESENT)) { - DEBUG(2,"ray_cs enet_statistics - device not present\n"); + DEBUG(2,"ray_cs net_device_stats - device not present\n"); return &local->stats; } if (readb(&p->mrx_overflow_for_host)) diff --git a/drivers/net/pcmcia/ray_cs.h b/drivers/net/pcmcia/ray_cs.h index 6f6f8e6ca..830dd2268 100644 --- a/drivers/net/pcmcia/ray_cs.h +++ b/drivers/net/pcmcia/ray_cs.h @@ -50,7 +50,7 @@ typedef struct ray_dev_t { UCHAR auth_id[6]; UCHAR net_default_tx_rate; UCHAR encryption; - struct enet_statistics stats; + struct net_device_stats stats; UCHAR net_type; UCHAR sta_type; diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index 0ed5b4317..289d1bccc 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c @@ -398,7 +398,7 @@ typedef struct local_info_t { dev_link_t link; struct net_device dev; dev_node_t node; - struct enet_statistics stats; + struct net_device_stats stats; int card_type; int probe_port; int silicon; /* silicon revision. 0=old CE2, 1=Scipper, 4=Mohawk */ @@ -416,7 +416,7 @@ typedef struct local_info_t { */ static int do_start_xmit(struct sk_buff *skb, struct net_device *dev); static void do_tx_timeout(struct net_device *dev); -static struct enet_statistics *do_get_stats(struct net_device *dev); +static struct net_device_stats *do_get_stats(struct net_device *dev); static void set_addresses(struct net_device *dev); static void set_multicast_list(struct net_device *dev); static int set_card_type(dev_link_t *link, const void *s); @@ -1648,7 +1648,7 @@ do_start_xmit(struct sk_buff *skb, struct net_device *dev) return 0; } -static struct enet_statistics * +static struct net_device_stats * do_get_stats(struct net_device *dev) { local_info_t *lp = dev->priv; diff --git a/drivers/net/ptifddi.c b/drivers/net/ptifddi.c index ec0dcd23b..e559928f5 100644 --- a/drivers/net/ptifddi.c +++ b/drivers/net/ptifddi.c @@ -142,7 +142,7 @@ static int pti_start_xmit(struct sk_buff *skb, struct net_device *dev) struct ptifddi *pp = (struct ptifddi *) dev->priv; } -static struct enet_statistics *pti_get_stats(struct net_device *dev) +static struct net_device_stats *pti_get_stats(struct net_device *dev) { return &(((struct ptifddi *)dev->priv)->enet_stats); } static void pti_set_multicast(struct net_device *dev) diff --git a/drivers/net/rcpci45.c b/drivers/net/rcpci45.c index 767d0a434..7a020278f 100644 --- a/drivers/net/rcpci45.c +++ b/drivers/net/rcpci45.c @@ -122,7 +122,7 @@ typedef struct U32 bus; U32 function; struct timer_list timer; /* timer */ - struct enet_statistics stats; /* the statistics structure */ + struct net_device_stats stats; /* the statistics structure */ struct net_device *next; /* points to the next RC adapter */ unsigned long numOutRcvBuffers;/* number of outstanding receive buffers*/ unsigned char shutdown; @@ -152,7 +152,7 @@ static int RCopen(struct net_device *); static int RC_xmit_packet(struct sk_buff *, struct net_device *); static void RCinterrupt(int, void *, struct pt_regs *); static int RCclose(struct net_device *dev); -static struct enet_statistics *RCget_stats(struct net_device *); +static struct net_device_stats *RCget_stats(struct net_device *); static int RCioctl(struct net_device *, struct ifreq *, int); static int RCconfig(struct net_device *, struct ifmap *); static void RCxmit_callback(U32, U16, PU32, U16); @@ -936,7 +936,7 @@ RCclose(struct net_device *dev) return 0; } -static struct enet_statistics * +static struct net_device_stats * RCget_stats(struct net_device *dev) { RCLINKSTATS RCstats; @@ -1019,7 +1019,7 @@ RCget_stats(struct net_device *dev) pDpa->stats.tx_heartbeat_errors = 0; pDpa->stats.tx_window_errors = 0; - return ((struct enet_statistics *)&(pDpa->stats)); + return ((struct net_device_stats *)&(pDpa->stats)); } return 0; } diff --git a/drivers/net/rtl8129.c b/drivers/net/rtl8129.c index d72b811b0..e3fedb0c9 100644 --- a/drivers/net/rtl8129.c +++ b/drivers/net/rtl8129.c @@ -260,11 +260,7 @@ struct rtl8129_private { int chip_id; int chip_revision; unsigned char pci_bus, pci_devfn; -#if LINUX_VERSION_CODE > 0x20139 struct net_device_stats stats; -#else - struct enet_statistics stats; -#endif struct timer_list timer; /* Media selection timer. */ unsigned int cur_rx; /* Index into the Rx buffer of next Rx pkt. */ unsigned int cur_tx, dirty_tx, tx_flag; @@ -306,7 +302,7 @@ static int rtl8129_rx(struct net_device *dev); static void rtl8129_interrupt(int irq, void *dev_instance, struct pt_regs *regs); static int rtl8129_close(struct net_device *dev); static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); -static struct enet_statistics *rtl8129_get_stats(struct net_device *dev); +static struct net_device_stats *rtl8129_get_stats(struct net_device *dev); static inline u32 ether_crc(int length, unsigned char *data); static void set_rx_mode(struct net_device *dev); @@ -1365,7 +1361,7 @@ static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) } } -static struct enet_statistics * +static struct net_device_stats * rtl8129_get_stats(struct net_device *dev) { struct rtl8129_private *tp = (struct rtl8129_private *)dev->priv; diff --git a/drivers/net/sb1000.c b/drivers/net/sb1000.c index a34deb630..97dfb6bd4 100644 --- a/drivers/net/sb1000.c +++ b/drivers/net/sb1000.c @@ -92,7 +92,7 @@ static int sb1000_open(struct net_device *dev); static int sb1000_dev_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd); static int sb1000_start_xmit(struct sk_buff *skb, struct net_device *dev); static void sb1000_interrupt(int irq, void *dev_id, struct pt_regs *regs); -static struct enet_statistics *sb1000_stats(struct net_device *dev); +static struct net_device_stats *sb1000_stats(struct net_device *dev); static int sb1000_close(struct net_device *dev); @@ -760,7 +760,7 @@ sb1000_rx(struct net_device *dev) unsigned int skbsize; struct sk_buff *skb; struct sb1000_private *lp = (struct sb1000_private *)dev->priv; - struct enet_statistics *stats = &lp->stats; + struct net_device_stats *stats = &lp->stats; /* SB1000 frame constants */ const int FrameSize = FRAMESIZE; diff --git a/drivers/net/sgiseeq.c b/drivers/net/sgiseeq.c index 1cea70fb7..53a223151 100644 --- a/drivers/net/sgiseeq.c +++ b/drivers/net/sgiseeq.c @@ -107,7 +107,7 @@ struct sgiseeq_private { unsigned char control; unsigned char mode; - struct enet_statistics stats; + struct net_device_stats stats; }; static inline void hpc3_eth_reset(volatile struct hpc3_ethregs *hregs) @@ -552,7 +552,7 @@ static void timeout(struct net_device *dev) netif_wake_queue(dev); } -static struct enet_statistics *sgiseeq_get_stats(struct net_device *dev) +static struct net_device_stats *sgiseeq_get_stats(struct net_device *dev) { struct sgiseeq_private *sp = (struct sgiseeq_private *) dev->priv; diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c index ddc98a3d5..d709ac2ca 100644 --- a/drivers/net/sis900.c +++ b/drivers/net/sis900.c @@ -161,7 +161,7 @@ static void sis900_finish_xmit (struct net_device *net_dev); static void sis900_interrupt(int irq, void *dev_instance, struct pt_regs *regs); static int sis900_close(struct net_device *net_dev); static int mii_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd); -static struct enet_statistics *sis900_get_stats(struct net_device *net_dev); +static struct net_device_stats *sis900_get_stats(struct net_device *net_dev); static u16 sis900_compute_hashtable_index(u8 *addr); static void set_rx_mode(struct net_device *net_dev); static void sis900_reset(struct net_device *net_dev); @@ -1140,7 +1140,7 @@ static int mii_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd) } } -static struct enet_statistics * +static struct net_device_stats * sis900_get_stats(struct net_device *net_dev) { struct sis900_private *sis_priv = (struct sis900_private *)net_dev->priv; diff --git a/drivers/net/sk_mca.c b/drivers/net/sk_mca.c index 1b8e48e0f..a98da4115 100644 --- a/drivers/net/sk_mca.c +++ b/drivers/net/sk_mca.c @@ -1016,7 +1016,7 @@ static int skmca_tx(struct sk_buff *skb, struct SKMCA_NETDEV *dev) /* return pointer to Ethernet statistics */ -static struct enet_statistics *skmca_stats(struct SKMCA_NETDEV *dev) +static struct net_device_stats *skmca_stats(struct SKMCA_NETDEV *dev) { skmca_priv *priv = (skmca_priv *) dev->priv; @@ -1164,7 +1164,7 @@ int skmca_probe(struct SKMCA_NETDEV *dev) priv->ctrladdr = base + 0x3ff2; priv->cmdaddr = base + 0x3ff3; priv->medium = medium; - memset(&(priv->stat), 0, sizeof(struct enet_statistics)); + memset(&(priv->stat), 0, sizeof(struct net_device_stats)); /* set base + irq for this device (irq not allocated so far) */ dev->irq = 0; diff --git a/drivers/net/sk_mca.h b/drivers/net/sk_mca.h index b107ecfb8..8a379b0e7 100644 --- a/drivers/net/sk_mca.h +++ b/drivers/net/sk_mca.h @@ -49,7 +49,7 @@ typedef struct { int nexttxdone; /* index of next TX descriptor to be finished */ int txbusy; /* # of busy TX descriptors */ - struct enet_statistics stat; /* packet statistics */ + struct net_device_stats stat; /* packet statistics */ int realirq; /* memorizes actual IRQ, even when currently not allocated */ skmca_medium medium; /* physical cannector */ diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c index 0d67bbb01..d845bd2ea 100644 --- a/drivers/net/skfp/skfddi.c +++ b/drivers/net/skfp/skfddi.c @@ -121,7 +121,7 @@ static int skfp_driver_init(struct net_device *dev); static int skfp_open(struct net_device *dev); static int skfp_close(struct net_device *dev); static void skfp_interrupt(int irq, void *dev_id, struct pt_regs *regs); -static struct enet_statistics *skfp_ctl_get_stats(struct net_device *dev); +static struct net_device_stats *skfp_ctl_get_stats(struct net_device *dev); static void skfp_ctl_set_multicast_list(struct net_device *dev); static void skfp_ctl_set_multicast_list_wo_lock(struct net_device *dev); static int skfp_ctl_set_mac_address(struct net_device *dev, void *addr); @@ -967,7 +967,7 @@ void skfp_interrupt(int irq, void *dev_id, struct pt_regs *regs) * independent. * */ -struct enet_statistics *skfp_ctl_get_stats(struct net_device *dev) +struct net_device_stats *skfp_ctl_get_stats(struct net_device *dev) { struct s_smc *bp = (struct s_smc *) dev->priv; @@ -1090,7 +1090,7 @@ struct enet_statistics *skfp_ctl_get_stats(struct net_device *dev) bp->stats.port_lem_cts[1] = bp->cmd_rsp_virt->cntrs_get.cntrs.link_errors[1].ls; #endif - return ((struct enet_statistics *) &bp->os.MacStat); + return ((struct net_device_stats *) &bp->os.MacStat); } // ctl_get_stat diff --git a/drivers/net/sonic.c b/drivers/net/sonic.c index b0c6d6615..5480ec0ff 100644 --- a/drivers/net/sonic.c +++ b/drivers/net/sonic.c @@ -377,7 +377,7 @@ sonic_rx(struct net_device *dev) * Get the current statistics. * This may be called with the device open or closed. */ -static struct enet_statistics * +static struct net_device_stats * sonic_get_stats(struct net_device *dev) { struct sonic_local *lp = (struct sonic_local *)dev->priv; diff --git a/drivers/net/sonic.h b/drivers/net/sonic.h index 4c18dbe70..d070f06e3 100644 --- a/drivers/net/sonic.h +++ b/drivers/net/sonic.h @@ -460,7 +460,7 @@ struct sonic_local { unsigned int cur_tx; unsigned int dirty_tx; /* last unacked transmit packet */ char tx_full; - struct enet_statistics stats; + struct net_device_stats stats; }; /* Index to functions, as function prototypes. */ @@ -470,7 +470,7 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev); static void sonic_interrupt(int irq, void *dev_id, struct pt_regs *regs); static void sonic_rx(struct net_device *dev); static int sonic_close(struct net_device *dev); -static struct enet_statistics *sonic_get_stats(struct net_device *dev); +static struct net_device_stats *sonic_get_stats(struct net_device *dev); static void sonic_multicast_list(struct net_device *dev); static int sonic_init(struct net_device *dev); diff --git a/drivers/net/strip.c b/drivers/net/strip.c index 3f3bd8a4a..b63c47cb8 100644 --- a/drivers/net/strip.c +++ b/drivers/net/strip.c @@ -2430,12 +2430,12 @@ static int dev_set_mac_address(struct net_device *dev, void *addr) return 0; } -static struct enet_statistics *strip_get_stats(struct net_device *dev) +static struct net_device_stats *strip_get_stats(struct net_device *dev) { - static struct enet_statistics stats; + static struct net_device_stats stats; struct strip *strip_info = (struct strip *)(dev->priv); - memset(&stats, 0, sizeof(struct enet_statistics)); + memset(&stats, 0, sizeof(struct net_device_stats)); stats.rx_packets = strip_info->rx_packets; stats.tx_packets = strip_info->tx_packets; diff --git a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c index 3b7f76700..b7fe862d0 100644 --- a/drivers/net/sunbmac.c +++ b/drivers/net/sunbmac.c @@ -164,7 +164,7 @@ static void bigmac_stop(struct bigmac *bp) static void bigmac_get_counters(struct bigmac *bp, unsigned long bregs) { - struct enet_statistics *stats = &bp->enet_stats; + struct net_device_stats *stats = &bp->enet_stats; stats->rx_crc_errors += sbus_readl(bregs + BMAC_RCRCECTR); sbus_writel(0, bregs + BMAC_RCRCECTR); @@ -974,7 +974,7 @@ static int bigmac_start_xmit(struct sk_buff *skb, struct net_device *dev) return 0; } -static struct enet_statistics *bigmac_get_stats(struct net_device *dev) +static struct net_device_stats *bigmac_get_stats(struct net_device *dev) { struct bigmac *bp = (struct bigmac *) dev->priv; diff --git a/drivers/net/sunbmac.h b/drivers/net/sunbmac.h index f1d878c66..6a668a9c5 100644 --- a/drivers/net/sunbmac.h +++ b/drivers/net/sunbmac.h @@ -328,7 +328,7 @@ struct bigmac { enum bigmac_timer_state timer_state; unsigned int timer_ticks; - struct enet_statistics enet_stats; + struct net_device_stats enet_stats; struct sbus_dev *qec_sdev; struct sbus_dev *bigmac_sdev; struct net_device *dev; diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c index 0fefb11ed..e9481039d 100644 --- a/drivers/net/tokenring/smctr.c +++ b/drivers/net/tokenring/smctr.c @@ -124,7 +124,7 @@ static unsigned int smctr_get_num_rx_bdbs(struct net_device *dev); static int smctr_get_physical_drop_number(struct net_device *dev); static __u8 *smctr_get_rx_pointer(struct net_device *dev, short queue); static int smctr_get_station_id(struct net_device *dev); -static struct enet_statistics *smctr_get_stats(struct net_device *dev); +static struct net_device_stats *smctr_get_stats(struct net_device *dev); static FCBlock *smctr_get_tx_fcb(struct net_device *dev, __u16 queue, __u16 bytes_count); static int smctr_get_upstream_neighbor_addr(struct net_device *dev); @@ -1402,11 +1402,11 @@ static int smctr_get_station_id(struct net_device *dev) * Get the current statistics. This may be called with the card open * or closed. */ -static struct enet_statistics *smctr_get_stats(struct net_device *dev) +static struct net_device_stats *smctr_get_stats(struct net_device *dev) { struct net_local *tp = (struct net_local *)dev->priv; - return ((struct enet_statistics *)&tp->MacStat); + return ((struct net_device_stats *)&tp->MacStat); } static FCBlock *smctr_get_tx_fcb(struct net_device *dev, __u16 queue, diff --git a/drivers/net/tokenring/tms380tr.c b/drivers/net/tokenring/tms380tr.c index f5a6d3587..e6dcbf2d8 100644 --- a/drivers/net/tokenring/tms380tr.c +++ b/drivers/net/tokenring/tms380tr.c @@ -143,7 +143,7 @@ static void tms380tr_exec_cmd(struct net_device *dev, unsigned short Command); static void tms380tr_exec_sifcmd(struct net_device *dev, unsigned int WriteValue); /* "F" */ /* "G" */ -static struct enet_statistics *tms380tr_get_stats(struct net_device *dev); +static struct net_device_stats *tms380tr_get_stats(struct net_device *dev); /* "H" */ static void tms380tr_hardware_send_packet(struct net_device *dev, struct net_local* tp); @@ -1166,11 +1166,11 @@ int tms380tr_close(struct net_device *dev) * Get the current statistics. This may be called with the card open * or closed. */ -static struct enet_statistics *tms380tr_get_stats(struct net_device *dev) +static struct net_device_stats *tms380tr_get_stats(struct net_device *dev) { struct net_local *tp = (struct net_local *)dev->priv; - return ((struct enet_statistics *)&tp->MacStat); + return ((struct net_device_stats *)&tp->MacStat); } /* diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index 6b0c7dd15..9079f8113 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c @@ -717,7 +717,7 @@ static int tulip_close (struct net_device *dev) return 0; } -static struct enet_statistics *tulip_get_stats(struct net_device *dev) +static struct net_device_stats *tulip_get_stats(struct net_device *dev) { struct tulip_private *tp = (struct tulip_private *)dev->priv; long ioaddr = dev->base_addr; diff --git a/drivers/net/wan/Config.in b/drivers/net/wan/Config.in index 890fe7104..4621d3981 100644 --- a/drivers/net/wan/Config.in +++ b/drivers/net/wan/Config.in @@ -45,6 +45,8 @@ if [ "$CONFIG_WAN" = "y" ]; then dep_tristate 'Sealevel Systems 4021 support' CONFIG_SEALEVEL_4021 m + dep_tristate 'SyncLink HDLC/SYNCPPP support' CONFIG_SYNCLINK_SYNCPPP m + tristate 'Frame relay DLCI support' CONFIG_DLCI if [ "$CONFIG_DLCI" != "n" ]; then int 'Max open DLCI' CONFIG_DLCI_COUNT 24 diff --git a/drivers/net/wan/Makefile b/drivers/net/wan/Makefile index 3904c76a6..d45f0ccfd 100644 --- a/drivers/net/wan/Makefile +++ b/drivers/net/wan/Makefile @@ -49,6 +49,14 @@ else endif endif +ifeq ($(CONFIG_SYNCLINK_SYNCPPP),y) +CONFIG_SYNCPPP_BUILTIN = y +else + ifeq ($(CONFIG_SYNCLINK_SYNCPPP),m) + CONFIG_SYNCPPP_MODULE = y + endif +endif + ifeq ($(CONFIG_COMX),y) LX_OBJS += comx.o else diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c index b28fdafc1..09d6c9556 100644 --- a/drivers/net/wan/hostess_sv11.c +++ b/drivers/net/wan/hostess_sv11.c @@ -166,7 +166,7 @@ static int hostess_ioctl(struct net_device *d, struct ifreq *ifr, int cmd) return sppp_do_ioctl(d, ifr,cmd); } -static struct enet_statistics *hostess_get_stats(struct net_device *d) +static struct net_device_stats *hostess_get_stats(struct net_device *d) { struct sv11_device *sv11=d->priv; if(sv11) diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c index c0b17f79f..30ec7ab8e 100644 --- a/drivers/net/wan/lmc/lmc_main.c +++ b/drivers/net/wan/lmc/lmc_main.c @@ -127,7 +127,7 @@ static int lmc_start_xmit(struct sk_buff *skb, struct net_device *dev); static int lmc_rx (struct net_device *dev); static int lmc_open(struct net_device *dev); static int lmc_close(struct net_device *dev); -static struct enet_statistics *lmc_get_stats(struct net_device *dev); +static struct net_device_stats *lmc_get_stats(struct net_device *dev); static void lmc_interrupt(int irq, void *dev_instance, struct pt_regs *regs); static int lmc_set_config(struct net_device *dev, struct ifmap *map); static void lmc_initcsrs(lmc_softc_t * const sc, lmc_csrptr_t csr_base, size_t csr_size); @@ -1961,7 +1961,7 @@ skip_out_of_mem: return 0; } -static struct enet_statistics *lmc_get_stats (struct net_device *dev) /*fold00*/ +static struct net_device_stats *lmc_get_stats (struct net_device *dev) /*fold00*/ { lmc_softc_t *sc; LMC_SPIN_FLAGS; @@ -1978,7 +1978,7 @@ static struct enet_statistics *lmc_get_stats (struct net_device *dev) /*fold00*/ lmc_trace(dev, "lmc_get_stats out"); - return (struct enet_statistics *) &sc->stats; + return (struct net_device_stats *) &sc->stats; } #ifdef MODULE diff --git a/drivers/net/wan/lmc/lmc_var.h b/drivers/net/wan/lmc/lmc_var.h index 67215b93b..9f50aada0 100644 --- a/drivers/net/wan/lmc/lmc_var.h +++ b/drivers/net/wan/lmc/lmc_var.h @@ -248,7 +248,7 @@ struct lmc___media { #define STATCHECK 0xBEEFCAFE /* Included in this structure are first - * - standard enet_statistics + * - standard net_device_stats * - some other counters used for debug and driver performance * evaluation -baz */ diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c index 69a32c48d..37ef27487 100644 --- a/drivers/net/wan/sbni.c +++ b/drivers/net/wan/sbni.c @@ -100,7 +100,7 @@ static int sbni_start_xmit(struct sk_buff *skb, struct net_device *dev); static void sbni_interrupt(int irq, void *dev_id, struct pt_regs *regs); static int sbni_close(struct net_device *dev); static void sbni_drop_tx_queue(struct net_device *dev); -static struct enet_statistics *sbni_get_stats(struct net_device *dev); +static struct net_device_stats *sbni_get_stats(struct net_device *dev); static void card_start(struct net_device *dev); static inline unsigned short sbni_recv(struct net_device *dev); void change_level(struct net_device *dev); @@ -952,7 +952,7 @@ static void sbni_interrupt(int irq, void *dev_id, struct pt_regs *regs) spin_unlock(&lp->lock); } -static struct enet_statistics *sbni_get_stats(struct net_device *dev) +static struct net_device_stats *sbni_get_stats(struct net_device *dev) { struct net_local *lp = (struct net_local *)dev->priv; return &lp->stats; diff --git a/drivers/net/wan/sbni.h b/drivers/net/wan/sbni.h index 56550d8f2..ce44bea46 100644 --- a/drivers/net/wan/sbni.h +++ b/drivers/net/wan/sbni.h @@ -106,7 +106,7 @@ struct sbni_in_stats { * Board-specific info in dev->priv. */ struct net_local { - struct enet_statistics stats; + struct net_device_stats stats; struct timer_list watchdog; unsigned int realframelen; /* the current size of the SB-frame */ diff --git a/drivers/net/wan/sdla_chdlc.c b/drivers/net/wan/sdla_chdlc.c index 5989cdc47..efdf2069d 100644 --- a/drivers/net/wan/sdla_chdlc.c +++ b/drivers/net/wan/sdla_chdlc.c @@ -143,7 +143,7 @@ static int if_rebuild_hdr (void* hdr, struct net_device* dev, unsigned long radd struct sk_buff* skb); #endif static int if_send (struct sk_buff* skb, struct net_device* dev); -static struct enet_statistics* if_stats (struct net_device* dev); +static struct net_device_stats* if_stats (struct net_device* dev); /* CHDLC Firmware interface functions */ static int chdlc_configure (sdla_t* card, void* data); @@ -1169,7 +1169,7 @@ unsigned short calc_checksum (char *data, int len) /*============================================================================ * Get ethernet-style interface statistics. - * Return a pointer to struct enet_statistics. + * Return a pointer to struct net_device_stats. */ #ifdef LINUX_2_1 static struct net_device_stats* if_stats (struct net_device* dev) @@ -1181,7 +1181,7 @@ static struct net_device_stats* if_stats (struct net_device* dev) return &my_card->wandev.stats; } #else -static struct enet_statistics* if_stats (struct net_device* dev) +static struct net_device_stats* if_stats (struct net_device* dev) { sdla_t *my_card; chdlc_private_area_t* chdlc_priv_area = dev->priv; diff --git a/drivers/net/wan/sdla_fr.c b/drivers/net/wan/sdla_fr.c index ab88a8bb3..69054c9f2 100644 --- a/drivers/net/wan/sdla_fr.c +++ b/drivers/net/wan/sdla_fr.c @@ -1588,9 +1588,9 @@ static void switch_net_numbers(unsigned char *sendpacket, unsigned long network_ /*============================================================================ * Get ethernet-style interface statistics. - * Return a pointer to struct enet_statistics. + * Return a pointer to struct net_device_stats. */ -static struct enet_statistics* if_stats (struct net_device* dev) +static struct net_device_stats* if_stats (struct net_device* dev) { fr_channel_t* chan = dev->priv; diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c index 68b318688..f1a895e36 100644 --- a/drivers/net/wan/sealevel.c +++ b/drivers/net/wan/sealevel.c @@ -164,7 +164,7 @@ static int sealevel_ioctl(struct net_device *d, struct ifreq *ifr, int cmd) return sppp_do_ioctl(d, ifr,cmd); } -static struct enet_statistics *sealevel_get_stats(struct net_device *d) +static struct net_device_stats *sealevel_get_stats(struct net_device *d) { struct slvl_device *slvl=d->priv; if(slvl) diff --git a/drivers/parport/ChangeLog b/drivers/parport/ChangeLog index f22c69b2a..d408c8796 100644 --- a/drivers/parport/ChangeLog +++ b/drivers/parport/ChangeLog @@ -1,3 +1,13 @@ +2000-06-30 Gunther Mayer <gunther.mayer@braunschweig.okersurf.de> + + * parport_pc.c: Support for the full range of Timedia cards. + +2000-07-08 Tim Waugh <twaugh@redhat.com> + + * daisy.c: License block comments as part of parportbook. + * ieee1284.c: Likewise. + * share.c: Likewise. + 2000-06-30 Petr Vandrovec <vandrove@vc.cvut.cz> * procfs.c (do_hardware_modes): Generated string can be up to 34 diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index 12b56f585..709228dc6 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -2307,8 +2307,31 @@ enum parport_pc_pci_cards { boca_ioppar, plx_9050, afavlab_tk9902, - timedia_1889, + timedia_4078a, + timedia_4079h, + timedia_4085h, + timedia_4088a, + timedia_4089a, + timedia_4095a, + timedia_4096a, + timedia_4078u, + timedia_4079a, + timedia_4085u, + timedia_4079r, + timedia_4079s, + timedia_4079d, + timedia_4079e, + timedia_4079f, + timedia_9079a, + timedia_9079b, + timedia_9079c, + timedia_4006a, + timedia_4014, + timedia_4008a, + timedia_4018, + timedia_9018a, syba_2p_epp, + syba_1p_ecp, }; @@ -2348,10 +2371,33 @@ static struct parport_pc_pci { /* boca_ioppar */ { 1, { { 0, -1 }, } }, /* plx_9050 */ { 2, { { 4, -1 }, { 5, -1 }, } }, /* afavlab_tk9902 */ { 1, { { 0, 1 }, } }, - /* timedia_1889 */ { 1, { { 2, -1 }, } }, + /* timedia_4078a */ { 1, { { 2, -1 }, } }, + /* timedia_4079h */ { 1, { { 2, 3 }, } }, + /* timedia_4085h */ { 2, { { 2, -1 }, { 4, -1 }, } }, + /* timedia_4088a */ { 2, { { 2, 3 }, { 4, 5 }, } }, + /* timedia_4089a */ { 2, { { 2, 3 }, { 4, 5 }, } }, + /* timedia_4095a */ { 2, { { 2, 3 }, { 4, 5 }, } }, + /* timedia_4096a */ { 2, { { 2, 3 }, { 4, 5 }, } }, + /* timedia_4078u */ { 1, { { 2, -1 }, } }, + /* timedia_4079a */ { 1, { { 2, 3 }, } }, + /* timedia_4085u */ { 2, { { 2, -1 }, { 4, -1 }, } }, + /* timedia_4079r */ { 1, { { 2, 3 }, } }, + /* timedia_4079s */ { 1, { { 2, 3 }, } }, + /* timedia_4079d */ { 1, { { 2, 3 }, } }, + /* timedia_4079e */ { 1, { { 2, 3 }, } }, + /* timedia_4079f */ { 1, { { 2, 3 }, } }, + /* timedia_9079a */ { 1, { { 2, 3 }, } }, + /* timedia_9079b */ { 1, { { 2, 3 }, } }, + /* timedia_9079c */ { 1, { { 2, 3 }, } }, + /* timedia_4006a */ { 1, { { 0, -1 }, } }, + /* timedia_4014 */ { 2, { { 0, -1 }, { 2, -1 }, } }, + /* timedia_4008a */ { 1, { { 0, 1 }, } }, + /* timedia_4018 */ { 2, { { 0, 1 }, { 2, 3 }, } }, + /* timedia_9018a */ { 2, { { 0, 1 }, { 2, 3 }, } }, /* SYBA uses fixed offsets in a 1K io window */ - /* syba_2p_epp */ { 2, { { 0, 0x078 }, { 0, 0x178 }, } }, + /* syba_2p_epp AP138B */ { 2, { { 0, 0x078 }, { 0, 0x178 }, } }, + /* syba_1p_ecp W83787 */ { 1, { { 0, 0x078 }, } }, }; static struct pci_device_id parport_pc_pci_tbl[] __devinitdata = { @@ -2409,9 +2455,34 @@ static struct pci_device_id parport_pc_pci_tbl[] __devinitdata = { PCI_SUBVENDOR_ID_EXSYS, PCI_SUBDEVICE_ID_EXSYS_4014, 0,0, plx_9050 }, { PCI_VENDOR_ID_AFAVLAB, PCI_DEVICE_ID_AFAVLAB_TK9902, PCI_ANY_ID, PCI_ANY_ID, 0, 0, afavlab_tk9902 }, - { PCI_VENDOR_ID_TIMEDIA, PCI_DEVICE_ID_TIMEDIA_1889, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, timedia_1889 }, - { 0x1592, 0x0782, PCI_ANY_ID, PCI_ANY_ID, 0, 0, syba_2p_epp }, + /* PCI_VENDOR_ID_TIMEDIA/SUNIX has many differing cards ...*/ + { 0x1409, 0x7168, 0x1409, 0x4078, 0, 0, timedia_4078a }, + { 0x1409, 0x7168, 0x1409, 0x4079, 0, 0, timedia_4079h }, + { 0x1409, 0x7168, 0x1409, 0x4085, 0, 0, timedia_4085h }, + { 0x1409, 0x7168, 0x1409, 0x4088, 0, 0, timedia_4088a }, + { 0x1409, 0x7168, 0x1409, 0x4089, 0, 0, timedia_4089a }, + { 0x1409, 0x7168, 0x1409, 0x4095, 0, 0, timedia_4095a }, + { 0x1409, 0x7168, 0x1409, 0x4096, 0, 0, timedia_4096a }, + { 0x1409, 0x7168, 0x1409, 0x5078, 0, 0, timedia_4078u }, + { 0x1409, 0x7168, 0x1409, 0x5079, 0, 0, timedia_4079a }, + { 0x1409, 0x7168, 0x1409, 0x5085, 0, 0, timedia_4085u }, + { 0x1409, 0x7168, 0x1409, 0x6079, 0, 0, timedia_4079r }, + { 0x1409, 0x7168, 0x1409, 0x7079, 0, 0, timedia_4079s }, + { 0x1409, 0x7168, 0x1409, 0x8079, 0, 0, timedia_4079d }, + { 0x1409, 0x7168, 0x1409, 0x9079, 0, 0, timedia_4079e }, + { 0x1409, 0x7168, 0x1409, 0xa079, 0, 0, timedia_4079f }, + { 0x1409, 0x7168, 0x1409, 0xb079, 0, 0, timedia_9079a }, + { 0x1409, 0x7168, 0x1409, 0xc079, 0, 0, timedia_9079b }, + { 0x1409, 0x7168, 0x1409, 0xd079, 0, 0, timedia_9079c }, + { 0x1409, 0x7268, 0x1409, 0x0101, 0, 0, timedia_4006a }, + { 0x1409, 0x7268, 0x1409, 0x0102, 0, 0, timedia_4014 }, + { 0x1409, 0x7268, 0x1409, 0x0103, 0, 0, timedia_4008a }, + { 0x1409, 0x7268, 0x1409, 0x0104, 0, 0, timedia_4018 }, + { 0x1409, 0x7268, 0x1409, 0x9018, 0, 0, timedia_9018a }, + { PCI_VENDOR_ID_SYBA, PCI_DEVICE_ID_SYBA_2P_EPP, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, syba_2p_epp }, + { PCI_VENDOR_ID_SYBA, PCI_DEVICE_ID_SYBA_1P_ECP, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, syba_1p_ecp }, { 0, } /* terminate list */ }; MODULE_DEVICE_TABLE(pci,parport_pc_pci_tbl); diff --git a/drivers/sound/Makefile b/drivers/sound/Makefile index 10fbd5871..399148c74 100644 --- a/drivers/sound/Makefile +++ b/drivers/sound/Makefile @@ -47,7 +47,7 @@ obj-$(CONFIG_SOUND_SOFTOSS) += softoss2.o obj-$(CONFIG_SOUND_SSCAPE) += sscape.o ad1848.o mpu401.o obj-$(CONFIG_SOUND_MAD16) += mad16.o ad1848.o sb_lib.o uart401.o obj-$(CONFIG_SOUND_CS4232) += cs4232.o uart401.o -obj-$(CONFIG_SOUND_OPL3SA2) += opl3sa2.o ad1848.o uart401.o mpu401.o +obj-$(CONFIG_SOUND_OPL3SA2) += opl3sa2.o ad1848.o mpu401.o obj-$(CONFIG_SOUND_MSS) += ad1848.o obj-$(CONFIG_SOUND_PAS) += pas2.o sb_lib.o uart401.o obj-$(CONFIG_SOUND_SB) += sb.o sb_lib.o uart401.o diff --git a/drivers/usb/bluetooth.c b/drivers/usb/bluetooth.c index dc3b54ed1..aaea67a4c 100644 --- a/drivers/usb/bluetooth.c +++ b/drivers/usb/bluetooth.c @@ -33,7 +33,6 @@ */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/signal.h> diff --git a/drivers/usb/hub.c b/drivers/usb/hub.c index 75794f3ca..71d6aabb9 100644 --- a/drivers/usb/hub.c +++ b/drivers/usb/hub.c @@ -588,6 +588,8 @@ static int usb_hub_thread(void *__hub) * so get rid of all our resources */ exit_files(current); /* daemonize doesn't do exit_files */ + current->files = init_task.files; + atomic_inc(¤t->files->count); daemonize(); /* Setup a nice name */ diff --git a/drivers/usb/ov511.c b/drivers/usb/ov511.c index 66f73d3c1..1862415fa 100644 --- a/drivers/usb/ov511.c +++ b/drivers/usb/ov511.c @@ -30,7 +30,7 @@ * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -static const char version[] = "1.18"; +static const char version[] = "1.19"; #define __NO_VERSION__ @@ -98,6 +98,9 @@ static int aperture = -1; * programs that expect RGB data (e.g. gqcam) to work with this driver. */ static int force_rgb = 0; +/* Number of seconds before inactive buffers are deallocated */ +static int buf_timeout = 5; + MODULE_PARM(autoadjust, "i"); MODULE_PARM(debug, "i"); MODULE_PARM(fix_rgb_offset, "i"); @@ -106,6 +109,7 @@ MODULE_PARM(sensor, "i"); MODULE_PARM(i2c_detect_tries, "i"); MODULE_PARM(aperture, "i"); MODULE_PARM(force_rgb, "i"); +MODULE_PARM(buf_timeout, "i"); MODULE_AUTHOR("Mark McClelland <mmcclelland@delphi.com> & Bret Wallach & Orion Sky Lawlor <olawlor@acm.org> & Kevin Moore & Charl P. Botha <cpbotha@ieee.org> & Claudio Matsuoka <claudio@conectiva.com>"); MODULE_DESCRIPTION("OV511 USB Camera Driver"); @@ -132,6 +136,7 @@ static struct cam_list clist[] = { { -1, NULL } }; +#if defined(CONFIG_PROC_FS) && defined(CONFIG_VIDEO_PROC_FS) static struct palette_list plist[] = { { VIDEO_PALETTE_GREY, "GREY" }, { VIDEO_PALETTE_HI240, "HI240" }, @@ -151,6 +156,7 @@ static struct palette_list plist[] = { { VIDEO_PALETTE_YUV410P,"YUV410P" }, { -1, NULL } }; +#endif /********************************************************************** * @@ -432,7 +438,7 @@ static int ov511_reg_write(struct usb_device *dev, PDEBUG(5, "reg write: 0x%02X:0x%02X, 0x%x", reg, value, rc); if (rc < 0) - err("ov511_reg_write: error %d", rc); + err("reg write: error %d", rc); return rc; } @@ -452,7 +458,7 @@ static int ov511_reg_read(struct usb_device *dev, unsigned char reg) PDEBUG(5, "reg read: 0x%02X:0x%02X", reg, buffer[0]); if (rc < 0) { - err("ov511_reg_read: error %d", rc); + err("reg read: error %d", rc); return rc; } else { return buffer[0]; @@ -501,7 +507,7 @@ static int ov511_i2c_write(struct usb_device *dev, return 0; error: - err("ov511_i2c_write: error %d", rc); + err("i2c write: error %d", rc); return rc; } @@ -573,7 +579,7 @@ static int ov511_i2c_read(struct usb_device *dev, unsigned char reg) return value; error: - err("ov511_i2c_read: error %d", rc); + err("i2c read: error %d", rc); return rc; } @@ -601,7 +607,7 @@ static int ov511_write_regvals(struct usb_device *dev, return 0; error: - err("ov511_write_regvals: error %d", rc); + err("write regvals: error %d", rc); return rc; } @@ -699,11 +705,8 @@ static int ov511_set_packet_size(struct usb_ov511 *ov511, int size) if (ov511->bridge == BRG_OV511) { if (size == 0) alt = OV511_ALT_SIZE_0; else if (size == 257) alt = OV511_ALT_SIZE_257; -// else if (size == 512) alt = OV511_ALT_SIZE_512; else if (size == 513) alt = OV511_ALT_SIZE_513; -// else if (size == 768) alt = OV511_ALT_SIZE_768; else if (size == 769) alt = OV511_ALT_SIZE_769; -// else if (size == 992) alt = OV511_ALT_SIZE_992; else if (size == 993) alt = OV511_ALT_SIZE_993; else { err("Set packet size: invalid size (%d)", size); @@ -1673,7 +1676,7 @@ static void ov511_isoc_irq(struct urb *urb) static int ov511_init_isoc(struct usb_ov511 *ov511) { urb_t *urb; - int fx, err; + int fx, err, n; PDEBUG(3, "*** Initializing capture ***"); @@ -1689,55 +1692,37 @@ static int ov511_init_isoc(struct usb_ov511 *ov511) else err("invalid bridge type"); - /* We double buffer the Iso lists */ - urb = usb_alloc_urb(FRAMES_PER_DESC); + for (n = 0; n < OV511_NUMSBUF; n++) { + urb = usb_alloc_urb(FRAMES_PER_DESC); - if (!urb) { - err("ov511_init_isoc: usb_alloc_urb ret. NULL"); - return -ENOMEM; - } - ov511->sbuf[0].urb = urb; - urb->dev = ov511->dev; - urb->context = ov511; - urb->pipe = usb_rcvisocpipe(ov511->dev, OV511_ENDPOINT_ADDRESS); - urb->transfer_flags = USB_ISO_ASAP; - urb->transfer_buffer = ov511->sbuf[0].data; - urb->complete = ov511_isoc_irq; - urb->number_of_packets = FRAMES_PER_DESC; - urb->transfer_buffer_length = ov511->packet_size * FRAMES_PER_DESC; - for (fx = 0; fx < FRAMES_PER_DESC; fx++) { - urb->iso_frame_desc[fx].offset = ov511->packet_size * fx; - urb->iso_frame_desc[fx].length = ov511->packet_size; - } - - urb = usb_alloc_urb(FRAMES_PER_DESC); - if (!urb) { - err("ov511_init_isoc: usb_alloc_urb ret. NULL"); - return -ENOMEM; - } - ov511->sbuf[1].urb = urb; - urb->dev = ov511->dev; - urb->context = ov511; - urb->pipe = usb_rcvisocpipe(ov511->dev, OV511_ENDPOINT_ADDRESS); - urb->transfer_flags = USB_ISO_ASAP; - urb->transfer_buffer = ov511->sbuf[1].data; - urb->complete = ov511_isoc_irq; - urb->number_of_packets = FRAMES_PER_DESC; - urb->transfer_buffer_length = ov511->packet_size * FRAMES_PER_DESC; - for (fx = 0; fx < FRAMES_PER_DESC; fx++) { - urb->iso_frame_desc[fx].offset = ov511->packet_size * fx; - urb->iso_frame_desc[fx].length = ov511->packet_size; + if (!urb) { + err("init isoc: usb_alloc_urb ret. NULL"); + return -ENOMEM; + } + ov511->sbuf[n].urb = urb; + urb->dev = ov511->dev; + urb->context = ov511; + urb->pipe = usb_rcvisocpipe(ov511->dev, OV511_ENDPOINT_ADDRESS); + urb->transfer_flags = USB_ISO_ASAP; + urb->transfer_buffer = ov511->sbuf[n].data; + urb->complete = ov511_isoc_irq; + urb->number_of_packets = FRAMES_PER_DESC; + urb->transfer_buffer_length = ov511->packet_size * FRAMES_PER_DESC; + for (fx = 0; fx < FRAMES_PER_DESC; fx++) { + urb->iso_frame_desc[fx].offset = ov511->packet_size * fx; + urb->iso_frame_desc[fx].length = ov511->packet_size; + } } - ov511->sbuf[1].urb->next = ov511->sbuf[0].urb; - ov511->sbuf[0].urb->next = ov511->sbuf[1].urb; + ov511->sbuf[OV511_NUMSBUF - 1].urb->next = ov511->sbuf[0].urb; + for (n = 0; n < OV511_NUMSBUF - 1; n++) + ov511->sbuf[n].urb->next = ov511->sbuf[n+1].urb; - err = usb_submit_urb(ov511->sbuf[0].urb); - if (err) - err("ov511_init_isoc: usb_submit_urb(0) ret %d", err); - err = usb_submit_urb(ov511->sbuf[1].urb); - if (err) - err("ov511_init_isoc: usb_submit_urb(1) ret %d", err); + for (n = 0; n < OV511_NUMSBUF; n++) { + err = usb_submit_urb(ov511->sbuf[n].urb); + if (err) + err("init isoc: usb_submit_urb(%d) ret %d", n, err); + } ov511->streaming = 1; @@ -1746,6 +1731,8 @@ static int ov511_init_isoc(struct usb_ov511 *ov511) static void ov511_stop_isoc(struct usb_ov511 *ov511) { + int n; + if (!ov511->streaming || !ov511->dev) return; @@ -1756,17 +1743,13 @@ static void ov511_stop_isoc(struct usb_ov511 *ov511) ov511->streaming = 0; /* Unschedule all of the iso td's */ - if (ov511->sbuf[1].urb) { - ov511->sbuf[1].urb->next = NULL; - usb_unlink_urb(ov511->sbuf[1].urb); - usb_free_urb(ov511->sbuf[1].urb); - ov511->sbuf[1].urb = NULL; - } - if (ov511->sbuf[0].urb) { - ov511->sbuf[0].urb->next = NULL; - usb_unlink_urb(ov511->sbuf[0].urb); - usb_free_urb(ov511->sbuf[0].urb); - ov511->sbuf[0].urb = NULL; + for (n = OV511_NUMSBUF - 1; n >= 0; n--) { + if (ov511->sbuf[n].urb) { + ov511->sbuf[n].urb->next = NULL; + usb_unlink_urb(ov511->sbuf[n].urb); + usb_free_urb(ov511->sbuf[n].urb); + ov511->sbuf[n].urb = NULL; + } } } @@ -1818,6 +1801,127 @@ static int ov511_new_frame(struct usb_ov511 *ov511, int framenum) /**************************************************************************** * + * Buffer management + * + ***************************************************************************/ +static int ov511_alloc(struct usb_ov511 *ov511) +{ + int i; + + PDEBUG(4, "entered"); + down(&ov511->buf_lock); + + if (ov511->buf_state == BUF_PEND_DEALLOC) { + ov511->buf_state = BUF_ALLOCATED; + del_timer(&ov511->buf_timer); + } + + if (ov511->buf_state == BUF_ALLOCATED) + goto out; + + ov511->fbuf = rvmalloc(OV511_NUMFRAMES * MAX_DATA_SIZE); + if (!ov511->fbuf) + goto error; + + for (i = 0; i < OV511_NUMFRAMES; i++) { + ov511->frame[i].grabstate = FRAME_UNUSED; + ov511->frame[i].data = ov511->fbuf + i * MAX_DATA_SIZE; + PDEBUG(4, "frame[%d] @ %p", i, ov511->frame[i].data); + + ov511->sbuf[i].data = kmalloc(FRAMES_PER_DESC * + MAX_FRAME_SIZE_PER_DESC, GFP_KERNEL); + if (!ov511->sbuf[i].data) { + while (--i) { + kfree(ov511->sbuf[i].data); + ov511->sbuf[i].data = NULL; + } + rvfree(ov511->fbuf, OV511_NUMFRAMES * MAX_DATA_SIZE); + ov511->fbuf = NULL; + goto error; + } + PDEBUG(4, "sbuf[%d] @ %p", i, ov511->sbuf[i].data); + } + ov511->buf_state = BUF_ALLOCATED; +out: + up(&ov511->buf_lock); + PDEBUG(4, "leaving"); + return 0; +error: + ov511->buf_state = BUF_NOT_ALLOCATED; + up(&ov511->buf_lock); + PDEBUG(4, "errored"); + return -ENOMEM; +} + +/* + * - You must acquire buf_lock before entering this function. + * - Because this code will free any non-null pointer, you must be sure to null + * them if you explicitly free them somewhere else! + */ +static void ov511_do_dealloc(struct usb_ov511 *ov511) +{ + int i; + PDEBUG(4, "entered"); + + if (ov511->fbuf) { + rvfree(ov511->fbuf, OV511_NUMFRAMES * MAX_DATA_SIZE); + ov511->fbuf = NULL; + } + + for (i = 0; i < OV511_NUMFRAMES; i++) { + if (ov511->sbuf[i].data) { + kfree(ov511->sbuf[i].data); + ov511->sbuf[i].data = NULL; + } + } + + PDEBUG(4, "buffer memory deallocated"); + ov511->buf_state = BUF_NOT_ALLOCATED; + PDEBUG(4, "leaving"); +} + +static void ov511_buf_callback(unsigned long data) +{ + struct usb_ov511 *ov511 = (struct usb_ov511 *)data; + PDEBUG(4, "entered"); + down(&ov511->buf_lock); + + if (ov511->buf_state == BUF_PEND_DEALLOC) + ov511_do_dealloc(ov511); + + up(&ov511->buf_lock); + PDEBUG(4, "leaving"); +} + +static void ov511_dealloc(struct usb_ov511 *ov511, int now) +{ + struct timer_list *bt = &(ov511->buf_timer); + PDEBUG(4, "entered"); + down(&ov511->buf_lock); + + PDEBUG(4, "deallocating buffer memory %s", now ? "now" : "later"); + + if (ov511->buf_state == BUF_PEND_DEALLOC) { + ov511->buf_state = BUF_ALLOCATED; + del_timer(bt); + } + + if (now) + ov511_do_dealloc(ov511); + else { + ov511->buf_state = BUF_PEND_DEALLOC; + init_timer(bt); + bt->function = ov511_buf_callback; + bt->data = (unsigned long)ov511; + bt->expires = jiffies + buf_timeout * HZ; + add_timer(bt); + } + up(&ov511->buf_lock); + PDEBUG(4, "leaving"); +} + +/**************************************************************************** + * * V4L API * ***************************************************************************/ @@ -1825,7 +1929,7 @@ static int ov511_new_frame(struct usb_ov511 *ov511, int framenum) static int ov511_open(struct video_device *dev, int flags) { struct usb_ov511 *ov511 = (struct usb_ov511 *)dev; - int i, err = 0; + int err = 0; MOD_INC_USE_COUNT; PDEBUG(4, "opening"); @@ -1836,33 +1940,16 @@ static int ov511_open(struct video_device *dev, int flags) goto out; err = -ENOMEM; - - /* Allocate memory for the frame buffers */ - ov511->fbuf = rvmalloc(OV511_NUMFRAMES * MAX_DATA_SIZE); - if (!ov511->fbuf) + if (ov511_alloc(ov511)) goto out; ov511->sub_flag = 0; - for (i = 0; i < OV511_NUMFRAMES; i++) { - ov511->frame[i].grabstate = FRAME_UNUSED; - ov511->frame[i].data = ov511->fbuf + i * MAX_DATA_SIZE; - PDEBUG(4, "frame [%d] @ %p", i, ov511->frame[0].data); - - ov511->sbuf[i].data = kmalloc(FRAMES_PER_DESC * - MAX_FRAME_SIZE_PER_DESC, GFP_KERNEL); - if (!ov511->sbuf[i].data) { -open_free_ret: - while (--i) kfree(ov511->sbuf[i].data); - rvfree(ov511->fbuf, 2 * MAX_DATA_SIZE); - goto out; - } - PDEBUG(4, "sbuf[%d] @ %p", i, ov511->sbuf[i].data); - } - err = ov511_init_isoc(ov511); - if (err) - goto open_free_ret; + if (err) { + ov511_dealloc(ov511, 0); + goto out; + } ov511->user++; @@ -1878,7 +1965,6 @@ out: static void ov511_close(struct video_device *dev) { struct usb_ov511 *ov511 = (struct usb_ov511 *)dev; - int i; PDEBUG(4, "ov511_close"); @@ -1887,15 +1973,13 @@ static void ov511_close(struct video_device *dev) ov511_stop_isoc(ov511); - rvfree(ov511->fbuf, OV511_NUMFRAMES * MAX_DATA_SIZE); - for (i = 0; i < OV511_NUMFRAMES; i++) - kfree(ov511->sbuf[i].data); - + ov511_dealloc(ov511, 0); up(&ov511->lock); if (!ov511->dev) { video_unregister_device(&ov511->vdev); kfree(ov511); + ov511 = NULL; } MOD_DEC_USE_COUNT; @@ -2118,8 +2202,8 @@ static int ov511_ioctl(struct video_device *vdev, unsigned int cmd, void *arg) struct video_mbuf vm; memset(&vm, 0, sizeof(vm)); - vm.size = 2 * MAX_DATA_SIZE; - vm.frames = 2; + vm.size = OV511_NUMFRAMES * MAX_DATA_SIZE; + vm.frames = OV511_NUMFRAMES; vm.offsets[0] = 0; vm.offsets[1] = MAX_FRAME_SIZE + sizeof (struct timeval); @@ -2329,7 +2413,7 @@ restart: frame->bytes_read = 0; err("** ick! ** Errored frame %d", ov511->curframe); if (ov511_new_frame(ov511, frmx)) - err("ov511_read: ov511_new_frame error"); + err("read: ov511_new_frame error"); goto restart; } @@ -2531,15 +2615,24 @@ static int ov76xx_configure(struct usb_ov511 *ov511) /* Reset the 76xx */ if (ov511_i2c_write(dev, 0x12, 0x80) < 0) return -1; +#if 1 /* Maybe this will fix detection problems? MM */ + /* Wait for it to initialize */ + schedule_timeout (1 + 150 * HZ / 1000); +#endif + for (i = 0, success = 0; i < i2c_detect_tries && !success; i++) { if ((ov511_i2c_read(dev, OV7610_REG_ID_HIGH) == 0x7F) && - (ov511_i2c_read(dev, OV7610_REG_ID_LOW) == 0xA2)) + (ov511_i2c_read(dev, OV7610_REG_ID_LOW) == 0xA2)) { success = 1; + continue; + } - /* Dummy read to sync I2C */ - if (ov511_i2c_read(dev, 0x00) < 0) return -1; + /* Reset the 76xx */ + if (ov511_i2c_write(dev, 0x12, 0x80) < 0) return -1; /* Wait for it to initialize */ schedule_timeout (1 + 150 * HZ / 1000); + /* Dummy read to sync I2C */ + if (ov511_i2c_read(dev, 0x00) < 0) return -1; } if (success) { @@ -2647,8 +2740,9 @@ static int ov511_configure(struct usb_ov511 *ov511) memcpy(&ov511->vdev, &ov511_template, sizeof(ov511_template)); - init_waitqueue_head(&ov511->frame[0].wq); - init_waitqueue_head(&ov511->frame[1].wq); + for (i = 0; i < OV511_NUMFRAMES; i++) + init_waitqueue_head(&ov511->frame[i].wq); + init_waitqueue_head(&ov511->wq); if (video_register_device(&ov511->vdev, VFL_TYPE_GRABBER) == -1) { @@ -2790,6 +2884,8 @@ static void* ov511_probe(struct usb_device *dev, unsigned int ifnum) if (!ov511_configure(ov511)) { ov511->user = 0; init_MUTEX(&ov511->lock); /* to 1 == available */ + init_MUTEX(&ov511->buf_lock); + ov511->buf_state = BUF_NOT_ALLOCATED; } else { err("Failed to configure camera"); goto error; @@ -2812,6 +2908,7 @@ error: static void ov511_disconnect(struct usb_device *dev, void *ptr) { struct usb_ov511 *ov511 = (struct usb_ov511 *) ptr; + int n; MOD_INC_USE_COUNT; @@ -2823,38 +2920,37 @@ static void ov511_disconnect(struct usb_device *dev, void *ptr) &ov511->dev->actconfig->interface[ov511->iface]); ov511->dev = NULL; - ov511->frame[0].grabstate = FRAME_ERROR; - ov511->frame[1].grabstate = FRAME_ERROR; + for (n = 0; n < OV511_NUMFRAMES; n++) + ov511->frame[n].grabstate = FRAME_ERROR; + ov511->curframe = -1; /* This will cause the process to request another frame */ - if (waitqueue_active(&ov511->frame[0].wq)) - wake_up_interruptible(&ov511->frame[0].wq); - if (waitqueue_active(&ov511->frame[1].wq)) - wake_up_interruptible(&ov511->frame[1].wq); + for (n = 0; n < OV511_NUMFRAMES; n++) + if (waitqueue_active(&ov511->frame[n].wq)) + wake_up_interruptible(&ov511->frame[n].wq); if (waitqueue_active(&ov511->wq)) wake_up_interruptible(&ov511->wq); ov511->streaming = 0; /* Unschedule all of the iso td's */ - if (ov511->sbuf[1].urb) { - ov511->sbuf[1].urb->next = NULL; - usb_unlink_urb(ov511->sbuf[1].urb); - usb_free_urb(ov511->sbuf[1].urb); - ov511->sbuf[1].urb = NULL; - } - if (ov511->sbuf[0].urb) { - ov511->sbuf[0].urb->next = NULL; - usb_unlink_urb(ov511->sbuf[0].urb); - usb_free_urb(ov511->sbuf[0].urb); - ov511->sbuf[0].urb = NULL; + for (n = OV511_NUMSBUF - 1; n >= 0; n--) { + if (ov511->sbuf[n].urb) { + ov511->sbuf[n].urb->next = NULL; + usb_unlink_urb(ov511->sbuf[n].urb); + usb_free_urb(ov511->sbuf[n].urb); + ov511->sbuf[n].urb = NULL; + } } #if defined(CONFIG_PROC_FS) && defined(CONFIG_VIDEO_PROC_FS) destroy_proc_ov511_cam(ov511); #endif + /* FIXME - is this correct/safe? Should we acquire ov511->lock? */ + ov511_dealloc(ov511, 1); + /* Free the memory */ if (ov511 && !ov511->user) { kfree(ov511); @@ -2895,7 +2991,7 @@ static int __init usb_ov511_init(void) static void __exit usb_ov511_exit(void) { usb_deregister(&ov511_driver); - info("ov511 driver deregistered"); + info("driver deregistered"); #if defined(CONFIG_PROC_FS) && defined(CONFIG_VIDEO_PROC_FS) proc_ov511_destroy(); diff --git a/drivers/usb/ov511.h b/drivers/usb/ov511.h index 92827afb3..f4499b2be 100644 --- a/drivers/usb/ov511.h +++ b/drivers/usb/ov511.h @@ -171,9 +171,7 @@ if (debug >= level) info("[" __PRETTY_FUNCTION__ ":%d] " fmt, __LINE__ , ## args #define OV7610_REG_COM_K 0x38 /* misc registers */ -#define STREAM_BUF_SIZE (PAGE_SIZE * 4) - -#define SCRATCH_BUF_SIZE 384 +#define SCRATCH_BUF_SIZE 512 #define FRAMES_PER_DESC 10 /* FIXME - What should this be? */ #define FRAME_SIZE_PER_DESC 993 /* FIXME - Deprecated */ @@ -213,6 +211,13 @@ enum { STATE_LINES, /* Parsing lines */ }; +/* Buffer states */ +enum { + BUF_NOT_ALLOCATED, + BUF_ALLOCATED, + BUF_PEND_DEALLOC, /* ov511->buf_timer is set */ +}; + struct usb_device; struct ov511_sbuf { @@ -324,6 +329,11 @@ struct usb_ov511 { /* proc interface */ struct semaphore param_lock; /* params lock for this camera */ struct proc_dir_entry *proc_entry; /* /proc/ov511/videoX */ + + /* Framebuffer/sbuf management */ + int buf_state; + struct semaphore buf_lock; + struct timer_list buf_timer; }; struct cam_list { |