Another batch of network device conversions
Subsystems (4)
PATCH 6/45 netrom: convert to internal net_device_stats
In reply to Stephen Hemminger--- include/net/netrom.h | 4 ---- net/netrom/af_netrom.c | 2 +- net/netrom/nr_dev.c | 14 ++------------ 3 files changed, 3 insertions(+), 17 deletions(-)
net/netrom/af_netrom.c +1 -1
@@ -1432,7 +1432,7 @@ static int __init nr_proto_init(void)struct net_device *dev;sprintf (name,"nr%d" , i); - dev =alloc_netdev (sizeof (struct nr_private ), name, nr_setup); + dev =alloc_netdev (0 , name, nr_setup);if (!dev) {printk (KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device structure\n" ); goto fail;
include/net/netrom.h +0 -4
@@ -59,10 +59,6 @@ enum {#define NR_MAX_WINDOW_SIZE 127/* Maximum Window Allowable - 127 */ #define NR_MAX_PACKET_SIZE 236/* Maximum Packet Length - 236 */ -struct nr_private { -struct net_device_stats stats; -}; -struct nr_sock {struct sock sock;ax25_address user_addr, source_addr, dest_addr;
net/netrom/nr_dev.c +2 -12
@@ -42,7 +42,7 @@int nr_rx_ip (struct sk_buff *skb,struct net_device *dev) { -struct net_device_stats *stats =netdev_priv (dev); +struct net_device_stats *stats = &dev->stats;if (!netif_running (dev)) { stats->rx_dropped++;
@@ -171,8 +171,7 @@ static int nr_close(struct net_device *dstatic int nr_xmit (struct sk_buff *skb,struct net_device *dev) { -struct nr_private *nr =netdev_priv (dev); -struct net_device_stats *stats = &nr->stats; +struct net_device_stats *stats = &dev->stats;unsigned int len = skb->len;if (!nr_route_frame (skb,NULL )) {
@@ -187,13 +186,6 @@ static int nr_xmit(struct sk_buff *skb,return 0 ; } -static struct net_device_stats *nr_get_stats (struct net_device *dev) -{ -struct nr_private *nr =netdev_priv (dev); - -return &nr->stats; -} -static const struct header_ops nr_header_ops = { .create = nr_header, .rebuild= nr_rebuild_header,
@@ -215,6 +207,4 @@ void nr_setup(struct net_device *dev)/* New-style flags. */ dev->flags =IFF_NOARP ; - - dev->get_stats = nr_get_stats; }
PATCH 7/45 netrom: convert to net_device_ops
In reply to Stephen Hemminger--- include/net/netrom.h | 4 ---- net/netrom/af_netrom.c | 4 ++-- net/netrom/nr_dev.c | 26 +++++++++----------------- 3 files changed, 11 insertions(+), 23 deletions(-)
net/netrom/nr_dev.c +7 -5
@@ -191,19 +191,21 @@ static const struct header_ops nr_header .rebuild= nr_rebuild_header, }; +static const struct net_device_ops nr_netdev_ops = { + .ndo_open = nr_open, + .ndo_stop = nr_close, + .ndo_start_xmit = nr_xmit, + .ndo_set_mac_address = nr_set_mac_address, +};void nr_setup (struct net_device *dev) { dev->mtu =NR_MAX_PACKET_SIZE ; - dev->hard_start_xmit = nr_xmit; - dev->open = nr_open; - dev->stop = nr_close; - + dev->netdev_ops = &nr_netdev_ops; dev->header_ops = &nr_header_ops; dev->hard_header_len =NR_NETWORK_LEN +NR_TRANSPORT_LEN ; dev->addr_len =AX25_ADDR_LEN ; dev->type =ARPHRD_NETROM ; - dev->set_mac_address = nr_set_mac_address;/* New-style flags. */ dev->flags =IFF_NOARP ;
PATCH 8/45 rose: convert to internal net_device_stats
In reply to Stephen Hemmingernet/rose/af_rose.c +1 -2
@@ -1587,8 +1587,7 @@ static int __init rose_proto_init(void)char name[IFNAMSIZ ];sprintf (name,"rose%d" , i); - dev =alloc_netdev (sizeof (struct net_device_stats ), - name, rose_setup); + dev =alloc_netdev (0 , name, rose_setup);if (!dev) {printk (KERN_ERR "ROSE: rose_proto_init - unable to allocate memory\n" ); rc = -ENOMEM ;
net/rose/rose_dev.c +2 -8
@@ -57,7 +57,7 @@ static int rose_rebuild_header(struct sk {#ifdef CONFIG_INET struct net_device *dev = skb->dev; -struct net_device_stats *stats =netdev_priv (dev); +struct net_device_stats *stats = &dev->stats;unsigned char *bp = (unsigned char *)skb->data;struct sk_buff *skbn;unsigned int len;
@@ -133,7 +133,7 @@ static int rose_close(struct net_devicestatic int rose_xmit (struct sk_buff *skb,struct net_device *dev) { -struct net_device_stats *stats =netdev_priv (dev); +struct net_device_stats *stats = &dev->stats;if (!netif_running (dev)) {printk (KERN_ERR "ROSE: rose_xmit - called when iface is down\n" );
@@ -144,11 +144,6 @@ static int rose_xmit(struct sk_buff *skbreturn 0 ; } -static struct net_device_stats *rose_get_stats (struct net_device *dev) -{ -return netdev_priv (dev); -} -static const struct header_ops rose_header_ops = { .create = rose_header, .rebuild= rose_rebuild_header,
@@ -169,5 +164,4 @@ void rose_setup(struct net_device *dev)/* New-style flags. */ dev->flags =IFF_NOARP ; - dev->get_stats = rose_get_stats; }
PATCH 9/45 rose: convert to network_device_ops
In reply to Stephen Hemmingernet/rose/rose_dev.c +8 -4
@@ -149,18 +149,22 @@ static const struct header_ops rose_head .rebuild= rose_rebuild_header, }; +static const struct net_device_ops rose_netdev_ops = { + .ndo_open = rose_open, + .ndo_stop = rose_close, + .ndo_start_xmit = rose_xmit, + .ndo_set_mac_address = rose_set_mac_address, +}; +void rose_setup (struct net_device *dev) { dev->mtu =ROSE_MAX_PACKET_SIZE -2 ; - dev->hard_start_xmit = rose_xmit; - dev->open = rose_open; - dev->stop = rose_close; + dev->netdev_ops = &rose_netdev_ops; dev->header_ops = &rose_header_ops; dev->hard_header_len =AX25_BPQ_HEADER_LEN +AX25_MAX_HEADER_LEN +ROSE_MIN_LEN ; dev->addr_len =ROSE_ADDR_LEN ; dev->type =ARPHRD_ROSE ; - dev->set_mac_address = rose_set_mac_address;/* New-style flags. */ dev->flags =IFF_NOARP ;
PATCH 31/45 6pack: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/hamradio/6pack.c +9 -7
@@ -322,23 +322,25 @@ static const struct header_ops sp_header .rebuild = sp_rebuild_header, }; +static const struct net_device_ops sp_netdev_ops = { + .ndo_open = sp_open_dev, + .ndo_stop = sp_close, + .ndo_start_xmit = sp_xmit, + .ndo_set_mac_address = sp_set_mac_address, +}; +static void sp_setup (struct net_device *dev) {/* Finish setting up the DEVICE info. */ - dev->mtu =SIXP_MTU ; - dev->hard_start_xmit = sp_xmit; - dev->open = sp_open_dev; + dev->netdev_ops = &sp_netdev_ops; dev->destructor = free_netdev; - dev->stop = sp_close; - - dev->set_mac_address = sp_set_mac_address; + dev->mtu =SIXP_MTU ; dev->hard_header_len =AX25_MAX_HEADER_LEN ; dev->header_ops = &sp_header_ops; dev->addr_len =AX25_ADDR_LEN ; dev->type =ARPHRD_AX25 ; dev->tx_queue_len =10 ; - dev->tx_timeout =NULL ;/* Only activated in AX.25 mode */ memcpy (dev->broadcast, &ax25_bcast,AX25_ADDR_LEN );
PATCH 32/45 baycom: convert to internal net_device_stats
In reply to Stephen Hemmingerdrivers/net/hamradio/baycom_epp.c +7 -22
@@ -203,7 +203,6 @@ struct baycom_state {unsigned char buf[TXBUFFER_SIZE ]; } hdlctx; -struct net_device_stats stats;unsigned int ptt_keyed;struct sk_buff *skb;/* next transmit packet */
@@ -423,7 +422,7 @@ static void encode_hdlc(struct baycom_st bc->hdlctx.bufptr = bc->hdlctx.buf; bc->hdlctx.bufcnt = wp - bc->hdlctx.buf;dev_kfree_skb (skb); - bc->stats.tx_packets++; + bc->dev->stats.tx_packets++; }/* ---------------------------------------------------------------------- */
@@ -547,7 +546,7 @@ static void do_rxpacket(struct net_devic pktlen = bc->hdlcrx.bufcnt-2 +1 ;/* KISS kludge */ if (!(skb =dev_alloc_skb (pktlen))) {printk ("%s: memory squeeze, dropping packet\n" , dev->name); - bc->stats.rx_dropped++; + dev->stats.rx_dropped++;return ; } cp =skb_put (skb, pktlen);
@@ -555,7 +554,7 @@ static void do_rxpacket(struct net_devicmemcpy (cp, bc->hdlcrx.buf, pktlen -1 ); skb->protocol =ax25_type_trans (skb, dev);netif_rx (skb); - bc->stats.rx_packets++; + dev->stats.rx_packets++; }static int receive (struct net_device *dev,int cnt)
@@ -802,19 +801,6 @@ static int baycom_set_mac_address(struct/* --------------------------------------------------------------------- */ -static struct net_device_stats *baycom_get_stats (struct net_device *dev) -{ -struct baycom_state *bc =netdev_priv (dev); - -/* -* Get the current statistics. This may be called with the -* card open or closed. -*/ -return &bc->stats; -} - -/* --------------------------------------------------------------------- */ -static void epp_wakeup (void *handle) {struct net_device *dev = (struct net_device *)handle;
@@ -1065,10 +1051,10 @@ static int baycom_ioctl(struct net_devic hi.data.cs.ptt = !!(bc->stat &EPP_PTTBIT ); hi.data.cs.dcd = !(bc->stat &EPP_DCDBIT ); hi.data.cs.ptt_keyed = bc->ptt_keyed; - hi.data.cs.tx_packets = bc->stats.tx_packets; - hi.data.cs.tx_errors = bc->stats.tx_errors; - hi.data.cs.rx_packets = bc->stats.rx_packets; - hi.data.cs.rx_errors = bc->stats.rx_errors; + hi.data.cs.tx_packets = dev->stats.tx_packets; + hi.data.cs.tx_errors = dev->stats.tx_errors; + hi.data.cs.rx_packets = dev->stats.rx_packets; + hi.data.cs.rx_errors = dev->stats.rx_errors;break ;case HDLCDRVCTL_OLDGETSTAT :
@@ -1147,7 +1133,6 @@ static void baycom_probe(struct net_devi dev->stop = epp_close; dev->do_ioctl = baycom_ioctl; dev->hard_start_xmit = baycom_send_packet; - dev->get_stats = baycom_get_stats;/* Fill in the fields of the device structure */ bc->skb =NULL ;
PATCH 33/45 baycom: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/hamradio/baycom_epp.c +9 -5
@@ -1102,6 +1102,14 @@ static int baycom_ioctl(struct net_devic/* --------------------------------------------------------------------- */ +static const struct net_device_ops baycom_netdev_ops = { + .ndo_open = epp_open, + .ndo_stop = epp_close, + .ndo_do_ioctl = baycom_ioctl, + .ndo_start_xmit = baycom_send_packet, + .ndo_set_mac_address = baycom_set_mac_address, +}; +/* * Check for a network adaptor of this type, and return '0' if one exists. * If dev->base_addr == 0, probe all likely locations.
@@ -1129,16 +1137,12 @@ static void baycom_probe(struct net_devi/* * initialize the device struct */ - dev->open = epp_open; - dev->stop = epp_close; - dev->do_ioctl = baycom_ioctl; - dev->hard_start_xmit = baycom_send_packet;/* Fill in the fields of the device structure */ bc->skb =NULL ; + dev->netdev_ops = &baycom_netdev_ops; dev->header_ops = &ax25_header_ops; - dev->set_mac_address = baycom_set_mac_address; dev->type =ARPHRD_AX25 ;/* AF_AX25 device */ dev->hard_header_len =AX25_MAX_HEADER_LEN +AX25_BPQ_HEADER_LEN ;
PATCH 34/45 bpqether: convert to internal net_device_stats
In reply to Stephen Hemmingerdrivers/net/hamradio/bpqether.c +5 -16
@@ -110,7 +110,6 @@ struct bpqdev {struct list_head bpq_list;/* list of bpq devices chain */ struct net_device *ethdev;/* link to ethernet device */ struct net_device *axdev;/* bpq device (bpq#) */ -struct net_device_stats stats;/* some statistics */ char dest_addr[6 ];/* ether destination address */ char acpt_addr[6 ];/* accept ether frames from this address only */ };
@@ -222,8 +221,8 @@ static int bpq_rcv(struct sk_buff *skb,skb_pull (skb,2 );/* Remove the length bytes */ skb_trim (skb, len);/* Set the length of the data */ - bpq->stats.rx_packets++; - bpq->stats.rx_bytes += len; + dev->stats.rx_packets++; + dev->stats.rx_bytes += len; ptr =skb_push (skb,1 ); *ptr =0 ;
@@ -292,7 +291,7 @@ static int bpq_xmit(struct sk_buff *skb, bpq =netdev_priv (dev);if ((dev =bpq_get_ether_dev (dev)) ==NULL ) { - bpq->stats.tx_dropped++; + dev->stats.tx_dropped++;kfree_skb (skb);return -ENODEV ; }
@@ -300,8 +299,8 @@ static int bpq_xmit(struct sk_buff *skb, skb->protocol =ax25_type_trans (skb, dev);skb_reset_network_header (skb);dev_hard_header (skb, dev,ETH_P_BPQ , bpq->dest_addr,NULL ,0 ); - bpq->stats.tx_packets++; - bpq->stats.tx_bytes+=skb->len; + dev->stats.tx_packets++; + dev->stats.tx_bytes+=skb->len;dev_queue_xmit (skb);netif_wake_queue (dev);
@@ -309,16 +308,6 @@ static int bpq_xmit(struct sk_buff *skb, }/* -* Statistics -*/ -static struct net_device_stats *bpq_get_stats (struct net_device *dev) -{ -struct bpqdev *bpq =netdev_priv (dev); - -return &bpq->stats; -} - -/* * Set AX.25 callsign */ static int bpq_set_mac_address (struct net_device *dev,void *addr)
PATCH 35/45 bpqether: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/hamradio/bpqether.c +8 -7
@@ -466,16 +466,17 @@ static const struct file_operations bpq_/* ------------------------------------------------------------------------ */ +static const struct net_device_ops bpq_netdev_ops = { + .ndo_open = bpq_open, + .ndo_stop = bpq_close, + .ndo_start_xmit = bpq_xmit, + .ndo_set_mac_address = bpq_set_mac_address, + .ndo_do_ioctl = bpq_ioctl, +};static void bpq_setup (struct net_device *dev) { - - dev->hard_start_xmit = bpq_xmit; - dev->open = bpq_open; - dev->stop = bpq_close; - dev->set_mac_address = bpq_set_mac_address; - dev->get_stats = bpq_get_stats; - dev->do_ioctl = bpq_ioctl; + dev->netdev_ops = &bpq_netdev_ops; dev->destructor = free_netdev;memcpy (dev->broadcast, &ax25_bcast,AX25_ADDR_LEN );
PATCH 36/45 dmascc: convert to internal network device stats
In reply to Stephen Hemmingerdrivers/net/hamradio/dmascc.c +16 -25
@@ -195,7 +195,7 @@ struct scc_priv {int chip;struct net_device *dev;struct scc_info *info; -struct net_device_stats stats; +int channel;int card_base, scc_cmd, scc_data;int tmr_cnt, tmr_ctrl, tmr_mode;
@@ -239,7 +239,6 @@ static int scc_open(struct net_device *dstatic int scc_close (struct net_device *dev);static int scc_ioctl (struct net_device *dev,struct ifreq *ifr,int cmd);static int scc_send_packet (struct sk_buff *skb,struct net_device *dev); -static struct net_device_stats *scc_get_stats (struct net_device *dev);static int scc_set_mac_address (struct net_device *dev,void *sa);static inline void tx_on (struct scc_priv *priv);
@@ -961,14 +960,6 @@ static int scc_send_packet(struct sk_buf } -static struct net_device_stats *scc_get_stats (struct net_device *dev) -{ -struct scc_priv *priv = dev->ml_priv; - -return &priv->stats; -} - -static int scc_set_mac_address (struct net_device *dev,void *sa) { memcpy(dev->dev_addr, ((struct sockaddr *) sa)->sa_data,
@@ -1216,17 +1207,17 @@ static void special_condition(struct scc }if (priv->rx_over) {/* We had an overrun */ - priv->stats.rx_errors++; + priv->dev->stats.rx_errors++;if (priv->rx_over ==2 ) - priv->stats.rx_length_errors++; + priv->dev->stats.rx_length_errors++;else - priv->stats.rx_fifo_errors++; + priv->dev->stats.rx_fifo_errors++; priv->rx_over =0 ; }else if (rc &CRC_ERR ) {/* Count invalid CRC only if packet length >= minimum */ if (cb >=15 ) { - priv->stats.rx_errors++; - priv->stats.rx_crc_errors++; + priv->dev->stats.rx_errors++; + priv->dev->stats.rx_crc_errors++; } }else {if (cb >=15 ) {
@@ -1239,8 +1230,8 @@ static void special_condition(struct scc priv->rx_count++;schedule_work (&priv->rx_work); }else { - priv->stats.rx_errors++; - priv->stats.rx_over_errors++; + priv->dev->stats.rx_errors++; + priv->dev->stats.rx_over_errors++; } } }
@@ -1275,7 +1266,7 @@ static void rx_bh(struct work_struct *ug skb =dev_alloc_skb (cb +1 );if (skb ==NULL ) {/* Drop packet */ - priv->stats.rx_dropped++; + priv->dev->stats.rx_dropped++; }else {/* Fill buffer */ data =skb_put (skb, cb +1 );
@@ -1283,8 +1274,8 @@ static void rx_bh(struct work_struct *ugmemcpy (&data[1 ], priv->rx_buf[i], cb); skb->protocol =ax25_type_trans (skb, priv->dev);netif_rx (skb); - priv->stats.rx_packets++; - priv->stats.rx_bytes += cb; + priv->dev->stats.rx_packets++; + priv->dev->stats.rx_bytes += cb; }spin_lock_irqsave (&priv->ring_lock, flags);/* Move tail */
@@ -1351,15 +1342,15 @@ static void es_isr(struct scc_priv *privwrite_scc (priv,R1 ,EXT_INT_ENAB |WT_FN_RDYFN );if (res) {/* Update packet statistics */ - priv->stats.tx_errors++; - priv->stats.tx_fifo_errors++; + priv->dev->stats.tx_errors++; + priv->dev->stats.tx_fifo_errors++;/* Other underrun interrupts may already be waiting */ write_scc (priv,R0 ,RES_EXT_INT );write_scc (priv,R0 ,RES_EXT_INT ); }else {/* Update packet statistics */ - priv->stats.tx_packets++; - priv->stats.tx_bytes += priv->tx_len[i]; + priv->dev->stats.tx_packets++; + priv->dev->stats.tx_bytes += priv->tx_len[i];/* Remove frame from FIFO */ priv->tx_tail = (i +1 ) %NUM_TX_BUF ; priv->tx_count--;
@@ -1425,7 +1416,7 @@ static void tm_isr(struct scc_priv *privwrite_scc (priv,R15 ,DCDIE ); priv->rr0 =read_scc (priv,R0 );if (priv->rr0 &DCD ) { - priv->stats.collisions++; + priv->dev->stats.collisions++;rx_on (priv); priv->state =RX_ON ; }else {
PATCH 37/45 dmascc: convert to network_device_ops
In reply to Stephen Hemmingerdrivers/net/hamradio/dmascc.c +8 -5
@@ -440,6 +440,13 @@ static void __init dev_setup(struct net_memcpy (dev->dev_addr, &ax25_defaddr,AX25_ADDR_LEN ); } +static const struct net_device_ops scc_netdev_ops = { + .ndo_open = scc_open, + .ndo_stop = scc_close, + .ndo_start_xmit = scc_send_packet, + .ndo_do_ioctl = scc_ioctl, +}; +static int __init setup_adapter (int card_base,int type,int n) {int i, irq, chip;
@@ -575,11 +582,7 @@ static int __init setup_adapter(int cardsprintf (dev->name,"dmascc%i" ,2 * n + i); dev->base_addr = card_base; dev->irq = irq; - dev->open = scc_open; - dev->stop = scc_close; - dev->do_ioctl = scc_ioctl; - dev->hard_start_xmit = scc_send_packet; - dev->get_stats = scc_get_stats; + dev->netdev_ops = &scc_netdev_ops; dev->header_ops = &ax25_header_ops; dev->set_mac_address = scc_set_mac_address; }
PATCH 38/45 hdlcdrv: convert to internal net_device_stats
In reply to Stephen Hemminger--- drivers/net/hamradio/hdlcdrv.c | 27 +++++++-------------------- include/linux/hdlcdrv.h | 1 - 2 files changed, 7 insertions(+), 21 deletions(-)
drivers/net/hamradio/hdlcdrv.c +7 -20
@@ -154,7 +154,7 @@ static void hdlc_rx_flag(struct net_devi pkt_len = s->hdlcrx.len -2 +1 ;/* KISS kludge */ if (!(skb =dev_alloc_skb (pkt_len))) {printk ("%s: memory squeeze, dropping packet\n" , dev->name); - s->stats.rx_dropped++; + dev->stats.rx_dropped++;return ; } cp =skb_put (skb, pkt_len);
@@ -162,7 +162,7 @@ static void hdlc_rx_flag(struct net_devimemcpy (cp, s->hdlcrx.buffer, pkt_len -1 ); skb->protocol =ax25_type_trans (skb, dev);netif_rx (skb); - s->stats.rx_packets++; + dev->stats.rx_packets++; }void hdlcdrv_receiver (struct net_device *dev,struct hdlcdrv_state *s)
@@ -326,7 +326,7 @@ void hdlcdrv_transmitter(struct net_devi s->hdlctx.len = pkt_len+2 ;/* the appended CRC */ s->hdlctx.tx_state =2 ; s->hdlctx.bitstream =0 ; - s->stats.tx_packets++; + dev->stats.tx_packets++;break ;case 2 :if (!s->hdlctx.len) {
@@ -427,19 +427,6 @@ static int hdlcdrv_set_mac_address(struc }/* --------------------------------------------------------------------- */ - -static struct net_device_stats *hdlcdrv_get_stats (struct net_device *dev) -{ -struct hdlcdrv_state *sm =netdev_priv (dev); - -/* -* Get the current statistics. This may be called with the -* card open or closed. -*/ -return &sm->stats; -} - -/* --------------------------------------------------------------------- */ /* * Open/initialize the board. This is called (in the current kernel) * sometime after booting when the 'ifconfig' program is run.
@@ -568,10 +555,10 @@ static int hdlcdrv_ioctl(struct net_devi bi.data.cs.ptt =hdlcdrv_ptt (s); bi.data.cs.dcd = s->hdlcrx.dcd; bi.data.cs.ptt_keyed = s->ptt_keyed; - bi.data.cs.tx_packets = s->stats.tx_packets; - bi.data.cs.tx_errors = s->stats.tx_errors; - bi.data.cs.rx_packets = s->stats.rx_packets; - bi.data.cs.rx_errors = s->stats.rx_errors; + bi.data.cs.tx_packets = dev->stats.tx_packets; + bi.data.cs.tx_errors = dev->stats.tx_errors; + bi.data.cs.rx_packets = dev->stats.rx_packets; + bi.data.cs.rx_errors = dev->stats.rx_errors;break ;case HDLCDRVCTL_OLDGETSTAT :
include/linux/hdlcdrv.h +0 -1
@@ -241,7 +241,6 @@ struct hdlcdrv_state {struct hdlcdrv_bitbuffer bitbuf_hdlc;#endif /* HDLCDRV_DEBUG */ -struct net_device_stats stats;int ptt_keyed;/* queued skb for transmission */
PATCH 39/45 hdlcdrv: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/hamradio/hdlcdrv.c +9 -9
@@ -617,6 +617,14 @@ static int hdlcdrv_ioctl(struct net_devi/* --------------------------------------------------------------------- */ +static const struct net_device_ops hdlcdrv_netdev = { + .ndo_open = hdlcdrv_open, + .ndo_stop = hdlcdrv_close, + .ndo_start_xmit = hdlcdrv_send_packet, + .ndo_do_ioctl = hdlcdrv_ioctl, + .ndo_set_mac_address = hdlcdrv_set_mac_address, +}; +/* * Initialize fields in hdlcdrv */
@@ -656,21 +664,13 @@ static void hdlcdrv_setup(struct net_dev s->bitbuf_hdlc.shreg =0x80 ;#endif /* HDLCDRV_DEBUG */ -/* -* initialize the device struct -*/ - dev->open = hdlcdrv_open; - dev->stop = hdlcdrv_close; - dev->do_ioctl = hdlcdrv_ioctl; - dev->hard_start_xmit = hdlcdrv_send_packet; - dev->get_stats = hdlcdrv_get_stats;/* Fill in the fields of the device structure */ s->skb =NULL ; + dev->netdev_ops = &hdlcdrv_netdev; dev->header_ops = &ax25_header_ops; - dev->set_mac_address = hdlcdrv_set_mac_address; dev->type =ARPHRD_AX25 ;/* AF_AX25 device */ dev->hard_header_len =AX25_MAX_HEADER_LEN +AX25_BPQ_HEADER_LEN ;
PATCH 40/45 yam: convert to internal net_device_stats
In reply to Stephen Hemmingerdrivers/net/hamradio/yam.c +9 -33
@@ -115,10 +115,6 @@ struct yam_port {struct net_device *dev; -/* Stats section */ - -struct net_device_stats stats; -int nb_rxint;int nb_mdint;
@@ -507,7 +503,7 @@ static inline void yam_rx_flag(struct ne }else {if (!(skb =dev_alloc_skb (pkt_len))) {printk (KERN_WARNING "%s: memory squeeze, dropping packet\n" , dev->name); - ++yp->stats.rx_dropped; + ++dev->stats.rx_dropped; }else {unsigned char *cp; cp =skb_put (skb, pkt_len);
@@ -515,7 +511,7 @@ static inline void yam_rx_flag(struct nememcpy (cp, yp->rx_buf, pkt_len -1 ); skb->protocol =ax25_type_trans (skb, dev);netif_rx (skb); - ++yp->stats.rx_packets; + ++dev->stats.rx_packets; } } }
@@ -677,7 +673,7 @@ static void yam_tx_byte(struct net_devic yp->tx_count =1 ; yp->tx_state =TX_HEAD ; } - ++yp->stats.tx_packets; + ++dev->stats.tx_packets;break ;case TX_TAIL :if (--yp->tx_count <=0 ) {
@@ -716,7 +712,7 @@ static irqreturn_t yam_interrupt(int irq handled =1 ;if (lsr &LSR_OE ) - ++yp->stats.rx_fifo_errors; + ++dev->stats.rx_fifo_errors; yp->dcd = (msr &RX_DCD ) ?1 :0 ;
@@ -778,11 +774,11 @@ static int yam_seq_show(struct seq_fileseq_printf (seq," TxTail %u\n" , yp->txtail);seq_printf (seq," SlotTime %u\n" , yp->slot);seq_printf (seq," Persist %u\n" , yp->pers); -seq_printf (seq," TxFrames %lu\n" , yp->stats.tx_packets); -seq_printf (seq," RxFrames %lu\n" , yp->stats.rx_packets); +seq_printf (seq," TxFrames %lu\n" , dev->stats.tx_packets); +seq_printf (seq," RxFrames %lu\n" , dev->stats.rx_packets);seq_printf (seq," TxInt %u\n" , yp->nb_mdint);seq_printf (seq," RxInt %u\n" , yp->nb_rxint); -seq_printf (seq," RxOver %lu\n" , yp->stats.rx_fifo_errors); +seq_printf (seq," RxOver %lu\n" , dev->stats.rx_fifo_errors);seq_printf (seq,"\n" );return 0 ; }
@@ -812,26 +808,6 @@ static const struct file_operations yam_/* --------------------------------------------------------------------- */ -static struct net_device_stats *yam_get_stats (struct net_device *dev) -{ -struct yam_port *yp; - -if (!dev) -return NULL ; - - yp =netdev_priv (dev); -if (yp->magic !=YAM_MAGIC ) -return NULL ; - -/* -* Get the current statistics. This may be called with the -* card open or closed. -*/ -return &yp->stats; -} - -/* --------------------------------------------------------------------- */ -static int yam_open (struct net_device *dev) {struct yam_port *yp =netdev_priv (dev);
@@ -878,9 +854,9 @@ static int yam_open(struct net_device *d/* Reset overruns for all ports - FPGA programming makes overruns */ for (i =0 ; i <NR_PORTS ; i++) {struct net_device *dev = yam_devs[i]; -struct yam_port *yp =netdev_priv (dev); +inb (LSR (dev->base_addr)); - yp->stats.rx_fifo_errors =0 ; + dev->stats.rx_fifo_errors =0 ; } printk(KERN_INFO "%s at iobase 0x%lx irq %u uart %s\n", dev->name, dev->base_addr, dev->irq,
PATCH 41/45 yam: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/hamradio/yam.c +9 -8
@@ -1044,6 +1044,14 @@ static int yam_set_mac_address(struct ne/* --------------------------------------------------------------------- */ +static const struct net_device_ops yam_netdev_ops = { + .ndo_open = yam_open, + .ndo_stop = yam_close, + .ndo_start_xmit = yam_send_packet, + .ndo_do_ioctl = yam_ioctl, + .ndo_set_mac_address = yam_set_mac_address, +}; +static void yam_setup (struct net_device *dev) {struct yam_port *yp =netdev_priv (dev);
@@ -1064,18 +1072,11 @@ static void yam_setup(struct net_device dev->base_addr = yp->iobase; dev->irq = yp->irq; - dev->open = yam_open; - dev->stop = yam_close; - dev->do_ioctl = yam_ioctl; - dev->hard_start_xmit = yam_send_packet; - dev->get_stats = yam_get_stats; -skb_queue_head_init (&yp->send_queue); + dev->netdev_ops = &yam_netdev_ops; dev->header_ops = &ax25_header_ops; - dev->set_mac_address = yam_set_mac_address; - dev->type =ARPHRD_AX25 ; dev->hard_header_len =AX25_MAX_HEADER_LEN ; dev->mtu =AX25_MTU ;
PATCH 42/45 scc: convert to internal net_device_ops
In reply to Stephen Hemmingerdrivers/net/hamradio/scc.c +10 -9
@@ -1542,23 +1542,24 @@ static int scc_net_alloc(const char *nam/* * Network driver methods * */ /* ******************************************************************** */ +static const struct net_device_ops scc_netdev_ops = { + .ndo_open = scc_net_open, + .ndo_stop = scc_net_close, + .ndo_start_xmit = scc_net_tx, + .ndo_set_mac_address = scc_net_set_mac_address, + .ndo_get_stats = scc_net_get_stats, + .ndo_do_ioctl = scc_net_ioctl, +}; +/* ----> Initialize device <----- */ static void scc_net_setup (struct net_device *dev) { dev->tx_queue_len =16 ;/* should be enough... */ - dev->open = scc_net_open; - dev->stop = scc_net_close; - - dev->hard_start_xmit = scc_net_tx; + dev->netdev_ops = &scc_netdev_ops; dev->header_ops = &ax25_header_ops; - dev->set_mac_address = scc_net_set_mac_address; - dev->get_stats = scc_net_get_stats; - dev->do_ioctl = scc_net_ioctl; - dev->tx_timeout =NULL ; -memcpy (dev->broadcast, &ax25_bcast,AX25_ADDR_LEN );memcpy (dev->dev_addr, &ax25_defaddr,AX25_ADDR_LEN );
PATCH 43/45 mkiss: convert to internal network device stats
In reply to Stephen Hemmingerdrivers/net/hamradio/mkiss.c +12 -22
@@ -59,8 +59,6 @@ struct mkiss {unsigned char *xhead;/* pointer to next byte to XMIT */ int xleft;/* bytes left in XMIT queue */ -struct net_device_stats stats; -/* Detailed SLIP statistics. */ int mtu;/* Our mtu (to spot changes!) */ int buffsize;/* Max buffers sizes */
@@ -253,7 +251,7 @@ static void ax_bump(struct mkiss *ax)if (ax->rbuff[0 ] >0x0f ) {if (ax->rbuff[0 ] &0x80 ) {if (check_crc_16 (ax->rbuff, ax->rcount) <0 ) { - ax->stats.rx_errors++; + ax->dev->stats.rx_errors++;spin_unlock_bh (&ax->buflock);return ;
@@ -268,7 +266,7 @@ static void ax_bump(struct mkiss *ax) *ax->rbuff &= ~0x80 ; }else if (ax->rbuff[0 ] &0x20 ) {if (check_crc_flex (ax->rbuff, ax->rcount) <0 ) { - ax->stats.rx_errors++; + ax->dev->stats.rx_errors++;spin_unlock_bh (&ax->buflock);return ; }
@@ -295,7 +293,7 @@ static void ax_bump(struct mkiss *ax)if ((skb =dev_alloc_skb (count)) ==NULL ) {printk (KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n" , ax->dev->name); - ax->stats.rx_dropped++; + ax->dev->stats.rx_dropped++;spin_unlock_bh (&ax->buflock);return ; }
@@ -303,8 +301,8 @@ static void ax_bump(struct mkiss *ax)memcpy (skb_put (skb,count), ax->rbuff, count); skb->protocol =ax25_type_trans (skb, ax->dev);netif_rx (skb); - ax->stats.rx_packets++; - ax->stats.rx_bytes += count; + ax->dev->stats.rx_packets++; + ax->dev->stats.rx_bytes += count;spin_unlock_bh (&ax->buflock); }
@@ -344,7 +342,7 @@ static void kiss_unesc(struct mkiss *ax,return ; } - ax->stats.rx_over_errors++; + ax->dev->stats.rx_over_errors++;set_bit (AXF_ERROR , &ax->flags); }spin_unlock_bh (&ax->buflock);
@@ -406,7 +404,7 @@ static void ax_changedmtu(struct mkiss *memcpy (ax->xbuff, ax->xhead, ax->xleft); }else { ax->xleft =0 ; - ax->stats.tx_dropped++; + dev->stats.tx_dropped++; } }
@@ -417,7 +415,7 @@ static void ax_changedmtu(struct mkiss *memcpy (ax->rbuff, orbuff, ax->rcount); }else { ax->rcount =0 ; - ax->stats.rx_over_errors++; + dev->stats.rx_over_errors++;set_bit (AXF_ERROR , &ax->flags); } }
@@ -444,7 +442,7 @@ static void ax_encaps(struct net_deviceif (len > ax->mtu) {/* Sigh, shouldn't occur BUT ... */ len = ax->mtu;printk (KERN_ERR "mkiss: %s: truncating oversized transmit packet!\n" , ax->dev->name); - ax->stats.tx_dropped++; + dev->stats.tx_dropped++;netif_start_queue (dev);return ; }
@@ -518,8 +516,8 @@ static void ax_encaps(struct net_deviceset_bit (TTY_DO_WRITE_WAKEUP , &ax->tty->flags); actual = ax->tty->ops->write (ax->tty, ax->xbuff, count); - ax->stats.tx_packets++; - ax->stats.tx_bytes += actual; + dev->stats.tx_packets++; + dev->stats.tx_bytes += actual; ax->dev->trans_start = jiffies; ax->xleft = count - actual;
@@ -664,13 +662,6 @@ static int ax_close(struct net_device *dreturn 0 ; } -static struct net_device_stats *ax_get_stats (struct net_device *dev) -{ -struct mkiss *ax =netdev_priv (dev); - -return &ax->stats; -} -static const struct header_ops ax_header_ops = { .create = ax_header, .rebuild = ax_rebuild_header,
@@ -683,7 +674,6 @@ static void ax_setup(struct net_device * dev->hard_start_xmit = ax_xmit; dev->open = ax_open_dev; dev->stop = ax_close; - dev->get_stats = ax_get_stats; dev->set_mac_address = ax_set_mac_address; dev->hard_header_len =0 ; dev->addr_len =0 ;
@@ -929,7 +919,7 @@ static void mkiss_receive_buf(struct ttywhile (count--) {if (fp !=NULL && *fp++) {if (!test_and_set_bit (AXF_ERROR , &ax->flags)) - ax->stats.rx_errors++; + ax->dev->stats.rx_errors++; cp++;continue ; }
PATCH 44/45 dmascc: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/hamradio/mkiss.c +8 -4
@@ -667,19 +667,23 @@ static const struct header_ops ax_header .rebuild = ax_rebuild_header, }; +static const struct net_device_ops ax_netdev_ops = { + .ndo_open = ax_open_dev, + .ndo_stop = ax_close, + .ndo_start_xmit = ax_xmit, + .ndo_set_mac_address = ax_set_mac_address, +}; +static void ax_setup (struct net_device *dev) {/* Finish setting up the DEVICE info. */ dev->mtu =AX_MTU ; - dev->hard_start_xmit = ax_xmit; - dev->open = ax_open_dev; - dev->stop = ax_close; - dev->set_mac_address = ax_set_mac_address; dev->hard_header_len =0 ; dev->addr_len =0 ; dev->type =ARPHRD_AX25 ; dev->tx_queue_len =10 ; dev->header_ops = &ax_header_ops; + dev->netdev_ops = &ax_netdev_ops;memcpy (dev->broadcast, &ax25_bcast,AX25_ADDR_LEN );
PATCH 45/45 dmascc: convert to internal net_device_ops
In reply to Stephen Hemmingerdrivers/net/82596.c +12 -5
@@ -1122,6 +1122,17 @@ static void print_eth(unsigned char *addstatic int io =0x300 ;static int irq =10 ; +static const struct net_device_ops i596_netdev_ops = { + .ndo_open = i596_open, + .ndo_stop = i596_close, + .ndo_start_xmit = i596_start_xmit, + .ndo_set_multicast_list = set_multicast_list, + .ndo_tx_timeout = i596_tx_timeout, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +struct net_device *__init i82596_probe (int unit) {struct net_device *dev;
@@ -1232,11 +1243,7 @@ found:DEB (DEB_PROBE ,printk (KERN_INFO "%s" , version));/* The 82596-specific entries in the device structure. */ - dev->open = i596_open; - dev->stop = i596_close; - dev->hard_start_xmit = i596_start_xmit; - dev->set_multicast_list = set_multicast_list; - dev->tx_timeout = i596_tx_timeout; + dev->netdev_ops = &i596_netdev_ops; dev->watchdog_timeo =TX_TIMEOUT ; dev->ml_priv = (void *)(dev->mem_start);
cover Another batch of network device conversions
That's all for this week.
Compile tested on x86 only.
PATCH 10/45 appletalk: remove unneeded stubs
With net_device_ops if set_mac_address is null, then error is -EOPNOTSUPPORTED.
--- net/appletalk/dev.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
net/appletalk/dev.c +4 -6
@@ -9,22 +9,20 @@#include <linux/if_arp.h> #include <linux/if_ltalk.h> +#ifdef CONFIG_COMPAT_NET_DEV_OPS static int ltalk_change_mtu (struct net_device *dev,int mtu) {return -EINVAL ; } - -static int ltalk_mac_addr (struct net_device *dev,void *addr) -{ -return -EINVAL ; -} +#endif static void ltalk_setup (struct net_device *dev) {/* Fill in the fields of the device structure with localtalk-generic values. */ +#ifdef CONFIG_COMPAT_NET_DEV_OPS dev->change_mtu = ltalk_change_mtu; - dev->set_mac_address = ltalk_mac_addr; +#endif dev->type =ARPHRD_LOCALTLK ; dev->hard_header_len =LTALK_HLEN ;
PATCH 11/45 arcnet: convert to internal stats
In reply to Stephen HemmingerUse pre-existing network_device_stats inside network_device rather than own private structure.
--- drivers/net/arcnet/arc-rawmode.c | 2 - drivers/net/arcnet/arcnet.c | 38 +++++++++---------------------- drivers/net/arcnet/capmode.c | 2 - drivers/net/arcnet/rfc1051.c | 12 ++++----- drivers/net/arcnet/rfc1201.c | 47 +++++++++++++++++++-------------------- include/linux/arcdevice.h | 2 - 6 files changed, 42 insertions(+), 61 deletions(-)
drivers/net/arcnet/arc-rawmode.c +1 -1
@@ -102,7 +102,7 @@ static void rx(struct net_device *dev, i skb =alloc_skb (length +ARC_HDR_SIZE ,GFP_ATOMIC );if (skb ==NULL ) {BUGMSG (D_NORMAL ,"Memory squeeze, dropping packet.\n" ); - lp->stats.rx_dropped++; + dev->stats.rx_dropped++;return ; }skb_put (skb, length +ARC_HDR_SIZE );
drivers/net/arcnet/arcnet.c +12 -26
@@ -105,7 +105,6 @@ static int arcnet_header(struct sk_buff unsigned short type, const void *daddr, const void *saddr, unsigned len);static int arcnet_rebuild_header (struct sk_buff *skb); -static struct net_device_stats *arcnet_get_stats (struct net_device *dev);static int go_tx (struct net_device *dev);static int debug =ARCNET_DEBUG ;
@@ -347,7 +346,6 @@ static void arcdev_setup(struct net_devi dev->stop = arcnet_close; dev->hard_start_xmit = arcnet_send_packet; dev->tx_timeout = arcnet_timeout; - dev->get_stats = arcnet_get_stats; }struct net_device *alloc_arcdev (char *name)
@@ -583,8 +581,8 @@ static int arcnet_rebuild_header(struct }else {BUGMSG (D_NORMAL ,"I don't understand ethernet protocol %Xh addresses!\n" , type); - lp->stats.tx_errors++; - lp->stats.tx_aborted_errors++; + dev->stats.tx_errors++; + dev->stats.tx_aborted_errors++; }/* if we couldn't resolve the address... give up. */
@@ -645,7 +643,7 @@ static int arcnet_send_packet(struct sk_ !proto->ack_tx) { /* done right away and we don't want to acknowledge the package later - forget about it now */ - lp->stats.tx_bytes += skb->len; + dev->stats.tx_bytes += skb->len; freeskb = 1; } else {/* do it the 'split' way */
@@ -709,7 +707,7 @@ static int go_tx(struct net_device *dev)/* start sending */ ACOMMAND (TXcmd | (lp->cur_tx <<3 )); - lp->stats.tx_packets++; + dev->stats.tx_packets++; lp->lasttrans_dest = lp->lastload_dest; lp->lastload_dest =0 ; lp->excnak_pending =0 ;
@@ -732,11 +730,11 @@ static void arcnet_timeout(struct net_de msg =" - missed IRQ?" ; }else { msg ="" ; - lp->stats.tx_aborted_errors++; + dev->stats.tx_aborted_errors++; lp->timed_out =1 ;ACOMMAND (NOTXcmd | (lp->cur_tx <<3 )); } - lp->stats.tx_errors++; + dev->stats.tx_errors++;/* make sure we didn't miss a TX or a EXC NAK IRQ */ AINTMASK (0 );
@@ -865,8 +863,8 @@ irqreturn_t arcnet_interrupt(int irq, vo"transmit was not acknowledged! " "(status=%Xh, dest=%02Xh)\n" , status, lp->lasttrans_dest); - lp->stats.tx_errors++; - lp->stats.tx_carrier_errors++; + dev->stats.tx_errors++; + dev->stats.tx_carrier_errors++; }else {BUGMSG (D_DURING , "broadcast was not acknowledged; that's normal "
@@ -905,7 +903,7 @@ irqreturn_t arcnet_interrupt(int irq, voif (txbuf !=-1 ) {if (lp->outgoing.proto->continue_tx (dev, txbuf)) {/* that was the last segment */ - lp->stats.tx_bytes += lp->outgoing.skb->len; + dev->stats.tx_bytes += lp->outgoing.skb->len;if (!lp->outgoing.proto->ack_tx) {dev_kfree_skb_irq (lp->outgoing.skb);
@@ -930,7 +928,7 @@ irqreturn_t arcnet_interrupt(int irq, vo }if (status & lp->intmask & RECONflag) {ACOMMAND (CFLAGScmd | CONFIGclear); - lp->stats.tx_carrier_errors++; + dev->stats.tx_carrier_errors++;BUGMSG (D_RECON ,"Network reconfiguration detected (status=%Xh)\n" , status);
@@ -1038,8 +1036,8 @@ static void arcnet_rx(struct net_device"(%d+4 bytes)\n" , bufnum, pkt.hard.source, pkt.hard.dest, length); - lp->stats.rx_packets++; - lp->stats.rx_bytes += length +ARC_HDR_SIZE ; + dev->stats.rx_packets++; + dev->stats.rx_bytes += length +ARC_HDR_SIZE ;/* call the right receiver for the protocol */ if (arc_proto_map[soft->proto]->is_ip) {
@@ -1067,18 +1065,6 @@ static void arcnet_rx(struct net_device } - -/* -* Get the current statistics. This may be called with the card open or -* closed. -*/ -static struct net_device_stats *arcnet_get_stats (struct net_device *dev) -{ -struct arcnet_local *lp =netdev_priv (dev); -return &lp->stats; -} - -static void null_rx (struct net_device *dev,int bufnum,struct archdr *pkthdr,int length) {
drivers/net/arcnet/capmode.c +1 -1
@@ -119,7 +119,7 @@ static void rx(struct net_device *dev, i skb =alloc_skb (length +ARC_HDR_SIZE +sizeof (int ),GFP_ATOMIC );if (skb ==NULL ) {BUGMSG (D_NORMAL ,"Memory squeeze, dropping packet.\n" ); - lp->stats.rx_dropped++; + dev->stats.rx_dropped++;return ; }skb_put (skb, length +ARC_HDR_SIZE +sizeof (int ));
drivers/net/arcnet/rfc1051.c +5 -7
@@ -88,7 +88,6 @@ MODULE_LICENSE("GPL");*/ static __be16 type_trans (struct sk_buff *skb,struct net_device *dev) { -struct arcnet_local *lp =netdev_priv (dev);struct archdr *pkt = (struct archdr *) skb->data;struct arc_rfc1051 *soft = &pkt->soft.rfc1051;int hdr_size =ARC_HDR_SIZE +RFC1051_HDR_SIZE ;
@@ -112,8 +111,8 @@ static __be16 type_trans(struct sk_buffreturn htons (ETH_P_ARP );default : - lp->stats.rx_errors++; - lp->stats.rx_crc_errors++; + dev->stats.rx_errors++; + dev->stats.rx_crc_errors++;return 0 ; }
@@ -140,7 +139,7 @@ static void rx(struct net_device *dev, i skb =alloc_skb (length +ARC_HDR_SIZE ,GFP_ATOMIC );if (skb ==NULL ) {BUGMSG (D_NORMAL ,"Memory squeeze, dropping packet.\n" ); - lp->stats.rx_dropped++; + dev->stats.rx_dropped++;return ; }skb_put (skb, length +ARC_HDR_SIZE );
@@ -168,7 +167,6 @@ static void rx(struct net_device *dev, istatic int build_header (struct sk_buff *skb,struct net_device *dev,unsigned short type,uint8_t daddr) { -struct arcnet_local *lp =netdev_priv (dev);int hdr_size =ARC_HDR_SIZE +RFC1051_HDR_SIZE ;struct archdr *pkt = (struct archdr *)skb_push (skb, hdr_size);struct arc_rfc1051 *soft = &pkt->soft.rfc1051;
@@ -184,8 +182,8 @@ static int build_header(struct sk_buff *default :BUGMSG (D_NORMAL ,"RFC1051: I don't understand protocol %d (%Xh)\n" , type, type); - lp->stats.tx_errors++; - lp->stats.tx_aborted_errors++; + dev->stats.tx_errors++; + dev->stats.tx_aborted_errors++;return 0 ; }
drivers/net/arcnet/rfc1201.c +23 -24
131 lines not on this page · raw message
include/linux/arcdevice.h +0 -2
@@ -235,8 +235,6 @@ struct Outgoing {struct arcnet_local { -struct net_device_stats stats; -uint8_t config,/* current value of CONFIG register */ timeout,/* Extended timeout for COM20020 */ backplane, /* Backplane flag for COM20020 */
PATCH 12/45 arcnet: convert to net_device_ops
In reply to Stephen Hemminger--- drivers/net/arcnet/arcnet.c | 33 ++++++++++++++++----------------- include/linux/arcdevice.h | 7 ++++++- 2 files changed, 22 insertions(+), 18 deletions(-)
drivers/net/arcnet/arcnet.c +16 -17
@@ -95,12 +95,12 @@ EXPORT_SYMBOL(arcnet_unregister_proto);EXPORT_SYMBOL (arcnet_debug);EXPORT_SYMBOL (alloc_arcdev);EXPORT_SYMBOL (arcnet_interrupt); +EXPORT_SYMBOL (arcnet_open); +EXPORT_SYMBOL (arcnet_close); +EXPORT_SYMBOL (arcnet_send_packet); +EXPORT_SYMBOL (arcnet_timeout);/* Internal function prototypes */ -static int arcnet_open (struct net_device *dev); -static int arcnet_close (struct net_device *dev); -static int arcnet_send_packet (struct sk_buff *skb,struct net_device *dev); -static void arcnet_timeout (struct net_device *dev);static int arcnet_header (struct sk_buff *skb,struct net_device *dev,unsigned short type,const void *daddr,const void *saddr,unsigned len);
@@ -321,11 +321,18 @@ static const struct header_ops arcnet_he .rebuild = arcnet_rebuild_header, }; +static const struct net_device_ops arcnet_netdev_ops = { + .ndo_open = arcnet_open, + .ndo_stop = arcnet_close, + .ndo_start_xmit = arcnet_send_packet, + .ndo_tx_timeout = arcnet_timeout, +};/* Setup a struct device for ARCnet. */ static void arcdev_setup (struct net_device *dev) { dev->type =ARPHRD_ARCNET ; + dev->netdev_ops = &arcnet_netdev_ops; dev->header_ops = &arcnet_header_ops; dev->hard_header_len =sizeof (struct archdr ); dev->mtu =choose_mtu ();
@@ -338,17 +345,9 @@ static void arcdev_setup(struct net_devi/* New-style flags. */ dev->flags =IFF_BROADCAST ; -/* -* Put in this stuff here, so we don't have to export the symbols to -* the chipset drivers. -*/ - dev->open = arcnet_open; - dev->stop = arcnet_close; - dev->hard_start_xmit = arcnet_send_packet; - dev->tx_timeout = arcnet_timeout; } -struct net_device *alloc_arcdev (char *name) +struct net_device *alloc_arcdev (const char *name) {struct net_device *dev;
@@ -370,7 +369,7 @@ struct net_device *alloc_arcdev(char *na* that "should" only need to be set once at boot, so that there is * non-reboot way to recover if something goes wrong. */ -static int arcnet_open (struct net_device *dev) +int arcnet_open (struct net_device *dev) {struct arcnet_local *lp =netdev_priv (dev);int count, newmtu, error;
@@ -470,7 +469,7 @@ static int arcnet_open(struct net_device/* The inverse routine to arcnet_open - shuts down the card. */ -static int arcnet_close (struct net_device *dev) +int arcnet_close (struct net_device *dev) {struct arcnet_local *lp =netdev_priv (dev);
@@ -599,7 +598,7 @@ static int arcnet_rebuild_header(struct/* Called by the kernel in order to transmit a packet. */ -static int arcnet_send_packet (struct sk_buff *skb,struct net_device *dev) +int arcnet_send_packet (struct sk_buff *skb,struct net_device *dev) {struct arcnet_local *lp =netdev_priv (dev);struct archdr *pkt;
@@ -718,7 +717,7 @@ static int go_tx(struct net_device *dev)/* Called by the kernel when transmit times out */ -static void arcnet_timeout (struct net_device *dev) +void arcnet_timeout (struct net_device *dev) {unsigned long flags;struct arcnet_local *lp =netdev_priv (dev);
include/linux/arcdevice.h +6 -1
@@ -333,7 +333,12 @@ void arcnet_dump_skb(struct net_device *void arcnet_unregister_proto (struct ArcProto *proto);irqreturn_t arcnet_interrupt (int irq,void *dev_id); -struct net_device *alloc_arcdev (char *name); +struct net_device *alloc_arcdev (const char *name); + +int arcnet_open (struct net_device *dev); +int arcnet_close (struct net_device *dev); +int arcnet_send_packet (struct sk_buff *skb,struct net_device *dev); +void arcnet_timeout (struct net_device *dev);#endif /* __KERNEL__ */ #endif /* _LINUX_ARCDEVICE_H */
PATCH 13/45 com20020: convert to net_devic_ops
In reply to Stephen Hemminger--- drivers/net/arcnet/com20020-isa.c | 2 ++ drivers/net/arcnet/com20020-pci.c | 3 +++ drivers/net/arcnet/com20020.c | 10 ++++++++-- include/linux/com20020.h | 1 + 4 files changed, 14 insertions(+), 2 deletions(-)
drivers/net/arcnet/com20020-isa.c +2 -0
@@ -151,6 +151,8 @@ static int __init com20020_init(void)if (node && node !=0xff ) dev->dev_addr[0 ] = node; + dev->netdev_ops = &com20020_netdev_ops; + lp =netdev_priv (dev); lp->backplane = backplane; lp->clockp = clockp &7 ;
drivers/net/arcnet/com20020-pci.c +3 -0
@@ -72,6 +72,9 @@ static int __devinit com20020pci_probe(s dev =alloc_arcdev (device);if (!dev)return -ENOMEM ; + + dev->netdev_ops = &com20020_netdev_ops; + lp =netdev_priv (dev);pci_set_drvdata (pdev, dev);
drivers/net/arcnet/com20020.c +8 -2
@@ -149,6 +149,14 @@ int com20020_check(struct net_device *dereturn 0 ; } +const struct net_device_ops com20020_netdev_ops = { + .ndo_open = arcnet_open, + .ndo_stop = arcnet_close, + .ndo_start_xmit = arcnet_send_packet, + .ndo_tx_timeout = arcnet_timeout, + .ndo_set_multicast_list = com20020_set_mc_list, +}; +/* Set up the struct net_device associated with this card. Called after * probing succeeds. */
@@ -170,8 +178,6 @@ int com20020_found(struct net_device *de lp->hw.copy_from_card = com20020_copy_from_card; lp->hw.close = com20020_close; - dev->set_multicast_list = com20020_set_mc_list; -if (!dev->dev_addr[0 ]) dev->dev_addr[0 ] =inb (ioaddr +BUS_ALIGN *8 );/* FIXME: do this some other way! */
include/linux/com20020.h +1 -0
@@ -29,6 +29,7 @@int com20020_check (struct net_device *dev);int com20020_found (struct net_device *dev,int shared); +const struct net_device_ops com20020_netdev_ops;/* The number of low I/O ports used by the card. */ #define ARCNET_TOTAL_SIZE 8
PATCH 14/45 3c501: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/3c501.c +12 -5
@@ -197,6 +197,17 @@ out:return ERR_PTR (err); } +static const struct net_device_ops el_netdev_ops = { + .ndo_open = el_open, + .ndo_stop = el1_close, + .ndo_start_xmit = el_start_xmit, + .ndo_tx_timeout = el_timeout, + .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, +}; +/** * el1_probe1: * @dev: The device structure to use
@@ -305,12 +316,8 @@ static int __init el1_probe1(struct net_* The EL1-specific entries in the device structure. */ - dev->open = &el_open; - dev->hard_start_xmit = &el_start_xmit; - dev->tx_timeout = &el_timeout; + dev->netdev_ops = &el_netdev_ops; dev->watchdog_timeo =HZ ; - dev->stop = &el1_close; - dev->set_multicast_list = &set_multicast_list; dev->ethtool_ops = &netdev_ethtool_ops;return 0 ; }
PATCH 16/45 3c507: convert to net_device_ops
In reply to Stephen Hemminger--- drivers/net/3c507.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/net/3c507.c +11 -4
@@ -352,6 +352,16 @@ out:return ERR_PTR (err); } +static const struct net_device_ops netdev_ops = { + .ndo_open = el16_open, + .ndo_stop = el16_close, + .ndo_start_xmit = el16_send_packet, + .ndo_tx_timeout = el16_tx_timeout, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +static int __init el16_probe1 (struct net_device *dev,int ioaddr) {static unsigned char init_ID_done, version_printed;
@@ -449,10 +459,7 @@ static int __init el16_probe1(struct net goto out1; } - dev->open = el16_open; - dev->stop = el16_close; - dev->hard_start_xmit = el16_send_packet; - dev->tx_timeout = el16_tx_timeout; + dev->netdev_ops = &netdev_ops; dev->watchdog_timeo =TX_TIMEOUT ; dev->ethtool_ops = &netdev_ethtool_ops; dev->flags &= ~IFF_MULTICAST ;/* Multicast doesn't work */
PATCH 17/45 3c509: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/3c509.c +16 -9
@@ -537,6 +537,21 @@ static struct mca_driver el3_mca_driverstatic int mca_registered;#endif /* CONFIG_MCA */ +static const struct net_device_ops netdev_ops = { + .ndo_open = el3_open, + .ndo_stop = el3_close, + .ndo_start_xmit = el3_start_xmit, + .ndo_get_stats = el3_get_stats, + .ndo_set_multicast_list = set_multicast_list, + .ndo_tx_timeout = el3_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 = el3_poll_controller, +#endif +}; +static int __devinit el3_common_init (struct net_device *dev) {struct el3_private *lp =netdev_priv (dev);
@@ -553,16 +568,8 @@ static int __devinit el3_common_init(str }/* The EL3-specific entries in the device structure. */ - dev->open = &el3_open; - dev->hard_start_xmit = &el3_start_xmit; - dev->stop = &el3_close; - dev->get_stats = &el3_get_stats; - dev->set_multicast_list = &set_multicast_list; - dev->tx_timeout = el3_tx_timeout; + dev->netdev_ops = &netdev_ops; dev->watchdog_timeo =TX_TIMEOUT ; -#ifdef CONFIG_NET_POLL_CONTROLLER - dev->poll_controller = el3_poll_controller; -#endif SET_ETHTOOL_OPS (dev, ðtool_ops); err =register_netdev (dev);
PATCH 18/45 3c515: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/3c515.c +15 -6
@@ -563,6 +563,20 @@ no_pnp:return NULL ; } + +static const struct net_device_ops netdev_ops = { + .ndo_open = corkscrew_open, + .ndo_stop = corkscrew_close, + .ndo_start_xmit = corkscrew_start_xmit, + .ndo_tx_timeout = corkscrew_timeout, + .ndo_get_stats = corkscrew_get_stats, + .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 corkscrew_setup (struct net_device *dev,int ioaddr,struct pnp_dev *idev,int card_number) {
@@ -681,13 +695,8 @@ static int corkscrew_setup(struct net_de vp->full_bus_master_rx = (vp->capabilities &0x20 ) ?1 :0 ;/* The 3c51x-specific entries in the device structure. */ - dev->open = &corkscrew_open; - dev->hard_start_xmit = &corkscrew_start_xmit; - dev->tx_timeout = &corkscrew_timeout; + dev->netdev_ops = &netdev_ops; dev->watchdog_timeo = (400 *HZ ) /1000 ; - dev->stop = &corkscrew_close; - dev->get_stats = &corkscrew_get_stats; - dev->set_multicast_list = &set_rx_mode; dev->ethtool_ops = &netdev_ethtool_ops;return register_netdev (dev);
PATCH 19/45 3c523: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/3c523.c +15 -10
@@ -403,6 +403,20 @@ static int elmc_getinfo(char *buf, int sreturn len; }/* elmc_getinfo() */ +static const struct net_device_ops netdev_ops = { + .ndo_open = elmc_open, + .ndo_stop = elmc_close, + .ndo_get_stats = elmc_get_stats, + .ndo_start_xmit = elmc_send_packet, + .ndo_tx_timeout = elmc_timeout, +#ifdef ELMC_MULTICAST + .ndo_set_multicast_list = set_multicast_list, +#endif + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +/*****************************************************************/ static int __init do_elmc_probe (struct net_device *dev)
@@ -544,17 +558,8 @@ static int __init do_elmc_probe(struct nprintk (KERN_INFO "%s: hardware address %pM\n" , dev->name, dev->dev_addr); - dev->open = &elmc_open; - dev->stop = &elmc_close; - dev->get_stats = &elmc_get_stats; - dev->hard_start_xmit = &elmc_send_packet; - dev->tx_timeout = &elmc_timeout; + dev->netdev_ops = &netdev_ops; dev->watchdog_timeo =HZ ; -#ifdef ELMC_MULTICAST - dev->set_multicast_list = &set_multicast_list; -#else - dev->set_multicast_list =NULL ; -#endif dev->ethtool_ops = &netdev_ethtool_ops;/* note that we haven't actually requested the IRQ from the kernel.
PATCH 20/45 3c527: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/3c527.c +13 -6
@@ -288,6 +288,18 @@ struct net_device *__init mc32_probe(intreturn ERR_PTR (-ENODEV ); } +static const struct net_device_ops netdev_ops = { + .ndo_open = mc32_open, + .ndo_stop = mc32_close, + .ndo_start_xmit = mc32_send_packet, + .ndo_get_stats = mc32_get_stats, + .ndo_set_multicast_list = mc32_set_multicast_list, + .ndo_tx_timeout = mc32_timeout, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +/** * mc32_probe1 - Check a given slot for a board and test the card * @dev: Device structure to fill in
@@ -518,12 +530,7 @@ static int __init mc32_probe1(struct netprintk ("%s: Firmware Rev %d. %d RX buffers, %d TX buffers. Base of 0x%08X.\n" , dev->name, lp->exec_box->data[12 ], lp->rx_len, lp->tx_len, lp->base); - dev->open = mc32_open; - dev->stop = mc32_close; - dev->hard_start_xmit = mc32_send_packet; - dev->get_stats = mc32_get_stats; - dev->set_multicast_list = mc32_set_multicast_list; - dev->tx_timeout = mc32_timeout; + dev->netdev_ops = &netdev_ops; dev->watchdog_timeo =HZ *5 ;/* Board does all the work */ dev->ethtool_ops = &netdev_ethtool_ops;
PATCH 23/45 ibmtr: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/tokenring/ibmtr.c +9 -5
@@ -815,17 +815,21 @@ static unsigned char __devinit get_sram_/*****************************************************************************/ +static const struct net_device_ops trdev_netdev_ops = { + .ndo_open = tok_open, + .ndo_stop = tok_close, + .ndo_start_xmit = tok_send_packet, + .ndo_set_multicast_list = tok_set_multicast_list, + .ndo_change_mtu = ibmtr_change_mtu, +}; +static int __devinit trdev_init (struct net_device *dev) {struct tok_info *ti =netdev_priv (dev);SET_PAGE (ti->srb_page); ti->open_failure =NO ; - dev->open = tok_open; - dev->stop = tok_close; - dev->hard_start_xmit = tok_send_packet; - dev->set_multicast_list = tok_set_multicast_list; - dev->change_mtu = ibmtr_change_mtu; + dev->netdev_ops = &trdev_netdev_ops;return 0 ; }
PATCH 22/45 ibmtr: convert to internal network_device_stats
In reply to Stephen Hemminger--- drivers/net/tokenring/ibmtr.c | 29 ++++++----------------------- include/linux/ibmtr.h | 2 +- 2 files changed, 7 insertions(+), 24 deletions(-)
drivers/net/tokenring/ibmtr.c +6 -23
@@ -200,7 +200,6 @@ static void tr_rx(struct net_device *destatic void ibmtr_reset_timer (struct timer_list *tmr,struct net_device *dev);static void tok_rerun (unsigned long dev_addr);static void ibmtr_readlog (struct net_device *dev); -static struct net_device_stats *tok_get_stats (struct net_device *dev);static int ibmtr_change_mtu (struct net_device *dev,int mtu);static void find_turbo_adapters (int *iolist);
@@ -825,7 +824,6 @@ static int __devinit trdev_init(struct n dev->open = tok_open; dev->stop = tok_close; dev->hard_start_xmit = tok_send_packet; - dev->get_stats = tok_get_stats; dev->set_multicast_list = tok_set_multicast_list; dev->change_mtu = ibmtr_change_mtu;
@@ -1460,7 +1458,7 @@ static irqreturn_t tok_interrupt(int irq"%02X\n" , (int)retcode, (int)readb(ti->ssb + 6)); else - ti->tr_stats.tx_packets++; + dev->stats.tx_packets++;break ;case XMIT_XID_CMD : DPRINTK("xmit xid ret_code: %02X\n",
@@ -1646,7 +1644,7 @@ static void tr_tx(struct net_device *devbreak ; }writeb (RESP_IN_ASB , ti->mmio +ACA_OFFSET +ACA_SET +ISRA_ODD ); - ti->tr_stats.tx_bytes += ti->current_skb->len; + dev->stats.tx_bytes += ti->current_skb->len;dev_kfree_skb_irq (ti->current_skb); ti->current_skb =NULL ;netif_wake_queue (dev);
@@ -1722,7 +1720,7 @@ static void tr_rx(struct net_device *devif (readb (llc + offsetof(struct trllc , llc)) !=UI_CMD ) {SET_PAGE (ti->asb_page);writeb (DATA_LOST , ti->asb +RETCODE_OFST ); - ti->tr_stats.rx_dropped++; + dev->stats.rx_dropped++;writeb (RESP_IN_ASB , ti->mmio +ACA_OFFSET +ACA_SET +ISRA_ODD );return ; }
@@ -1757,7 +1755,7 @@ static void tr_rx(struct net_device *devif (!(skb =dev_alloc_skb (skb_size))) {DPRINTK ("out of memory. frame dropped.\n" ); - ti->tr_stats.rx_dropped++; + dev->stats.rx_dropped++;SET_PAGE (ti->asb_page);writeb (DATA_LOST , ti->asb + offsetof(struct asb_rec , ret_code));writeb (RESP_IN_ASB , ti->mmio +ACA_OFFSET +ACA_SET +ISRA_ODD );
@@ -1813,8 +1811,8 @@ static void tr_rx(struct net_device *devwriteb (RESP_IN_ASB , ti->mmio +ACA_OFFSET +ACA_SET +ISRA_ODD ); - ti->tr_stats.rx_bytes += skb->len; - ti->tr_stats.rx_packets++; + dev->stats.rx_bytes += skb->len; + dev->stats.rx_packets++; skb->protocol =tr_type_trans (skb, dev);if (IPv4_p) {
@@ -1876,21 +1874,6 @@ static void ibmtr_readlog(struct net_dev/*****************************************************************************/ -/* tok_get_stats(): Basically a scaffold routine which will return -the address of the tr_statistics structure associated with -this device -- the tr.... structure is an ethnet look-alike -so at least for this iteration may suffice. */ - -static struct net_device_stats *tok_get_stats (struct net_device *dev) -{ - -struct tok_info *toki; - toki =netdev_priv (dev); -return (struct net_device_stats *) &toki->tr_stats; -} - -/*****************************************************************************/ -static int ibmtr_change_mtu (struct net_device *dev,int mtu) {struct tok_info *ti =netdev_priv (dev);
include/linux/ibmtr.h +1 -1
@@ -207,7 +207,7 @@ struct tok_info {unsigned short exsap_station_id;unsigned short global_int_enable;struct sk_buff *current_skb; -struct net_device_stats tr_stats; +unsigned char auto_speedsave;open_state open_status, sap_status;enum {MANUAL ,AUTOMATIC } open_mode;
PATCH 24/45 lanstreamer: convert to internal network stats
In reply to Stephen HemmingerUse internal network_device_stats to keep track of statistics.
--- drivers/net/tokenring/lanstreamer.c | 17 +++++------------ drivers/net/tokenring/lanstreamer.h | 1 - 2 files changed, 5 insertions(+), 13 deletions(-)
drivers/net/tokenring/lanstreamer.c +5 -14
@@ -207,7 +207,6 @@ static int streamer_xmit(struct sk_buffstatic int streamer_close (struct net_device *dev);static void streamer_set_rx_mode (struct net_device *dev);static irqreturn_t streamer_interrupt (int irq,void *dev_id); -static struct net_device_stats *streamer_get_stats (struct net_device *dev);static int streamer_set_mac_address (struct net_device *dev,void *addr);static void streamer_arb_cmd (struct net_device *dev);static int streamer_change_mtu (struct net_device *dev,int mtu);
@@ -331,7 +330,6 @@ static int __devinit streamer_init_one(s dev->do_ioctl =NULL ;#endif dev->set_multicast_list = &streamer_set_rx_mode; - dev->get_stats = &streamer_get_stats; dev->set_mac_address = &streamer_set_mac_address; dev->irq = pdev->irq; dev->base_addr=pio_start;
@@ -937,7 +935,7 @@ static void streamer_rx(struct net_devicif (skb ==NULL ) {printk (KERN_WARNING "%s: Not enough memory to copy packet to upper layers. \n" , dev->name); - streamer_priv->streamer_stats.rx_dropped++; + dev->stats.rx_dropped++; }else {/* we allocated an skb OK */ if (buffer_cnt ==1 ) {/* release the DMA mapping */
@@ -1009,8 +1007,8 @@ static void streamer_rx(struct net_devic/* send up to the protocol */ netif_rx (skb); } - streamer_priv->streamer_stats.rx_packets++; - streamer_priv->streamer_stats.rx_bytes += length; + dev->stats.rx_packets++; + dev->stats.rx_bytes += length; }/* if skb == null */ }/* end received without errors */
@@ -1053,8 +1051,8 @@ static irqreturn_t streamer_interrupt(inwhile (streamer_priv->streamer_tx_ring[(streamer_priv->tx_ring_last_status +1 ) & (STREAMER_TX_RING_SIZE -1 )].status) { streamer_priv->tx_ring_last_status = (streamer_priv->tx_ring_last_status +1 ) & (STREAMER_TX_RING_SIZE -1 ); streamer_priv->free_tx_ring_entries++; - streamer_priv->streamer_stats.tx_bytes += streamer_priv->tx_ring_skb[streamer_priv->tx_ring_last_status]->len; - streamer_priv->streamer_stats.tx_packets++; + dev->stats.tx_bytes += streamer_priv->tx_ring_skb[streamer_priv->tx_ring_last_status]->len; + dev->stats.tx_packets++;dev_kfree_skb_irq (streamer_priv->tx_ring_skb[streamer_priv->tx_ring_last_status]); streamer_priv->streamer_tx_ring[streamer_priv->tx_ring_last_status].buffer =0xdeadbeef ; streamer_priv->streamer_tx_ring[streamer_priv->tx_ring_last_status].status =0 ;
@@ -1484,13 +1482,6 @@ static void streamer_srb_bh(struct net_d }/* switch srb[0] */ } -static struct net_device_stats *streamer_get_stats (struct net_device *dev) -{ -struct streamer_private *streamer_priv; - streamer_priv =netdev_priv (dev); -return (struct net_device_stats *) &streamer_priv->streamer_stats; -} -static int streamer_set_mac_address (struct net_device *dev,void *addr) {struct sockaddr *saddr = addr;
drivers/net/tokenring/lanstreamer.h +0 -1
@@ -299,7 +299,6 @@ struct streamer_private {int tx_ring_free, tx_ring_last_status, rx_ring_last_received, free_tx_ring_entries; -struct net_device_stats streamer_stats;__u16 streamer_lan_status;__u8 streamer_ring_speed;__u16 pkt_buf_sz;
PATCH 25/45 lanstreamer: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/tokenring/lanstreamer.c +13 -11
@@ -221,6 +221,18 @@ struct streamer_private *dev_streamer=NU#endif #endif +static const struct net_device_ops streamer_netdev_ops = { + .ndo_open = streamer_open, + .ndo_stop = streamer_close, + .ndo_start_xmit = streamer_xmit, + .ndo_change_mtu = streamer_change_mtu, +#if STREAMER_IOCTL + .ndo_do_ioctl = streamer_ioctl, +#endif + .ndo_set_multicast_list = streamer_set_rx_mode, + .ndo_set_mac_address = streamer_set_mac_address, +}; +static int __devinit streamer_init_one (struct pci_dev *pdev,const struct pci_device_id *ent) {
@@ -320,17 +332,7 @@ static int __devinit streamer_init_one(sinit_waitqueue_head (&streamer_priv->srb_wait);init_waitqueue_head (&streamer_priv->trb_wait); - dev->open = &streamer_open; - dev->hard_start_xmit = &streamer_xmit; - dev->change_mtu = &streamer_change_mtu; - dev->stop = &streamer_close; -#if STREAMER_IOCTL - dev->do_ioctl = &streamer_ioctl; -#else - dev->do_ioctl =NULL ; -#endif - dev->set_multicast_list = &streamer_set_rx_mode; - dev->set_mac_address = &streamer_set_mac_address; + dev->netdev_ops = &streamer_netdev_ops; dev->irq = pdev->irq; dev->base_addr=pio_start;SET_NETDEV_DEV (dev, &pdev->dev);
PATCH 26/45 olympic: convert to internal network device stats
In reply to Stephen Hemminger--- drivers/net/tokenring/olympic.c | 21 ++++++--------------- drivers/net/tokenring/olympic.h | 1 - 2 files changed, 6 insertions(+), 16 deletions(-)
drivers/net/tokenring/olympic.c +6 -15
@@ -187,7 +187,6 @@ static int olympic_close(struct net_devistatic void olympic_set_rx_mode (struct net_device *dev);static void olympic_freemem (struct net_device *dev) ;static irqreturn_t olympic_interrupt (int irq,void *dev_id); -static struct net_device_stats *olympic_get_stats (struct net_device *dev);static int olympic_set_mac_address (struct net_device *dev,void *addr) ;static void olympic_arb_cmd (struct net_device *dev);static int olympic_change_mtu (struct net_device *dev,int mtu);
@@ -259,7 +258,6 @@ static int __devinit olympic_probe(struc dev->stop=&olympic_close; dev->do_ioctl=NULL ; dev->set_multicast_list=&olympic_set_rx_mode; - dev->get_stats=&olympic_get_stats ; dev->set_mac_address=&olympic_set_mac_address ;SET_NETDEV_DEV (dev, &pdev->dev);
@@ -785,7 +783,7 @@ static void olympic_rx(struct net_device } olympic_priv->rx_ring_last_received += i ; olympic_priv->rx_ring_last_received &= (OLYMPIC_RX_RING_SIZE -1 ) ; - olympic_priv->olympic_stats.rx_errors++; + dev->stats.rx_errors++; }else {if (buffer_cnt ==1 ) {
@@ -796,7 +794,7 @@ static void olympic_rx(struct net_deviceif (skb ==NULL ) {printk (KERN_WARNING "%s: Not enough memory to copy packet to upper layers. \n" ,dev->name) ; - olympic_priv->olympic_stats.rx_dropped++ ; + dev->stats.rx_dropped++;/* Update counters even though we don't transfer the frame */ olympic_priv->rx_ring_last_received += i ; olympic_priv->rx_ring_last_received &= (OLYMPIC_RX_RING_SIZE -1 ) ;
@@ -862,8 +860,8 @@ static void olympic_rx(struct net_device skb->protocol =tr_type_trans (skb,dev);netif_rx (skb) ; } - olympic_priv->olympic_stats.rx_packets++ ; - olympic_priv->olympic_stats.rx_bytes += length ; + dev->stats.rx_packets++ ; + dev->stats.rx_bytes += length ; }/* if skb == null */ }/* If status & 0x3b */
@@ -971,8 +969,8 @@ static irqreturn_t olympic_interrupt(int olympic_priv->tx_ring_last_status++; olympic_priv->tx_ring_last_status &= (OLYMPIC_TX_RING_SIZE -1 ); olympic_priv->free_tx_ring_entries++; - olympic_priv->olympic_stats.tx_bytes += olympic_priv->tx_ring_skb[olympic_priv->tx_ring_last_status]->len; - olympic_priv->olympic_stats.tx_packets++ ; + dev->stats.tx_bytes += olympic_priv->tx_ring_skb[olympic_priv->tx_ring_last_status]->len; + dev->stats.tx_packets++ ;pci_unmap_single (olympic_priv->pdev,le32_to_cpu (olympic_priv->olympic_tx_ring[olympic_priv->tx_ring_last_status].buffer), olympic_priv->tx_ring_skb[olympic_priv->tx_ring_last_status]->len,PCI_DMA_TODEVICE );
@@ -1344,13 +1342,6 @@ static void olympic_srb_bh(struct net_de } -static struct net_device_stats *olympic_get_stats (struct net_device *dev) -{ -struct olympic_private *olympic_priv ; - olympic_priv=netdev_priv (dev); -return (struct net_device_stats *) &olympic_priv->olympic_stats; -} -static int olympic_set_mac_address (struct net_device *dev,void *addr) {struct sockaddr *saddr = addr ;
drivers/net/tokenring/olympic.h +0 -1
@@ -275,7 +275,6 @@ struct olympic_private {struct sk_buff *tx_ring_skb[OLYMPIC_TX_RING_SIZE ], *rx_ring_skb[OLYMPIC_RX_RING_SIZE ];int tx_ring_free, tx_ring_last_status, rx_ring_last_received,rx_status_last_received, free_tx_ring_entries; -struct net_device_stats olympic_stats ;u16 olympic_lan_status ;u8 olympic_ring_speed ;u16 pkt_buf_sz ;
PATCH 27/45 olympic: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/tokenring/olympic.c +10 -7
@@ -194,6 +194,15 @@ static void olympic_srb_bh(struct net_destatic void olympic_asb_bh (struct net_device *dev) ;static int olympic_proc_info (char *buffer,char **start,off_t offset,int length,int *eof,void *data) ; +static const struct net_device_ops olympic_netdev_ops = { + .ndo_open = olympic_open, + .ndo_stop = olympic_close, + .ndo_start_xmit = olympic_xmit, + .ndo_change_mtu = olympic_change_mtu, + .ndo_set_multicast_list = olympic_set_rx_mode, + .ndo_set_mac_address = olympic_set_mac_address, +}; +static int __devinit olympic_probe (struct pci_dev *pdev,const struct pci_device_id *ent) {struct net_device *dev ;
@@ -252,13 +261,7 @@ static int __devinit olympic_probe(struc goto op_free_iomap; } - dev->open=&olympic_open; - dev->hard_start_xmit=&olympic_xmit; - dev->change_mtu=&olympic_change_mtu; - dev->stop=&olympic_close; - dev->do_ioctl=NULL ; - dev->set_multicast_list=&olympic_set_rx_mode; - dev->set_mac_address=&olympic_set_mac_address ; + dev->netdev_ops = &olympic_netdev_ops;SET_NETDEV_DEV (dev, &pdev->dev);pci_set_drvdata (pdev,dev) ;
PATCH 28/45 tms380tr: convert to net_device_ops
In reply to Stephen HemmingerConver this related group of drivers to new API
--- drivers/net/tokenring/abyss.c | 9 +++++++-- drivers/net/tokenring/tms380tr.c | 21 ++++++++++++--------- drivers/net/tokenring/tms380tr.h | 1 + drivers/net/tokenring/tmspci.c | 4 ++-- 4 files changed, 22 insertions(+), 13 deletions(-)
drivers/net/tokenring/tms380tr.c +12 -9
@@ -2330,6 +2330,17 @@ void tmsdev_term(struct net_device *dev) DMA_BIDIRECTIONAL); } +const struct net_device_ops tms380tr_netdev_ops = { + .ndo_open = tms380tr_open, + .ndo_stop = tms380tr_close, + .ndo_start_xmit = tms380tr_send_packet, + .ndo_tx_timeout = tms380tr_timeout, + .ndo_get_stats = tms380tr_get_stats, + .ndo_set_multicast_list = tms380tr_set_multicast_list, + .ndo_set_mac_address = tms380tr_set_mac_address, +}; +EXPORT_SYMBOL (tms380tr_netdev_ops); +int tmsdev_init (struct net_device *dev,struct device *pdev) {struct net_local *tms_local;
@@ -2353,16 +2364,8 @@ int tmsdev_init(struct net_device *dev,return -ENOMEM ; } -/* These can be overridden by the card driver if needed */ - dev->open = tms380tr_open; - dev->stop = tms380tr_close; - dev->do_ioctl =NULL ; - dev->hard_start_xmit = tms380tr_send_packet; - dev->tx_timeout = tms380tr_timeout; + dev->netdev_ops = &tms380tr_netdev_ops; dev->watchdog_timeo =HZ ; - dev->get_stats = tms380tr_get_stats; - dev->set_multicast_list = &tms380tr_set_multicast_list; - dev->set_mac_address = tms380tr_set_mac_address;return 0 ; }
drivers/net/tokenring/abyss.c +8 -2
@@ -92,6 +92,8 @@ static void abyss_sifwritew(struct net_doutw (val, dev->base_addr + reg); } +static struct net_device_ops abyss_netdev_ops; +static int __devinit abyss_attach (struct pci_dev *pdev,const struct pci_device_id *ent) {static int versionprinted;
@@ -157,8 +159,7 @@ static int __devinit abyss_attach(structmemcpy (tp->ProductID,"Madge PCI 16/4 Mk2" ,PROD_ID_SIZE +1 ); - dev->open = abyss_open; - dev->stop = abyss_close; + dev->netdev_ops = &abyss_netdev_ops;pci_set_drvdata (pdev, dev);SET_NETDEV_DEV (dev, &pdev->dev);
@@ -450,6 +451,11 @@ static struct pci_driver abyss_driver =static int __init abyss_init (void ) { + abyss_netdev_ops = tms380tr_netdev_ops; + + abyss_netdev_ops.ndo_open = abyss_open; + abyss_netdev_ops.ndo_stop = abyss_close; +return pci_register_driver (&abyss_driver); }
drivers/net/tokenring/tmspci.c +2 -2
@@ -157,8 +157,8 @@ static int __devinit tms_pci_attach(stru tp->tmspriv = cardinfo; - dev->open = tms380tr_open; - dev->stop = tms380tr_close; + dev->netdev_ops = &tms380tr_netdev_ops; +pci_set_drvdata (pdev, dev);SET_NETDEV_DEV (dev, &pdev->dev);
drivers/net/tokenring/tms380tr.h +1 -0
@@ -14,6 +14,7 @@#include <linux/interrupt.h> /* module prototypes */ +extern const struct net_device_ops tms380tr_netdev_ops;int tms380tr_open (struct net_device *dev);int tms380tr_close (struct net_device *dev);irqreturn_t tms380tr_interrupt (int irq,void *dev_id);
PATCH 29/45 3c559: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/tokenring/3c359.c +10 -7
@@ -274,6 +274,15 @@ static void xl_ee_write(struct net_devireturn ; } + +static const struct net_device_ops xl_netdev_ops = { + .ndo_open = xl_open, + .ndo_stop = xl_close, + .ndo_start_xmit = xl_xmit, + .ndo_change_mtu = xl_change_mtu, + .ndo_set_multicast_list = xl_set_rx_mode, + .ndo_set_mac_address = xl_set_mac_address, +};static int __devinit xl_probe (struct pci_dev *pdev,const struct pci_device_id *ent)
@@ -337,13 +346,7 @@ static int __devinit xl_probe(struct pcireturn i ; } - dev->open=&xl_open; - dev->hard_start_xmit=&xl_xmit; - dev->change_mtu=&xl_change_mtu; - dev->stop=&xl_close; - dev->do_ioctl=NULL ; - dev->set_multicast_list=&xl_set_rx_mode; - dev->set_mac_address=&xl_set_mac_address ; + dev->netdev_ops = &xl_netdev_ops;SET_NETDEV_DEV (dev, &pdev->dev);pci_set_drvdata (pdev,dev) ;
PATCH 30/45 znet: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/znet.c +12 -5
@@ -358,6 +358,17 @@ static void znet_set_multicast_list (str* multicast address configured isn't equal to IFF_ALLMULTI */ } +static const struct net_device_ops znet_netdev_ops = { + .ndo_open = znet_open, + .ndo_stop = znet_close, + .ndo_start_xmit = znet_send_packet, + .ndo_set_multicast_list = znet_set_multicast_list, + .ndo_tx_timeout = znet_tx_timeout, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; +/* The Z-Note probe is pretty easy. The NETIDBLK exists in the safe-to-probe BIOS area. We just scan for the signature, and pull the vital parameters out of the structure. */
@@ -440,11 +451,7 @@ static int __init znet_probe (void) znet->tx_end = znet->tx_start + znet->tx_buf_len;/* The ZNET-specific entries in the device structure. */ - dev->open = &znet_open; - dev->hard_start_xmit = &znet_send_packet; - dev->stop = &znet_close; - dev->set_multicast_list = &znet_set_multicast_list; - dev->tx_timeout = znet_tx_timeout; + dev->netdev_ops = &znet_netdev_ops; dev->watchdog_timeo =TX_TIMEOUT ; err =register_netdev (dev);if (err)
PATCH 21/45 3c59x: convert to net_device_ops
In reply to Stephen Hemmingerdrivers/net/3c59x.c +40 -15
@@ -992,6 +992,42 @@ out:return rc; } +static const struct net_device_ops boomrang_netdev_ops = { + .ndo_open = vortex_open, + .ndo_stop = vortex_close, + .ndo_start_xmit = boomerang_start_xmit, + .ndo_tx_timeout = vortex_tx_timeout, + .ndo_get_stats = vortex_get_stats, +#ifdef CONFIG_PCI + .ndo_do_ioctl = vortex_ioctl, +#endif + .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, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = poll_vortex, +#endif +}; + +static const struct net_device_ops vortex_netdev_ops = { + .ndo_open = vortex_open, + .ndo_stop = vortex_close, + .ndo_start_xmit = vortex_start_xmit, + .ndo_tx_timeout = vortex_tx_timeout, + .ndo_get_stats = vortex_get_stats, +#ifdef CONFIG_PCI + .ndo_do_ioctl = vortex_ioctl, +#endif + .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, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = poll_vortex, +#endif +}; +/* * Start up the PCI/EISA device which is described by *gendev. * Return 0 on success.
@@ -1366,18 +1402,16 @@ static int __devinit vortex_probe1(struc }/* The 3c59x-specific entries in the device structure. */ - dev->open = vortex_open;if (vp->full_bus_master_tx) { - dev->hard_start_xmit = boomerang_start_xmit; + dev->netdev_ops = &boomrang_netdev_ops;/* Actually, it still should work with iommu. */ if (card_idx <MAX_UNITS && ((hw_checksums[card_idx] ==-1 && (vp->drv_flags &HAS_HWCKSM )) || hw_checksums[card_idx] ==1 )) { dev->features |=NETIF_F_IP_CSUM |NETIF_F_SG ; } - }else { - dev->hard_start_xmit = vortex_start_xmit; - } + }else + dev->netdev_ops = &vortex_netdev_ops;if (print_info) { printk(KERN_INFO "%s: scatter/gather %sabled. h/w checksums %sabled\n",
@@ -1386,18 +1420,9 @@ static int __devinit vortex_probe1(struc (dev->features & NETIF_F_IP_CSUM) ? "en":"dis"); } - dev->stop = vortex_close; - dev->get_stats = vortex_get_stats; -#ifdef CONFIG_PCI - dev->do_ioctl = vortex_ioctl; -#endif dev->ethtool_ops = &vortex_ethtool_ops; - dev->set_multicast_list = set_rx_mode; - dev->tx_timeout = vortex_tx_timeout; dev->watchdog_timeo = (watchdog *HZ ) /1000 ; -#ifdef CONFIG_NET_POLL_CONTROLLER - dev->poll_controller = poll_vortex; -#endif +if (pdev) { vp->pm_state_valid =1 ;pci_save_state (VORTEX_PCI (vp));
PATCH 3/45 clip: convert to internal network_device_stats
In reply to Stephen Hemminger--- include/net/atmclip.h | 1 - net/atm/clip.c | 30 ++++++++++++------------------ 2 files changed, 12 insertions(+), 19 deletions(-)
include/net/atmclip.h +0 -1
@@ -50,7 +50,6 @@ struct atmarp_entry {struct clip_priv {int number;/* for convenience ... */ spinlock_t xoff_lock;/* ensures that pop is atomic (SMP) */ -struct net_device_stats stats;struct net_device *next;/* next CLIP interface */ };
net/atm/clip.c +12 -18
@@ -214,15 +214,15 @@ static void clip_push(struct atm_vcc *vc skb->protocol = ((__be16 *) skb->data)[3 ];skb_pull (skb,RFC1483LLC_LEN );if (skb->protocol ==htons (ETH_P_ARP )) { -PRIV (skb->dev)->stats.rx_packets++; -PRIV (skb->dev)->stats.rx_bytes += skb->len; + skb->dev->stats.rx_packets++; + skb->dev->stats.rx_bytes += skb->len;clip_arp_rcv (skb);return ; } } clip_vcc->last_use = jiffies; -PRIV (skb->dev)->stats.rx_packets++; -PRIV (skb->dev)->stats.rx_bytes += skb->len; + skb->dev->stats.rx_packets++; + skb->dev->stats.rx_bytes += skb->len;memset (ATM_SKB (skb),0 ,sizeof (struct atm_skb_data ));netif_rx (skb); }
@@ -372,7 +372,7 @@ static int clip_start_xmit(struct sk_bufif (!skb->dst) {printk (KERN_ERR "clip_start_xmit: skb->dst == NULL\n" );dev_kfree_skb (skb); - clip_priv->stats.tx_dropped++; + dev->stats.tx_dropped++;return 0 ; }if (!skb->dst->neighbour) {
@@ -380,13 +380,13 @@ static int clip_start_xmit(struct sk_buf skb->dst->neighbour =clip_find_neighbour (skb->dst,1 );if (!skb->dst->neighbour) {dev_kfree_skb (skb);/* lost that one */ - clip_priv->stats.tx_dropped++; + dev->stats.tx_dropped++;return 0 ; }#endif printk (KERN_ERR "clip_start_xmit: NO NEIGHBOUR !\n" );dev_kfree_skb (skb); - clip_priv->stats.tx_dropped++; + dev->stats.tx_dropped++;return 0 ; } entry =NEIGH2ENTRY (skb->dst->neighbour);
@@ -400,7 +400,7 @@ static int clip_start_xmit(struct sk_bufskb_queue_tail (&entry->neigh->arp_queue, skb); else {dev_kfree_skb (skb); - clip_priv->stats.tx_dropped++; + dev->stats.tx_dropped++; }return 0 ; }
@@ -423,8 +423,8 @@ static int clip_start_xmit(struct sk_bufprintk (KERN_WARNING "clip_start_xmit: XOFF->XOFF transition\n" );return 0 ; } - clip_priv->stats.tx_packets++; - clip_priv->stats.tx_bytes += skb->len; + dev->stats.tx_packets++; + dev->stats.tx_bytes += skb->len; vcc->send (vcc, skb);if (atm_may_send (vcc,0 )) { entry->vccs->xoff =0 ;
@@ -443,11 +443,6 @@ static int clip_start_xmit(struct sk_bufreturn 0 ; } -static struct net_device_stats *clip_get_stats (struct net_device *dev) -{ -return &PRIV (dev)->stats; -} -static int clip_mkip (struct atm_vcc *vcc,int timeout) {struct clip_vcc *clip_vcc;
@@ -501,8 +496,8 @@ static int clip_mkip(struct atm_vcc *vccskb_get (skb);clip_push (vcc, skb); -PRIV (skb->dev)->stats.rx_packets--; -PRIV (skb->dev)->stats.rx_bytes -= len; + skb->dev->stats.rx_packets--; + skb->dev->stats.rx_bytes -= len;kfree_skb (skb); }
@@ -561,7 +556,6 @@ static void clip_setup(struct net_device { dev->hard_start_xmit = clip_start_xmit;/* sg_xmit ... */ - dev->get_stats = clip_get_stats; dev->type =ARPHRD_ATM ; dev->hard_header_len =RFC1483LLC_LEN ; dev->mtu =RFC1626_MTU ;
PATCH 1/45 atm: br2684 internal stats
In reply to Stephen HemmingerNow that stats are in net_device, use them.
net/atm/br2684.c +15 -23
@@ -83,7 +83,6 @@ struct br2684_dev {struct list_head br2684_devs;int number;struct list_head brvccs;/* one device <=> one vcc (before xmas) */ -struct net_device_stats stats;int mac_was_set;enum br2684_payload payload; };
@@ -148,9 +147,10 @@ static struct net_device *br2684_find_de* the way for multiple vcc's per itf. Returns true if we can send, * otherwise false */ -static int br2684_xmit_vcc (struct sk_buff *skb,struct br2684_dev *brdev, +static int br2684_xmit_vcc (struct sk_buff *skb,struct net_device *dev,struct br2684_vcc *brvcc) { +struct br2684_dev *brdev =BRPRIV (dev);struct atm_vcc *atmvcc;int minheadroom = (brvcc->encaps == e_llc) ?10 :2 ;
@@ -211,8 +211,8 @@ static int br2684_xmit_vcc(struct sk_buf }atomic_add (skb->truesize, &sk_atm (atmvcc)->sk_wmem_alloc);ATM_SKB (skb)->atm_options = atmvcc->atm_options; - brdev->stats.tx_packets++; - brdev->stats.tx_bytes += skb->len; + dev->stats.tx_packets++; + dev->stats.tx_bytes += skb->len; atmvcc->send (atmvcc, skb);return 1 ; }
@@ -233,14 +233,14 @@ static int br2684_start_xmit(struct sk_b brvcc =pick_outgoing_vcc (skb, brdev);if (brvcc ==NULL ) {pr_debug ("no vcc attached to dev %s\n" , dev->name); - brdev->stats.tx_errors++; - brdev->stats.tx_carrier_errors++; + dev->stats.tx_errors++; + dev->stats.tx_carrier_errors++;/* netif_stop_queue(dev); */ dev_kfree_skb (skb);read_unlock (&devs_lock);return 0 ; } -if (!br2684_xmit_vcc (skb, brdev, brvcc)) { +if (!br2684_xmit_vcc (skb, dev, brvcc)) {/* * We should probably use netif_*_queue() here, but that * involves added complication. We need to walk before
@@ -248,19 +248,13 @@ static int br2684_start_xmit(struct sk_b* * Don't free here! this pointer might be no longer valid! */ - brdev->stats.tx_errors++; - brdev->stats.tx_fifo_errors++; + dev->stats.tx_errors++; + dev->stats.tx_fifo_errors++; }read_unlock (&devs_lock);return 0 ; } -static struct net_device_stats *br2684_get_stats (struct net_device *dev) -{ -pr_debug ("br2684_get_stats\n" ); -return &BRPRIV (dev)->stats; -} -/* * We remember when the MAC gets set, so we don't override it later with * the ESI of the ATM card of the first VC
@@ -430,17 +424,17 @@ static void br2684_push(struct atm_vcc */* sigh, interface is down? */ if (unlikely (!(net_dev->flags &IFF_UP ))) goto dropped; - brdev->stats.rx_packets++; - brdev->stats.rx_bytes += skb->len; + net_dev->stats.rx_packets++; + net_dev->stats.rx_bytes += skb->len;memset (ATM_SKB (skb),0 ,sizeof (struct atm_skb_data ));netif_rx (skb);return ; dropped: - brdev->stats.rx_dropped++; + net_dev->stats.rx_dropped++; goto free_skb; error: - brdev->stats.rx_errors++; + net_dev->stats.rx_errors++; free_skb:dev_kfree_skb (skb);return ;
@@ -531,8 +525,8 @@ static int br2684_regvcc(struct atm_vcc skb->next = skb->prev =NULL ;br2684_push (atmvcc, skb); -BRPRIV (skb->dev)->stats.rx_bytes -= skb->len; -BRPRIV (skb->dev)->stats.rx_packets--; + skb->dev->stats.rx_bytes -= skb->len; + skb->dev->stats.rx_packets--; skb = next; }
@@ -554,7 +548,6 @@ static void br2684_setup(struct net_devi my_eth_mac_addr = netdev->set_mac_address; netdev->set_mac_address = br2684_mac_addr; netdev->hard_start_xmit = br2684_start_xmit; - netdev->get_stats = br2684_get_stats;INIT_LIST_HEAD (&brdev->brvccs); }
@@ -568,7 +561,6 @@ static void br2684_setup_routed(struct n my_eth_mac_addr = netdev->set_mac_address; netdev->set_mac_address = br2684_mac_addr; netdev->hard_start_xmit = br2684_start_xmit; - netdev->get_stats = br2684_get_stats; netdev->addr_len =0 ; netdev->mtu =1500 ; netdev->type =ARPHRD_PPP ;
PATCH 2/45 br2684: convert to net_device_ops
In reply to Stephen Hemmingernet/atm/br2684.c +11 -9
@@ -259,10 +259,9 @@ static int br2684_start_xmit(struct sk_b* We remember when the MAC gets set, so we don't override it later with * the ESI of the ATM card of the first VC */ -static int (*my_eth_mac_addr) (struct net_device *,void *);static int br2684_mac_addr (struct net_device *dev,void *p) { -int err =my_eth_mac_addr (dev, p); +int err =eth_mac_addr (dev, p);if (!err)BRPRIV (dev)->mac_was_set =1 ;return err;
@@ -538,16 +537,20 @@ static int br2684_regvcc(struct atm_vccreturn err; } +static const struct net_device_ops br2684_netdev_ops = { + .ndo_start_xmit = br2684_start_xmit, + .ndo_set_mac_address = br2684_mac_addr, + .ndo_change_mtu = eth_change_mtu, + .ndo_validate_addr = eth_validate_addr, +}; +static void br2684_setup (struct net_device *netdev) {struct br2684_dev *brdev =BRPRIV (netdev);ether_setup (netdev); - brdev->net_dev = netdev; - my_eth_mac_addr = netdev->set_mac_address; - netdev->set_mac_address = br2684_mac_addr; - netdev->hard_start_xmit = br2684_start_xmit; + netdev->netdev_ops = &br2684_netdev_ops;INIT_LIST_HEAD (&brdev->brvccs); }
@@ -558,9 +561,8 @@ static void br2684_setup_routed(struct n brdev->net_dev = netdev; netdev->hard_header_len =0 ; - my_eth_mac_addr = netdev->set_mac_address; - netdev->set_mac_address = br2684_mac_addr; - netdev->hard_start_xmit = br2684_start_xmit; + + netdev->netdev_ops = &br2684_netdev_ops; netdev->addr_len =0 ; netdev->mtu =1500 ; netdev->type =ARPHRD_PPP ;
PATCH 4/45 lec: convert to internal network_device_stats
In reply to Stephen Hemminger--- net/atm/lec.c | 44 +++++++++++++++++--------------------------- net/atm/lec.h | 1 - 2 files changed, 17 insertions(+), 28 deletions(-)
net/atm/lec.h +0 -1
@@ -69,7 +69,6 @@ struct lane2_ops {#define LEC_ARP_TABLE_SIZE 16struct lec_priv { -struct net_device_stats stats;unsigned short lecid;/* Lecid of this client */ struct hlist_head lec_arp_empty_ones;/* Used for storing VCC's that don't have a MAC address attached yet */
net/atm/lec.c +17 -27
120 lines not on this page · raw message
PATCH 5/45 lec: convert to net_device_ops
In reply to Stephen Hemminger--- net/atm/lec.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
net/atm/lec.c +11 -9
@@ -667,17 +667,19 @@ static void lec_set_multicast_list(strucreturn ; } +static const struct net_device_ops lec_netdev_ops = { + .ndo_open = lec_open, + .ndo_stop = lec_close, + .ndo_start_xmit = lec_start_xmit, + .ndo_change_mtu = lec_change_mtu, + .ndo_tx_timeout = lec_tx_timeout, + .ndo_set_multicast_list = lec_set_multicast_list, +}; + +static void lec_init (struct net_device *dev) { - dev->change_mtu = lec_change_mtu; - dev->open = lec_open; - dev->stop = lec_close; - dev->hard_start_xmit = lec_start_xmit; - dev->tx_timeout = lec_tx_timeout; - - dev->get_stats = lec_get_stats; - dev->set_multicast_list = lec_set_multicast_list; - dev->do_ioctl =NULL ; + dev->netdev_ops = &lec_netdev_ops;printk ("%s: Initialized!\n" , dev->name); }
PATCH 15/45 3c505: convert to net_device_ops
In reply to Stephen Hemminger--- drivers/net/3c505.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/net/3c505.c +12 -6
@@ -1348,6 +1348,17 @@ static int __init elp_autodetect(structreturn 0 ;/* Because of this, the layer above will return -ENODEV */ } +static const struct net_device_ops elp_netdev_ops = { + .ndo_open = elp_open, + .ndo_stop = elp_close, + .ndo_get_stats = elp_get_stats, + .ndo_start_xmit = elp_start_xmit, + .ndo_tx_timeout = elp_timeout, + .ndo_set_multicast_list = elp_set_mc_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +};/****************************************************** *
@@ -1552,13 +1563,8 @@ static int __init elplus_setup(struct neprintk (KERN_ERR "%s: adapter configuration failed\n" , dev->name); } - dev->open = elp_open;/* local */ - dev->stop = elp_close;/* local */ - dev->get_stats = elp_get_stats;/* local */ - dev->hard_start_xmit = elp_start_xmit;/* local */ - dev->tx_timeout = elp_timeout;/* local */ + dev->netdev_ops = &elp_netdev_ops; dev->watchdog_timeo =10 *HZ ; - dev->set_multicast_list = elp_set_mc_list;/* local */ dev->ethtool_ops = &netdev_ethtool_ops;/* local */ dev->mem_start = dev->mem_end =0 ;
Re: [patch 32/45] baycom: convert to internal net_device_stats
In reply to Stephen HemmingerQuoted 2 lines · Stephen Hemminger
plain text document attachment (baycom-stats.patch)
Signed-off-by Stephen Hemminger <[email protected]>
Thanks!
Re: [patch 33/45] baycom: convert to net_device_ops
In reply to Stephen HemmingerQuoted 2 lines · Stephen Hemminger
plain text document attachment (baycom-netdev.patch)
Signed-off-by Stephen Hemminger <[email protected]>
Thanks!
Re: [patch 39/45] hdlcdrv: convert to net_device_ops
In reply to Stephen HemmingerQuoted 2 lines · Stephen Hemminger
plain text document attachment (hdlcdrv-netdev.patch)
Signed-off-by Stephen Hemminger <[email protected]>
Thanks!
Re: [patch 38/45] hdlcdrv: convert to internal net_device_stats
In reply to Stephen HemmingerQuoted 2 lines · Stephen Hemminger
plain text document attachment (hdlcdrv-stats.patch)
Signed-off-by Stephen Hemminger <[email protected]>
Thanks!
David Miller
maintainerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 09 Jan 2009 15:00:57 -0800
Quoted 2 lines
That's all for this week.
Compile tested on x86 only.
All applied, I'll push out to kernel.org after some build testing of my own.
Thanks!
Re: [patch 06/45] netrom: convert to internal net_device_stats
In reply to Stephen HemmingerQuoted 1 line · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>
Ralf
Re: [patch 07/45] netrom: convert to net_device_ops
In reply to Stephen HemmingerQuoted 7 lines · Stephen Hemminger
From: Stephen Hemminger <[email protected]>
Date: Fri, 09 Jan 2009 15:01:04 -0800
To: David Miller <[email protected]>, Ralf Baechle <[email protected]>
Cc: [email protected], [email protected]
Subject: [patch 07/45] netrom: convert tonet_device_opsSigned-off-by Stephen Hemminger <[email protected]>
Re: [patch 08/45] rose: convert to internal net_device_stats
In reply to Stephen HemmingerQuoted 7 lines · Stephen Hemminger
From: Stephen Hemminger <[email protected]>
Date: Fri, 09 Jan 2009 15:01:05 -0800
To: David Miller <[email protected]>, Ralf Baechle <[email protected]>
Cc: [email protected], [email protected]
Subject: [patch 08/45] rose: convert to internalnet_device_statsSigned-off-by Stephen Hemminger <[email protected]>
Re: [patch 09/45] rose: convert to network_device_ops
In reply to Stephen HemmingerQuoted 7 lines · Stephen Hemminger
From: Stephen Hemminger <[email protected]>
Date: Fri, 09 Jan 2009 15:01:06 -0800
To: David Miller <[email protected]>, Ralf Baechle <[email protected]>
Cc: [email protected], [email protected]
Subject: [patch 09/45] rose: convert tonetwork_device_opsSigned-off-by Stephen Hemminger <[email protected]>
David Miller
maintainerRe: [patch 06/45] netrom: convert to internal net_device_stats
In reply to Ralf Baechle DL5RBFrom: Ralf Baechle DL5RB <[email protected]>
Date: Sat, 10 Jan 2009 12:54:48 +0000
Quoted 5 lines · Stephen Hemminger
Quoted 2 lines
Signed-off-by Stephen Hemminger <[email protected]>Acked-by Ralf Baechle <[email protected]>
I've added your ACKs for these 4 patches, thanks Ralf.