diff options
Diffstat (limited to 'net/core/dev.c')
| -rw-r--r-- | net/core/dev.c | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index cd0981977f5c..1cb0d8a6aa6c 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -1136,8 +1136,8 @@ void dev_load(struct net *net, const char *name) | |||
| 1136 | no_module = request_module("netdev-%s", name); | 1136 | no_module = request_module("netdev-%s", name); |
| 1137 | if (no_module && capable(CAP_SYS_MODULE)) { | 1137 | if (no_module && capable(CAP_SYS_MODULE)) { |
| 1138 | if (!request_module("%s", name)) | 1138 | if (!request_module("%s", name)) |
| 1139 | pr_err("Loading kernel module for a network device with CAP_SYS_MODULE (deprecated). Use CAP_NET_ADMIN and alias netdev-%s instead.\n", | 1139 | pr_warn("Loading kernel module for a network device with CAP_SYS_MODULE (deprecated). Use CAP_NET_ADMIN and alias netdev-%s instead.\n", |
| 1140 | name); | 1140 | name); |
| 1141 | } | 1141 | } |
| 1142 | } | 1142 | } |
| 1143 | EXPORT_SYMBOL(dev_load); | 1143 | EXPORT_SYMBOL(dev_load); |
| @@ -2089,25 +2089,6 @@ static int dev_gso_segment(struct sk_buff *skb, netdev_features_t features) | |||
| 2089 | return 0; | 2089 | return 0; |
| 2090 | } | 2090 | } |
| 2091 | 2091 | ||
| 2092 | /* | ||
| 2093 | * Try to orphan skb early, right before transmission by the device. | ||
| 2094 | * We cannot orphan skb if tx timestamp is requested or the sk-reference | ||
| 2095 | * is needed on driver level for other reasons, e.g. see net/can/raw.c | ||
| 2096 | */ | ||
| 2097 | static inline void skb_orphan_try(struct sk_buff *skb) | ||
| 2098 | { | ||
| 2099 | struct sock *sk = skb->sk; | ||
| 2100 | |||
| 2101 | if (sk && !skb_shinfo(skb)->tx_flags) { | ||
| 2102 | /* skb_tx_hash() wont be able to get sk. | ||
| 2103 | * We copy sk_hash into skb->rxhash | ||
| 2104 | */ | ||
| 2105 | if (!skb->rxhash) | ||
| 2106 | skb->rxhash = sk->sk_hash; | ||
| 2107 | skb_orphan(skb); | ||
| 2108 | } | ||
| 2109 | } | ||
| 2110 | |||
| 2111 | static bool can_checksum_protocol(netdev_features_t features, __be16 protocol) | 2092 | static bool can_checksum_protocol(netdev_features_t features, __be16 protocol) |
| 2112 | { | 2093 | { |
| 2113 | return ((features & NETIF_F_GEN_CSUM) || | 2094 | return ((features & NETIF_F_GEN_CSUM) || |
| @@ -2193,8 +2174,6 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, | |||
| 2193 | if (!list_empty(&ptype_all)) | 2174 | if (!list_empty(&ptype_all)) |
| 2194 | dev_queue_xmit_nit(skb, dev); | 2175 | dev_queue_xmit_nit(skb, dev); |
| 2195 | 2176 | ||
| 2196 | skb_orphan_try(skb); | ||
| 2197 | |||
| 2198 | features = netif_skb_features(skb); | 2177 | features = netif_skb_features(skb); |
| 2199 | 2178 | ||
| 2200 | if (vlan_tx_tag_present(skb) && | 2179 | if (vlan_tx_tag_present(skb) && |
| @@ -2304,7 +2283,7 @@ u16 __skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb, | |||
| 2304 | if (skb->sk && skb->sk->sk_hash) | 2283 | if (skb->sk && skb->sk->sk_hash) |
| 2305 | hash = skb->sk->sk_hash; | 2284 | hash = skb->sk->sk_hash; |
| 2306 | else | 2285 | else |
| 2307 | hash = (__force u16) skb->protocol ^ skb->rxhash; | 2286 | hash = (__force u16) skb->protocol; |
| 2308 | hash = jhash_1word(hash, hashrnd); | 2287 | hash = jhash_1word(hash, hashrnd); |
| 2309 | 2288 | ||
| 2310 | return (u16) (((u64) hash * qcount) >> 32) + qoffset; | 2289 | return (u16) (((u64) hash * qcount) >> 32) + qoffset; |
| @@ -2465,8 +2444,12 @@ static void skb_update_prio(struct sk_buff *skb) | |||
| 2465 | { | 2444 | { |
| 2466 | struct netprio_map *map = rcu_dereference_bh(skb->dev->priomap); | 2445 | struct netprio_map *map = rcu_dereference_bh(skb->dev->priomap); |
| 2467 | 2446 | ||
| 2468 | if ((!skb->priority) && (skb->sk) && map) | 2447 | if (!skb->priority && skb->sk && map) { |
| 2469 | skb->priority = map->priomap[skb->sk->sk_cgrp_prioidx]; | 2448 | unsigned int prioidx = skb->sk->sk_cgrp_prioidx; |
| 2449 | |||
| 2450 | if (prioidx < map->priomap_len) | ||
| 2451 | skb->priority = map->priomap[prioidx]; | ||
| 2452 | } | ||
| 2470 | } | 2453 | } |
| 2471 | #else | 2454 | #else |
| 2472 | #define skb_update_prio(skb) | 2455 | #define skb_update_prio(skb) |
| @@ -6300,7 +6283,8 @@ static struct hlist_head *netdev_create_hash(void) | |||
| 6300 | /* Initialize per network namespace state */ | 6283 | /* Initialize per network namespace state */ |
| 6301 | static int __net_init netdev_init(struct net *net) | 6284 | static int __net_init netdev_init(struct net *net) |
| 6302 | { | 6285 | { |
| 6303 | INIT_LIST_HEAD(&net->dev_base_head); | 6286 | if (net != &init_net) |
| 6287 | INIT_LIST_HEAD(&net->dev_base_head); | ||
| 6304 | 6288 | ||
| 6305 | net->dev_name_head = netdev_create_hash(); | 6289 | net->dev_name_head = netdev_create_hash(); |
| 6306 | if (net->dev_name_head == NULL) | 6290 | if (net->dev_name_head == NULL) |
