Convert most of the rest of the devices to net_device_ops
Subsystems (14)
PATCH 3/77 infiniband: convert c2 to net_device_ops
In reply to Stephen HemmingerConvert this driver to new net_device_ops infrastructure. Also use default net_device get-stats infrastructure
--- drivers/infiniband/hw/amso1100/c2.c | 41 ++++++++++++--------------- drivers/infiniband/hw/amso1100/c2.h | 2 - drivers/infiniband/hw/amso1100/c2_provider.c | 22 +++++++------- 3 files changed, 30 insertions(+), 35 deletions(-)
drivers/infiniband/hw/amso1100/c2.c +19 -22
@@ -76,7 +76,6 @@ static irqreturn_t c2_interrupt(int irq,static void c2_tx_timeout (struct net_device *netdev);static int c2_change_mtu (struct net_device *netdev,int new_mtu);static void c2_reset (struct c2_port *c2_port); -static struct net_device_stats *c2_get_stats (struct net_device *netdev);static struct pci_device_id c2_pci_table[] = { {PCI_DEVICE (0x18b8 ,0xb001 ) },
@@ -349,7 +348,7 @@ static void c2_tx_clean(struct c2_port * elem->hw_desc + C2_TXP_ADDR);__raw_writew ((__force u16 )cpu_to_be16 (TXP_HTXD_DONE ), elem->hw_desc +C2_TXP_FLAGS ); - c2_port->netstats.tx_dropped++; + c2_port->netdev->stats.tx_dropped++;break ; }else { __raw_writew(0,
@@ -457,7 +456,7 @@ static void c2_rx_error(struct c2_port * elem->hw_desc + C2_RXP_FLAGS);pr_debug ("packet dropped\n" ); - c2_port->netstats.rx_dropped++; + c2_port->netdev->stats.rx_dropped++; }static void c2_rx_interrupt (struct net_device *netdev)
@@ -532,8 +531,8 @@ static void c2_rx_interrupt(struct net_dnetif_rx (skb); netdev->last_rx = jiffies; - c2_port->netstats.rx_packets++; - c2_port->netstats.rx_bytes += buflen; + netdev->stats.rx_packets++; + netdev->stats.rx_bytes += buflen; }/* Save where we left off */
@@ -797,8 +796,8 @@ static int c2_xmit_frame(struct sk_buff__raw_writew ((__force u16 )cpu_to_be16 (TXP_HTXD_READY ), elem->hw_desc +C2_TXP_FLAGS ); - c2_port->netstats.tx_packets++; - c2_port->netstats.tx_bytes += maplen; + netdev->stats.tx_packets++; + netdev->stats.tx_bytes += maplen;/* Loop thru additional data fragments and queue them */ if (skb_shinfo (skb)->nr_frags) {
@@ -823,8 +822,8 @@ static int c2_xmit_frame(struct sk_buff__raw_writew ((__force u16 )cpu_to_be16 (TXP_HTXD_READY ), elem->hw_desc +C2_TXP_FLAGS ); - c2_port->netstats.tx_packets++; - c2_port->netstats.tx_bytes += maplen; + netdev->stats.tx_packets++; + netdev->stats.tx_bytes += maplen; } }
@@ -845,13 +844,6 @@ static int c2_xmit_frame(struct sk_buffreturn NETDEV_TX_OK ; } -static struct net_device_stats *c2_get_stats (struct net_device *netdev) -{ -struct c2_port *c2_port =netdev_priv (netdev); - -return &c2_port->netstats; -} -static void c2_tx_timeout (struct net_device *netdev) {struct c2_port *c2_port =netdev_priv (netdev);
@@ -880,6 +872,16 @@ static int c2_change_mtu(struct net_devireturn ret; } +static const struct net_device_ops c2_netdev = { + .ndo_open = c2_up, + .ndo_stop = c2_down, + .ndo_start_xmit = c2_xmit_frame, + .ndo_tx_timeout = c2_tx_timeout, + .ndo_change_mtu = c2_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +/* Initialize network device */ static struct net_device *c2_devinit (struct c2_dev *c2dev,void __iomem * mmio_addr)
@@ -894,12 +896,7 @@ static struct net_device *c2_devinit(strSET_NETDEV_DEV (netdev, &c2dev->pcidev->dev); - netdev->open = c2_up; - netdev->stop = c2_down; - netdev->hard_start_xmit = c2_xmit_frame; - netdev->get_stats = c2_get_stats; - netdev->tx_timeout = c2_tx_timeout; - netdev->change_mtu = c2_change_mtu; + netdev->netdev_ops = &c2_netdev; netdev->watchdog_timeo =C2_TX_TIMEOUT ; netdev->irq = c2dev->pcidev->irq;
drivers/infiniband/hw/amso1100/c2.h +0 -2
@@ -369,8 +369,6 @@ struct c2_port {unsigned long mem_size;u32 rx_buf_size; - -struct net_device_stats netstats; };/*
drivers/infiniband/hw/amso1100/c2_provider.c +11 -11
@@ -708,26 +708,27 @@ static int c2_pseudo_xmit_frame(struct sstatic int c2_pseudo_change_mtu (struct net_device *netdev,int new_mtu) { -int ret =0 ; -if (new_mtu <ETH_ZLEN || new_mtu >ETH_JUMBO_MTU )return -EINVAL ; netdev->mtu = new_mtu;/* TODO: Tell rnic about new rmda interface mtu */ -return ret; +return 0 ; } +static const struct net_device_ops c2_pseudo_netdev_ops = { + .ndo_open = c2_pseudo_up, + .ndo_stop = c2_pseudo_down, + .ndo_start_xmit = c2_pseudo_xmit_frame, + .ndo_change_mtu = c2_pseudo_change_mtu, + .ndo_validate_addr = eth_validate_addr, +}; +static void setup (struct net_device *netdev) { - netdev->open = c2_pseudo_up; - netdev->stop = c2_pseudo_down; - netdev->hard_start_xmit = c2_pseudo_xmit_frame; - netdev->get_stats =NULL ; - netdev->tx_timeout =NULL ; - netdev->set_mac_address =NULL ; - netdev->change_mtu = c2_pseudo_change_mtu; + netdev->netdev_ops = &c2_pseudo_netdev_ops; + netdev->watchdog_timeo =0 ; netdev->type =ARPHRD_ETHER ; netdev->mtu =1500 ;
@@ -735,7 +736,6 @@ static void setup(struct net_device *net netdev->addr_len =ETH_ALEN ; netdev->tx_queue_len =0 ; netdev->flags |=IFF_NOARP ; -return ; }static struct net_device *c2_pseudo_netdev_init (struct c2_dev *c2dev)
PATCH 4/77 infiniband: convert nes driver to net_device_ops
In reply to Stephen HemmingerAlso, removed unnecessary memset() sinc alloc_netdev returns zeroed memory.
--- drivers/infiniband/hw/nes/nes_nic.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)
drivers/infiniband/hw/nes/nes_nic.c +15 -12
@@ -1568,6 +1568,19 @@ static void nes_netdev_vlan_rx_register(spin_unlock_irqrestore (&nesadapter->phy_lock, flags); } +static const struct net_device_ops nes_netdev_ops = { + .ndo_open = nes_netdev_open, + .ndo_stop = nes_netdev_stop, + .ndo_start_xmit = nes_netdev_start_xmit, + .ndo_get_stats = nes_netdev_get_stats, + .ndo_tx_timeout = nes_netdev_tx_timeout, + .ndo_set_mac_address = nes_netdev_set_mac_address, + .ndo_set_multicast_list = nes_netdev_set_multicast_list, + .ndo_change_mtu = nes_netdev_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, + .ndo_vlan_rx_register = nes_netdev_vlan_rx_register, +};/** * nes_netdev_init - initialize network device
@@ -1593,17 +1606,6 @@ struct net_device *nes_netdev_init(strucSET_NETDEV_DEV (netdev, &nesdev->pcidev->dev); - nesvnic =netdev_priv (netdev); -memset (nesvnic,0 ,sizeof (*nesvnic)); - - netdev->open = nes_netdev_open; - netdev->stop = nes_netdev_stop; - netdev->hard_start_xmit = nes_netdev_start_xmit; - netdev->get_stats = nes_netdev_get_stats; - netdev->tx_timeout = nes_netdev_tx_timeout; - netdev->set_mac_address = nes_netdev_set_mac_address; - netdev->set_multicast_list = nes_netdev_set_multicast_list; - netdev->change_mtu = nes_netdev_change_mtu; netdev->watchdog_timeo =NES_TX_TIMEOUT ; netdev->irq = nesdev->pcidev->irq; netdev->mtu =ETH_DATA_LEN ;
@@ -1611,14 +1613,15 @@ struct net_device *nes_netdev_init(struc netdev->addr_len =ETH_ALEN ; netdev->type =ARPHRD_ETHER ; netdev->features =NETIF_F_HIGHDMA ; + netdev->netdev_ops = &nes_netdev_ops; netdev->ethtool_ops = &nes_ethtool_ops;netif_napi_add (netdev, &nesvnic->napi, nes_netdev_poll,128 );nes_debug (NES_DBG_INIT ,"Enabling VLAN Insert/Delete.\n" ); netdev->features |=NETIF_F_HW_VLAN_TX |NETIF_F_HW_VLAN_RX ; - netdev->vlan_rx_register = nes_netdev_vlan_rx_register; netdev->features |=NETIF_F_LLTX ;/* Fill in the port structure */ + nesvnic =netdev_priv (netdev); nesvnic->netdev = netdev; nesvnic->nesdev = nesdev; nesvnic->msg_enable =netif_msg_init (debug, default_msg);
PATCH 5/77 infiniband: convert ipoib to net_device_ops
In reply to Stephen Hemminger--- drivers/infiniband/ulp/ipoib/ipoib_main.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_main.c +11 -7
@@ -1016,18 +1016,22 @@ static void ipoib_lro_setup(struct ipoib priv->lro.lro_mgr.ip_summed_aggr =CHECKSUM_UNNECESSARY ; } +static const struct net_device_ops ipoib_netdev_ops = { + .ndo_open = ipoib_open, + .ndo_stop = ipoib_stop, + .ndo_change_mtu = ipoib_change_mtu, + .ndo_start_xmit = ipoib_start_xmit, + .ndo_tx_timeout = ipoib_timeout, + .ndo_set_multicast_list = ipoib_set_mcast_list, + .ndo_neigh_setup = ipoib_neigh_setup_dev, +}; +static void ipoib_setup (struct net_device *dev) {struct ipoib_dev_priv *priv =netdev_priv (dev); - dev->open = ipoib_open; - dev->stop = ipoib_stop; - dev->change_mtu = ipoib_change_mtu; - dev->hard_start_xmit = ipoib_start_xmit; - dev->tx_timeout = ipoib_timeout; + dev->netdev_ops = &ipoib_netdev_ops; dev->header_ops = &ipoib_header_ops; - dev->set_multicast_list = ipoib_set_mcast_list; - dev->neigh_setup = ipoib_neigh_setup_dev;ipoib_set_ethtool_ops (dev);
PATCH 55/77 netwave: convert to net_device_ops
In reply to Stephen HemmingerAlso get rid of unneeded cast
drivers/net/wireless/netwave_cs.c +13 -6
@@ -355,6 +355,17 @@ static struct iw_statistics *netwave_getreturn &priv->iw_stats; } +static const struct net_device_ops netwave_netdev_ops = { + .ndo_open = netwave_open, + .ndo_stop = netwave_close, + .ndo_start_xmit = netwave_start_xmit, + .ndo_set_multicast_list = set_multicast_list, + .ndo_tx_timeout = netwave_watchdog, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +/* * Function netwave_attach (void) *
@@ -403,16 +414,12 @@ static int netwave_probe(struct pcmcia_dspin_lock_init (&priv->spinlock);/* Netwave specific entries in the device structure */ - dev->hard_start_xmit = &netwave_start_xmit; - dev->set_multicast_list = &set_multicast_list; + dev->netdev_ops = &netwave_netdev_ops;/* wireless extensions */ - dev->wireless_handlers = (struct iw_handler_def *)&netwave_handler_def; + dev->wireless_handlers = &netwave_handler_def; - dev->tx_timeout = &netwave_watchdog; dev->watchdog_timeo =TX_TIMEOUT ; - dev->open = &netwave_open; - dev->stop = &netwave_close; link->irq.Instance = dev;return netwave_pcmcia_config ( link);
Signature · 4 lines
-- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 56/77 strip: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/wireless/strip.c +10 -8
@@ -2477,6 +2477,16 @@ static const struct header_ops strip_hea .rebuild = strip_rebuild_header, }; + +static const struct net_device_ops strip_netdev_ops = { + .ndo_open = strip_open_low, + .ndo_stop = strip_close_low, + .ndo_start_xmit = strip_xmit, + .ndo_set_mac_address = strip_set_mac_address, + .ndo_get_stats = strip_get_stats, + .ndo_change_mtu = strip_change_mtu, +}; +/* * This routine is called by DDI when the * (dynamically assigned) device is registered
@@ -2503,18 +2513,8 @@ static void strip_dev_setup(struct net_d dev->dev_addr[0 ] =0 ; dev->addr_len =sizeof (MetricomAddress); -/* -* Pointers to interface service routines. -*/ - - dev->open = strip_open_low; - dev->stop = strip_close_low; - dev->hard_start_xmit = strip_xmit; - dev->header_ops = &strip_header_ops;
PATCH 57/77 wavelan: convert to internal net_device_stats
In reply to Stephen Hemmingerdrivers/net/wireless/wavelan_cs.c +17 -33
@@ -1352,21 +1352,6 @@ wv_init_info(struct net_device * dev)* or wireless extensions */ -/*------------------------------------------------------------------*/ -/* -* Get the current ethernet statistics. This may be called with the -* card open or closed. -* Used when the user read /proc/net/dev -*/ -static en_stats * -wavelan_get_stats (struct net_device * dev) -{ -#ifdef DEBUG_IOCTL_TRACE -printk (KERN_DEBUG "%s: <>wavelan_get_stats()\n" , dev->name); -#endif - -return (&((net_local *)netdev_priv (dev))->stats); -}/*------------------------------------------------------------------*/ /*
@@ -2817,7 +2802,7 @@ wv_packet_read(struct net_device * dev,printk (KERN_INFO "%s: wv_packet_read(): could not alloc_skb(%d, GFP_ATOMIC)\n" , dev->name, sksize);#endif - lp->stats.rx_dropped++; + dev->stats.rx_dropped++;/* * Not only do we want to return here, but we also need to drop the * packet on the floor to clear the interrupt.
@@ -2877,8 +2862,8 @@ wv_packet_read(struct net_device * dev,netif_rx (skb);/* Keep stats up to date */ - lp->stats.rx_packets++; - lp->stats.rx_bytes += sksize; + dev->stats.rx_packets++; + dev->stats.rx_bytes += sksize;#ifdef DEBUG_RX_TRACE printk (KERN_DEBUG "%s: <-wv_packet_read()\n" , dev->name);
@@ -2980,13 +2965,13 @@ wv_packet_rcv(struct net_device * dev)/* Check status */ if ((status &RX_RCV_OK ) !=RX_RCV_OK ) { - lp->stats.rx_errors++; + dev->stats.rx_errors++;if (status &RX_NO_SFD ) - lp->stats.rx_frame_errors++; + dev->stats.rx_frame_errors++;if (status &RX_CRC_ERR ) - lp->stats.rx_crc_errors++; + dev->stats.rx_crc_errors++;if (status &RX_OVRRUN ) - lp->stats.rx_over_errors++; + dev->stats.rx_over_errors++;#ifdef DEBUG_RX_FAIL printk(KERN_DEBUG "%s: wv_packet_rcv(): packet not received ok, status = 0x%x\n",
@@ -3073,7 +3058,7 @@ wv_packet_write(struct net_device * dev, dev->trans_start = jiffies;/* Keep stats up to date */ - lp->stats.tx_bytes += length; + dev->stats.tx_bytes += length;spin_unlock_irqrestore (&lp->spinlock, flags);
@@ -4106,7 +4091,7 @@ wavelan_interrupt(int irq,printk (KERN_INFO "%s: wv_interrupt(): receive buffer overflow\n" , dev->name);#endif - lp->stats.rx_over_errors++; + dev->stats.rx_over_errors++; lp->overrunning =1 ; }
@@ -4155,7 +4140,7 @@ wavelan_interrupt(int irq,/* Check for possible errors */ if ((tx_status &TX_OK ) !=TX_OK ) { - lp->stats.tx_errors++; + dev->stats.tx_errors++;if (tx_status &TX_FRTL ) {
@@ -4170,14 +4155,14 @@ wavelan_interrupt(int irq,printk (KERN_DEBUG "%s: wv_interrupt(): DMA underrun\n" , dev->name);#endif - lp->stats.tx_aborted_errors++; + dev->stats.tx_aborted_errors++; }if (tx_status &TX_LOST_CTS ) {#ifdef DEBUG_TX_FAIL printk (KERN_DEBUG "%s: wv_interrupt(): no CTS\n" , dev->name);#endif - lp->stats.tx_carrier_errors++; + dev->stats.tx_carrier_errors++; }if (tx_status &TX_LOST_CRS ) {
@@ -4185,14 +4170,14 @@ wavelan_interrupt(int irq,printk (KERN_DEBUG "%s: wv_interrupt(): no carrier\n" , dev->name);#endif - lp->stats.tx_carrier_errors++; + dev->stats.tx_carrier_errors++; }if (tx_status &TX_HRT_BEAT ) {#ifdef DEBUG_TX_FAIL printk (KERN_DEBUG "%s: wv_interrupt(): heart beat\n" , dev->name);#endif - lp->stats.tx_heartbeat_errors++; + dev->stats.tx_heartbeat_errors++; }if (tx_status &TX_DEFER ) {
@@ -4216,14 +4201,14 @@ wavelan_interrupt(int irq,#endif if (!(tx_status &TX_NCOL_MASK )) { - lp->stats.collisions +=0x10 ; + dev->stats.collisions +=0x10 ; } } } }/* if(!(tx_status & TX_OK)) */ - lp->stats.collisions += (tx_status &TX_NCOL_MASK ); - lp->stats.tx_packets++; + dev->stats.collisions += (tx_status &TX_NCOL_MASK ); + dev->stats.tx_packets++;netif_wake_queue (dev);outb (CR0_INT_ACK |OP0_NOP ,LCCR (base));/* Acknowledge the interrupt */
@@ -4514,7 +4499,6 @@ wavelan_probe(struct pcmcia_device *p_de dev->open = &wavelan_open; dev->stop = &wavelan_close; dev->hard_start_xmit = &wavelan_packet_xmit; - dev->get_stats = &wavelan_get_stats; dev->set_multicast_list = &wavelan_set_multicast_list;#ifdef SET_MAC_ADDRESS dev->set_mac_address = &wavelan_set_mac_address;
drivers/net/wireless/wavelan_cs.p.h +0 -6
@@ -576,7 +576,6 @@ struct wavepoint_table/****************************** TYPES ******************************/ /* Shortcuts */ -typedef struct net_device_stats en_stats ;typedef struct iw_statistics iw_stats ;typedef struct iw_quality iw_qual ;typedef struct iw_freq iw_freq ;
@@ -592,8 +591,6 @@ typedef u_char mac_addr[WAVELAN_ADDR_SI* For each network interface, Linux keep data in two structure. "device" * keep the generic data (same format for everybody) and "net_local" keep * the additional specific data. -* Note that some of this specific data is in fact generic (en_stats, for -* example). */ struct net_local {
@@ -601,7 +598,6 @@ struct net_localstruct net_device * dev;/* Reverse link... */ spinlock_t spinlock;/* Serialize access to the hardware (SMP) */ struct pcmcia_device * link;/* pcmcia structure */ -en_stats stats;/* Ethernet interface statistics */ int nresets;/* Number of hw resets */ u_char configured;/* If it is configured */ u_char reconfig_82593;/* Need to reconfigure the controller */
@@ -694,8 +690,6 @@ static voidstatic void wv_init_info (struct net_device *);/* display startup info */ /* ------------------- IOCTL, STATS & RECONFIG ------------------- */ -static en_stats * -wavelan_get_stats (struct net_device *);/* Give stats /proc/net/dev */ static iw_stats *wavelan_get_wireless_stats (struct net_device *);/* ----------------------- PACKET RECEPTION ----------------------- */
Signature · 4 lines
-- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 60/77 atmel: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/wireless/atmel.c +13 -7
@@ -1495,6 +1495,17 @@ static int atmel_read_proc(char *page, creturn len; } +static const struct net_device_ops atmel_netdev_ops = { + .ndo_open = atmel_open, + .ndo_stop = atmel_close, + .ndo_change_mtu = atmel_change_mtu, + .ndo_set_mac_address = atmel_set_mac_address, + .ndo_start_xmit = start_tx, + .ndo_do_ioctl = atmel_ioctl, + .ndo_change_mtu = eth_change_mtu, + .ndo_validate_addr = eth_validate_addr, +}; + struct net_device *init_atmel_card(unsigned short irq, unsigned long port, const AtmelFWType fw_type, struct device *sys_dev,
@@ -1579,13 +1590,8 @@ struct net_device *init_atmel_card(unsig priv->management_timer.function = atmel_management_timer; priv->management_timer.data = (unsigned long ) dev; - dev->open = atmel_open; - dev->stop = atmel_close; - dev->change_mtu = atmel_change_mtu; - dev->set_mac_address = atmel_set_mac_address; - dev->hard_start_xmit = start_tx; - dev->wireless_handlers = (struct iw_handler_def *)&atmel_handler_def; - dev->do_ioctl = atmel_ioctl; + dev->netdev_ops = &atmel_netdev_ops; + dev->wireless_handlers = &atmel_handler_def; dev->irq = irq; dev->base_addr = port;
Signature · 4 lines
-- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 64/77 zd1201: convert to internal net_device_stats
In reply to Stephen Hemmingerdrivers/net/wireless/zd1201.c +10 -19
@@ -328,8 +328,8 @@ static void zd1201_usbrx(struct urb *urbmemcpy (skb_put (skb,2 ), &data[datalen-24 ],2 );memcpy (skb_put (skb, len), data, len); skb->protocol =eth_type_trans (skb, zd->dev); - zd->stats.rx_packets++; - zd->stats.rx_bytes += skb->len; + zd->dev->stats.rx_packets++; + zd->dev->stats.rx_bytes += skb->len;netif_rx (skb); goto resubmit; }
@@ -384,8 +384,8 @@ static void zd1201_usbrx(struct urb *urbmemcpy (skb_put (skb, len), data+8 , len); } skb->protocol =eth_type_trans (skb, zd->dev); - zd->stats.rx_packets++; - zd->stats.rx_bytes += skb->len; + zd->dev->stats.rx_packets++; + zd->dev->stats.rx_bytes += skb->len;netif_rx (skb); } resubmit:
@@ -787,7 +787,7 @@ static int zd1201_hard_start_xmit(structstruct urb *urb = zd->tx_urb;if (!zd->mac_enabled || zd->monitor) { - zd->stats.tx_dropped++; + dev->stats.tx_dropped++;kfree_skb (skb);return 0 ; }
@@ -817,12 +817,12 @@ static int zd1201_hard_start_xmit(struct err =usb_submit_urb (zd->tx_urb,GFP_ATOMIC );if (err) { - zd->stats.tx_errors++; + dev->stats.tx_errors++;netif_start_queue (dev);return err; } - zd->stats.tx_packets++; - zd->stats.tx_bytes += skb->len; + dev->stats.tx_packets++; + dev->stats.tx_bytes += skb->len; dev->trans_start = jiffies;kfree_skb (skb);
@@ -838,7 +838,7 @@ static void zd1201_tx_timeout(struct netdev_warn (&zd->usb->dev,"%s: TX timeout, shooting down urb\n" , dev->name);usb_unlink_urb (zd->tx_urb); - zd->stats.tx_errors++; + dev->stats.tx_errors++;/* Restart the timeout to quiet the watchdog: */ dev->trans_start = jiffies; }
@@ -861,13 +861,6 @@ static int zd1201_set_mac_address(structreturn zd1201_mac_reset (zd); } -static struct net_device_stats *zd1201_get_stats (struct net_device *dev) -{ -struct zd1201 *zd =netdev_priv (dev); - -return &zd->stats; -} -static struct iw_statistics *zd1201_get_wireless_stats (struct net_device *dev) {struct zd1201 *zd =netdev_priv (dev);
@@ -1778,9 +1771,7 @@ static int zd1201_probe(struct usb_inter dev->open = zd1201_net_open; dev->stop = zd1201_net_stop; - dev->get_stats = zd1201_get_stats; - dev->wireless_handlers = - (struct iw_handler_def *)&zd1201_iw_handlers; + dev->wireless_handlers = &zd1201_iw_handlers; dev->hard_start_xmit = zd1201_hard_start_xmit; dev->watchdog_timeo =ZD1201_TX_TIMEOUT ; dev->tx_timeout = zd1201_tx_timeout;
drivers/net/wireless/zd1201.h +0 -1
@@ -26,7 +26,6 @@ struct zd1201 {struct usb_device *usb;int removed;struct net_device *dev; -struct net_device_stats stats;struct iw_statistics iwstats;int endp_in;
Signature · 4 lines
-- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 65/77 zd1201: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/wireless/zd1201.c +13 -6
@@ -1717,6 +1717,18 @@ static const struct iw_handler_def zd120 .get_wireless_stats = zd1201_get_wireless_stats, }; +static const struct net_device_ops zd1201_netdev_ops = { + .ndo_open = zd1201_net_open, + .ndo_stop = zd1201_net_stop, + .ndo_start_xmit = zd1201_hard_start_xmit, + .ndo_tx_timeout = zd1201_tx_timeout, + .ndo_set_multicast_list = zd1201_set_multicast, + .ndo_set_mac_address = zd1201_set_mac_address, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +static int zd1201_probe (struct usb_interface *interface,const struct usb_device_id *id) {
@@ -1769,14 +1781,9 @@ static int zd1201_probe(struct usb_interif (err) goto err_start; - dev->open = zd1201_net_open; - dev->stop = zd1201_net_stop; + dev->netdev_ops = &zd1201_netdev_ops; dev->wireless_handlers = &zd1201_iw_handlers; - dev->hard_start_xmit = zd1201_hard_start_xmit; dev->watchdog_timeo =ZD1201_TX_TIMEOUT ; - dev->tx_timeout = zd1201_tx_timeout; - dev->set_multicast_list = zd1201_set_multicast; - dev->set_mac_address = zd1201_set_mac_address;strcpy (dev->name,"wlan%d" ); err = zd1201_getconfig(zd, ZD1201_RID_CNFOWNMACADDR,
Signature · 4 lines
-- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 66/77 mac80211_hwsim: convert to internal net_device_stats
In reply to Stephen Hemmingerdrivers/net/wireless/mac80211_hwsim.c +7 -1
@@ -739,10 +739,16 @@ static struct device_driver mac80211_hws .name = "mac80211_hwsim" }; +static const struct net_device_ops hwsim_netdev_ops = { + .ndo_start_xmit = hwsim_mon_xmit, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +};static void hwsim_mon_setup (struct net_device *dev) { - dev->hard_start_xmit = hwsim_mon_xmit; + dev->netdev_ops = &hwsim_netdev_ops; dev->destructor = free_netdev;ether_setup (dev); dev->tx_queue_len =0 ;
Signature · 4 lines
-- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 67/77 prism54: convert to net_device_ops
In reply to Stephen HemmingerAlso, make ethtool_ops const as it should be, and get rid of useless cast.
drivers/net/wireless/prism54/islpci_dev.c +16 -12
@@ -804,10 +804,23 @@ static void islpci_ethtool_get_drvinfo(sstrcpy (info->version,DRV_VERSION ); } -static struct ethtool_ops islpci_ethtool_ops = { +static const struct ethtool_ops islpci_ethtool_ops = { .get_drvinfo = islpci_ethtool_get_drvinfo, }; +static const struct net_device_ops islpci_netdev_ops = { + .ndo_open = islpci_open, + .ndo_stop = islpci_close, + .ndo_get_stats = islpci_statistics, + .ndo_do_ioctl = prism54_ioctl, + .ndo_start_xmit = islpci_eth_transmit, + .ndo_tx_timeout = islpci_eth_tx_timeout, + .ndo_set_mac_address = prism54_set_mac_address, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +struct net_device *islpci_setup (struct pci_dev *pdev) {
@@ -827,25 +840,16 @@ islpci_setup(struct pci_dev *pdev) ndev->irq = pdev->irq;/* initialize the function pointers */ - ndev->open = &islpci_open; - ndev->stop = &islpci_close; - ndev->get_stats = &islpci_statistics; - ndev->do_ioctl = &prism54_ioctl; - ndev->wireless_handlers = - (struct iw_handler_def *) &prism54_handler_def; + ndev->netdev_ops = &islpci_netdev_ops; + ndev->wireless_handlers = &prism54_handler_def; ndev->ethtool_ops = &islpci_ethtool_ops; - ndev->hard_start_xmit = &islpci_eth_transmit;/* ndev->set_multicast_list = &islpci_set_multicast_list; */ ndev->addr_len =ETH_ALEN ; - ndev->set_mac_address = &prism54_set_mac_address;/* Get a non-zero dummy MAC address for nameif. Jean II */ memcpy (ndev->dev_addr, dummy_mac,6 ); -#ifdef HAVE_TX_TIMEOUT ndev->watchdog_timeo =ISLPCI_TX_TIMEOUT ; - ndev->tx_timeout = &islpci_eth_tx_timeout; -#endif /* allocate a private device structure to the network device */ priv =netdev_priv (ndev);
Signature · 4 lines
-- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 68/77 prism54: convert to internal net_device_stats
In reply to Stephen HemmingerAlso, make ethtool_ops const as it should be, and get rid of useless cast.
--- drivers/net/wireless/prism54/islpci_dev.c | 14 -------------- drivers/net/wireless/prism54/islpci_dev.h | 3 --- drivers/net/wireless/prism54/islpci_eth.c | 13 ++++++------- 3 files changed, 6 insertions(+), 24 deletions(-)
drivers/net/wireless/prism54/islpci_dev.c +0 -14
@@ -43,7 +43,6 @@static int prism54_bring_down (islpci_private *);static int islpci_alloc_memory (islpci_private *); -static struct net_device_stats *islpci_statistics (struct net_device *);/* Temporary dummy MAC address to use until firmware is loaded. * The idea there is that some tools (such as nameif) may query
@@ -614,18 +613,6 @@ islpci_reset(islpci_private *priv, int rreturn rc; } -static struct net_device_stats * -islpci_statistics (struct net_device *ndev) -{ -islpci_private *priv =netdev_priv (ndev); - -#if VERBOSE >SHOW_ERROR_MESSAGES -DEBUG (SHOW_FUNCTION_CALLS ,"islpci_statistics\n" ); -#endif - -return &priv->statistics; -} -/****************************************************************************** Network device configuration functions ******************************************************************************/
@@ -811,7 +798,6 @@ static const struct ethtool_ops islpci_estatic const struct net_device_ops islpci_netdev_ops = { .ndo_open = islpci_open, .ndo_stop = islpci_close, - .ndo_get_stats = islpci_statistics, .ndo_do_ioctl = prism54_ioctl, .ndo_start_xmit = islpci_eth_transmit, .ndo_tx_timeout = islpci_eth_tx_timeout,
drivers/net/wireless/prism54/islpci_dev.h +0 -3
@@ -158,9 +158,6 @@ typedef struct {dma_addr_t pci_map_tx_address[ISL38XX_CB_TX_QSIZE ];dma_addr_t pci_map_rx_address[ISL38XX_CB_RX_QSIZE ]; -/* driver network interface members */ -struct net_device_stats statistics; -/* wait for a reset interrupt */ wait_queue_head_t reset_done;
drivers/net/wireless/prism54/islpci_eth.c +6 -7
@@ -231,8 +231,8 @@ islpci_eth_transmit(struct sk_buff *skb,/* set the transmission time */ ndev->trans_start = jiffies; - priv->statistics.tx_packets++; - priv->statistics.tx_bytes += skb->len; + ndev->stats.tx_packets++; + ndev->stats.tx_bytes += skb->len;/* trigger the device */ islpci_trigger (priv);
@@ -243,7 +243,7 @@ islpci_eth_transmit(struct sk_buff *skb,return 0 ; drop_free: - priv->statistics.tx_dropped++; + ndev->stats.tx_dropped++;spin_unlock_irqrestore (&priv->slock, flags);dev_kfree_skb (skb);return err;
@@ -408,8 +408,8 @@ islpci_eth_receive(islpci_private *priv) skb->protocol =eth_type_trans (skb, ndev); } skb->ip_summed =CHECKSUM_NONE ; - priv->statistics.rx_packets++; - priv->statistics.rx_bytes += size; + ndev->stats.rx_packets++; + ndev->stats.rx_bytes += size;/* deliver the skb to the network layer */ #ifdef ISLPCI_ETH_DEBUG
@@ -497,10 +497,9 @@ void islpci_eth_tx_timeout(struct net_device *ndev) {islpci_private *priv =netdev_priv (ndev); -struct net_device_stats *statistics = &priv->statistics;/* increment the transmit error counter */ - statistics->tx_errors++; + ndev->stats.tx_errors++;if (!priv->reset_task_pending) { printk(KERN_WARNING
Signature · 4 lines
-- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 69/77 libertas: convert to internal net_device_stats
In reply to Stephen Hemminger--- drivers/net/wireless/libertas/dev.h | 1 - drivers/net/wireless/libertas/if_cs.c | 2 +- drivers/net/wireless/libertas/main.c | 26 +------------------------- drivers/net/wireless/libertas/rx.c | 18 +++++++++--------- drivers/net/wireless/libertas/tx.c | 8 ++++---- drivers/net/wireless/libertas/wext.c | 2 +- 6 files changed, 16 insertions(+), 41 deletions(-)
drivers/net/wireless/libertas/dev.h +0 -1
@@ -109,7 +109,6 @@ struct lbs_private {void *card;struct net_device *dev; -struct net_device_stats stats;struct net_device *mesh_dev;/* Virtual device */ struct net_device *rtap_net_dev;
drivers/net/wireless/libertas/main.c +1 -25
@@ -582,20 +582,6 @@ void lbs_host_to_card_done(struct lbs_pr }EXPORT_SYMBOL_GPL (lbs_host_to_card_done); -/** -* @brief This function returns the network statistics -* -* @param dev A pointer to struct lbs_private structure -* @return A pointer to net_device_stats structure -*/ -static struct net_device_stats *lbs_get_stats (struct net_device *dev) -{ -struct lbs_private *priv = dev->ml_priv; - -lbs_deb_enter (LBS_DEB_NET ); -return &priv->stats; -} -static int lbs_set_mac_address (struct net_device *dev,void *addr) {int ret =0 ;
@@ -1201,7 +1187,7 @@ struct lbs_private *lbs_add_card(void *c dev->stop = lbs_eth_stop; dev->set_mac_address = lbs_set_mac_address; dev->tx_timeout = lbs_tx_timeout; - dev->get_stats = lbs_get_stats; + dev->watchdog_timeo =5 *HZ ; dev->ethtool_ops = &lbs_ethtool_ops;#ifdef WIRELESS_EXT
@@ -1443,7 +1429,6 @@ static int lbs_add_mesh(struct lbs_priva mesh_dev->open = lbs_dev_open; mesh_dev->hard_start_xmit = lbs_hard_start_xmit; mesh_dev->stop = lbs_mesh_stop; - mesh_dev->get_stats = lbs_get_stats; mesh_dev->set_mac_address = lbs_set_mac_address; mesh_dev->ethtool_ops = &lbs_ethtool_ops; memcpy(mesh_dev->dev_addr, priv->dev->dev_addr,
@@ -1648,14 +1633,6 @@ static int lbs_rtap_hard_start_xmit(strureturn NETDEV_TX_BUSY ; } -static struct net_device_stats *lbs_rtap_get_stats (struct net_device *dev) -{ -struct lbs_private *priv = dev->ml_priv; -lbs_deb_enter (LBS_DEB_NET ); -return &priv->stats; -} - -static void lbs_remove_rtap (struct lbs_private *priv) {lbs_deb_enter (LBS_DEB_MAIN );
@@ -1689,7 +1666,6 @@ static int lbs_add_rtap(struct lbs_priva rtap_dev->type =ARPHRD_IEEE80211_RADIOTAP ; rtap_dev->open = lbs_rtap_open; rtap_dev->stop = lbs_rtap_stop; - rtap_dev->get_stats = lbs_rtap_get_stats; rtap_dev->hard_start_xmit = lbs_rtap_hard_start_xmit; rtap_dev->ml_priv = priv;SET_NETDEV_DEV (rtap_dev, priv->dev->dev.parent);
drivers/net/wireless/libertas/if_cs.c +1 -1
@@ -421,7 +421,7 @@ static struct sk_buff *if_cs_receive_dat len =if_cs_read16 (priv->card,IF_CS_READ_LEN );if (len ==0 || len >MRVDRV_ETH_RX_PACKET_BUFFER_SIZE ) {lbs_pr_err ("card data buffer has invalid # of bytes (%d)\n" , len); - priv->stats.rx_dropped++; + priv->dev->stats.rx_dropped++; goto dat_err; }
drivers/net/wireless/libertas/rx.c +9 -9
@@ -168,7 +168,7 @@ int lbs_process_rxed_packet(struct lbs_pif (skb->len < (ETH_HLEN +8 +sizeof (struct rxpd ))) {lbs_deb_rx ("rx err: frame received with bad length\n" ); - priv->stats.rx_length_errors++; + dev->stats.rx_length_errors++; ret =0 ; goto done; }
@@ -179,7 +179,7 @@ int lbs_process_rxed_packet(struct lbs_pif (!(p_rx_pd->status &cpu_to_le16 (MRVDRV_RXPD_STATUS_OK ))) {lbs_deb_rx ("rx err: frame received with bad status\n" );lbs_pr_alert ("rxpd not ok\n" ); - priv->stats.rx_errors++; + dev->stats.rx_errors++; ret =0 ; goto done; }
@@ -243,8 +243,8 @@ int lbs_process_rxed_packet(struct lbs_plbs_compute_rssi (priv, p_rx_pd);lbs_deb_rx ("rx data: size of actual packet %d\n" , skb->len); - priv->stats.rx_bytes += skb->len; - priv->stats.rx_packets++; + dev->stats.rx_bytes += skb->len; + dev->stats.rx_packets++; skb->protocol =eth_type_trans (skb, dev);if (in_interrupt ())
@@ -311,7 +311,7 @@ static int process_rxed_802_11_packet(st struct sk_buff *skb) {int ret =0 ; - +struct net_device *dev = priv->dev;struct rx80211packethdr *p_rx_pkt;struct rxpd *prxpd;struct rx_radiotap_hdr radiotap_hdr;
@@ -326,7 +326,7 @@ static int process_rxed_802_11_packet(stif (skb->len < (ETH_HLEN +8 +sizeof (struct rxpd ))) {lbs_deb_rx ("rx err: frame received with bad length\n" ); - priv->stats.rx_length_errors++; + dev->stats.rx_length_errors++; ret = -EINVAL ;kfree_skb (skb); goto done;
@@ -337,7 +337,7 @@ static int process_rxed_802_11_packet(st*/ if (!(prxpd->status &cpu_to_le16 (MRVDRV_RXPD_STATUS_OK ))) {//lbs_deb_rx("rx err: frame received with bad status\n"); - priv->stats.rx_errors++; + dev->stats.rx_errors++; } lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n",
@@ -389,8 +389,8 @@ static int process_rxed_802_11_packet(stlbs_compute_rssi (priv, prxpd);lbs_deb_rx ("rx data: size of actual packet %d\n" , skb->len); - priv->stats.rx_bytes += skb->len; - priv->stats.rx_packets++; + dev->stats.rx_bytes += skb->len; + dev->stats.rx_packets++; skb->protocol =eth_type_trans (skb, priv->rtap_net_dev);netif_rx (skb);
drivers/net/wireless/libertas/tx.c +4 -4
@@ -82,8 +82,8 @@ int lbs_hard_start_xmit(struct sk_buff * skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE);/* We'll never manage to send this one; drop it and return 'OK' */ - priv->stats.tx_dropped++; - priv->stats.tx_errors++; + dev->stats.tx_dropped++; + dev->stats.tx_errors++; goto free; }
@@ -146,8 +146,8 @@ int lbs_hard_start_xmit(struct sk_buff *lbs_deb_tx ("%s lined up packet\n" , __func__); - priv->stats.tx_packets++; - priv->stats.tx_bytes += skb->len; + dev->stats.tx_packets++; + dev->stats.tx_bytes += skb->len; dev->trans_start = jiffies;
drivers/net/wireless/libertas/wext.c +1 -1
@@ -830,7 +830,7 @@ static struct iw_statistics *lbs_get_wir quality = rssi_qual;/* Quality by TX errors */ - priv->wstats.discard.retries = priv->stats.tx_errors; + priv->wstats.discard.retries = dev->stats.tx_errors;memset (&log,0 ,sizeof (log)); log.hdr.size =cpu_to_le16 (sizeof (log));
Signature · 4 lines
-- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 70/77 libertas: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/wireless/libertas/main.c +29 -16
@@ -1148,6 +1148,17 @@ static void lbs_free_adapter(struct lbs_lbs_deb_leave (LBS_DEB_MAIN ); } +static const struct net_device_ops lbs_netdev_ops = { + .ndo_open = lbs_dev_open, + .ndo_stop = lbs_eth_stop, + .ndo_start_xmit = lbs_hard_start_xmit, + .ndo_set_mac_address = lbs_set_mac_address, + .ndo_tx_timeout = lbs_tx_timeout, + .ndo_set_multicast_list = lbs_set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_validate_addr = eth_validate_addr, +}; +/** * @brief This function adds the card. it will probe the * card, allocate the lbs_priv and initialize the device.
@@ -1182,19 +1193,13 @@ struct lbs_private *lbs_add_card(void *c priv->infra_open =0 ;/* Setup the OS Interface to our functions */ - dev->open = lbs_dev_open; - dev->hard_start_xmit = lbs_hard_start_xmit; - dev->stop = lbs_eth_stop; - dev->set_mac_address = lbs_set_mac_address; - dev->tx_timeout = lbs_tx_timeout; - + dev->netdev_ops = &lbs_netdev_ops; dev->watchdog_timeo =5 *HZ ; dev->ethtool_ops = &lbs_ethtool_ops;#ifdef WIRELESS_EXT - dev->wireless_handlers = (struct iw_handler_def *)&lbs_handler_def; + dev->wireless_handlers = &lbs_handler_def;#endif dev->flags |=IFF_BROADCAST |IFF_MULTICAST ; - dev->set_multicast_list = lbs_set_multicast_list;SET_NETDEV_DEV (dev, dmdev);
@@ -1404,6 +1409,14 @@ out:EXPORT_SYMBOL_GPL (lbs_stop_card); +static const struct net_device_ops mesh_netdev_ops = { + .ndo_open = lbs_dev_open, + .ndo_stop = lbs_mesh_stop, + .ndo_start_xmit = lbs_hard_start_xmit, + .ndo_set_mac_address = lbs_set_mac_address, + .ndo_set_multicast_list = lbs_set_multicast_list, +}; +/** * @brief This function adds mshX interface *
@@ -1426,10 +1439,7 @@ static int lbs_add_mesh(struct lbs_priva mesh_dev->ml_priv = priv; priv->mesh_dev = mesh_dev; - mesh_dev->open = lbs_dev_open; - mesh_dev->hard_start_xmit = lbs_hard_start_xmit; - mesh_dev->stop = lbs_mesh_stop; - mesh_dev->set_mac_address = lbs_set_mac_address; + mesh_dev->netdev_ops = &mesh_netdev_ops; mesh_dev->ethtool_ops = &lbs_ethtool_ops;memcpy (mesh_dev->dev_addr, priv->dev->dev_addr,sizeof (priv->dev->dev_addr));
@@ -1440,7 +1450,6 @@ static int lbs_add_mesh(struct lbs_priva mesh_dev->wireless_handlers = (struct iw_handler_def *)&mesh_handler_def;#endif mesh_dev->flags |=IFF_BROADCAST |IFF_MULTICAST ; - mesh_dev->set_multicast_list = lbs_set_multicast_list;/* Register virtual mesh interface */ ret =register_netdev (mesh_dev);if (ret) {
@@ -1645,6 +1654,12 @@ out:lbs_deb_leave (LBS_DEB_MAIN ); } +static const struct net_device_ops rtap_netdev_ops = { + .ndo_open = lbs_rtap_open, + .ndo_stop = lbs_rtap_stop, + .ndo_start_xmit = lbs_rtap_hard_start_xmit, +}; +static int lbs_add_rtap (struct lbs_private *priv) {int ret =0 ;
@@ -1664,9 +1679,7 @@ static int lbs_add_rtap(struct lbs_privamemcpy (rtap_dev->dev_addr, priv->current_addr,ETH_ALEN ); rtap_dev->type =ARPHRD_IEEE80211_RADIOTAP ; - rtap_dev->open = lbs_rtap_open; - rtap_dev->stop = lbs_rtap_stop; - rtap_dev->hard_start_xmit = lbs_rtap_hard_start_xmit; + rtap_dev->netdev_ops = &rtap_netdev_ops; rtap_dev->ml_priv = priv;SET_NETDEV_DEV (rtap_dev, priv->dev->dev.parent);
Signature · 4 lines
-- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 72/77 ipw2x00: convert infrastructure for use by net_device_ops
In reply to Stephen HemmingerExpose routines so drivers can hook. Only set ptrs in netdev if using old compat code.
--- drivers/net/wireless/ipw2x00/ieee80211.h | 1 + drivers/net/wireless/ipw2x00/libipw_module.c | 5 ++++- drivers/net/wireless/ipw2x00/libipw_tx.c | 1 + 3 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/wireless/ipw2x00/libipw_module.c +4 -1
@@ -131,13 +131,14 @@ static void ieee80211_networks_initializ &ieee->network_free_list); } -static int ieee80211_change_mtu (struct net_device *dev,int new_mtu) +int ieee80211_change_mtu (struct net_device *dev,int new_mtu) {if ((new_mtu <68 ) || (new_mtu >IEEE80211_DATA_LEN ))return -EINVAL ; dev->mtu = new_mtu;return 0 ; } +EXPORT_SYMBOL (ieee80211_change_mtu);struct net_device *alloc_ieee80211 (int sizeof_priv) {
@@ -153,8 +154,10 @@ struct net_device *alloc_ieee80211(int s goto failed; } ieee =netdev_priv (dev); +#ifdef CONFIG_COMPAT_NET_DEV_OPS dev->hard_start_xmit = ieee80211_xmit; dev->change_mtu = ieee80211_change_mtu; +#endif ieee->dev = dev;
drivers/net/wireless/ipw2x00/ieee80211.h +1 -0
@@ -1016,6 +1016,7 @@ static inline int ieee80211_is_cck_rate(/* ieee80211.c */ extern void free_ieee80211 (struct net_device *dev);extern struct net_device *alloc_ieee80211 (int sizeof_priv); +extern int ieee80211_change_mtu (struct net_device *dev,int new_mtu);extern void ieee80211_networks_age (struct ieee80211_device *ieee,unsigned long age_secs);
drivers/net/wireless/ipw2x00/libipw_tx.c +1 -0
@@ -541,5 +541,6 @@ int ieee80211_xmit(struct sk_buff *skb, dev->stats.tx_errors++;return 1 ; } +EXPORT_SYMBOL (ieee80211_xmit);EXPORT_SYMBOL (ieee80211_txb_free);
Signature · 4 lines
-- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 75/77 hostap: convert to internal net_device_stats
In reply to Stephen HemmingerUse pre-existing net_device_stats in network_device struct.
--- drivers/net/wireless/hostap/hostap_80211_rx.c | 19 ++++++------------- drivers/net/wireless/hostap/hostap_ap.c | 2 +- drivers/net/wireless/hostap/hostap_hw.c | 12 ++++-------- drivers/net/wireless/hostap/hostap_main.c | 10 ---------- drivers/net/wireless/hostap/hostap_wlan.h | 1 - 5 files changed, 11 insertions(+), 33 deletions(-)
drivers/net/wireless/hostap/hostap_80211_rx.c +6 -13
@@ -207,13 +207,11 @@ hdr->f.status = s; hdr->f.len = l; hdr->static void monitor_rx (struct net_device *dev,struct sk_buff *skb,struct hostap_80211_rx_status *rx_stats) { -struct net_device_stats *stats;int len; len =prism2_rx_80211 (dev, skb, rx_stats,PRISM2_RX_MONITOR ); - stats =hostap_get_stats (dev); - stats->rx_packets++; - stats->rx_bytes += len; + dev->stats.rx_packets++; + dev->stats.rx_bytes += len; }
@@ -724,7 +722,6 @@ void hostap_80211_rx(struct net_device *size_t hdrlen;u16 fc, type, stype, sc;struct net_device *wds =NULL ; -struct net_device_stats *stats;unsigned int frag;u8 *payload;struct sk_buff *skb2 =NULL ;
@@ -748,7 +745,6 @@ void hostap_80211_rx(struct net_device * iface =netdev_priv (dev); hdr = (struct ieee80211_hdr *) skb->data; - stats =hostap_get_stats (dev);if (skb->len <10 ) goto rx_dropped;
@@ -866,10 +862,8 @@ void hostap_80211_rx(struct net_device *if (hostap_rx_frame_wds (local, hdr, fc, &wds)) goto rx_dropped; -if (wds) { +if (wds) skb->dev = dev = wds; - stats =hostap_get_stats (dev); - }if (local->iw_mode ==IW_MODE_MASTER && !wds && (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
@@ -878,7 +872,6 @@ void hostap_80211_rx(struct net_device * memcmp(hdr->addr2, local->assoc_ap_addr, ETH_ALEN) == 0) {/* Frame from BSSID of the AP for which we are a client */ skb->dev = dev = local->stadev; - stats =hostap_get_stats (dev); from_assoc_ap =1 ; }
@@ -1069,8 +1062,8 @@ void hostap_80211_rx(struct net_device *skb_trim (skb, skb->len -ETH_ALEN ); } - stats->rx_packets++; - stats->rx_bytes += skb->len; + dev->stats.rx_packets++; + dev->stats.rx_bytes += skb->len;if (local->iw_mode ==IW_MODE_MASTER && !wds && local->ap->bridge_packets) {
@@ -1115,7 +1108,7 @@ void hostap_80211_rx(struct net_device * rx_dropped:dev_kfree_skb (skb); - stats->rx_dropped++; + dev->stats.rx_dropped++; goto rx_exit; }
drivers/net/wireless/hostap/hostap_hw.c +4 -8
@@ -1682,7 +1682,7 @@ static int prism2_get_txfid_idx(local_inPDEBUG (DEBUG_EXTRA2 ,"prism2_get_txfid_idx: no room in txfid buf: " "packet dropped\n" ); - local->stats.tx_dropped++; + local->dev->stats.tx_dropped++;return -1 ; }
@@ -1787,11 +1787,9 @@ static int prism2_transmit(struct net_de prism2_transmit_cb, (long) idx);if (res) { -struct net_device_stats *stats;printk (KERN_DEBUG "%s: prism2_transmit: CMDCODE_TRANSMIT " "failed (res=%d)\n" , dev->name, res); - stats =hostap_get_stats (dev); - stats->tx_dropped++; + dev->stats.tx_dropped++;netif_wake_queue (dev);return -1 ; }
@@ -1939,12 +1937,10 @@ static void prism2_rx(local_info_t *locastruct net_device *dev = local->dev;int res, rx_pending =0 ;u16 len, hdr_len, rxfid, status, macport; -struct net_device_stats *stats;struct hfa384x_rx_frame rxdesc;struct sk_buff *skb =NULL ;prism2_callback (local,PRISM2_CALLBACK_RX_START ); - stats =hostap_get_stats (dev); rxfid =prism2_read_fid_reg (dev,HFA384X_RXFID_OFF );#ifndef final_version
@@ -2031,7 +2027,7 @@ static void prism2_rx(local_info_t *locareturn ; rx_dropped: - stats->rx_dropped++; + dev->stats.rx_dropped++;if (skb)dev_kfree_skb (skb); goto rx_exit;
@@ -2335,7 +2331,7 @@ static void prism2_txexc(local_info_t *lstruct hfa384x_tx_frame txdesc; show_dump = local->frame_dump &PRISM2_DUMP_TXEXC_HDR ; - local->stats.tx_errors++; + dev->stats.tx_errors++; res =hostap_tx_compl_read (local,1 , &txdesc, &payload);HFA384X_OUTW (HFA384X_EV_TXEXC ,HFA384X_EVACK_OFF );
drivers/net/wireless/hostap/hostap_main.c +0 -10
@@ -607,14 +607,6 @@ int hostap_80211_get_hdrlen(__le16 fc) } -struct net_device_stats *hostap_get_stats (struct net_device *dev) -{ -struct hostap_interface *iface; - iface =netdev_priv (dev); -return &iface->stats; -} - -static int prism2_close (struct net_device *dev) {struct hostap_interface *iface;
@@ -832,7 +824,6 @@ void hostap_setup_dev(struct net_deviceether_setup (dev);/* kernel callbacks */ - dev->get_stats = hostap_get_stats;if (iface) {/* Currently, we point to the proper spy_data only on * the main_dev. This could be fixed. Jean II */
@@ -1112,7 +1103,6 @@ EXPORT_SYMBOL(hostap_set_auth_algs);EXPORT_SYMBOL (hostap_dump_rx_header);EXPORT_SYMBOL (hostap_dump_tx_header);EXPORT_SYMBOL (hostap_80211_get_hdrlen); -EXPORT_SYMBOL (hostap_get_stats);EXPORT_SYMBOL (hostap_setup_dev);EXPORT_SYMBOL (hostap_set_multicast_list_queue);EXPORT_SYMBOL (hostap_set_hostapd);
drivers/net/wireless/hostap/hostap_wlan.h +0 -1
@@ -684,7 +684,6 @@ struct local_info {u16 channel_mask;/* mask of allowed channels */ u16 scan_channel_mask;/* mask of channels to be scanned */ struct comm_tallies_sums comm_tallies; -struct net_device_stats stats;struct proc_dir_entry *proc;int iw_mode;/* operating mode (IW_MODE_*) */ int pseudo_adhoc;/* 0: IW_MODE_ADHOC is real 802.11 compliant IBSS
drivers/net/wireless/hostap/hostap_ap.c +1 -1
@@ -2262,7 +2262,7 @@ void hostap_rx(struct net_device *dev, sif (skb->len <16 ) goto drop; - local->stats.rx_packets++; + dev->stats.rx_packets++; hdr = (struct ieee80211_hdr *) skb->data;
Signature · 4 lines
-- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
cover Convert most of the rest of the devices to net_device_ops
This patch series against net-next-2.6 fixes most of the remaining network devices to use net_device_ops. ALL ARE COMPILE TESTED ONLY.
PATCH 6/77 irda: net_device_ops ioctl fix
Need to reference net_device_ops not old pointer.
--- net/irda/irda_device.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/irda/irda_device.c +3 -2
@@ -149,13 +149,14 @@ int irda_device_is_receiving(struct net_IRDA_DEBUG (2 ,"%s()\n" , __func__); -if (!dev->do_ioctl) { +if (!dev->netdev_ops->ndo_do_ioctl) {IRDA_ERROR ("%s: do_ioctl not impl. by device driver\n" , __func__);return -1 ; } - ret = dev->do_ioctl (dev, (struct ifreq *) &req,SIOCGRECEIVING ); + ret = (dev->netdev_ops->ndo_do_ioctl)(dev, (struct ifreq *) &req, +SIOCGRECEIVING );if (ret <0 )return ret;
PATCH 7/77 irlan: convert to net_device_ops
In reply to Stephen Hemminger--- net/irda/irlan/irlan_eth.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
net/irda/irlan/irlan_eth.c +13 -6
@@ -45,6 +45,16 @@ static int irlan_eth_xmit(struct sk_bufstatic void irlan_eth_set_multicast_list (struct net_device *dev);static struct net_device_stats *irlan_eth_get_stats (struct net_device *dev); +static const struct net_device_ops irlan_eth_netdev_ops = { + .ndo_open = irlan_eth_open, + .ndo_stop = irlan_eth_close, + .ndo_start_xmit = irlan_eth_xmit, + .ndo_get_stats = irlan_eth_get_stats, + .ndo_set_multicast_list = irlan_eth_set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_validate_addr = eth_validate_addr, +}; +/* * Function irlan_eth_setup (dev) *
@@ -53,14 +63,11 @@ static struct net_device_stats *irlan_et*/ static void irlan_eth_setup (struct net_device *dev) { - dev->open = irlan_eth_open; - dev->stop = irlan_eth_close; - dev->hard_start_xmit = irlan_eth_xmit; - dev->get_stats = irlan_eth_get_stats; - dev->set_multicast_list = irlan_eth_set_multicast_list; +ether_setup (dev); + + dev->netdev_ops = &irlan_eth_netdev_ops; dev->destructor = free_netdev; -ether_setup (dev);/* * Lets do all queueing in IrTTP instead of this device driver.
PATCH 8/77 irda: convert irda_usb to net_device_ops
In reply to Stephen Hemminger--- drivers/net/irda/irda-usb.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/net/irda/irda-usb.c +10 -8
@@ -1401,6 +1401,14 @@ static inline void irda_usb_init_qos(str }/*------------------------------------------------------------------*/ +static const struct net_device_ops irda_usb_netdev_ops = { + .ndo_open = irda_usb_net_open, + .ndo_stop = irda_usb_net_close, + .ndo_do_ioctl = irda_usb_net_ioctl, + .ndo_start_xmit = irda_usb_hard_xmit, + .ndo_tx_timeout = irda_usb_net_timeout, +}; +/* * Initialise the network side of the irda-usb instance * Called when a new USB instance is registered in irda_usb_probe()
@@ -1411,15 +1419,9 @@ static inline int irda_usb_open(struct iIRDA_DEBUG (1 ,"%s()\n" , __func__); -irda_usb_init_qos (self); + netdev->netdev_ops = &irda_usb_netdev_ops; -/* Override the network functions we need to use */ - netdev->hard_start_xmit = irda_usb_hard_xmit; - netdev->tx_timeout = irda_usb_net_timeout; - netdev->watchdog_timeo =250 *HZ /1000 ;/* 250 ms > USB timeout */ - netdev->open = irda_usb_net_open; - netdev->stop = irda_usb_net_close; - netdev->do_ioctl = irda_usb_net_ioctl; +irda_usb_init_qos (self);return register_netdev (netdev); }
PATCH 9/77 irda: convert mcs driver to net_device_ops
In reply to Stephen Hemminger--- drivers/net/irda/mcs7780.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/net/irda/mcs7780.c +8 -5
@@ -873,6 +873,13 @@ static int mcs_hard_xmit(struct sk_buffreturn ret; } +static const struct net_device_ops mcs_netdev_ops = { + .ndo_open = mcs_net_open, + .ndo_stop = mcs_net_close, + .ndo_start_xmit = mcs_hard_xmit, + .ndo_do_ioctl = mcs_net_ioctl, +}; +/* * This function is called by the USB subsystem for each new device in the * system. Need to verify the device and if it is, then start handling it.
@@ -919,11 +926,7 @@ static int mcs_probe(struct usb_interfac/* Speed change work initialisation*/ INIT_WORK (&mcs->work, mcs_speed_work); -/* Override the network functions we need to use */ - ndev->hard_start_xmit = mcs_hard_xmit; - ndev->open = mcs_net_open; - ndev->stop = mcs_net_close; - ndev->do_ioctl = mcs_net_ioctl; + ndev->netdev_ops = &mcs_netdev_ops;if (!intf->cur_altsetting) goto error2;
PATCH 10/77 stir4200: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/irda/stir4200.c +8 -4
@@ -1007,6 +1007,13 @@ static int stir_net_ioctl(struct net_devreturn ret; } +static const struct net_device_ops stir_netdev_ops = { + .ndo_open = stir_net_open, + .ndo_stop = stir_net_close, + .ndo_start_xmit = stir_hard_xmit, + .ndo_do_ioctl = stir_net_ioctl, +}; +/* * This routine is called by the USB subsystem for each new device * in the system. We need to check if the device is ours, and in
@@ -1054,10 +1061,7 @@ static int stir_probe(struct usb_interfairda_qos_bits_to_value (&stir->qos);/* Override the network functions we need to use */ - net->hard_start_xmit = stir_hard_xmit; - net->open = stir_net_open; - net->stop = stir_net_close; - net->do_ioctl = stir_net_ioctl; + net->netdev_ops = &stir_netdev_ops; ret =register_netdev (net);if (ret !=0 )
PATCH 11/77 irda: convert w83977af_ir to net_device_ops
In reply to Stephen Hemmingerdrivers/net/irda/w83977af_ir.c +8 -5
@@ -140,6 +140,13 @@ static void __exit w83977af_cleanup(void } } +static const struct net_device_ops w83977_netdev_ops = { + .ndo_open = w83977af_net_open, + .ndo_stop = w83977af_net_close, + .ndo_start_xmit = w83977af_hard_xmit, + .ndo_do_ioctl = w83977af_net_ioctl, +}; +/* * Function w83977af_open (iobase, irq) *
@@ -231,11 +238,7 @@ static int w83977af_open(int i, unsigned self->rx_buff.data = self->rx_buff.head; self->netdev = dev; -/* Override the network functions we need to use */ - dev->hard_start_xmit = w83977af_hard_xmit; - dev->open = w83977af_net_open; - dev->stop = w83977af_net_close; - dev->do_ioctl = w83977af_net_ioctl; + dev->netdev_ops = &w83977_netdev_ops; err =register_netdev (dev);if (err) {
PATCH 12/77 irda: convert nsc_ircc driver to net_device_ops
In reply to Stephen Hemmingerdrivers/net/irda/nsc-ircc.c +17 -6
@@ -331,6 +331,20 @@ static void __exit nsc_ircc_cleanup(void pnp_registered =0 ; } +static const struct net_device_ops nsc_ircc_sir_ops = { + .ndo_open = nsc_ircc_net_open, + .ndo_stop = nsc_ircc_net_close, + .ndo_start_xmit = nsc_ircc_hard_xmit_sir, + .ndo_do_ioctl = nsc_ircc_net_ioctl, +}; + +static const struct net_device_ops nsc_ircc_fir_ops = { + .ndo_open = nsc_ircc_net_open, + .ndo_stop = nsc_ircc_net_close, + .ndo_start_xmit = nsc_ircc_hard_xmit_fir, + .ndo_do_ioctl = nsc_ircc_net_ioctl, +}; +/* * Function nsc_ircc_open (iobase, irq) *
@@ -441,10 +455,7 @@ static int __init nsc_ircc_open(chipio_t self->tx_fifo.tail = self->tx_buff.head;/* Override the network functions we need to use */ - dev->hard_start_xmit = nsc_ircc_hard_xmit_sir; - dev->open = nsc_ircc_net_open; - dev->stop = nsc_ircc_net_close; - dev->do_ioctl = nsc_ircc_net_ioctl; + dev->netdev_ops = &nsc_ircc_sir_ops; err =register_netdev (dev);if (err) {
@@ -1320,12 +1331,12 @@ static __u8 nsc_ircc_change_speed(structswitch_bank (iobase,BANK0 );if (speed >115200 ) {/* Install FIR xmit handler */ - dev->hard_start_xmit = nsc_ircc_hard_xmit_fir; + dev->netdev_ops = &nsc_ircc_fir_ops; ier =IER_SFIF_IE ;nsc_ircc_dma_receive (self); }else {/* Install SIR xmit handler */ - dev->hard_start_xmit = nsc_ircc_hard_xmit_sir; + dev->netdev_ops = &nsc_ircc_sir_ops; ier =IER_RXHDL_IE ; }/* Set our current interrupt mask */
PATCH 13/77 irda: convert ali driver to net_device_ops
In reply to Stephen Hemminger--- drivers/net/irda/ali-ircc.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/net/irda/ali-ircc.c +17 -6
@@ -259,6 +259,20 @@ static void __exit ali_ircc_cleanup(voidIRDA_DEBUG (2 ,"%s(), ----------------- End -----------------\n" , __func__); } +static const struct net_device_ops ali_ircc_sir_ops = { + .ndo_open = ali_ircc_net_open, + .ndo_stop = ali_ircc_net_close, + .ndo_start_xmit = ali_ircc_sir_hard_xmit, + .ndo_do_ioctl = ali_ircc_net_ioctl, +}; + +static const struct net_device_ops ali_ircc_fir_ops = { + .ndo_open = ali_ircc_net_open, + .ndo_stop = ali_ircc_net_close, + .ndo_start_xmit = ali_ircc_fir_hard_xmit, + .ndo_do_ioctl = ali_ircc_net_ioctl, +}; +/* * Function ali_ircc_open (int i, chipio_t *inf) *
@@ -361,10 +375,7 @@ static int ali_ircc_open(int i, chipio_t self->tx_fifo.tail = self->tx_buff.head;/* Override the network functions we need to use */ - dev->hard_start_xmit = ali_ircc_sir_hard_xmit; - dev->open = ali_ircc_net_open; - dev->stop = ali_ircc_net_close; - dev->do_ioctl = ali_ircc_net_ioctl; + dev->netdev_ops = &ali_ircc_sir_ops; err =register_netdev (dev);if (err) {
@@ -974,7 +985,7 @@ static void ali_ircc_change_speed(structali_ircc_fir_change_speed (self, baud);/* Install FIR xmit handler*/ - dev->hard_start_xmit = ali_ircc_fir_hard_xmit; + dev->netdev_ops = &ali_ircc_fir_ops;/* Enable Interuupt */ self->ier =IER_EOM ;// benjamin 2000/11/20 07:24PM
@@ -988,7 +999,7 @@ static void ali_ircc_change_speed(structali_ircc_sir_change_speed (self, baud);/* Install SIR xmit handler*/ - dev->hard_start_xmit = ali_ircc_sir_hard_xmit; + dev->netdev_ops = &ali_ircc_sir_ops; }
PATCH 14/77 irda: convert vlsi driver to net_device_ops
In reply to Stephen Hemminger--- drivers/net/irda/vlsi_ir.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/irda/vlsi_ir.c +9 -5
@@ -1573,6 +1573,14 @@ static int vlsi_close(struct net_devicereturn 0 ; } +static const struct net_device_ops vlsi_netdev_ops = { + .ndo_open = vlsi_open, + .ndo_stop = vlsi_close, + .ndo_start_xmit = vlsi_hard_start_xmit, + .ndo_do_ioctl = vlsi_ioctl, + .ndo_tx_timeout = vlsi_tx_timeout, +}; +static int vlsi_irda_init (struct net_device *ndev) {vlsi_irda_dev_t *idev =netdev_priv (ndev);
@@ -1608,11 +1616,7 @@ static int vlsi_irda_init(struct net_dev ndev->flags |=IFF_PORTSEL |IFF_AUTOMEDIA ; ndev->if_port =IF_PORT_UNKNOWN ; - ndev->open = vlsi_open; - ndev->stop = vlsi_close; - ndev->hard_start_xmit = vlsi_hard_start_xmit; - ndev->do_ioctl = vlsi_ioctl; - ndev->tx_timeout = vlsi_tx_timeout; + ndev->netdev_ops = &vlsi_netdev_ops; ndev->watchdog_timeo =500 *HZ /1000 ;/* max. allowed turn time for IrLAP */ SET_NETDEV_DEV (ndev, &pdev->dev);
PATCH 15/77 irda: convert smsc driver to net_device_ops
In reply to Stephen Hemminger--- drivers/net/irda/smsc-ircc2.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-)
drivers/net/irda/smsc-ircc2.c +21 -9
@@ -486,6 +486,26 @@ static int __init smsc_ircc_init(void)return ret; } +static int smsc_ircc_net_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct smsc_ircc_cb *self =netdev_priv (dev); + +if (self->io.speed >115200 ) +return smsc_ircc_hard_xmit_fir (skb, dev); +else +return smsc_ircc_hard_xmit_sir (skb, dev); +} + +static const struct net_device_ops smsc_ircc_netdev_ops = { + .ndo_open = smsc_ircc_net_open, + .ndo_stop = smsc_ircc_net_close, + .ndo_do_ioctl = smsc_ircc_net_ioctl, + .ndo_start_xmit = smsc_ircc_net_xmit, +#if SMSC_IRCC2_C_NET_TIMEOUT + .ndo_tx_timeout = smsc_ircc_timeout, +#endif +}; +/* * Function smsc_ircc_open (firbase, sirbase, dma, irq) *
@@ -519,14 +539,10 @@ static int __init smsc_ircc_open(unsigne goto err_out1; } - dev->hard_start_xmit = smsc_ircc_hard_xmit_sir;#if SMSC_IRCC2_C_NET_TIMEOUT - dev->tx_timeout = smsc_ircc_timeout; dev->watchdog_timeo =HZ *2 ;/* Allow enough time for speed change */ #endif - dev->open = smsc_ircc_net_open; - dev->stop = smsc_ircc_net_close; - dev->do_ioctl = smsc_ircc_net_ioctl; + dev->netdev_ops = &smsc_ircc_netdev_ops; self =netdev_priv (dev); self->netdev = dev;
@@ -995,9 +1011,6 @@ static void smsc_ircc_fir_start(struct s/* Reset everything */ -/* Install FIR transmit handler */ - dev->hard_start_xmit = smsc_ircc_hard_xmit_fir; -/* Clear FIFO */ outb (inb (fir_base +IRCC_LCR_A ) |IRCC_LCR_A_FIFO_RESET , fir_base +IRCC_LCR_A );
@@ -1894,7 +1907,6 @@ static void smsc_ircc_sir_start(struct s IRDA_ASSERT(self != NULL, return;); dev = self->netdev; IRDA_ASSERT(dev != NULL, return;); - dev->hard_start_xmit = &smsc_ircc_hard_xmit_sir; fir_base = self->io.fir_base; sir_base = self->io.sir_base;
PATCH 16/77 irda: convert via-ircc to net_device_ops
In reply to Stephen Hemminger--- drivers/net/irda/via-ircc.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/net/irda/via-ircc.c +16 -6
@@ -310,6 +310,19 @@ static void __exit via_ircc_cleanup(voidpci_unregister_driver (&via_driver); } +static const struct net_device_ops via_ircc_sir_ops = { + .ndo_start_xmit = via_ircc_hard_xmit_sir, + .ndo_open = via_ircc_net_open, + .ndo_stop = via_ircc_net_close, + .ndo_do_ioctl = via_ircc_net_ioctl, +}; +static const struct net_device_ops via_ircc_fir_ops = { + .ndo_start_xmit = via_ircc_hard_xmit_fir, + .ndo_open = via_ircc_net_open, + .ndo_stop = via_ircc_net_close, + .ndo_do_ioctl = via_ircc_net_ioctl, +}; +/* * Function via_ircc_open (iobase, irq) *
@@ -428,10 +441,7 @@ static __devinit int via_ircc_open(int i self->tx_fifo.tail = self->tx_buff.head;/* Override the network functions we need to use */ - dev->hard_start_xmit = via_ircc_hard_xmit_sir; - dev->open = via_ircc_net_open; - dev->stop = via_ircc_net_close; - dev->do_ioctl = via_ircc_net_ioctl; + dev->netdev_ops = &via_ircc_sir_ops; err =register_netdev (dev);if (err)
@@ -798,11 +808,11 @@ static void via_ircc_change_speed(structif (speed >115200 ) {/* Install FIR xmit handler */ - dev->hard_start_xmit = via_ircc_hard_xmit_fir; + dev->netdev_ops = &via_ircc_fir_ops;via_ircc_dma_receive (self); }else {/* Install SIR xmit handler */ - dev->hard_start_xmit = via_ircc_hard_xmit_sir; + dev->netdev_ops = &via_ircc_sir_ops; }netif_wake_queue (dev); }
PATCH 17/77 irda: convert sir device to net_device_ops
In reply to Stephen Hemmingerdrivers/net/irda/sir_dev.c +7 -4
@@ -865,6 +865,12 @@ out:return 0 ; } +static const struct net_device_ops sirdev_ops = { + .ndo_start_xmit = sirdev_hard_xmit, + .ndo_open = sirdev_open, + .ndo_stop = sirdev_close, + .ndo_do_ioctl = sirdev_ioctl, +};/* ----------------------------------------------------------------------------- */ struct sir_dev *sirdev_get_instance (const struct sir_driver *drv,const char *name)
@@ -908,10 +914,7 @@ struct sir_dev * sirdev_get_instance(con dev->netdev = ndev;/* Override the network functions we need to use */ - ndev->hard_start_xmit = sirdev_hard_xmit; - ndev->open = sirdev_open; - ndev->stop = sirdev_close; - ndev->do_ioctl = sirdev_ioctl; + ndev->netdev_ops = &sirdev_ops;if (register_netdev (ndev)) {IRDA_ERROR ("%s(), register_netdev() failed!\n" , __func__);
PATCH 18/77 irda: convert kignsun device to net_device_ops
In reply to Stephen Hemmingerdrivers/net/irda/kingsun-sir.c +7 -4
@@ -418,6 +418,12 @@ static int kingsun_net_ioctl(struct net_return ret; } +static const struct net_device_ops kingsun_ops = { + .ndo_start_xmit = kingsun_hard_xmit, + .ndo_open = kingsun_net_open, + .ndo_stop = kingsun_net_close, + .ndo_do_ioctl = kingsun_net_ioctl, +};/* * This routine is called by the USB subsystem for each new device
@@ -520,10 +526,7 @@ static int kingsun_probe(struct usb_inteirda_qos_bits_to_value (&kingsun->qos);/* Override the network functions we need to use */ - net->hard_start_xmit = kingsun_hard_xmit; - net->open = kingsun_net_open; - net->stop = kingsun_net_close; - net->do_ioctl = kingsun_net_ioctl; + net->netdev_ops = &kingsun_ops; ret =register_netdev (net);if (ret !=0 )
PATCH 19/77 irda: convert ksdazzle device to net_device_ops
In reply to Stephen Hemmingerdrivers/net/irda/ksdazzle-sir.c +8 -4
@@ -562,6 +562,13 @@ static int ksdazzle_net_ioctl(struct netreturn ret; } +static const struct net_device_ops ksdazzle_ops = { + .ndo_start_xmit = ksdazzle_hard_xmit, + .ndo_open = ksdazzle_net_open, + .ndo_stop = ksdazzle_net_close, + .ndo_do_ioctl = ksdazzle_net_ioctl, +}; +/* * This routine is called by the USB subsystem for each new device * in the system. We need to check if the device is ours, and in
@@ -684,10 +691,7 @@ static int ksdazzle_probe(struct usb_intirda_qos_bits_to_value (&kingsun->qos);/* Override the network functions we need to use */ - net->hard_start_xmit = ksdazzle_hard_xmit; - net->open = ksdazzle_net_open; - net->stop = ksdazzle_net_close; - net->do_ioctl = ksdazzle_net_ioctl; + net->netdev_ops = &ksdazzle_ops; ret =register_netdev (net);if (ret !=0 )
PATCH 20/77 irda: convert ks959 device to net_device_ops
In reply to Stephen Hemmingerdrivers/net/irda/ks959-sir.c +7 -4
@@ -668,6 +668,12 @@ static int ks959_net_ioctl(struct net_dereturn ret; } +static const struct net_device_ops ks959_ops = { + .ndo_start_xmit = ks959_hard_xmit, + .ndo_open = ks959_net_open, + .ndo_stop = ks959_net_close, + .ndo_do_ioctl = ks959_net_ioctl, +};/* * This routine is called by the USB subsystem for each new device * in the system. We need to check if the device is ours, and in
@@ -780,10 +786,7 @@ static int ks959_probe(struct usb_interfirda_qos_bits_to_value (&kingsun->qos);/* Override the network functions we need to use */ - net->hard_start_xmit = ks959_hard_xmit; - net->open = ks959_net_open; - net->stop = ks959_net_close; - net->do_ioctl = ks959_net_ioctl; + net->netdev_ops = &ks959_ops; ret =register_netdev (net);if (ret !=0 )
PATCH 22/77 usbnet: convert catc device to net_device_ops
In reply to Stephen Hemmingerdrivers/net/usb/catc.c +13 -5
@@ -743,6 +743,18 @@ static int catc_stop(struct net_device *return 0 ; } +static const struct net_device_ops catc_netdev_ops = { + .ndo_open = catc_open, + .ndo_stop = catc_stop, + .ndo_start_xmit = catc_start_xmit, + + .ndo_tx_timeout = catc_tx_timeout, + .ndo_set_multicast_list = catc_set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +/* * USB probe, disconnect. */
@@ -767,12 +779,8 @@ static int catc_probe(struct usb_interfa catc =netdev_priv (netdev); - netdev->open = catc_open; - netdev->hard_start_xmit = catc_hard_start_xmit; - netdev->stop = catc_stop; - netdev->tx_timeout = catc_tx_timeout; + netdev->netdev_ops = &catc_netdev_ops; netdev->watchdog_timeo =TX_TIMEOUT ; - netdev->set_multicast_list = catc_set_multicast_list;SET_ETHTOOL_OPS (netdev, &ops); catc->usbdev = usbdev;
PATCH 21/77 usbnet: convert catc to internal net_device_stats
In reply to Stephen Hemmingerdrivers/net/usb/catc.c +13 -21
@@ -163,7 +163,6 @@ struct catc {struct net_device *netdev;struct usb_device *usbdev; -struct net_device_stats stats;unsigned long flags;unsigned int tx_ptr, tx_idx;
@@ -245,8 +244,8 @@ static void catc_rx_done(struct urb *urbif (!catc->is_f5u011) { pkt_len =le16_to_cpup ((__le16 *)pkt_start);if (pkt_len > urb->actual_length) { - catc->stats.rx_length_errors++; - catc->stats.rx_errors++; + catc->netdev->stats.rx_length_errors++; + catc->netdev->stats.rx_errors++;break ; } }else {
@@ -262,8 +261,8 @@ static void catc_rx_done(struct urb *urb skb->protocol =eth_type_trans (skb, catc->netdev);netif_rx (skb); - catc->stats.rx_packets++; - catc->stats.rx_bytes += pkt_len; + catc->netdev->stats.rx_packets++; + catc->netdev->stats.rx_bytes += pkt_len;/* F5U011 only does one packet per RX */ if (catc->is_f5u011)
@@ -386,7 +385,7 @@ static void catc_tx_done(struct urb *urbdbg ("Tx Reset." ); urb->status =0 ; catc->netdev->trans_start = jiffies; - catc->stats.tx_errors++; + catc->netdev->stats.tx_errors++;clear_bit (TX_RUNNING , &catc->flags);netif_wake_queue (catc->netdev);return ;
@@ -412,7 +411,7 @@ static void catc_tx_done(struct urb *urbspin_unlock_irqrestore (&catc->tx_lock, flags); } -static int catc_hard_start_xmit (struct sk_buff *skb,struct net_device *netdev) +static int catc_start_xmit (struct sk_buff *skb,struct net_device *netdev) {struct catc *catc =netdev_priv (netdev);unsigned long flags;
@@ -443,8 +442,8 @@ static int catc_hard_start_xmit(struct sspin_unlock_irqrestore (&catc->tx_lock, flags);if (r >=0 ) { - catc->stats.tx_bytes += skb->len; - catc->stats.tx_packets++; + catc->netdev->stats.tx_bytes += skb->len; + catc->netdev->stats.tx_packets++; }dev_kfree_skb (skb);
@@ -588,15 +587,15 @@ static void catc_stats_done(struct catcswitch (index) {case TxSingleColl:case TxMultiColl: - catc->stats.collisions += data - last; + catc->netdev->stats.collisions += data - last;break ;case TxExcessColl: - catc->stats.tx_aborted_errors += data - last; - catc->stats.tx_errors += data - last; + catc->netdev->stats.tx_aborted_errors += data - last; + catc->netdev->stats.tx_errors += data - last;break ;case RxFramErr: - catc->stats.rx_frame_errors += data - last; - catc->stats.rx_errors += data - last; + catc->netdev->stats.rx_frame_errors += data - last; + catc->netdev->stats.rx_errors += data - last;break ; }
@@ -614,12 +613,6 @@ static void catc_stats_timer(unsigned lomod_timer (&catc->timer, jiffies +STATS_UPDATE ); } -static struct net_device_stats *catc_get_stats (struct net_device *netdev) -{ -struct catc *catc =netdev_priv (netdev); -return &catc->stats; -} -/* * Receive modes. Broadcast, Multicast, Promisc. */
@@ -777,7 +770,6 @@ static int catc_probe(struct usb_interfa netdev->open = catc_open; netdev->hard_start_xmit = catc_hard_start_xmit; netdev->stop = catc_stop; - netdev->get_stats = catc_get_stats; netdev->tx_timeout = catc_tx_timeout; netdev->watchdog_timeo =TX_TIMEOUT ; netdev->set_multicast_list = catc_set_multicast_list;
PATCH 23/77 usbnet: convert to internal net_device stats
In reply to Stephen Hemmingerdrivers/net/usb/rtl8150.c +11 -17
@@ -155,7 +155,6 @@ struct rtl8150 {unsigned long flags;struct usb_device *udev;struct tasklet_struct tl; -struct net_device_stats stats;struct net_device *netdev;struct urb *rx_urb, *tx_urb, *intr_urb, *ctrl_urb;struct sk_buff *tx_skb, *rx_skb;
@@ -463,8 +462,8 @@ static void read_bulk_callback(struct urskb_put (dev->rx_skb, pkt_len); dev->rx_skb->protocol =eth_type_trans (dev->rx_skb, netdev);netif_rx (dev->rx_skb); - dev->stats.rx_packets++; - dev->stats.rx_bytes += pkt_len; + netdev->stats.rx_packets++; + netdev->stats.rx_bytes += pkt_len;spin_lock (&dev->rx_pool_lock); skb =pull_skb (dev);
@@ -573,13 +572,13 @@ static void intr_callback(struct urb *ur d = urb->transfer_buffer;if (d[0 ] &TSR_ERRORS ) { - dev->stats.tx_errors++; + dev->netdev->stats.tx_errors++;if (d[INT_TSR ] & (TSR_ECOL |TSR_JBR )) - dev->stats.tx_aborted_errors++; + dev->netdev->stats.tx_aborted_errors++;if (d[INT_TSR ] &TSR_LCOL ) - dev->stats.tx_window_errors++; + dev->netdev->stats.tx_window_errors++;if (d[INT_TSR ] &TSR_LOSS_CRS ) - dev->stats.tx_carrier_errors++; + dev->netdev->stats.tx_carrier_errors++; }/* Report link status changes to the network stack */ if ((d[INT_MSR ] &MSR_LINK ) ==0 ) {
@@ -697,17 +696,12 @@ static void disable_net_traffic(rtl8150_set_registers (dev,CR ,1 , &cr); } -static struct net_device_stats *rtl8150_netdev_stats (struct net_device *dev) -{ -return &((rtl8150_t *)netdev_priv (dev))->stats; -} -static void rtl8150_tx_timeout (struct net_device *netdev) {rtl8150_t *dev =netdev_priv (netdev);dev_warn (&netdev->dev,"Tx timeout.\n" );usb_unlink_urb (dev->tx_urb); - dev->stats.tx_errors++; + netdev->stats.tx_errors++; }static void rtl8150_set_multicast (struct net_device *netdev)
@@ -747,12 +741,12 @@ static int rtl8150_start_xmit(struct sk_netif_device_detach (dev->netdev); else {dev_warn (&netdev->dev,"failed tx_urb %d\n" , res); - dev->stats.tx_errors++; + netdev->stats.tx_errors++;netif_start_queue (netdev); } }else { - dev->stats.tx_packets++; - dev->stats.tx_bytes += skb->len; + netdev->stats.tx_packets++; + netdev->stats.tx_bytes += skb->len; netdev->trans_start = jiffies; }
@@ -931,7 +925,7 @@ static int rtl8150_probe(struct usb_inte netdev->hard_start_xmit = rtl8150_start_xmit; netdev->set_multicast_list = rtl8150_set_multicast; netdev->set_mac_address = rtl8150_set_mac_address; - netdev->get_stats = rtl8150_netdev_stats; +SET_ETHTOOL_OPS (netdev, &ops); dev->intr_interval =100 ;/* 100ms */
PATCH 24/77 usbnet: convert rtl driver to net_device_ops
In reply to Stephen Hemmingerdrivers/net/usb/rtl8150.c +14 -8
@@ -891,6 +891,19 @@ static int rtl8150_ioctl(struct net_devireturn res; } +static const struct net_device_ops rtl8150_netdev_ops = { + .ndo_open = rtl8150_open, + .ndo_stop = rtl8150_close, + .ndo_do_ioctl = rtl8150_ioctl, + .ndo_start_xmit = rtl8150_start_xmit, + .ndo_tx_timeout = rtl8150_tx_timeout, + .ndo_set_multicast_list = rtl8150_set_multicast, + .ndo_set_mac_address = rtl8150_set_mac_address, + + .ndo_change_mtu = eth_change_mtu, + .ndo_validate_addr = eth_validate_addr, +}; +static int rtl8150_probe (struct usb_interface *intf,const struct usb_device_id *id) {
@@ -917,15 +930,8 @@ static int rtl8150_probe(struct usb_inte dev->udev = udev; dev->netdev = netdev; - netdev->open = rtl8150_open; - netdev->stop = rtl8150_close; - netdev->do_ioctl = rtl8150_ioctl; + netdev->netdev_ops = &rtl8150_netdev_ops; netdev->watchdog_timeo =RTL8150_TX_TIMEOUT ; - netdev->tx_timeout = rtl8150_tx_timeout; - netdev->hard_start_xmit = rtl8150_start_xmit; - netdev->set_multicast_list = rtl8150_set_multicast; - netdev->set_mac_address = rtl8150_set_mac_address; -SET_ETHTOOL_OPS (netdev, &ops); dev->intr_interval =100 ;/* 100ms */
PATCH 25/77 usbnet: convert hso driver to net_device_ops
In reply to Stephen Hemmingerdrivers/net/usb/hso.c +8 -4
@@ -2428,6 +2428,13 @@ static void hso_free_net_device(struct hkfree (hso_dev); } +static const struct net_device_ops hso_netdev_ops = { + .ndo_open = hso_net_open, + .ndo_stop = hso_net_close, + .ndo_start_xmit = hso_net_start_xmit, + .ndo_tx_timeout = hso_net_tx_timeout, +}; +/* initialize the network interface */ static void hso_net_init (struct net_device *net) {
@@ -2436,10 +2443,7 @@ static void hso_net_init(struct net_deviD1 ("sizeof hso_net is %d" , (int )sizeof (*hso_net));/* fill in the other fields */ - net->open = hso_net_open; - net->stop = hso_net_close; - net->hard_start_xmit = hso_net_start_xmit; - net->tx_timeout = hso_net_tx_timeout; + net->netdev_ops = &hso_netdev_ops; net->watchdog_timeo =HSO_NET_TX_TIMEOUT ; net->flags =IFF_POINTOPOINT |IFF_NOARP |IFF_MULTICAST ; net->type =ARPHRD_NONE ;
PATCH 26/77 usbnet: convert to internal net_device_stats
In reply to Stephen HemmingerDefault handler for net_device_stats already does same thing.
drivers/net/usb/usbnet.c +0 -9
@@ -249,14 +249,6 @@ static int usbnet_change_mtu (struct net/*-------------------------------------------------------------------------*/ -static struct net_device_stats *usbnet_get_stats (struct net_device *net) -{ -struct usbnet *dev =netdev_priv (net); -return &dev->stats; -} - -/*-------------------------------------------------------------------------*/ -/* some LK 2.4 HCDs oopsed if we freed or resubmitted urbs from * completion callbacks. 2.5 should have fixed those bugs... */
@@ -1180,7 +1172,6 @@ usbnet_probe (struct usb_interface *udev#endif net->change_mtu = usbnet_change_mtu; - net->get_stats = usbnet_get_stats; net->hard_start_xmit = usbnet_start_xmit; net->open = usbnet_open; net->stop = usbnet_stop;
PATCH 27/77 usbnet: support net_device_ops
In reply to Stephen HemmingerUse net_device_ops for usbnet device, and export for use by other derived drivers.
--- drivers/net/usb/usbnet.c | 31 +++++++++++++++++++++++-------- include/linux/usb/usbnet.h | 5 +++++ 2 files changed, 28 insertions(+), 8 deletions(-)
drivers/net/usb/usbnet.c +23 -8
@@ -223,7 +223,7 @@ EXPORT_SYMBOL_GPL(usbnet_skb_return);* *-------------------------------------------------------------------------*/ -static int usbnet_change_mtu (struct net_device *net,int new_mtu) +int usbnet_change_mtu (struct net_device *net,int new_mtu) {struct usbnet *dev =netdev_priv (net);int ll_mtu = new_mtu + net->hard_header_len;
@@ -246,6 +246,7 @@ static int usbnet_change_mtu (struct netreturn 0 ; } +EXPORT_SYMBOL_GPL (usbnet_change_mtu);/*-------------------------------------------------------------------------*/
@@ -540,7 +541,7 @@ EXPORT_SYMBOL_GPL(usbnet_unlink_rx_urbs)// precondition: never called in_interrupt -static int usbnet_stop (struct net_device *net) +int usbnet_stop (struct net_device *net) {struct usbnet *dev =netdev_priv (net);int temp;
@@ -584,6 +585,7 @@ static int usbnet_stop (struct net_devicreturn 0 ; } +EXPORT_SYMBOL_GPL (usbnet_stop);/*-------------------------------------------------------------------------*/
@@ -591,7 +593,7 @@ static int usbnet_stop (struct net_devic// precondition: never called in_interrupt -static int usbnet_open (struct net_device *net) +int usbnet_open (struct net_device *net) {struct usbnet *dev =netdev_priv (net);int retval;
@@ -666,6 +668,7 @@ done: done_nopm:return retval; } +EXPORT_SYMBOL_GPL (usbnet_open);/*-------------------------------------------------------------------------*/
@@ -900,7 +903,7 @@ static void tx_complete (struct urb *urb/*-------------------------------------------------------------------------*/ -static void usbnet_tx_timeout (struct net_device *net) +void usbnet_tx_timeout (struct net_device *net) {struct usbnet *dev =netdev_priv (net);
@@ -909,10 +912,11 @@ static void usbnet_tx_timeout (struct ne// FIXME: device recovery -- reset? } +EXPORT_SYMBOL_GPL (usbnet_tx_timeout);/*-------------------------------------------------------------------------*/ -static int usbnet_start_xmit (struct sk_buff *skb,struct net_device *net) +int usbnet_start_xmit (struct sk_buff *skb,struct net_device *net) {struct usbnet *dev =netdev_priv (net);int length;
@@ -995,7 +999,7 @@ drop: }return retval; } - +EXPORT_SYMBOL_GPL (usbnet_start_xmit);/*-------------------------------------------------------------------------*/
@@ -1102,6 +1106,15 @@ void usbnet_disconnect (struct usb_inter }EXPORT_SYMBOL_GPL (usbnet_disconnect); +static const struct net_device_ops usbnet_netdev_ops = { + .ndo_open = usbnet_open, + .ndo_stop = usbnet_stop, + .ndo_start_xmit = usbnet_start_xmit, + .ndo_tx_timeout = usbnet_tx_timeout, + .ndo_change_mtu = usbnet_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +};/*-------------------------------------------------------------------------*/
@@ -1171,12 +1184,14 @@ usbnet_probe (struct usb_interface *udev net->features |=NETIF_F_HIGHDMA ;#endif - net->change_mtu = usbnet_change_mtu; + net->netdev_ops = &usbnet_netdev_ops; +#ifdef CONFIG_COMPAT_NET_DEV_OPS net->hard_start_xmit = usbnet_start_xmit; net->open = usbnet_open; net->stop = usbnet_stop; - net->watchdog_timeo =TX_TIMEOUT_JIFFIES ; net->tx_timeout = usbnet_tx_timeout; +#endif + net->watchdog_timeo =TX_TIMEOUT_JIFFIES ; net->ethtool_ops = &usbnet_ethtool_ops;// allow device-specific bind/init procedures
include/linux/usb/usbnet.h +5 -0
@@ -176,6 +176,11 @@ struct skb_data { /* skb->cb is one of tsize_t length; }; +extern int usbnet_open (struct net_device *net); +extern int usbnet_stop (struct net_device *net); +extern int usbnet_start_xmit (struct sk_buff *skb,struct net_device *net); +extern void usbnet_tx_timeout (struct net_device *net); +extern int usbnet_change_mtu (struct net_device *net,int new_mtu);extern int usbnet_get_endpoints (struct usbnet *,struct usb_interface *);extern void usbnet_defer_kevent (struct usbnet *,int );
PATCH 28/77 usbnet: convert asix driver to net_device_ops
In reply to Stephen Hemmingerdrivers/net/usb/asix.c +40 -7
@@ -807,6 +807,18 @@ static int ax88172_link_reset(struct usbreturn 0 ; } +static const struct net_device_ops ax88172_netdev_ops = { + .ndo_open = usbnet_open, + .ndo_stop = usbnet_stop, + .ndo_start_xmit = usbnet_start_xmit, + .ndo_tx_timeout = usbnet_tx_timeout, + .ndo_change_mtu = usbnet_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = asix_ioctl, + .ndo_set_multicast_list = ax88172_set_multicast, +}; +static int ax88172_bind (struct usbnet *dev,struct usb_interface *intf) {int ret =0 ;
@@ -846,9 +858,8 @@ static int ax88172_bind(struct usbnet *d dev->mii.phy_id_mask =0x3f ; dev->mii.reg_num_mask =0x1f ; dev->mii.phy_id =asix_get_phy_addr (dev); - dev->net->do_ioctl = asix_ioctl; - dev->net->set_multicast_list = ax88172_set_multicast; + dev->net->netdev_ops = &ax88172_netdev_ops; dev->net->ethtool_ops = &ax88172_ethtool_ops;asix_mdio_write (dev->net, dev->mii.phy_id,MII_BMCR ,BMCR_RESET );
@@ -898,6 +909,18 @@ static int ax88772_link_reset(struct usbreturn 0 ; } +static const struct net_device_ops ax88772_netdev_ops = { + .ndo_open = usbnet_open, + .ndo_stop = usbnet_stop, + .ndo_start_xmit = usbnet_start_xmit, + .ndo_tx_timeout = usbnet_tx_timeout, + .ndo_change_mtu = usbnet_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = asix_ioctl, + .ndo_set_multicast_list = asix_set_multicast, +}; +static int ax88772_bind (struct usbnet *dev,struct usb_interface *intf) {int ret, embd_phy;
@@ -962,7 +985,6 @@ static int ax88772_bind(struct usbnet *d dev->mii.mdio_write = asix_mdio_write; dev->mii.phy_id_mask =0x1f ; dev->mii.reg_num_mask =0x1f ; - dev->net->do_ioctl = asix_ioctl; dev->mii.phy_id =asix_get_phy_addr (dev); phyid =asix_get_phyid (dev);
@@ -978,7 +1000,7 @@ static int ax88772_bind(struct usbnet *dmsleep (150 ); - dev->net->set_multicast_list = asix_set_multicast; + dev->net->netdev_ops = &ax88772_netdev_ops; dev->net->ethtool_ops = &ax88772_ethtool_ops;asix_mdio_write (dev->net, dev->mii.phy_id,MII_BMCR ,BMCR_RESET );
@@ -1181,6 +1203,18 @@ static int ax88178_change_mtu(struct netreturn 0 ; } +static const struct net_device_ops ax88178_netdev_ops = { + .ndo_open = usbnet_open, + .ndo_stop = usbnet_stop, + .ndo_start_xmit = usbnet_start_xmit, + .ndo_tx_timeout = usbnet_tx_timeout, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, + .ndo_set_multicast_list = asix_set_multicast, + .ndo_do_ioctl = asix_ioctl, + .ndo_change_mtu = ax88178_change_mtu, +}; +static int ax88178_bind (struct usbnet *dev,struct usb_interface *intf) {struct asix_data *data = (struct asix_data *)&dev->data;
@@ -1247,11 +1281,10 @@ static int ax88178_bind(struct usbnet *d dev->mii.phy_id_mask =0x1f ; dev->mii.reg_num_mask =0xff ; dev->mii.supports_gmii =1 ; - dev->net->do_ioctl = asix_ioctl; dev->mii.phy_id =asix_get_phy_addr (dev); - dev->net->set_multicast_list = asix_set_multicast; + + dev->net->netdev_ops = &ax88178_netdev_ops; dev->net->ethtool_ops = &ax88178_ethtool_ops; - dev->net->change_mtu = &ax88178_change_mtu; phyid =asix_get_phyid (dev);dbg ("PHYID=0x%08x" , phyid);
PATCH 29/77 usbnet: convert dms9601 driver to net_device_ops
In reply to Stephen Hemmingerdrivers/net/usb/dm9601.c +13 -3
@@ -419,6 +419,18 @@ static int dm9601_set_mac_address(structreturn 0 ; } +static const struct net_device_ops dm9601_netdev_ops = { + .ndo_open = usbnet_open, + .ndo_stop = usbnet_stop, + .ndo_start_xmit = usbnet_start_xmit, + .ndo_tx_timeout = usbnet_tx_timeout, + .ndo_change_mtu = usbnet_change_mtu, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = dm9601_ioctl, + .ndo_set_multicast_list = dm9601_set_multicast, + .ndo_set_mac_address = dm9601_set_mac_address, +}; +static int dm9601_bind (struct usbnet *dev,struct usb_interface *intf) {int ret;
@@ -428,9 +440,7 @@ static int dm9601_bind(struct usbnet *deif (ret) goto out; - dev->net->do_ioctl = dm9601_ioctl; - dev->net->set_multicast_list = dm9601_set_multicast; - dev->net->set_mac_address = dm9601_set_mac_address; + dev->net->netdev_ops = &dm9601_netdev_ops; dev->net->ethtool_ops = &dm9601_ethtool_ops; dev->net->hard_header_len +=DM_TX_OVERHEAD ; dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
PATCH 30/77 usbnet: convert msc7830 driver to net_device_ops
In reply to Stephen Hemmingerdrivers/net/usb/mcs7830.c +13 -3
@@ -486,6 +486,18 @@ static int mcs7830_set_mac_address(strucreturn 0 ; } +static const struct net_device_ops mcs7830_netdev_ops = { + .ndo_open = usbnet_open, + .ndo_stop = usbnet_stop, + .ndo_start_xmit = usbnet_start_xmit, + .ndo_tx_timeout = usbnet_tx_timeout, + .ndo_change_mtu = usbnet_change_mtu, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = mcs7830_ioctl, + .ndo_set_multicast_list = mcs7830_set_multicast, + .ndo_set_mac_address = mcs7830_set_mac_address, +}; +static int mcs7830_bind (struct usbnet *dev,struct usb_interface *udev) {struct net_device *net = dev->net;
@@ -495,11 +507,9 @@ static int mcs7830_bind(struct usbnet *dif (ret) goto out; - net->do_ioctl = mcs7830_ioctl; net->ethtool_ops = &mcs7830_ethtool_ops; - net->set_multicast_list = mcs7830_set_multicast; + net->netdev_ops = &mcs7830_netdev_ops;mcs7830_set_multicast (net); - net->set_mac_address = mcs7830_set_mac_address;/* reserve space for the status byte on rx */ dev->rx_urb_size =ETH_FRAME_LEN +1 ;
PATCH 31/77 usbnet: convert sms95xx driver to net_device_ops
In reply to Stephen Hemmingerdrivers/net/usb/smsc95xx.c +13 -2
@@ -1008,6 +1008,18 @@ static int smsc95xx_reset(struct usbnetreturn 0 ; } +static const struct net_device_ops smsc95xx_netdev_ops = { + .ndo_open = usbnet_open, + .ndo_stop = usbnet_stop, + .ndo_start_xmit = usbnet_start_xmit, + .ndo_tx_timeout = usbnet_tx_timeout, + .ndo_change_mtu = usbnet_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = smsc95xx_ioctl, + .ndo_set_multicast_list = smsc95xx_set_multicast, +}; +static int smsc95xx_bind (struct usbnet *dev,struct usb_interface *intf) {struct smsc95xx_priv *pdata =NULL ;
@@ -1038,9 +1050,8 @@ static int smsc95xx_bind(struct usbnet */* Init all registers */ ret =smsc95xx_reset (dev); - dev->net->do_ioctl = smsc95xx_ioctl; + dev->net->netdev_ops = &smsc95xx_netdev_ops; dev->net->ethtool_ops = &smsc95xx_ethtool_ops; - dev->net->set_multicast_list = smsc95xx_set_multicast; dev->net->flags |=IFF_MULTICAST ; dev->net->hard_header_len +=SMSC95XX_TX_OVERHEAD ;return 0 ;
PATCH 34/77 pcmcia: convert 3c589 to net_device_ops
In reply to Stephen Hemmingerdrivers/net/pcmcia/3c589_cs.c +15 -10
@@ -169,6 +169,19 @@ static void tc589_detach(struct pcmcia_d======================================================================*/ +static const struct net_device_ops el3_netdev_ops = { + .ndo_open = el3_open, + .ndo_stop = el3_close, + .ndo_start_xmit = el3_start_xmit, + .ndo_tx_timeout = el3_tx_timeout, + .ndo_set_config = el3_config, + .ndo_get_stats = el3_get_stats, + .ndo_set_multicast_list = set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +static int tc589_probe (struct pcmcia_device *link) {struct el3_private *lp;
@@ -195,17 +208,9 @@ static int tc589_probe(struct pcmcia_dev link->conf.IntType =INT_MEMORY_AND_IO ; link->conf.ConfigIndex =1 ; -/* The EL3-specific entries in the device structure. */ - dev->hard_start_xmit = &el3_start_xmit; - dev->set_config = &el3_config; - dev->get_stats = &el3_get_stats; - dev->set_multicast_list = &set_multicast_list; - dev->open = &el3_open; - dev->stop = &el3_close; -#ifdef HAVE_TX_TIMEOUT - dev->tx_timeout = el3_tx_timeout; + dev->netdev_ops = &el3_netdev_ops; dev->watchdog_timeo =TX_TIMEOUT ; -#endif +SET_ETHTOOL_OPS (dev, &netdev_ethtool_ops);return tc589_config (link);
PATCH 35/77 pcmcia: convert 3c574 to net_device_ops
In reply to Stephen Hemmingerdrivers/net/pcmcia/3c574_cs.c +13 -10
@@ -257,6 +257,18 @@ static void tc574_detach(struct pcmcia_dlocal data structures for one device. The device is registered with Card Services. */ +static const struct net_device_ops el3_netdev_ops = { + .ndo_open = el3_open, + .ndo_stop = el3_close, + .ndo_start_xmit = el3_start_xmit, + .ndo_tx_timeout = el3_tx_timeout, + .ndo_get_stats = el3_get_stats, + .ndo_do_ioctl = el3_ioctl, + .ndo_set_multicast_list = set_rx_mode, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +};static int tc574_probe (struct pcmcia_device *link) {
@@ -284,18 +296,9 @@ static int tc574_probe(struct pcmcia_dev link->conf.IntType =INT_MEMORY_AND_IO ; link->conf.ConfigIndex =1 ; -/* The EL3-specific entries in the device structure. */ - dev->hard_start_xmit = &el3_start_xmit; - dev->get_stats = &el3_get_stats; - dev->do_ioctl = &el3_ioctl; + dev->netdev_ops = &el3_netdev_ops;SET_ETHTOOL_OPS (dev, &netdev_ethtool_ops); - dev->set_multicast_list = &set_rx_mode; - dev->open = &el3_open; - dev->stop = &el3_close; -#ifdef HAVE_TX_TIMEOUT - dev->tx_timeout = el3_tx_timeout; dev->watchdog_timeo =TX_TIMEOUT ; -#endif return tc574_config (link); }/* tc574_attach */
PATCH 36/77 pcmcia: convert fmvj18x driver to internal net_device_stats
In reply to Stephen Hemmingerdrivers/net/pcmcia/fmvj18x_cs.c +12 -24
@@ -100,7 +100,6 @@ static int fjn_start_xmit(struct sk_buffstatic irqreturn_t fjn_interrupt (int irq,void *dev_id);static void fjn_rx (struct net_device *dev);static void fjn_reset (struct net_device *dev); -static struct net_device_stats *fjn_get_stats (struct net_device *dev);static void set_rx_mode (struct net_device *dev);static void fjn_tx_timeout (struct net_device *dev);static const struct ethtool_ops netdev_ethtool_ops;
@@ -118,7 +117,6 @@ typedef enum { MBH10302, MBH10304, TDK, typedef struct local_info_t { struct pcmcia_device *p_dev; dev_node_t node; - struct net_device_stats stats; long open_time; uint tx_started:1; uint tx_queue;
@@ -263,7 +261,6 @@ static int fmvj18x_probe(struct pcmcia_d/* The FMVJ18x specific entries in the device structure. */ dev->hard_start_xmit = &fjn_start_xmit; dev->set_config = &fjn_config; - dev->get_stats = &fjn_get_stats; dev->set_multicast_list = &set_rx_mode; dev->open = &fjn_open; dev->stop = &fjn_close;
@@ -793,7 +790,7 @@ static irqreturn_t fjn_interrupt(int dumfjn_rx (dev); }if (tx_stat &F_TMT_RDY ) { - lp->stats.tx_packets += lp->sent ; + dev->stats.tx_packets += lp->sent ; lp->sent =0 ;if (lp->tx_queue) {outb (DO_TX | lp->tx_queue, ioaddr +TX_START );
@@ -840,7 +837,7 @@ static void fjn_tx_timeout(struct net_dehtons (inw (ioaddr +6 )),htons (inw (ioaddr +8 )),htons (inw (ioaddr +10 )),htons (inw (ioaddr +12 )), htons(inw(ioaddr +14))); - lp->stats.tx_errors++; + dev->stats.tx_errors++;/* ToDo: We should try to restart the adaptor... */ local_irq_disable ();fjn_reset (dev);
@@ -880,7 +877,7 @@ static int fjn_start_xmit(struct sk_buffDEBUG (4 ,"%s: Transmitting a packet of length %lu.\n" , dev->name, (unsigned long )skb->len); - lp->stats.tx_bytes += skb->len; + dev->stats.tx_bytes += skb->len;/* Disable both interrupts. */ outw (0x0000 , ioaddr +TX_INTR );
@@ -1008,7 +1005,6 @@ static void fjn_reset(struct net_devicestatic void fjn_rx (struct net_device *dev) { -struct local_info_t *lp =netdev_priv (dev);unsigned int ioaddr = dev->base_addr;int boguscount =10 ;/* 5 -> 10: by agy 19940922 */
@@ -1027,11 +1023,11 @@ static void fjn_rx(struct net_device *de }#endif if ((status &0xF0 ) !=0x20 ) {/* There was an error. */ - lp->stats.rx_errors++; -if (status &F_LEN_ERR ) lp->stats.rx_length_errors++; -if (status &F_ALG_ERR ) lp->stats.rx_frame_errors++; -if (status &F_CRC_ERR ) lp->stats.rx_crc_errors++; -if (status &F_OVR_FLO ) lp->stats.rx_over_errors++; + dev->stats.rx_errors++; +if (status &F_LEN_ERR ) dev->stats.rx_length_errors++; +if (status &F_ALG_ERR ) dev->stats.rx_frame_errors++; +if (status &F_CRC_ERR ) dev->stats.rx_crc_errors++; +if (status &F_OVR_FLO ) dev->stats.rx_over_errors++; }else {u_short pkt_len =inw (ioaddr +DATAPORT );/* Malloc up new buffer. */
@@ -1041,7 +1037,7 @@ static void fjn_rx(struct net_device *deprintk (KERN_NOTICE "%s: The FMV-18x claimed a very " "large packet, size %d.\n" , dev->name, pkt_len);outb (F_SKP_PKT , ioaddr +RX_SKIP ); - lp->stats.rx_errors++; + dev->stats.rx_errors++;break ; } skb =dev_alloc_skb (pkt_len+2 );
@@ -1049,7 +1045,7 @@ static void fjn_rx(struct net_device *deprintk (KERN_NOTICE "%s: Memory squeeze, dropping " "packet (len %d).\n" , dev->name, pkt_len);outb (F_SKP_PKT , ioaddr +RX_SKIP ); - lp->stats.rx_dropped++; + dev->stats.rx_dropped++;break ; }
@@ -1070,8 +1066,8 @@ static void fjn_rx(struct net_device *de#endif netif_rx (skb); - lp->stats.rx_packets++; - lp->stats.rx_bytes += pkt_len; + dev->stats.rx_packets++; + dev->stats.rx_bytes += pkt_len; }if (--boguscount <=0 )break ;
@@ -1191,14 +1187,6 @@ static int fjn_close(struct net_device */*====================================================================*/ -static struct net_device_stats *fjn_get_stats (struct net_device *dev) -{ -local_info_t *lp =netdev_priv (dev); -return &lp->stats; -}/* fjn_get_stats */ - -/*====================================================================*/ -/* Set the multicast/promiscuous mode for this adaptor. */
PATCH 32/77 usbnet: convert rndis driver to use dev_get_stats
In reply to Stephen Hemmingerdev_get_stats() handles all issues with net_device_ops
--- drivers/usb/gadget/rndis.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/usb/gadget/rndis.c +2 -5
@@ -170,7 +170,7 @@ gen_ndis_query_resp (int configNr, u32 Oint i, count;rndis_query_cmplt_type *resp;struct net_device *net; -struct net_device_stats *stats; +const struct net_device_stats *stats;if (!r)return -ENOMEM ; resp = (rndis_query_cmplt_type *) r->buf;
@@ -193,10 +193,7 @@ gen_ndis_query_resp (int configNr, u32 O resp->InformationBufferOffset =cpu_to_le32 (16 ); net = rndis_per_dev_params[configNr].dev; -if (net->get_stats) - stats = net->get_stats (net); -else - stats =NULL ; + stats =dev_get_stats (net);switch (OID ) {
PATCH 33/77 usbnet: convert rndis driver to net_device_ops
In reply to Stephen Hemmingerdrivers/net/usb/rndis_host.c +12 -1
@@ -266,6 +266,16 @@ response_error:return -EDOM ; } +/* same as usbnet_netdev_ops but MTU change not allowed */ +static const struct net_device_ops rndis_netdev_ops = { + .ndo_open = usbnet_open, + .ndo_stop = usbnet_stop, + .ndo_start_xmit = usbnet_start_xmit, + .ndo_tx_timeout = usbnet_tx_timeout, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +int generic_rndis_bind (struct usbnet *dev,struct usb_interface *intf,int flags) {
@@ -327,7 +337,8 @@ generic_rndis_bind(struct usbnet *dev, s dev->rx_urb_size &= ~(dev->maxpacket -1 ); u.init->max_transfer_size =cpu_to_le32 (dev->rx_urb_size); - net->change_mtu =NULL ; + net->netdev_ops = &rndis_netdev_ops; + retval =rndis_command (dev, u.header,CONTROL_BUFFER_SIZE );if (unlikely (retval <0 )) {/* it might not even be an RNDIS device!! */
PATCH 37/77 pcmcia: convert fmvj18x driver to net_device_ops
In reply to Stephen Hemmingerdrivers/net/pcmcia/fmvj18x_cs.c +14 -9
@@ -227,6 +227,18 @@ typedef struct local_info_t {#define BANK_1U 0x24/* bank 1 (CONFIG_1) */ #define BANK_2U 0x28/* bank 2 (CONFIG_1) */ +static const struct net_device_ops fjn_netdev_ops = { + .ndo_open = fjn_open, + .ndo_stop = fjn_close, + .ndo_start_xmit = fjn_start_xmit, + .ndo_tx_timeout = fjn_tx_timeout, + .ndo_set_config = fjn_config, + .ndo_set_multicast_list = set_rx_mode, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +static int fmvj18x_probe (struct pcmcia_device *link) {local_info_t *lp;
@@ -258,16 +270,9 @@ static int fmvj18x_probe(struct pcmcia_d link->conf.Attributes =CONF_ENABLE_IRQ ; link->conf.IntType =INT_MEMORY_AND_IO ; -/* The FMVJ18x specific entries in the device structure. */ - dev->hard_start_xmit = &fjn_start_xmit; - dev->set_config = &fjn_config; - dev->set_multicast_list = &set_rx_mode; - dev->open = &fjn_open; - dev->stop = &fjn_close; -#ifdef HAVE_TX_TIMEOUT - dev->tx_timeout = fjn_tx_timeout; + dev->netdev_ops = &fjn_netdev_ops; dev->watchdog_timeo =TX_TIMEOUT ; -#endif +SET_ETHTOOL_OPS (dev, &netdev_ethtool_ops);return fmvj18x_config (link);
PATCH 38/77 pcmcia: convert nmclan driver to net_device_ops
In reply to Stephen Hemmingerdrivers/net/pcmcia/nmclan_cs.c +14 -9
@@ -436,6 +436,19 @@ static const struct ethtool_ops netdev_estatic void nmclan_detach (struct pcmcia_device *p_dev); +static const struct net_device_ops mace_netdev_ops = { + .ndo_open = mace_open, + .ndo_stop = mace_close, + .ndo_start_xmit = mace_start_xmit, + .ndo_tx_timeout = mace_tx_timeout, + .ndo_set_config = mace_config, + .ndo_get_stats = mace_get_stats, + .ndo_set_multicast_list = set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +/* ---------------------------------------------------------------------------- nmclan_attach Creates an "instance" of the driver, allocating local data
@@ -474,17 +487,9 @@ static int nmclan_probe(struct pcmcia_de lp->tx_free_frames=AM2150_MAX_TX_FRAMES ; - dev->hard_start_xmit = &mace_start_xmit; - dev->set_config = &mace_config; - dev->get_stats = &mace_get_stats; - dev->set_multicast_list = &set_multicast_list; + dev->netdev_ops = &mace_netdev_ops;SET_ETHTOOL_OPS (dev, &netdev_ethtool_ops); - dev->open = &mace_open; - dev->stop = &mace_close; -#ifdef HAVE_TX_TIMEOUT - dev->tx_timeout = mace_tx_timeout; dev->watchdog_timeo =TX_TIMEOUT ; -#endif return nmclan_config (link); }/* nmclan_attach */
PATCH 39/77 pcnet: convert driver to net_device_ops
In reply to Stephen Hemmingerdrivers/net/pcmcia/pcnet_cs.c +24 -10
@@ -39,6 +39,7 @@#include <linux/ethtool.h> #include <linux/netdevice.h> #include <linux/log2.h> +#include <linux/etherdevice.h> #include "../8390.h" #include <pcmcia/cs_types.h>
@@ -233,6 +234,23 @@ static inline pcnet_dev_t *PRIV(struct nreturn (pcnet_dev_t *)(p +sizeof (struct ei_device )); } +static const struct net_device_ops pcnet_netdev_ops = { + .ndo_open = pcnet_open, + .ndo_stop = pcnet_close, + .ndo_set_config = set_config, + .ndo_start_xmit = ei_start_xmit, + .ndo_get_stats = ei_get_stats, + .ndo_do_ioctl = ei_ioctl, + .ndo_set_multicast_list = ei_set_multicast_list, + .ndo_tx_timeout = ei_tx_timeout, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = ei_poll, +#endif +}; +/*====================================================================== pcnet_attach() creates an "instance" of the driver, allocating
@@ -260,9 +278,7 @@ static int pcnet_probe(struct pcmcia_dev link->conf.Attributes =CONF_ENABLE_IRQ ; link->conf.IntType =INT_MEMORY_AND_IO ; - dev->open = &pcnet_open; - dev->stop = &pcnet_close; - dev->set_config = &set_config; + dev->netdev_ops = &pcnet_netdev_ops;return pcnet_config (link); }/* pcnet_attach */
@@ -640,18 +656,12 @@ static int pcnet_config(struct pcmcia_deSET_ETHTOOL_OPS (dev, &netdev_ethtool_ops); -if (info->flags & (IS_DL10019 |IS_DL10022 )) { - dev->do_ioctl = &ei_ioctl; +if (info->flags & (IS_DL10019 |IS_DL10022 ))mii_phy_probe (dev); - } link->dev_node = &info->node;SET_NETDEV_DEV (dev, &handle_to_dev (link)); -#ifdef CONFIG_NET_POLL_CONTROLLER - dev->poll_controller = ei_poll; -#endif -if (register_netdev (dev) !=0 ) {printk (KERN_NOTICE "pcnet_cs: register_netdev() failed\n" ); link->dev_node =NULL ;
@@ -1183,6 +1193,10 @@ static int ei_ioctl(struct net_device *dpcnet_dev_t *info =PRIV (dev);u16 *data = (u16 *)&rq->ifr_ifru;unsigned int mii_addr = dev->base_addr +DLINK_GPIO ; + +if (!(info->flags & (IS_DL10019 |IS_DL10022 ))) +return -EINVAL ; +switch (cmd) {case SIOCGMIIPHY : data[0 ] = info->phy_id;
PATCH 40/77 xir2cps: convert to internal net_device stats
In reply to Stephen Hemmingerdrivers/net/pcmcia/xirc2ps_cs.c +15 -26
@@ -335,7 +335,7 @@ typedef struct local_info_t {struct net_device *dev;struct pcmcia_device *p_dev;dev_node_t node; -struct net_device_stats stats; +int card_type;int probe_port;int silicon;/* silicon revision. 0=old CE2, 1=Scipper, 4=Mohawk */
@@ -355,7 +355,6 @@ typedef struct local_info_t {static int do_start_xmit (struct sk_buff *skb,struct net_device *dev);static void xirc_tx_timeout (struct net_device *dev);static void xirc2ps_tx_timeout_task (struct work_struct *work); -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 (struct pcmcia_device *link,const void *s);
@@ -583,7 +582,6 @@ xirc2ps_probe(struct pcmcia_device *link/* Fill in card specific entries */ dev->hard_start_xmit = &do_start_xmit; dev->set_config = &do_config; - dev->get_stats = &do_get_stats; dev->do_ioctl = &do_ioctl;SET_ETHTOOL_OPS (dev, &netdev_ethtool_ops); dev->set_multicast_list = &set_multicast_list;
@@ -1172,7 +1170,7 @@ xirc2ps_interrupt(int irq, void *dev_id)if (bytes_rcvd > maxrx_bytes && (rsr & PktRxOk)) {/* too many bytes received during this int, drop the rest of the * packets */ - lp->stats.rx_dropped++; + dev->stats.rx_dropped++;DEBUG (2 ,"%s: RX drop, too much done\n" , dev->name); }else if (rsr & PktRxOk) {struct sk_buff *skb;
@@ -1186,7 +1184,7 @@ xirc2ps_interrupt(int irq, void *dev_id)if (!skb) {printk (KNOT_XIRC "low memory, packet dropped (size=%u)\n" , pktlen); - lp->stats.rx_dropped++; + dev->stats.rx_dropped++; }else {/* okay get the packet */ skb_reserve (skb,2 );if (lp->silicon ==0 ) {/* work around a hardware bug */
@@ -1242,24 +1240,24 @@ xirc2ps_interrupt(int irq, void *dev_id) } skb->protocol =eth_type_trans (skb, dev);netif_rx (skb); - lp->stats.rx_packets++; - lp->stats.rx_bytes += pktlen; + dev->stats.rx_packets++; + dev->stats.rx_bytes += pktlen;if (!(rsr & PhyPkt)) - lp->stats.multicast++; + dev->stats.multicast++; } }else {/* bad packet */ DEBUG (5 ,"rsr=%#02x\n" , rsr); }if (rsr & PktTooLong) { - lp->stats.rx_frame_errors++; + dev->stats.rx_frame_errors++;DEBUG (3 ,"%s: Packet too long\n" , dev->name); }if (rsr & CRCErr) { - lp->stats.rx_crc_errors++; + dev->stats.rx_crc_errors++;DEBUG (3 ,"%s: CRC error\n" , dev->name); }if (rsr & AlignErr) { - lp->stats.rx_fifo_errors++;/* okay ? */ + dev->stats.rx_fifo_errors++;/* okay ? */ DEBUG (3 ,"%s: Alignment error\n" , dev->name); }
@@ -1270,7 +1268,7 @@ xirc2ps_interrupt(int irq, void *dev_id) eth_status =GetByte (XIRCREG_ESR ); }if (rx_status &0x10 ) {/* Receive overrun */ - lp->stats.rx_over_errors++; + dev->stats.rx_over_errors++;PutByte (XIRCREG_CR , ClearRxOvrun);DEBUG (3 ,"receive overrun cleared\n" ); }
@@ -1283,11 +1281,11 @@ xirc2ps_interrupt(int irq, void *dev_id) nn =GetByte (XIRCREG0_PTR ); lp->last_ptr_value = nn;if (nn < n)/* rollover */ - lp->stats.tx_packets +=256 - n; + dev->stats.tx_packets +=256 - n;else if (n == nn) {/* happens sometimes - don't know why */ DEBUG (0 ,"PTR not changed?\n" ); }else - lp->stats.tx_packets += lp->last_ptr_value - n; + dev->stats.tx_packets += lp->last_ptr_value - n;netif_wake_queue (dev); }if (tx_status &0x0002 ) {/* Execessive collissions */
@@ -1295,7 +1293,7 @@ xirc2ps_interrupt(int irq, void *dev_id)PutByte (XIRCREG_CR , RestartTx);/* restart transmitter process */ }if (tx_status &0x0040 ) - lp->stats.tx_aborted_errors++; + dev->stats.tx_aborted_errors++;/* recalculate our work chunk so that we limit the duration of this * ISR to about 1/10 of a second.
@@ -1353,7 +1351,7 @@ static void xirc_tx_timeout(struct net_device *dev) {local_info_t *lp =netdev_priv (dev); - lp->stats.tx_errors++; + dev->stats.tx_errors++;printk (KERN_NOTICE "%s: transmit timed out\n" , dev->name);schedule_work (&lp->tx_timeout_task); }
@@ -1409,20 +1407,11 @@ do_start_xmit(struct sk_buff *skb, strucdev_kfree_skb (skb); dev->trans_start = jiffies; - lp->stats.tx_bytes += pktlen; + dev->stats.tx_bytes += pktlen;netif_start_queue (dev);return 0 ; } -static struct net_device_stats * -do_get_stats (struct net_device *dev) -{ -local_info_t *lp =netdev_priv (dev); - -/* lp->stats.rx_missed_errors = GetByte(?) */ -return &lp->stats; -} -/**************** * Set all addresses: This first one is the individual address, * the next 9 addresses are taken from the multicast list and
PATCH 1/77 atm: convert mpc device to using netdev_ops
In reply to Stephen HemmingerThis converts the mpc device to using new netdevice_ops. Compile tested only, needs more than usual review since device was swaping pointers around etc.
--- net/atm/mpc.c | 32 ++++++++++++++------------------ net/atm/mpc.h | 5 ++++- 2 files changed, 18 insertions(+), 19 deletions(-)
net/atm/mpc.c +14 -18
@@ -286,33 +286,32 @@ static void start_mpc(struct mpoa_client {dprintk ("mpoa: (%s) start_mpc:\n" , mpc->dev->name); -if (dev->hard_start_xmit ==NULL ) { -printk ("mpoa: (%s) start_mpc: dev->hard_start_xmit == NULL, not starting\n" , - dev->name); -return ; +if (!dev->netdev_ops) +printk ("mpoa: (%s) start_mpc not starting\n" , dev->name); +else { + mpc->old_ops = dev->netdev_ops; + mpc->new_ops = *mpc->old_ops; + mpc->new_ops.ndo_start_xmit = mpc_send_packet; + dev->netdev_ops = &mpc->new_ops; } - mpc->old_hard_start_xmit = dev->hard_start_xmit; - dev->hard_start_xmit = mpc_send_packet; - -return ; }static void stop_mpc (struct mpoa_client *mpc) { - +struct net_device *dev = mpc->dev;dprintk ("mpoa: (%s) stop_mpc:" , mpc->dev->name);/* Lets not nullify lec device's dev->hard_start_xmit */ -if (mpc->dev->hard_start_xmit != mpc_send_packet) { +if (dev->netdev_ops != &mpc->new_ops) {dprintk (" mpc already stopped, not fatal\n" );return ; }dprintk ("\n" ); - mpc->dev->hard_start_xmit = mpc->old_hard_start_xmit; - mpc->old_hard_start_xmit =NULL ; -/* close_shortcuts(mpc); ??? FIXME */ -return ; + dev->netdev_ops = mpc->old_ops; + mpc->old_ops =NULL ; + +/* close_shortcuts(mpc); ??? FIXME */ }static const char *mpoa_device_type_string (char type) __attribute__ ((unused));
@@ -531,7 +530,6 @@ static int send_via_shortcut(struct sk_b*/ static int mpc_send_packet (struct sk_buff *skb,struct net_device *dev) { -int retval;struct mpoa_client *mpc;struct ethhdr *eth;int i =0 ;
@@ -561,9 +559,7 @@ static int mpc_send_packet(struct sk_buf } non_ip: - retval = mpc->old_hard_start_xmit (skb,dev); - -return retval; +return mpc->old_ops->ndo_start_xmit (skb,dev); }static int atm_mpoa_vcc_attach (struct atm_vcc *vcc,void __user *arg)
net/atm/mpc.h +4 -1
@@ -15,7 +15,7 @@ struct mpoa_client {struct mpoa_client *next;struct net_device *dev;/* lec in question */ int dev_num;/* e.g. 2 for lec2 */ -int (*old_hard_start_xmit)(struct sk_buff *skb,struct net_device *dev); +struct atm_vcc *mpoad_vcc;/* control channel to mpoad */ uint8_t mps_ctrl_addr[ATM_ESA_LEN ];/* MPS control ATM address */ uint8_t our_ctrl_addr[ATM_ESA_LEN ];/* MPC's control ATM address */
@@ -31,6 +31,9 @@ struct mpoa_client {uint8_t *mps_macs;/* array of MPS MAC addresses, >=1 */ int number_of_mps_macs;/* number of the above MAC addresses */ struct mpc_parameters parameters;/* parameters for this client */ + +const struct net_device_ops *old_ops; +struct net_device_ops new_ops; };
PATCH 2/77 atm: cconvert clip driver to net_device_ops
In reply to Stephen Hemminger--- net/atm/clip.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/atm/clip.c +6 -3
@@ -552,10 +552,13 @@ static int clip_setentry(struct atm_vccreturn error; } +static const struct net_device_ops clip_netdev_ops = { + .ndo_start_xmit = clip_start_xmit, +}; +static void clip_setup (struct net_device *dev) { - dev->hard_start_xmit = clip_start_xmit; -/* sg_xmit ... */ + dev->netdev_ops = &clip_netdev_ops; dev->type =ARPHRD_ATM ; dev->hard_header_len =RFC1483LLC_LEN ; dev->mtu =RFC1626_MTU ;
@@ -615,7 +618,7 @@ static int clip_device_event(struct noti }/* ignore non-CLIP devices */ -if (dev->type !=ARPHRD_ATM || dev->hard_start_xmit != clip_start_xmit) +if (dev->type !=ARPHRD_ATM || dev->netdev_ops != &clip_netdev_ops)return NOTIFY_DONE ;switch (event) {
PATCH 41/77 xirc2ps: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/pcmcia/xirc2ps_cs.c +15 -10
@@ -545,6 +545,19 @@ mii_wr(unsigned int ioaddr, u_char phyad/*============= Main bulk of functions =========================*/ +static const struct net_device_ops netdev_ops = { + .ndo_open = do_open, + .ndo_stop = do_stop, + .ndo_start_xmit = do_start_xmit, + .ndo_tx_timeout = xirc_tx_timeout, + .ndo_set_config = do_config, + .ndo_do_ioctl = do_ioctl, + .ndo_set_multicast_list = set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +/**************** * xirc2ps_attach() creates an "instance" of the driver, allocating * local data structures for one device. The device is registered
@@ -580,18 +593,10 @@ xirc2ps_probe(struct pcmcia_device *link link->irq.Instance = dev;/* Fill in card specific entries */ - dev->hard_start_xmit = &do_start_xmit; - dev->set_config = &do_config; - dev->do_ioctl = &do_ioctl; -SET_ETHTOOL_OPS (dev, &netdev_ethtool_ops); - dev->set_multicast_list = &set_multicast_list; - dev->open = &do_open; - dev->stop = &do_stop; -#ifdef HAVE_TX_TIMEOUT - dev->tx_timeout = xirc_tx_timeout; + dev->netdev_ops = &netdev_ops; + dev->ethtool_ops = &netdev_ethtool_ops; dev->watchdog_timeo =TX_TIMEOUT ;INIT_WORK (&local->tx_timeout_task, xirc2ps_tx_timeout_task); -#endif return xirc2ps_config (link); }/* xirc2ps_attach */
PATCH 42/77 smc91c92: convert to internal net_device_stats
In reply to Stephen Hemmingerdrivers/net/pcmcia/smc91c92_cs.c +22 -34
@@ -108,7 +108,7 @@ struct smc_private {spinlock_t lock;u_short manfid;u_short cardid; -struct net_device_stats stats; +dev_node_t node;struct sk_buff *saved_skb;int packets_waiting;
@@ -289,7 +289,6 @@ static void smc_tx_timeout(struct net_destatic int smc_start_xmit (struct sk_buff *skb,struct net_device *dev);static irqreturn_t smc_interrupt (int irq,void *dev_id);static void smc_rx (struct net_device *dev); -static struct net_device_stats *smc_get_stats (struct net_device *dev);static void set_rx_mode (struct net_device *dev);static int s9k_config (struct net_device *dev,struct ifmap *map);static void smc_set_xcvr (struct net_device *dev,int if_port);
@@ -337,7 +336,6 @@ static int smc91c92_probe(struct pcmcia_/* The SMC91c92-specific entries in the device structure. */ dev->hard_start_xmit = &smc_start_xmit; - dev->get_stats = &smc_get_stats; dev->set_config = &s9k_config; dev->set_multicast_list = &set_rx_mode; dev->open = &smc_open;
@@ -1291,7 +1289,7 @@ static void smc_hardware_send_packet(strreturn ; } - smc->stats.tx_bytes += skb->len; + dev->stats.tx_bytes += skb->len;/* The card should use the just-allocated buffer. */ outw (packet_no, ioaddr +PNR_ARR );/* point to the beginning of the packet */
@@ -1340,7 +1338,7 @@ static void smc_tx_timeout(struct net_deprintk (KERN_NOTICE "%s: SMC91c92 transmit timed out, " "Tx_status %2.2x status %4.4x.\n" , dev->name,inw (ioaddr)&0xff ,inw (ioaddr +2 )); - smc->stats.tx_errors++; + dev->stats.tx_errors++;smc_reset (dev); dev->trans_start = jiffies; smc->saved_skb =NULL ;
@@ -1362,7 +1360,7 @@ static int smc_start_xmit(struct sk_buffif (smc->saved_skb) {/* THIS SHOULD NEVER HAPPEN. */ - smc->stats.tx_aborted_errors++; + dev->stats.tx_aborted_errors++;printk (KERN_DEBUG "%s: Internal error -- sent packet while busy.\n" , dev->name);return 1 ;
@@ -1375,7 +1373,7 @@ static int smc_start_xmit(struct sk_buffprintk (KERN_ERR "%s: Far too big packet error.\n" , dev->name);dev_kfree_skb (skb); smc->saved_skb =NULL ; - smc->stats.tx_dropped++; + dev->stats.tx_dropped++;return 0 ;/* Do not re-queue this packet. */ }/* A packet is now waiting. */
@@ -1433,11 +1431,11 @@ static void smc_tx_err(struct net_device tx_status =inw (ioaddr +DATA_1 ); - smc->stats.tx_errors++; -if (tx_status &TS_LOSTCAR ) smc->stats.tx_carrier_errors++; -if (tx_status &TS_LATCOL ) smc->stats.tx_window_errors++; + dev->stats.tx_errors++; +if (tx_status &TS_LOSTCAR ) dev->stats.tx_carrier_errors++; +if (tx_status &TS_LATCOL ) dev->stats.tx_window_errors++;if (tx_status &TS_16COL ) { - smc->stats.tx_aborted_errors++; + dev->stats.tx_aborted_errors++; smc->tx_err++; }
@@ -1474,10 +1472,10 @@ static void smc_eph_irq(struct net_devic/* Could be a counter roll-over warning: update stats. */ card_stats =inw (ioaddr +COUNTER );/* single collisions */ - smc->stats.collisions += card_stats &0xF ; + dev->stats.collisions += card_stats &0xF ; card_stats >>=4 ;/* multiple collisions */ - smc->stats.collisions += card_stats &0xF ; + dev->stats.collisions += card_stats &0xF ;#if 0 /* These are for when linux supports these statistics */ card_stats >>=4 ;/* deferred */ card_stats >>=4 ;/* excess deferred */
@@ -1551,7 +1549,7 @@ static irqreturn_t smc_interrupt(int irqif (status &IM_TX_EMPTY_INT ) {outw (IM_TX_EMPTY_INT , ioaddr +INTERRUPT ); mask &= ~IM_TX_EMPTY_INT ; - smc->stats.tx_packets += smc->packets_waiting; + dev->stats.tx_packets += smc->packets_waiting; smc->packets_waiting =0 ; }if (status &IM_ALLOC_INT ) {
@@ -1567,8 +1565,8 @@ static irqreturn_t smc_interrupt(int irqnetif_wake_queue (dev); }if (status &IM_RX_OVRN_INT ) { - smc->stats.rx_errors++; - smc->stats.rx_fifo_errors++; + dev->stats.rx_errors++; + dev->stats.rx_fifo_errors++;if (smc->duplex) smc->rx_ovrn =1 ;/* need MC_RESET outside smc_interrupt */ outw (IM_RX_OVRN_INT , ioaddr +INTERRUPT );
@@ -1618,7 +1616,6 @@ irq_done:static void smc_rx (struct net_device *dev) { -struct smc_private *smc =netdev_priv (dev);unsigned int ioaddr = dev->base_addr;int rx_status;int packet_length;/* Caution: not frame length, rather words
@@ -1649,7 +1646,7 @@ static void smc_rx(struct net_device *deif (skb ==NULL ) {DEBUG (1 ,"%s: Low memory, packet dropped.\n" , dev->name); - smc->stats.rx_dropped++; + dev->stats.rx_dropped++;outw (MC_RELEASE , ioaddr +MMU_CMD );return ; }
@@ -1662,18 +1659,18 @@ static void smc_rx(struct net_device *denetif_rx (skb); dev->last_rx = jiffies; - smc->stats.rx_packets++; - smc->stats.rx_bytes += packet_length; + dev->stats.rx_packets++; + dev->stats.rx_bytes += packet_length;if (rx_status &RS_MULTICAST ) - smc->stats.multicast++; + dev->stats.multicast++; }else {/* error ... */ - smc->stats.rx_errors++; + dev->stats.rx_errors++; -if (rx_status &RS_ALGNERR ) smc->stats.rx_frame_errors++; +if (rx_status &RS_ALGNERR ) dev->stats.rx_frame_errors++;if (rx_status & (RS_TOOSHORT |RS_TOOLONG )) - smc->stats.rx_length_errors++; -if (rx_status &RS_BADCRC ) smc->stats.rx_crc_errors++; + dev->stats.rx_length_errors++; +if (rx_status &RS_BADCRC ) dev->stats.rx_crc_errors++; }/* Let the MMU free the memory of this packet. */ outw (MC_RELEASE , ioaddr +MMU_CMD );
@@ -1681,15 +1678,6 @@ static void smc_rx(struct net_device *dereturn ; } -/*====================================================================*/ - -static struct net_device_stats *smc_get_stats (struct net_device *dev) -{ -struct smc_private *smc =netdev_priv (dev); -/* Nothing to update - the 91c92 is a pretty primative chip. */ -return &smc->stats; -} -/*====================================================================== Calculate values for the hardware multicast filter hash table.
PATCH 43/77 smc91c92: convert to net_device_ops
In reply to Stephen Hemminger--- drivers/net/pcmcia/smc91c92_cs.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
drivers/net/pcmcia/smc91c92_cs.c +14 -9
@@ -300,6 +300,19 @@ static void mdio_write(struct net_devicestatic int smc_link_ok (struct net_device *dev);static const struct ethtool_ops ethtool_ops; +static const struct net_device_ops smc_netdev_ops = { + .ndo_open = smc_open, + .ndo_stop = smc_close, + .ndo_start_xmit = smc_start_xmit, + .ndo_tx_timeout = smc_tx_timeout, + .ndo_set_config = s9k_config, + .ndo_set_multicast_list = set_rx_mode, + .ndo_do_ioctl = &smc_ioctl, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +/*====================================================================== smc91c92_attach() creates an "instance" of the driver, allocating
@@ -335,17 +348,9 @@ static int smc91c92_probe(struct pcmcia_ link->conf.IntType =INT_MEMORY_AND_IO ;/* The SMC91c92-specific entries in the device structure. */ - dev->hard_start_xmit = &smc_start_xmit; - dev->set_config = &s9k_config; - dev->set_multicast_list = &set_rx_mode; - dev->open = &smc_open; - dev->stop = &smc_close; - dev->do_ioctl = &smc_ioctl; + dev->netdev_ops = &smc_netdev_ops;SET_ETHTOOL_OPS (dev, ðtool_ops); -#ifdef HAVE_TX_TIMEOUT - dev->tx_timeout = smc_tx_timeout; dev->watchdog_timeo =TX_TIMEOUT ; -#endif smc->mii_if.dev = dev; smc->mii_if.mdio_read = mdio_read;
PATCH 44/77 axnet: convert ot net_device_ops
In reply to Stephen Hemmingerdrivers/net/pcmcia/axnet_cs.c +26 -42
@@ -35,6 +35,7 @@#include <linux/spinlock.h> #include <linux/ethtool.h> #include <linux/netdevice.h> +#include <linux/etherdevice.h> #include <linux/crc32.h> #include "../8390.h"
@@ -91,6 +92,10 @@ static void axnet_release(struct pcmcia_static int axnet_open (struct net_device *dev);static int axnet_close (struct net_device *dev);static int axnet_ioctl (struct net_device *dev,struct ifreq *rq,int cmd); +static int axnet_start_xmit (struct sk_buff *skb,struct net_device *dev); +static struct net_device_stats *get_stats (struct net_device *dev); +static void set_multicast_list (struct net_device *dev); +static void axnet_tx_timeout (struct net_device *dev);static const struct ethtool_ops netdev_ethtool_ops;static irqreturn_t ei_irq_wrapper (int irq,void *dev_id);static void ei_watchdog (u_long arg);
@@ -108,7 +113,6 @@ static void block_output(struct net_devistatic void axnet_detach (struct pcmcia_device *p_dev); -static void axdev_setup (struct net_device *dev);static void AX88190_init (struct net_device *dev,int startp);static int ax_open (struct net_device *dev);static int ax_close (struct net_device *dev);
@@ -134,6 +138,19 @@ static inline axnet_dev_t *PRIV(struct nreturn p; } +static const struct net_device_ops axnet_netdev_ops = { + .ndo_open = axnet_open, + .ndo_stop = axnet_close, + .ndo_do_ioctl = axnet_ioctl, + .ndo_start_xmit = axnet_start_xmit, + .ndo_tx_timeout = axnet_tx_timeout, + .ndo_get_stats = get_stats, + .ndo_set_multicast_list = set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +/*====================================================================== axnet_attach() creates an "instance" of the driver, allocating
@@ -146,15 +163,17 @@ static int axnet_probe(struct pcmcia_dev {axnet_dev_t *info;struct net_device *dev; +struct ei_device *ei_local;DEBUG (0 ,"axnet_attach()\n" ); - dev =alloc_netdev (sizeof (struct ei_device ) +sizeof (axnet_dev_t), -"eth%d" , axdev_setup); - + dev =alloc_etherdev (sizeof (struct ei_device ) +sizeof (axnet_dev_t));if (!dev)return -ENOMEM ; + ei_local =netdev_priv (dev); +spin_lock_init (&ei_local->page_lock); + info =PRIV (dev); info->p_dev = link; link->priv = dev;
@@ -163,10 +182,10 @@ static int axnet_probe(struct pcmcia_dev link->conf.Attributes =CONF_ENABLE_IRQ ; link->conf.IntType =INT_MEMORY_AND_IO ; - dev->open = &axnet_open; - dev->stop = &axnet_close; - dev->do_ioctl = &axnet_ioctl; + dev->netdev_ops = &axnet_netdev_ops; +SET_ETHTOOL_OPS (dev, &netdev_ethtool_ops); + dev->watchdog_timeo =TX_TIMEOUT ;return axnet_config (link); }/* axnet_attach */
@@ -905,14 +924,12 @@ int ei_debug = 1;/* Index to functions. */ static void ei_tx_intr (struct net_device *dev);static void ei_tx_err (struct net_device *dev); -static void axnet_tx_timeout (struct net_device *dev);static void ei_receive (struct net_device *dev);static void ei_rx_overrun (struct net_device *dev);/* Routines generic to NS8390-based boards. */ static void NS8390_trigger_send (struct net_device *dev,unsigned int length,int start_page); -static void set_multicast_list (struct net_device *dev);static void do_set_multicast_list (struct net_device *dev);/*
@@ -954,15 +971,6 @@ static int ax_open(struct net_device *deunsigned long flags;struct ei_device *ei_local = (struct ei_device *)netdev_priv (dev); -#ifdef HAVE_TX_TIMEOUT -/* The card I/O part of the driver (e.g. 3c503) can hook a Tx timeout -wrapper that does e.g. media check & then calls axnet_tx_timeout. */ -if (dev->tx_timeout ==NULL ) - dev->tx_timeout = axnet_tx_timeout; -if (dev->watchdog_timeo <=0 ) - dev->watchdog_timeo =TX_TIMEOUT ; -#endif -/* * Grab the page lock so we own the register set, then call * the init function.
@@ -1701,30 +1709,6 @@ static void set_multicast_list(struct nespin_unlock_irqrestore (&dev_lock (dev), flags); } -/** -* axdev_setup - init rest of 8390 device struct -* @dev: network device structure to init -* -* Initialize the rest of the 8390 device structure. Do NOT __init -* this, as it is used by 8390 based modular drivers too. -*/ - -static void axdev_setup (struct net_device *dev) -{ -struct ei_device *ei_local; -if (ei_debug >1 ) -printk (version_8390); - - ei_local = (struct ei_device *)netdev_priv (dev); -spin_lock_init (&ei_local->page_lock); - - dev->hard_start_xmit = &axnet_start_xmit; - dev->get_stats = get_stats; - dev->set_multicast_list = &set_multicast_list; - -ether_setup (dev); -} -/* This page of functions should be 8390 generic */ /* Follow National Semi's recommendations for initializing the "NIC". */
PATCH 45/77 x25_asy: convert to internal net_device_stats
In reply to Stephen Hemmingerdrivers/net/wan/x25_asy.c +11 -19
@@ -142,7 +142,7 @@ static int x25_asy_change_mtu(struct netmemcpy (sl->xbuff, sl->xhead, sl->xleft); }else { sl->xleft =0 ; - sl->stats.tx_dropped++; + dev->stats.tx_dropped++; } } sl->xhead = sl->xbuff;
@@ -153,7 +153,7 @@ static int x25_asy_change_mtu(struct netmemcpy (sl->rbuff, rbuff, sl->rcount); }else { sl->rcount =0 ; - sl->stats.rx_over_errors++; + dev->stats.rx_over_errors++;set_bit (SLF_ERROR , &sl->flags); } }
@@ -188,18 +188,19 @@ static inline void x25_asy_unlock(structstatic void x25_asy_bump (struct x25_asy *sl) { +struct net_device *dev = sl->dev;struct sk_buff *skb;int count;int err; count = sl->rcount; - sl->stats.rx_bytes += count; + dev->stats.rx_bytes += count; skb =dev_alloc_skb (count+1 );if (skb ==NULL ) {printk (KERN_WARNING "%s: memory squeeze, dropping packet.\n" , sl->dev->name); - sl->stats.rx_dropped++; + dev->stats.rx_dropped++;return ; }skb_push (skb,1 );/* LAPB internal control */
@@ -211,7 +212,7 @@ static void x25_asy_bump(struct x25_asyprintk (KERN_DEBUG "x25_asy: data received err - %d\n" , err); }else {netif_rx (skb); - sl->stats.rx_packets++; + dev->stats.rx_packets++; } }
@@ -226,7 +227,7 @@ static void x25_asy_encaps(struct x25_as len = mtu;printk (KERN_DEBUG "%s: truncating oversized transmit packet!\n" , sl->dev->name); - sl->stats.tx_dropped++; + sl->dev->stats.tx_dropped++;x25_asy_unlock (sl);return ; }
@@ -266,7 +267,7 @@ static void x25_asy_write_wakeup(structif (sl->xleft <=0 ) {/* Now serial buffer is almost free & we can start * transmission of another packet */ - sl->stats.tx_packets++; + sl->dev->stats.tx_packets++;clear_bit (TTY_DO_WRITE_WAKEUP , &tty->flags);x25_asy_unlock (sl);return ;
@@ -383,7 +384,7 @@ static void x25_asy_data_transmit(struct/* We were not busy, so we are now... :-) */ if (skb !=NULL ) {x25_asy_lock (sl); - sl->stats.tx_bytes += skb->len; + dev->stats.tx_bytes += skb->len;x25_asy_encaps (sl, skb->data, skb->len);dev_kfree_skb (skb); }
@@ -533,7 +534,7 @@ static void x25_asy_receive_buf(struct twhile (count--) {if (fp && *fp++) {if (!test_and_set_bit (SLF_ERROR , &sl->flags)) - sl->stats.rx_errors++; + sl->dev->stats.rx_errors++; cp++;continue ; }
@@ -608,14 +609,6 @@ static void x25_asy_close_tty(struct ttyx25_asy_free (sl); } - -static struct net_device_stats *x25_asy_get_stats (struct net_device *dev) -{ -struct x25_asy *sl =netdev_priv (dev); -return &sl->stats; -} - -/************************************************************************ * STANDARD X.25 ENCAPSULATION * ************************************************************************/
@@ -682,7 +675,7 @@ static void x25_asy_unesc(struct x25_asy sl->rbuff[sl->rcount++] = s;return ; } - sl->stats.rx_over_errors++; + sl->dev->stats.rx_over_errors++;set_bit (SLF_ERROR , &sl->flags); } }
@@ -739,7 +732,6 @@ static void x25_asy_setup(struct net_dev dev->watchdog_timeo =HZ *20 ; dev->open = x25_asy_open_dev; dev->stop = x25_asy_close; - dev->get_stats = x25_asy_get_stats; dev->change_mtu = x25_asy_change_mtu; dev->hard_header_len =0 ; dev->addr_len =0 ;
drivers/net/wan/x25_asy.h +0 -4
@@ -28,10 +28,6 @@ struct x25_asy {unsigned char *xbuff;/* transmitter buffer */ unsigned char *xhead;/* pointer to next byte to XMIT */ int xleft;/* bytes left in XMIT queue */ - -/* X.25 interface statistics. */ -struct net_device_stats stats; -int buffsize;/* Max buffers sizes */ unsigned long flags;/* Flag values/ mode etc */
PATCH 46/77 x25_asy: convert to net_device_ops
In reply to Stephen Hemminger--- drivers/net/wan/x25_asy.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/wan/x25_asy.c +9 -5
@@ -712,6 +712,14 @@ static int x25_asy_open_dev(struct net_dreturn 0 ; } +static const struct net_device_ops x25_asy_netdev_ops = { + .ndo_open = x25_asy_open_dev, + .ndo_stop = x25_asy_close, + .ndo_start_xmit = x25_asy_xmit, + .ndo_tx_timeout = x25_asy_timeout, + .ndo_change_mtu = x25_asy_change_mtu, +}; +/* Initialise the X.25 driver. Called by the device init code */ static void x25_asy_setup (struct net_device *dev) {
@@ -727,12 +735,8 @@ static void x25_asy_setup(struct net_dev*/ dev->mtu =SL_MTU ; - dev->hard_start_xmit = x25_asy_xmit; - dev->tx_timeout = x25_asy_timeout; + dev->netdev_ops = &x25_asy_netdev_ops; dev->watchdog_timeo =HZ *20 ; - dev->open = x25_asy_open_dev; - dev->stop = x25_asy_close; - dev->change_mtu = x25_asy_change_mtu; dev->hard_header_len =0 ; dev->addr_len =0 ; dev->type =ARPHRD_X25 ;
PATCH 47/77 dlci: convert to internal net_device_stats
In reply to Stephen Hemmingerdrivers/net/wan/dlci.c +11 -21
@@ -114,7 +114,7 @@ static void dlci_receive(struct sk_buffif (!pskb_may_pull (skb,sizeof (*hdr))) {printk (KERN_NOTICE "%s: invalid data no header\n" , dev->name); - dlp->stats.rx_errors++; + dev->stats.rx_errors++;kfree_skb (skb);return ; }
@@ -127,7 +127,7 @@ static void dlci_receive(struct sk_buffif (hdr->control !=FRAD_I_UI ) {printk (KERN_NOTICE "%s: Invalid header flag 0x%02X.\n" , dev->name, hdr->control); - dlp->stats.rx_errors++; + dev->stats.rx_errors++; }else switch(hdr->IP_NLPID)
@@ -136,14 +136,14 @@ static void dlci_receive(struct sk_buffif (hdr->NLPID !=FRAD_P_SNAP ) {printk (KERN_NOTICE "%s: Unsupported NLPID 0x%02X.\n" , dev->name, hdr->NLPID); - dlp->stats.rx_errors++; + dev->stats.rx_errors++;break ; }if (hdr->OUI[0 ] + hdr->OUI[1 ] + hdr->OUI[2 ] !=0 ) {printk (KERN_NOTICE "%s: Unsupported organizationally unique identifier 0x%02X-%02X-%02X.\n" , dev->name, hdr->OUI[0 ], hdr->OUI[1 ], hdr->OUI[2 ]); - dlp->stats.rx_errors++; + dev->stats.rx_errors++;break ; }
@@ -164,12 +164,12 @@ static void dlci_receive(struct sk_buffcase FRAD_P_Q933 :case FRAD_P_CLNP :printk (KERN_NOTICE "%s: Unsupported NLPID 0x%02X.\n" , dev->name, hdr->pad); - dlp->stats.rx_errors++; + dev->stats.rx_errors++;break ;default :printk (KERN_NOTICE "%s: Invalid pad byte 0x%02X.\n" , dev->name, hdr->pad); - dlp->stats.rx_errors++; + dev->stats.rx_errors++;break ; }
@@ -178,9 +178,9 @@ static void dlci_receive(struct sk_buff/* we've set up the protocol, so discard the header */ skb_reset_mac_header (skb);skb_pull (skb, header); - dlp->stats.rx_bytes += skb->len; + dev->stats.rx_bytes += skb->len;netif_rx (skb); - dlp->stats.rx_packets++; + dev->stats.rx_packets++; }else dev_kfree_skb (skb);
@@ -204,15 +204,15 @@ static int dlci_transmit(struct sk_buffswitch (ret) {case DLCI_RET_OK : - dlp->stats.tx_packets++; + dev->stats.tx_packets++; ret =0 ;break ;case DLCI_RET_ERR : - dlp->stats.tx_errors++; + dev->stats.tx_errors++; ret =0 ;break ;case DLCI_RET_DROP : - dlp->stats.tx_dropped++; + dev->stats.tx_dropped++; ret =1 ;break ; }
@@ -342,15 +342,6 @@ static int dlci_close(struct net_devicereturn 0 ; } -static struct net_device_stats *dlci_get_stats (struct net_device *dev) -{ -struct dlci_local *dlp; - - dlp =netdev_priv (dev); - -return (&dlp->stats); -} -static int dlci_add (struct dlci_add *dlci) {struct net_device *master, *slave;
@@ -498,7 +489,6 @@ static void dlci_setup(struct net_device dev->do_ioctl = dlci_dev_ioctl; dev->hard_start_xmit = dlci_transmit; dev->header_ops = &dlci_header_ops; - dev->get_stats = dlci_get_stats; dev->change_mtu = dlci_change_mtu; dev->destructor = free_netdev;
PATCH 48/77 dlci: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/wan/dlci.c +12 -10
@@ -200,7 +200,7 @@ static int dlci_transmit(struct sk_buffnetif_stop_queue (dev); - ret = dlp->slave->hard_start_xmit (skb, dlp->slave); + ret = dlp->slave->netdev_ops->ndo_start_xmit (skb, dlp->slave);switch (ret) {case DLCI_RET_OK :
@@ -295,11 +295,9 @@ static int dlci_dev_ioctl(struct net_devstatic int dlci_change_mtu (struct net_device *dev,int new_mtu) { -struct dlci_local *dlp; - - dlp =netdev_priv (dev); +struct dlci_local *dlp =netdev_priv (dev); -return ((*dlp->slave->change_mtu)(dlp->slave, new_mtu)); +return dev_set_mtu (dlp->slave, new_mtu); }static int dlci_open (struct net_device *dev)
@@ -479,17 +477,21 @@ static const struct header_ops dlci_head .create = dlci_header, }; +static const struct net_device_ops dlci_netdev_ops = { + .ndo_open = dlci_open, + .ndo_stop = dlci_close, + .ndo_do_ioctl = dlci_dev_ioctl, + .ndo_start_xmit = dlci_transmit, + .ndo_change_mtu = dlci_change_mtu, +}; +static void dlci_setup (struct net_device *dev) {struct dlci_local *dlp =netdev_priv (dev); dev->flags =0 ; - dev->open = dlci_open; - dev->stop = dlci_close; - dev->do_ioctl = dlci_dev_ioctl; - dev->hard_start_xmit = dlci_transmit; dev->header_ops = &dlci_header_ops; - dev->change_mtu = dlci_change_mtu; + dev->netdev_ops = &dlci_netdev_ops; dev->destructor = free_netdev; dlp->receive = dlci_receive;
PATCH 49/77 cycx: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/wan/cycx_x25.c +21 -20
@@ -355,12 +355,6 @@ static int cycx_wan_update(struct wan_dereturn 0 ; } -/* callback to initialize device */ -static void cycx_x25_chan_setup (struct net_device *dev) -{ - dev->init = cycx_netdevice_init; -} -/* Create new logical channel. * This routine is called by the router when ROUTER_IFNEW IOCTL is being * handled.
@@ -476,6 +470,27 @@ static const struct header_ops cycx_head .rebuild = cycx_netdevice_rebuild_header, }; +static const struct net_device_ops cycx_netdev_ops = { + .ndo_init = cycx_netdevice_init, + .ndo_open = cycx_netdevice_open, + .ndo_stop = cycx_netdevice_stop, + .ndo_start_xmit = cycx_netdevice_hard_start_xmit, + .ndo_get_stats = cycx_netdevice_get_stats, +}; + +static void cycx_x25_chan_setup (struct net_device *dev) +{ +/* Initialize device driver entry points */ + dev->netdev_ops = &cycx_netdev_ops; + dev->header_ops = &cycx_header_ops; + +/* Initialize media-specific parameters */ + dev->mtu =CYCX_X25_CHAN_MTU ; + dev->type =ARPHRD_HWX25 ;/* ARP h/w type */ + dev->hard_header_len =0 ;/* media header length */ + dev->addr_len =0 ;/* hardware address length */ +} +/* Initialize Linux network interface. * * This routine is called only once for each interface, during Linux network
@@ -487,20 +502,6 @@ static int cycx_netdevice_init(struct nestruct cycx_device *card = chan->card;struct wan_device *wandev = &card->wandev; -/* Initialize device driver entry points */ - dev->open = cycx_netdevice_open; - dev->stop = cycx_netdevice_stop; - dev->header_ops = &cycx_header_ops; - - dev->hard_start_xmit = cycx_netdevice_hard_start_xmit; - dev->get_stats = cycx_netdevice_get_stats; - -/* Initialize media-specific parameters */ - dev->mtu =CYCX_X25_CHAN_MTU ; - dev->type =ARPHRD_HWX25 ;/* ARP h/w type */ - dev->hard_header_len =0 ;/* media header length */ - dev->addr_len =0 ;/* hardware address length */ -if (!chan->svc) *(__be16 *)dev->dev_addr =htons (chan->lcn);
PATCH 50/77 lapbether: convert to internal net_device_stats
In reply to Stephen Hemmingerdrivers/net/wan/lapbether.c +4 -16
@@ -55,7 +55,6 @@ struct lapbethdev {struct list_head node;struct net_device *ethdev;/* link to ethernet device */ struct net_device *axdev;/* lapbeth device (lapb#) */ -struct net_device_stats stats;/* some statistics */ };static LIST_HEAD (lapbeth_devices);
@@ -107,10 +106,9 @@ static int lapbeth_rcv(struct sk_buff *sif (!netif_running (lapbeth->axdev)) goto drop_unlock; - lapbeth->stats.rx_packets++; - len = skb->data[0 ] + skb->data[1 ] *256 ; - lapbeth->stats.rx_bytes += len; + dev->stats.rx_packets++; + dev->stats.rx_bytes += len;skb_pull (skb,2 );/* Remove the length bytes */ skb_trim (skb, len);/* Set the length of the data */
@@ -210,8 +208,8 @@ static void lapbeth_data_transmit(struct *ptr++ = size %256 ; *ptr++ = size /256 ; - lapbeth->stats.tx_packets++; - lapbeth->stats.tx_bytes += size; + ndev->stats.tx_packets++; + ndev->stats.tx_bytes += size; skb->dev = dev = lapbeth->ethdev;
@@ -255,15 +253,6 @@ static void lapbeth_disconnected(struct }/* -* Statistics -*/ -static struct net_device_stats *lapbeth_get_stats (struct net_device *dev) -{ -struct lapbethdev *lapbeth =netdev_priv (dev); -return &lapbeth->stats; -} - -/* * Set AX.25 callsign */ static int lapbeth_set_mac_address (struct net_device *dev,void *addr)
@@ -321,7 +310,6 @@ static void lapbeth_setup(struct net_dev dev->stop = lapbeth_close; dev->destructor = free_netdev; dev->set_mac_address = lapbeth_set_mac_address; - dev->get_stats = lapbeth_get_stats; dev->type =ARPHRD_X25 ; dev->hard_header_len =3 ; dev->mtu =1000 ;
PATCH 51/77 labether: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/wan/lapbether.c +8 -4
@@ -303,13 +303,17 @@ static int lapbeth_close(struct net_devi/* ------------------------------------------------------------------------ */ +static const struct net_device_ops lapbeth_netdev_ops = { + .ndo_open = lapbeth_open, + .ndo_stop = lapbeth_close, + .ndo_start_xmit = lapbeth_xmit, + .ndo_set_mac_address = lapbeth_set_mac_address, +}; +static void lapbeth_setup (struct net_device *dev) { - dev->hard_start_xmit = lapbeth_xmit; - dev->open = lapbeth_open; - dev->stop = lapbeth_close; + dev->netdev_ops = &lapbeth_netdev_ops; dev->destructor = free_netdev; - dev->set_mac_address = lapbeth_set_mac_address; dev->type =ARPHRD_X25 ; dev->hard_header_len =3 ; dev->mtu =1000 ;
PATCH 52/77 sbni: use internal net_device_stats
In reply to Stephen HemmingerConvert to use existing net_device_stats.
This driver,
has bad style,
of using commas,
when brackets should be used...
drivers/net/wan/sbni.c +26 -42
@@ -68,7 +68,6 @@/* device private data */ struct net_local { -struct net_device_stats stats;struct timer_list watchdog;spinlock_t lock;
@@ -117,7 +116,6 @@ static int sbni_open( struct net_devicestatic int sbni_close (struct net_device * );static int sbni_start_xmit (struct sk_buff *,struct net_device * );static int sbni_ioctl (struct net_device *,struct ifreq *,int ); -static struct net_device_stats *sbni_get_stats (struct net_device * );static void set_multicast_list (struct net_device * );static irqreturn_t sbni_interrupt (int ,void * );
@@ -723,13 +721,11 @@ upload_data( struct net_device *dev, u nl->wait_frameno = 0, nl->inppos = 0,#ifdef CONFIG_SBNI_MULTILINE - ((struct net_local *)netdev_priv (nl->master)) - ->stats.rx_errors++, - ((struct net_local *)netdev_priv (nl->master)) - ->stats.rx_missed_errors++; + nl->master->stats.rx_errors++, + nl->master->stats.rx_missed_errors++;#else - nl->stats.rx_errors++, - nl->stats.rx_missed_errors++; + dev->stats.rx_errors++, + dev->stats.rx_missed_errors++;#endif /* now skip all frames until is_first != 0 */ }else
@@ -742,13 +738,11 @@ upload_data( struct net_device *dev, u*/ nl->wait_frameno = 0,#ifdef CONFIG_SBNI_MULTILINE - ((struct net_local *)netdev_priv (nl->master)) - ->stats.rx_errors++, - ((struct net_local *)netdev_priv (nl->master)) - ->stats.rx_crc_errors++; + nl->master->stats.rx_errors++, + nl->master->stats.rx_crc_errors++;#else - nl->stats.rx_errors++, - nl->stats.rx_crc_errors++; + dev->stats.rx_errors++, + dev->stats.rx_crc_errors++;#endif return frame_ok;
@@ -756,15 +750,16 @@ upload_data( struct net_device *dev, ustatic inline void -send_complete (struct net_local *nl ) +send_complete (struct net_device *dev ) { +struct net_local *nl =netdev_priv (dev); +#ifdef CONFIG_SBNI_MULTILINE - ((struct net_local *)netdev_priv (nl->master))->stats.tx_packets++; - ((struct net_local *)netdev_priv (nl->master))->stats.tx_bytes - += nl->tx_buf_p->len; + nl->master->stats.tx_packets++; + nl->master->stats.tx_bytes += nl->tx_buf_p->len;#else - nl->stats.tx_packets++; - nl->stats.tx_bytes += nl->tx_buf_p->len; + dev->stats.tx_packets++; + dev->stats.tx_bytes += nl->tx_buf_p->len;#endif dev_kfree_skb_irq ( nl->tx_buf_p );
@@ -792,7 +787,7 @@ interpret_ack( struct net_device *dev, nl->maxframe, nl->tx_buf_p->len - nl->outpos); else - send_complete( nl ), + send_complete( dev ),#ifdef CONFIG_SBNI_MULTILINE netif_wake_queue ( nl->master );#else
@@ -881,13 +876,11 @@ drop_xmit_queue( struct net_device *dev dev_kfree_skb_any( nl->tx_buf_p ), nl->tx_buf_p = NULL,#ifdef CONFIG_SBNI_MULTILINE - ((struct net_local *)netdev_priv (nl->master)) - ->stats.tx_errors++, - ((struct net_local *)netdev_priv (nl->master)) - ->stats.tx_carrier_errors++; + nl->master->stats.tx_errors++, + nl->master->stats.tx_carrier_errors++;#else - nl->stats.tx_errors++, - nl->stats.tx_carrier_errors++; + dev->stats.tx_errors++, + dev->stats.tx_carrier_errors++;#endif nl->tx_frameno =0 ;
@@ -1017,14 +1010,13 @@ indicate_pkt( struct net_device *dev )#ifdef CONFIG_SBNI_MULTILINE skb->protocol =eth_type_trans ( skb, nl->master );netif_rx ( skb ); - ++((struct net_local *)netdev_priv (nl->master))->stats.rx_packets; - ((struct net_local *)netdev_priv (nl->master))->stats.rx_bytes += - nl->inppos; + ++nl->master->stats.rx_packets; + nl->master->stats.rx_bytes += nl->inppos;#else skb->protocol =eth_type_trans ( skb, dev );netif_rx ( skb ); - ++nl->stats.rx_packets; - nl->stats.rx_bytes += nl->inppos; + ++dev->stats.rx_packets; + dev->stats.rx_bytes += nl->inppos;#endif nl->rx_buf_p =NULL ;/* protocol driver will clear this sk_buff */ }
@@ -1197,7 +1189,7 @@ sbni_open( struct net_device *dev ) handler_attached:spin_lock ( &nl->lock ); -memset ( &nl->stats,0 ,sizeof (struct net_device_stats ) ); +memset ( &dev->stats,0 ,sizeof (struct net_device_stats ) );memset ( &nl->in_stats,0 ,sizeof (struct sbni_in_stats ) );card_start ( dev );
@@ -1413,7 +1405,7 @@ enslave( struct net_device *dev, struc/* Summary statistics of MultiLine operation will be stored in master's counters */ -memset ( &snl->stats,0 ,sizeof (struct net_device_stats ) ); +memset ( &slave_dev->stats,0 ,sizeof (struct net_device_stats ) );netif_stop_queue ( slave_dev );netif_wake_queue ( dev );/* Now we are able to transmit */
@@ -1464,14 +1456,6 @@ emancipate( struct net_device *dev )#endif - -static struct net_device_stats * -sbni_get_stats (struct net_device *dev ) -{ -return &((struct net_local *)netdev_priv (dev))->stats; -} - -static void set_multicast_list (struct net_device *dev ) {
PATCH 53/77 sbni: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/wan/sbni.c +14 -6
@@ -206,15 +206,21 @@ sbni_isa_probe( struct net_device *dev } } +static const struct net_device_ops sbni_netdev_ops = { + .ndo_open = sbni_open, + .ndo_stop = sbni_close, + .ndo_start_xmit = sbni_start_xmit, + .ndo_set_multicast_list = set_multicast_list, + .ndo_do_ioctl = sbni_ioctl, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +static void __init sbni_devsetup (struct net_device *dev) {ether_setup ( dev ); - dev->open = &sbni_open; - dev->stop = &sbni_close; - dev->hard_start_xmit = &sbni_start_xmit; - dev->get_stats = &sbni_get_stats; - dev->set_multicast_list = &set_multicast_list; - dev->do_ioctl = &sbni_ioctl; + dev->netdev_ops = &sbni_netdev_ops; }int __init sbni_probe (int unit)
@@ -227,6 +233,8 @@ int __init sbni_probe(int unit)if (!dev)return -ENOMEM ; + dev->netdev_ops = &sbni_netdev_ops; +sprintf (dev->name,"sbni%d" , unit);netdev_boot_setup_check (dev);
PATCH 54/77 netwave: convert to internal net_device_stats
In reply to Stephen Hemmingerdrivers/net/wireless/netwave_cs.c +14 -58
@@ -210,10 +210,6 @@ static int netwave_rx( struct net_devicestatic irqreturn_t netwave_interrupt (int irq,void *dev_id);static void netwave_watchdog (struct net_device *); -/* Statistics */ -static void update_stats (struct net_device *dev); -static struct net_device_stats *netwave_get_stats (struct net_device *dev); -/* Wireless extensions */ static struct iw_statistics *netwave_get_wireless_stats (struct net_device *dev);
@@ -275,14 +271,9 @@ typedef struct netwave_private {int lastExec;struct timer_list watchdog;/* To avoid blocking state */ struct site_survey nss; -struct net_device_stats stats;struct iw_statistics iw_stats;/* Wireless stats */ } netwave_private; -#ifdef NETWAVE_STATS -static struct net_device_stats *netwave_get_stats (struct net_device *dev); -#endif -/* * The Netwave card is little-endian, so won't work for big endian * systems.
@@ -413,7 +404,6 @@ static int netwave_probe(struct pcmcia_d/* Netwave specific entries in the device structure */ dev->hard_start_xmit = &netwave_start_xmit; - dev->get_stats = &netwave_get_stats; dev->set_multicast_list = &set_multicast_list;/* wireless extensions */ dev->wireless_handlers = (struct iw_handler_def *)&netwave_handler_def;
@@ -988,7 +978,7 @@ static int netwave_hw_xmit(unsigned charreturn 1 ; } - priv->stats.tx_bytes += len; + dev->stats.tx_bytes += len; DEBUG(3, "Transmitting with SPCQ %x SPU %x LIF %x ISPLQ %x\n", readb(ramBase + NETWAVE_EREG_SPCQ),
@@ -1107,11 +1097,11 @@ static irqreturn_t netwave_interrupt(int rser =readb (ramBase +NETWAVE_EREG_RSER );if (rser &0x04 ) { - ++priv->stats.rx_dropped; - ++priv->stats.rx_crc_errors; + ++dev->stats.rx_dropped; + ++dev->stats.rx_crc_errors; }if (rser &0x02 ) - ++priv->stats.rx_frame_errors; + ++dev->stats.rx_frame_errors;/* Clear the RxErr bit in RSER. RSER+4 is the * write part. Also clear the RxCRC (0x04) and
@@ -1125,8 +1115,8 @@ static irqreturn_t netwave_interrupt(intwait_WOC (iobase);writeb (0x40 , ramBase +NETWAVE_EREG_ASCC ); -/* Remember to count up priv->stats on error packets */ - ++priv->stats.rx_errors; +/* Remember to count up dev->stats on error packets */ + ++dev->stats.rx_errors; }/* TxDN */ if (status &0x20 ) {
@@ -1140,17 +1130,17 @@ static irqreturn_t netwave_interrupt(int/* Transmitting was okay, clear bits */ wait_WOC (iobase);writeb (0x2f , ramBase +NETWAVE_EREG_TSER +4 ); - ++priv->stats.tx_packets; + ++dev->stats.tx_packets; }if (txStatus &0xd0 ) {if (txStatus &0x80 ) { - ++priv->stats.collisions;/* Because of /proc/net/dev*/ -/* ++priv->stats.tx_aborted_errors; */ + ++dev->stats.collisions;/* Because of /proc/net/dev*/ +/* ++dev->stats.tx_aborted_errors; */ /* printk("Collision. %ld\n", jiffies - dev->trans_start); */ }if (txStatus &0x40 ) - ++priv->stats.tx_carrier_errors; + ++dev->stats.tx_carrier_errors;/* 0x80 TxGU Transmit giveup - nine times and no luck * 0x40 TxNOAP No access point. Discarded packet. * 0x10 TxErr Transmit error. Always set when
@@ -1163,7 +1153,7 @@ static irqreturn_t netwave_interrupt(int/* Clear out TxGU, TxNOAP, TxErr and TxTrys */ wait_WOC (iobase);writeb (0xdf & txStatus, ramBase+NETWAVE_EREG_TSER +4 ); - ++priv->stats.tx_errors; + ++dev->stats.tx_errors; } DEBUG(3, "New status is TSER %x ASR %x\n", readb(ramBase + NETWAVE_EREG_TSER),
@@ -1197,40 +1187,6 @@ static void netwave_watchdog(struct net_netif_wake_queue (dev); }/* netwave_watchdog */ -static struct net_device_stats *netwave_get_stats (struct net_device *dev) { -netwave_private *priv =netdev_priv (dev); - -update_stats (dev); - -DEBUG (2 ,"netwave: SPCQ %x SPU %x LIF %x ISPLQ %x MHS %x rxtx %x" -" %x tx %x %x %x %x\n" , -readb (priv->ramBase +NETWAVE_EREG_SPCQ ), -readb (priv->ramBase +NETWAVE_EREG_SPU ), -readb (priv->ramBase +NETWAVE_EREG_LIF ), -readb (priv->ramBase +NETWAVE_EREG_ISPLQ ), -readb (priv->ramBase +NETWAVE_EREG_MHS ), -readb (priv->ramBase +NETWAVE_EREG_EC +0xe ), -readb (priv->ramBase +NETWAVE_EREG_EC +0xf ), -readb (priv->ramBase +NETWAVE_EREG_EC +0x18 ), -readb (priv->ramBase +NETWAVE_EREG_EC +0x19 ), -readb (priv->ramBase +NETWAVE_EREG_EC +0x1a ), -readb (priv->ramBase +NETWAVE_EREG_EC +0x1b )); - -return &priv->stats; -} - -static void update_stats (struct net_device *dev) { -//unsigned long flags; -/* netwave_private *priv = netdev_priv(dev); */ - -//spin_lock_irqsave(&priv->spinlock, flags); - -/* priv->stats.rx_packets = readb(priv->ramBase + 0x18e); -priv->stats.tx_packets = readb(priv->ramBase + 0x18f); */ - -//spin_unlock_irqrestore(&priv->spinlock, flags); -} -static int netwave_rx (struct net_device *dev) {netwave_private *priv =netdev_priv (dev);
@@ -1274,7 +1230,7 @@ static int netwave_rx(struct net_deviceif (skb ==NULL ) {DEBUG (1 ,"netwave_rx: Could not allocate an sk_buff of " "length %d\n" , rcvLen); - ++priv->stats.rx_dropped; + ++dev->stats.rx_dropped;/* Tell the adapter to skip the packet */ wait_WOC (iobase);writeb (NETWAVE_CMD_SRP , ramBase +NETWAVE_EREG_CB +0 );
@@ -1307,8 +1263,8 @@ static int netwave_rx(struct net_device/* Queue packet for network layer */ netif_rx (skb); - priv->stats.rx_packets++; - priv->stats.rx_bytes += rcvLen; + dev->stats.rx_packets++; + dev->stats.rx_bytes += rcvLen;/* Got the packet, tell the adapter to skip it */ wait_WOC (iobase);
PATCH 59/77 airo: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/wireless/airo.c +44 -19
@@ -2646,17 +2646,21 @@ static const struct header_ops airo_head .parse = wll_header_parse, }; +static const struct net_device_ops airo11_netdev_ops = { + .ndo_open = airo_open, + .ndo_stop = airo_close, + .ndo_start_xmit = airo_start_xmit11, + .ndo_get_stats = airo_get_stats, + .ndo_set_mac_address = airo_set_mac_address, + .ndo_do_ioctl = airo_ioctl, + .ndo_change_mtu = airo_change_mtu, +}; +static void wifi_setup (struct net_device *dev) { + dev->netdev_ops = &airo11_netdev_ops; dev->header_ops = &airo_header_ops; - dev->hard_start_xmit = &airo_start_xmit11; - dev->get_stats = &airo_get_stats; - dev->set_mac_address = &airo_set_mac_address; - dev->do_ioctl = &airo_ioctl; dev->wireless_handlers = &airo_handler_def; - dev->change_mtu = &airo_change_mtu; - dev->open = &airo_open; - dev->stop = &airo_close; dev->type =ARPHRD_IEEE80211 ; dev->hard_header_len =ETH_HLEN ;
@@ -2739,6 +2743,33 @@ static void airo_networks_initialize(str &ai->network_free_list); } +static const struct net_device_ops airo_netdev_ops = { + .ndo_open = airo_open, + .ndo_stop = airo_close, + .ndo_start_xmit = airo_start_xmit, + .ndo_get_stats = airo_get_stats, + .ndo_set_multicast_list = airo_set_multicast_list, + .ndo_set_mac_address = airo_set_mac_address, + .ndo_do_ioctl = airo_ioctl, + .ndo_change_mtu = airo_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; + +static const struct net_device_ops mpi_netdev_ops = { + .ndo_open = airo_open, + .ndo_stop = airo_close, + .ndo_start_xmit = mpi_start_xmit, + .ndo_get_stats = airo_get_stats, + .ndo_set_multicast_list = airo_set_multicast_list, + .ndo_set_mac_address = airo_set_mac_address, + .ndo_do_ioctl = airo_ioctl, + .ndo_change_mtu = airo_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; + +static struct net_device *_init_airo_card (unsigned short irq,int port,int is_pcmcia,struct pci_dev *pci,struct device *dmdev )
@@ -2776,22 +2807,16 @@ static struct net_device *_init_airo_car goto err_out_free;airo_networks_initialize (ai); +skb_queue_head_init (&ai->txq); +/* The Airo-specific entries in the device structure. */ -if (test_bit (FLAG_MPI ,&ai->flags)) { -skb_queue_head_init (&ai->txq); - dev->hard_start_xmit = &mpi_start_xmit; - }else - dev->hard_start_xmit = &airo_start_xmit; - dev->get_stats = &airo_get_stats; - dev->set_multicast_list = &airo_set_multicast_list; - dev->set_mac_address = &airo_set_mac_address; - dev->do_ioctl = &airo_ioctl; +if (test_bit (FLAG_MPI ,&ai->flags)) + dev->netdev_ops = &mpi_netdev_ops; +else + dev->netdev_ops = &airo_netdev_ops; dev->wireless_handlers = &airo_handler_def; ai->wireless_data.spy_data = &ai->spy_data; dev->wireless_data = &ai->wireless_data; - dev->change_mtu = &airo_change_mtu; - dev->open = &airo_open; - dev->stop = &airo_close; dev->irq = irq; dev->base_addr = port;
PATCH 76/77 hostap: convert to net_device_ops
In reply to Stephen Hemminger--- drivers/net/wireless/hostap/hostap_hw.c | 1 drivers/net/wireless/hostap/hostap_main.c | 69 ++++++++++++++++++++++-------- 2 files changed, 52 insertions(+), 18 deletions(-)
drivers/net/wireless/hostap/hostap_main.c +52 -17
@@ -815,6 +815,46 @@ const struct header_ops hostap_80211_ops };EXPORT_SYMBOL (hostap_80211_ops); + +static const struct net_device_ops hostap_netdev_ops = { + .ndo_start_xmit = hostap_data_start_xmit, + + .ndo_open = prism2_open, + .ndo_stop = prism2_close, + .ndo_do_ioctl = hostap_ioctl, + .ndo_set_mac_address = prism2_set_mac_address, + .ndo_set_multicast_list = hostap_set_multicast_list, + .ndo_change_mtu = prism2_change_mtu, + .ndo_tx_timeout = prism2_tx_timeout, + .ndo_validate_addr = eth_validate_addr, +}; + +static const struct net_device_ops hostap_mgmt_netdev_ops = { + .ndo_start_xmit = hostap_mgmt_start_xmit, + + .ndo_open = prism2_open, + .ndo_stop = prism2_close, + .ndo_do_ioctl = hostap_ioctl, + .ndo_set_mac_address = prism2_set_mac_address, + .ndo_set_multicast_list = hostap_set_multicast_list, + .ndo_change_mtu = prism2_change_mtu, + .ndo_tx_timeout = prism2_tx_timeout, + .ndo_validate_addr = eth_validate_addr, +}; + +static const struct net_device_ops hostap_master_ops = { + .ndo_start_xmit = hostap_master_start_xmit, + + .ndo_open = prism2_open, + .ndo_stop = prism2_close, + .ndo_do_ioctl = hostap_ioctl, + .ndo_set_mac_address = prism2_set_mac_address, + .ndo_set_multicast_list = hostap_set_multicast_list, + .ndo_change_mtu = prism2_change_mtu, + .ndo_tx_timeout = prism2_tx_timeout, + .ndo_validate_addr = eth_validate_addr, +}; +void hostap_setup_dev (struct net_device *dev,local_info_t *local,int type) {
@@ -830,30 +870,25 @@ void hostap_setup_dev(struct net_device iface->wireless_data.spy_data = &iface->spy_data; dev->wireless_data = &iface->wireless_data; } - dev->wireless_handlers = - (struct iw_handler_def *) &hostap_iw_handler_def; - dev->do_ioctl = hostap_ioctl; - dev->open = prism2_open; - dev->stop = prism2_close; - dev->set_mac_address = prism2_set_mac_address; - dev->set_multicast_list = hostap_set_multicast_list; - dev->change_mtu = prism2_change_mtu; - dev->tx_timeout = prism2_tx_timeout; + dev->wireless_handlers = &hostap_iw_handler_def; dev->watchdog_timeo =TX_TIMEOUT ; -if (type ==HOSTAP_INTERFACE_AP ) { - dev->hard_start_xmit = hostap_mgmt_start_xmit; +switch (type) { +case HOSTAP_INTERFACE_AP : + dev->netdev_ops = &hostap_mgmt_netdev_ops; dev->type =ARPHRD_IEEE80211 ; dev->header_ops = &hostap_80211_ops; - }else { - dev->hard_start_xmit = hostap_data_start_xmit; +break ; +case HOSTAP_INTERFACE_MASTER : + dev->tx_queue_len =0 ;/* use main radio device queue */ + dev->netdev_ops = &hostap_master_ops; +break ; +default : + dev->netdev_ops = &hostap_netdev_ops; } dev->mtu = local->mtu; -if (type !=HOSTAP_INTERFACE_MASTER ) { -/* use main radio device queue */ - dev->tx_queue_len =0 ; - } +SET_ETHTOOL_OPS (dev, &prism2_ethtool_ops);
drivers/net/wireless/hostap/hostap_hw.c +0 -1
@@ -3222,7 +3222,6 @@ while (0)hostap_setup_dev (dev, local,HOSTAP_INTERFACE_MASTER ); - dev->hard_start_xmit = hostap_master_start_xmit; dev->type =ARPHRD_IEEE80211 ; dev->header_ops = &hostap_80211_ops;
PATCH 77/77 netdev: expose net_device_ops compat as config option
In reply to Stephen HemmingerNow that most network device drivers in (all but one in x86_64 allmodconfig) support net_device_ops. Expose it as a configuration parameter. Still need to address even older 32 bit drivers, and other arch before compatiablity can be scheduled for removal in some future release.
--- drivers/net/Kconfig | 9 +++++++++ net/Kconfig | 3 --- 2 files changed, 9 insertions(+), 3 deletions(-)
drivers/net/Kconfig +9 -0
@@ -26,6 +26,15 @@ menuconfig NETDEVICES # that for each of the symbols. if NETDEVICES +config COMPAT_NET_DEV_OPS + default y + bool "Enable older network device API compatiablity" + ---help--- + This option enables kernel compatiability with older network devices + that do not use net_device_ops interface. + + If unsure, say Y. + config IFB tristate "Intermediate Functional Block support" depends on NET_CLS_ACT
net/Kconfig +0 -3
@@ -24,9 +24,6 @@ if NET menu "Networking options" -config COMPAT_NET_DEV_OPS - def_bool y - source "net/packet/Kconfig" source "net/unix/Kconfig" source "net/xfrm/Kconfig"
PATCH 61/77 raylan: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/wireless/ray_cs.c +14 -7
@@ -298,6 +298,19 @@ static char hop_pattern_length[] = { 1,static char rcsid[] ="Raylink/WebGear wireless LAN - Corey <Thomas [email protected]>" ; +static const struct net_device_ops ray_netdev_ops = { + .ndo_init = ray_dev_init, + .ndo_open = ray_open, + .ndo_stop = ray_dev_close, + .ndo_start_xmit = ray_dev_start_xmit, + .ndo_set_config = ray_dev_config, + .ndo_get_stats = ray_get_stats, + .ndo_set_multicast_list = set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +/*============================================================================= ray_attach() creates an "instance" of the driver, allocating local data structures for one device. The device is registered
@@ -347,9 +360,7 @@ static int ray_probe(struct pcmcia_devic p_dev, dev, local, &ray_interrupt);/* Raylink entries in the device structure */ - dev->hard_start_xmit = &ray_dev_start_xmit; - dev->set_config = &ray_dev_config; - dev->get_stats = &ray_get_stats; + dev->netdev_ops = &ray_netdev_ops;SET_ETHTOOL_OPS (dev, &netdev_ethtool_ops); dev->wireless_handlers = &ray_handler_def;#ifdef WIRELESS_SPY
@@ -357,12 +368,8 @@ static int ray_probe(struct pcmcia_devic dev->wireless_data = &local->wireless_data;#endif /* WIRELESS_SPY */ - dev->set_multicast_list = &set_multicast_list;DEBUG (2 ,"ray_cs ray_attach calling ether_setup.)\n" ); - dev->init = &ray_dev_init; - dev->open = &ray_open; - dev->stop = &ray_dev_close;netif_stop_queue (dev);init_timer (&local->timer);
PATCH 71/77 ipw2x00: convert to internal net_device_stats
In reply to Stephen HemmingerReplace struct in ieee with current net_device_stats, so no longer need get_stats hook
--- drivers/net/wireless/ipw2x00/ieee80211.h | 1 drivers/net/wireless/ipw2x00/ipw2100.c | 36 +++++++++--------- drivers/net/wireless/ipw2x00/ipw2200.c | 52 +++++++++------------------ drivers/net/wireless/ipw2x00/libipw_module.c | 11 ----- drivers/net/wireless/ipw2x00/libipw_rx.c | 17 +++----- drivers/net/wireless/ipw2x00/libipw_tx.c | 9 ++-- 6 files changed, 49 insertions(+), 77 deletions(-)
drivers/net/wireless/ipw2x00/ieee80211.h +0 -1
@@ -786,7 +786,6 @@ struct ieee80211_device {struct ieee80211_security sec;/* Bookkeeping structures */ -struct net_device_stats stats;struct ieee80211_stats ieee_stats;struct ieee80211_geo geo;
drivers/net/wireless/ipw2x00/libipw_module.c +0 -11
@@ -139,13 +139,6 @@ static int ieee80211_change_mtu(struct nreturn 0 ; } -static struct net_device_stats *ieee80211_generic_get_stats ( -struct net_device *dev) -{ -struct ieee80211_device *ieee =netdev_priv (dev); -return &ieee->stats; -} -struct net_device *alloc_ieee80211 (int sizeof_priv) {struct ieee80211_device *ieee;
@@ -163,10 +156,6 @@ struct net_device *alloc_ieee80211(int s dev->hard_start_xmit = ieee80211_xmit; dev->change_mtu = ieee80211_change_mtu; -/* Drivers are free to override this if the generic implementation -* does not meet their needs. */ - dev->get_stats = ieee80211_generic_get_stats; - ieee->dev = dev; err =ieee80211_networks_allocate (ieee);
drivers/net/wireless/ipw2x00/libipw_rx.c +7 -10
@@ -335,7 +335,6 @@ int ieee80211_rx(struct ieee80211_devicestruct ieee80211_hdr_4addr *hdr;size_t hdrlen;u16 fc, type, stype, sc; -struct net_device_stats *stats;unsigned int frag;u8 *payload;u16 ethertype;
@@ -354,8 +353,6 @@ int ieee80211_rx(struct ieee80211_deviceint can_be_decrypted =0 ; hdr = (struct ieee80211_hdr_4addr *)skb->data; - stats = &ieee->stats; -if (skb->len <10 ) {printk (KERN_INFO "%s: SKB length < 10\n" , dev->name); goto rx_dropped;
@@ -412,8 +409,8 @@ int ieee80211_rx(struct ieee80211_device#endif if (ieee->iw_mode ==IW_MODE_MONITOR ) { - stats->rx_packets++; - stats->rx_bytes += skb->len; + dev->stats.rx_packets++; + dev->stats.rx_bytes += skb->len;ieee80211_monitor_rx (ieee, skb, rx_stats);return 1 ; }
@@ -769,8 +766,8 @@ int ieee80211_rx(struct ieee80211_device }#endif - stats->rx_packets++; - stats->rx_bytes += skb->len; + dev->stats.rx_packets++; + dev->stats.rx_bytes += skb->len;#ifdef NOT_YET if (ieee->iw_mode ==IW_MODE_MASTER && !wds && ieee->ap->bridge_packets) {
@@ -812,7 +809,7 @@ int ieee80211_rx(struct ieee80211_device* in our stats. */ IEEE80211_DEBUG_DROP ("RX: netif_rx dropped the packet\n" ); - stats->rx_dropped++; + dev->stats.rx_dropped++; } }
@@ -824,7 +821,7 @@ int ieee80211_rx(struct ieee80211_devicereturn 1 ; rx_dropped: - stats->rx_dropped++; + dev->stats.rx_dropped++;/* Returning 0 indicates to caller that we have not handled the SKB-- * so it is still allocated and can be used again by underlying
@@ -919,7 +916,7 @@ void ieee80211_rx_any(struct ieee80211_d drop_free:dev_kfree_skb_irq (skb); - ieee->stats.rx_dropped++; + ieee->dev->stats.rx_dropped++;return ; }
drivers/net/wireless/ipw2x00/libipw_tx.c +4 -5
@@ -260,7 +260,6 @@ int ieee80211_xmit(struct sk_buff *skb,int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size, rts_required;unsigned long flags; -struct net_device_stats *stats = &ieee->stats;int encrypt, host_encrypt, host_encrypt_msdu, host_build_iv;__be16 ether_type;int bytes, fc, hdr_len;
@@ -306,7 +305,7 @@ int ieee80211_xmit(struct sk_buff *skb,if (!encrypt && ieee->ieee802_1x && ieee->drop_unencrypted && ether_type !=htons (ETH_P_PAE )) { - stats->tx_dropped++; + dev->stats.tx_dropped++; goto success; }
@@ -526,8 +525,8 @@ int ieee80211_xmit(struct sk_buff *skb,if (txb) {int ret = (*ieee->hard_start_xmit) (txb, dev, priority);if (ret ==0 ) { - stats->tx_packets++; - stats->tx_bytes += txb->payload_size; + dev->stats.tx_packets++; + dev->stats.tx_bytes += txb->payload_size;return 0 ; }
@@ -539,7 +538,7 @@ int ieee80211_xmit(struct sk_buff *skb, failed:spin_unlock_irqrestore (&ieee->lock, flags);netif_stop_queue (dev); - stats->tx_errors++; + dev->stats.tx_errors++;return 1 ; }
drivers/net/wireless/ipw2x00/ipw2100.c +19 -17
@@ -2391,13 +2391,14 @@ static void ipw2100_corruption_detected(#endif priv->fatal_error =IPW2100_ERR_C3_CORRUPTION ; - priv->ieee->stats.rx_errors++; + priv->net_dev->stats.rx_errors++;schedule_reset (priv); }static void isr_rx (struct ipw2100_priv *priv,int i,struct ieee80211_rx_stats *stats) { +struct net_device *dev = priv->net_dev;struct ipw2100_status *status = &priv->status_queue.drv[i];struct ipw2100_rx_packet *packet = &priv->rx_buffers[i];
@@ -2406,14 +2407,14 @@ static void isr_rx(struct ipw2100_priv *if (unlikely (status->frame_size >skb_tailroom (packet->skb))) {IPW_DEBUG_INFO ("%s: frame_size (%u) > skb_tailroom (%u)!" " Dropping.\n" , - priv->net_dev->name, + dev->name, status->frame_size,skb_tailroom (packet->skb)); - priv->ieee->stats.rx_errors++; + dev->stats.rx_errors++;return ; } -if (unlikely (!netif_running (priv->net_dev))) { - priv->ieee->stats.rx_errors++; +if (unlikely (!netif_running (dev))) { + dev->stats.rx_errors++; priv->wstats.discard.misc++;IPW_DEBUG_DROP ("Dropping packet while interface is not up.\n" );return ;
@@ -2443,10 +2444,10 @@ static void isr_rx(struct ipw2100_priv *if (!ieee80211_rx (priv->ieee, packet->skb, stats)) {#ifdef IPW2100_RX_DEBUG IPW_DEBUG_DROP ("%s: Non consumed packet:\n" , - priv->net_dev->name); + dev->name);printk_buf (IPW_DL_DROP , packet_data, status->frame_size);#endif - priv->ieee->stats.rx_errors++; + dev->stats.rx_errors++;/* ieee80211_rx failed, so it didn't free the SKB */ dev_kfree_skb_any (packet->skb);
@@ -2457,7 +2458,7 @@ static void isr_rx(struct ipw2100_priv *if (unlikely (ipw2100_alloc_skb (priv, packet))) { printk(KERN_WARNING DRV_NAME ": ""%s: Unable to allocate SKB onto RBD ring - disabling " - "adapter.\n", priv->net_dev->name); + "adapter.\n", dev->name);/* TODO: schedule adapter shutdown */ IPW_DEBUG_INFO ("TODO: Shutdown adapter...\n" ); }
@@ -2471,6 +2472,7 @@ static void isr_rx(struct ipw2100_priv *static void isr_rx_monitor (struct ipw2100_priv *priv,int i,struct ieee80211_rx_stats *stats) { +struct net_device *dev = priv->net_dev;struct ipw2100_status *status = &priv->status_queue.drv[i];struct ipw2100_rx_packet *packet = &priv->rx_buffers[i];
@@ -2488,15 +2490,15 @@ static void isr_rx_monitor(struct ipw210 sizeof(struct ipw_rt_hdr))) {IPW_DEBUG_INFO ("%s: frame_size (%u) > skb_tailroom (%u)!" " Dropping.\n" , - priv->net_dev->name, + dev->name, status->frame_size,skb_tailroom (packet->skb)); - priv->ieee->stats.rx_errors++; + dev->stats.rx_errors++;return ; } -if (unlikely (!netif_running (priv->net_dev))) { - priv->ieee->stats.rx_errors++; +if (unlikely (!netif_running (dev))) { + dev->stats.rx_errors++; priv->wstats.discard.misc++;IPW_DEBUG_DROP ("Dropping packet while interface is not up.\n" );return ;
@@ -2505,7 +2507,7 @@ static void isr_rx_monitor(struct ipw210if (unlikely (priv->config &CFG_CRC_CHECK && status->flags &IPW_STATUS_FLAG_CRC_ERROR )) {IPW_DEBUG_RX ("CRC error in packet. Dropping.\n" ); - priv->ieee->stats.rx_errors++; + dev->stats.rx_errors++;return ; }
@@ -2527,7 +2529,7 @@ static void isr_rx_monitor(struct ipw210skb_put (packet->skb, status->frame_size +sizeof (struct ipw_rt_hdr ));if (!ieee80211_rx (priv->ieee, packet->skb, stats)) { - priv->ieee->stats.rx_errors++; + dev->stats.rx_errors++;/* ieee80211_rx failed, so it didn't free the SKB */ dev_kfree_skb_any (packet->skb);
@@ -2538,7 +2540,7 @@ static void isr_rx_monitor(struct ipw210if (unlikely (ipw2100_alloc_skb (priv, packet))) {IPW_DEBUG_WARNING ("%s: Unable to allocate SKB onto RBD ring - disabling " -"adapter.\n" , priv->net_dev->name); +"adapter.\n" , dev->name);/* TODO: schedule adapter shutdown */ IPW_DEBUG_INFO ("TODO: Shutdown adapter...\n" ); }
@@ -3340,7 +3342,7 @@ static int ipw2100_tx(struct ieee80211_tif (!(priv->status &STATUS_ASSOCIATED )) {IPW_DEBUG_INFO ("Can not transmit when not connected.\n" ); - priv->ieee->stats.tx_carrier_errors++; + priv->net_dev->stats.tx_carrier_errors++;netif_stop_queue (dev); goto fail_unlock; }
@@ -5836,7 +5838,7 @@ static void ipw2100_tx_timeout(struct ne {struct ipw2100_priv *priv =ieee80211_priv (dev); - priv->ieee->stats.tx_errors++; + dev->stats.tx_errors++;#ifdef CONFIG_IPW2100_MONITOR if (priv->ieee->iw_mode ==IW_MODE_MONITOR )
drivers/net/wireless/ipw2x00/ipw2200.c +19 -33
171 lines not on this page · raw message
PATCH 73/77 ipw2100: convert to net_device_ops
In reply to Stephen Hemminger--- drivers/net/wireless/ipw2x00/ipw2100.c | 17 ++++++++++++----- drivers/net/wireless/ipw2x00/libipw_module.c | 2 ++ 2 files changed, 14 insertions(+), 5 deletions(-)
drivers/net/wireless/ipw2x00/ipw2100.c +12 -5
@@ -6008,6 +6008,17 @@ static void ipw2100_rf_kill(struct work_static void ipw2100_irq_tasklet (struct ipw2100_priv *priv); +static const struct net_device_ops ipw2100_netdev_ops = { + .ndo_open = ipw2100_open, + .ndo_stop = ipw2100_close, + .ndo_start_xmit = ieee80211_xmit, + .ndo_change_mtu = ieee80211_change_mtu, + .ndo_init = ipw2100_net_init, + .ndo_tx_timeout = ipw2100_tx_timeout, + .ndo_set_mac_address = ipw2100_set_address, + .ndo_validate_addr = eth_validate_addr, +}; +/* Look into using netdev destructor to shutdown ieee80211? */ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev,
@@ -6032,15 +6043,11 @@ static struct net_device *ipw2100_alloc_ priv->ieee->perfect_rssi =-20 ; priv->ieee->worst_rssi =-85 ; - dev->open = ipw2100_open; - dev->stop = ipw2100_close; - dev->init = ipw2100_net_init; + dev->netdev_ops = &ipw2100_netdev_ops; dev->ethtool_ops = &ipw2100_ethtool_ops; - dev->tx_timeout = ipw2100_tx_timeout; dev->wireless_handlers = &ipw2100_wx_handler_def; priv->wireless_data.ieee80211 = priv->ieee; dev->wireless_data = &priv->wireless_data; - dev->set_mac_address = ipw2100_set_address; dev->watchdog_timeo =3 *HZ ; dev->irq =0 ;
PATCH 74/77 ipw2200: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/wireless/ipw2x00/ipw2200.c +22 -8
@@ -11529,6 +11529,15 @@ static int ipw_prom_hard_start_xmit(strureturn -EOPNOTSUPP ; } +static const struct net_device_ops ipw_prom_netdev_ops = { + .ndo_open = ipw_prom_open, + .ndo_stop = ipw_prom_stop, + .ndo_start_xmit = ipw_prom_hard_start_xmit, + .ndo_change_mtu = ieee80211_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +static int ipw_prom_alloc (struct ipw_priv *priv) {int rc =0 ;
@@ -11548,9 +11557,7 @@ static int ipw_prom_alloc(struct ipw_primemcpy (priv->prom_net_dev->dev_addr, priv->mac_addr,ETH_ALEN ); priv->prom_net_dev->type =ARPHRD_IEEE80211_RADIOTAP ; - priv->prom_net_dev->open = ipw_prom_open; - priv->prom_net_dev->stop = ipw_prom_stop; - priv->prom_net_dev->hard_start_xmit = ipw_prom_hard_start_xmit; + priv->prom_net_dev->netdev_ops = &ipw_prom_netdev_ops; priv->prom_priv->ieee->iw_mode =IW_MODE_MONITOR ;SET_NETDEV_DEV (priv->prom_net_dev, &priv->pci_dev->dev);
@@ -11578,6 +11585,17 @@ static void ipw_prom_free(struct ipw_pri#endif +static const struct net_device_ops ipw_netdev_ops = { + .ndo_init = ipw_net_init, + .ndo_open = ipw_net_open, + .ndo_stop = ipw_net_stop, + .ndo_set_multicast_list = ipw_net_set_multicast_list, + .ndo_set_mac_address = ipw_net_set_mac_address, + .ndo_start_xmit = ieee80211_xmit, + .ndo_change_mtu = ieee80211_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +};static int __devinit ipw_pci_probe (struct pci_dev *pdev,const struct pci_device_id *ent)
@@ -11679,11 +11697,7 @@ static int __devinit ipw_pci_probe(struc priv->ieee->perfect_rssi =-20 ; priv->ieee->worst_rssi =-85 ; - net_dev->open = ipw_net_open; - net_dev->stop = ipw_net_stop; - net_dev->init = ipw_net_init; - net_dev->set_multicast_list = ipw_net_set_multicast_list; - net_dev->set_mac_address = ipw_net_set_mac_address; + net_dev->netdev_ops = &ipw_netdev_ops; priv->wireless_data.spy_data = &priv->ieee->spy_data; net_dev->wireless_data = &priv->wireless_data; net_dev->wireless_handlers = &ipw_wx_handler_def;
PATCH 62/77 wl3501: convert to internal net_device_stats
In reply to Stephen Hemmingerdrivers/net/wireless/wl3501.h +1 -1
@@ -606,7 +606,7 @@ struct wl3501_card {u8 reg_domain;u8 version[2 ];struct wl3501_scan_confirm bss_set[20 ]; -struct net_device_stats stats; +struct iw_statistics wstats;struct iw_spy_data spy_data;struct iw_public_data wireless_data;
drivers/net/wireless/wl3501_cs.c +10 -15
@@ -1000,7 +1000,7 @@ static inline void wl3501_md_ind_interruif (!skb) {printk (KERN_WARNING "%s: Can't alloc a sk_buff of size %d.\n" , dev->name, pkt_len); - this->stats.rx_dropped++; + dev->stats.rx_dropped++; }else { skb->dev = dev;skb_reserve (skb,2 );/* IP headers on 16 bytes boundaries */
@@ -1008,8 +1008,8 @@ static inline void wl3501_md_ind_interruwl3501_receive (this, skb->data, pkt_len);skb_put (skb, pkt_len); skb->protocol =eth_type_trans (skb, dev); - this->stats.rx_packets++; - this->stats.rx_bytes += skb->len; + dev->stats.rx_packets++; + dev->stats.rx_bytes += skb->len;netif_rx (skb); } }
@@ -1311,7 +1311,7 @@ out:static void wl3501_tx_timeout (struct net_device *dev) {struct wl3501_card *this =netdev_priv (dev); -struct net_device_stats *stats = &this->stats; +struct net_device_stats *stats = &dev->stats;unsigned long flags;int rc;
@@ -1346,11 +1346,11 @@ static int wl3501_hard_start_xmit(structif (enabled)wl3501_unblock_interrupt (this);if (rc) { - ++this->stats.tx_dropped; + ++dev->stats.tx_dropped;netif_stop_queue (dev); }else { - ++this->stats.tx_packets; - this->stats.tx_bytes += skb->len; + ++dev->stats.tx_packets; + dev->stats.tx_bytes += skb->len;kfree_skb (skb);if (this->tx_buffer_cnt <2 )
@@ -1400,13 +1400,6 @@ fail: goto out; } -static struct net_device_stats *wl3501_get_stats (struct net_device *dev) -{ -struct wl3501_card *this =netdev_priv (dev); - -return &this->stats; -} -static struct iw_statistics *wl3501_get_wireless_stats (struct net_device *dev) {struct wl3501_card *this =netdev_priv (dev);
@@ -1922,12 +1915,14 @@ static int wl3501_probe(struct pcmcia_de dev =alloc_etherdev (sizeof (struct wl3501_card ));if (!dev) goto out_link; + + dev->open = wl3501_open; dev->stop = wl3501_close; dev->hard_start_xmit = wl3501_hard_start_xmit; dev->tx_timeout = wl3501_tx_timeout; dev->watchdog_timeo =5 *HZ ; - dev->get_stats = wl3501_get_stats; + this =netdev_priv (dev); this->wireless_data.spy_data = &this->spy_data; this->p_dev = p_dev;
PATCH 63/77 wl3501: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/wireless/wl3501_cs.c +12 -5
@@ -1883,6 +1883,16 @@ static const struct iw_handler_def wl350 .get_wireless_stats = wl3501_get_wireless_stats, }; +static const struct net_device_ops wl3501_netdev_ops = { + .ndo_open = wl3501_open, + .ndo_stop = wl3501_close, + .ndo_start_xmit = wl3501_hard_start_xmit, + .ndo_tx_timeout = wl3501_tx_timeout, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +/** * wl3501_attach - creates an "instance" of the driver *
@@ -1917,17 +1927,14 @@ static int wl3501_probe(struct pcmcia_de goto out_link; - dev->open = wl3501_open; - dev->stop = wl3501_close; - dev->hard_start_xmit = wl3501_hard_start_xmit; - dev->tx_timeout = wl3501_tx_timeout; + dev->netdev_ops = &wl3501_netdev_ops; dev->watchdog_timeo =5 *HZ ; this =netdev_priv (dev); this->wireless_data.spy_data = &this->spy_data; this->p_dev = p_dev; dev->wireless_data = &this->wireless_data; - dev->wireless_handlers = (struct iw_handler_def *)&wl3501_handler_def; + dev->wireless_handlers = &wl3501_handler_def;SET_ETHTOOL_OPS (dev, &ops);netif_stop_queue (dev); p_dev->priv = p_dev->irq.Instance = dev;
PATCH 58/77 wavelan: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/wireless/wavelan_cs.c +14 -10
@@ -4436,6 +4436,19 @@ wavelan_close(struct net_device * dev)return 0 ; } +static const struct net_device_ops wavelan_netdev_ops = { + .ndo_open = wavelan_open, + .ndo_stop = wavelan_close, + .ndo_start_xmit = wavelan_packet_xmit, + .ndo_set_multicast_list = wavelan_set_multicast_list, +#ifdef SET_MAC_ADDRESS + .ndo_set_mac_address = wavelan_set_mac_address, +#endif + .ndo_tx_timeout = wavelan_watchdog, + .ndo_change_mtu = eth_change_mtu, + .ndo_validate_addr = eth_validate_addr, +}; +/*------------------------------------------------------------------*/ /* * wavelan_attach() creates an "instance" of the driver, allocating
@@ -4496,16 +4509,7 @@ wavelan_probe(struct pcmcia_device *p_de lp->dev = dev;/* wavelan NET3 callbacks */ - dev->open = &wavelan_open; - dev->stop = &wavelan_close; - dev->hard_start_xmit = &wavelan_packet_xmit; - dev->set_multicast_list = &wavelan_set_multicast_list; -#ifdef SET_MAC_ADDRESS - dev->set_mac_address = &wavelan_set_mac_address; -#endif /* SET_MAC_ADDRESS */ - -/* Set the watchdog timer */ - dev->tx_timeout = &wavelan_watchdog; + dev->netdev_ops = &wavelan_netdev_ops; dev->watchdog_timeo =WATCHDOG_JIFFIES ;SET_ETHTOOL_OPS (dev, &ops);
Re: [PATCH 22/77] usbnet: convert catc device to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
OK by me, but I cc'd Vojtech who was the last maintainer of this code.
Quoted 39 lines
drivers/net/usb/catc.c +13
-5@@ -743,6 +743,18 @@ static int catc_stop(struct net_device *return 0 ; } +static const struct net_device_ops catc_netdev_ops = { + .ndo_open = catc_open, + .ndo_stop = catc_stop, + .ndo_start_xmit = catc_start_xmit, + + .ndo_tx_timeout = catc_tx_timeout, + .ndo_set_multicast_list = catc_set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +/* * USB probe, disconnect. */ @@ -767,12 +779,8 @@ static int catc_probe(struct usb_interfa catc =netdev_priv (netdev); - netdev->open = catc_open; - netdev->hard_start_xmit = catc_hard_start_xmit; - netdev->stop = catc_stop; - netdev->tx_timeout = catc_tx_timeout; + netdev->netdev_ops = &catc_netdev_ops; netdev->watchdog_timeo =TX_TIMEOUT ; - netdev->set_multicast_list = catc_set_multicast_list;SET_ETHTOOL_OPS (netdev, &ops); catc->usbdev = usbdev;Signature · 1 line
--
Re: [PATCH 23/77] usbnet: convert to internal net_device stats
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
... ditto ...
Quoted 87 lines
drivers/net/usb/rtl8150.c +11
-17@@ -155,7 +155,6 @@ struct rtl8150 {unsigned long flags;struct usb_device *udev;struct tasklet_struct tl; -struct net_device_stats stats;struct net_device *netdev;struct urb *rx_urb, *tx_urb, *intr_urb, *ctrl_urb;struct sk_buff *tx_skb, *rx_skb;@@ -463,8 +462,8 @@ static void read_bulk_callback(struct urskb_put (dev->rx_skb, pkt_len); dev->rx_skb->protocol =eth_type_trans (dev->rx_skb, netdev);netif_rx (dev->rx_skb); - dev->stats.rx_packets++; - dev->stats.rx_bytes += pkt_len; + netdev->stats.rx_packets++; + netdev->stats.rx_bytes += pkt_len;spin_lock (&dev->rx_pool_lock); skb =pull_skb (dev);@@ -573,13 +572,13 @@ static void intr_callback(struct urb *ur d = urb->transfer_buffer;if (d[0 ] &TSR_ERRORS ) { - dev->stats.tx_errors++; + dev->netdev->stats.tx_errors++;if (d[INT_TSR ] & (TSR_ECOL |TSR_JBR )) - dev->stats.tx_aborted_errors++; + dev->netdev->stats.tx_aborted_errors++;if (d[INT_TSR ] &TSR_LCOL ) - dev->stats.tx_window_errors++; + dev->netdev->stats.tx_window_errors++;if (d[INT_TSR ] &TSR_LOSS_CRS ) - dev->stats.tx_carrier_errors++; + dev->netdev->stats.tx_carrier_errors++; }/* Report link status changes to the network stack */ if ((d[INT_MSR ] &MSR_LINK ) ==0 ) {@@ -697,17 +696,12 @@ static void disable_net_traffic(rtl8150_set_registers (dev,CR ,1 , &cr); } -static struct net_device_stats *rtl8150_netdev_stats (struct net_device *dev) -{ -return &((rtl8150_t *)netdev_priv (dev))->stats; -} -static void rtl8150_tx_timeout (struct net_device *netdev) {rtl8150_t *dev =netdev_priv (netdev);dev_warn (&netdev->dev,"Tx timeout.\n" );usb_unlink_urb (dev->tx_urb); - dev->stats.tx_errors++; + netdev->stats.tx_errors++; }static void rtl8150_set_multicast (struct net_device *netdev)@@ -747,12 +741,12 @@ static int rtl8150_start_xmit(struct sk_netif_device_detach (dev->netdev); else {dev_warn (&netdev->dev,"failed tx_urb %d\n" , res); - dev->stats.tx_errors++; + netdev->stats.tx_errors++;netif_start_queue (netdev); } }else { - dev->stats.tx_packets++; - dev->stats.tx_bytes += skb->len; + netdev->stats.tx_packets++; + netdev->stats.tx_bytes += skb->len; netdev->trans_start = jiffies; }@@ -931,7 +925,7 @@ static int rtl8150_probe(struct usb_inte netdev->hard_start_xmit = rtl8150_start_xmit; netdev->set_multicast_list = rtl8150_set_multicast; netdev->set_mac_address = rtl8150_set_mac_address; - netdev->get_stats = rtl8150_netdev_stats; +SET_ETHTOOL_OPS (netdev, &ops); dev->intr_interval =100 ;/* 100ms */ Signature · 1 line
--
Re: [PATCH 24/77] usbnet: convert rtl driver to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
cc'd the maintainer ... by the way, note that
"usbnet" != "everything in drivers/net/usb" ...
Quoted 43 lines
drivers/net/usb/rtl8150.c +14
-8@@ -891,6 +891,19 @@ static int rtl8150_ioctl(struct net_devireturn res; } +static const struct net_device_ops rtl8150_netdev_ops = { + .ndo_open = rtl8150_open, + .ndo_stop = rtl8150_close, + .ndo_do_ioctl = rtl8150_ioctl, + .ndo_start_xmit = rtl8150_start_xmit, + .ndo_tx_timeout = rtl8150_tx_timeout, + .ndo_set_multicast_list = rtl8150_set_multicast, + .ndo_set_mac_address = rtl8150_set_mac_address, + + .ndo_change_mtu = eth_change_mtu, + .ndo_validate_addr = eth_validate_addr, +}; +static int rtl8150_probe (struct usb_interface *intf,const struct usb_device_id *id) {@@ -917,15 +930,8 @@ static int rtl8150_probe(struct usb_inte dev->udev = udev; dev->netdev = netdev; - netdev->open = rtl8150_open; - netdev->stop = rtl8150_close; - netdev->do_ioctl = rtl8150_ioctl; + netdev->netdev_ops = &rtl8150_netdev_ops; netdev->watchdog_timeo =RTL8150_TX_TIMEOUT ; - netdev->tx_timeout = rtl8150_tx_timeout; - netdev->hard_start_xmit = rtl8150_start_xmit; - netdev->set_multicast_list = rtl8150_set_multicast; - netdev->set_mac_address = rtl8150_set_mac_address; -SET_ETHTOOL_OPS (netdev, &ops); dev->intr_interval =100 ;/* 100ms */ Signature · 1 line
--
Re: [PATCH 25/77] usbnet: convert hso driver to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
cc'd the driver's maintainer
Quoted 32 lines
drivers/net/usb/hso.c +8
-4@@ -2428,6 +2428,13 @@ static void hso_free_net_device(struct hkfree (hso_dev); } +static const struct net_device_ops hso_netdev_ops = { + .ndo_open = hso_net_open, + .ndo_stop = hso_net_close, + .ndo_start_xmit = hso_net_start_xmit, + .ndo_tx_timeout = hso_net_tx_timeout, +}; +/* initialize the network interface */ static void hso_net_init (struct net_device *net) {@@ -2436,10 +2443,7 @@ static void hso_net_init(struct net_deviD1 ("sizeof hso_net is %d" , (int )sizeof (*hso_net));/* fill in the other fields */ - net->open = hso_net_open; - net->stop = hso_net_close; - net->hard_start_xmit = hso_net_start_xmit; - net->tx_timeout = hso_net_tx_timeout; + net->netdev_ops = &hso_netdev_ops; net->watchdog_timeo =HSO_NET_TX_TIMEOUT ; net->flags =IFF_POINTOPOINT |IFF_NOARP |IFF_MULTICAST ; net->type =ARPHRD_NONE ;Signature · 1 line
--
Re: [PATCH 26/77] usbnet: convert to internal net_device_stats
In reply to Stephen HemmingerQuoted 3 lines · Stephen Hemminger
Default handler for
net_device_statsalready does same thing.Signed-off-by Stephen Hemminger <[email protected]>
Quoted 31 lines
drivers/net/usb/usbnet.c +0
-9@@ -249,14 +249,6 @@ static int usbnet_change_mtu (struct net/*-------------------------------------------------------------------------*/ -static struct net_device_stats *usbnet_get_stats (struct net_device *net) -{ -struct usbnet *dev =netdev_priv (net); -return &dev->stats; -} - -/*-------------------------------------------------------------------------*/ -/* some LK 2.4 HCDs oopsed if we freed or resubmitted urbs from * completion callbacks. 2.5 should have fixed those bugs... */ @@ -1180,7 +1172,6 @@ usbnet_probe (struct usb_interface *udev#endif net->change_mtu = usbnet_change_mtu; - net->get_stats = usbnet_get_stats; net->hard_start_xmit = usbnet_start_xmit; net->open = usbnet_open; net->stop = usbnet_stop;Signature · 1 line
--
Re: [PATCH 27/77] usbnet: support net_device_ops
In reply to Stephen HemmingerQuoted 4 lines · Stephen Hemminger
Use
net_device_opsfor usbnet device, and export for use by other derived drivers.Signed-off-by Stephen Hemminger <[email protected]>
Quoted 140 lines
--- drivers/net/usb/usbnet.c | 31 +++++++++++++++++++++++-------- include/linux/usb/usbnet.h | 5 +++++ 2 files changed, 28 insertions(+), 8 deletions(-)drivers/net/usb/usbnet.c +23
-8@@ -223,7 +223,7 @@ EXPORT_SYMBOL_GPL(usbnet_skb_return);* *-------------------------------------------------------------------------*/ -static int usbnet_change_mtu (struct net_device *net,int new_mtu) +int usbnet_change_mtu (struct net_device *net,int new_mtu) {struct usbnet *dev =netdev_priv (net);int ll_mtu = new_mtu + net->hard_header_len;@@ -246,6 +246,7 @@ static int usbnet_change_mtu (struct netreturn 0 ; } +EXPORT_SYMBOL_GPL (usbnet_change_mtu);/*-------------------------------------------------------------------------*/ @@ -540,7 +541,7 @@ EXPORT_SYMBOL_GPL(usbnet_unlink_rx_urbs)// precondition: never called in_interrupt -static int usbnet_stop (struct net_device *net) +int usbnet_stop (struct net_device *net) {struct usbnet *dev =netdev_priv (net);int temp;@@ -584,6 +585,7 @@ static int usbnet_stop (struct net_devicreturn 0 ; } +EXPORT_SYMBOL_GPL (usbnet_stop);/*-------------------------------------------------------------------------*/ @@ -591,7 +593,7 @@ static int usbnet_stop (struct net_devic// precondition: never called in_interrupt -static int usbnet_open (struct net_device *net) +int usbnet_open (struct net_device *net) {struct usbnet *dev =netdev_priv (net);int retval;@@ -666,6 +668,7 @@ done: done_nopm:return retval; } +EXPORT_SYMBOL_GPL (usbnet_open);/*-------------------------------------------------------------------------*/ @@ -900,7 +903,7 @@ static void tx_complete (struct urb *urb/*-------------------------------------------------------------------------*/ -static void usbnet_tx_timeout (struct net_device *net) +void usbnet_tx_timeout (struct net_device *net) {struct usbnet *dev =netdev_priv (net);@@ -909,10 +912,11 @@ static void usbnet_tx_timeout (struct ne// FIXME: device recovery -- reset? } +EXPORT_SYMBOL_GPL (usbnet_tx_timeout);/*-------------------------------------------------------------------------*/ -static int usbnet_start_xmit (struct sk_buff *skb,struct net_device *net) +int usbnet_start_xmit (struct sk_buff *skb,struct net_device *net) {struct usbnet *dev =netdev_priv (net);int length;@@ -995,7 +999,7 @@ drop: }return retval; } - +EXPORT_SYMBOL_GPL (usbnet_start_xmit);/*-------------------------------------------------------------------------*/ @@ -1102,6 +1106,15 @@ void usbnet_disconnect (struct usb_inter }EXPORT_SYMBOL_GPL (usbnet_disconnect); +static const struct net_device_ops usbnet_netdev_ops = { + .ndo_open = usbnet_open, + .ndo_stop = usbnet_stop, + .ndo_start_xmit = usbnet_start_xmit, + .ndo_tx_timeout = usbnet_tx_timeout, + .ndo_change_mtu = usbnet_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +};/*-------------------------------------------------------------------------*/ @@ -1171,12 +1184,14 @@ usbnet_probe (struct usb_interface *udev net->features |=NETIF_F_HIGHDMA ;#endif - net->change_mtu = usbnet_change_mtu; + net->netdev_ops = &usbnet_netdev_ops; +#ifdef CONFIG_COMPAT_NET_DEV_OPS net->hard_start_xmit = usbnet_start_xmit; net->open = usbnet_open; net->stop = usbnet_stop; - net->watchdog_timeo =TX_TIMEOUT_JIFFIES ; net->tx_timeout = usbnet_tx_timeout; +#endif + net->watchdog_timeo =TX_TIMEOUT_JIFFIES ; net->ethtool_ops = &usbnet_ethtool_ops;// allow device-specific bind/init procedures include/linux/usb/usbnet.h +5
-0@@ -176,6 +176,11 @@ struct skb_data { /* skb->cb is one of tsize_t length; }; +extern int usbnet_open (struct net_device *net); +extern int usbnet_stop (struct net_device *net); +extern int usbnet_start_xmit (struct sk_buff *skb,struct net_device *net); +extern void usbnet_tx_timeout (struct net_device *net); +extern int usbnet_change_mtu (struct net_device *net,int new_mtu);extern int usbnet_get_endpoints (struct usbnet *,struct usb_interface *);extern void usbnet_defer_kevent (struct usbnet *,int );Signature · 1 line
--
Re: [PATCH 28/77] usbnet: convert asix driver to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
cc'd driver maintainer
Quoted 106 lines
drivers/net/usb/asix.c +40
-7@@ -807,6 +807,18 @@ static int ax88172_link_reset(struct usbreturn 0 ; } +static const struct net_device_ops ax88172_netdev_ops = { + .ndo_open = usbnet_open, + .ndo_stop = usbnet_stop, + .ndo_start_xmit = usbnet_start_xmit, + .ndo_tx_timeout = usbnet_tx_timeout, + .ndo_change_mtu = usbnet_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = asix_ioctl, + .ndo_set_multicast_list = ax88172_set_multicast, +}; +static int ax88172_bind (struct usbnet *dev,struct usb_interface *intf) {int ret =0 ;@@ -846,9 +858,8 @@ static int ax88172_bind(struct usbnet *d dev->mii.phy_id_mask =0x3f ; dev->mii.reg_num_mask =0x1f ; dev->mii.phy_id =asix_get_phy_addr (dev); - dev->net->do_ioctl = asix_ioctl; - dev->net->set_multicast_list = ax88172_set_multicast; + dev->net->netdev_ops = &ax88172_netdev_ops; dev->net->ethtool_ops = &ax88172_ethtool_ops;asix_mdio_write (dev->net, dev->mii.phy_id,MII_BMCR ,BMCR_RESET );@@ -898,6 +909,18 @@ static int ax88772_link_reset(struct usbreturn 0 ; } +static const struct net_device_ops ax88772_netdev_ops = { + .ndo_open = usbnet_open, + .ndo_stop = usbnet_stop, + .ndo_start_xmit = usbnet_start_xmit, + .ndo_tx_timeout = usbnet_tx_timeout, + .ndo_change_mtu = usbnet_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = asix_ioctl, + .ndo_set_multicast_list = asix_set_multicast, +}; +static int ax88772_bind (struct usbnet *dev,struct usb_interface *intf) {int ret, embd_phy;@@ -962,7 +985,6 @@ static int ax88772_bind(struct usbnet *d dev->mii.mdio_write = asix_mdio_write; dev->mii.phy_id_mask =0x1f ; dev->mii.reg_num_mask =0x1f ; - dev->net->do_ioctl = asix_ioctl; dev->mii.phy_id =asix_get_phy_addr (dev); phyid =asix_get_phyid (dev);@@ -978,7 +1000,7 @@ static int ax88772_bind(struct usbnet *dmsleep (150 ); - dev->net->set_multicast_list = asix_set_multicast; + dev->net->netdev_ops = &ax88772_netdev_ops; dev->net->ethtool_ops = &ax88772_ethtool_ops;asix_mdio_write (dev->net, dev->mii.phy_id,MII_BMCR ,BMCR_RESET );@@ -1181,6 +1203,18 @@ static int ax88178_change_mtu(struct netreturn 0 ; } +static const struct net_device_ops ax88178_netdev_ops = { + .ndo_open = usbnet_open, + .ndo_stop = usbnet_stop, + .ndo_start_xmit = usbnet_start_xmit, + .ndo_tx_timeout = usbnet_tx_timeout, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, + .ndo_set_multicast_list = asix_set_multicast, + .ndo_do_ioctl = asix_ioctl, + .ndo_change_mtu = ax88178_change_mtu, +}; +static int ax88178_bind (struct usbnet *dev,struct usb_interface *intf) {struct asix_data *data = (struct asix_data *)&dev->data;@@ -1247,11 +1281,10 @@ static int ax88178_bind(struct usbnet *d dev->mii.phy_id_mask =0x1f ; dev->mii.reg_num_mask =0xff ; dev->mii.supports_gmii =1 ; - dev->net->do_ioctl = asix_ioctl; dev->mii.phy_id =asix_get_phy_addr (dev); - dev->net->set_multicast_list = asix_set_multicast; + + dev->net->netdev_ops = &ax88178_netdev_ops; dev->net->ethtool_ops = &ax88178_ethtool_ops; - dev->net->change_mtu = &ax88178_change_mtu; phyid =asix_get_phyid (dev);dbg ("PHYID=0x%08x" , phyid);Signature · 1 line
--
Re: [PATCH 29/77] usbnet: convert dms9601 driver to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
cc'd maintainer
Quoted 37 lines
drivers/net/usb/dm9601.c +13
-3@@ -419,6 +419,18 @@ static int dm9601_set_mac_address(structreturn 0 ; } +static const struct net_device_ops dm9601_netdev_ops = { + .ndo_open = usbnet_open, + .ndo_stop = usbnet_stop, + .ndo_start_xmit = usbnet_start_xmit, + .ndo_tx_timeout = usbnet_tx_timeout, + .ndo_change_mtu = usbnet_change_mtu, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = dm9601_ioctl, + .ndo_set_multicast_list = dm9601_set_multicast, + .ndo_set_mac_address = dm9601_set_mac_address, +}; +static int dm9601_bind (struct usbnet *dev,struct usb_interface *intf) {int ret;@@ -428,9 +440,7 @@ static int dm9601_bind(struct usbnet *deif (ret) goto out; - dev->net->do_ioctl = dm9601_ioctl; - dev->net->set_multicast_list = dm9601_set_multicast; - dev->net->set_mac_address = dm9601_set_mac_address; + dev->net->netdev_ops = &dm9601_netdev_ops; dev->net->ethtool_ops = &dm9601_ethtool_ops; dev->net->hard_header_len +=DM_TX_OVERHEAD ; dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;Signature · 1 line
--
Re: [PATCH 30/77] usbnet: convert msc7830 driver to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
cc'd driver maintainer
Quoted 39 lines
drivers/net/usb/mcs7830.c +13
-3@@ -486,6 +486,18 @@ static int mcs7830_set_mac_address(strucreturn 0 ; } +static const struct net_device_ops mcs7830_netdev_ops = { + .ndo_open = usbnet_open, + .ndo_stop = usbnet_stop, + .ndo_start_xmit = usbnet_start_xmit, + .ndo_tx_timeout = usbnet_tx_timeout, + .ndo_change_mtu = usbnet_change_mtu, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = mcs7830_ioctl, + .ndo_set_multicast_list = mcs7830_set_multicast, + .ndo_set_mac_address = mcs7830_set_mac_address, +}; +static int mcs7830_bind (struct usbnet *dev,struct usb_interface *udev) {struct net_device *net = dev->net;@@ -495,11 +507,9 @@ static int mcs7830_bind(struct usbnet *dif (ret) goto out; - net->do_ioctl = mcs7830_ioctl; net->ethtool_ops = &mcs7830_ethtool_ops; - net->set_multicast_list = mcs7830_set_multicast; + net->netdev_ops = &mcs7830_netdev_ops;mcs7830_set_multicast (net); - net->set_mac_address = mcs7830_set_mac_address;/* reserve space for the status byte on rx */ dev->rx_urb_size =ETH_FRAME_LEN +1 ;Signature · 1 line
--
Re: [PATCH 31/77] usbnet: convert sms95xx driver to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
cc driver maintainer
Quoted 36 lines
drivers/net/usb/smsc95xx.c +13
-2@@ -1008,6 +1008,18 @@ static int smsc95xx_reset(struct usbnetreturn 0 ; } +static const struct net_device_ops smsc95xx_netdev_ops = { + .ndo_open = usbnet_open, + .ndo_stop = usbnet_stop, + .ndo_start_xmit = usbnet_start_xmit, + .ndo_tx_timeout = usbnet_tx_timeout, + .ndo_change_mtu = usbnet_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = smsc95xx_ioctl, + .ndo_set_multicast_list = smsc95xx_set_multicast, +}; +static int smsc95xx_bind (struct usbnet *dev,struct usb_interface *intf) {struct smsc95xx_priv *pdata =NULL ;@@ -1038,9 +1050,8 @@ static int smsc95xx_bind(struct usbnet */* Init all registers */ ret =smsc95xx_reset (dev); - dev->net->do_ioctl = smsc95xx_ioctl; + dev->net->netdev_ops = &smsc95xx_netdev_ops; dev->net->ethtool_ops = &smsc95xx_ethtool_ops; - dev->net->set_multicast_list = smsc95xx_set_multicast; dev->net->flags |=IFF_MULTICAST ; dev->net->hard_header_len +=SMSC95XX_TX_OVERHEAD ;return 0 ;Signature · 1 line
--
Re: [PATCH 32/77] usbnet: convert rndis driver to use dev_get_stats
In reply to Stephen HemmingerQuoted 3 lines · Stephen Hemminger
dev_get_stats()handles all issues withnet_device_opsSigned-off-by Stephen Hemminger <[email protected]>
Quoted 31 lines
--- drivers/usb/gadget/rndis.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/usb/gadget/rndis.c +2
-5@@ -170,7 +170,7 @@ gen_ndis_query_resp (int configNr, u32 Oint i, count;rndis_query_cmplt_type *resp;struct net_device *net; -struct net_device_stats *stats; +const struct net_device_stats *stats;if (!r)return -ENOMEM ; resp = (rndis_query_cmplt_type *) r->buf;@@ -193,10 +193,7 @@ gen_ndis_query_resp (int configNr, u32 O resp->InformationBufferOffset =cpu_to_le32 (16 ); net = rndis_per_dev_params[configNr].dev; -if (net->get_stats) - stats = net->get_stats (net); -else - stats =NULL ; + stats =dev_get_stats (net);switch (OID ) {Signature · 1 line
--
Re: [PATCH 33/77] usbnet: convert rndis driver to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
Quoted 33 lines
drivers/net/usb/rndis_host.c +12
-1@@ -266,6 +266,16 @@ response_error:return -EDOM ; } +/* same as usbnet_netdev_ops but MTU change not allowed */ +static const struct net_device_ops rndis_netdev_ops = { + .ndo_open = usbnet_open, + .ndo_stop = usbnet_stop, + .ndo_start_xmit = usbnet_start_xmit, + .ndo_tx_timeout = usbnet_tx_timeout, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +int generic_rndis_bind (struct usbnet *dev,struct usb_interface *intf,int flags) {@@ -327,7 +337,8 @@ generic_rndis_bind(struct usbnet *dev, s dev->rx_urb_size &= ~(dev->maxpacket -1 ); u.init->max_transfer_size =cpu_to_le32 (dev->rx_urb_size); - net->change_mtu =NULL ; + net->netdev_ops = &rndis_netdev_ops; + retval =rndis_command (dev, u.header,CONTROL_BUFFER_SIZE );if (unlikely (retval <0 )) {/* it might not even be an RNDIS device!! */ Signature · 1 line
--
Re: [PATCH 22/77] usbnet: convert catc device to net_device_ops
In reply to Stephen Hemmingerdrivers/net/usb/catc.c static int catc_stop(struct net_device * · line 749
Quoted 12 lines · Sat, Mar 21, 2009 at 06:35:49AM CET, [email protected] wrote:
Signed-off-by Stephen Hemminger <[email protected]>drivers/net/usb/catc.c +4
-0@@ -743,6 +743,18 @@ static int catc_stop(struct net_device *return 0 ; } +static const struct net_device_ops catc_netdev_ops = { + .ndo_open = catc_open, + .ndo_stop = catc_stop, + .ndo_start_xmit = catc_start_xmit,
^^^^^^^^^^^^^^^
Shouldn't be here catc_hard_start_xmit() instead? Cannot find catc_start_xmit() anywhere in the code...
Quoted 32 lines
drivers/net/usb/catc.c +9
-5+ + .ndo_tx_timeout = catc_tx_timeout, + .ndo_set_multicast_list = catc_set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +/* * USB probe, disconnect. */ @@ -767,12 +779,8 @@ static int catc_probe(struct usb_interfa catc =netdev_priv (netdev); - netdev->open = catc_open; - netdev->hard_start_xmit = catc_hard_start_xmit; - netdev->stop = catc_stop; - netdev->tx_timeout = catc_tx_timeout; + netdev->netdev_ops = &catc_netdev_ops; netdev->watchdog_timeo =TX_TIMEOUT ; - netdev->set_multicast_list = catc_set_multicast_list;SET_ETHTOOL_OPS (netdev, &ops); catc->usbdev = usbdev;Signature · 6 lines
-- -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 29/77] usbnet: convert dms9601 driver to net_device_ops
In reply to David BrownellQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"David" == David Brownell <[email protected]> writes:
Quoted 1 line · Stephen Hemminger
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
David> cc'd maintainer
Seems fine.
Signature · 1 line
Bye, Peter Korsgaard
Re: [PATCH 66/77] mac80211_hwsim: convert to internal net_device_stats
In reply to a message not in the archivedrivers/net/wireless/mac80211_hwsim.c static struct device_driver mac80211_hws · line 742
Quoted 11 lines · Stephen Hemminger
plain text document attachment (hwsim.patch)
Signed-off-by Stephen Hemminger <[email protected]>drivers/net/wireless/mac80211_hwsim.c +1
-0@@ -739,10 +739,16 @@ static struct device_driver mac80211_hws .name = "mac80211_hwsim" }; +static const struct net_device_ops hwsim_netdev_ops = {
this, and a few others I think, have wrong subjects.
johannes
Re: [PATCH 29/77] usbnet: convert dms9601 driver to net_device_ops
In reply to Peter KorsgaardQuoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
"Peter" == Peter Korsgaard <[email protected]> writes:
"David" == David Brownell <[email protected]> writes:
Quoted 1 line · Stephen Hemminger
Quoted 1 line
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
David> cc'd maintainer
Peter> Seems fine.
Peter> Signed-off-by: Peter Korsgaard <[email protected]>
Ehhm, I meant Acked-by: Peter Korsgaard <[email protected]> ofcourse.
Signature · 1 line
Bye, Peter Korsgaard
Re: [PATCH 01/77] atm: convert mpc device to using netdev_ops
In reply to Stephen Hemmingerthis looks fine. it seems like there should be a better way to handle this, but it should work. i dont remember many people using the mpoa shortcut code though.
Quoted 5 lines · In message <[email protected]>,Stephen Hemminger writes:
This converts the mpc device to using new
netdevice_ops. Compile tested only, needs more than usual review since device was swaping pointers around etc.Signed-off-by Stephen Hemminger <[email protected]>
Re: [PATCH 22/77] usbnet: convert catc device to net_device_ops
In reply to David BrownellQuoted 4 lines · David Brownell
Quoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>OK by me, but I cc'd Vojtech who was the last maintainer of this code.
OK by me, too.
Quoted 43 lines
Quoted 41 lines
drivers/net/usb/catc.c +13
-5@@ -743,6 +743,18 @@ static int catc_stop(struct net_device *return 0 ; } +static const struct net_device_ops catc_netdev_ops = { + .ndo_open = catc_open, + .ndo_stop = catc_stop, + .ndo_start_xmit = catc_start_xmit, + + .ndo_tx_timeout = catc_tx_timeout, + .ndo_set_multicast_list = catc_set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +/* * USB probe, disconnect. */ @@ -767,12 +779,8 @@ static int catc_probe(struct usb_interfa catc =netdev_priv (netdev); - netdev->open = catc_open; - netdev->hard_start_xmit = catc_hard_start_xmit; - netdev->stop = catc_stop; - netdev->tx_timeout = catc_tx_timeout; + netdev->netdev_ops = &catc_netdev_ops; netdev->watchdog_timeo =TX_TIMEOUT ; - netdev->set_multicast_list = catc_set_multicast_list;SET_ETHTOOL_OPS (netdev, &ops); catc->usbdev = usbdev;Signature · 1 line
--
Signature · 2 lines
Vojtech Pavlik Director SuSE Labs
Re: [PATCH 23/77] usbnet: convert to internal net_device stats
In reply to David BrownellQuoted 4 lines · David Brownell
Quoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>... ditto ...
And here ok, too.
Quoted 90 lines
Quoted 88 lines
drivers/net/usb/rtl8150.c +11
-17@@ -155,7 +155,6 @@ struct rtl8150 {unsigned long flags;struct usb_device *udev;struct tasklet_struct tl; -struct net_device_stats stats;struct net_device *netdev;struct urb *rx_urb, *tx_urb, *intr_urb, *ctrl_urb;struct sk_buff *tx_skb, *rx_skb;@@ -463,8 +462,8 @@ static void read_bulk_callback(struct urskb_put (dev->rx_skb, pkt_len); dev->rx_skb->protocol =eth_type_trans (dev->rx_skb, netdev);netif_rx (dev->rx_skb); - dev->stats.rx_packets++; - dev->stats.rx_bytes += pkt_len; + netdev->stats.rx_packets++; + netdev->stats.rx_bytes += pkt_len;spin_lock (&dev->rx_pool_lock); skb =pull_skb (dev);@@ -573,13 +572,13 @@ static void intr_callback(struct urb *ur d = urb->transfer_buffer;if (d[0 ] &TSR_ERRORS ) { - dev->stats.tx_errors++; + dev->netdev->stats.tx_errors++;if (d[INT_TSR ] & (TSR_ECOL |TSR_JBR )) - dev->stats.tx_aborted_errors++; + dev->netdev->stats.tx_aborted_errors++;if (d[INT_TSR ] &TSR_LCOL ) - dev->stats.tx_window_errors++; + dev->netdev->stats.tx_window_errors++;if (d[INT_TSR ] &TSR_LOSS_CRS ) - dev->stats.tx_carrier_errors++; + dev->netdev->stats.tx_carrier_errors++; }/* Report link status changes to the network stack */ if ((d[INT_MSR ] &MSR_LINK ) ==0 ) {@@ -697,17 +696,12 @@ static void disable_net_traffic(rtl8150_set_registers (dev,CR ,1 , &cr); } -static struct net_device_stats *rtl8150_netdev_stats (struct net_device *dev) -{ -return &((rtl8150_t *)netdev_priv (dev))->stats; -} -static void rtl8150_tx_timeout (struct net_device *netdev) {rtl8150_t *dev =netdev_priv (netdev);dev_warn (&netdev->dev,"Tx timeout.\n" );usb_unlink_urb (dev->tx_urb); - dev->stats.tx_errors++; + netdev->stats.tx_errors++; }static void rtl8150_set_multicast (struct net_device *netdev)@@ -747,12 +741,12 @@ static int rtl8150_start_xmit(struct sk_netif_device_detach (dev->netdev); else {dev_warn (&netdev->dev,"failed tx_urb %d\n" , res); - dev->stats.tx_errors++; + netdev->stats.tx_errors++;netif_start_queue (netdev); } }else { - dev->stats.tx_packets++; - dev->stats.tx_bytes += skb->len; + netdev->stats.tx_packets++; + netdev->stats.tx_bytes += skb->len; netdev->trans_start = jiffies; }@@ -931,7 +925,7 @@ static int rtl8150_probe(struct usb_inte netdev->hard_start_xmit = rtl8150_start_xmit; netdev->set_multicast_list = rtl8150_set_multicast; netdev->set_mac_address = rtl8150_set_mac_address; - netdev->get_stats = rtl8150_netdev_stats; +SET_ETHTOOL_OPS (netdev, &ops); dev->intr_interval =100 ;/* 100ms */ Signature · 1 line
--
Signature · 2 lines
Vojtech Pavlik Director SuSE Labs
[email protected]
Acked-byRe: [PATCH 31/77] usbnet: convert sms95xx driver to net_device_ops
In reply to David BrownellHi David,
The patch looks fine, but (minor nit) the subject line should read "smsc95xx" instead of "sms95xx".
--
Steve Glendinning
SMSC GmbH
m: +44 777 933 9124
e: [email protected]
David Brownell <[email protected]> wrote on 21/03/2009 09:20:29:
Quoted 12 lines · Stephen Hemminger
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>cc driver maintainer
Quoted 6 lines
drivers/net/usb/smsc95xx.c 2009-03-20 12:16:51.582901740 -0700 renamed from drivers/net/usb/smsc95xx.c 2009-03-20 12:11:35.646901516 -0700 +0
-0@@ -1008,6 +1008,18 @@ static int smsc95xx_reset(struct usbnet return 0; }
Quoted 13 lines
drivers/net/usb/smsc95xx.c 2009-03-20 12:16:51.582901740 -0700 static int smsc95xx_reset(struct usbnet · line 1023
Quoted 13 lines
drivers/net/usb/smsc95xx.c 2009-03-20 12:16:51.582901740 -0700 renamed from drivers/net/usb/smsc95xx.c 2009-03-20 12:11:35.646901516 -0700 +12
-0+static const struct net_device_ops smsc95xx_netdev_ops = { + .ndo_open = usbnet_open, + .ndo_stop = usbnet_stop, + .ndo_start_xmit = usbnet_start_xmit, + .ndo_tx_timeout = usbnet_tx_timeout, + .ndo_change_mtu = usbnet_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = smsc95xx_ioctl, + .ndo_set_multicast_list = smsc95xx_set_multicast, +}; + static int smsc95xx_bind(struct usbnet *dev, struct usb_interface
*intf)
Quoted 19 lines
Quoted 17 lines
drivers/net/usb/smsc95xx.c 2009-03-20 12:16:51.582901740 -0700 renamed from drivers/net/usb/smsc95xx.c 2009-03-20 12:11:35.646901516 -0700 +1
-2{ struct smsc95xx_priv *pdata = NULL;@@ -1038,9 +1050,8 @@ static int smsc95xx_bind(struct usbnet * /* Init all registers */ ret = smsc95xx_reset(dev); - dev->net->do_ioctl = smsc95xx_ioctl; + dev->net->netdev_ops = &smsc95xx_netdev_ops; dev->net->ethtool_ops = &smsc95xx_ethtool_ops; - dev->net->set_multicast_list = smsc95xx_set_multicast; dev->net->flags |= IFF_MULTICAST; dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD; return 0;Signature · 1 line
--
[ofa-general] Re: [PATCH 03/77] infiniband: convert c2 to net_device_ops
In reply to Stephen Hemminger[ofa-general] Re: [PATCH 03/77] infiniband: convert c2 to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:30 -0700
Quoted 4 lines
Convert this driver to new
net_device_opsinfrastructure. Also use defaultnet_deviceget-stats infrastructureSigned-off-by Stephen Hemminger <[email protected]>
Applied.
[ofa-general] Re: [PATCH 05/77] infiniband: convert ipoib to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:32 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 01/77] atm: convert mpc device to using netdev_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:28 -0700
Quoted 5 lines
This converts the mpc device to using new
netdevice_ops. Compile tested only, needs more than usual review since device was swaping pointers around etc.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 02/77] atm: cconvert clip driver to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:29 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 04/77] infiniband: convert nes driver to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:31 -0700
Quoted 4 lines
Also, removed unnecessary
memset()sincalloc_netdevreturns zeroed memory.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 06/77] irda: net_device_ops ioctl fix
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:33 -0700
Quoted 3 lines
Need to reference
net_device_opsnot old pointer.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 07/77] irlan: convert to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:34 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 08/77] irda: convert irda_usb to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:35 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 09/77] irda: convert mcs driver to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:36 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 10/77] stir4200: convert to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:37 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 11/77] irda: convert w83977af_ir to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:38 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 12/77] irda: convert nsc_ircc driver to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:39 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 13/77] irda: convert ali driver to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:40 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 14/77] irda: convert vlsi driver to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:41 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 15/77] irda: convert smsc driver to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:42 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 16/77] irda: convert via-ircc to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:43 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 17/77] irda: convert sir device to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:44 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 18/77] irda: convert kignsun device to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:45 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 19/77] irda: convert ksdazzle device to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:46 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 20/77] irda: convert ks959 device to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:47 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
David Miller
maintainerRe: [PATCH 22/77] usbnet: convert catc device to net_device_ops
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
Date: Sat, 21 Mar 2009 11:17:29 +0100
Quoted 9 lines
Quoted 8 lines · Sat, Mar 21, 2009 at 06:35:49AM CET, [email protected] wrote:
Signed-off-by Stephen Hemminger <[email protected]>drivers/net/usb/catc.c +0
-0@@ -743,6 +743,18 @@ static int catc_stop(struct net_device *return 0 ; }
Quoted 7 lines
drivers/net/usb/catc.c static int catc_stop(struct net_device * · line 749
Quoted 4 lines
drivers/net/usb/catc.c +4
-0+static const struct net_device_ops catc_netdev_ops = { + .ndo_open = catc_open, + .ndo_stop = catc_stop, + .ndo_start_xmit = catc_start_xmit,^^^^^^^^^^^^^^^Shouldn't be here
catc_hard_start_xmit()instead? Cannot findcatc_start_xmit()anywhere in the code...
It gets renamed to catc_start_xmit() in the previous patch in this series, #21.
Re: [PATCH 21/77] usbnet: convert catc to internal net_device_stats
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:48 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 22/77] usbnet: convert catc device to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:49 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 23/77] usbnet: convert to internal net_device stats
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:50 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 24/77] usbnet: convert rtl driver to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:51 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 25/77] usbnet: convert hso driver to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:52 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 26/77] usbnet: convert to internal net_device_stats
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:53 -0700
Quoted 3 lines
Default handler for
net_device_statsalready does same thing.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 27/77] usbnet: support net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:54 -0700
Quoted 4 lines
Use
net_device_opsfor usbnet device, and export for use by other derived drivers.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 28/77] usbnet: convert asix driver to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:55 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 29/77] usbnet: convert dms9601 driver to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:56 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 30/77] usbnet: convert msc7830 driver to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:57 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 31/77] usbnet: convert sms95xx driver to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:58 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 32/77] usbnet: convert rndis driver to use dev_get_stats
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:35:59 -0700
Quoted 3 lines
dev_get_stats()handles all issues withnet_device_opsSigned-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 33/77] usbnet: convert rndis driver to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:00 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 34/77] pcmcia: convert 3c589 to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:01 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 35/77] pcmcia: convert 3c574 to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:02 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 36/77] pcmcia: convert fmvj18x driver to internal net_device_stats
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:03 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 37/77] pcmcia: convert fmvj18x driver to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:04 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 38/77] pcmcia: convert nmclan driver to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:05 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 39/77] pcnet: convert driver to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:06 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 40/77] xir2cps: convert to internal net_device stats
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:07 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 41/77] xirc2ps: convert to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:08 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 42/77] smc91c92: convert to internal net_device_stats
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:09 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 43/77] smc91c92: convert to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:10 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 44/77] axnet: convert ot net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:11 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 45/77] x25_asy: convert to internal net_device_stats
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:12 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 46/77] x25_asy: convert to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:13 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 47/77] dlci: convert to internal net_device_stats
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:14 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 48/77] dlci: convert to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:15 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 49/77] cycx: convert to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:16 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 50/77] lapbether: convert to internal net_device_stats
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:17 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 51/77] labether: convert to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:18 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 54/77] netwave: convert to internal net_device_stats
In reply to a message not in the archiveFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:21 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 52/77] sbni: use internal net_device_stats
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:19 -0700
Quoted 7 lines
Convert to use existing
net_device_stats.
This driver,
has bad style,
of using commas,
when brackets should be used...Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 53/77] sbni: convert to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:20 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 57/77] wavelan: convert to internal net_device_stats
In reply to a message not in the archiveFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:24 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 56/77] strip: convert to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:23 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 59/77] airo: convert to net_device_ops
In reply to a message not in the archiveFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:26 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 60/77] atmel: convert to net_device_ops
In reply to a message not in the archiveFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:27 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 58/77] wavelan: convert to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:25 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 55/77] netwave: convert to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:22 -0700
Quoted 3 lines
Also get rid of unneeded cast
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
David Miller
maintainerRe: [PATCH 66/77] mac80211_hwsim: convert to internal net_device_stats
In reply to Johannes BergFrom: Johannes Berg <[email protected]>
Date: Sat, 21 Mar 2009 12:08:25 +0100
Quoted 11 lines · Stephen Hemminger
Quoted 10 lines
plain text document attachment (hwsim.patch)
Signed-off-by Stephen Hemminger <[email protected]>drivers/net/wireless/mac80211_hwsim.c +0
-0@@ -739,10 +739,16 @@ static struct device_driver mac80211_hws .name = "mac80211_hwsim" };
Quoted 3 lines
drivers/net/wireless/mac80211_hwsim.c static struct device_driver mac80211_hws · line 742
Quoted 1 line
drivers/net/wireless/mac80211_hwsim.c +1
-0+static const struct net_device_ops hwsim_netdev_ops = {this, and a few others I think, have wrong subjects.
I'll fix it up, as needed.
Re: [PATCH 61/77] raylan: convert to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:28 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 62/77] wl3501: convert to internal net_device_stats
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:29 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 64/77] zd1201: convert to internal net_device_stats
In reply to a message not in the archiveFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:31 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 65/77] zd1201: convert to net_device_ops
In reply to a message not in the archiveFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:32 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 63/77] wl3501: convert to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:30 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 66/77] mac80211_hwsim: convert to internal net_device_stats
In reply to a message not in the archiveFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:33 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 67/77] prism54: convert to net_device_ops
In reply to a message not in the archiveFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:34 -0700
Quoted 4 lines
Also, make
ethtool_opsconst as it should be, and get rid of useless cast.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 68/77] prism54: convert to internal net_device_stats
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:35 -0700
Quoted 4 lines
Also, make
ethtool_opsconst as it should be, and get rid of useless cast.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 69/77] libertas: convert to internal net_device_stats
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:36 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 70/77] libertas: convert to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:37 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 71/77] ipw2x00: convert to internal net_device_stats
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:38 -0700
Quoted 4 lines
Replace struct in ieee with current
net_device_stats, so no longer needget_statshookSigned-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 73/77] ipw2100: convert to net_device_ops
In reply to a message not in the archiveFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:40 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 74/77] ipw2200: convert to net_device_ops
In reply to a message not in the archiveFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:41 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 72/77] ipw2x00: convert infrastructure for use by net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:39 -0700
Quoted 4 lines
Expose routines so drivers can hook. Only set ptrs in netdev if using old compat code.
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 75/77] hostap: convert to internal net_device_stats
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:42 -0700
Quoted 3 lines
Use pre-existing
net_device_statsinnetwork_devicestruct.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 76/77] hostap: convert to net_device_ops
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:43 -0700
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH 77/77] netdev: expose net_device_ops compat as config option
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 20 Mar 2009 22:36:44 -0700
Quoted 6 lines
Now that most network device drivers in (all but one in
x86_64allmodconfig) supportnet_device_ops. Expose it as a configuration parameter. Still need to address even older 32 bit drivers, and other arch before compatiablity can be scheduled for removal in some future release.Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [ofa-general] [PATCH 03/77] infiniband: convert c2 to net_device_ops
In reply to Stephen HemmingerDon't I already have this queued in my for-next branch?
Or is this an updated version?
[And same applies to the nes driver changes]
- R.
David Miller
maintainerRe: [ofa-general] [PATCH 03/77] infiniband: convert c2 to net_device_ops
From: Roland Dreier <[email protected]>
Date: Sun, 22 Mar 2009 09:12:57 -0700
Quoted 5 lines
Don't I already have this queued in my for-next branch?
Or is this an updated version?
[And same applies to the nes driver changes]
Any chance you can drop the copies in your tree?
The reason I'm asking is that once all the conversions are in net-next-2.6 which hit the i386 allmodconfig build there is a change we can add (which in fast is in net-next-2.6 now) which exposes a config option to turn all of the pre-netdev_ops compatibility stuff off.
We can't do that until i386 builds in all configurations.
Petko Manolov
maintainerRe: [PATCH 24/77] usbnet: convert rtl driver to net_device_ops
In reply to David BrownellACK :-)
cheers,
Petko
Quoted 53 lines · David Brownell
Quoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>cc'd the maintainer ... by the way, note that
"usbnet" != "everything indrivers/net/usb" ...Quoted 43 lines
drivers/net/usb/rtl8150.c +14
-9@@ -891,6 +891,19 @@ static int rtl8150_ioctl(struct net_devireturn res; } +static const struct net_device_ops rtl8150_netdev_ops = { + .ndo_open = rtl8150_open, + .ndo_stop = rtl8150_close, + .ndo_do_ioctl = rtl8150_ioctl, + .ndo_start_xmit = rtl8150_start_xmit, + .ndo_tx_timeout = rtl8150_tx_timeout, + .ndo_set_multicast_list = rtl8150_set_multicast, + .ndo_set_mac_address = rtl8150_set_mac_address, + + .ndo_change_mtu = eth_change_mtu, + .ndo_validate_addr = eth_validate_addr, +}; +static int rtl8150_probe (struct usb_interface *intf,const struct usb_device_id *id) {@@ -917,15 +930,8 @@ static int rtl8150_probe(struct usb_inte dev->udev = udev; dev->netdev = netdev; - netdev->open = rtl8150_open; - netdev->stop = rtl8150_close; - netdev->do_ioctl = rtl8150_ioctl; + netdev->netdev_ops = &rtl8150_netdev_ops; netdev->watchdog_timeo =RTL8150_TX_TIMEOUT ; - netdev->tx_timeout = rtl8150_tx_timeout; - netdev->hard_start_xmit = rtl8150_start_xmit; - netdev->set_multicast_list = rtl8150_set_multicast; - netdev->set_mac_address = rtl8150_set_mac_address; -SET_ETHTOOL_OPS (netdev, &ops); dev->intr_interval =100 ;/* 100ms */ --
Re: [PATCH 06/77] irda: net_device_ops ioctl fix
In reply to Stephen HemmingerThanks Stephen...
Quoted 3 lines · Stephen Hemminger
Need to reference
net_device_opsnot old pointer.Signed-off-by Stephen Hemminger <[email protected]>
Quoted 26 lines
--- net/irda/irda_device.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)net/irda/irda_device.c +3
-2@@ -149,13 +149,14 @@ int irda_device_is_receiving(struct net_IRDA_DEBUG (2 ,"%s()\n" , __func__); -if (!dev->do_ioctl) { +if (!dev->netdev_ops->ndo_do_ioctl) {IRDA_ERROR ("%s: do_ioctl not impl. by device driver\n" , __func__);return -1 ; } - ret = dev->do_ioctl (dev, (struct ifreq *) &req,SIOCGRECEIVING ); + ret = (dev->netdev_ops->ndo_do_ioctl)(dev, (struct ifreq *) &req, +SIOCGRECEIVING );if (ret <0 )return ret;Signature · 1 line
--
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Re: [PATCH 06/77] irda: net_device_ops ioctl fix
In reply to Stephen HemmingerQuoted 3 lines · Stephen Hemminger
Need to reference
net_device_opsnot old pointer.Signed-off-by Stephen Hemminger <[email protected]>
Quoted 27 lines
--- net/irda/irda_device.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)net/irda/irda_device.c +3
-2@@ -149,13 +149,14 @@ int irda_device_is_receiving(struct net_IRDA_DEBUG (2 ,"%s()\n" , __func__); -if (!dev->do_ioctl) { +if (!dev->netdev_ops->ndo_do_ioctl) {IRDA_ERROR ("%s: do_ioctl not impl. by device driver\n" , __func__);return -1 ; } - ret = dev->do_ioctl (dev, (struct ifreq *) &req,SIOCGRECEIVING ); + ret = (dev->netdev_ops->ndo_do_ioctl)(dev, (struct ifreq *) &req, +SIOCGRECEIVING );if (ret <0 )return ret;Signature · 1 line
--
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Re: [PATCH 07/77] irlan: convert to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
Quoted 44 lines
--- net/irda/irlan/irlan_eth.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)net/irda/irlan/irlan_eth.c +13
-6@@ -45,6 +45,16 @@ static int irlan_eth_xmit(struct sk_bufstatic void irlan_eth_set_multicast_list (struct net_device *dev);static struct net_device_stats *irlan_eth_get_stats (struct net_device *dev); +static const struct net_device_ops irlan_eth_netdev_ops = { + .ndo_open = irlan_eth_open, + .ndo_stop = irlan_eth_close, + .ndo_start_xmit = irlan_eth_xmit, + .ndo_get_stats = irlan_eth_get_stats, + .ndo_set_multicast_list = irlan_eth_set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_validate_addr = eth_validate_addr, +}; +/* * Function irlan_eth_setup (dev) * @@ -53,14 +63,11 @@ static struct net_device_stats *irlan_et*/ static void irlan_eth_setup (struct net_device *dev) { - dev->open = irlan_eth_open; - dev->stop = irlan_eth_close; - dev->hard_start_xmit = irlan_eth_xmit; - dev->get_stats = irlan_eth_get_stats; - dev->set_multicast_list = irlan_eth_set_multicast_list; +ether_setup (dev); + + dev->netdev_ops = &irlan_eth_netdev_ops; dev->destructor = free_netdev; -ether_setup (dev);/* * Lets do all queueing in IrTTP instead of this device driver. Signature · 1 line
--
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Re: [PATCH 08/77] irda: convert irda_usb to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
Quoted 43 lines
--- drivers/net/irda/irda-usb.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)drivers/net/irda/irda-usb.c +10
-8@@ -1401,6 +1401,14 @@ static inline void irda_usb_init_qos(str }/*------------------------------------------------------------------*/ +static const struct net_device_ops irda_usb_netdev_ops = { + .ndo_open = irda_usb_net_open, + .ndo_stop = irda_usb_net_close, + .ndo_do_ioctl = irda_usb_net_ioctl, + .ndo_start_xmit = irda_usb_hard_xmit, + .ndo_tx_timeout = irda_usb_net_timeout, +}; +/* * Initialise the network side of the irda-usb instance * Called when a new USB instance is registered in irda_usb_probe() @@ -1411,15 +1419,9 @@ static inline int irda_usb_open(struct iIRDA_DEBUG (1 ,"%s()\n" , __func__); -irda_usb_init_qos (self); + netdev->netdev_ops = &irda_usb_netdev_ops; -/* Override the network functions we need to use */ - netdev->hard_start_xmit = irda_usb_hard_xmit; - netdev->tx_timeout = irda_usb_net_timeout; - netdev->watchdog_timeo =250 *HZ /1000 ;/* 250 ms > USB timeout */ - netdev->open = irda_usb_net_open; - netdev->stop = irda_usb_net_close; - netdev->do_ioctl = irda_usb_net_ioctl; +irda_usb_init_qos (self);return register_netdev (netdev); }Signature · 1 line
--
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Re: [PATCH 09/77] irda: convert mcs driver to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
Quoted 36 lines
--- drivers/net/irda/mcs7780.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)drivers/net/irda/mcs7780.c +8
-5@@ -873,6 +873,13 @@ static int mcs_hard_xmit(struct sk_buffreturn ret; } +static const struct net_device_ops mcs_netdev_ops = { + .ndo_open = mcs_net_open, + .ndo_stop = mcs_net_close, + .ndo_start_xmit = mcs_hard_xmit, + .ndo_do_ioctl = mcs_net_ioctl, +}; +/* * This function is called by the USB subsystem for each new device in the * system. Need to verify the device and if it is, then start handling it. @@ -919,11 +926,7 @@ static int mcs_probe(struct usb_interfac/* Speed change work initialisation*/ INIT_WORK (&mcs->work, mcs_speed_work); -/* Override the network functions we need to use */ - ndev->hard_start_xmit = mcs_hard_xmit; - ndev->open = mcs_net_open; - ndev->stop = mcs_net_close; - ndev->do_ioctl = mcs_net_ioctl; + ndev->netdev_ops = &mcs_netdev_ops;if (!intf->cur_altsetting) goto error2;Signature · 1 line
--
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Re: [PATCH 10/77] stir4200: convert to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
Quoted 31 lines
drivers/net/irda/stir4200.c +8
-4@@ -1007,6 +1007,13 @@ static int stir_net_ioctl(struct net_devreturn ret; } +static const struct net_device_ops stir_netdev_ops = { + .ndo_open = stir_net_open, + .ndo_stop = stir_net_close, + .ndo_start_xmit = stir_hard_xmit, + .ndo_do_ioctl = stir_net_ioctl, +}; +/* * This routine is called by the USB subsystem for each new device * in the system. We need to check if the device is ours, and in @@ -1054,10 +1061,7 @@ static int stir_probe(struct usb_interfairda_qos_bits_to_value (&stir->qos);/* Override the network functions we need to use */ - net->hard_start_xmit = stir_hard_xmit; - net->open = stir_net_open; - net->stop = stir_net_close; - net->do_ioctl = stir_net_ioctl; + net->netdev_ops = &stir_netdev_ops; ret =register_netdev (net);if (ret !=0 )Signature · 1 line
--
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Re: [PATCH 11/77] irda: convert w83977af_ir to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
Quoted 32 lines
drivers/net/irda/w83977af_ir.c +8
-5@@ -140,6 +140,13 @@ static void __exit w83977af_cleanup(void } } +static const struct net_device_ops w83977_netdev_ops = { + .ndo_open = w83977af_net_open, + .ndo_stop = w83977af_net_close, + .ndo_start_xmit = w83977af_hard_xmit, + .ndo_do_ioctl = w83977af_net_ioctl, +}; +/* * Function w83977af_open (iobase, irq) * @@ -231,11 +238,7 @@ static int w83977af_open(int i, unsigned self->rx_buff.data = self->rx_buff.head; self->netdev = dev; -/* Override the network functions we need to use */ - dev->hard_start_xmit = w83977af_hard_xmit; - dev->open = w83977af_net_open; - dev->stop = w83977af_net_close; - dev->do_ioctl = w83977af_net_ioctl; + dev->netdev_ops = &w83977_netdev_ops; err =register_netdev (dev);if (err) {Signature · 1 line
--
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Re: [PATCH 12/77] irda: convert nsc_ircc driver to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
Quoted 53 lines
drivers/net/irda/nsc-ircc.c +17
-6@@ -331,6 +331,20 @@ static void __exit nsc_ircc_cleanup(void pnp_registered =0 ; } +static const struct net_device_ops nsc_ircc_sir_ops = { + .ndo_open = nsc_ircc_net_open, + .ndo_stop = nsc_ircc_net_close, + .ndo_start_xmit = nsc_ircc_hard_xmit_sir, + .ndo_do_ioctl = nsc_ircc_net_ioctl, +}; + +static const struct net_device_ops nsc_ircc_fir_ops = { + .ndo_open = nsc_ircc_net_open, + .ndo_stop = nsc_ircc_net_close, + .ndo_start_xmit = nsc_ircc_hard_xmit_fir, + .ndo_do_ioctl = nsc_ircc_net_ioctl, +}; +/* * Function nsc_ircc_open (iobase, irq) * @@ -441,10 +455,7 @@ static int __init nsc_ircc_open(chipio_t self->tx_fifo.tail = self->tx_buff.head;/* Override the network functions we need to use */ - dev->hard_start_xmit = nsc_ircc_hard_xmit_sir; - dev->open = nsc_ircc_net_open; - dev->stop = nsc_ircc_net_close; - dev->do_ioctl = nsc_ircc_net_ioctl; + dev->netdev_ops = &nsc_ircc_sir_ops; err =register_netdev (dev);if (err) {@@ -1320,12 +1331,12 @@ static __u8 nsc_ircc_change_speed(structswitch_bank (iobase,BANK0 );if (speed >115200 ) {/* Install FIR xmit handler */ - dev->hard_start_xmit = nsc_ircc_hard_xmit_fir; + dev->netdev_ops = &nsc_ircc_fir_ops; ier =IER_SFIF_IE ;nsc_ircc_dma_receive (self); }else {/* Install SIR xmit handler */ - dev->hard_start_xmit = nsc_ircc_hard_xmit_sir; + dev->netdev_ops = &nsc_ircc_sir_ops; ier =IER_RXHDL_IE ; }/* Set our current interrupt mask */ Signature · 1 line
--
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Re: [PATCH 13/77] irda: convert ali driver to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
Quoted 60 lines
--- drivers/net/irda/ali-ircc.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)drivers/net/irda/ali-ircc.c +17
-6@@ -259,6 +259,20 @@ static void __exit ali_ircc_cleanup(voidIRDA_DEBUG (2 ,"%s(), ----------------- End -----------------\n" , __func__); } +static const struct net_device_ops ali_ircc_sir_ops = { + .ndo_open = ali_ircc_net_open, + .ndo_stop = ali_ircc_net_close, + .ndo_start_xmit = ali_ircc_sir_hard_xmit, + .ndo_do_ioctl = ali_ircc_net_ioctl, +}; + +static const struct net_device_ops ali_ircc_fir_ops = { + .ndo_open = ali_ircc_net_open, + .ndo_stop = ali_ircc_net_close, + .ndo_start_xmit = ali_ircc_fir_hard_xmit, + .ndo_do_ioctl = ali_ircc_net_ioctl, +}; +/* * Function ali_ircc_open (int i, chipio_t *inf) * @@ -361,10 +375,7 @@ static int ali_ircc_open(int i, chipio_t self->tx_fifo.tail = self->tx_buff.head;/* Override the network functions we need to use */ - dev->hard_start_xmit = ali_ircc_sir_hard_xmit; - dev->open = ali_ircc_net_open; - dev->stop = ali_ircc_net_close; - dev->do_ioctl = ali_ircc_net_ioctl; + dev->netdev_ops = &ali_ircc_sir_ops; err =register_netdev (dev);if (err) {@@ -974,7 +985,7 @@ static void ali_ircc_change_speed(structali_ircc_fir_change_speed (self, baud);/* Install FIR xmit handler*/ - dev->hard_start_xmit = ali_ircc_fir_hard_xmit; + dev->netdev_ops = &ali_ircc_fir_ops;/* Enable Interuupt */ self->ier =IER_EOM ;// benjamin 2000/11/20 07:24PM @@ -988,7 +999,7 @@ static void ali_ircc_change_speed(structali_ircc_sir_change_speed (self, baud);/* Install SIR xmit handler*/ - dev->hard_start_xmit = ali_ircc_sir_hard_xmit; + dev->netdev_ops = &ali_ircc_sir_ops; }Signature · 1 line
--
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Re: [PATCH 14/77] irda: convert vlsi driver to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
Quoted 38 lines
--- drivers/net/irda/vlsi_ir.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)drivers/net/irda/vlsi_ir.c +9
-5@@ -1573,6 +1573,14 @@ static int vlsi_close(struct net_devicereturn 0 ; } +static const struct net_device_ops vlsi_netdev_ops = { + .ndo_open = vlsi_open, + .ndo_stop = vlsi_close, + .ndo_start_xmit = vlsi_hard_start_xmit, + .ndo_do_ioctl = vlsi_ioctl, + .ndo_tx_timeout = vlsi_tx_timeout, +}; +static int vlsi_irda_init (struct net_device *ndev) {vlsi_irda_dev_t *idev =netdev_priv (ndev);@@ -1608,11 +1616,7 @@ static int vlsi_irda_init(struct net_dev ndev->flags |=IFF_PORTSEL |IFF_AUTOMEDIA ; ndev->if_port =IF_PORT_UNKNOWN ; - ndev->open = vlsi_open; - ndev->stop = vlsi_close; - ndev->hard_start_xmit = vlsi_hard_start_xmit; - ndev->do_ioctl = vlsi_ioctl; - ndev->tx_timeout = vlsi_tx_timeout; + ndev->netdev_ops = &vlsi_netdev_ops; ndev->watchdog_timeo =500 *HZ /1000 ;/* max. allowed turn time for IrLAP */ SET_NETDEV_DEV (ndev, &pdev->dev);Signature · 1 line
--
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Re: [PATCH 15/77] irda: convert smsc driver to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
Quoted 71 lines
--- drivers/net/irda/smsc-ircc2.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-)drivers/net/irda/smsc-ircc2.c +21
-9@@ -486,6 +486,26 @@ static int __init smsc_ircc_init(void)return ret; } +static int smsc_ircc_net_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct smsc_ircc_cb *self =netdev_priv (dev); + +if (self->io.speed >115200 ) +return smsc_ircc_hard_xmit_fir (skb, dev); +else +return smsc_ircc_hard_xmit_sir (skb, dev); +} + +static const struct net_device_ops smsc_ircc_netdev_ops = { + .ndo_open = smsc_ircc_net_open, + .ndo_stop = smsc_ircc_net_close, + .ndo_do_ioctl = smsc_ircc_net_ioctl, + .ndo_start_xmit = smsc_ircc_net_xmit, +#if SMSC_IRCC2_C_NET_TIMEOUT + .ndo_tx_timeout = smsc_ircc_timeout, +#endif +}; +/* * Function smsc_ircc_open (firbase, sirbase, dma, irq) * @@ -519,14 +539,10 @@ static int __init smsc_ircc_open(unsigne goto err_out1; } - dev->hard_start_xmit = smsc_ircc_hard_xmit_sir;#if SMSC_IRCC2_C_NET_TIMEOUT - dev->tx_timeout = smsc_ircc_timeout; dev->watchdog_timeo =HZ *2 ;/* Allow enough time for speed change */ #endif - dev->open = smsc_ircc_net_open; - dev->stop = smsc_ircc_net_close; - dev->do_ioctl = smsc_ircc_net_ioctl; + dev->netdev_ops = &smsc_ircc_netdev_ops; self =netdev_priv (dev); self->netdev = dev;@@ -995,9 +1011,6 @@ static void smsc_ircc_fir_start(struct s/* Reset everything */ -/* Install FIR transmit handler */ - dev->hard_start_xmit = smsc_ircc_hard_xmit_fir; -/* Clear FIFO */ outb (inb (fir_base +IRCC_LCR_A ) |IRCC_LCR_A_FIFO_RESET , fir_base +IRCC_LCR_A );@@ -1894,7 +1907,6 @@ static void smsc_ircc_sir_start(struct s IRDA_ASSERT(self != NULL, return;); dev = self->netdev; IRDA_ASSERT(dev != NULL, return;); - dev->hard_start_xmit = &smsc_ircc_hard_xmit_sir; fir_base = self->io.fir_base; sir_base = self->io.sir_base;Signature · 1 line
--
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Re: [PATCH 16/77] irda: convert via-ircc to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
Quoted 56 lines
--- drivers/net/irda/via-ircc.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)drivers/net/irda/via-ircc.c +16
-6@@ -310,6 +310,19 @@ static void __exit via_ircc_cleanup(voidpci_unregister_driver (&via_driver); } +static const struct net_device_ops via_ircc_sir_ops = { + .ndo_start_xmit = via_ircc_hard_xmit_sir, + .ndo_open = via_ircc_net_open, + .ndo_stop = via_ircc_net_close, + .ndo_do_ioctl = via_ircc_net_ioctl, +}; +static const struct net_device_ops via_ircc_fir_ops = { + .ndo_start_xmit = via_ircc_hard_xmit_fir, + .ndo_open = via_ircc_net_open, + .ndo_stop = via_ircc_net_close, + .ndo_do_ioctl = via_ircc_net_ioctl, +}; +/* * Function via_ircc_open (iobase, irq) * @@ -428,10 +441,7 @@ static __devinit int via_ircc_open(int i self->tx_fifo.tail = self->tx_buff.head;/* Override the network functions we need to use */ - dev->hard_start_xmit = via_ircc_hard_xmit_sir; - dev->open = via_ircc_net_open; - dev->stop = via_ircc_net_close; - dev->do_ioctl = via_ircc_net_ioctl; + dev->netdev_ops = &via_ircc_sir_ops; err =register_netdev (dev);if (err)@@ -798,11 +808,11 @@ static void via_ircc_change_speed(structif (speed >115200 ) {/* Install FIR xmit handler */ - dev->hard_start_xmit = via_ircc_hard_xmit_fir; + dev->netdev_ops = &via_ircc_fir_ops;via_ircc_dma_receive (self); }else {/* Install SIR xmit handler */ - dev->hard_start_xmit = via_ircc_hard_xmit_sir; + dev->netdev_ops = &via_ircc_sir_ops; }netif_wake_queue (dev); }Signature · 1 line
--
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Re: [PATCH 17/77] irda: convert sir device to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
Quoted 31 lines
drivers/net/irda/sir_dev.c +7
-4@@ -865,6 +865,12 @@ out:return 0 ; } +static const struct net_device_ops sirdev_ops = { + .ndo_start_xmit = sirdev_hard_xmit, + .ndo_open = sirdev_open, + .ndo_stop = sirdev_close, + .ndo_do_ioctl = sirdev_ioctl, +};/* ----------------------------------------------------------------------------- */ struct sir_dev *sirdev_get_instance (const struct sir_driver *drv,const char *name)@@ -908,10 +914,7 @@ struct sir_dev * sirdev_get_instance(con dev->netdev = ndev;/* Override the network functions we need to use */ - ndev->hard_start_xmit = sirdev_hard_xmit; - ndev->open = sirdev_open; - ndev->stop = sirdev_close; - ndev->do_ioctl = sirdev_ioctl; + ndev->netdev_ops = &sirdev_ops;if (register_netdev (ndev)) {IRDA_ERROR ("%s(), register_netdev() failed!\n" , __func__);Signature · 1 line
--
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Re: [PATCH 18/77] irda: convert kignsun device to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
Quoted 30 lines
drivers/net/irda/kingsun-sir.c +7
-4@@ -418,6 +418,12 @@ static int kingsun_net_ioctl(struct net_return ret; } +static const struct net_device_ops kingsun_ops = { + .ndo_start_xmit = kingsun_hard_xmit, + .ndo_open = kingsun_net_open, + .ndo_stop = kingsun_net_close, + .ndo_do_ioctl = kingsun_net_ioctl, +};/* * This routine is called by the USB subsystem for each new device @@ -520,10 +526,7 @@ static int kingsun_probe(struct usb_inteirda_qos_bits_to_value (&kingsun->qos);/* Override the network functions we need to use */ - net->hard_start_xmit = kingsun_hard_xmit; - net->open = kingsun_net_open; - net->stop = kingsun_net_close; - net->do_ioctl = kingsun_net_ioctl; + net->netdev_ops = &kingsun_ops; ret =register_netdev (net);if (ret !=0 )Signature · 1 line
--
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Re: [PATCH 19/77] irda: convert ksdazzle device to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
Quoted 31 lines
drivers/net/irda/ksdazzle-sir.c +8
-4@@ -562,6 +562,13 @@ static int ksdazzle_net_ioctl(struct netreturn ret; } +static const struct net_device_ops ksdazzle_ops = { + .ndo_start_xmit = ksdazzle_hard_xmit, + .ndo_open = ksdazzle_net_open, + .ndo_stop = ksdazzle_net_close, + .ndo_do_ioctl = ksdazzle_net_ioctl, +}; +/* * This routine is called by the USB subsystem for each new device * in the system. We need to check if the device is ours, and in @@ -684,10 +691,7 @@ static int ksdazzle_probe(struct usb_intirda_qos_bits_to_value (&kingsun->qos);/* Override the network functions we need to use */ - net->hard_start_xmit = ksdazzle_hard_xmit; - net->open = ksdazzle_net_open; - net->stop = ksdazzle_net_close; - net->do_ioctl = ksdazzle_net_ioctl; + net->netdev_ops = &ksdazzle_ops; ret =register_netdev (net);if (ret !=0 )Signature · 1 line
--
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Re: [PATCH 20/77] irda: convert ks959 device to net_device_ops
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
Quoted 30 lines
drivers/net/irda/ks959-sir.c +7
-4@@ -668,6 +668,12 @@ static int ks959_net_ioctl(struct net_dereturn ret; } +static const struct net_device_ops ks959_ops = { + .ndo_start_xmit = ks959_hard_xmit, + .ndo_open = ks959_net_open, + .ndo_stop = ks959_net_close, + .ndo_do_ioctl = ks959_net_ioctl, +};/* * This routine is called by the USB subsystem for each new device * in the system. We need to check if the device is ours, and in @@ -780,10 +786,7 @@ static int ks959_probe(struct usb_interfirda_qos_bits_to_value (&kingsun->qos);/* Override the network functions we need to use */ - net->hard_start_xmit = ks959_hard_xmit; - net->open = ks959_net_open; - net->stop = ks959_net_close; - net->do_ioctl = ks959_net_ioctl; + net->netdev_ops = &ks959_ops; ret =register_netdev (net);if (ret !=0 )Signature · 1 line
--
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/