ipv4: remove unused macro (FIB_RES_RESET) from ip_fib.h.
[deliverable/linux.git] / net / core / dev.c
index 91d792d17e098761c2e725204eb065621bba5d57..81442957c5c2f06669f7c848e21b2b3fdf42ba80 100644 (file)
@@ -1336,7 +1336,12 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
 {
        struct packet_type *ptype;
 
+#ifdef CONFIG_NET_CLS_ACT
+       if (!(skb->tstamp.tv64 && (G_TC_FROM(skb->tc_verd) & AT_INGRESS)))
+               net_timestamp(skb);
+#else
        net_timestamp(skb);
+#endif
 
        rcu_read_lock();
        list_for_each_entry_rcu(ptype, &ptype_all, list) {
@@ -1430,7 +1435,7 @@ void netif_device_detach(struct net_device *dev)
 {
        if (test_and_clear_bit(__LINK_STATE_PRESENT, &dev->state) &&
            netif_running(dev)) {
-               netif_stop_queue(dev);
+               netif_tx_stop_all_queues(dev);
        }
 }
 EXPORT_SYMBOL(netif_device_detach);
@@ -1445,7 +1450,7 @@ void netif_device_attach(struct net_device *dev)
 {
        if (!test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) &&
            netif_running(dev)) {
-               netif_wake_queue(dev);
+               netif_tx_wake_all_queues(dev);
                __netdev_watchdog_up(dev);
        }
 }
@@ -1730,11 +1735,12 @@ u16 skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb)
 {
        u32 hash;
 
-       if (skb_rx_queue_recorded(skb)) {
-               hash = skb_get_rx_queue(skb);
-       } else if (skb->sk && skb->sk->sk_hash) {
+       if (skb_rx_queue_recorded(skb))
+               return skb_get_rx_queue(skb) % dev->real_num_tx_queues;
+
+       if (skb->sk && skb->sk->sk_hash)
                hash = skb->sk->sk_hash;
-       else
+       else
                hash = skb->protocol;
 
        hash = jhash_1word(hash, skb_tx_hashrnd);
@@ -2328,8 +2334,10 @@ static int napi_gro_complete(struct sk_buff *skb)
        struct list_head *head = &ptype_base[ntohs(type) & PTYPE_HASH_MASK];
        int err = -ENOENT;
 
-       if (NAPI_GRO_CB(skb)->count == 1)
+       if (NAPI_GRO_CB(skb)->count == 1) {
+               skb_shinfo(skb)->gso_size = 0;
                goto out;
+       }
 
        rcu_read_lock();
        list_for_each_entry_rcu(ptype, head, list) {
@@ -2348,7 +2356,6 @@ static int napi_gro_complete(struct sk_buff *skb)
        }
 
 out:
-       skb_shinfo(skb)->gso_size = 0;
        return netif_receive_skb(skb);
 }
 
@@ -2372,18 +2379,13 @@ void *skb_gro_header(struct sk_buff *skb, unsigned int hlen)
        unsigned int offset = skb_gro_offset(skb);
 
        hlen += offset;
-       if (hlen <= skb_headlen(skb))
-               return skb->data + offset;
-
-       if (unlikely(!skb_shinfo(skb)->nr_frags ||
-                    skb_shinfo(skb)->frags[0].size <=
-                    hlen - skb_headlen(skb) ||
+       if (unlikely(skb_headlen(skb) ||
+                    skb_shinfo(skb)->frags[0].size < hlen ||
                     PageHighMem(skb_shinfo(skb)->frags[0].page)))
                return pskb_may_pull(skb, hlen) ? skb->data + offset : NULL;
 
        return page_address(skb_shinfo(skb)->frags[0].page) +
-              skb_shinfo(skb)->frags[0].page_offset +
-              offset - skb_headlen(skb);
+              skb_shinfo(skb)->frags[0].page_offset + offset;
 }
 EXPORT_SYMBOL(skb_gro_header);
 
@@ -2519,16 +2521,10 @@ void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
 }
 EXPORT_SYMBOL(napi_reuse_skb);
 
-struct sk_buff *napi_fraginfo_skb(struct napi_struct *napi,
-                                 struct napi_gro_fraginfo *info)
+struct sk_buff *napi_get_frags(struct napi_struct *napi)
 {
        struct net_device *dev = napi->dev;
        struct sk_buff *skb = napi->skb;
-       struct ethhdr *eth;
-       skb_frag_t *frag;
-       int i;
-
-       napi->skb = NULL;
 
        if (!skb) {
                skb = netdev_alloc_skb(dev, GRO_MAX_HEAD + NET_IP_ALIGN);
@@ -2536,47 +2532,14 @@ struct sk_buff *napi_fraginfo_skb(struct napi_struct *napi,
                        goto out;
 
                skb_reserve(skb, NET_IP_ALIGN);
-       }
-
-       BUG_ON(info->nr_frags > MAX_SKB_FRAGS);
-       frag = &info->frags[info->nr_frags - 1];
-
-       for (i = skb_shinfo(skb)->nr_frags; i < info->nr_frags; i++) {
-               skb_fill_page_desc(skb, i, frag->page, frag->page_offset,
-                                  frag->size);
-               frag++;
-       }
-       skb_shinfo(skb)->nr_frags = info->nr_frags;
-
-       skb->data_len = info->len;
-       skb->len += info->len;
-       skb->truesize += info->len;
-
-       skb_reset_mac_header(skb);
-       skb_gro_reset_offset(skb);
 
-       eth = skb_gro_header(skb, sizeof(*eth));
-       if (!eth) {
-               napi_reuse_skb(napi, skb);
-               skb = NULL;
-               goto out;
+               napi->skb = skb;
        }
 
-       skb_gro_pull(skb, sizeof(*eth));
-
-       /*
-        * This works because the only protocols we care about don't require
-        * special handling.  We'll fix it up properly at the end.
-        */
-       skb->protocol = eth->h_proto;
-
-       skb->ip_summed = info->ip_summed;
-       skb->csum = info->csum;
-
 out:
        return skb;
 }
-EXPORT_SYMBOL(napi_fraginfo_skb);
+EXPORT_SYMBOL(napi_get_frags);
 
 int napi_frags_finish(struct napi_struct *napi, struct sk_buff *skb, int ret)
 {
@@ -2606,9 +2569,39 @@ int napi_frags_finish(struct napi_struct *napi, struct sk_buff *skb, int ret)
 }
 EXPORT_SYMBOL(napi_frags_finish);
 
-int napi_gro_frags(struct napi_struct *napi, struct napi_gro_fraginfo *info)
+struct sk_buff *napi_frags_skb(struct napi_struct *napi)
+{
+       struct sk_buff *skb = napi->skb;
+       struct ethhdr *eth;
+
+       napi->skb = NULL;
+
+       skb_reset_mac_header(skb);
+       skb_gro_reset_offset(skb);
+
+       eth = skb_gro_header(skb, sizeof(*eth));
+       if (!eth) {
+               napi_reuse_skb(napi, skb);
+               skb = NULL;
+               goto out;
+       }
+
+       skb_gro_pull(skb, sizeof(*eth));
+
+       /*
+        * This works because the only protocols we care about don't require
+        * special handling.  We'll fix it up properly at the end.
+        */
+       skb->protocol = eth->h_proto;
+
+out:
+       return skb;
+}
+EXPORT_SYMBOL(napi_frags_skb);
+
+int napi_gro_frags(struct napi_struct *napi)
 {
-       struct sk_buff *skb = napi_fraginfo_skb(napi, info);
+       struct sk_buff *skb = napi_frags_skb(napi);
 
        if (!skb)
                return NET_RX_DROP;
@@ -2712,7 +2705,7 @@ void netif_napi_del(struct napi_struct *napi)
        struct sk_buff *skb, *next;
 
        list_del_init(&napi->dev_list);
-       kfree_skb(napi->skb);
+       napi_free_frags(napi);
 
        for (skb = napi->gro_list; skb; skb = next) {
                next = skb->next;
@@ -4399,7 +4392,7 @@ int register_netdevice(struct net_device *dev)
        dev->iflink = -1;
 
 #ifdef CONFIG_COMPAT_NET_DEV_OPS
-       /* Netdevice_ops API compatiability support.
+       /* Netdevice_ops API compatibility support.
         * This is temporary until all network devices are converted.
         */
        if (dev->netdev_ops) {
@@ -4410,7 +4403,7 @@ int register_netdevice(struct net_device *dev)
                        dev->name, netdev_drivername(dev, drivername, 64));
 
                /* This works only because net_device_ops and the
-                  compatiablity structure are the same. */
+                  compatibility structure are the same. */
                dev->netdev_ops = (void *) &(dev->init);
        }
 #endif
This page took 0.029503 seconds and 5 git commands to generate.