diff options
73 files changed, 746 insertions, 232 deletions
diff --git a/Documentation/networking/tuntap.txt b/Documentation/networking/tuntap.txt index 76750fb9151a..839cbb71388b 100644 --- a/Documentation/networking/tuntap.txt +++ b/Documentation/networking/tuntap.txt | |||
@@ -39,10 +39,13 @@ Copyright (C) 1999-2000 Maxim Krasnyansky <max_mk@yahoo.com> | |||
39 | mknod /dev/net/tun c 10 200 | 39 | mknod /dev/net/tun c 10 200 |
40 | 40 | ||
41 | Set permissions: | 41 | Set permissions: |
42 | e.g. chmod 0700 /dev/net/tun | 42 | e.g. chmod 0666 /dev/net/tun |
43 | if you want the device only accessible by root. Giving regular users the | 43 | There's no harm in allowing the device to be accessible by non-root users, |
44 | right to assign network devices is NOT a good idea. Users could assign | 44 | since CAP_NET_ADMIN is required for creating network devices or for |
45 | bogus network interfaces to trick firewalls or administrators. | 45 | connecting to network devices which aren't owned by the user in question. |
46 | If you want to create persistent devices and give ownership of them to | ||
47 | unprivileged users, then you need the /dev/net/tun device to be usable by | ||
48 | those users. | ||
46 | 49 | ||
47 | Driver module autoloading | 50 | Driver module autoloading |
48 | 51 | ||
diff --git a/drivers/net/3c527.c b/drivers/net/3c527.c index 1b1cb0026072..157eda573925 100644 --- a/drivers/net/3c527.c +++ b/drivers/net/3c527.c | |||
@@ -1031,8 +1031,7 @@ static int mc32_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
1031 | return 1; | 1031 | return 1; |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | skb = skb_padto(skb, ETH_ZLEN); | 1034 | if (skb_padto(skb, ETH_ZLEN)) { |
1035 | if (skb == NULL) { | ||
1036 | netif_wake_queue(dev); | 1035 | netif_wake_queue(dev); |
1037 | return 0; | 1036 | return 0; |
1038 | } | 1037 | } |
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index a26077a175ad..0cdc830449d8 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c | |||
@@ -797,7 +797,7 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev) | |||
797 | entry = cp->tx_head; | 797 | entry = cp->tx_head; |
798 | eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0; | 798 | eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0; |
799 | if (dev->features & NETIF_F_TSO) | 799 | if (dev->features & NETIF_F_TSO) |
800 | mss = skb_shinfo(skb)->tso_size; | 800 | mss = skb_shinfo(skb)->gso_size; |
801 | 801 | ||
802 | if (skb_shinfo(skb)->nr_frags == 0) { | 802 | if (skb_shinfo(skb)->nr_frags == 0) { |
803 | struct cp_desc *txd = &cp->tx_ring[entry]; | 803 | struct cp_desc *txd = &cp->tx_ring[entry]; |
diff --git a/drivers/net/82596.c b/drivers/net/82596.c index da0c878dcba8..8a9f7d61b9b1 100644 --- a/drivers/net/82596.c +++ b/drivers/net/82596.c | |||
@@ -1070,8 +1070,7 @@ static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1070 | skb->len, (unsigned int)skb->data)); | 1070 | skb->len, (unsigned int)skb->data)); |
1071 | 1071 | ||
1072 | if (skb->len < ETH_ZLEN) { | 1072 | if (skb->len < ETH_ZLEN) { |
1073 | skb = skb_padto(skb, ETH_ZLEN); | 1073 | if (skb_padto(skb, ETH_ZLEN)) |
1074 | if (skb == NULL) | ||
1075 | return 0; | 1074 | return 0; |
1076 | length = ETH_ZLEN; | 1075 | length = ETH_ZLEN; |
1077 | } | 1076 | } |
diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c index 79bb56b8dcef..71165ac0257a 100644 --- a/drivers/net/a2065.c +++ b/drivers/net/a2065.c | |||
@@ -573,8 +573,7 @@ static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev) | |||
573 | 573 | ||
574 | if (len < ETH_ZLEN) { | 574 | if (len < ETH_ZLEN) { |
575 | len = ETH_ZLEN; | 575 | len = ETH_ZLEN; |
576 | skb = skb_padto(skb, ETH_ZLEN); | 576 | if (skb_padto(skb, ETH_ZLEN)) |
577 | if (skb == NULL) | ||
578 | return 0; | 577 | return 0; |
579 | } | 578 | } |
580 | 579 | ||
diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c index d1b6b1f794e2..a9bb7a4aff98 100644 --- a/drivers/net/ariadne.c +++ b/drivers/net/ariadne.c | |||
@@ -607,8 +607,7 @@ static int ariadne_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
607 | /* FIXME: is the 79C960 new enough to do its own padding right ? */ | 607 | /* FIXME: is the 79C960 new enough to do its own padding right ? */ |
608 | if (skb->len < ETH_ZLEN) | 608 | if (skb->len < ETH_ZLEN) |
609 | { | 609 | { |
610 | skb = skb_padto(skb, ETH_ZLEN); | 610 | if (skb_padto(skb, ETH_ZLEN)) |
611 | if (skb == NULL) | ||
612 | return 0; | 611 | return 0; |
613 | len = ETH_ZLEN; | 612 | len = ETH_ZLEN; |
614 | } | 613 | } |
diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c index 36475eb2727f..312955d07b28 100644 --- a/drivers/net/arm/ether1.c +++ b/drivers/net/arm/ether1.c | |||
@@ -700,8 +700,7 @@ ether1_sendpacket (struct sk_buff *skb, struct net_device *dev) | |||
700 | } | 700 | } |
701 | 701 | ||
702 | if (skb->len < ETH_ZLEN) { | 702 | if (skb->len < ETH_ZLEN) { |
703 | skb = skb_padto(skb, ETH_ZLEN); | 703 | if (skb_padto(skb, ETH_ZLEN)) |
704 | if (skb == NULL) | ||
705 | goto out; | 704 | goto out; |
706 | } | 705 | } |
707 | 706 | ||
diff --git a/drivers/net/arm/ether3.c b/drivers/net/arm/ether3.c index f1d5b1027ff7..081074180e62 100644 --- a/drivers/net/arm/ether3.c +++ b/drivers/net/arm/ether3.c | |||
@@ -518,8 +518,7 @@ ether3_sendpacket(struct sk_buff *skb, struct net_device *dev) | |||
518 | 518 | ||
519 | length = (length + 1) & ~1; | 519 | length = (length + 1) & ~1; |
520 | if (length != skb->len) { | 520 | if (length != skb->len) { |
521 | skb = skb_padto(skb, length); | 521 | if (skb_padto(skb, length)) |
522 | if (skb == NULL) | ||
523 | goto out; | 522 | goto out; |
524 | } | 523 | } |
525 | 524 | ||
diff --git a/drivers/net/atarilance.c b/drivers/net/atarilance.c index 442b2cbeb58a..91783a8008be 100644 --- a/drivers/net/atarilance.c +++ b/drivers/net/atarilance.c | |||
@@ -804,8 +804,7 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev ) | |||
804 | ++len; | 804 | ++len; |
805 | 805 | ||
806 | if (len > skb->len) { | 806 | if (len > skb->len) { |
807 | skb = skb_padto(skb, len); | 807 | if (skb_padto(skb, len)) |
808 | if (skb == NULL) | ||
809 | return 0; | 808 | return 0; |
810 | } | 809 | } |
811 | 810 | ||
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 702d546567ad..7635736cc791 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -1640,7 +1640,7 @@ bnx2_tx_int(struct bnx2 *bp) | |||
1640 | skb = tx_buf->skb; | 1640 | skb = tx_buf->skb; |
1641 | #ifdef BCM_TSO | 1641 | #ifdef BCM_TSO |
1642 | /* partial BD completions possible with TSO packets */ | 1642 | /* partial BD completions possible with TSO packets */ |
1643 | if (skb_shinfo(skb)->tso_size) { | 1643 | if (skb_shinfo(skb)->gso_size) { |
1644 | u16 last_idx, last_ring_idx; | 1644 | u16 last_idx, last_ring_idx; |
1645 | 1645 | ||
1646 | last_idx = sw_cons + | 1646 | last_idx = sw_cons + |
@@ -4428,7 +4428,7 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4428 | (TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get(skb) << 16)); | 4428 | (TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get(skb) << 16)); |
4429 | } | 4429 | } |
4430 | #ifdef BCM_TSO | 4430 | #ifdef BCM_TSO |
4431 | if ((mss = skb_shinfo(skb)->tso_size) && | 4431 | if ((mss = skb_shinfo(skb)->gso_size) && |
4432 | (skb->len > (bp->dev->mtu + ETH_HLEN))) { | 4432 | (skb->len > (bp->dev->mtu + ETH_HLEN))) { |
4433 | u32 tcp_opt_len, ip_tcp_len; | 4433 | u32 tcp_opt_len, ip_tcp_len; |
4434 | 4434 | ||
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index 39f36aa05aa8..565a54f1d06a 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c | |||
@@ -2915,8 +2915,7 @@ static int cas_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2915 | */ | 2915 | */ |
2916 | static int ring; | 2916 | static int ring; |
2917 | 2917 | ||
2918 | skb = skb_padto(skb, cp->min_frame_size); | 2918 | if (skb_padto(skb, cp->min_frame_size)) |
2919 | if (!skb) | ||
2920 | return 0; | 2919 | return 0; |
2921 | 2920 | ||
2922 | /* XXX: we need some higher-level QoS hooks to steer packets to | 2921 | /* XXX: we need some higher-level QoS hooks to steer packets to |
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c index 4391bf4bf573..53efff6da784 100644 --- a/drivers/net/chelsio/sge.c +++ b/drivers/net/chelsio/sge.c | |||
@@ -1418,7 +1418,7 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1418 | struct cpl_tx_pkt *cpl; | 1418 | struct cpl_tx_pkt *cpl; |
1419 | 1419 | ||
1420 | #ifdef NETIF_F_TSO | 1420 | #ifdef NETIF_F_TSO |
1421 | if (skb_shinfo(skb)->tso_size) { | 1421 | if (skb_shinfo(skb)->gso_size) { |
1422 | int eth_type; | 1422 | int eth_type; |
1423 | struct cpl_tx_pkt_lso *hdr; | 1423 | struct cpl_tx_pkt_lso *hdr; |
1424 | 1424 | ||
@@ -1433,7 +1433,7 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1433 | hdr->ip_hdr_words = skb->nh.iph->ihl; | 1433 | hdr->ip_hdr_words = skb->nh.iph->ihl; |
1434 | hdr->tcp_hdr_words = skb->h.th->doff; | 1434 | hdr->tcp_hdr_words = skb->h.th->doff; |
1435 | hdr->eth_type_mss = htons(MK_ETH_TYPE_MSS(eth_type, | 1435 | hdr->eth_type_mss = htons(MK_ETH_TYPE_MSS(eth_type, |
1436 | skb_shinfo(skb)->tso_size)); | 1436 | skb_shinfo(skb)->gso_size)); |
1437 | hdr->len = htonl(skb->len - sizeof(*hdr)); | 1437 | hdr->len = htonl(skb->len - sizeof(*hdr)); |
1438 | cpl = (struct cpl_tx_pkt *)hdr; | 1438 | cpl = (struct cpl_tx_pkt *)hdr; |
1439 | sge->stats.tx_lso_pkts++; | 1439 | sge->stats.tx_lso_pkts++; |
diff --git a/drivers/net/declance.c b/drivers/net/declance.c index f130bdab3fd3..d3d958e7ac56 100644 --- a/drivers/net/declance.c +++ b/drivers/net/declance.c | |||
@@ -885,8 +885,7 @@ static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
885 | len = skblen; | 885 | len = skblen; |
886 | 886 | ||
887 | if (len < ETH_ZLEN) { | 887 | if (len < ETH_ZLEN) { |
888 | skb = skb_padto(skb, ETH_ZLEN); | 888 | if (skb_padto(skb, ETH_ZLEN)) |
889 | if (skb == NULL) | ||
890 | return 0; | 889 | return 0; |
891 | len = ETH_ZLEN; | 890 | len = ETH_ZLEN; |
892 | } | 891 | } |
diff --git a/drivers/net/depca.c b/drivers/net/depca.c index 0941d40f046f..e946c43d3b10 100644 --- a/drivers/net/depca.c +++ b/drivers/net/depca.c | |||
@@ -938,11 +938,8 @@ static int depca_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
938 | if (skb->len < 1) | 938 | if (skb->len < 1) |
939 | goto out; | 939 | goto out; |
940 | 940 | ||
941 | if (skb->len < ETH_ZLEN) { | 941 | if (skb_padto(skb, ETH_ZLEN)) |
942 | skb = skb_padto(skb, ETH_ZLEN); | 942 | goto out; |
943 | if (skb == NULL) | ||
944 | goto out; | ||
945 | } | ||
946 | 943 | ||
947 | netif_stop_queue(dev); | 944 | netif_stop_queue(dev); |
948 | 945 | ||
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index a373ccb308d8..32b7d444b374 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -2394,7 +2394,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2394 | uint8_t ipcss, ipcso, tucss, tucso, hdr_len; | 2394 | uint8_t ipcss, ipcso, tucss, tucso, hdr_len; |
2395 | int err; | 2395 | int err; |
2396 | 2396 | ||
2397 | if (skb_shinfo(skb)->tso_size) { | 2397 | if (skb_shinfo(skb)->gso_size) { |
2398 | if (skb_header_cloned(skb)) { | 2398 | if (skb_header_cloned(skb)) { |
2399 | err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); | 2399 | err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); |
2400 | if (err) | 2400 | if (err) |
@@ -2402,7 +2402,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2402 | } | 2402 | } |
2403 | 2403 | ||
2404 | hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); | 2404 | hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); |
2405 | mss = skb_shinfo(skb)->tso_size; | 2405 | mss = skb_shinfo(skb)->gso_size; |
2406 | if (skb->protocol == htons(ETH_P_IP)) { | 2406 | if (skb->protocol == htons(ETH_P_IP)) { |
2407 | skb->nh.iph->tot_len = 0; | 2407 | skb->nh.iph->tot_len = 0; |
2408 | skb->nh.iph->check = 0; | 2408 | skb->nh.iph->check = 0; |
@@ -2519,7 +2519,7 @@ e1000_tx_map(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2519 | * tso gets written back prematurely before the data is fully | 2519 | * tso gets written back prematurely before the data is fully |
2520 | * DMA'd to the controller */ | 2520 | * DMA'd to the controller */ |
2521 | if (!skb->data_len && tx_ring->last_tx_tso && | 2521 | if (!skb->data_len && tx_ring->last_tx_tso && |
2522 | !skb_shinfo(skb)->tso_size) { | 2522 | !skb_shinfo(skb)->gso_size) { |
2523 | tx_ring->last_tx_tso = 0; | 2523 | tx_ring->last_tx_tso = 0; |
2524 | size -= 4; | 2524 | size -= 4; |
2525 | } | 2525 | } |
@@ -2757,7 +2757,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2757 | } | 2757 | } |
2758 | 2758 | ||
2759 | #ifdef NETIF_F_TSO | 2759 | #ifdef NETIF_F_TSO |
2760 | mss = skb_shinfo(skb)->tso_size; | 2760 | mss = skb_shinfo(skb)->gso_size; |
2761 | /* The controller does a simple calculation to | 2761 | /* The controller does a simple calculation to |
2762 | * make sure there is enough room in the FIFO before | 2762 | * make sure there is enough room in the FIFO before |
2763 | * initiating the DMA for each buffer. The calc is: | 2763 | * initiating the DMA for each buffer. The calc is: |
@@ -2807,7 +2807,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2807 | #ifdef NETIF_F_TSO | 2807 | #ifdef NETIF_F_TSO |
2808 | /* Controller Erratum workaround */ | 2808 | /* Controller Erratum workaround */ |
2809 | if (!skb->data_len && tx_ring->last_tx_tso && | 2809 | if (!skb->data_len && tx_ring->last_tx_tso && |
2810 | !skb_shinfo(skb)->tso_size) | 2810 | !skb_shinfo(skb)->gso_size) |
2811 | count++; | 2811 | count++; |
2812 | #endif | 2812 | #endif |
2813 | 2813 | ||
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c index a806dfe54d23..e70f172699db 100644 --- a/drivers/net/eepro.c +++ b/drivers/net/eepro.c | |||
@@ -1154,8 +1154,7 @@ static int eepro_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
1154 | printk(KERN_DEBUG "%s: entering eepro_send_packet routine.\n", dev->name); | 1154 | printk(KERN_DEBUG "%s: entering eepro_send_packet routine.\n", dev->name); |
1155 | 1155 | ||
1156 | if (length < ETH_ZLEN) { | 1156 | if (length < ETH_ZLEN) { |
1157 | skb = skb_padto(skb, ETH_ZLEN); | 1157 | if (skb_padto(skb, ETH_ZLEN)) |
1158 | if (skb == NULL) | ||
1159 | return 0; | 1158 | return 0; |
1160 | length = ETH_ZLEN; | 1159 | length = ETH_ZLEN; |
1161 | } | 1160 | } |
diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c index 82bd356e4f3a..a74b20715755 100644 --- a/drivers/net/eexpress.c +++ b/drivers/net/eexpress.c | |||
@@ -677,8 +677,7 @@ static int eexp_xmit(struct sk_buff *buf, struct net_device *dev) | |||
677 | #endif | 677 | #endif |
678 | 678 | ||
679 | if (buf->len < ETH_ZLEN) { | 679 | if (buf->len < ETH_ZLEN) { |
680 | buf = skb_padto(buf, ETH_ZLEN); | 680 | if (skb_padto(buf, ETH_ZLEN)) |
681 | if (buf == NULL) | ||
682 | return 0; | 681 | return 0; |
683 | length = ETH_ZLEN; | 682 | length = ETH_ZLEN; |
684 | } | 683 | } |
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c index 8d680ce600d7..724d7dc35fa3 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c | |||
@@ -1027,11 +1027,8 @@ static int epic_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1027 | u32 ctrl_word; | 1027 | u32 ctrl_word; |
1028 | unsigned long flags; | 1028 | unsigned long flags; |
1029 | 1029 | ||
1030 | if (skb->len < ETH_ZLEN) { | 1030 | if (skb_padto(skb, ETH_ZLEN)) |
1031 | skb = skb_padto(skb, ETH_ZLEN); | 1031 | return 0; |
1032 | if (skb == NULL) | ||
1033 | return 0; | ||
1034 | } | ||
1035 | 1032 | ||
1036 | /* Caution: the write order is important here, set the field with the | 1033 | /* Caution: the write order is important here, set the field with the |
1037 | "ownership" bit last. */ | 1034 | "ownership" bit last. */ |
diff --git a/drivers/net/eth16i.c b/drivers/net/eth16i.c index b67545be2caa..4bf76f86d8e9 100644 --- a/drivers/net/eth16i.c +++ b/drivers/net/eth16i.c | |||
@@ -1064,8 +1064,7 @@ static int eth16i_tx(struct sk_buff *skb, struct net_device *dev) | |||
1064 | unsigned long flags; | 1064 | unsigned long flags; |
1065 | 1065 | ||
1066 | if (length < ETH_ZLEN) { | 1066 | if (length < ETH_ZLEN) { |
1067 | skb = skb_padto(skb, ETH_ZLEN); | 1067 | if (skb_padto(skb, ETH_ZLEN)) |
1068 | if (skb == NULL) | ||
1069 | return 0; | 1068 | return 0; |
1070 | length = ETH_ZLEN; | 1069 | length = ETH_ZLEN; |
1071 | } | 1070 | } |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 191383d461d7..21be4fa071b5 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -1495,8 +1495,8 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1495 | np->tx_skbuff[nr] = skb; | 1495 | np->tx_skbuff[nr] = skb; |
1496 | 1496 | ||
1497 | #ifdef NETIF_F_TSO | 1497 | #ifdef NETIF_F_TSO |
1498 | if (skb_shinfo(skb)->tso_size) | 1498 | if (skb_shinfo(skb)->gso_size) |
1499 | tx_flags_extra = NV_TX2_TSO | (skb_shinfo(skb)->tso_size << NV_TX2_TSO_SHIFT); | 1499 | tx_flags_extra = NV_TX2_TSO | (skb_shinfo(skb)->gso_size << NV_TX2_TSO_SHIFT); |
1500 | else | 1500 | else |
1501 | #endif | 1501 | #endif |
1502 | tx_flags_extra = (skb->ip_summed == CHECKSUM_HW ? (NV_TX2_CHECKSUM_L3|NV_TX2_CHECKSUM_L4) : 0); | 1502 | tx_flags_extra = (skb->ip_summed == CHECKSUM_HW ? (NV_TX2_CHECKSUM_L3|NV_TX2_CHECKSUM_L4) : 0); |
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index 247c8ca86033..dd1dc32dc98d 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c | |||
@@ -1487,11 +1487,8 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev) | |||
1487 | if (skb->len <= 0) | 1487 | if (skb->len <= 0) |
1488 | return 0; | 1488 | return 0; |
1489 | 1489 | ||
1490 | if (skb->len < ETH_ZLEN && lp->chip == HP100_CHIPID_SHASTA) { | 1490 | if (lp->chip == HP100_CHIPID_SHASTA && skb_padto(skb, ETH_ZLEN)) |
1491 | skb = skb_padto(skb, ETH_ZLEN); | 1491 | return 0; |
1492 | if (skb == NULL) | ||
1493 | return 0; | ||
1494 | } | ||
1495 | 1492 | ||
1496 | /* Get Tx ring tail pointer */ | 1493 | /* Get Tx ring tail pointer */ |
1497 | if (lp->txrtail->next == lp->txrhead) { | 1494 | if (lp->txrtail->next == lp->txrhead) { |
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index 57006fb8840e..8bb32f946993 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -1173,7 +1173,7 @@ ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb) | |||
1173 | uint16_t ipcse, tucse, mss; | 1173 | uint16_t ipcse, tucse, mss; |
1174 | int err; | 1174 | int err; |
1175 | 1175 | ||
1176 | if(likely(skb_shinfo(skb)->tso_size)) { | 1176 | if(likely(skb_shinfo(skb)->gso_size)) { |
1177 | if (skb_header_cloned(skb)) { | 1177 | if (skb_header_cloned(skb)) { |
1178 | err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); | 1178 | err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); |
1179 | if (err) | 1179 | if (err) |
@@ -1181,7 +1181,7 @@ ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb) | |||
1181 | } | 1181 | } |
1182 | 1182 | ||
1183 | hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); | 1183 | hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); |
1184 | mss = skb_shinfo(skb)->tso_size; | 1184 | mss = skb_shinfo(skb)->gso_size; |
1185 | skb->nh.iph->tot_len = 0; | 1185 | skb->nh.iph->tot_len = 0; |
1186 | skb->nh.iph->check = 0; | 1186 | skb->nh.iph->check = 0; |
1187 | skb->h.th->check = ~csum_tcpudp_magic(skb->nh.iph->saddr, | 1187 | skb->h.th->check = ~csum_tcpudp_magic(skb->nh.iph->saddr, |
diff --git a/drivers/net/lance.c b/drivers/net/lance.c index bb5ad479210b..c1c3452c90ca 100644 --- a/drivers/net/lance.c +++ b/drivers/net/lance.c | |||
@@ -968,8 +968,7 @@ static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
968 | /* The old LANCE chips doesn't automatically pad buffers to min. size. */ | 968 | /* The old LANCE chips doesn't automatically pad buffers to min. size. */ |
969 | if (chip_table[lp->chip_version].flags & LANCE_MUST_PAD) { | 969 | if (chip_table[lp->chip_version].flags & LANCE_MUST_PAD) { |
970 | if (skb->len < ETH_ZLEN) { | 970 | if (skb->len < ETH_ZLEN) { |
971 | skb = skb_padto(skb, ETH_ZLEN); | 971 | if (skb_padto(skb, ETH_ZLEN)) |
972 | if (skb == NULL) | ||
973 | goto out; | 972 | goto out; |
974 | lp->tx_ring[entry].length = -ETH_ZLEN; | 973 | lp->tx_ring[entry].length = -ETH_ZLEN; |
975 | } | 974 | } |
diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c index 957888de3d7e..1ab09447baa5 100644 --- a/drivers/net/lasi_82596.c +++ b/drivers/net/lasi_82596.c | |||
@@ -1083,8 +1083,7 @@ static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1083 | skb->len, skb->data)); | 1083 | skb->len, skb->data)); |
1084 | 1084 | ||
1085 | if (length < ETH_ZLEN) { | 1085 | if (length < ETH_ZLEN) { |
1086 | skb = skb_padto(skb, ETH_ZLEN); | 1086 | if (skb_padto(skb, ETH_ZLEN)) |
1087 | if (skb == NULL) | ||
1088 | return 0; | 1087 | return 0; |
1089 | length = ETH_ZLEN; | 1088 | length = ETH_ZLEN; |
1090 | } | 1089 | } |
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index b79d6e8d3045..43fef7de8cb9 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
@@ -74,7 +74,7 @@ static void emulate_large_send_offload(struct sk_buff *skb) | |||
74 | struct iphdr *iph = skb->nh.iph; | 74 | struct iphdr *iph = skb->nh.iph; |
75 | struct tcphdr *th = (struct tcphdr*)(skb->nh.raw + (iph->ihl * 4)); | 75 | struct tcphdr *th = (struct tcphdr*)(skb->nh.raw + (iph->ihl * 4)); |
76 | unsigned int doffset = (iph->ihl + th->doff) * 4; | 76 | unsigned int doffset = (iph->ihl + th->doff) * 4; |
77 | unsigned int mtu = skb_shinfo(skb)->tso_size + doffset; | 77 | unsigned int mtu = skb_shinfo(skb)->gso_size + doffset; |
78 | unsigned int offset = 0; | 78 | unsigned int offset = 0; |
79 | u32 seq = ntohl(th->seq); | 79 | u32 seq = ntohl(th->seq); |
80 | u16 id = ntohs(iph->id); | 80 | u16 id = ntohs(iph->id); |
@@ -139,7 +139,7 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev) | |||
139 | #endif | 139 | #endif |
140 | 140 | ||
141 | #ifdef LOOPBACK_TSO | 141 | #ifdef LOOPBACK_TSO |
142 | if (skb_shinfo(skb)->tso_size) { | 142 | if (skb_shinfo(skb)->gso_size) { |
143 | BUG_ON(skb->protocol != htons(ETH_P_IP)); | 143 | BUG_ON(skb->protocol != htons(ETH_P_IP)); |
144 | BUG_ON(skb->nh.iph->protocol != IPPROTO_TCP); | 144 | BUG_ON(skb->nh.iph->protocol != IPPROTO_TCP); |
145 | 145 | ||
diff --git a/drivers/net/lp486e.c b/drivers/net/lp486e.c index 94d5ea1ce8bd..bf3f343ae715 100644 --- a/drivers/net/lp486e.c +++ b/drivers/net/lp486e.c | |||
@@ -877,8 +877,7 @@ static int i596_start_xmit (struct sk_buff *skb, struct net_device *dev) { | |||
877 | length = skb->len; | 877 | length = skb->len; |
878 | 878 | ||
879 | if (length < ETH_ZLEN) { | 879 | if (length < ETH_ZLEN) { |
880 | skb = skb_padto(skb, ETH_ZLEN); | 880 | if (skb_padto(skb, ETH_ZLEN)) |
881 | if (skb == NULL) | ||
882 | return 0; | 881 | return 0; |
883 | length = ETH_ZLEN; | 882 | length = ETH_ZLEN; |
884 | } | 883 | } |
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index 5a74f63618bc..dbdf189436fa 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -1879,7 +1879,7 @@ again: | |||
1879 | 1879 | ||
1880 | #ifdef NETIF_F_TSO | 1880 | #ifdef NETIF_F_TSO |
1881 | if (skb->len > (dev->mtu + ETH_HLEN)) { | 1881 | if (skb->len > (dev->mtu + ETH_HLEN)) { |
1882 | mss = skb_shinfo(skb)->tso_size; | 1882 | mss = skb_shinfo(skb)->gso_size; |
1883 | if (mss != 0) | 1883 | if (mss != 0) |
1884 | max_segments = MYRI10GE_MAX_SEND_DESC_TSO; | 1884 | max_segments = MYRI10GE_MAX_SEND_DESC_TSO; |
1885 | } | 1885 | } |
@@ -1939,8 +1939,7 @@ again: | |||
1939 | 1939 | ||
1940 | /* pad frames to at least ETH_ZLEN bytes */ | 1940 | /* pad frames to at least ETH_ZLEN bytes */ |
1941 | if (unlikely(skb->len < ETH_ZLEN)) { | 1941 | if (unlikely(skb->len < ETH_ZLEN)) { |
1942 | skb = skb_padto(skb, ETH_ZLEN); | 1942 | if (skb_padto(skb, ETH_ZLEN)) { |
1943 | if (skb == NULL) { | ||
1944 | /* The packet is gone, so we must | 1943 | /* The packet is gone, so we must |
1945 | * return 0 */ | 1944 | * return 0 */ |
1946 | mgp->stats.tx_dropped += 1; | 1945 | mgp->stats.tx_dropped += 1; |
@@ -2113,7 +2112,7 @@ abort_linearize: | |||
2113 | } | 2112 | } |
2114 | idx = (idx + 1) & tx->mask; | 2113 | idx = (idx + 1) & tx->mask; |
2115 | } while (idx != last_idx); | 2114 | } while (idx != last_idx); |
2116 | if (skb_shinfo(skb)->tso_size) { | 2115 | if (skb_shinfo(skb)->gso_size) { |
2117 | printk(KERN_ERR | 2116 | printk(KERN_ERR |
2118 | "myri10ge: %s: TSO but wanted to linearize?!?!?\n", | 2117 | "myri10ge: %s: TSO but wanted to linearize?!?!?\n", |
2119 | mgp->dev->name); | 2118 | mgp->dev->name); |
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 09b11761cdfa..ea93b8f18605 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c | |||
@@ -831,8 +831,7 @@ static int fjn_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
831 | 831 | ||
832 | if (length < ETH_ZLEN) | 832 | if (length < ETH_ZLEN) |
833 | { | 833 | { |
834 | skb = skb_padto(skb, ETH_ZLEN); | 834 | if (skb_padto(skb, ETH_ZLEN)) |
835 | if (skb == NULL) | ||
836 | return 0; | 835 | return 0; |
837 | length = ETH_ZLEN; | 836 | length = ETH_ZLEN; |
838 | } | 837 | } |
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index e80d1e3aec68..9bae77ce1314 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
@@ -1374,8 +1374,7 @@ do_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1374 | */ | 1374 | */ |
1375 | if (pktlen < ETH_ZLEN) | 1375 | if (pktlen < ETH_ZLEN) |
1376 | { | 1376 | { |
1377 | skb = skb_padto(skb, ETH_ZLEN); | 1377 | if (skb_padto(skb, ETH_ZLEN)) |
1378 | if (skb == NULL) | ||
1379 | return 0; | 1378 | return 0; |
1380 | pktlen = ETH_ZLEN; | 1379 | pktlen = ETH_ZLEN; |
1381 | } | 1380 | } |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 9945cc6b8d90..12d1cb289bb0 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -2172,7 +2172,7 @@ static int rtl8169_xmit_frags(struct rtl8169_private *tp, struct sk_buff *skb, | |||
2172 | static inline u32 rtl8169_tso_csum(struct sk_buff *skb, struct net_device *dev) | 2172 | static inline u32 rtl8169_tso_csum(struct sk_buff *skb, struct net_device *dev) |
2173 | { | 2173 | { |
2174 | if (dev->features & NETIF_F_TSO) { | 2174 | if (dev->features & NETIF_F_TSO) { |
2175 | u32 mss = skb_shinfo(skb)->tso_size; | 2175 | u32 mss = skb_shinfo(skb)->gso_size; |
2176 | 2176 | ||
2177 | if (mss) | 2177 | if (mss) |
2178 | return LargeSend | ((mss & MSSMask) << MSSShift); | 2178 | return LargeSend | ((mss & MSSMask) << MSSShift); |
@@ -2222,8 +2222,7 @@ static int rtl8169_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2222 | len = skb->len; | 2222 | len = skb->len; |
2223 | 2223 | ||
2224 | if (unlikely(len < ETH_ZLEN)) { | 2224 | if (unlikely(len < ETH_ZLEN)) { |
2225 | skb = skb_padto(skb, ETH_ZLEN); | 2225 | if (skb_padto(skb, ETH_ZLEN)) |
2226 | if (!skb) | ||
2227 | goto err_update_stats; | 2226 | goto err_update_stats; |
2228 | len = ETH_ZLEN; | 2227 | len = ETH_ZLEN; |
2229 | } | 2228 | } |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 11daed495b97..3defe5d4f7d3 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -3959,8 +3959,8 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3959 | txdp->Control_1 = 0; | 3959 | txdp->Control_1 = 0; |
3960 | txdp->Control_2 = 0; | 3960 | txdp->Control_2 = 0; |
3961 | #ifdef NETIF_F_TSO | 3961 | #ifdef NETIF_F_TSO |
3962 | mss = skb_shinfo(skb)->tso_size; | 3962 | mss = skb_shinfo(skb)->gso_size; |
3963 | if (mss) { | 3963 | if (skb_shinfo(skb)->gso_type == SKB_GSO_TCPV4) { |
3964 | txdp->Control_1 |= TXD_TCP_LSO_EN; | 3964 | txdp->Control_1 |= TXD_TCP_LSO_EN; |
3965 | txdp->Control_1 |= TXD_TCP_LSO_MSS(mss); | 3965 | txdp->Control_1 |= TXD_TCP_LSO_MSS(mss); |
3966 | } | 3966 | } |
@@ -3980,10 +3980,10 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3980 | } | 3980 | } |
3981 | 3981 | ||
3982 | frg_len = skb->len - skb->data_len; | 3982 | frg_len = skb->len - skb->data_len; |
3983 | if (skb_shinfo(skb)->ufo_size) { | 3983 | if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4) { |
3984 | int ufo_size; | 3984 | int ufo_size; |
3985 | 3985 | ||
3986 | ufo_size = skb_shinfo(skb)->ufo_size; | 3986 | ufo_size = skb_shinfo(skb)->gso_size; |
3987 | ufo_size &= ~7; | 3987 | ufo_size &= ~7; |
3988 | txdp->Control_1 |= TXD_UFO_EN; | 3988 | txdp->Control_1 |= TXD_UFO_EN; |
3989 | txdp->Control_1 |= TXD_UFO_MSS(ufo_size); | 3989 | txdp->Control_1 |= TXD_UFO_MSS(ufo_size); |
@@ -4009,7 +4009,7 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4009 | txdp->Host_Control = (unsigned long) skb; | 4009 | txdp->Host_Control = (unsigned long) skb; |
4010 | txdp->Control_1 |= TXD_BUFFER0_SIZE(frg_len); | 4010 | txdp->Control_1 |= TXD_BUFFER0_SIZE(frg_len); |
4011 | 4011 | ||
4012 | if (skb_shinfo(skb)->ufo_size) | 4012 | if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4) |
4013 | txdp->Control_1 |= TXD_UFO_EN; | 4013 | txdp->Control_1 |= TXD_UFO_EN; |
4014 | 4014 | ||
4015 | frg_cnt = skb_shinfo(skb)->nr_frags; | 4015 | frg_cnt = skb_shinfo(skb)->nr_frags; |
@@ -4024,12 +4024,12 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4024 | (sp->pdev, frag->page, frag->page_offset, | 4024 | (sp->pdev, frag->page, frag->page_offset, |
4025 | frag->size, PCI_DMA_TODEVICE); | 4025 | frag->size, PCI_DMA_TODEVICE); |
4026 | txdp->Control_1 = TXD_BUFFER0_SIZE(frag->size); | 4026 | txdp->Control_1 = TXD_BUFFER0_SIZE(frag->size); |
4027 | if (skb_shinfo(skb)->ufo_size) | 4027 | if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4) |
4028 | txdp->Control_1 |= TXD_UFO_EN; | 4028 | txdp->Control_1 |= TXD_UFO_EN; |
4029 | } | 4029 | } |
4030 | txdp->Control_1 |= TXD_GATHER_CODE_LAST; | 4030 | txdp->Control_1 |= TXD_GATHER_CODE_LAST; |
4031 | 4031 | ||
4032 | if (skb_shinfo(skb)->ufo_size) | 4032 | if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4) |
4033 | frg_cnt++; /* as Txd0 was used for inband header */ | 4033 | frg_cnt++; /* as Txd0 was used for inband header */ |
4034 | 4034 | ||
4035 | tx_fifo = mac_control->tx_FIFO_start[queue]; | 4035 | tx_fifo = mac_control->tx_FIFO_start[queue]; |
@@ -4043,7 +4043,7 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4043 | if (mss) | 4043 | if (mss) |
4044 | val64 |= TX_FIFO_SPECIAL_FUNC; | 4044 | val64 |= TX_FIFO_SPECIAL_FUNC; |
4045 | #endif | 4045 | #endif |
4046 | if (skb_shinfo(skb)->ufo_size) | 4046 | if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4) |
4047 | val64 |= TX_FIFO_SPECIAL_FUNC; | 4047 | val64 |= TX_FIFO_SPECIAL_FUNC; |
4048 | writeq(val64, &tx_fifo->List_Control); | 4048 | writeq(val64, &tx_fifo->List_Control); |
4049 | 4049 | ||
diff --git a/drivers/net/seeq8005.c b/drivers/net/seeq8005.c index bcef03feb2fc..efd0f235020f 100644 --- a/drivers/net/seeq8005.c +++ b/drivers/net/seeq8005.c | |||
@@ -396,8 +396,7 @@ static int seeq8005_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
396 | unsigned char *buf; | 396 | unsigned char *buf; |
397 | 397 | ||
398 | if (length < ETH_ZLEN) { | 398 | if (length < ETH_ZLEN) { |
399 | skb = skb_padto(skb, ETH_ZLEN); | 399 | if (skb_padto(skb, ETH_ZLEN)) |
400 | if (skb == NULL) | ||
401 | return 0; | 400 | return 0; |
402 | length = ETH_ZLEN; | 401 | length = ETH_ZLEN; |
403 | } | 402 | } |
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c index 31dd3f036fa8..df39f3447655 100644 --- a/drivers/net/sis190.c +++ b/drivers/net/sis190.c | |||
@@ -1156,8 +1156,7 @@ static int sis190_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1156 | dma_addr_t mapping; | 1156 | dma_addr_t mapping; |
1157 | 1157 | ||
1158 | if (unlikely(skb->len < ETH_ZLEN)) { | 1158 | if (unlikely(skb->len < ETH_ZLEN)) { |
1159 | skb = skb_padto(skb, ETH_ZLEN); | 1159 | if (skb_padto(skb, ETH_ZLEN)) { |
1160 | if (!skb) { | ||
1161 | tp->stats.tx_dropped++; | 1160 | tp->stats.tx_dropped++; |
1162 | goto out; | 1161 | goto out; |
1163 | } | 1162 | } |
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c index 38a26df4095f..f3efbd177ae7 100644 --- a/drivers/net/sk98lin/skge.c +++ b/drivers/net/sk98lin/skge.c | |||
@@ -1525,7 +1525,7 @@ struct sk_buff *pMessage) /* pointer to send-message */ | |||
1525 | ** This is to resolve faulty padding by the HW with 0xaa bytes. | 1525 | ** This is to resolve faulty padding by the HW with 0xaa bytes. |
1526 | */ | 1526 | */ |
1527 | if (BytesSend < C_LEN_ETHERNET_MINSIZE) { | 1527 | if (BytesSend < C_LEN_ETHERNET_MINSIZE) { |
1528 | if ((pMessage = skb_padto(pMessage, C_LEN_ETHERNET_MINSIZE)) == NULL) { | 1528 | if (skb_padto(pMessage, C_LEN_ETHERNET_MINSIZE)) { |
1529 | spin_unlock_irqrestore(&pTxPort->TxDesRingLock, Flags); | 1529 | spin_unlock_irqrestore(&pTxPort->TxDesRingLock, Flags); |
1530 | return 0; | 1530 | return 0; |
1531 | } | 1531 | } |
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 536dd1cf7f79..19a4a16055dc 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -2310,8 +2310,7 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev) | |||
2310 | u64 map; | 2310 | u64 map; |
2311 | unsigned long flags; | 2311 | unsigned long flags; |
2312 | 2312 | ||
2313 | skb = skb_padto(skb, ETH_ZLEN); | 2313 | if (skb_padto(skb, ETH_ZLEN)) |
2314 | if (!skb) | ||
2315 | return NETDEV_TX_OK; | 2314 | return NETDEV_TX_OK; |
2316 | 2315 | ||
2317 | if (!spin_trylock_irqsave(&skge->tx_lock, flags)) | 2316 | if (!spin_trylock_irqsave(&skge->tx_lock, flags)) |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index fba1e4d4d83d..d3577871be28 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -1160,7 +1160,7 @@ static unsigned tx_le_req(const struct sk_buff *skb) | |||
1160 | count = sizeof(dma_addr_t) / sizeof(u32); | 1160 | count = sizeof(dma_addr_t) / sizeof(u32); |
1161 | count += skb_shinfo(skb)->nr_frags * count; | 1161 | count += skb_shinfo(skb)->nr_frags * count; |
1162 | 1162 | ||
1163 | if (skb_shinfo(skb)->tso_size) | 1163 | if (skb_shinfo(skb)->gso_size) |
1164 | ++count; | 1164 | ++count; |
1165 | 1165 | ||
1166 | if (skb->ip_summed == CHECKSUM_HW) | 1166 | if (skb->ip_summed == CHECKSUM_HW) |
@@ -1232,7 +1232,7 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev) | |||
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | /* Check for TCP Segmentation Offload */ | 1234 | /* Check for TCP Segmentation Offload */ |
1235 | mss = skb_shinfo(skb)->tso_size; | 1235 | mss = skb_shinfo(skb)->gso_size; |
1236 | if (mss != 0) { | 1236 | if (mss != 0) { |
1237 | /* just drop the packet if non-linear expansion fails */ | 1237 | /* just drop the packet if non-linear expansion fails */ |
1238 | if (skb_header_cloned(skb) && | 1238 | if (skb_header_cloned(skb) && |
diff --git a/drivers/net/smc9194.c b/drivers/net/smc9194.c index 6cf16f322ad5..8b0321f1976c 100644 --- a/drivers/net/smc9194.c +++ b/drivers/net/smc9194.c | |||
@@ -523,8 +523,7 @@ static int smc_wait_to_send_packet( struct sk_buff * skb, struct net_device * de | |||
523 | length = skb->len; | 523 | length = skb->len; |
524 | 524 | ||
525 | if (length < ETH_ZLEN) { | 525 | if (length < ETH_ZLEN) { |
526 | skb = skb_padto(skb, ETH_ZLEN); | 526 | if (skb_padto(skb, ETH_ZLEN)) { |
527 | if (skb == NULL) { | ||
528 | netif_wake_queue(dev); | 527 | netif_wake_queue(dev); |
529 | return 0; | 528 | return 0; |
530 | } | 529 | } |
diff --git a/drivers/net/sonic.c b/drivers/net/sonic.c index 90b818a8de6e..cab0dd958492 100644 --- a/drivers/net/sonic.c +++ b/drivers/net/sonic.c | |||
@@ -231,8 +231,7 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
231 | 231 | ||
232 | length = skb->len; | 232 | length = skb->len; |
233 | if (length < ETH_ZLEN) { | 233 | if (length < ETH_ZLEN) { |
234 | skb = skb_padto(skb, ETH_ZLEN); | 234 | if (skb_padto(skb, ETH_ZLEN)) |
235 | if (skb == NULL) | ||
236 | return 0; | 235 | return 0; |
237 | length = ETH_ZLEN; | 236 | length = ETH_ZLEN; |
238 | } | 237 | } |
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c index 9b7805be21da..c158eedc7813 100644 --- a/drivers/net/starfire.c +++ b/drivers/net/starfire.c | |||
@@ -1349,8 +1349,7 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev) | |||
1349 | 1349 | ||
1350 | #if defined(ZEROCOPY) && defined(HAS_BROKEN_FIRMWARE) | 1350 | #if defined(ZEROCOPY) && defined(HAS_BROKEN_FIRMWARE) |
1351 | if (skb->ip_summed == CHECKSUM_HW) { | 1351 | if (skb->ip_summed == CHECKSUM_HW) { |
1352 | skb = skb_padto(skb, (skb->len + PADDING_MASK) & ~PADDING_MASK); | 1352 | if (skb_padto(skb, (skb->len + PADDING_MASK) & ~PADDING_MASK)) |
1353 | if (skb == NULL) | ||
1354 | return NETDEV_TX_OK; | 1353 | return NETDEV_TX_OK; |
1355 | } | 1354 | } |
1356 | #endif /* ZEROCOPY && HAS_BROKEN_FIRMWARE */ | 1355 | #endif /* ZEROCOPY && HAS_BROKEN_FIRMWARE */ |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index b2ddd4522a87..e3e380f90f86 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -3780,7 +3780,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3780 | #if TG3_TSO_SUPPORT != 0 | 3780 | #if TG3_TSO_SUPPORT != 0 |
3781 | mss = 0; | 3781 | mss = 0; |
3782 | if (skb->len > (tp->dev->mtu + ETH_HLEN) && | 3782 | if (skb->len > (tp->dev->mtu + ETH_HLEN) && |
3783 | (mss = skb_shinfo(skb)->tso_size) != 0) { | 3783 | (mss = skb_shinfo(skb)->gso_size) != 0) { |
3784 | int tcp_opt_len, ip_tcp_len; | 3784 | int tcp_opt_len, ip_tcp_len; |
3785 | 3785 | ||
3786 | if (skb_header_cloned(skb) && | 3786 | if (skb_header_cloned(skb) && |
@@ -3905,7 +3905,7 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev) | |||
3905 | #if TG3_TSO_SUPPORT != 0 | 3905 | #if TG3_TSO_SUPPORT != 0 |
3906 | mss = 0; | 3906 | mss = 0; |
3907 | if (skb->len > (tp->dev->mtu + ETH_HLEN) && | 3907 | if (skb->len > (tp->dev->mtu + ETH_HLEN) && |
3908 | (mss = skb_shinfo(skb)->tso_size) != 0) { | 3908 | (mss = skb_shinfo(skb)->gso_size) != 0) { |
3909 | int tcp_opt_len, ip_tcp_len; | 3909 | int tcp_opt_len, ip_tcp_len; |
3910 | 3910 | ||
3911 | if (skb_header_cloned(skb) && | 3911 | if (skb_header_cloned(skb) && |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index a1ed2d983740..6c62d5c88268 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -490,6 +490,9 @@ static int tun_set_iff(struct file *file, struct ifreq *ifr) | |||
490 | 490 | ||
491 | err = -EINVAL; | 491 | err = -EINVAL; |
492 | 492 | ||
493 | if (!capable(CAP_NET_ADMIN)) | ||
494 | return -EPERM; | ||
495 | |||
493 | /* Set dev type */ | 496 | /* Set dev type */ |
494 | if (ifr->ifr_flags & IFF_TUN) { | 497 | if (ifr->ifr_flags & IFF_TUN) { |
495 | /* TUN device */ | 498 | /* TUN device */ |
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c index d9258d42090c..e49e8b520c28 100644 --- a/drivers/net/typhoon.c +++ b/drivers/net/typhoon.c | |||
@@ -340,7 +340,7 @@ enum state_values { | |||
340 | #endif | 340 | #endif |
341 | 341 | ||
342 | #if defined(NETIF_F_TSO) | 342 | #if defined(NETIF_F_TSO) |
343 | #define skb_tso_size(x) (skb_shinfo(x)->tso_size) | 343 | #define skb_tso_size(x) (skb_shinfo(x)->gso_size) |
344 | #define TSO_NUM_DESCRIPTORS 2 | 344 | #define TSO_NUM_DESCRIPTORS 2 |
345 | #define TSO_OFFLOAD_ON TYPHOON_OFFLOAD_TCP_SEGMENT | 345 | #define TSO_OFFLOAD_ON TYPHOON_OFFLOAD_TCP_SEGMENT |
346 | #else | 346 | #else |
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index fdc21037f6dc..c80a4f1d5f7a 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
@@ -1284,11 +1284,8 @@ static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
1284 | /* Calculate the next Tx descriptor entry. */ | 1284 | /* Calculate the next Tx descriptor entry. */ |
1285 | entry = rp->cur_tx % TX_RING_SIZE; | 1285 | entry = rp->cur_tx % TX_RING_SIZE; |
1286 | 1286 | ||
1287 | if (skb->len < ETH_ZLEN) { | 1287 | if (skb_padto(skb, ETH_ZLEN)) |
1288 | skb = skb_padto(skb, ETH_ZLEN); | 1288 | return 0; |
1289 | if (skb == NULL) | ||
1290 | return 0; | ||
1291 | } | ||
1292 | 1289 | ||
1293 | rp->tx_skbuff[entry] = skb; | 1290 | rp->tx_skbuff[entry] = skb; |
1294 | 1291 | ||
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 879eb427607c..a915fe6c6aa5 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -924,8 +924,7 @@ static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
924 | 924 | ||
925 | if (length < ETH_ZLEN) | 925 | if (length < ETH_ZLEN) |
926 | { | 926 | { |
927 | skb = skb_padto(skb, ETH_ZLEN); | 927 | if (skb_padto(skb, ETH_ZLEN)) |
928 | if (skb == NULL) | ||
929 | return 0; | 928 | return 0; |
930 | length = ETH_ZLEN; | 929 | length = ETH_ZLEN; |
931 | } | 930 | } |
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index f7724eb2fa7e..561250f73fd3 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
@@ -3194,11 +3194,8 @@ wavelan_packet_xmit(struct sk_buff * skb, | |||
3194 | * and we don't have the Ethernet specific requirement of beeing | 3194 | * and we don't have the Ethernet specific requirement of beeing |
3195 | * able to detect collisions, therefore in theory we don't really | 3195 | * able to detect collisions, therefore in theory we don't really |
3196 | * need to pad. Jean II */ | 3196 | * need to pad. Jean II */ |
3197 | if (skb->len < ETH_ZLEN) { | 3197 | if (skb_padto(skb, ETH_ZLEN)) |
3198 | skb = skb_padto(skb, ETH_ZLEN); | 3198 | return 0; |
3199 | if (skb == NULL) | ||
3200 | return 0; | ||
3201 | } | ||
3202 | 3199 | ||
3203 | wv_packet_write(dev, skb->data, skb->len); | 3200 | wv_packet_write(dev, skb->data, skb->len); |
3204 | 3201 | ||
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c index fd0f43b7db5b..ecec8e5db786 100644 --- a/drivers/net/yellowfin.c +++ b/drivers/net/yellowfin.c | |||
@@ -862,13 +862,11 @@ static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
862 | /* Fix GX chipset errata. */ | 862 | /* Fix GX chipset errata. */ |
863 | if (cacheline_end > 24 || cacheline_end == 0) { | 863 | if (cacheline_end > 24 || cacheline_end == 0) { |
864 | len = skb->len + 32 - cacheline_end + 1; | 864 | len = skb->len + 32 - cacheline_end + 1; |
865 | if (len != skb->len) | 865 | if (skb_padto(skb, len)) { |
866 | skb = skb_padto(skb, len); | 866 | yp->tx_skbuff[entry] = NULL; |
867 | } | 867 | netif_wake_queue(dev); |
868 | if (skb == NULL) { | 868 | return 0; |
869 | yp->tx_skbuff[entry] = NULL; | 869 | } |
870 | netif_wake_queue(dev); | ||
871 | return 0; | ||
872 | } | 870 | } |
873 | } | 871 | } |
874 | yp->tx_skbuff[entry] = skb; | 872 | yp->tx_skbuff[entry] = skb; |
diff --git a/drivers/net/znet.c b/drivers/net/znet.c index 3ac047bc727d..a7c089df66e6 100644 --- a/drivers/net/znet.c +++ b/drivers/net/znet.c | |||
@@ -544,8 +544,7 @@ static int znet_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
544 | printk(KERN_DEBUG "%s: ZNet_send_packet.\n", dev->name); | 544 | printk(KERN_DEBUG "%s: ZNet_send_packet.\n", dev->name); |
545 | 545 | ||
546 | if (length < ETH_ZLEN) { | 546 | if (length < ETH_ZLEN) { |
547 | skb = skb_padto(skb, ETH_ZLEN); | 547 | if (skb_padto(skb, ETH_ZLEN)) |
548 | if (skb == NULL) | ||
549 | return 0; | 548 | return 0; |
550 | length = ETH_ZLEN; | 549 | length = ETH_ZLEN; |
551 | } | 550 | } |
diff --git a/drivers/s390/net/qeth_eddp.c b/drivers/s390/net/qeth_eddp.c index 0bab60a20309..38aad8321456 100644 --- a/drivers/s390/net/qeth_eddp.c +++ b/drivers/s390/net/qeth_eddp.c | |||
@@ -420,7 +420,7 @@ __qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx, | |||
420 | } | 420 | } |
421 | tcph = eddp->skb->h.th; | 421 | tcph = eddp->skb->h.th; |
422 | while (eddp->skb_offset < eddp->skb->len) { | 422 | while (eddp->skb_offset < eddp->skb->len) { |
423 | data_len = min((int)skb_shinfo(eddp->skb)->tso_size, | 423 | data_len = min((int)skb_shinfo(eddp->skb)->gso_size, |
424 | (int)(eddp->skb->len - eddp->skb_offset)); | 424 | (int)(eddp->skb->len - eddp->skb_offset)); |
425 | /* prepare qdio hdr */ | 425 | /* prepare qdio hdr */ |
426 | if (eddp->qh.hdr.l2.id == QETH_HEADER_TYPE_LAYER2){ | 426 | if (eddp->qh.hdr.l2.id == QETH_HEADER_TYPE_LAYER2){ |
@@ -515,20 +515,20 @@ qeth_eddp_calc_num_pages(struct qeth_eddp_context *ctx, struct sk_buff *skb, | |||
515 | 515 | ||
516 | QETH_DBF_TEXT(trace, 5, "eddpcanp"); | 516 | QETH_DBF_TEXT(trace, 5, "eddpcanp"); |
517 | /* can we put multiple skbs in one page? */ | 517 | /* can we put multiple skbs in one page? */ |
518 | skbs_per_page = PAGE_SIZE / (skb_shinfo(skb)->tso_size + hdr_len); | 518 | skbs_per_page = PAGE_SIZE / (skb_shinfo(skb)->gso_size + hdr_len); |
519 | if (skbs_per_page > 1){ | 519 | if (skbs_per_page > 1){ |
520 | ctx->num_pages = (skb_shinfo(skb)->tso_segs + 1) / | 520 | ctx->num_pages = (skb_shinfo(skb)->gso_segs + 1) / |
521 | skbs_per_page + 1; | 521 | skbs_per_page + 1; |
522 | ctx->elements_per_skb = 1; | 522 | ctx->elements_per_skb = 1; |
523 | } else { | 523 | } else { |
524 | /* no -> how many elements per skb? */ | 524 | /* no -> how many elements per skb? */ |
525 | ctx->elements_per_skb = (skb_shinfo(skb)->tso_size + hdr_len + | 525 | ctx->elements_per_skb = (skb_shinfo(skb)->gso_size + hdr_len + |
526 | PAGE_SIZE) >> PAGE_SHIFT; | 526 | PAGE_SIZE) >> PAGE_SHIFT; |
527 | ctx->num_pages = ctx->elements_per_skb * | 527 | ctx->num_pages = ctx->elements_per_skb * |
528 | (skb_shinfo(skb)->tso_segs + 1); | 528 | (skb_shinfo(skb)->gso_segs + 1); |
529 | } | 529 | } |
530 | ctx->num_elements = ctx->elements_per_skb * | 530 | ctx->num_elements = ctx->elements_per_skb * |
531 | (skb_shinfo(skb)->tso_segs + 1); | 531 | (skb_shinfo(skb)->gso_segs + 1); |
532 | } | 532 | } |
533 | 533 | ||
534 | static inline struct qeth_eddp_context * | 534 | static inline struct qeth_eddp_context * |
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index 9e671a48cd2f..56009d768326 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -4417,7 +4417,7 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb) | |||
4417 | struct qeth_eddp_context *ctx = NULL; | 4417 | struct qeth_eddp_context *ctx = NULL; |
4418 | int tx_bytes = skb->len; | 4418 | int tx_bytes = skb->len; |
4419 | unsigned short nr_frags = skb_shinfo(skb)->nr_frags; | 4419 | unsigned short nr_frags = skb_shinfo(skb)->nr_frags; |
4420 | unsigned short tso_size = skb_shinfo(skb)->tso_size; | 4420 | unsigned short tso_size = skb_shinfo(skb)->gso_size; |
4421 | int rc; | 4421 | int rc; |
4422 | 4422 | ||
4423 | QETH_DBF_TEXT(trace, 6, "sendpkt"); | 4423 | QETH_DBF_TEXT(trace, 6, "sendpkt"); |
@@ -4453,7 +4453,7 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb) | |||
4453 | queue = card->qdio.out_qs | 4453 | queue = card->qdio.out_qs |
4454 | [qeth_get_priority_queue(card, skb, ipv, cast_type)]; | 4454 | [qeth_get_priority_queue(card, skb, ipv, cast_type)]; |
4455 | 4455 | ||
4456 | if (skb_shinfo(skb)->tso_size) | 4456 | if (skb_shinfo(skb)->gso_size) |
4457 | large_send = card->options.large_send; | 4457 | large_send = card->options.large_send; |
4458 | 4458 | ||
4459 | /*are we able to do TSO ? If so ,prepare and send it from here */ | 4459 | /*are we able to do TSO ? If so ,prepare and send it from here */ |
diff --git a/drivers/s390/net/qeth_tso.h b/drivers/s390/net/qeth_tso.h index 24ef40ca9562..593f298142c1 100644 --- a/drivers/s390/net/qeth_tso.h +++ b/drivers/s390/net/qeth_tso.h | |||
@@ -51,7 +51,7 @@ qeth_tso_fill_header(struct qeth_card *card, struct sk_buff *skb) | |||
51 | hdr->ext.hdr_version = 1; | 51 | hdr->ext.hdr_version = 1; |
52 | hdr->ext.hdr_len = 28; | 52 | hdr->ext.hdr_len = 28; |
53 | /*insert non-fix values */ | 53 | /*insert non-fix values */ |
54 | hdr->ext.mss = skb_shinfo(skb)->tso_size; | 54 | hdr->ext.mss = skb_shinfo(skb)->gso_size; |
55 | hdr->ext.dg_hdr_len = (__u16)(iph->ihl*4 + tcph->doff*4); | 55 | hdr->ext.dg_hdr_len = (__u16)(iph->ihl*4 + tcph->doff*4); |
56 | hdr->ext.payload_len = (__u16)(skb->len - hdr->ext.dg_hdr_len - | 56 | hdr->ext.payload_len = (__u16)(skb->len - hdr->ext.dg_hdr_len - |
57 | sizeof(struct qeth_hdr_tso)); | 57 | sizeof(struct qeth_hdr_tso)); |
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index cf2abeca92a0..c6310aef5ab0 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
@@ -411,6 +411,8 @@ struct ethtool_ops { | |||
411 | #define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */ | 411 | #define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */ |
412 | #define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */ | 412 | #define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */ |
413 | #define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */ | 413 | #define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */ |
414 | #define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */ | ||
415 | #define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */ | ||
414 | 416 | ||
415 | /* compatibility with older code */ | 417 | /* compatibility with older code */ |
416 | #define SPARC_ETH_GSET ETHTOOL_GSET | 418 | #define SPARC_ETH_GSET ETHTOOL_GSET |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index cead6be467ed..bc747e5d7138 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -308,9 +308,13 @@ struct net_device | |||
308 | #define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */ | 308 | #define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */ |
309 | #define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */ | 309 | #define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */ |
310 | #define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ | 310 | #define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ |
311 | #define NETIF_F_TSO 2048 /* Can offload TCP/IP segmentation */ | 311 | #define NETIF_F_GSO 2048 /* Enable software GSO. */ |
312 | #define NETIF_F_LLTX 4096 /* LockLess TX */ | 312 | #define NETIF_F_LLTX 4096 /* LockLess TX */ |
313 | #define NETIF_F_UFO 8192 /* Can offload UDP Large Send*/ | 313 | |
314 | /* Segmentation offload features */ | ||
315 | #define NETIF_F_GSO_SHIFT 16 | ||
316 | #define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT) | ||
317 | #define NETIF_F_UFO (SKB_GSO_UDPV4 << NETIF_F_GSO_SHIFT) | ||
314 | 318 | ||
315 | #define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM) | 319 | #define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM) |
316 | #define NETIF_F_ALL_CSUM (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM) | 320 | #define NETIF_F_ALL_CSUM (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM) |
@@ -402,6 +406,9 @@ struct net_device | |||
402 | struct list_head qdisc_list; | 406 | struct list_head qdisc_list; |
403 | unsigned long tx_queue_len; /* Max frames per queue allowed */ | 407 | unsigned long tx_queue_len; /* Max frames per queue allowed */ |
404 | 408 | ||
409 | /* Partially transmitted GSO packet. */ | ||
410 | struct sk_buff *gso_skb; | ||
411 | |||
405 | /* ingress path synchronizer */ | 412 | /* ingress path synchronizer */ |
406 | spinlock_t ingress_lock; | 413 | spinlock_t ingress_lock; |
407 | struct Qdisc *qdisc_ingress; | 414 | struct Qdisc *qdisc_ingress; |
@@ -536,6 +543,7 @@ struct packet_type { | |||
536 | struct net_device *, | 543 | struct net_device *, |
537 | struct packet_type *, | 544 | struct packet_type *, |
538 | struct net_device *); | 545 | struct net_device *); |
546 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, int sg); | ||
539 | void *af_packet_priv; | 547 | void *af_packet_priv; |
540 | struct list_head list; | 548 | struct list_head list; |
541 | }; | 549 | }; |
@@ -686,7 +694,8 @@ extern int dev_change_name(struct net_device *, char *); | |||
686 | extern int dev_set_mtu(struct net_device *, int); | 694 | extern int dev_set_mtu(struct net_device *, int); |
687 | extern int dev_set_mac_address(struct net_device *, | 695 | extern int dev_set_mac_address(struct net_device *, |
688 | struct sockaddr *); | 696 | struct sockaddr *); |
689 | extern void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev); | 697 | extern int dev_hard_start_xmit(struct sk_buff *skb, |
698 | struct net_device *dev); | ||
690 | 699 | ||
691 | extern void dev_init(void); | 700 | extern void dev_init(void); |
692 | 701 | ||
@@ -960,6 +969,7 @@ extern int netdev_max_backlog; | |||
960 | extern int weight_p; | 969 | extern int weight_p; |
961 | extern int netdev_set_master(struct net_device *dev, struct net_device *master); | 970 | extern int netdev_set_master(struct net_device *dev, struct net_device *master); |
962 | extern int skb_checksum_help(struct sk_buff *skb, int inward); | 971 | extern int skb_checksum_help(struct sk_buff *skb, int inward); |
972 | extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int sg); | ||
963 | #ifdef CONFIG_BUG | 973 | #ifdef CONFIG_BUG |
964 | extern void netdev_rx_csum_fault(struct net_device *dev); | 974 | extern void netdev_rx_csum_fault(struct net_device *dev); |
965 | #else | 975 | #else |
@@ -979,6 +989,13 @@ extern void dev_seq_stop(struct seq_file *seq, void *v); | |||
979 | 989 | ||
980 | extern void linkwatch_run_queue(void); | 990 | extern void linkwatch_run_queue(void); |
981 | 991 | ||
992 | static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) | ||
993 | { | ||
994 | int feature = skb_shinfo(skb)->gso_type << NETIF_F_GSO_SHIFT; | ||
995 | return skb_shinfo(skb)->gso_size && | ||
996 | (dev->features & feature) != feature; | ||
997 | } | ||
998 | |||
982 | #endif /* __KERNEL__ */ | 999 | #endif /* __KERNEL__ */ |
983 | 1000 | ||
984 | #endif /* _LINUX_DEV_H */ | 1001 | #endif /* _LINUX_DEV_H */ |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 66f8819f9568..16eef03ce0eb 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -134,9 +134,10 @@ struct skb_frag_struct { | |||
134 | struct skb_shared_info { | 134 | struct skb_shared_info { |
135 | atomic_t dataref; | 135 | atomic_t dataref; |
136 | unsigned short nr_frags; | 136 | unsigned short nr_frags; |
137 | unsigned short tso_size; | 137 | unsigned short gso_size; |
138 | unsigned short tso_segs; | 138 | /* Warning: this field is not always filled in (UFO)! */ |
139 | unsigned short ufo_size; | 139 | unsigned short gso_segs; |
140 | unsigned short gso_type; | ||
140 | unsigned int ip6_frag_id; | 141 | unsigned int ip6_frag_id; |
141 | struct sk_buff *frag_list; | 142 | struct sk_buff *frag_list; |
142 | skb_frag_t frags[MAX_SKB_FRAGS]; | 143 | skb_frag_t frags[MAX_SKB_FRAGS]; |
@@ -168,6 +169,11 @@ enum { | |||
168 | SKB_FCLONE_CLONE, | 169 | SKB_FCLONE_CLONE, |
169 | }; | 170 | }; |
170 | 171 | ||
172 | enum { | ||
173 | SKB_GSO_TCPV4 = 1 << 0, | ||
174 | SKB_GSO_UDPV4 = 1 << 1, | ||
175 | }; | ||
176 | |||
171 | /** | 177 | /** |
172 | * struct sk_buff - socket buffer | 178 | * struct sk_buff - socket buffer |
173 | * @next: Next buffer in list | 179 | * @next: Next buffer in list |
@@ -209,6 +215,8 @@ enum { | |||
209 | * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c | 215 | * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c |
210 | * @tc_index: Traffic control index | 216 | * @tc_index: Traffic control index |
211 | * @tc_verd: traffic control verdict | 217 | * @tc_verd: traffic control verdict |
218 | * @dma_cookie: a cookie to one of several possible DMA operations | ||
219 | * done by skb DMA functions | ||
212 | * @secmark: security marking | 220 | * @secmark: security marking |
213 | */ | 221 | */ |
214 | 222 | ||
@@ -345,7 +353,7 @@ extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, | |||
345 | extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, | 353 | extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, |
346 | int newheadroom, int newtailroom, | 354 | int newheadroom, int newtailroom, |
347 | gfp_t priority); | 355 | gfp_t priority); |
348 | extern struct sk_buff * skb_pad(struct sk_buff *skb, int pad); | 356 | extern int skb_pad(struct sk_buff *skb, int pad); |
349 | #define dev_kfree_skb(a) kfree_skb(a) | 357 | #define dev_kfree_skb(a) kfree_skb(a) |
350 | extern void skb_over_panic(struct sk_buff *skb, int len, | 358 | extern void skb_over_panic(struct sk_buff *skb, int len, |
351 | void *here); | 359 | void *here); |
@@ -1122,16 +1130,15 @@ static inline int skb_cow(struct sk_buff *skb, unsigned int headroom) | |||
1122 | * | 1130 | * |
1123 | * Pads up a buffer to ensure the trailing bytes exist and are | 1131 | * Pads up a buffer to ensure the trailing bytes exist and are |
1124 | * blanked. If the buffer already contains sufficient data it | 1132 | * blanked. If the buffer already contains sufficient data it |
1125 | * is untouched. Returns the buffer, which may be a replacement | 1133 | * is untouched. Otherwise it is extended. Returns zero on |
1126 | * for the original, or NULL for out of memory - in which case | 1134 | * success. The skb is freed on error. |
1127 | * the original buffer is still freed. | ||
1128 | */ | 1135 | */ |
1129 | 1136 | ||
1130 | static inline struct sk_buff *skb_padto(struct sk_buff *skb, unsigned int len) | 1137 | static inline int skb_padto(struct sk_buff *skb, unsigned int len) |
1131 | { | 1138 | { |
1132 | unsigned int size = skb->len; | 1139 | unsigned int size = skb->len; |
1133 | if (likely(size >= len)) | 1140 | if (likely(size >= len)) |
1134 | return skb; | 1141 | return 0; |
1135 | return skb_pad(skb, len-size); | 1142 | return skb_pad(skb, len-size); |
1136 | } | 1143 | } |
1137 | 1144 | ||
@@ -1292,6 +1299,7 @@ extern void skb_split(struct sk_buff *skb, | |||
1292 | struct sk_buff *skb1, const u32 len); | 1299 | struct sk_buff *skb1, const u32 len); |
1293 | 1300 | ||
1294 | extern void skb_release_data(struct sk_buff *skb); | 1301 | extern void skb_release_data(struct sk_buff *skb); |
1302 | extern struct sk_buff *skb_segment(struct sk_buff *skb, int sg); | ||
1295 | 1303 | ||
1296 | static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, | 1304 | static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, |
1297 | int len, void *buffer) | 1305 | int len, void *buffer) |
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 420a689c3fb4..8ebf497907f8 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -18,7 +18,6 @@ | |||
18 | #define _LINUX_TCP_H | 18 | #define _LINUX_TCP_H |
19 | 19 | ||
20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
21 | #include <linux/dmaengine.h> | ||
22 | #include <asm/byteorder.h> | 21 | #include <asm/byteorder.h> |
23 | 22 | ||
24 | struct tcphdr { | 23 | struct tcphdr { |
@@ -161,6 +160,7 @@ struct tcp_info | |||
161 | #ifdef __KERNEL__ | 160 | #ifdef __KERNEL__ |
162 | 161 | ||
163 | #include <linux/skbuff.h> | 162 | #include <linux/skbuff.h> |
163 | #include <linux/dmaengine.h> | ||
164 | #include <net/sock.h> | 164 | #include <net/sock.h> |
165 | #include <net/inet_connection_sock.h> | 165 | #include <net/inet_connection_sock.h> |
166 | #include <net/inet_timewait_sock.h> | 166 | #include <net/inet_timewait_sock.h> |
diff --git a/include/net/protocol.h b/include/net/protocol.h index bcaee39bd2ff..3b6dc15c68a5 100644 --- a/include/net/protocol.h +++ b/include/net/protocol.h | |||
@@ -36,6 +36,7 @@ | |||
36 | struct net_protocol { | 36 | struct net_protocol { |
37 | int (*handler)(struct sk_buff *skb); | 37 | int (*handler)(struct sk_buff *skb); |
38 | void (*err_handler)(struct sk_buff *skb, u32 info); | 38 | void (*err_handler)(struct sk_buff *skb, u32 info); |
39 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, int sg); | ||
39 | int no_policy; | 40 | int no_policy; |
40 | }; | 41 | }; |
41 | 42 | ||
diff --git a/include/net/sock.h b/include/net/sock.h index d10dfecb6cbd..2d8d6adf1616 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1030,9 +1030,13 @@ static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst) | |||
1030 | { | 1030 | { |
1031 | __sk_dst_set(sk, dst); | 1031 | __sk_dst_set(sk, dst); |
1032 | sk->sk_route_caps = dst->dev->features; | 1032 | sk->sk_route_caps = dst->dev->features; |
1033 | if (sk->sk_route_caps & NETIF_F_GSO) | ||
1034 | sk->sk_route_caps |= NETIF_F_TSO; | ||
1033 | if (sk->sk_route_caps & NETIF_F_TSO) { | 1035 | if (sk->sk_route_caps & NETIF_F_TSO) { |
1034 | if (sock_flag(sk, SOCK_NO_LARGESEND) || dst->header_len) | 1036 | if (sock_flag(sk, SOCK_NO_LARGESEND) || dst->header_len) |
1035 | sk->sk_route_caps &= ~NETIF_F_TSO; | 1037 | sk->sk_route_caps &= ~NETIF_F_TSO; |
1038 | else | ||
1039 | sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM; | ||
1036 | } | 1040 | } |
1037 | } | 1041 | } |
1038 | 1042 | ||
@@ -1265,6 +1269,7 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) | |||
1265 | * sk_eat_skb - Release a skb if it is no longer needed | 1269 | * sk_eat_skb - Release a skb if it is no longer needed |
1266 | * @sk: socket to eat this skb from | 1270 | * @sk: socket to eat this skb from |
1267 | * @skb: socket buffer to eat | 1271 | * @skb: socket buffer to eat |
1272 | * @copied_early: flag indicating whether DMA operations copied this data early | ||
1268 | * | 1273 | * |
1269 | * This routine must be called with interrupts disabled or with the socket | 1274 | * This routine must be called with interrupts disabled or with the socket |
1270 | * locked so that the sk_buff queue operation is ok. | 1275 | * locked so that the sk_buff queue operation is ok. |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 5f4eb5c79689..ca3d38dfc00b 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -569,13 +569,13 @@ struct tcp_skb_cb { | |||
569 | */ | 569 | */ |
570 | static inline int tcp_skb_pcount(const struct sk_buff *skb) | 570 | static inline int tcp_skb_pcount(const struct sk_buff *skb) |
571 | { | 571 | { |
572 | return skb_shinfo(skb)->tso_segs; | 572 | return skb_shinfo(skb)->gso_segs; |
573 | } | 573 | } |
574 | 574 | ||
575 | /* This is valid iff tcp_skb_pcount() > 1. */ | 575 | /* This is valid iff tcp_skb_pcount() > 1. */ |
576 | static inline int tcp_skb_mss(const struct sk_buff *skb) | 576 | static inline int tcp_skb_mss(const struct sk_buff *skb) |
577 | { | 577 | { |
578 | return skb_shinfo(skb)->tso_size; | 578 | return skb_shinfo(skb)->gso_size; |
579 | } | 579 | } |
580 | 580 | ||
581 | static inline void tcp_dec_pcount_approx(__u32 *count, | 581 | static inline void tcp_dec_pcount_approx(__u32 *count, |
@@ -1086,6 +1086,8 @@ extern struct request_sock_ops tcp_request_sock_ops; | |||
1086 | 1086 | ||
1087 | extern int tcp_v4_destroy_sock(struct sock *sk); | 1087 | extern int tcp_v4_destroy_sock(struct sock *sk); |
1088 | 1088 | ||
1089 | extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int sg); | ||
1090 | |||
1089 | #ifdef CONFIG_PROC_FS | 1091 | #ifdef CONFIG_PROC_FS |
1090 | extern int tcp4_proc_init(void); | 1092 | extern int tcp4_proc_init(void); |
1091 | extern void tcp4_proc_exit(void); | 1093 | extern void tcp4_proc_exit(void); |
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c index 0dca027ceb80..8be9f2123e54 100644 --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c | |||
@@ -34,8 +34,8 @@ static inline unsigned packet_length(const struct sk_buff *skb) | |||
34 | 34 | ||
35 | int br_dev_queue_push_xmit(struct sk_buff *skb) | 35 | int br_dev_queue_push_xmit(struct sk_buff *skb) |
36 | { | 36 | { |
37 | /* drop mtu oversized packets except tso */ | 37 | /* drop mtu oversized packets except gso */ |
38 | if (packet_length(skb) > skb->dev->mtu && !skb_shinfo(skb)->tso_size) | 38 | if (packet_length(skb) > skb->dev->mtu && !skb_shinfo(skb)->gso_size) |
39 | kfree_skb(skb); | 39 | kfree_skb(skb); |
40 | else { | 40 | else { |
41 | #ifdef CONFIG_BRIDGE_NETFILTER | 41 | #ifdef CONFIG_BRIDGE_NETFILTER |
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index fdec773f5b52..07956ecf545e 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -376,15 +376,20 @@ void br_features_recompute(struct net_bridge *br) | |||
376 | features = br->feature_mask & ~NETIF_F_ALL_CSUM; | 376 | features = br->feature_mask & ~NETIF_F_ALL_CSUM; |
377 | 377 | ||
378 | list_for_each_entry(p, &br->port_list, list) { | 378 | list_for_each_entry(p, &br->port_list, list) { |
379 | if (checksum & NETIF_F_NO_CSUM && | 379 | unsigned long feature = p->dev->features; |
380 | !(p->dev->features & NETIF_F_NO_CSUM)) | 380 | |
381 | if (checksum & NETIF_F_NO_CSUM && !(feature & NETIF_F_NO_CSUM)) | ||
381 | checksum ^= NETIF_F_NO_CSUM | NETIF_F_HW_CSUM; | 382 | checksum ^= NETIF_F_NO_CSUM | NETIF_F_HW_CSUM; |
382 | if (checksum & NETIF_F_HW_CSUM && | 383 | if (checksum & NETIF_F_HW_CSUM && !(feature & NETIF_F_HW_CSUM)) |
383 | !(p->dev->features & NETIF_F_HW_CSUM)) | ||
384 | checksum ^= NETIF_F_HW_CSUM | NETIF_F_IP_CSUM; | 384 | checksum ^= NETIF_F_HW_CSUM | NETIF_F_IP_CSUM; |
385 | if (!(p->dev->features & NETIF_F_IP_CSUM)) | 385 | if (!(feature & NETIF_F_IP_CSUM)) |
386 | checksum = 0; | 386 | checksum = 0; |
387 | features &= p->dev->features; | 387 | |
388 | if (feature & NETIF_F_GSO) | ||
389 | feature |= NETIF_F_TSO; | ||
390 | feature |= NETIF_F_GSO; | ||
391 | |||
392 | features &= feature; | ||
388 | } | 393 | } |
389 | 394 | ||
390 | br->dev->features = features | checksum | NETIF_F_LLTX; | 395 | br->dev->features = features | checksum | NETIF_F_LLTX; |
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index 3e41f9d6d51c..8298a5179aef 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -761,7 +761,7 @@ static int br_nf_dev_queue_xmit(struct sk_buff *skb) | |||
761 | { | 761 | { |
762 | if (skb->protocol == htons(ETH_P_IP) && | 762 | if (skb->protocol == htons(ETH_P_IP) && |
763 | skb->len > skb->dev->mtu && | 763 | skb->len > skb->dev->mtu && |
764 | !(skb_shinfo(skb)->ufo_size || skb_shinfo(skb)->tso_size)) | 764 | !skb_shinfo(skb)->gso_size) |
765 | return ip_fragment(skb, br_dev_queue_push_xmit); | 765 | return ip_fragment(skb, br_dev_queue_push_xmit); |
766 | else | 766 | else |
767 | return br_dev_queue_push_xmit(skb); | 767 | return br_dev_queue_push_xmit(skb); |
diff --git a/net/core/dev.c b/net/core/dev.c index 195a5e96b2d1..ea2469398bd5 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -116,6 +116,7 @@ | |||
116 | #include <asm/current.h> | 116 | #include <asm/current.h> |
117 | #include <linux/audit.h> | 117 | #include <linux/audit.h> |
118 | #include <linux/dmaengine.h> | 118 | #include <linux/dmaengine.h> |
119 | #include <linux/err.h> | ||
119 | 120 | ||
120 | /* | 121 | /* |
121 | * The list of packet types we will receive (as opposed to discard) | 122 | * The list of packet types we will receive (as opposed to discard) |
@@ -1048,7 +1049,7 @@ static inline void net_timestamp(struct sk_buff *skb) | |||
1048 | * taps currently in use. | 1049 | * taps currently in use. |
1049 | */ | 1050 | */ |
1050 | 1051 | ||
1051 | void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev) | 1052 | static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev) |
1052 | { | 1053 | { |
1053 | struct packet_type *ptype; | 1054 | struct packet_type *ptype; |
1054 | 1055 | ||
@@ -1186,6 +1187,40 @@ out: | |||
1186 | return ret; | 1187 | return ret; |
1187 | } | 1188 | } |
1188 | 1189 | ||
1190 | /** | ||
1191 | * skb_gso_segment - Perform segmentation on skb. | ||
1192 | * @skb: buffer to segment | ||
1193 | * @sg: whether scatter-gather is supported on the target. | ||
1194 | * | ||
1195 | * This function segments the given skb and returns a list of segments. | ||
1196 | */ | ||
1197 | struct sk_buff *skb_gso_segment(struct sk_buff *skb, int sg) | ||
1198 | { | ||
1199 | struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT); | ||
1200 | struct packet_type *ptype; | ||
1201 | int type = skb->protocol; | ||
1202 | |||
1203 | BUG_ON(skb_shinfo(skb)->frag_list); | ||
1204 | BUG_ON(skb->ip_summed != CHECKSUM_HW); | ||
1205 | |||
1206 | skb->mac.raw = skb->data; | ||
1207 | skb->mac_len = skb->nh.raw - skb->data; | ||
1208 | __skb_pull(skb, skb->mac_len); | ||
1209 | |||
1210 | rcu_read_lock(); | ||
1211 | list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type) & 15], list) { | ||
1212 | if (ptype->type == type && !ptype->dev && ptype->gso_segment) { | ||
1213 | segs = ptype->gso_segment(skb, sg); | ||
1214 | break; | ||
1215 | } | ||
1216 | } | ||
1217 | rcu_read_unlock(); | ||
1218 | |||
1219 | return segs; | ||
1220 | } | ||
1221 | |||
1222 | EXPORT_SYMBOL(skb_gso_segment); | ||
1223 | |||
1189 | /* Take action when hardware reception checksum errors are detected. */ | 1224 | /* Take action when hardware reception checksum errors are detected. */ |
1190 | #ifdef CONFIG_BUG | 1225 | #ifdef CONFIG_BUG |
1191 | void netdev_rx_csum_fault(struct net_device *dev) | 1226 | void netdev_rx_csum_fault(struct net_device *dev) |
@@ -1222,6 +1257,86 @@ static inline int illegal_highdma(struct net_device *dev, struct sk_buff *skb) | |||
1222 | #define illegal_highdma(dev, skb) (0) | 1257 | #define illegal_highdma(dev, skb) (0) |
1223 | #endif | 1258 | #endif |
1224 | 1259 | ||
1260 | struct dev_gso_cb { | ||
1261 | void (*destructor)(struct sk_buff *skb); | ||
1262 | }; | ||
1263 | |||
1264 | #define DEV_GSO_CB(skb) ((struct dev_gso_cb *)(skb)->cb) | ||
1265 | |||
1266 | static void dev_gso_skb_destructor(struct sk_buff *skb) | ||
1267 | { | ||
1268 | struct dev_gso_cb *cb; | ||
1269 | |||
1270 | do { | ||
1271 | struct sk_buff *nskb = skb->next; | ||
1272 | |||
1273 | skb->next = nskb->next; | ||
1274 | nskb->next = NULL; | ||
1275 | kfree_skb(nskb); | ||
1276 | } while (skb->next); | ||
1277 | |||
1278 | cb = DEV_GSO_CB(skb); | ||
1279 | if (cb->destructor) | ||
1280 | cb->destructor(skb); | ||
1281 | } | ||
1282 | |||
1283 | /** | ||
1284 | * dev_gso_segment - Perform emulated hardware segmentation on skb. | ||
1285 | * @skb: buffer to segment | ||
1286 | * | ||
1287 | * This function segments the given skb and stores the list of segments | ||
1288 | * in skb->next. | ||
1289 | */ | ||
1290 | static int dev_gso_segment(struct sk_buff *skb) | ||
1291 | { | ||
1292 | struct net_device *dev = skb->dev; | ||
1293 | struct sk_buff *segs; | ||
1294 | |||
1295 | segs = skb_gso_segment(skb, dev->features & NETIF_F_SG && | ||
1296 | !illegal_highdma(dev, skb)); | ||
1297 | if (unlikely(IS_ERR(segs))) | ||
1298 | return PTR_ERR(segs); | ||
1299 | |||
1300 | skb->next = segs; | ||
1301 | DEV_GSO_CB(skb)->destructor = skb->destructor; | ||
1302 | skb->destructor = dev_gso_skb_destructor; | ||
1303 | |||
1304 | return 0; | ||
1305 | } | ||
1306 | |||
1307 | int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||
1308 | { | ||
1309 | if (likely(!skb->next)) { | ||
1310 | if (netdev_nit) | ||
1311 | dev_queue_xmit_nit(skb, dev); | ||
1312 | |||
1313 | if (!netif_needs_gso(dev, skb)) | ||
1314 | return dev->hard_start_xmit(skb, dev); | ||
1315 | |||
1316 | if (unlikely(dev_gso_segment(skb))) | ||
1317 | goto out_kfree_skb; | ||
1318 | } | ||
1319 | |||
1320 | do { | ||
1321 | struct sk_buff *nskb = skb->next; | ||
1322 | int rc; | ||
1323 | |||
1324 | skb->next = nskb->next; | ||
1325 | nskb->next = NULL; | ||
1326 | rc = dev->hard_start_xmit(nskb, dev); | ||
1327 | if (unlikely(rc)) { | ||
1328 | skb->next = nskb; | ||
1329 | return rc; | ||
1330 | } | ||
1331 | } while (skb->next); | ||
1332 | |||
1333 | skb->destructor = DEV_GSO_CB(skb)->destructor; | ||
1334 | |||
1335 | out_kfree_skb: | ||
1336 | kfree_skb(skb); | ||
1337 | return 0; | ||
1338 | } | ||
1339 | |||
1225 | #define HARD_TX_LOCK(dev, cpu) { \ | 1340 | #define HARD_TX_LOCK(dev, cpu) { \ |
1226 | if ((dev->features & NETIF_F_LLTX) == 0) { \ | 1341 | if ((dev->features & NETIF_F_LLTX) == 0) { \ |
1227 | netif_tx_lock(dev); \ | 1342 | netif_tx_lock(dev); \ |
@@ -1266,6 +1381,10 @@ int dev_queue_xmit(struct sk_buff *skb) | |||
1266 | struct Qdisc *q; | 1381 | struct Qdisc *q; |
1267 | int rc = -ENOMEM; | 1382 | int rc = -ENOMEM; |
1268 | 1383 | ||
1384 | /* GSO will handle the following emulations directly. */ | ||
1385 | if (netif_needs_gso(dev, skb)) | ||
1386 | goto gso; | ||
1387 | |||
1269 | if (skb_shinfo(skb)->frag_list && | 1388 | if (skb_shinfo(skb)->frag_list && |
1270 | !(dev->features & NETIF_F_FRAGLIST) && | 1389 | !(dev->features & NETIF_F_FRAGLIST) && |
1271 | __skb_linearize(skb)) | 1390 | __skb_linearize(skb)) |
@@ -1290,12 +1409,13 @@ int dev_queue_xmit(struct sk_buff *skb) | |||
1290 | if (skb_checksum_help(skb, 0)) | 1409 | if (skb_checksum_help(skb, 0)) |
1291 | goto out_kfree_skb; | 1410 | goto out_kfree_skb; |
1292 | 1411 | ||
1412 | gso: | ||
1293 | spin_lock_prefetch(&dev->queue_lock); | 1413 | spin_lock_prefetch(&dev->queue_lock); |
1294 | 1414 | ||
1295 | /* Disable soft irqs for various locks below. Also | 1415 | /* Disable soft irqs for various locks below. Also |
1296 | * stops preemption for RCU. | 1416 | * stops preemption for RCU. |
1297 | */ | 1417 | */ |
1298 | local_bh_disable(); | 1418 | rcu_read_lock_bh(); |
1299 | 1419 | ||
1300 | /* Updates of qdisc are serialized by queue_lock. | 1420 | /* Updates of qdisc are serialized by queue_lock. |
1301 | * The struct Qdisc which is pointed to by qdisc is now a | 1421 | * The struct Qdisc which is pointed to by qdisc is now a |
@@ -1346,11 +1466,8 @@ int dev_queue_xmit(struct sk_buff *skb) | |||
1346 | HARD_TX_LOCK(dev, cpu); | 1466 | HARD_TX_LOCK(dev, cpu); |
1347 | 1467 | ||
1348 | if (!netif_queue_stopped(dev)) { | 1468 | if (!netif_queue_stopped(dev)) { |
1349 | if (netdev_nit) | ||
1350 | dev_queue_xmit_nit(skb, dev); | ||
1351 | |||
1352 | rc = 0; | 1469 | rc = 0; |
1353 | if (!dev->hard_start_xmit(skb, dev)) { | 1470 | if (!dev_hard_start_xmit(skb, dev)) { |
1354 | HARD_TX_UNLOCK(dev); | 1471 | HARD_TX_UNLOCK(dev); |
1355 | goto out; | 1472 | goto out; |
1356 | } | 1473 | } |
@@ -1369,13 +1486,13 @@ int dev_queue_xmit(struct sk_buff *skb) | |||
1369 | } | 1486 | } |
1370 | 1487 | ||
1371 | rc = -ENETDOWN; | 1488 | rc = -ENETDOWN; |
1372 | local_bh_enable(); | 1489 | rcu_read_unlock_bh(); |
1373 | 1490 | ||
1374 | out_kfree_skb: | 1491 | out_kfree_skb: |
1375 | kfree_skb(skb); | 1492 | kfree_skb(skb); |
1376 | return rc; | 1493 | return rc; |
1377 | out: | 1494 | out: |
1378 | local_bh_enable(); | 1495 | rcu_read_unlock_bh(); |
1379 | return rc; | 1496 | return rc; |
1380 | } | 1497 | } |
1381 | 1498 | ||
@@ -3301,8 +3418,8 @@ static void net_dma_rebalance(void) | |||
3301 | /** | 3418 | /** |
3302 | * netdev_dma_event - event callback for the net_dma_client | 3419 | * netdev_dma_event - event callback for the net_dma_client |
3303 | * @client: should always be net_dma_client | 3420 | * @client: should always be net_dma_client |
3304 | * @chan: | 3421 | * @chan: DMA channel for the event |
3305 | * @event: | 3422 | * @event: event type |
3306 | */ | 3423 | */ |
3307 | static void netdev_dma_event(struct dma_client *client, struct dma_chan *chan, | 3424 | static void netdev_dma_event(struct dma_client *client, struct dma_chan *chan, |
3308 | enum dma_event event) | 3425 | enum dma_event event) |
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 33ce7ed6afc6..27ce1683caf5 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -614,6 +614,29 @@ static int ethtool_set_ufo(struct net_device *dev, char __user *useraddr) | |||
614 | return dev->ethtool_ops->set_ufo(dev, edata.data); | 614 | return dev->ethtool_ops->set_ufo(dev, edata.data); |
615 | } | 615 | } |
616 | 616 | ||
617 | static int ethtool_get_gso(struct net_device *dev, char __user *useraddr) | ||
618 | { | ||
619 | struct ethtool_value edata = { ETHTOOL_GGSO }; | ||
620 | |||
621 | edata.data = dev->features & NETIF_F_GSO; | ||
622 | if (copy_to_user(useraddr, &edata, sizeof(edata))) | ||
623 | return -EFAULT; | ||
624 | return 0; | ||
625 | } | ||
626 | |||
627 | static int ethtool_set_gso(struct net_device *dev, char __user *useraddr) | ||
628 | { | ||
629 | struct ethtool_value edata; | ||
630 | |||
631 | if (copy_from_user(&edata, useraddr, sizeof(edata))) | ||
632 | return -EFAULT; | ||
633 | if (edata.data) | ||
634 | dev->features |= NETIF_F_GSO; | ||
635 | else | ||
636 | dev->features &= ~NETIF_F_GSO; | ||
637 | return 0; | ||
638 | } | ||
639 | |||
617 | static int ethtool_self_test(struct net_device *dev, char __user *useraddr) | 640 | static int ethtool_self_test(struct net_device *dev, char __user *useraddr) |
618 | { | 641 | { |
619 | struct ethtool_test test; | 642 | struct ethtool_test test; |
@@ -905,6 +928,12 @@ int dev_ethtool(struct ifreq *ifr) | |||
905 | case ETHTOOL_SUFO: | 928 | case ETHTOOL_SUFO: |
906 | rc = ethtool_set_ufo(dev, useraddr); | 929 | rc = ethtool_set_ufo(dev, useraddr); |
907 | break; | 930 | break; |
931 | case ETHTOOL_GGSO: | ||
932 | rc = ethtool_get_gso(dev, useraddr); | ||
933 | break; | ||
934 | case ETHTOOL_SGSO: | ||
935 | rc = ethtool_set_gso(dev, useraddr); | ||
936 | break; | ||
908 | default: | 937 | default: |
909 | rc = -EOPNOTSUPP; | 938 | rc = -EOPNOTSUPP; |
910 | } | 939 | } |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index bb7210f4005e..8e5044ba3ab6 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -172,9 +172,9 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask, | |||
172 | shinfo = skb_shinfo(skb); | 172 | shinfo = skb_shinfo(skb); |
173 | atomic_set(&shinfo->dataref, 1); | 173 | atomic_set(&shinfo->dataref, 1); |
174 | shinfo->nr_frags = 0; | 174 | shinfo->nr_frags = 0; |
175 | shinfo->tso_size = 0; | 175 | shinfo->gso_size = 0; |
176 | shinfo->tso_segs = 0; | 176 | shinfo->gso_segs = 0; |
177 | shinfo->ufo_size = 0; | 177 | shinfo->gso_type = 0; |
178 | shinfo->ip6_frag_id = 0; | 178 | shinfo->ip6_frag_id = 0; |
179 | shinfo->frag_list = NULL; | 179 | shinfo->frag_list = NULL; |
180 | 180 | ||
@@ -238,8 +238,9 @@ struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp, | |||
238 | 238 | ||
239 | atomic_set(&(skb_shinfo(skb)->dataref), 1); | 239 | atomic_set(&(skb_shinfo(skb)->dataref), 1); |
240 | skb_shinfo(skb)->nr_frags = 0; | 240 | skb_shinfo(skb)->nr_frags = 0; |
241 | skb_shinfo(skb)->tso_size = 0; | 241 | skb_shinfo(skb)->gso_size = 0; |
242 | skb_shinfo(skb)->tso_segs = 0; | 242 | skb_shinfo(skb)->gso_segs = 0; |
243 | skb_shinfo(skb)->gso_type = 0; | ||
243 | skb_shinfo(skb)->frag_list = NULL; | 244 | skb_shinfo(skb)->frag_list = NULL; |
244 | out: | 245 | out: |
245 | return skb; | 246 | return skb; |
@@ -528,8 +529,9 @@ static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old) | |||
528 | #endif | 529 | #endif |
529 | skb_copy_secmark(new, old); | 530 | skb_copy_secmark(new, old); |
530 | atomic_set(&new->users, 1); | 531 | atomic_set(&new->users, 1); |
531 | skb_shinfo(new)->tso_size = skb_shinfo(old)->tso_size; | 532 | skb_shinfo(new)->gso_size = skb_shinfo(old)->gso_size; |
532 | skb_shinfo(new)->tso_segs = skb_shinfo(old)->tso_segs; | 533 | skb_shinfo(new)->gso_segs = skb_shinfo(old)->gso_segs; |
534 | skb_shinfo(new)->gso_type = skb_shinfo(old)->gso_type; | ||
533 | } | 535 | } |
534 | 536 | ||
535 | /** | 537 | /** |
@@ -781,24 +783,40 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb, | |||
781 | * filled. Used by network drivers which may DMA or transfer data | 783 | * filled. Used by network drivers which may DMA or transfer data |
782 | * beyond the buffer end onto the wire. | 784 | * beyond the buffer end onto the wire. |
783 | * | 785 | * |
784 | * May return NULL in out of memory cases. | 786 | * May return error in out of memory cases. The skb is freed on error. |
785 | */ | 787 | */ |
786 | 788 | ||
787 | struct sk_buff *skb_pad(struct sk_buff *skb, int pad) | 789 | int skb_pad(struct sk_buff *skb, int pad) |
788 | { | 790 | { |
789 | struct sk_buff *nskb; | 791 | int err; |
792 | int ntail; | ||
790 | 793 | ||
791 | /* If the skbuff is non linear tailroom is always zero.. */ | 794 | /* If the skbuff is non linear tailroom is always zero.. */ |
792 | if (skb_tailroom(skb) >= pad) { | 795 | if (!skb_cloned(skb) && skb_tailroom(skb) >= pad) { |
793 | memset(skb->data+skb->len, 0, pad); | 796 | memset(skb->data+skb->len, 0, pad); |
794 | return skb; | 797 | return 0; |
795 | } | 798 | } |
796 | 799 | ||
797 | nskb = skb_copy_expand(skb, skb_headroom(skb), skb_tailroom(skb) + pad, GFP_ATOMIC); | 800 | ntail = skb->data_len + pad - (skb->end - skb->tail); |
801 | if (likely(skb_cloned(skb) || ntail > 0)) { | ||
802 | err = pskb_expand_head(skb, 0, ntail, GFP_ATOMIC); | ||
803 | if (unlikely(err)) | ||
804 | goto free_skb; | ||
805 | } | ||
806 | |||
807 | /* FIXME: The use of this function with non-linear skb's really needs | ||
808 | * to be audited. | ||
809 | */ | ||
810 | err = skb_linearize(skb); | ||
811 | if (unlikely(err)) | ||
812 | goto free_skb; | ||
813 | |||
814 | memset(skb->data + skb->len, 0, pad); | ||
815 | return 0; | ||
816 | |||
817 | free_skb: | ||
798 | kfree_skb(skb); | 818 | kfree_skb(skb); |
799 | if (nskb) | 819 | return err; |
800 | memset(nskb->data+nskb->len, 0, pad); | ||
801 | return nskb; | ||
802 | } | 820 | } |
803 | 821 | ||
804 | /* Trims skb to length len. It can change skb pointers. | 822 | /* Trims skb to length len. It can change skb pointers. |
@@ -1824,6 +1842,132 @@ unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len) | |||
1824 | 1842 | ||
1825 | EXPORT_SYMBOL_GPL(skb_pull_rcsum); | 1843 | EXPORT_SYMBOL_GPL(skb_pull_rcsum); |
1826 | 1844 | ||
1845 | /** | ||
1846 | * skb_segment - Perform protocol segmentation on skb. | ||
1847 | * @skb: buffer to segment | ||
1848 | * @sg: whether scatter-gather can be used for generated segments | ||
1849 | * | ||
1850 | * This function performs segmentation on the given skb. It returns | ||
1851 | * the segment at the given position. It returns NULL if there are | ||
1852 | * no more segments to generate, or when an error is encountered. | ||
1853 | */ | ||
1854 | struct sk_buff *skb_segment(struct sk_buff *skb, int sg) | ||
1855 | { | ||
1856 | struct sk_buff *segs = NULL; | ||
1857 | struct sk_buff *tail = NULL; | ||
1858 | unsigned int mss = skb_shinfo(skb)->gso_size; | ||
1859 | unsigned int doffset = skb->data - skb->mac.raw; | ||
1860 | unsigned int offset = doffset; | ||
1861 | unsigned int headroom; | ||
1862 | unsigned int len; | ||
1863 | int nfrags = skb_shinfo(skb)->nr_frags; | ||
1864 | int err = -ENOMEM; | ||
1865 | int i = 0; | ||
1866 | int pos; | ||
1867 | |||
1868 | __skb_push(skb, doffset); | ||
1869 | headroom = skb_headroom(skb); | ||
1870 | pos = skb_headlen(skb); | ||
1871 | |||
1872 | do { | ||
1873 | struct sk_buff *nskb; | ||
1874 | skb_frag_t *frag; | ||
1875 | int hsize, nsize; | ||
1876 | int k; | ||
1877 | int size; | ||
1878 | |||
1879 | len = skb->len - offset; | ||
1880 | if (len > mss) | ||
1881 | len = mss; | ||
1882 | |||
1883 | hsize = skb_headlen(skb) - offset; | ||
1884 | if (hsize < 0) | ||
1885 | hsize = 0; | ||
1886 | nsize = hsize + doffset; | ||
1887 | if (nsize > len + doffset || !sg) | ||
1888 | nsize = len + doffset; | ||
1889 | |||
1890 | nskb = alloc_skb(nsize + headroom, GFP_ATOMIC); | ||
1891 | if (unlikely(!nskb)) | ||
1892 | goto err; | ||
1893 | |||
1894 | if (segs) | ||
1895 | tail->next = nskb; | ||
1896 | else | ||
1897 | segs = nskb; | ||
1898 | tail = nskb; | ||
1899 | |||
1900 | nskb->dev = skb->dev; | ||
1901 | nskb->priority = skb->priority; | ||
1902 | nskb->protocol = skb->protocol; | ||
1903 | nskb->dst = dst_clone(skb->dst); | ||
1904 | memcpy(nskb->cb, skb->cb, sizeof(skb->cb)); | ||
1905 | nskb->pkt_type = skb->pkt_type; | ||
1906 | nskb->mac_len = skb->mac_len; | ||
1907 | |||
1908 | skb_reserve(nskb, headroom); | ||
1909 | nskb->mac.raw = nskb->data; | ||
1910 | nskb->nh.raw = nskb->data + skb->mac_len; | ||
1911 | nskb->h.raw = nskb->nh.raw + (skb->h.raw - skb->nh.raw); | ||
1912 | memcpy(skb_put(nskb, doffset), skb->data, doffset); | ||
1913 | |||
1914 | if (!sg) { | ||
1915 | nskb->csum = skb_copy_and_csum_bits(skb, offset, | ||
1916 | skb_put(nskb, len), | ||
1917 | len, 0); | ||
1918 | continue; | ||
1919 | } | ||
1920 | |||
1921 | frag = skb_shinfo(nskb)->frags; | ||
1922 | k = 0; | ||
1923 | |||
1924 | nskb->ip_summed = CHECKSUM_HW; | ||
1925 | nskb->csum = skb->csum; | ||
1926 | memcpy(skb_put(nskb, hsize), skb->data + offset, hsize); | ||
1927 | |||
1928 | while (pos < offset + len) { | ||
1929 | BUG_ON(i >= nfrags); | ||
1930 | |||
1931 | *frag = skb_shinfo(skb)->frags[i]; | ||
1932 | get_page(frag->page); | ||
1933 | size = frag->size; | ||
1934 | |||
1935 | if (pos < offset) { | ||
1936 | frag->page_offset += offset - pos; | ||
1937 | frag->size -= offset - pos; | ||
1938 | } | ||
1939 | |||
1940 | k++; | ||
1941 | |||
1942 | if (pos + size <= offset + len) { | ||
1943 | i++; | ||
1944 | pos += size; | ||
1945 | } else { | ||
1946 | frag->size -= pos + size - (offset + len); | ||
1947 | break; | ||
1948 | } | ||
1949 | |||
1950 | frag++; | ||
1951 | } | ||
1952 | |||
1953 | skb_shinfo(nskb)->nr_frags = k; | ||
1954 | nskb->data_len = len - hsize; | ||
1955 | nskb->len += nskb->data_len; | ||
1956 | nskb->truesize += nskb->data_len; | ||
1957 | } while ((offset += len) < skb->len); | ||
1958 | |||
1959 | return segs; | ||
1960 | |||
1961 | err: | ||
1962 | while ((skb = segs)) { | ||
1963 | segs = skb->next; | ||
1964 | kfree(skb); | ||
1965 | } | ||
1966 | return ERR_PTR(err); | ||
1967 | } | ||
1968 | |||
1969 | EXPORT_SYMBOL_GPL(skb_segment); | ||
1970 | |||
1827 | void __init skb_init(void) | 1971 | void __init skb_init(void) |
1828 | { | 1972 | { |
1829 | skbuff_head_cache = kmem_cache_create("skbuff_head_cache", | 1973 | skbuff_head_cache = kmem_cache_create("skbuff_head_cache", |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 0a277453526b..461216b47948 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -68,6 +68,7 @@ | |||
68 | */ | 68 | */ |
69 | 69 | ||
70 | #include <linux/config.h> | 70 | #include <linux/config.h> |
71 | #include <linux/err.h> | ||
71 | #include <linux/errno.h> | 72 | #include <linux/errno.h> |
72 | #include <linux/types.h> | 73 | #include <linux/types.h> |
73 | #include <linux/socket.h> | 74 | #include <linux/socket.h> |
@@ -1096,6 +1097,54 @@ int inet_sk_rebuild_header(struct sock *sk) | |||
1096 | 1097 | ||
1097 | EXPORT_SYMBOL(inet_sk_rebuild_header); | 1098 | EXPORT_SYMBOL(inet_sk_rebuild_header); |
1098 | 1099 | ||
1100 | static struct sk_buff *inet_gso_segment(struct sk_buff *skb, int sg) | ||
1101 | { | ||
1102 | struct sk_buff *segs = ERR_PTR(-EINVAL); | ||
1103 | struct iphdr *iph; | ||
1104 | struct net_protocol *ops; | ||
1105 | int proto; | ||
1106 | int ihl; | ||
1107 | int id; | ||
1108 | |||
1109 | if (!pskb_may_pull(skb, sizeof(*iph))) | ||
1110 | goto out; | ||
1111 | |||
1112 | iph = skb->nh.iph; | ||
1113 | ihl = iph->ihl * 4; | ||
1114 | if (ihl < sizeof(*iph)) | ||
1115 | goto out; | ||
1116 | |||
1117 | if (!pskb_may_pull(skb, ihl)) | ||
1118 | goto out; | ||
1119 | |||
1120 | skb->h.raw = __skb_pull(skb, ihl); | ||
1121 | iph = skb->nh.iph; | ||
1122 | id = ntohs(iph->id); | ||
1123 | proto = iph->protocol & (MAX_INET_PROTOS - 1); | ||
1124 | segs = ERR_PTR(-EPROTONOSUPPORT); | ||
1125 | |||
1126 | rcu_read_lock(); | ||
1127 | ops = rcu_dereference(inet_protos[proto]); | ||
1128 | if (ops && ops->gso_segment) | ||
1129 | segs = ops->gso_segment(skb, sg); | ||
1130 | rcu_read_unlock(); | ||
1131 | |||
1132 | if (IS_ERR(segs)) | ||
1133 | goto out; | ||
1134 | |||
1135 | skb = segs; | ||
1136 | do { | ||
1137 | iph = skb->nh.iph; | ||
1138 | iph->id = htons(id++); | ||
1139 | iph->tot_len = htons(skb->len - skb->mac_len); | ||
1140 | iph->check = 0; | ||
1141 | iph->check = ip_fast_csum(skb->nh.raw, iph->ihl); | ||
1142 | } while ((skb = skb->next)); | ||
1143 | |||
1144 | out: | ||
1145 | return segs; | ||
1146 | } | ||
1147 | |||
1099 | #ifdef CONFIG_IP_MULTICAST | 1148 | #ifdef CONFIG_IP_MULTICAST |
1100 | static struct net_protocol igmp_protocol = { | 1149 | static struct net_protocol igmp_protocol = { |
1101 | .handler = igmp_rcv, | 1150 | .handler = igmp_rcv, |
@@ -1105,6 +1154,7 @@ static struct net_protocol igmp_protocol = { | |||
1105 | static struct net_protocol tcp_protocol = { | 1154 | static struct net_protocol tcp_protocol = { |
1106 | .handler = tcp_v4_rcv, | 1155 | .handler = tcp_v4_rcv, |
1107 | .err_handler = tcp_v4_err, | 1156 | .err_handler = tcp_v4_err, |
1157 | .gso_segment = tcp_tso_segment, | ||
1108 | .no_policy = 1, | 1158 | .no_policy = 1, |
1109 | }; | 1159 | }; |
1110 | 1160 | ||
@@ -1150,6 +1200,7 @@ static int ipv4_proc_init(void); | |||
1150 | static struct packet_type ip_packet_type = { | 1200 | static struct packet_type ip_packet_type = { |
1151 | .type = __constant_htons(ETH_P_IP), | 1201 | .type = __constant_htons(ETH_P_IP), |
1152 | .func = ip_rcv, | 1202 | .func = ip_rcv, |
1203 | .gso_segment = inet_gso_segment, | ||
1153 | }; | 1204 | }; |
1154 | 1205 | ||
1155 | static int __init inet_init(void) | 1206 | static int __init inet_init(void) |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 8538aac3d148..7624fd1d8f9f 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -210,8 +210,7 @@ static inline int ip_finish_output(struct sk_buff *skb) | |||
210 | return dst_output(skb); | 210 | return dst_output(skb); |
211 | } | 211 | } |
212 | #endif | 212 | #endif |
213 | if (skb->len > dst_mtu(skb->dst) && | 213 | if (skb->len > dst_mtu(skb->dst) && !skb_shinfo(skb)->gso_size) |
214 | !(skb_shinfo(skb)->ufo_size || skb_shinfo(skb)->tso_size)) | ||
215 | return ip_fragment(skb, ip_finish_output2); | 214 | return ip_fragment(skb, ip_finish_output2); |
216 | else | 215 | else |
217 | return ip_finish_output2(skb); | 216 | return ip_finish_output2(skb); |
@@ -362,7 +361,7 @@ packet_routed: | |||
362 | } | 361 | } |
363 | 362 | ||
364 | ip_select_ident_more(iph, &rt->u.dst, sk, | 363 | ip_select_ident_more(iph, &rt->u.dst, sk, |
365 | (skb_shinfo(skb)->tso_segs ?: 1) - 1); | 364 | (skb_shinfo(skb)->gso_segs ?: 1) - 1); |
366 | 365 | ||
367 | /* Add an IP checksum. */ | 366 | /* Add an IP checksum. */ |
368 | ip_send_check(iph); | 367 | ip_send_check(iph); |
@@ -744,7 +743,8 @@ static inline int ip_ufo_append_data(struct sock *sk, | |||
744 | (length - transhdrlen)); | 743 | (length - transhdrlen)); |
745 | if (!err) { | 744 | if (!err) { |
746 | /* specify the length of each IP datagram fragment*/ | 745 | /* specify the length of each IP datagram fragment*/ |
747 | skb_shinfo(skb)->ufo_size = (mtu - fragheaderlen); | 746 | skb_shinfo(skb)->gso_size = mtu - fragheaderlen; |
747 | skb_shinfo(skb)->gso_type = SKB_GSO_UDPV4; | ||
748 | __skb_queue_tail(&sk->sk_write_queue, skb); | 748 | __skb_queue_tail(&sk->sk_write_queue, skb); |
749 | 749 | ||
750 | return 0; | 750 | return 0; |
@@ -1087,14 +1087,16 @@ ssize_t ip_append_page(struct sock *sk, struct page *page, | |||
1087 | 1087 | ||
1088 | inet->cork.length += size; | 1088 | inet->cork.length += size; |
1089 | if ((sk->sk_protocol == IPPROTO_UDP) && | 1089 | if ((sk->sk_protocol == IPPROTO_UDP) && |
1090 | (rt->u.dst.dev->features & NETIF_F_UFO)) | 1090 | (rt->u.dst.dev->features & NETIF_F_UFO)) { |
1091 | skb_shinfo(skb)->ufo_size = (mtu - fragheaderlen); | 1091 | skb_shinfo(skb)->gso_size = mtu - fragheaderlen; |
1092 | skb_shinfo(skb)->gso_type = SKB_GSO_UDPV4; | ||
1093 | } | ||
1092 | 1094 | ||
1093 | 1095 | ||
1094 | while (size > 0) { | 1096 | while (size > 0) { |
1095 | int i; | 1097 | int i; |
1096 | 1098 | ||
1097 | if (skb_shinfo(skb)->ufo_size) | 1099 | if (skb_shinfo(skb)->gso_size) |
1098 | len = size; | 1100 | len = size; |
1099 | else { | 1101 | else { |
1100 | 1102 | ||
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 74998f250071..0e029c4e2903 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -258,6 +258,7 @@ | |||
258 | #include <linux/random.h> | 258 | #include <linux/random.h> |
259 | #include <linux/bootmem.h> | 259 | #include <linux/bootmem.h> |
260 | #include <linux/cache.h> | 260 | #include <linux/cache.h> |
261 | #include <linux/err.h> | ||
261 | 262 | ||
262 | #include <net/icmp.h> | 263 | #include <net/icmp.h> |
263 | #include <net/tcp.h> | 264 | #include <net/tcp.h> |
@@ -571,7 +572,7 @@ new_segment: | |||
571 | skb->ip_summed = CHECKSUM_HW; | 572 | skb->ip_summed = CHECKSUM_HW; |
572 | tp->write_seq += copy; | 573 | tp->write_seq += copy; |
573 | TCP_SKB_CB(skb)->end_seq += copy; | 574 | TCP_SKB_CB(skb)->end_seq += copy; |
574 | skb_shinfo(skb)->tso_segs = 0; | 575 | skb_shinfo(skb)->gso_segs = 0; |
575 | 576 | ||
576 | if (!copied) | 577 | if (!copied) |
577 | TCP_SKB_CB(skb)->flags &= ~TCPCB_FLAG_PSH; | 578 | TCP_SKB_CB(skb)->flags &= ~TCPCB_FLAG_PSH; |
@@ -818,7 +819,7 @@ new_segment: | |||
818 | 819 | ||
819 | tp->write_seq += copy; | 820 | tp->write_seq += copy; |
820 | TCP_SKB_CB(skb)->end_seq += copy; | 821 | TCP_SKB_CB(skb)->end_seq += copy; |
821 | skb_shinfo(skb)->tso_segs = 0; | 822 | skb_shinfo(skb)->gso_segs = 0; |
822 | 823 | ||
823 | from += copy; | 824 | from += copy; |
824 | copied += copy; | 825 | copied += copy; |
@@ -2144,6 +2145,67 @@ int compat_tcp_getsockopt(struct sock *sk, int level, int optname, | |||
2144 | EXPORT_SYMBOL(compat_tcp_getsockopt); | 2145 | EXPORT_SYMBOL(compat_tcp_getsockopt); |
2145 | #endif | 2146 | #endif |
2146 | 2147 | ||
2148 | struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int sg) | ||
2149 | { | ||
2150 | struct sk_buff *segs = ERR_PTR(-EINVAL); | ||
2151 | struct tcphdr *th; | ||
2152 | unsigned thlen; | ||
2153 | unsigned int seq; | ||
2154 | unsigned int delta; | ||
2155 | unsigned int oldlen; | ||
2156 | unsigned int len; | ||
2157 | |||
2158 | if (!pskb_may_pull(skb, sizeof(*th))) | ||
2159 | goto out; | ||
2160 | |||
2161 | th = skb->h.th; | ||
2162 | thlen = th->doff * 4; | ||
2163 | if (thlen < sizeof(*th)) | ||
2164 | goto out; | ||
2165 | |||
2166 | if (!pskb_may_pull(skb, thlen)) | ||
2167 | goto out; | ||
2168 | |||
2169 | oldlen = ~htonl(skb->len); | ||
2170 | __skb_pull(skb, thlen); | ||
2171 | |||
2172 | segs = skb_segment(skb, sg); | ||
2173 | if (IS_ERR(segs)) | ||
2174 | goto out; | ||
2175 | |||
2176 | len = skb_shinfo(skb)->gso_size; | ||
2177 | delta = csum_add(oldlen, htonl(thlen + len)); | ||
2178 | |||
2179 | skb = segs; | ||
2180 | th = skb->h.th; | ||
2181 | seq = ntohl(th->seq); | ||
2182 | |||
2183 | do { | ||
2184 | th->fin = th->psh = 0; | ||
2185 | |||
2186 | if (skb->ip_summed == CHECKSUM_NONE) { | ||
2187 | th->check = csum_fold(csum_partial( | ||
2188 | skb->h.raw, thlen, csum_add(skb->csum, delta))); | ||
2189 | } | ||
2190 | |||
2191 | seq += len; | ||
2192 | skb = skb->next; | ||
2193 | th = skb->h.th; | ||
2194 | |||
2195 | th->seq = htonl(seq); | ||
2196 | th->cwr = 0; | ||
2197 | } while (skb->next); | ||
2198 | |||
2199 | if (skb->ip_summed == CHECKSUM_NONE) { | ||
2200 | delta = csum_add(oldlen, htonl(skb->tail - skb->h.raw)); | ||
2201 | th->check = csum_fold(csum_partial( | ||
2202 | skb->h.raw, thlen, csum_add(skb->csum, delta))); | ||
2203 | } | ||
2204 | |||
2205 | out: | ||
2206 | return segs; | ||
2207 | } | ||
2208 | |||
2147 | extern void __skb_cb_too_small_for_tcp(int, int); | 2209 | extern void __skb_cb_too_small_for_tcp(int, int); |
2148 | extern struct tcp_congestion_ops tcp_reno; | 2210 | extern struct tcp_congestion_ops tcp_reno; |
2149 | 2211 | ||
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index e08245bdda3a..94fe5b1f9dcb 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -1073,7 +1073,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ | |||
1073 | else | 1073 | else |
1074 | pkt_len = (end_seq - | 1074 | pkt_len = (end_seq - |
1075 | TCP_SKB_CB(skb)->seq); | 1075 | TCP_SKB_CB(skb)->seq); |
1076 | if (tcp_fragment(sk, skb, pkt_len, skb_shinfo(skb)->tso_size)) | 1076 | if (tcp_fragment(sk, skb, pkt_len, skb_shinfo(skb)->gso_size)) |
1077 | break; | 1077 | break; |
1078 | pcount = tcp_skb_pcount(skb); | 1078 | pcount = tcp_skb_pcount(skb); |
1079 | } | 1079 | } |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 07bb5a2b375e..bdd71db8bf90 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -515,15 +515,17 @@ static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb, unsigned | |||
515 | /* Avoid the costly divide in the normal | 515 | /* Avoid the costly divide in the normal |
516 | * non-TSO case. | 516 | * non-TSO case. |
517 | */ | 517 | */ |
518 | skb_shinfo(skb)->tso_segs = 1; | 518 | skb_shinfo(skb)->gso_segs = 1; |
519 | skb_shinfo(skb)->tso_size = 0; | 519 | skb_shinfo(skb)->gso_size = 0; |
520 | skb_shinfo(skb)->gso_type = 0; | ||
520 | } else { | 521 | } else { |
521 | unsigned int factor; | 522 | unsigned int factor; |
522 | 523 | ||
523 | factor = skb->len + (mss_now - 1); | 524 | factor = skb->len + (mss_now - 1); |
524 | factor /= mss_now; | 525 | factor /= mss_now; |
525 | skb_shinfo(skb)->tso_segs = factor; | 526 | skb_shinfo(skb)->gso_segs = factor; |
526 | skb_shinfo(skb)->tso_size = mss_now; | 527 | skb_shinfo(skb)->gso_size = mss_now; |
528 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; | ||
527 | } | 529 | } |
528 | } | 530 | } |
529 | 531 | ||
@@ -914,7 +916,7 @@ static int tcp_init_tso_segs(struct sock *sk, struct sk_buff *skb, unsigned int | |||
914 | 916 | ||
915 | if (!tso_segs || | 917 | if (!tso_segs || |
916 | (tso_segs > 1 && | 918 | (tso_segs > 1 && |
917 | skb_shinfo(skb)->tso_size != mss_now)) { | 919 | tcp_skb_mss(skb) != mss_now)) { |
918 | tcp_set_skb_tso_segs(sk, skb, mss_now); | 920 | tcp_set_skb_tso_segs(sk, skb, mss_now); |
919 | tso_segs = tcp_skb_pcount(skb); | 921 | tso_segs = tcp_skb_pcount(skb); |
920 | } | 922 | } |
@@ -1724,8 +1726,9 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) | |||
1724 | tp->snd_una == (TCP_SKB_CB(skb)->end_seq - 1)) { | 1726 | tp->snd_una == (TCP_SKB_CB(skb)->end_seq - 1)) { |
1725 | if (!pskb_trim(skb, 0)) { | 1727 | if (!pskb_trim(skb, 0)) { |
1726 | TCP_SKB_CB(skb)->seq = TCP_SKB_CB(skb)->end_seq - 1; | 1728 | TCP_SKB_CB(skb)->seq = TCP_SKB_CB(skb)->end_seq - 1; |
1727 | skb_shinfo(skb)->tso_segs = 1; | 1729 | skb_shinfo(skb)->gso_segs = 1; |
1728 | skb_shinfo(skb)->tso_size = 0; | 1730 | skb_shinfo(skb)->gso_size = 0; |
1731 | skb_shinfo(skb)->gso_type = 0; | ||
1729 | skb->ip_summed = CHECKSUM_NONE; | 1732 | skb->ip_summed = CHECKSUM_NONE; |
1730 | skb->csum = 0; | 1733 | skb->csum = 0; |
1731 | } | 1734 | } |
@@ -1930,8 +1933,9 @@ void tcp_send_fin(struct sock *sk) | |||
1930 | skb->csum = 0; | 1933 | skb->csum = 0; |
1931 | TCP_SKB_CB(skb)->flags = (TCPCB_FLAG_ACK | TCPCB_FLAG_FIN); | 1934 | TCP_SKB_CB(skb)->flags = (TCPCB_FLAG_ACK | TCPCB_FLAG_FIN); |
1932 | TCP_SKB_CB(skb)->sacked = 0; | 1935 | TCP_SKB_CB(skb)->sacked = 0; |
1933 | skb_shinfo(skb)->tso_segs = 1; | 1936 | skb_shinfo(skb)->gso_segs = 1; |
1934 | skb_shinfo(skb)->tso_size = 0; | 1937 | skb_shinfo(skb)->gso_size = 0; |
1938 | skb_shinfo(skb)->gso_type = 0; | ||
1935 | 1939 | ||
1936 | /* FIN eats a sequence byte, write_seq advanced by tcp_queue_skb(). */ | 1940 | /* FIN eats a sequence byte, write_seq advanced by tcp_queue_skb(). */ |
1937 | TCP_SKB_CB(skb)->seq = tp->write_seq; | 1941 | TCP_SKB_CB(skb)->seq = tp->write_seq; |
@@ -1963,8 +1967,9 @@ void tcp_send_active_reset(struct sock *sk, gfp_t priority) | |||
1963 | skb->csum = 0; | 1967 | skb->csum = 0; |
1964 | TCP_SKB_CB(skb)->flags = (TCPCB_FLAG_ACK | TCPCB_FLAG_RST); | 1968 | TCP_SKB_CB(skb)->flags = (TCPCB_FLAG_ACK | TCPCB_FLAG_RST); |
1965 | TCP_SKB_CB(skb)->sacked = 0; | 1969 | TCP_SKB_CB(skb)->sacked = 0; |
1966 | skb_shinfo(skb)->tso_segs = 1; | 1970 | skb_shinfo(skb)->gso_segs = 1; |
1967 | skb_shinfo(skb)->tso_size = 0; | 1971 | skb_shinfo(skb)->gso_size = 0; |
1972 | skb_shinfo(skb)->gso_type = 0; | ||
1968 | 1973 | ||
1969 | /* Send it off. */ | 1974 | /* Send it off. */ |
1970 | TCP_SKB_CB(skb)->seq = tcp_acceptable_seq(sk, tp); | 1975 | TCP_SKB_CB(skb)->seq = tcp_acceptable_seq(sk, tp); |
@@ -2047,8 +2052,9 @@ struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, | |||
2047 | TCP_SKB_CB(skb)->seq = tcp_rsk(req)->snt_isn; | 2052 | TCP_SKB_CB(skb)->seq = tcp_rsk(req)->snt_isn; |
2048 | TCP_SKB_CB(skb)->end_seq = TCP_SKB_CB(skb)->seq + 1; | 2053 | TCP_SKB_CB(skb)->end_seq = TCP_SKB_CB(skb)->seq + 1; |
2049 | TCP_SKB_CB(skb)->sacked = 0; | 2054 | TCP_SKB_CB(skb)->sacked = 0; |
2050 | skb_shinfo(skb)->tso_segs = 1; | 2055 | skb_shinfo(skb)->gso_segs = 1; |
2051 | skb_shinfo(skb)->tso_size = 0; | 2056 | skb_shinfo(skb)->gso_size = 0; |
2057 | skb_shinfo(skb)->gso_type = 0; | ||
2052 | th->seq = htonl(TCP_SKB_CB(skb)->seq); | 2058 | th->seq = htonl(TCP_SKB_CB(skb)->seq); |
2053 | th->ack_seq = htonl(tcp_rsk(req)->rcv_isn + 1); | 2059 | th->ack_seq = htonl(tcp_rsk(req)->rcv_isn + 1); |
2054 | if (req->rcv_wnd == 0) { /* ignored for retransmitted syns */ | 2060 | if (req->rcv_wnd == 0) { /* ignored for retransmitted syns */ |
@@ -2152,8 +2158,9 @@ int tcp_connect(struct sock *sk) | |||
2152 | TCP_SKB_CB(buff)->flags = TCPCB_FLAG_SYN; | 2158 | TCP_SKB_CB(buff)->flags = TCPCB_FLAG_SYN; |
2153 | TCP_ECN_send_syn(sk, tp, buff); | 2159 | TCP_ECN_send_syn(sk, tp, buff); |
2154 | TCP_SKB_CB(buff)->sacked = 0; | 2160 | TCP_SKB_CB(buff)->sacked = 0; |
2155 | skb_shinfo(buff)->tso_segs = 1; | 2161 | skb_shinfo(buff)->gso_segs = 1; |
2156 | skb_shinfo(buff)->tso_size = 0; | 2162 | skb_shinfo(buff)->gso_size = 0; |
2163 | skb_shinfo(buff)->gso_type = 0; | ||
2157 | buff->csum = 0; | 2164 | buff->csum = 0; |
2158 | TCP_SKB_CB(buff)->seq = tp->write_seq++; | 2165 | TCP_SKB_CB(buff)->seq = tp->write_seq++; |
2159 | TCP_SKB_CB(buff)->end_seq = tp->write_seq; | 2166 | TCP_SKB_CB(buff)->end_seq = tp->write_seq; |
@@ -2257,8 +2264,9 @@ void tcp_send_ack(struct sock *sk) | |||
2257 | buff->csum = 0; | 2264 | buff->csum = 0; |
2258 | TCP_SKB_CB(buff)->flags = TCPCB_FLAG_ACK; | 2265 | TCP_SKB_CB(buff)->flags = TCPCB_FLAG_ACK; |
2259 | TCP_SKB_CB(buff)->sacked = 0; | 2266 | TCP_SKB_CB(buff)->sacked = 0; |
2260 | skb_shinfo(buff)->tso_segs = 1; | 2267 | skb_shinfo(buff)->gso_segs = 1; |
2261 | skb_shinfo(buff)->tso_size = 0; | 2268 | skb_shinfo(buff)->gso_size = 0; |
2269 | skb_shinfo(buff)->gso_type = 0; | ||
2262 | 2270 | ||
2263 | /* Send it off, this clears delayed acks for us. */ | 2271 | /* Send it off, this clears delayed acks for us. */ |
2264 | TCP_SKB_CB(buff)->seq = TCP_SKB_CB(buff)->end_seq = tcp_acceptable_seq(sk, tp); | 2272 | TCP_SKB_CB(buff)->seq = TCP_SKB_CB(buff)->end_seq = tcp_acceptable_seq(sk, tp); |
@@ -2293,8 +2301,9 @@ static int tcp_xmit_probe_skb(struct sock *sk, int urgent) | |||
2293 | skb->csum = 0; | 2301 | skb->csum = 0; |
2294 | TCP_SKB_CB(skb)->flags = TCPCB_FLAG_ACK; | 2302 | TCP_SKB_CB(skb)->flags = TCPCB_FLAG_ACK; |
2295 | TCP_SKB_CB(skb)->sacked = urgent; | 2303 | TCP_SKB_CB(skb)->sacked = urgent; |
2296 | skb_shinfo(skb)->tso_segs = 1; | 2304 | skb_shinfo(skb)->gso_segs = 1; |
2297 | skb_shinfo(skb)->tso_size = 0; | 2305 | skb_shinfo(skb)->gso_size = 0; |
2306 | skb_shinfo(skb)->gso_type = 0; | ||
2298 | 2307 | ||
2299 | /* Use a previous sequence. This should cause the other | 2308 | /* Use a previous sequence. This should cause the other |
2300 | * end to send an ack. Don't queue or clone SKB, just | 2309 | * end to send an ack. Don't queue or clone SKB, just |
diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c index ac9d91d4bb05..193363e22932 100644 --- a/net/ipv4/xfrm4_output.c +++ b/net/ipv4/xfrm4_output.c | |||
@@ -9,6 +9,8 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/compiler.h> | 11 | #include <linux/compiler.h> |
12 | #include <linux/if_ether.h> | ||
13 | #include <linux/kernel.h> | ||
12 | #include <linux/skbuff.h> | 14 | #include <linux/skbuff.h> |
13 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
14 | #include <linux/netfilter_ipv4.h> | 16 | #include <linux/netfilter_ipv4.h> |
@@ -97,16 +99,10 @@ error_nolock: | |||
97 | goto out_exit; | 99 | goto out_exit; |
98 | } | 100 | } |
99 | 101 | ||
100 | static int xfrm4_output_finish(struct sk_buff *skb) | 102 | static int xfrm4_output_finish2(struct sk_buff *skb) |
101 | { | 103 | { |
102 | int err; | 104 | int err; |
103 | 105 | ||
104 | #ifdef CONFIG_NETFILTER | ||
105 | if (!skb->dst->xfrm) { | ||
106 | IPCB(skb)->flags |= IPSKB_REROUTED; | ||
107 | return dst_output(skb); | ||
108 | } | ||
109 | #endif | ||
110 | while (likely((err = xfrm4_output_one(skb)) == 0)) { | 106 | while (likely((err = xfrm4_output_one(skb)) == 0)) { |
111 | nf_reset(skb); | 107 | nf_reset(skb); |
112 | 108 | ||
@@ -119,7 +115,7 @@ static int xfrm4_output_finish(struct sk_buff *skb) | |||
119 | return dst_output(skb); | 115 | return dst_output(skb); |
120 | 116 | ||
121 | err = nf_hook(PF_INET, NF_IP_POST_ROUTING, &skb, NULL, | 117 | err = nf_hook(PF_INET, NF_IP_POST_ROUTING, &skb, NULL, |
122 | skb->dst->dev, xfrm4_output_finish); | 118 | skb->dst->dev, xfrm4_output_finish2); |
123 | if (unlikely(err != 1)) | 119 | if (unlikely(err != 1)) |
124 | break; | 120 | break; |
125 | } | 121 | } |
@@ -127,6 +123,48 @@ static int xfrm4_output_finish(struct sk_buff *skb) | |||
127 | return err; | 123 | return err; |
128 | } | 124 | } |
129 | 125 | ||
126 | static int xfrm4_output_finish(struct sk_buff *skb) | ||
127 | { | ||
128 | struct sk_buff *segs; | ||
129 | |||
130 | #ifdef CONFIG_NETFILTER | ||
131 | if (!skb->dst->xfrm) { | ||
132 | IPCB(skb)->flags |= IPSKB_REROUTED; | ||
133 | return dst_output(skb); | ||
134 | } | ||
135 | #endif | ||
136 | |||
137 | if (!skb_shinfo(skb)->gso_size) | ||
138 | return xfrm4_output_finish2(skb); | ||
139 | |||
140 | skb->protocol = htons(ETH_P_IP); | ||
141 | segs = skb_gso_segment(skb, 0); | ||
142 | kfree_skb(skb); | ||
143 | if (unlikely(IS_ERR(segs))) | ||
144 | return PTR_ERR(segs); | ||
145 | |||
146 | do { | ||
147 | struct sk_buff *nskb = segs->next; | ||
148 | int err; | ||
149 | |||
150 | segs->next = NULL; | ||
151 | err = xfrm4_output_finish2(segs); | ||
152 | |||
153 | if (unlikely(err)) { | ||
154 | while ((segs = nskb)) { | ||
155 | nskb = segs->next; | ||
156 | segs->next = NULL; | ||
157 | kfree_skb(segs); | ||
158 | } | ||
159 | return err; | ||
160 | } | ||
161 | |||
162 | segs = nskb; | ||
163 | } while (segs); | ||
164 | |||
165 | return 0; | ||
166 | } | ||
167 | |||
130 | int xfrm4_output(struct sk_buff *skb) | 168 | int xfrm4_output(struct sk_buff *skb) |
131 | { | 169 | { |
132 | return NF_HOOK_COND(PF_INET, NF_IP_POST_ROUTING, skb, NULL, skb->dst->dev, | 170 | return NF_HOOK_COND(PF_INET, NF_IP_POST_ROUTING, skb, NULL, skb->dst->dev, |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index c2c26fa0943d..4da664538f52 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -862,6 +862,8 @@ static int inline ipv6_saddr_label(const struct in6_addr *addr, int type) | |||
862 | * 2002::/16 2 | 862 | * 2002::/16 2 |
863 | * ::/96 3 | 863 | * ::/96 3 |
864 | * ::ffff:0:0/96 4 | 864 | * ::ffff:0:0/96 4 |
865 | * fc00::/7 5 | ||
866 | * 2001::/32 6 | ||
865 | */ | 867 | */ |
866 | if (type & IPV6_ADDR_LOOPBACK) | 868 | if (type & IPV6_ADDR_LOOPBACK) |
867 | return 0; | 869 | return 0; |
@@ -869,8 +871,12 @@ static int inline ipv6_saddr_label(const struct in6_addr *addr, int type) | |||
869 | return 3; | 871 | return 3; |
870 | else if (type & IPV6_ADDR_MAPPED) | 872 | else if (type & IPV6_ADDR_MAPPED) |
871 | return 4; | 873 | return 4; |
874 | else if (addr->s6_addr32[0] == htonl(0x20010000)) | ||
875 | return 6; | ||
872 | else if (addr->s6_addr16[0] == htons(0x2002)) | 876 | else if (addr->s6_addr16[0] == htons(0x2002)) |
873 | return 2; | 877 | return 2; |
878 | else if ((addr->s6_addr[0] & 0xfe) == 0xfc) | ||
879 | return 5; | ||
874 | return 1; | 880 | return 1; |
875 | } | 881 | } |
876 | 882 | ||
@@ -1069,6 +1075,9 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev, | |||
1069 | if (hiscore.attrs & IPV6_SADDR_SCORE_PRIVACY) | 1075 | if (hiscore.attrs & IPV6_SADDR_SCORE_PRIVACY) |
1070 | continue; | 1076 | continue; |
1071 | } | 1077 | } |
1078 | #else | ||
1079 | if (hiscore.rule < 7) | ||
1080 | hiscore.rule++; | ||
1072 | #endif | 1081 | #endif |
1073 | /* Rule 8: Use longest matching prefix */ | 1082 | /* Rule 8: Use longest matching prefix */ |
1074 | if (hiscore.rule < 8) { | 1083 | if (hiscore.rule < 8) { |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index d29620f4910e..abb94de33768 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -148,7 +148,7 @@ static int ip6_output2(struct sk_buff *skb) | |||
148 | 148 | ||
149 | int ip6_output(struct sk_buff *skb) | 149 | int ip6_output(struct sk_buff *skb) |
150 | { | 150 | { |
151 | if ((skb->len > dst_mtu(skb->dst) && !skb_shinfo(skb)->ufo_size) || | 151 | if ((skb->len > dst_mtu(skb->dst) && !skb_shinfo(skb)->gso_size) || |
152 | dst_allfrag(skb->dst)) | 152 | dst_allfrag(skb->dst)) |
153 | return ip6_fragment(skb, ip6_output2); | 153 | return ip6_fragment(skb, ip6_output2); |
154 | else | 154 | else |
@@ -833,8 +833,9 @@ static inline int ip6_ufo_append_data(struct sock *sk, | |||
833 | struct frag_hdr fhdr; | 833 | struct frag_hdr fhdr; |
834 | 834 | ||
835 | /* specify the length of each IP datagram fragment*/ | 835 | /* specify the length of each IP datagram fragment*/ |
836 | skb_shinfo(skb)->ufo_size = (mtu - fragheaderlen) - | 836 | skb_shinfo(skb)->gso_size = mtu - fragheaderlen - |
837 | sizeof(struct frag_hdr); | 837 | sizeof(struct frag_hdr); |
838 | skb_shinfo(skb)->gso_type = SKB_GSO_UDPV4; | ||
838 | ipv6_select_ident(skb, &fhdr); | 839 | ipv6_select_ident(skb, &fhdr); |
839 | skb_shinfo(skb)->ip6_frag_id = fhdr.identification; | 840 | skb_shinfo(skb)->ip6_frag_id = fhdr.identification; |
840 | __skb_queue_tail(&sk->sk_write_queue, skb); | 841 | __skb_queue_tail(&sk->sk_write_queue, skb); |
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c index 16e84254a252..48fccb1eca08 100644 --- a/net/ipv6/xfrm6_output.c +++ b/net/ipv6/xfrm6_output.c | |||
@@ -94,7 +94,7 @@ error_nolock: | |||
94 | goto out_exit; | 94 | goto out_exit; |
95 | } | 95 | } |
96 | 96 | ||
97 | static int xfrm6_output_finish(struct sk_buff *skb) | 97 | static int xfrm6_output_finish2(struct sk_buff *skb) |
98 | { | 98 | { |
99 | int err; | 99 | int err; |
100 | 100 | ||
@@ -110,7 +110,7 @@ static int xfrm6_output_finish(struct sk_buff *skb) | |||
110 | return dst_output(skb); | 110 | return dst_output(skb); |
111 | 111 | ||
112 | err = nf_hook(PF_INET6, NF_IP6_POST_ROUTING, &skb, NULL, | 112 | err = nf_hook(PF_INET6, NF_IP6_POST_ROUTING, &skb, NULL, |
113 | skb->dst->dev, xfrm6_output_finish); | 113 | skb->dst->dev, xfrm6_output_finish2); |
114 | if (unlikely(err != 1)) | 114 | if (unlikely(err != 1)) |
115 | break; | 115 | break; |
116 | } | 116 | } |
@@ -118,6 +118,41 @@ static int xfrm6_output_finish(struct sk_buff *skb) | |||
118 | return err; | 118 | return err; |
119 | } | 119 | } |
120 | 120 | ||
121 | static int xfrm6_output_finish(struct sk_buff *skb) | ||
122 | { | ||
123 | struct sk_buff *segs; | ||
124 | |||
125 | if (!skb_shinfo(skb)->gso_size) | ||
126 | return xfrm6_output_finish2(skb); | ||
127 | |||
128 | skb->protocol = htons(ETH_P_IP); | ||
129 | segs = skb_gso_segment(skb, 0); | ||
130 | kfree_skb(skb); | ||
131 | if (unlikely(IS_ERR(segs))) | ||
132 | return PTR_ERR(segs); | ||
133 | |||
134 | do { | ||
135 | struct sk_buff *nskb = segs->next; | ||
136 | int err; | ||
137 | |||
138 | segs->next = NULL; | ||
139 | err = xfrm6_output_finish2(segs); | ||
140 | |||
141 | if (unlikely(err)) { | ||
142 | while ((segs = nskb)) { | ||
143 | nskb = segs->next; | ||
144 | segs->next = NULL; | ||
145 | kfree_skb(segs); | ||
146 | } | ||
147 | return err; | ||
148 | } | ||
149 | |||
150 | segs = nskb; | ||
151 | } while (segs); | ||
152 | |||
153 | return 0; | ||
154 | } | ||
155 | |||
121 | int xfrm6_output(struct sk_buff *skb) | 156 | int xfrm6_output(struct sk_buff *skb) |
122 | { | 157 | { |
123 | return NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, skb, NULL, skb->dst->dev, | 158 | return NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, skb, NULL, skb->dst->dev, |
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index d7aca8ef524a..74d4a1dceeec 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -96,8 +96,11 @@ static inline int qdisc_restart(struct net_device *dev) | |||
96 | struct sk_buff *skb; | 96 | struct sk_buff *skb; |
97 | 97 | ||
98 | /* Dequeue packet */ | 98 | /* Dequeue packet */ |
99 | if ((skb = q->dequeue(q)) != NULL) { | 99 | if (((skb = dev->gso_skb)) || ((skb = q->dequeue(q)))) { |
100 | unsigned nolock = (dev->features & NETIF_F_LLTX); | 100 | unsigned nolock = (dev->features & NETIF_F_LLTX); |
101 | |||
102 | dev->gso_skb = NULL; | ||
103 | |||
101 | /* | 104 | /* |
102 | * When the driver has LLTX set it does its own locking | 105 | * When the driver has LLTX set it does its own locking |
103 | * in start_xmit. No need to add additional overhead by | 106 | * in start_xmit. No need to add additional overhead by |
@@ -134,10 +137,8 @@ static inline int qdisc_restart(struct net_device *dev) | |||
134 | 137 | ||
135 | if (!netif_queue_stopped(dev)) { | 138 | if (!netif_queue_stopped(dev)) { |
136 | int ret; | 139 | int ret; |
137 | if (netdev_nit) | ||
138 | dev_queue_xmit_nit(skb, dev); | ||
139 | 140 | ||
140 | ret = dev->hard_start_xmit(skb, dev); | 141 | ret = dev_hard_start_xmit(skb, dev); |
141 | if (ret == NETDEV_TX_OK) { | 142 | if (ret == NETDEV_TX_OK) { |
142 | if (!nolock) { | 143 | if (!nolock) { |
143 | netif_tx_unlock(dev); | 144 | netif_tx_unlock(dev); |
@@ -171,7 +172,10 @@ static inline int qdisc_restart(struct net_device *dev) | |||
171 | */ | 172 | */ |
172 | 173 | ||
173 | requeue: | 174 | requeue: |
174 | q->ops->requeue(skb, q); | 175 | if (skb->next) |
176 | dev->gso_skb = skb; | ||
177 | else | ||
178 | q->ops->requeue(skb, q); | ||
175 | netif_schedule(dev); | 179 | netif_schedule(dev); |
176 | return 1; | 180 | return 1; |
177 | } | 181 | } |
@@ -181,9 +185,13 @@ requeue: | |||
181 | 185 | ||
182 | void __qdisc_run(struct net_device *dev) | 186 | void __qdisc_run(struct net_device *dev) |
183 | { | 187 | { |
188 | if (unlikely(dev->qdisc == &noop_qdisc)) | ||
189 | goto out; | ||
190 | |||
184 | while (qdisc_restart(dev) < 0 && !netif_queue_stopped(dev)) | 191 | while (qdisc_restart(dev) < 0 && !netif_queue_stopped(dev)) |
185 | /* NOTHING */; | 192 | /* NOTHING */; |
186 | 193 | ||
194 | out: | ||
187 | clear_bit(__LINK_STATE_QDISC_RUNNING, &dev->state); | 195 | clear_bit(__LINK_STATE_QDISC_RUNNING, &dev->state); |
188 | } | 196 | } |
189 | 197 | ||
@@ -583,10 +591,17 @@ void dev_deactivate(struct net_device *dev) | |||
583 | 591 | ||
584 | dev_watchdog_down(dev); | 592 | dev_watchdog_down(dev); |
585 | 593 | ||
586 | while (test_bit(__LINK_STATE_SCHED, &dev->state)) | 594 | /* Wait for outstanding dev_queue_xmit calls. */ |
595 | synchronize_rcu(); | ||
596 | |||
597 | /* Wait for outstanding qdisc_run calls. */ | ||
598 | while (test_bit(__LINK_STATE_QDISC_RUNNING, &dev->state)) | ||
587 | yield(); | 599 | yield(); |
588 | 600 | ||
589 | spin_unlock_wait(&dev->_xmit_lock); | 601 | if (dev->gso_skb) { |
602 | kfree_skb(dev->gso_skb); | ||
603 | dev->gso_skb = NULL; | ||
604 | } | ||
590 | } | 605 | } |
591 | 606 | ||
592 | void dev_init_scheduler(struct net_device *dev) | 607 | void dev_init_scheduler(struct net_device *dev) |