diff options
author | David S. Miller <davem@davemloft.net> | 2014-03-29 18:48:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-03-29 18:48:54 -0400 |
commit | 64c27237a07129758e33f5f824ba5c33b7f57417 (patch) | |
tree | 4c0c0a9b6d282d600f2226e1b3510096b9d789dd /net/core | |
parent | 77a9939426f7a3f35f460afc9b11f1fe45955409 (diff) | |
parent | 49d8137a4039c63c834827f4bfe875e27bb9c521 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
drivers/net/ethernet/marvell/mvneta.c
The mvneta.c conflict is a case of overlapping changes,
a conversion to devm_ioremap_resource() vs. a conversion
to netdev_alloc_pcpu_stats.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/dev.c | 13 | ||||
-rw-r--r-- | net/core/skbuff.c | 30 |
2 files changed, 31 insertions, 12 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 778b2036a9e7..cf92139b229c 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2281,7 +2281,7 @@ out: | |||
2281 | } | 2281 | } |
2282 | EXPORT_SYMBOL(skb_checksum_help); | 2282 | EXPORT_SYMBOL(skb_checksum_help); |
2283 | 2283 | ||
2284 | __be16 skb_network_protocol(struct sk_buff *skb) | 2284 | __be16 skb_network_protocol(struct sk_buff *skb, int *depth) |
2285 | { | 2285 | { |
2286 | __be16 type = skb->protocol; | 2286 | __be16 type = skb->protocol; |
2287 | int vlan_depth = ETH_HLEN; | 2287 | int vlan_depth = ETH_HLEN; |
@@ -2308,6 +2308,8 @@ __be16 skb_network_protocol(struct sk_buff *skb) | |||
2308 | vlan_depth += VLAN_HLEN; | 2308 | vlan_depth += VLAN_HLEN; |
2309 | } | 2309 | } |
2310 | 2310 | ||
2311 | *depth = vlan_depth; | ||
2312 | |||
2311 | return type; | 2313 | return type; |
2312 | } | 2314 | } |
2313 | 2315 | ||
@@ -2321,12 +2323,13 @@ struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb, | |||
2321 | { | 2323 | { |
2322 | struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT); | 2324 | struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT); |
2323 | struct packet_offload *ptype; | 2325 | struct packet_offload *ptype; |
2324 | __be16 type = skb_network_protocol(skb); | 2326 | int vlan_depth = skb->mac_len; |
2327 | __be16 type = skb_network_protocol(skb, &vlan_depth); | ||
2325 | 2328 | ||
2326 | if (unlikely(!type)) | 2329 | if (unlikely(!type)) |
2327 | return ERR_PTR(-EINVAL); | 2330 | return ERR_PTR(-EINVAL); |
2328 | 2331 | ||
2329 | __skb_pull(skb, skb->mac_len); | 2332 | __skb_pull(skb, vlan_depth); |
2330 | 2333 | ||
2331 | rcu_read_lock(); | 2334 | rcu_read_lock(); |
2332 | list_for_each_entry_rcu(ptype, &offload_base, list) { | 2335 | list_for_each_entry_rcu(ptype, &offload_base, list) { |
@@ -2493,8 +2496,10 @@ static netdev_features_t harmonize_features(struct sk_buff *skb, | |||
2493 | const struct net_device *dev, | 2496 | const struct net_device *dev, |
2494 | netdev_features_t features) | 2497 | netdev_features_t features) |
2495 | { | 2498 | { |
2499 | int tmp; | ||
2500 | |||
2496 | if (skb->ip_summed != CHECKSUM_NONE && | 2501 | if (skb->ip_summed != CHECKSUM_NONE && |
2497 | !can_checksum_protocol(features, skb_network_protocol(skb))) { | 2502 | !can_checksum_protocol(features, skb_network_protocol(skb, &tmp))) { |
2498 | features &= ~NETIF_F_ALL_CSUM; | 2503 | features &= ~NETIF_F_ALL_CSUM; |
2499 | } else if (illegal_highdma(dev, skb)) { | 2504 | } else if (illegal_highdma(dev, skb)) { |
2500 | features &= ~NETIF_F_SG; | 2505 | features &= ~NETIF_F_SG; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 3f14c638c2b1..30c7d35dd862 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -2127,25 +2127,31 @@ EXPORT_SYMBOL_GPL(skb_zerocopy_headlen); | |||
2127 | * | 2127 | * |
2128 | * The `hlen` as calculated by skb_zerocopy_headlen() specifies the | 2128 | * The `hlen` as calculated by skb_zerocopy_headlen() specifies the |
2129 | * headroom in the `to` buffer. | 2129 | * headroom in the `to` buffer. |
2130 | * | ||
2131 | * Return value: | ||
2132 | * 0: everything is OK | ||
2133 | * -ENOMEM: couldn't orphan frags of @from due to lack of memory | ||
2134 | * -EFAULT: skb_copy_bits() found some problem with skb geometry | ||
2130 | */ | 2135 | */ |
2131 | void | 2136 | int |
2132 | skb_zerocopy(struct sk_buff *to, const struct sk_buff *from, int len, int hlen) | 2137 | skb_zerocopy(struct sk_buff *to, struct sk_buff *from, int len, int hlen) |
2133 | { | 2138 | { |
2134 | int i, j = 0; | 2139 | int i, j = 0; |
2135 | int plen = 0; /* length of skb->head fragment */ | 2140 | int plen = 0; /* length of skb->head fragment */ |
2141 | int ret; | ||
2136 | struct page *page; | 2142 | struct page *page; |
2137 | unsigned int offset; | 2143 | unsigned int offset; |
2138 | 2144 | ||
2139 | BUG_ON(!from->head_frag && !hlen); | 2145 | BUG_ON(!from->head_frag && !hlen); |
2140 | 2146 | ||
2141 | /* dont bother with small payloads */ | 2147 | /* dont bother with small payloads */ |
2142 | if (len <= skb_tailroom(to)) { | 2148 | if (len <= skb_tailroom(to)) |
2143 | skb_copy_bits(from, 0, skb_put(to, len), len); | 2149 | return skb_copy_bits(from, 0, skb_put(to, len), len); |
2144 | return; | ||
2145 | } | ||
2146 | 2150 | ||
2147 | if (hlen) { | 2151 | if (hlen) { |
2148 | skb_copy_bits(from, 0, skb_put(to, hlen), hlen); | 2152 | ret = skb_copy_bits(from, 0, skb_put(to, hlen), hlen); |
2153 | if (unlikely(ret)) | ||
2154 | return ret; | ||
2149 | len -= hlen; | 2155 | len -= hlen; |
2150 | } else { | 2156 | } else { |
2151 | plen = min_t(int, skb_headlen(from), len); | 2157 | plen = min_t(int, skb_headlen(from), len); |
@@ -2163,6 +2169,11 @@ skb_zerocopy(struct sk_buff *to, const struct sk_buff *from, int len, int hlen) | |||
2163 | to->len += len + plen; | 2169 | to->len += len + plen; |
2164 | to->data_len += len + plen; | 2170 | to->data_len += len + plen; |
2165 | 2171 | ||
2172 | if (unlikely(skb_orphan_frags(from, GFP_ATOMIC))) { | ||
2173 | skb_tx_error(from); | ||
2174 | return -ENOMEM; | ||
2175 | } | ||
2176 | |||
2166 | for (i = 0; i < skb_shinfo(from)->nr_frags; i++) { | 2177 | for (i = 0; i < skb_shinfo(from)->nr_frags; i++) { |
2167 | if (!len) | 2178 | if (!len) |
2168 | break; | 2179 | break; |
@@ -2173,6 +2184,8 @@ skb_zerocopy(struct sk_buff *to, const struct sk_buff *from, int len, int hlen) | |||
2173 | j++; | 2184 | j++; |
2174 | } | 2185 | } |
2175 | skb_shinfo(to)->nr_frags = j; | 2186 | skb_shinfo(to)->nr_frags = j; |
2187 | |||
2188 | return 0; | ||
2176 | } | 2189 | } |
2177 | EXPORT_SYMBOL_GPL(skb_zerocopy); | 2190 | EXPORT_SYMBOL_GPL(skb_zerocopy); |
2178 | 2191 | ||
@@ -2866,8 +2879,9 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb, | |||
2866 | int err = -ENOMEM; | 2879 | int err = -ENOMEM; |
2867 | int i = 0; | 2880 | int i = 0; |
2868 | int pos; | 2881 | int pos; |
2882 | int dummy; | ||
2869 | 2883 | ||
2870 | proto = skb_network_protocol(head_skb); | 2884 | proto = skb_network_protocol(head_skb, &dummy); |
2871 | if (unlikely(!proto)) | 2885 | if (unlikely(!proto)) |
2872 | return ERR_PTR(-EINVAL); | 2886 | return ERR_PTR(-EINVAL); |
2873 | 2887 | ||