aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/net_kern.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/drivers/net_kern.c')
-rw-r--r--arch/um/drivers/net_kern.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index fde510b664d3..434224e2229f 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -86,7 +86,7 @@ static int uml_net_rx(struct net_device *dev)
86 drop_skb->dev = dev; 86 drop_skb->dev = dev;
87 /* Read a packet into drop_skb and don't do anything with it. */ 87 /* Read a packet into drop_skb and don't do anything with it. */
88 (*lp->read)(lp->fd, drop_skb, lp); 88 (*lp->read)(lp->fd, drop_skb, lp);
89 lp->stats.rx_dropped++; 89 dev->stats.rx_dropped++;
90 return 0; 90 return 0;
91 } 91 }
92 92
@@ -99,8 +99,8 @@ static int uml_net_rx(struct net_device *dev)
99 skb_trim(skb, pkt_len); 99 skb_trim(skb, pkt_len);
100 skb->protocol = (*lp->protocol)(skb); 100 skb->protocol = (*lp->protocol)(skb);
101 101
102 lp->stats.rx_bytes += skb->len; 102 dev->stats.rx_bytes += skb->len;
103 lp->stats.rx_packets++; 103 dev->stats.rx_packets++;
104 netif_rx(skb); 104 netif_rx(skb);
105 return pkt_len; 105 return pkt_len;
106 } 106 }
@@ -224,8 +224,8 @@ static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
224 len = (*lp->write)(lp->fd, skb, lp); 224 len = (*lp->write)(lp->fd, skb, lp);
225 225
226 if (len == skb->len) { 226 if (len == skb->len) {
227 lp->stats.tx_packets++; 227 dev->stats.tx_packets++;
228 lp->stats.tx_bytes += skb->len; 228 dev->stats.tx_bytes += skb->len;
229 dev->trans_start = jiffies; 229 dev->trans_start = jiffies;
230 netif_start_queue(dev); 230 netif_start_queue(dev);
231 231
@@ -234,7 +234,7 @@ static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
234 } 234 }
235 else if (len == 0) { 235 else if (len == 0) {
236 netif_start_queue(dev); 236 netif_start_queue(dev);
237 lp->stats.tx_dropped++; 237 dev->stats.tx_dropped++;
238 } 238 }
239 else { 239 else {
240 netif_start_queue(dev); 240 netif_start_queue(dev);
@@ -248,12 +248,6 @@ static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
248 return 0; 248 return 0;
249} 249}
250 250
251static struct net_device_stats *uml_net_get_stats(struct net_device *dev)
252{
253 struct uml_net_private *lp = netdev_priv(dev);
254 return &lp->stats;
255}
256
257static void uml_net_set_multicast_list(struct net_device *dev) 251static void uml_net_set_multicast_list(struct net_device *dev)
258{ 252{
259 return; 253 return;
@@ -377,6 +371,18 @@ static void net_device_release(struct device *dev)
377 free_netdev(netdev); 371 free_netdev(netdev);
378} 372}
379 373
374static const struct net_device_ops uml_netdev_ops = {
375 .ndo_open = uml_net_open,
376 .ndo_stop = uml_net_close,
377 .ndo_start_xmit = uml_net_start_xmit,
378 .ndo_set_multicast_list = uml_net_set_multicast_list,
379 .ndo_tx_timeout = uml_net_tx_timeout,
380 .ndo_set_mac_address = uml_net_set_mac,
381 .ndo_change_mtu = uml_net_change_mtu,
382 .ndo_set_mac_address = eth_mac_addr,
383 .ndo_validate_addr = eth_validate_addr,
384};
385
380/* 386/*
381 * Ensures that platform_driver_register is called only once by 387 * Ensures that platform_driver_register is called only once by
382 * eth_configure. Will be set in an initcall. 388 * eth_configure. Will be set in an initcall.
@@ -473,14 +479,7 @@ static void eth_configure(int n, void *init, char *mac,
473 479
474 set_ether_mac(dev, device->mac); 480 set_ether_mac(dev, device->mac);
475 dev->mtu = transport->user->mtu; 481 dev->mtu = transport->user->mtu;
476 dev->open = uml_net_open; 482 dev->netdev_ops = &uml_netdev_ops;
477 dev->hard_start_xmit = uml_net_start_xmit;
478 dev->stop = uml_net_close;
479 dev->get_stats = uml_net_get_stats;
480 dev->set_multicast_list = uml_net_set_multicast_list;
481 dev->tx_timeout = uml_net_tx_timeout;
482 dev->set_mac_address = uml_net_set_mac;
483 dev->change_mtu = uml_net_change_mtu;
484 dev->ethtool_ops = &uml_net_ethtool_ops; 483 dev->ethtool_ops = &uml_net_ethtool_ops;
485 dev->watchdog_timeo = (HZ >> 1); 484 dev->watchdog_timeo = (HZ >> 1);
486 dev->irq = UM_ETH_IRQ; 485 dev->irq = UM_ETH_IRQ;