libata-sff: separate out BMDMA qc_issue
[safe/jmp/linux-2.6] / drivers / net / loopback.c
index 6f71157..72b7949 100644 (file)
@@ -69,9 +69,11 @@ struct pcpu_lstats {
  * The higher levels take care of making this non-reentrant (it's
  * called with bh's disabled).
  */
-static int loopback_xmit(struct sk_buff *skb, struct net_device *dev)
+static netdev_tx_t loopback_xmit(struct sk_buff *skb,
+                                struct net_device *dev)
 {
-       struct pcpu_lstats *pcpu_lstats, *lb_stats;
+       struct pcpu_lstats __percpu *pcpu_lstats;
+       struct pcpu_lstats *lb_stats;
        int len;
 
        skb_orphan(skb);
@@ -79,8 +81,8 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev)
        skb->protocol = eth_type_trans(skb, dev);
 
        /* it's OK to use per_cpu_ptr() because BHs are off */
-       pcpu_lstats = dev->ml_priv;
-       lb_stats = per_cpu_ptr(pcpu_lstats, smp_processor_id());
+       pcpu_lstats = (void __percpu __force *)dev->ml_priv;
+       lb_stats = this_cpu_ptr(pcpu_lstats);
 
        len = skb->len;
        if (likely(netif_rx(skb) == NET_RX_SUCCESS)) {
@@ -89,19 +91,19 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev)
        } else
                lb_stats->drops++;
 
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 static struct net_device_stats *loopback_get_stats(struct net_device *dev)
 {
-       const struct pcpu_lstats *pcpu_lstats;
+       const struct pcpu_lstats __percpu *pcpu_lstats;
        struct net_device_stats *stats = &dev->stats;
        unsigned long bytes = 0;
        unsigned long packets = 0;
        unsigned long drops = 0;
        int i;
 
-       pcpu_lstats = dev->ml_priv;
+       pcpu_lstats = (void __percpu __force *)dev->ml_priv;
        for_each_possible_cpu(i) {
                const struct pcpu_lstats *lb_stats;
 
@@ -134,19 +136,20 @@ static const struct ethtool_ops loopback_ethtool_ops = {
 
 static int loopback_dev_init(struct net_device *dev)
 {
-       struct pcpu_lstats *lstats;
+       struct pcpu_lstats __percpu *lstats;
 
        lstats = alloc_percpu(struct pcpu_lstats);
        if (!lstats)
                return -ENOMEM;
 
-       dev->ml_priv = lstats;
+       dev->ml_priv = (void __force *)lstats;
        return 0;
 }
 
 static void loopback_dev_free(struct net_device *dev)
 {
-       struct pcpu_lstats *lstats = dev->ml_priv;
+       struct pcpu_lstats __percpu *lstats =
+               (void __percpu __force *)dev->ml_priv;
 
        free_percpu(lstats);
        free_netdev(dev);
@@ -170,6 +173,7 @@ static void loopback_setup(struct net_device *dev)
        dev->tx_queue_len       = 0;
        dev->type               = ARPHRD_LOOPBACK;      /* 0x0001*/
        dev->flags              = IFF_LOOPBACK;
+       dev->priv_flags        &= ~IFF_XMIT_DST_RELEASE;
        dev->features           = NETIF_F_SG | NETIF_F_FRAGLIST
                | NETIF_F_TSO
                | NETIF_F_NO_CSUM
@@ -205,20 +209,12 @@ static __net_init int loopback_net_init(struct net *net)
 out_free_netdev:
        free_netdev(dev);
 out:
-       if (net == &init_net)
+       if (net_eq(net, &init_net))
                panic("loopback: Failed to register netdevice: %d\n", err);
        return err;
 }
 
-static __net_exit void loopback_net_exit(struct net *net)
-{
-       struct net_device *dev = net->loopback_dev;
-
-       unregister_netdev(dev);
-}
-
 /* Registered in net/core/dev.c */
 struct pernet_operations __net_initdata loopback_net_ops = {
        .init = loopback_net_init,
-       .exit = loopback_net_exit,
 };