aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-xp/xpnet.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/sgi-xp/xpnet.c')
-rw-r--r--drivers/misc/sgi-xp/xpnet.c68
1 files changed, 20 insertions, 48 deletions
diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c
index 8e6aa9508f46..e5f0a947c083 100644
--- a/drivers/misc/sgi-xp/xpnet.c
+++ b/drivers/misc/sgi-xp/xpnet.c
@@ -95,11 +95,6 @@ struct xpnet_pending_msg {
95 atomic_t use_count; 95 atomic_t use_count;
96}; 96};
97 97
98/* driver specific structure pointed to by the device structure */
99struct xpnet_dev_private {
100 struct net_device_stats stats;
101};
102
103struct net_device *xpnet_device; 98struct net_device *xpnet_device;
104 99
105/* 100/*
@@ -153,7 +148,6 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg)
153 struct sk_buff *skb; 148 struct sk_buff *skb;
154 void *dst; 149 void *dst;
155 enum xp_retval ret; 150 enum xp_retval ret;
156 struct xpnet_dev_private *priv = netdev_priv(xpnet_device);
157 151
158 if (!XPNET_VALID_MSG(msg)) { 152 if (!XPNET_VALID_MSG(msg)) {
159 /* 153 /*
@@ -161,7 +155,7 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg)
161 */ 155 */
162 xpc_received(partid, channel, (void *)msg); 156 xpc_received(partid, channel, (void *)msg);
163 157
164 priv->stats.rx_errors++; 158 xpnet_device->stats.rx_errors++;
165 159
166 return; 160 return;
167 } 161 }
@@ -176,7 +170,7 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg)
176 170
177 xpc_received(partid, channel, (void *)msg); 171 xpc_received(partid, channel, (void *)msg);
178 172
179 priv->stats.rx_errors++; 173 xpnet_device->stats.rx_errors++;
180 174
181 return; 175 return;
182 } 176 }
@@ -226,7 +220,7 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg)
226 220
227 xpc_received(partid, channel, (void *)msg); 221 xpc_received(partid, channel, (void *)msg);
228 222
229 priv->stats.rx_errors++; 223 xpnet_device->stats.rx_errors++;
230 224
231 return; 225 return;
232 } 226 }
@@ -247,8 +241,8 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg)
247 skb_end_pointer(skb), skb->len); 241 skb_end_pointer(skb), skb->len);
248 242
249 xpnet_device->last_rx = jiffies; 243 xpnet_device->last_rx = jiffies;
250 priv->stats.rx_packets++; 244 xpnet_device->stats.rx_packets++;
251 priv->stats.rx_bytes += skb->len + ETH_HLEN; 245 xpnet_device->stats.rx_bytes += skb->len + ETH_HLEN;
252 246
253 netif_rx_ni(skb); 247 netif_rx_ni(skb);
254 xpc_received(partid, channel, (void *)msg); 248 xpc_received(partid, channel, (void *)msg);
@@ -353,26 +347,6 @@ xpnet_dev_change_mtu(struct net_device *dev, int new_mtu)
353} 347}
354 348
355/* 349/*
356 * Required for the net_device structure.
357 */
358static int
359xpnet_dev_set_config(struct net_device *dev, struct ifmap *new_map)
360{
361 return 0;
362}
363
364/*
365 * Return statistics to the caller.
366 */
367static struct net_device_stats *
368xpnet_dev_get_stats(struct net_device *dev)
369{
370 struct xpnet_dev_private *priv = netdev_priv(dev);
371
372 return &priv->stats;
373}
374
375/*
376 * Notification that the other end has received the message and 350 * Notification that the other end has received the message and
377 * DMA'd the skb information. At this point, they are done with 351 * DMA'd the skb information. At this point, they are done with
378 * our side. When all recipients are done processing, we 352 * our side. When all recipients are done processing, we
@@ -453,7 +427,6 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
453 struct xpnet_pending_msg *queued_msg; 427 struct xpnet_pending_msg *queued_msg;
454 u64 start_addr, end_addr; 428 u64 start_addr, end_addr;
455 short dest_partid; 429 short dest_partid;
456 struct xpnet_dev_private *priv = netdev_priv(dev);
457 u16 embedded_bytes = 0; 430 u16 embedded_bytes = 0;
458 431
459 dev_dbg(xpnet, ">skb->head=0x%p skb->data=0x%p skb->tail=0x%p " 432 dev_dbg(xpnet, ">skb->head=0x%p skb->data=0x%p skb->tail=0x%p "
@@ -476,7 +449,7 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
476 dev_warn(xpnet, "failed to kmalloc %ld bytes; dropping " 449 dev_warn(xpnet, "failed to kmalloc %ld bytes; dropping "
477 "packet\n", sizeof(struct xpnet_pending_msg)); 450 "packet\n", sizeof(struct xpnet_pending_msg));
478 451
479 priv->stats.tx_errors++; 452 dev->stats.tx_errors++;
480 return -ENOMEM; 453 return -ENOMEM;
481 } 454 }
482 455
@@ -526,8 +499,8 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
526 kfree(queued_msg); 499 kfree(queued_msg);
527 } 500 }
528 501
529 priv->stats.tx_packets++; 502 dev->stats.tx_packets++;
530 priv->stats.tx_bytes += skb->len; 503 dev->stats.tx_bytes += skb->len;
531 504
532 return 0; 505 return 0;
533} 506}
@@ -538,12 +511,19 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
538static void 511static void
539xpnet_dev_tx_timeout(struct net_device *dev) 512xpnet_dev_tx_timeout(struct net_device *dev)
540{ 513{
541 struct xpnet_dev_private *priv = netdev_priv(dev); 514 dev->stats.tx_errors++;
542
543 priv->stats.tx_errors++;
544 return;
545} 515}
546 516
517static const struct net_device_ops xpnet_netdev_ops = {
518 .ndo_open = xpnet_dev_open,
519 .ndo_stop = xpnet_dev_stop,
520 .ndo_start_xmit = xpnet_dev_hard_start_xmit,
521 .ndo_change_mtu = xpnet_dev_change_mtu,
522 .ndo_tx_timeout = xpnet_dev_tx_timeout,
523 .ndo_set_mac_address = eth_mac_addr,
524 .ndo_validate_addr = eth_validate_addr,
525};
526
547static int __init 527static int __init
548xpnet_init(void) 528xpnet_init(void)
549{ 529{
@@ -563,8 +543,7 @@ xpnet_init(void)
563 * use ether_setup() to init the majority of our device 543 * use ether_setup() to init the majority of our device
564 * structure and then override the necessary pieces. 544 * structure and then override the necessary pieces.
565 */ 545 */
566 xpnet_device = alloc_netdev(sizeof(struct xpnet_dev_private), 546 xpnet_device = alloc_netdev(0, XPNET_DEVICE_NAME, ether_setup);
567 XPNET_DEVICE_NAME, ether_setup);
568 if (xpnet_device == NULL) { 547 if (xpnet_device == NULL) {
569 kfree(xpnet_broadcast_partitions); 548 kfree(xpnet_broadcast_partitions);
570 return -ENOMEM; 549 return -ENOMEM;
@@ -573,13 +552,6 @@ xpnet_init(void)
573 netif_carrier_off(xpnet_device); 552 netif_carrier_off(xpnet_device);
574 553
575 xpnet_device->mtu = XPNET_DEF_MTU; 554 xpnet_device->mtu = XPNET_DEF_MTU;
576 xpnet_device->change_mtu = xpnet_dev_change_mtu;
577 xpnet_device->open = xpnet_dev_open;
578 xpnet_device->get_stats = xpnet_dev_get_stats;
579 xpnet_device->stop = xpnet_dev_stop;
580 xpnet_device->hard_start_xmit = xpnet_dev_hard_start_xmit;
581 xpnet_device->tx_timeout = xpnet_dev_tx_timeout;
582 xpnet_device->set_config = xpnet_dev_set_config;
583 555
584 /* 556 /*
585 * Multicast assumes the LSB of the first octet is set for multicast 557 * Multicast assumes the LSB of the first octet is set for multicast