diff options
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/dev.c | 28 | ||||
-rw-r--r-- | net/core/fib_rules.c | 7 | ||||
-rw-r--r-- | net/core/flow_dissector.c | 20 | ||||
-rw-r--r-- | net/core/neighbour.c | 8 | ||||
-rw-r--r-- | net/core/netpoll.c | 4 | ||||
-rw-r--r-- | net/core/rtnetlink.c | 21 | ||||
-rw-r--r-- | net/core/skbuff.c | 3 | ||||
-rw-r--r-- | net/core/sock.c | 6 |
8 files changed, 50 insertions, 47 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 3721db716350..b1b0c8d4d7df 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2420,7 +2420,7 @@ EXPORT_SYMBOL(netdev_rx_csum_fault); | |||
2420 | * 2. No high memory really exists on this machine. | 2420 | * 2. No high memory really exists on this machine. |
2421 | */ | 2421 | */ |
2422 | 2422 | ||
2423 | static int illegal_highdma(struct net_device *dev, struct sk_buff *skb) | 2423 | static int illegal_highdma(const struct net_device *dev, struct sk_buff *skb) |
2424 | { | 2424 | { |
2425 | #ifdef CONFIG_HIGHMEM | 2425 | #ifdef CONFIG_HIGHMEM |
2426 | int i; | 2426 | int i; |
@@ -2495,34 +2495,36 @@ static int dev_gso_segment(struct sk_buff *skb, netdev_features_t features) | |||
2495 | } | 2495 | } |
2496 | 2496 | ||
2497 | static netdev_features_t harmonize_features(struct sk_buff *skb, | 2497 | static netdev_features_t harmonize_features(struct sk_buff *skb, |
2498 | netdev_features_t features) | 2498 | const struct net_device *dev, |
2499 | netdev_features_t features) | ||
2499 | { | 2500 | { |
2500 | if (skb->ip_summed != CHECKSUM_NONE && | 2501 | if (skb->ip_summed != CHECKSUM_NONE && |
2501 | !can_checksum_protocol(features, skb_network_protocol(skb))) { | 2502 | !can_checksum_protocol(features, skb_network_protocol(skb))) { |
2502 | features &= ~NETIF_F_ALL_CSUM; | 2503 | features &= ~NETIF_F_ALL_CSUM; |
2503 | } else if (illegal_highdma(skb->dev, skb)) { | 2504 | } else if (illegal_highdma(dev, skb)) { |
2504 | features &= ~NETIF_F_SG; | 2505 | features &= ~NETIF_F_SG; |
2505 | } | 2506 | } |
2506 | 2507 | ||
2507 | return features; | 2508 | return features; |
2508 | } | 2509 | } |
2509 | 2510 | ||
2510 | netdev_features_t netif_skb_features(struct sk_buff *skb) | 2511 | netdev_features_t netif_skb_dev_features(struct sk_buff *skb, |
2512 | const struct net_device *dev) | ||
2511 | { | 2513 | { |
2512 | __be16 protocol = skb->protocol; | 2514 | __be16 protocol = skb->protocol; |
2513 | netdev_features_t features = skb->dev->features; | 2515 | netdev_features_t features = dev->features; |
2514 | 2516 | ||
2515 | if (skb_shinfo(skb)->gso_segs > skb->dev->gso_max_segs) | 2517 | if (skb_shinfo(skb)->gso_segs > dev->gso_max_segs) |
2516 | features &= ~NETIF_F_GSO_MASK; | 2518 | features &= ~NETIF_F_GSO_MASK; |
2517 | 2519 | ||
2518 | if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) { | 2520 | if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) { |
2519 | struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; | 2521 | struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; |
2520 | protocol = veh->h_vlan_encapsulated_proto; | 2522 | protocol = veh->h_vlan_encapsulated_proto; |
2521 | } else if (!vlan_tx_tag_present(skb)) { | 2523 | } else if (!vlan_tx_tag_present(skb)) { |
2522 | return harmonize_features(skb, features); | 2524 | return harmonize_features(skb, dev, features); |
2523 | } | 2525 | } |
2524 | 2526 | ||
2525 | features &= (skb->dev->vlan_features | NETIF_F_HW_VLAN_CTAG_TX | | 2527 | features &= (dev->vlan_features | NETIF_F_HW_VLAN_CTAG_TX | |
2526 | NETIF_F_HW_VLAN_STAG_TX); | 2528 | NETIF_F_HW_VLAN_STAG_TX); |
2527 | 2529 | ||
2528 | if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) | 2530 | if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) |
@@ -2530,9 +2532,9 @@ netdev_features_t netif_skb_features(struct sk_buff *skb) | |||
2530 | NETIF_F_GEN_CSUM | NETIF_F_HW_VLAN_CTAG_TX | | 2532 | NETIF_F_GEN_CSUM | NETIF_F_HW_VLAN_CTAG_TX | |
2531 | NETIF_F_HW_VLAN_STAG_TX; | 2533 | NETIF_F_HW_VLAN_STAG_TX; |
2532 | 2534 | ||
2533 | return harmonize_features(skb, features); | 2535 | return harmonize_features(skb, dev, features); |
2534 | } | 2536 | } |
2535 | EXPORT_SYMBOL(netif_skb_features); | 2537 | EXPORT_SYMBOL(netif_skb_dev_features); |
2536 | 2538 | ||
2537 | int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, | 2539 | int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, |
2538 | struct netdev_queue *txq) | 2540 | struct netdev_queue *txq) |
@@ -2803,7 +2805,7 @@ EXPORT_SYMBOL(dev_loopback_xmit); | |||
2803 | * the BH enable code must have IRQs enabled so that it will not deadlock. | 2805 | * the BH enable code must have IRQs enabled so that it will not deadlock. |
2804 | * --BLG | 2806 | * --BLG |
2805 | */ | 2807 | */ |
2806 | int __dev_queue_xmit(struct sk_buff *skb, void *accel_priv) | 2808 | static int __dev_queue_xmit(struct sk_buff *skb, void *accel_priv) |
2807 | { | 2809 | { |
2808 | struct net_device *dev = skb->dev; | 2810 | struct net_device *dev = skb->dev; |
2809 | struct netdev_queue *txq; | 2811 | struct netdev_queue *txq; |
@@ -4637,7 +4639,7 @@ struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev) | |||
4637 | } | 4639 | } |
4638 | EXPORT_SYMBOL(netdev_master_upper_dev_get_rcu); | 4640 | EXPORT_SYMBOL(netdev_master_upper_dev_get_rcu); |
4639 | 4641 | ||
4640 | int netdev_adjacent_sysfs_add(struct net_device *dev, | 4642 | static int netdev_adjacent_sysfs_add(struct net_device *dev, |
4641 | struct net_device *adj_dev, | 4643 | struct net_device *adj_dev, |
4642 | struct list_head *dev_list) | 4644 | struct list_head *dev_list) |
4643 | { | 4645 | { |
@@ -4647,7 +4649,7 @@ int netdev_adjacent_sysfs_add(struct net_device *dev, | |||
4647 | return sysfs_create_link(&(dev->dev.kobj), &(adj_dev->dev.kobj), | 4649 | return sysfs_create_link(&(dev->dev.kobj), &(adj_dev->dev.kobj), |
4648 | linkname); | 4650 | linkname); |
4649 | } | 4651 | } |
4650 | void netdev_adjacent_sysfs_del(struct net_device *dev, | 4652 | static void netdev_adjacent_sysfs_del(struct net_device *dev, |
4651 | char *name, | 4653 | char *name, |
4652 | struct list_head *dev_list) | 4654 | struct list_head *dev_list) |
4653 | { | 4655 | { |
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index f409e0bd35c0..185c341fafbd 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
@@ -745,6 +745,13 @@ static int fib_rules_event(struct notifier_block *this, unsigned long event, | |||
745 | attach_rules(&ops->rules_list, dev); | 745 | attach_rules(&ops->rules_list, dev); |
746 | break; | 746 | break; |
747 | 747 | ||
748 | case NETDEV_CHANGENAME: | ||
749 | list_for_each_entry(ops, &net->rules_ops, list) { | ||
750 | detach_rules(&ops->rules_list, dev); | ||
751 | attach_rules(&ops->rules_list, dev); | ||
752 | } | ||
753 | break; | ||
754 | |||
748 | case NETDEV_UNREGISTER: | 755 | case NETDEV_UNREGISTER: |
749 | list_for_each_entry(ops, &net->rules_ops, list) | 756 | list_for_each_entry(ops, &net->rules_ops, list) |
750 | detach_rules(&ops->rules_list, dev); | 757 | detach_rules(&ops->rules_list, dev); |
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 87577d447554..e29e810663d7 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c | |||
@@ -323,17 +323,6 @@ u32 __skb_get_poff(const struct sk_buff *skb) | |||
323 | return poff; | 323 | return poff; |
324 | } | 324 | } |
325 | 325 | ||
326 | static inline u16 dev_cap_txqueue(struct net_device *dev, u16 queue_index) | ||
327 | { | ||
328 | if (unlikely(queue_index >= dev->real_num_tx_queues)) { | ||
329 | net_warn_ratelimited("%s selects TX queue %d, but real number of TX queues is %d\n", | ||
330 | dev->name, queue_index, | ||
331 | dev->real_num_tx_queues); | ||
332 | return 0; | ||
333 | } | ||
334 | return queue_index; | ||
335 | } | ||
336 | |||
337 | static inline int get_xps_queue(struct net_device *dev, struct sk_buff *skb) | 326 | static inline int get_xps_queue(struct net_device *dev, struct sk_buff *skb) |
338 | { | 327 | { |
339 | #ifdef CONFIG_XPS | 328 | #ifdef CONFIG_XPS |
@@ -372,7 +361,7 @@ static inline int get_xps_queue(struct net_device *dev, struct sk_buff *skb) | |||
372 | #endif | 361 | #endif |
373 | } | 362 | } |
374 | 363 | ||
375 | u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb) | 364 | static u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb) |
376 | { | 365 | { |
377 | struct sock *sk = skb->sk; | 366 | struct sock *sk = skb->sk; |
378 | int queue_index = sk_tx_queue_get(sk); | 367 | int queue_index = sk_tx_queue_get(sk); |
@@ -392,7 +381,6 @@ u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb) | |||
392 | 381 | ||
393 | return queue_index; | 382 | return queue_index; |
394 | } | 383 | } |
395 | EXPORT_SYMBOL(__netdev_pick_tx); | ||
396 | 384 | ||
397 | struct netdev_queue *netdev_pick_tx(struct net_device *dev, | 385 | struct netdev_queue *netdev_pick_tx(struct net_device *dev, |
398 | struct sk_buff *skb, | 386 | struct sk_buff *skb, |
@@ -403,13 +391,13 @@ struct netdev_queue *netdev_pick_tx(struct net_device *dev, | |||
403 | if (dev->real_num_tx_queues != 1) { | 391 | if (dev->real_num_tx_queues != 1) { |
404 | const struct net_device_ops *ops = dev->netdev_ops; | 392 | const struct net_device_ops *ops = dev->netdev_ops; |
405 | if (ops->ndo_select_queue) | 393 | if (ops->ndo_select_queue) |
406 | queue_index = ops->ndo_select_queue(dev, skb, | 394 | queue_index = ops->ndo_select_queue(dev, skb, accel_priv, |
407 | accel_priv); | 395 | __netdev_pick_tx); |
408 | else | 396 | else |
409 | queue_index = __netdev_pick_tx(dev, skb); | 397 | queue_index = __netdev_pick_tx(dev, skb); |
410 | 398 | ||
411 | if (!accel_priv) | 399 | if (!accel_priv) |
412 | queue_index = dev_cap_txqueue(dev, queue_index); | 400 | queue_index = netdev_cap_txqueue(dev, queue_index); |
413 | } | 401 | } |
414 | 402 | ||
415 | skb_set_queue_mapping(skb, queue_index); | 403 | skb_set_queue_mapping(skb, queue_index); |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index b9e9e0d38672..e16129019c66 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -766,9 +766,6 @@ static void neigh_periodic_work(struct work_struct *work) | |||
766 | nht = rcu_dereference_protected(tbl->nht, | 766 | nht = rcu_dereference_protected(tbl->nht, |
767 | lockdep_is_held(&tbl->lock)); | 767 | lockdep_is_held(&tbl->lock)); |
768 | 768 | ||
769 | if (atomic_read(&tbl->entries) < tbl->gc_thresh1) | ||
770 | goto out; | ||
771 | |||
772 | /* | 769 | /* |
773 | * periodically recompute ReachableTime from random function | 770 | * periodically recompute ReachableTime from random function |
774 | */ | 771 | */ |
@@ -781,6 +778,9 @@ static void neigh_periodic_work(struct work_struct *work) | |||
781 | neigh_rand_reach_time(NEIGH_VAR(p, BASE_REACHABLE_TIME)); | 778 | neigh_rand_reach_time(NEIGH_VAR(p, BASE_REACHABLE_TIME)); |
782 | } | 779 | } |
783 | 780 | ||
781 | if (atomic_read(&tbl->entries) < tbl->gc_thresh1) | ||
782 | goto out; | ||
783 | |||
784 | for (i = 0 ; i < (1 << nht->hash_shift); i++) { | 784 | for (i = 0 ; i < (1 << nht->hash_shift); i++) { |
785 | np = &nht->hash_buckets[i]; | 785 | np = &nht->hash_buckets[i]; |
786 | 786 | ||
@@ -3046,7 +3046,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, | |||
3046 | if (!t) | 3046 | if (!t) |
3047 | goto err; | 3047 | goto err; |
3048 | 3048 | ||
3049 | for (i = 0; i < ARRAY_SIZE(t->neigh_vars); i++) { | 3049 | for (i = 0; i < NEIGH_VAR_GC_INTERVAL; i++) { |
3050 | t->neigh_vars[i].data += (long) p; | 3050 | t->neigh_vars[i].data += (long) p; |
3051 | t->neigh_vars[i].extra1 = dev; | 3051 | t->neigh_vars[i].extra1 = dev; |
3052 | t->neigh_vars[i].extra2 = p; | 3052 | t->neigh_vars[i].extra2 = p; |
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index c03f3dec4763..a664f7829a6d 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -948,6 +948,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt) | |||
948 | { | 948 | { |
949 | char *cur=opt, *delim; | 949 | char *cur=opt, *delim; |
950 | int ipv6; | 950 | int ipv6; |
951 | bool ipversion_set = false; | ||
951 | 952 | ||
952 | if (*cur != '@') { | 953 | if (*cur != '@') { |
953 | if ((delim = strchr(cur, '@')) == NULL) | 954 | if ((delim = strchr(cur, '@')) == NULL) |
@@ -960,6 +961,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt) | |||
960 | cur++; | 961 | cur++; |
961 | 962 | ||
962 | if (*cur != '/') { | 963 | if (*cur != '/') { |
964 | ipversion_set = true; | ||
963 | if ((delim = strchr(cur, '/')) == NULL) | 965 | if ((delim = strchr(cur, '/')) == NULL) |
964 | goto parse_failed; | 966 | goto parse_failed; |
965 | *delim = 0; | 967 | *delim = 0; |
@@ -1002,7 +1004,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt) | |||
1002 | ipv6 = netpoll_parse_ip_addr(cur, &np->remote_ip); | 1004 | ipv6 = netpoll_parse_ip_addr(cur, &np->remote_ip); |
1003 | if (ipv6 < 0) | 1005 | if (ipv6 < 0) |
1004 | goto parse_failed; | 1006 | goto parse_failed; |
1005 | else if (np->ipv6 != (bool)ipv6) | 1007 | else if (ipversion_set && np->ipv6 != (bool)ipv6) |
1006 | goto parse_failed; | 1008 | goto parse_failed; |
1007 | else | 1009 | else |
1008 | np->ipv6 = (bool)ipv6; | 1010 | np->ipv6 = (bool)ipv6; |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 393b1bc9a618..1a0dac2ef9ad 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -374,7 +374,7 @@ static size_t rtnl_link_get_slave_info_data_size(const struct net_device *dev) | |||
374 | if (!master_dev) | 374 | if (!master_dev) |
375 | return 0; | 375 | return 0; |
376 | ops = master_dev->rtnl_link_ops; | 376 | ops = master_dev->rtnl_link_ops; |
377 | if (!ops->get_slave_size) | 377 | if (!ops || !ops->get_slave_size) |
378 | return 0; | 378 | return 0; |
379 | /* IFLA_INFO_SLAVE_DATA + nested data */ | 379 | /* IFLA_INFO_SLAVE_DATA + nested data */ |
380 | return nla_total_size(sizeof(struct nlattr)) + | 380 | return nla_total_size(sizeof(struct nlattr)) + |
@@ -1963,16 +1963,21 @@ replay: | |||
1963 | 1963 | ||
1964 | dev->ifindex = ifm->ifi_index; | 1964 | dev->ifindex = ifm->ifi_index; |
1965 | 1965 | ||
1966 | if (ops->newlink) | 1966 | if (ops->newlink) { |
1967 | err = ops->newlink(net, dev, tb, data); | 1967 | err = ops->newlink(net, dev, tb, data); |
1968 | else | 1968 | /* Drivers should call free_netdev() in ->destructor |
1969 | * and unregister it on failure so that device could be | ||
1970 | * finally freed in rtnl_unlock. | ||
1971 | */ | ||
1972 | if (err < 0) | ||
1973 | goto out; | ||
1974 | } else { | ||
1969 | err = register_netdevice(dev); | 1975 | err = register_netdevice(dev); |
1970 | 1976 | if (err < 0) { | |
1971 | if (err < 0) { | 1977 | free_netdev(dev); |
1972 | free_netdev(dev); | 1978 | goto out; |
1973 | goto out; | 1979 | } |
1974 | } | 1980 | } |
1975 | |||
1976 | err = rtnl_configure_link(dev, ifm); | 1981 | err = rtnl_configure_link(dev, ifm); |
1977 | if (err < 0) | 1982 | if (err < 0) |
1978 | unregister_netdevice(dev); | 1983 | unregister_netdevice(dev); |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 5976ef0846bd..5d6236d9fdce 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -707,9 +707,6 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old) | |||
707 | new->mark = old->mark; | 707 | new->mark = old->mark; |
708 | new->skb_iif = old->skb_iif; | 708 | new->skb_iif = old->skb_iif; |
709 | __nf_copy(new, old); | 709 | __nf_copy(new, old); |
710 | #if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) | ||
711 | new->nf_trace = old->nf_trace; | ||
712 | #endif | ||
713 | #ifdef CONFIG_NET_SCHED | 710 | #ifdef CONFIG_NET_SCHED |
714 | new->tc_index = old->tc_index; | 711 | new->tc_index = old->tc_index; |
715 | #ifdef CONFIG_NET_CLS_ACT | 712 | #ifdef CONFIG_NET_CLS_ACT |
diff --git a/net/core/sock.c b/net/core/sock.c index 0c127dcdf6a8..5b6a9431b017 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -1775,7 +1775,9 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len, | |||
1775 | while (order) { | 1775 | while (order) { |
1776 | if (npages >= 1 << order) { | 1776 | if (npages >= 1 << order) { |
1777 | page = alloc_pages(sk->sk_allocation | | 1777 | page = alloc_pages(sk->sk_allocation | |
1778 | __GFP_COMP | __GFP_NOWARN, | 1778 | __GFP_COMP | |
1779 | __GFP_NOWARN | | ||
1780 | __GFP_NORETRY, | ||
1779 | order); | 1781 | order); |
1780 | if (page) | 1782 | if (page) |
1781 | goto fill_page; | 1783 | goto fill_page; |
@@ -1845,7 +1847,7 @@ bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t prio) | |||
1845 | gfp_t gfp = prio; | 1847 | gfp_t gfp = prio; |
1846 | 1848 | ||
1847 | if (order) | 1849 | if (order) |
1848 | gfp |= __GFP_COMP | __GFP_NOWARN; | 1850 | gfp |= __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY; |
1849 | pfrag->page = alloc_pages(gfp, order); | 1851 | pfrag->page = alloc_pages(gfp, order); |
1850 | if (likely(pfrag->page)) { | 1852 | if (likely(pfrag->page)) { |
1851 | pfrag->offset = 0; | 1853 | pfrag->offset = 0; |