aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tulip/xircom_cb.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-01-07 21:00:55 -0500
committerDavid S. Miller <davem@davemloft.net>2009-01-07 21:00:55 -0500
commit1034c9f69ae7b61d408836e60c6a2b5afc6e48bc (patch)
tree2e4176b940114a6164019d5c7fdfd5b93fb9d63b /drivers/net/tulip/xircom_cb.c
parent0b9a5b05b23587c81e2985bc89f6f1a502c1991e (diff)
xircom: convert devices to new API
Convert to net_device_ops and internal net_device_stats Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tulip/xircom_cb.c')
-rw-r--r--drivers/net/tulip/xircom_cb.c43
1 files changed, 19 insertions, 24 deletions
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index 13c8703ecb9f..c2ca9f40e40e 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -104,10 +104,8 @@ struct xircom_private {
104 */ 104 */
105 spinlock_t lock; 105 spinlock_t lock;
106 106
107
108 struct pci_dev *pdev; 107 struct pci_dev *pdev;
109 struct net_device *dev; 108 struct net_device *dev;
110 struct net_device_stats stats;
111}; 109};
112 110
113 111
@@ -119,7 +117,6 @@ static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev);
119static int xircom_open(struct net_device *dev); 117static int xircom_open(struct net_device *dev);
120static int xircom_close(struct net_device *dev); 118static int xircom_close(struct net_device *dev);
121static void xircom_up(struct xircom_private *card); 119static void xircom_up(struct xircom_private *card);
122static struct net_device_stats *xircom_get_stats(struct net_device *dev);
123#ifdef CONFIG_NET_POLL_CONTROLLER 120#ifdef CONFIG_NET_POLL_CONTROLLER
124static void xircom_poll_controller(struct net_device *dev); 121static void xircom_poll_controller(struct net_device *dev);
125#endif 122#endif
@@ -194,6 +191,18 @@ static const struct ethtool_ops netdev_ethtool_ops = {
194 .get_drvinfo = netdev_get_drvinfo, 191 .get_drvinfo = netdev_get_drvinfo,
195}; 192};
196 193
194static const struct net_device_ops netdev_ops = {
195 .ndo_open = xircom_open,
196 .ndo_stop = xircom_close,
197 .ndo_start_xmit = xircom_start_xmit,
198 .ndo_change_mtu = eth_change_mtu,
199 .ndo_set_mac_address = eth_mac_addr,
200 .ndo_validate_addr = eth_validate_addr,
201#ifdef CONFIG_NET_POLL_CONTROLLER
202 .ndo_poll_controller = xircom_poll_controller,
203#endif
204};
205
197/* xircom_probe is the code that gets called on device insertion. 206/* xircom_probe is the code that gets called on device insertion.
198 it sets up the hardware and registers the device to the networklayer. 207 it sets up the hardware and registers the device to the networklayer.
199 208
@@ -266,13 +275,7 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
266 read_mac_address(private); 275 read_mac_address(private);
267 setup_descriptors(private); 276 setup_descriptors(private);
268 277
269 dev->open = &xircom_open; 278 dev->netdev_ops = &netdev_ops;
270 dev->hard_start_xmit = &xircom_start_xmit;
271 dev->stop = &xircom_close;
272 dev->get_stats = &xircom_get_stats;
273#ifdef CONFIG_NET_POLL_CONTROLLER
274 dev->poll_controller = &xircom_poll_controller;
275#endif
276 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 279 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
277 pci_set_drvdata(pdev, dev); 280 pci_set_drvdata(pdev, dev);
278 281
@@ -497,14 +500,6 @@ static int xircom_close(struct net_device *dev)
497} 500}
498 501
499 502
500
501static struct net_device_stats *xircom_get_stats(struct net_device *dev)
502{
503 struct xircom_private *card = netdev_priv(dev);
504 return &card->stats;
505}
506
507
508#ifdef CONFIG_NET_POLL_CONTROLLER 503#ifdef CONFIG_NET_POLL_CONTROLLER
509static void xircom_poll_controller(struct net_device *dev) 504static void xircom_poll_controller(struct net_device *dev)
510{ 505{
@@ -1193,7 +1188,7 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri
1193 1188
1194 skb = dev_alloc_skb(pkt_len + 2); 1189 skb = dev_alloc_skb(pkt_len + 2);
1195 if (skb == NULL) { 1190 if (skb == NULL) {
1196 card->stats.rx_dropped++; 1191 dev->stats.rx_dropped++;
1197 goto out; 1192 goto out;
1198 } 1193 }
1199 skb_reserve(skb, 2); 1194 skb_reserve(skb, 2);
@@ -1201,8 +1196,8 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri
1201 skb_put(skb, pkt_len); 1196 skb_put(skb, pkt_len);
1202 skb->protocol = eth_type_trans(skb, dev); 1197 skb->protocol = eth_type_trans(skb, dev);
1203 netif_rx(skb); 1198 netif_rx(skb);
1204 card->stats.rx_packets++; 1199 dev->stats.rx_packets++;
1205 card->stats.rx_bytes += pkt_len; 1200 dev->stats.rx_bytes += pkt_len;
1206 1201
1207 out: 1202 out:
1208 /* give the buffer back to the card */ 1203 /* give the buffer back to the card */
@@ -1232,16 +1227,16 @@ static void investigate_write_descriptor(struct net_device *dev, struct xircom_p
1232#endif 1227#endif
1233 if (status > 0) { /* bit 31 is 0 when done */ 1228 if (status > 0) { /* bit 31 is 0 when done */
1234 if (card->tx_skb[descnr]!=NULL) { 1229 if (card->tx_skb[descnr]!=NULL) {
1235 card->stats.tx_bytes += card->tx_skb[descnr]->len; 1230 dev->stats.tx_bytes += card->tx_skb[descnr]->len;
1236 dev_kfree_skb_irq(card->tx_skb[descnr]); 1231 dev_kfree_skb_irq(card->tx_skb[descnr]);
1237 } 1232 }
1238 card->tx_skb[descnr] = NULL; 1233 card->tx_skb[descnr] = NULL;
1239 /* Bit 8 in the status field is 1 if there was a collision */ 1234 /* Bit 8 in the status field is 1 if there was a collision */
1240 if (status&(1<<8)) 1235 if (status&(1<<8))
1241 card->stats.collisions++; 1236 dev->stats.collisions++;
1242 card->tx_buffer[4*descnr] = 0; /* descriptor is free again */ 1237 card->tx_buffer[4*descnr] = 0; /* descriptor is free again */
1243 netif_wake_queue (dev); 1238 netif_wake_queue (dev);
1244 card->stats.tx_packets++; 1239 dev->stats.tx_packets++;
1245 } 1240 }
1246 1241
1247 leave("investigate_write_descriptor"); 1242 leave("investigate_write_descriptor");