History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Pull networking fixes from David Miller: 1) The netlink attribute passed in to dev_set_alias() is not necessarily NULL terminated, don't use strlcpy() on it. From Alexander Potapenko. 2) Fix implementation of atomics in arm64 bpf JIT, from Daniel Borkmann. 3) Correct the release of netdevs and driver private data in certain circumstances. 4) Sanitize netlink message length properly in decnet, from Mateusz Jurczyk. 5) Don't leak kernel data in rtnl_fill_vfinfo() netlink blobs. From Yuval Mintz. 6) Hash secret is never initialized in ipv6 ILA translation code, from Arnd Bergmann. I guess those clang warnings about unused inline functions are useful for something! 7) Fix endian selection in bpf_endian.h, from Daniel Borkmann. 8) Sanitize sockaddr length before dereferncing any fields in AF_UNIX and CAIF. From Mateusz Jurczyk. 9) Fix timestamping for GMAC3 chips in stmmac driver, from Mario Molitor. 10) Do not leak netdev on dev_alloc_name() errors in mac80211, from Johannes Berg. 11) Fix locking in sctp_for_each_endpoint(), from Xin Long. 12) Fix wrong memset size on 32-bit in snmp6, from Christian Perle. 13) Fix use after free in ip_mc_clear_src(), from WANG Cong. 14) Fix regressions caused by ICMP rate limiting changes in 4.11, from Jesper Dangaard Brouer. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (91 commits) i40e: Fix a sleep-in-atomic bug net: don't global ICMP rate limit packets originating from loopback net/act_pedit: fix an error code net: update undefined ->ndo_change_mtu() comment net_sched: move tcf_lock down after gen_replace_estimator() caif: Add sockaddr length check before accessing sa_family in connect handler qed: fix dump of context data qmi_wwan: new Telewell and Sierra device IDs net: phy: Fix MDIO_THUNDER dependencies netconsole: Remove duplicate "netconsole: " logging prefix igmp: acquire pmc lock for ip_mc_clear_src() r8152: give the device version net: rps: fix uninitialized symbol warning mac80211: don't send SMPS action frame in AP mode when not needed mac80211/wpa: use constant time memory comparison for MACs mac80211: set bss_info data before configuring the channel mac80211: remove 5/10 MHz rate code from station MLME mac80211: Fix incorrect condition when checking rx timestamp mac80211: don't look at the PM bit of BAR frames i40e: fix handling of HW ATR eviction ...

Linus Torvalds committed 9 years ago

Commit a090bd42 parents 54ed0f7 640f93c136 files · +810 −491Browse files

Unified · Split

136 files
  1. Documentation/networking/scaling.txt +1 −1
  2. arch/arm64/net/bpf_jit_comp.c +5 −2
  3. drivers/hsi/clients/ssi_protocol.c +1 −1
  4. drivers/net/bonding/bond_3ad.c +27 −0
  5. drivers/net/bonding/bond_main.c +3 −3
  6. drivers/net/caif/caif_hsi.c +1 −1
  7. drivers/net/caif/caif_serial.c +1 −1
  8. drivers/net/caif/caif_spi.c +1 −1
  9. drivers/net/caif/caif_virtio.c +1 −1
  10. drivers/net/can/dev.c +3 −0
  11. drivers/net/can/peak_canfd/peak_canfd.c +1 −1
  12. drivers/net/can/slcan.c +3 −4
  13. drivers/net/can/usb/gs_usb.c +2 −0
  14. drivers/net/can/usb/peak_usb/pcan_usb_core.c +1 −3
  15. drivers/net/can/vcan.c +2 −2
  16. drivers/net/can/vxcan.c +2 −2
  17. drivers/net/dummy.c +2 −2
  18. drivers/net/ethernet/amazon/ena/ena_com.c +21 −14
  19. drivers/net/ethernet/amazon/ena/ena_ethtool.c +1 −1
  20. drivers/net/ethernet/amazon/ena/ena_netdev.c +132 −47
  21. drivers/net/ethernet/amazon/ena/ena_netdev.h +15 −3
  22. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h +0 −3
  23. drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +15 −4
  24. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +13 −2
  25. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h +1 −0
  26. drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +1 −1
  27. drivers/net/ethernet/ibm/emac/core.c +40 −27
  28. drivers/net/ethernet/ibm/ibmvnic.c +6 −0
  29. drivers/net/ethernet/intel/i40e/i40e.h +1 −0
  30. drivers/net/ethernet/intel/i40e/i40e_ethtool.c +2 −2
  31. drivers/net/ethernet/intel/i40e/i40e_main.c +4 −3
  32. drivers/net/ethernet/intel/i40e/i40e_txrx.c +2 −2
  33. drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +2 −0
  34. drivers/net/ethernet/marvell/mvpp2.c +33 −43
  35. drivers/net/ethernet/mellanox/mlx5/core/en.h +5 −3
  36. drivers/net/ethernet/mellanox/mlx5/core/en_rx_am.c +26 −19
  37. drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +2 −9
  38. drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +1 −1
  39. drivers/net/ethernet/mellanox/mlx5/core/health.c +5 −6
  40. drivers/net/ethernet/mellanox/mlx5/core/main.c +4 −2
  41. drivers/net/ethernet/qlogic/qed/qed_debug.c +1 −1
  42. drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +7 −4
  43. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +17 −8
  44. drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h +2 −1
  45. drivers/net/geneve.c +1 −1
  46. drivers/net/gtp.c +1 −1
  47. drivers/net/hamradio/6pack.c +1 −1
  48. drivers/net/hamradio/bpqether.c +1 −1
  49. drivers/net/hyperv/hyperv_net.h +3 −2
  50. drivers/net/hyperv/netvsc_drv.c +18 −36
  51. drivers/net/hyperv/rndis_filter.c +29 −1
  52. drivers/net/ifb.c +2 −2
  53. drivers/net/ipvlan/ipvlan_main.c +1 −1
  54. drivers/net/loopback.c +2 −2
  55. drivers/net/macsec.c +2 −2
  56. drivers/net/macvlan.c +1 −1
  57. drivers/net/netconsole.c +1 −1
  58. drivers/net/nlmon.c +1 −1
  59. drivers/net/phy/Kconfig +1 −0
  60. drivers/net/phy/phy.c +2 −0
  61. drivers/net/slip/slip.c +3 −4
  62. drivers/net/team/team.c +2 −2
  63. drivers/net/tun.c +2 −2
  64. drivers/net/usb/cdc-phonet.c +1 −1
  65. drivers/net/usb/qmi_wwan.c +5 −1
  66. drivers/net/usb/r8152.c +2 −0
  67. drivers/net/veth.c +2 −2
  68. drivers/net/vrf.c +33 −5
  69. drivers/net/vsockmon.c +1 −1
  70. drivers/net/vxlan.c +1 −1
  71. drivers/net/wan/dlci.c +1 −1
  72. drivers/net/wan/hdlc_fr.c +1 −1
  73. drivers/net/wan/lapbether.c +1 −1
  74. drivers/net/wireless/ath/ath6kl/main.c +1 −1
  75. drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +0 −1
  76. drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +2 −1
  77. drivers/net/wireless/intersil/hostap/hostap_main.c +1 −1
  78. drivers/net/wireless/mac80211_hwsim.c +1 −1
  79. drivers/net/wireless/marvell/mwifiex/main.c +1 −1
  80. drivers/s390/net/netiucv.c +2 −2
  81. drivers/staging/rtl8188eu/os_dep/mon.c +1 −1
  82. drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +2 −1
  83. drivers/staging/rtl8723bs/os_dep/os_intfs.c +0 −2
  84. drivers/usb/gadget/function/f_phonet.c +1 −1
  85. include/linux/netdevice.h +10 −5
  86. include/uapi/linux/ethtool.h +4 −2
  87. include/uapi/linux/openvswitch.h +1 −0
  88. net/8021q/vlan_dev.c +2 −2
  89. net/batman-adv/distributed-arp-table.c +3 −2
  90. net/batman-adv/routing.c +1 −1
  91. net/batman-adv/soft-interface.c +2 −3
  92. net/bluetooth/6lowpan.c +1 −1
  93. net/bridge/br_device.c +1 −1
  94. net/caif/caif_socket.c +4 −0
  95. net/caif/cfpkt_skbuff.c +1 −5
  96. net/caif/chnl_net.c +2 −2
  97. net/can/af_can.c +1 −2
  98. net/core/dev.c +30 −12
  99. net/core/dst.c +14 −0
  100. net/core/rtnetlink.c +2 −1
  101. net/decnet/netfilter/dn_rtmsg.c +3 −1
  102. net/hsr/hsr_device.c +2 −2
  103. net/hsr/hsr_forward.c +1 −2
  104. net/hsr/hsr_framereg.c +7 −2
  105. net/hsr/hsr_framereg.h +1 −1
  106. net/ieee802154/6lowpan/core.c +1 −1
  107. net/ipv4/icmp.c +6 −2
  108. net/ipv4/igmp.c +13 −8
  109. net/ipv4/ip_tunnel.c +2 −2
  110. net/ipv4/ipmr.c +16 −18
  111. net/ipv6/icmp.c +1 −1
  112. net/ipv6/ila/ila_xlat.c +1 −0
  113. net/ipv6/ip6_gre.c +5 −4
  114. net/ipv6/ip6_tunnel.c +4 −4
  115. net/ipv6/ip6_vti.c +4 −4
  116. net/ipv6/ip6mr.c +1 −1
  117. net/ipv6/proc.c +1 −1
  118. net/ipv6/route.c +1 −0
  119. net/ipv6/sit.c +3 −3
  120. net/irda/irlan/irlan_eth.c +1 −1
  121. net/l2tp/l2tp_eth.c +8 −7
  122. net/mac80211/cfg.c +2 −0
  123. net/mac80211/ieee80211_i.h +1 −1
  124. net/mac80211/iface.c +4 −3
  125. net/mac80211/mlme.c +31 −31
  126. net/mac80211/rx.c +5 −1
  127. net/mac80211/wpa.c +5 −4
  128. net/mac802154/iface.c +3 −4
  129. net/openvswitch/vport-internal_dev.c +2 −2
  130. net/phonet/pep-gprs.c +1 −1
  131. net/sched/act_pedit.c +3 −1
  132. net/sched/act_police.c +3 −5
  133. net/sctp/socket.c +2 −2
  134. net/tipc/msg.c +1 −1
  135. net/unix/af_unix.c +6 −1
  136. tools/testing/selftests/bpf/bpf_endian.h +30 −11
Documentation/networking/scaling.txt+1−1
@@ -122,7 +122,7 @@ associated flow of the packet. The hash is either provided by hardware · 121 unmodified lines
122122 or will be computed in the stack. Capable hardware can pass the hash in
123123 the receive descriptor for the packet; this would usually be the same
124124 hash used for RSS (e.g. computed Toeplitz hash). The hash is saved in
125−skb->rx_hash and can be used elsewhere in the stack as a hash of the
125+skb->hash and can be used elsewhere in the stack as a hash of the
126126 packet’s flow.
127127
128128 Each receive hardware queue has an associated list of CPUs to which
arch/arm64/net/bpf_jit_comp.c+5−2
@@ -36,6 +36,7 @@ int bpf_jit_enable __read_mostly; · 35 unmodified lines
3636 #define TMP_REG_1 (MAX_BPF_JIT_REG + 0)
3737 #define TMP_REG_2 (MAX_BPF_JIT_REG + 1)
3838 #define TCALL_CNT (MAX_BPF_JIT_REG + 2)
39+#define TMP_REG_3 (MAX_BPF_JIT_REG + 3)
3940
4041 /* Map BPF registers to A64 registers */
4142 static const int bpf2a64[] = {
@@ -57,6 +58,7 @@ static const int bpf2a64[] = { · 15 unmodified lines
5758 /* temporary registers for internal BPF JIT */
5859 [TMP_REG_1] = A64_R(10),
5960 [TMP_REG_2] = A64_R(11),
61+ [TMP_REG_3] = A64_R(12),
6062 /* tail_call_cnt */
6163 [TCALL_CNT] = A64_R(26),
6264 /* temporary register for blinding constants */
@@ -319,6 +321,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx) · 256 unmodified lines
319321 const u8 src = bpf2a64[insn->src_reg];
320322 const u8 tmp = bpf2a64[TMP_REG_1];
321323 const u8 tmp2 = bpf2a64[TMP_REG_2];
324+ const u8 tmp3 = bpf2a64[TMP_REG_3];
322325 const s16 off = insn->off;
323326 const s32 imm = insn->imm;
324327 const int i = insn - ctx->prog->insnsi;
@@ -689,10 +692,10 @@ emit_cond_jmp: · 364 unmodified lines
689692 emit(A64_PRFM(tmp, PST, L1, STRM), ctx);
690693 emit(A64_LDXR(isdw, tmp2, tmp), ctx);
691694 emit(A64_ADD(isdw, tmp2, tmp2, src), ctx);
692− emit(A64_STXR(isdw, tmp2, tmp, tmp2), ctx);
695+ emit(A64_STXR(isdw, tmp2, tmp, tmp3), ctx);
693696 jmp_offset = -3;
694697 check_imm19(jmp_offset);
695− emit(A64_CBNZ(0, tmp2, jmp_offset), ctx);
698+ emit(A64_CBNZ(0, tmp3, jmp_offset), ctx);
696699 break;
697700
698701 /* R0 = ntohx(*(size *)(((struct sk_buff *)R6)->data + imm)) */
drivers/hsi/clients/ssi_protocol.c+1−1
@@ -1066,7 +1066,7 @@ static void ssip_pn_setup(struct net_device *dev) · 1065 unmodified lines
10661066 dev->addr_len = 1;
10671067 dev->tx_queue_len = SSIP_TXQUEUE_LEN;
10681068
1069− dev->destructor = free_netdev;
1069+ dev->needs_free_netdev = true;
10701070 dev->header_ops = &phonet_header_ops;
10711071 }
10721072
drivers/net/bonding/bond_3ad.c+27−0
@@ -90,10 +90,13 @@ enum ad_link_speed_type { · 89 unmodified lines
9090 AD_LINK_SPEED_100MBPS,
9191 AD_LINK_SPEED_1000MBPS,
9292 AD_LINK_SPEED_2500MBPS,
93+ AD_LINK_SPEED_5000MBPS,
9394 AD_LINK_SPEED_10000MBPS,
95+ AD_LINK_SPEED_14000MBPS,
9496 AD_LINK_SPEED_20000MBPS,
9597 AD_LINK_SPEED_25000MBPS,
9698 AD_LINK_SPEED_40000MBPS,
99+ AD_LINK_SPEED_50000MBPS,
97100 AD_LINK_SPEED_56000MBPS,
98101 AD_LINK_SPEED_100000MBPS,
99102 };
@@ -259,10 +262,13 @@ static inline int __check_agg_selection_timer(struct port *port) · 159 unmodified lines
259262 * %AD_LINK_SPEED_100MBPS,
260263 * %AD_LINK_SPEED_1000MBPS,
261264 * %AD_LINK_SPEED_2500MBPS,
265+ * %AD_LINK_SPEED_5000MBPS,
262266 * %AD_LINK_SPEED_10000MBPS
267+ * %AD_LINK_SPEED_14000MBPS,
263268 * %AD_LINK_SPEED_20000MBPS
264269 * %AD_LINK_SPEED_25000MBPS
265270 * %AD_LINK_SPEED_40000MBPS
271+ * %AD_LINK_SPEED_50000MBPS
266272 * %AD_LINK_SPEED_56000MBPS
267273 * %AD_LINK_SPEED_100000MBPS
268274 */
@@ -296,10 +302,18 @@ static u16 __get_link_speed(struct port *port) · 27 unmodified lines
296302 speed = AD_LINK_SPEED_2500MBPS;
297303 break;
298304
305+ case SPEED_5000:
306+ speed = AD_LINK_SPEED_5000MBPS;
307+ break;
308+
299309 case SPEED_10000:
300310 speed = AD_LINK_SPEED_10000MBPS;
301311 break;
302312
313+ case SPEED_14000:
314+ speed = AD_LINK_SPEED_14000MBPS;
315+ break;
316+
303317 case SPEED_20000:
304318 speed = AD_LINK_SPEED_20000MBPS;
305319 break;
@@ -312,6 +326,10 @@ static u16 __get_link_speed(struct port *port) · 6 unmodified lines
312326 speed = AD_LINK_SPEED_40000MBPS;
313327 break;
314328
329+ case SPEED_50000:
330+ speed = AD_LINK_SPEED_50000MBPS;
331+ break;
332+
315333 case SPEED_56000:
316334 speed = AD_LINK_SPEED_56000MBPS;
317335 break;
@@ -707,9 +725,15 @@ static u32 __get_agg_bandwidth(struct aggregator *aggregator) · 389 unmodified lines
707725 case AD_LINK_SPEED_2500MBPS:
708726 bandwidth = nports * 2500;
709727 break;
728+ case AD_LINK_SPEED_5000MBPS:
729+ bandwidth = nports * 5000;
730+ break;
710731 case AD_LINK_SPEED_10000MBPS:
711732 bandwidth = nports * 10000;
712733 break;
734+ case AD_LINK_SPEED_14000MBPS:
735+ bandwidth = nports * 14000;
736+ break;
713737 case AD_LINK_SPEED_20000MBPS:
714738 bandwidth = nports * 20000;
715739 break;
@@ -719,6 +743,9 @@ static u32 __get_agg_bandwidth(struct aggregator *aggregator) · 3 unmodified lines
719743 case AD_LINK_SPEED_40000MBPS:
720744 bandwidth = nports * 40000;
721745 break;
746+ case AD_LINK_SPEED_50000MBPS:
747+ bandwidth = nports * 50000;
748+ break;
722749 case AD_LINK_SPEED_56000MBPS:
723750 bandwidth = nports * 56000;
724751 break;
drivers/net/bonding/bond_main.c+3−3
@@ -4192,7 +4192,6 @@ static void bond_destructor(struct net_device *bond_dev) · 4191 unmodified lines
41924192 struct bonding *bond = netdev_priv(bond_dev);
41934193 if (bond->wq)
41944194 destroy_workqueue(bond->wq);
4195− free_netdev(bond_dev);
41964195 }
41974196
41984197 void bond_setup(struct net_device *bond_dev)
@@ -4212,7 +4211,8 @@ void bond_setup(struct net_device *bond_dev) · 13 unmodified lines
42124211 bond_dev->netdev_ops = &bond_netdev_ops;
42134212 bond_dev->ethtool_ops = &bond_ethtool_ops;
42144213
4215− bond_dev->destructor = bond_destructor;
4214+ bond_dev->needs_free_netdev = true;
4215+ bond_dev->priv_destructor = bond_destructor;
42164216
42174217 SET_NETDEV_DEVTYPE(bond_dev, &bond_type);
42184218
@@ -4736,7 +4736,7 @@ int bond_create(struct net *net, const char *name) · 517 unmodified lines
47364736
47374737 rtnl_unlock();
47384738 if (res < 0)
4739− bond_destructor(bond_dev);
4739+ free_netdev(bond_dev);
47404740 return res;
47414741 }
47424742
drivers/net/caif/caif_hsi.c+1−1
@@ -1121,7 +1121,7 @@ static void cfhsi_setup(struct net_device *dev) · 1120 unmodified lines
11211121 dev->flags = IFF_POINTOPOINT | IFF_NOARP;
11221122 dev->mtu = CFHSI_MAX_CAIF_FRAME_SZ;
11231123 dev->priv_flags |= IFF_NO_QUEUE;
1124− dev->destructor = free_netdev;
1124+ dev->needs_free_netdev = true;
11251125 dev->netdev_ops = &cfhsi_netdevops;
11261126 for (i = 0; i < CFHSI_PRIO_LAST; ++i)
11271127 skb_queue_head_init(&cfhsi->qhead[i]);
drivers/net/caif/caif_serial.c+1−1
@@ -428,7 +428,7 @@ static void caifdev_setup(struct net_device *dev) · 427 unmodified lines
428428 dev->flags = IFF_POINTOPOINT | IFF_NOARP;
429429 dev->mtu = CAIF_MAX_MTU;
430430 dev->priv_flags |= IFF_NO_QUEUE;
431− dev->destructor = free_netdev;
431+ dev->needs_free_netdev = true;
432432 skb_queue_head_init(&serdev->head);
433433 serdev->common.link_select = CAIF_LINK_LOW_LATENCY;
434434 serdev->common.use_frag = true;
drivers/net/caif/caif_spi.c+1−1
@@ -712,7 +712,7 @@ static void cfspi_setup(struct net_device *dev) · 711 unmodified lines
712712 dev->flags = IFF_NOARP | IFF_POINTOPOINT;
713713 dev->priv_flags |= IFF_NO_QUEUE;
714714 dev->mtu = SPI_MAX_PAYLOAD_SIZE;
715− dev->destructor = free_netdev;
715+ dev->needs_free_netdev = true;
716716 skb_queue_head_init(&cfspi->qhead);
717717 skb_queue_head_init(&cfspi->chead);
718718 cfspi->cfdev.link_select = CAIF_LINK_HIGH_BANDW;
drivers/net/caif/caif_virtio.c+1−1
@@ -617,7 +617,7 @@ static void cfv_netdev_setup(struct net_device *netdev) · 616 unmodified lines
617617 netdev->tx_queue_len = 100;
618618 netdev->flags = IFF_POINTOPOINT | IFF_NOARP;
619619 netdev->mtu = CFV_DEF_MTU_SIZE;
620− netdev->destructor = free_netdev;
620+ netdev->needs_free_netdev = true;
621621 }
622622
623623 /* Create debugfs counters for the device */
drivers/net/can/dev.c+3−0
@@ -391,6 +391,9 @@ void can_change_state(struct net_device *dev, struct can_frame *cf, · 390 unmodified lines
391391 can_update_state_error_stats(dev, new_state);
392392 priv->state = new_state;
393393
394+ if (!cf)
395+ return;
396+
394397 if (unlikely(new_state == CAN_STATE_BUS_OFF)) {
395398 cf->can_id |= CAN_ERR_BUSOFF;
396399 return;
drivers/net/can/peak_canfd/peak_canfd.c+1−1
@@ -489,7 +489,7 @@ int peak_canfd_handle_msgs_list(struct peak_canfd_priv *priv, · 488 unmodified lines
489489 struct pucan_rx_msg *msg_list, int msg_count)
490490 {
491491 void *msg_ptr = msg_list;
492− int i, msg_size;
492+ int i, msg_size = 0;
493493
494494 for (i = 0; i < msg_count; i++) {
495495 msg_size = peak_canfd_handle_msg(priv, msg_ptr);
drivers/net/can/slcan.c+3−4
@@ -417,7 +417,7 @@ static int slc_open(struct net_device *dev) · 416 unmodified lines
417417 static void slc_free_netdev(struct net_device *dev)
418418 {
419419 int i = dev->base_addr;
420− free_netdev(dev);
420+
421421 slcan_devs[i] = NULL;
422422 }
423423
@@ -436,7 +436,8 @@ static const struct net_device_ops slc_netdev_ops = { · 12 unmodified lines
436436 static void slc_setup(struct net_device *dev)
437437 {
438438 dev->netdev_ops = &slc_netdev_ops;
439− dev->destructor = slc_free_netdev;
439+ dev->needs_free_netdev = true;
440+ dev->priv_destructor = slc_free_netdev;
440441
441442 dev->hard_header_len = 0;
442443 dev->addr_len = 0;
@@ -761,8 +762,6 @@ static void __exit slcan_exit(void) · 318 unmodified lines
761762 if (sl->tty) {
762763 printk(KERN_ERR "%s: tty discipline still running\n",
763764 dev->name);
764− /* Intentionally leak the control block. */
765− dev->destructor = NULL;
766765 }
767766
768767 unregister_netdev(dev);
drivers/net/can/usb/gs_usb.c+2−0
@@ -265,6 +265,8 @@ static int gs_cmd_reset(struct gs_usb *gsusb, struct gs_can *gsdev) · 264 unmodified lines
265265 sizeof(*dm),
266266 1000);
267267
268+ kfree(dm);
269+
268270 return rc;
269271 }
270272
drivers/net/can/usb/peak_usb/pcan_usb_core.c+1−3
@@ -908,8 +908,6 @@ static int peak_usb_probe(struct usb_interface *intf, · 907 unmodified lines
908908 const struct peak_usb_adapter *peak_usb_adapter = NULL;
909909 int i, err = -ENOMEM;
910910
911− usb_dev = interface_to_usbdev(intf);
912−
913911 /* get corresponding PCAN-USB adapter */
914912 for (i = 0; i < ARRAY_SIZE(peak_usb_adapters_list); i++)
915913 if (peak_usb_adapters_list[i]->device_id == usb_id_product) {
@@ -920,7 +918,7 @@ static int peak_usb_probe(struct usb_interface *intf, · 4 unmodified lines
920918 if (!peak_usb_adapter) {
921919 /* should never come except device_id bad usage in this file */
922920 pr_err("%s: didn't find device id. 0x%x in devices list\n",
923− PCAN_USB_DRIVER_NAME, usb_dev->descriptor.idProduct);
921+ PCAN_USB_DRIVER_NAME, usb_id_product);
924922 return -ENODEV;
925923 }
926924
drivers/net/can/vcan.c+2−2
@@ -152,7 +152,7 @@ static const struct net_device_ops vcan_netdev_ops = { · 151 unmodified lines
152152 static void vcan_setup(struct net_device *dev)
153153 {
154154 dev->type = ARPHRD_CAN;
155− dev->mtu = CAN_MTU;
155+ dev->mtu = CANFD_MTU;
156156 dev->hard_header_len = 0;
157157 dev->addr_len = 0;
158158 dev->tx_queue_len = 0;
@@ -163,7 +163,7 @@ static void vcan_setup(struct net_device *dev) · 4 unmodified lines
163163 dev->flags |= IFF_ECHO;
164164
165165 dev->netdev_ops = &vcan_netdev_ops;
166− dev->destructor = free_netdev;
166+ dev->needs_free_netdev = true;
167167 }
168168
169169 static struct rtnl_link_ops vcan_link_ops __read_mostly = {
drivers/net/can/vxcan.c+2−2
@@ -150,13 +150,13 @@ static const struct net_device_ops vxcan_netdev_ops = { · 149 unmodified lines
150150 static void vxcan_setup(struct net_device *dev)
151151 {
152152 dev->type = ARPHRD_CAN;
153− dev->mtu = CAN_MTU;
153+ dev->mtu = CANFD_MTU;
154154 dev->hard_header_len = 0;
155155 dev->addr_len = 0;
156156 dev->tx_queue_len = 0;
157157 dev->flags = (IFF_NOARP|IFF_ECHO);
158158 dev->netdev_ops = &vxcan_netdev_ops;
159− dev->destructor = free_netdev;
159+ dev->needs_free_netdev = true;
160160 }
161161
162162 /* forward declaration for rtnl_create_link() */
drivers/net/dummy.c+2−2
@@ -328,7 +328,6 @@ static void dummy_free_netdev(struct net_device *dev) · 327 unmodified lines
328328 struct dummy_priv *priv = netdev_priv(dev);
329329
330330 kfree(priv->vfinfo);
331− free_netdev(dev);
332331 }
333332
334333 static void dummy_setup(struct net_device *dev)
@@ -338,7 +337,8 @@ static void dummy_setup(struct net_device *dev) · 3 unmodified lines
338337 /* Initialize the device structure. */
339338 dev->netdev_ops = &dummy_netdev_ops;
340339 dev->ethtool_ops = &dummy_ethtool_ops;
341− dev->destructor = dummy_free_netdev;
340+ dev->needs_free_netdev = true;
341+ dev->priv_destructor = dummy_free_netdev;
342342
343343 /* Fill in device structure with ethernet-generic values. */
344344 dev->flags |= IFF_NOARP;
drivers/net/ethernet/amazon/ena/ena_com.c+21−14
@@ -61,6 +61,8 @@ · 60 unmodified lines
6161
6262 #define ENA_MMIO_READ_TIMEOUT 0xFFFFFFFF
6363
64+#define ENA_REGS_ADMIN_INTR_MASK 1
65+
6466 /*****************************************************************************/
6567 /*****************************************************************************/
6668 /*****************************************************************************/
@@ -232,11 +234,9 @@ static struct ena_comp_ctx *__ena_com_submit_admin_cmd(struct ena_com_admin_queu · 165 unmodified lines
232234 tail_masked = admin_queue->sq.tail & queue_size_mask;
233235
234236 /* In case of queue FULL */
235− cnt = admin_queue->sq.tail - admin_queue->sq.head;
237+ cnt = atomic_read(&admin_queue->outstanding_cmds);
236238 if (cnt >= admin_queue->q_depth) {
237− pr_debug("admin queue is FULL (tail %d head %d depth: %d)\n",
238− admin_queue->sq.tail, admin_queue->sq.head,
239− admin_queue->q_depth);
239+ pr_debug("admin queue is full.\n");
240240 admin_queue->stats.out_of_space++;
241241 return ERR_PTR(-ENOSPC);
242242 }
@@ -508,15 +508,20 @@ static int ena_com_comp_status_to_errno(u8 comp_status) · 265 unmodified lines
508508 static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_ctx,
509509 struct ena_com_admin_queue *admin_queue)
510510 {
511− unsigned long flags;
512− u32 start_time;
511+ unsigned long flags, timeout;
513512 int ret;
514513
515− start_time = ((u32)jiffies_to_usecs(jiffies));
514+ timeout = jiffies + ADMIN_CMD_TIMEOUT_US;
515+
516+ while (1) {
517+ spin_lock_irqsave(&admin_queue->q_lock, flags);
518+ ena_com_handle_admin_completion(admin_queue);
519+ spin_unlock_irqrestore(&admin_queue->q_lock, flags);
520+
521+ if (comp_ctx->status != ENA_CMD_SUBMITTED)
522+ break;
516523
517− while (comp_ctx->status == ENA_CMD_SUBMITTED) {
518− if ((((u32)jiffies_to_usecs(jiffies)) - start_time) >
519− ADMIN_CMD_TIMEOUT_US) {
524+ if (time_is_before_jiffies(timeout)) {
520525 pr_err("Wait for completion (polling) timeout\n");
521526 /* ENA didn't have any completion */
522527 spin_lock_irqsave(&admin_queue->q_lock, flags);
@@ -528,10 +533,6 @@ static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_c · 5 unmodified lines
528533 goto err;
529534 }
530535
531− spin_lock_irqsave(&admin_queue->q_lock, flags);
532− ena_com_handle_admin_completion(admin_queue);
533− spin_unlock_irqrestore(&admin_queue->q_lock, flags);
534−
535536 msleep(100);
536537 }
537538
@@ -1455,6 +1456,12 @@ void ena_com_admin_destroy(struct ena_com_dev *ena_dev) · 917 unmodified lines
14551456
14561457 void ena_com_set_admin_polling_mode(struct ena_com_dev *ena_dev, bool polling)
14571458 {
1459+ u32 mask_value = 0;
1460+
1461+ if (polling)
1462+ mask_value = ENA_REGS_ADMIN_INTR_MASK;
1463+
1464+ writel(mask_value, ena_dev->reg_bar + ENA_REGS_INTR_MASK_OFF);
14581465 ena_dev->admin_queue.polling = polling;
14591466 }
14601467
drivers/net/ethernet/amazon/ena/ena_ethtool.c+1−1
@@ -80,7 +80,6 @@ static const struct ena_stats ena_stats_tx_strings[] = { · 79 unmodified lines
8080 ENA_STAT_TX_ENTRY(tx_poll),
8181 ENA_STAT_TX_ENTRY(doorbells),
8282 ENA_STAT_TX_ENTRY(prepare_ctx_err),
83− ENA_STAT_TX_ENTRY(missing_tx_comp),
8483 ENA_STAT_TX_ENTRY(bad_req_id),
8584 };
8685
@@ -94,6 +93,7 @@ static const struct ena_stats ena_stats_rx_strings[] = { · 7 unmodified lines
9493 ENA_STAT_RX_ENTRY(dma_mapping_err),
9594 ENA_STAT_RX_ENTRY(bad_desc_num),
9695 ENA_STAT_RX_ENTRY(rx_copybreak_pkt),
96+ ENA_STAT_RX_ENTRY(empty_rx_ring),
9797 };
9898
9999 static const struct ena_stats ena_stats_ena_com_strings[] = {
drivers/net/ethernet/amazon/ena/ena_netdev.c+132−47
@@ -190,6 +190,7 @@ static void ena_init_io_rings(struct ena_adapter *adapter) · 189 unmodified lines
190190 rxr->sgl_size = adapter->max_rx_sgl_size;
191191 rxr->smoothed_interval =
192192 ena_com_get_nonadaptive_moderation_interval_rx(ena_dev);
193+ rxr->empty_rx_queue = 0;
193194 }
194195 }
195196
@@ -1078,6 +1079,26 @@ inline void ena_adjust_intr_moderation(struct ena_ring *rx_ring, · 882 unmodified lines
10781079 rx_ring->per_napi_bytes = 0;
10791080 }
10801081
1082+static inline void ena_unmask_interrupt(struct ena_ring *tx_ring,
1083+ struct ena_ring *rx_ring)
1084+{
1085+ struct ena_eth_io_intr_reg intr_reg;
1086+
1087+ /* Update intr register: rx intr delay,
1088+ * tx intr delay and interrupt unmask
1089+ */
1090+ ena_com_update_intr_reg(&intr_reg,
1091+ rx_ring->smoothed_interval,
1092+ tx_ring->smoothed_interval,
1093+ true);
1094+
1095+ /* It is a shared MSI-X.
1096+ * Tx and Rx CQ have pointer to it.
1097+ * So we use one of them to reach the intr reg
1098+ */
1099+ ena_com_unmask_intr(rx_ring->ena_com_io_cq, &intr_reg);
1100+}
1101+
10811102 static inline void ena_update_ring_numa_node(struct ena_ring *tx_ring,
10821103 struct ena_ring *rx_ring)
10831104 {
@@ -1108,7 +1129,6 @@ static int ena_io_poll(struct napi_struct *napi, int budget) · 24 unmodified lines
11081129 {
11091130 struct ena_napi *ena_napi = container_of(napi, struct ena_napi, napi);
11101131 struct ena_ring *tx_ring, *rx_ring;
1111− struct ena_eth_io_intr_reg intr_reg;
11121132
11131133 u32 tx_work_done;
11141134 u32 rx_work_done;
@@ -1149,22 +1169,9 @@ static int ena_io_poll(struct napi_struct *napi, int budget) · 34 unmodified lines
11491169 if (ena_com_get_adaptive_moderation_enabled(rx_ring->ena_dev))
11501170 ena_adjust_intr_moderation(rx_ring, tx_ring);
11511171
1152− /* Update intr register: rx intr delay,
1153− * tx intr delay and interrupt unmask
1154− */
1155− ena_com_update_intr_reg(&intr_reg,
1156− rx_ring->smoothed_interval,
1157− tx_ring->smoothed_interval,
1158− true);
1159−
1160− /* It is a shared MSI-X.
1161− * Tx and Rx CQ have pointer to it.
1162− * So we use one of them to reach the intr reg
1163− */
1164− ena_com_unmask_intr(rx_ring->ena_com_io_cq, &intr_reg);
1172+ ena_unmask_interrupt(tx_ring, rx_ring);
11651173 }
11661174
1167−
11681175 ena_update_ring_numa_node(tx_ring, rx_ring);
11691176
11701177 ret = rx_work_done;
@@ -1485,6 +1492,11 @@ static int ena_up_complete(struct ena_adapter *adapter) · 314 unmodified lines
14851492
14861493 ena_napi_enable_all(adapter);
14871494
1495+ /* Enable completion queues interrupt */
1496+ for (i = 0; i < adapter->num_queues; i++)
1497+ ena_unmask_interrupt(&adapter->tx_ring[i],
1498+ &adapter->rx_ring[i]);
1499+
14881500 /* schedule napi in case we had pending packets
14891501 * from the last time we disable napi
14901502 */
@@ -1532,6 +1544,7 @@ static int ena_create_io_tx_queue(struct ena_adapter *adapter, int qid) · 41 unmodified lines
15321544 "Failed to get TX queue handlers. TX queue num %d rc: %d\n",
15331545 qid, rc);
15341546 ena_com_destroy_io_queue(ena_dev, ena_qid);
1547+ return rc;
15351548 }
15361549
15371550 ena_com_update_numa_node(tx_ring->ena_com_io_cq, ctx.numa_node);
@@ -1596,6 +1609,7 @@ static int ena_create_io_rx_queue(struct ena_adapter *adapter, int qid) · 58 unmodified lines
15961609 "Failed to get RX queue handlers. RX queue num %d rc: %d\n",
15971610 qid, rc);
15981611 ena_com_destroy_io_queue(ena_dev, ena_qid);
1612+ return rc;
15991613 }
16001614
16011615 ena_com_update_numa_node(rx_ring->ena_com_io_cq, ctx.numa_node);
@@ -1981,6 +1995,7 @@ static netdev_tx_t ena_start_xmit(struct sk_buff *skb, struct net_device *dev) · 379 unmodified lines
19811995
19821996 tx_info->tx_descs = nb_hw_desc;
19831997 tx_info->last_jiffies = jiffies;
1998+ tx_info->print_once = 0;
19841999
19852000 tx_ring->next_to_use = ENA_TX_RING_IDX_NEXT(next_to_use,
19862001 tx_ring->ring_size);
@@ -2550,13 +2565,44 @@ err: · 563 unmodified lines
25502565 "Reset attempt failed. Can not reset the device\n");
25512566 }
25522567
2553−static void check_for_missing_tx_completions(struct ena_adapter *adapter)
2568+static int check_missing_comp_in_queue(struct ena_adapter *adapter,
2569+ struct ena_ring *tx_ring)
25542570 {
25552571 struct ena_tx_buffer *tx_buf;
25562572 unsigned long last_jiffies;
2573+ u32 missed_tx = 0;
2574+ int i;
2575+
2576+ for (i = 0; i < tx_ring->ring_size; i++) {
2577+ tx_buf = &tx_ring->tx_buffer_info[i];
2578+ last_jiffies = tx_buf->last_jiffies;
2579+ if (unlikely(last_jiffies &&
2580+ time_is_before_jiffies(last_jiffies + TX_TIMEOUT))) {
2581+ if (!tx_buf->print_once)
2582+ netif_notice(adapter, tx_err, adapter->netdev,
2583+ "Found a Tx that wasn't completed on time, qid %d, index %d.\n",
2584+ tx_ring->qid, i);
2585+
2586+ tx_buf->print_once = 1;
2587+ missed_tx++;
2588+
2589+ if (unlikely(missed_tx > MAX_NUM_OF_TIMEOUTED_PACKETS)) {
2590+ netif_err(adapter, tx_err, adapter->netdev,
2591+ "The number of lost tx completions is above the threshold (%d > %d). Reset the device\n",
2592+ missed_tx, MAX_NUM_OF_TIMEOUTED_PACKETS);
2593+ set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);
2594+ return -EIO;
2595+ }
2596+ }
2597+ }
2598+
2599+ return 0;
2600+}
2601+
2602+static void check_for_missing_tx_completions(struct ena_adapter *adapter)
2603+{
25572604 struct ena_ring *tx_ring;
2558− int i, j, budget;
2559− u32 missed_tx;
2605+ int i, budget, rc;
25602606
25612607 /* Make sure the driver doesn't turn the device in other process */
25622608 smp_rmb();
@@ -2572,31 +2618,9 @@ static void check_for_missing_tx_completions(struct ena_adapter *adapter) · 9 unmodified lines
25722618 for (i = adapter->last_monitored_tx_qid; i < adapter->num_queues; i++) {
25732619 tx_ring = &adapter->tx_ring[i];
25742620
2575− for (j = 0; j < tx_ring->ring_size; j++) {
2576− tx_buf = &tx_ring->tx_buffer_info[j];
2577− last_jiffies = tx_buf->last_jiffies;
2578− if (unlikely(last_jiffies && time_is_before_jiffies(last_jiffies + TX_TIMEOUT))) {
2579− netif_notice(adapter, tx_err, adapter->netdev,
2580− "Found a Tx that wasn't completed on time, qid %d, index %d.\n",
2581− tx_ring->qid, j);
2582−
2583− u64_stats_update_begin(&tx_ring->syncp);
2584− missed_tx = tx_ring->tx_stats.missing_tx_comp++;
2585− u64_stats_update_end(&tx_ring->syncp);
2586−
2587− /* Clear last jiffies so the lost buffer won't
2588− * be counted twice.
2589− */
2590− tx_buf->last_jiffies = 0;
2591−
2592− if (unlikely(missed_tx > MAX_NUM_OF_TIMEOUTED_PACKETS)) {
2593− netif_err(adapter, tx_err, adapter->netdev,
2594− "The number of lost tx completion is above the threshold (%d > %d). Reset the device\n",
2595− missed_tx, MAX_NUM_OF_TIMEOUTED_PACKETS);
2596− set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);
2597− }
2598− }
2599− }
2621+ rc = check_missing_comp_in_queue(adapter, tx_ring);
2622+ if (unlikely(rc))
2623+ return;
26002624
26012625 budget--;
26022626 if (!budget)
@@ -2606,6 +2630,58 @@ static void check_for_missing_tx_completions(struct ena_adapter *adapter) · 3 unmodified lines
26062630 adapter->last_monitored_tx_qid = i % adapter->num_queues;
26072631 }
26082632
2633+/* trigger napi schedule after 2 consecutive detections */
2634+#define EMPTY_RX_REFILL 2
2635+/* For the rare case where the device runs out of Rx descriptors and the
2636+ * napi handler failed to refill new Rx descriptors (due to a lack of memory
2637+ * for example).
2638+ * This case will lead to a deadlock:
2639+ * The device won't send interrupts since all the new Rx packets will be dropped
2640+ * The napi handler won't allocate new Rx descriptors so the device will be
2641+ * able to send new packets.
2642+ *
2643+ * This scenario can happen when the kernel's vm.min_free_kbytes is too small.
2644+ * It is recommended to have at least 512MB, with a minimum of 128MB for
2645+ * constrained environment).
2646+ *
2647+ * When such a situation is detected - Reschedule napi
2648+ */
2649+static void check_for_empty_rx_ring(struct ena_adapter *adapter)
2650+{
2651+ struct ena_ring *rx_ring;
2652+ int i, refill_required;
2653+
2654+ if (!test_bit(ENA_FLAG_DEV_UP, &adapter->flags))
2655+ return;
2656+
2657+ if (test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags))
2658+ return;
2659+
2660+ for (i = 0; i < adapter->num_queues; i++) {
2661+ rx_ring = &adapter->rx_ring[i];
2662+
2663+ refill_required =
2664+ ena_com_sq_empty_space(rx_ring->ena_com_io_sq);
2665+ if (unlikely(refill_required == (rx_ring->ring_size - 1))) {
2666+ rx_ring->empty_rx_queue++;
2667+
2668+ if (rx_ring->empty_rx_queue >= EMPTY_RX_REFILL) {
2669+ u64_stats_update_begin(&rx_ring->syncp);
2670+ rx_ring->rx_stats.empty_rx_ring++;
2671+ u64_stats_update_end(&rx_ring->syncp);
2672+
2673+ netif_err(adapter, drv, adapter->netdev,
2674+ "trigger refill for ring %d\n", i);
2675+
2676+ napi_schedule(rx_ring->napi);
2677+ rx_ring->empty_rx_queue = 0;
2678+ }
2679+ } else {
2680+ rx_ring->empty_rx_queue = 0;
2681+ }
2682+ }
2683+}
2684+
26092685 /* Check for keep alive expiration */
26102686 static void check_for_missing_keep_alive(struct ena_adapter *adapter)
26112687 {
@@ -2660,6 +2736,8 @@ static void ena_timer_service(unsigned long data) · 48 unmodified lines
26602736
26612737 check_for_missing_tx_completions(adapter);
26622738
2739+ check_for_empty_rx_ring(adapter);
2740+
26632741 if (debug_area)
26642742 ena_dump_stats_to_buf(adapter, debug_area);
26652743
@@ -2840,6 +2918,11 @@ static void ena_release_bars(struct ena_com_dev *ena_dev, struct pci_dev *pdev) · 174 unmodified lines
28402918 {
28412919 int release_bars;
28422920
2921+ if (ena_dev->mem_bar)
2922+ devm_iounmap(&pdev->dev, ena_dev->mem_bar);
2923+
2924+ devm_iounmap(&pdev->dev, ena_dev->reg_bar);
2925+
28432926 release_bars = pci_select_bars(pdev, IORESOURCE_MEM) & ENA_BAR_MASK;
28442927 pci_release_selected_regions(pdev, release_bars);
28452928 }
@@ -2927,8 +3010,9 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 81 unmodified lines
29273010 goto err_free_ena_dev;
29283011 }
29293012
2930− ena_dev->reg_bar = ioremap(pci_resource_start(pdev, ENA_REG_BAR),
2931− pci_resource_len(pdev, ENA_REG_BAR));
3013+ ena_dev->reg_bar = devm_ioremap(&pdev->dev,
3014+ pci_resource_start(pdev, ENA_REG_BAR),
3015+ pci_resource_len(pdev, ENA_REG_BAR));
29323016 if (!ena_dev->reg_bar) {
29333017 dev_err(&pdev->dev, "failed to remap regs bar\n");
29343018 rc = -EFAULT;
@@ -2948,8 +3032,9 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 13 unmodified lines
29483032 ena_set_push_mode(pdev, ena_dev, &get_feat_ctx);
29493033
29503034 if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) {
2951− ena_dev->mem_bar = ioremap_wc(pci_resource_start(pdev, ENA_MEM_BAR),
2952− pci_resource_len(pdev, ENA_MEM_BAR));
3035+ ena_dev->mem_bar = devm_ioremap_wc(&pdev->dev,
3036+ pci_resource_start(pdev, ENA_MEM_BAR),
3037+ pci_resource_len(pdev, ENA_MEM_BAR));
29533038 if (!ena_dev->mem_bar) {
29543039 rc = -EFAULT;
29553040 goto err_device_destroy;
drivers/net/ethernet/amazon/ena/ena_netdev.h+15−3
@@ -45,7 +45,7 @@ · 44 unmodified lines
4545
4646 #define DRV_MODULE_VER_MAJOR 1
4747 #define DRV_MODULE_VER_MINOR 1
48−#define DRV_MODULE_VER_SUBMINOR 2
48+#define DRV_MODULE_VER_SUBMINOR 7
4949
5050 #define DRV_MODULE_NAME "ena"
5151 #ifndef DRV_MODULE_VERSION
@@ -146,7 +146,18 @@ struct ena_tx_buffer { · 94 unmodified lines
146146 u32 tx_descs;
147147 /* num of buffers used by this skb */
148148 u32 num_of_bufs;
149− /* Save the last jiffies to detect missing tx packets */
149+
150+ /* Used for detect missing tx packets to limit the number of prints */
151+ u32 print_once;
152+ /* Save the last jiffies to detect missing tx packets
153+ *
154+ * sets to non zero value on ena_start_xmit and set to zero on
155+ * napi and timer_Service_routine.
156+ *
157+ * while this value is not protected by lock,
158+ * a given packet is not expected to be handled by ena_start_xmit
159+ * and by napi/timer_service at the same time.
160+ */
150161 unsigned long last_jiffies;
151162 struct ena_com_buf bufs[ENA_PKT_MAX_BUFS];
152163 } ____cacheline_aligned;
@@ -170,7 +181,6 @@ struct ena_stats_tx { · 17 unmodified lines
170181 u64 napi_comp;
171182 u64 tx_poll;
172183 u64 doorbells;
173− u64 missing_tx_comp;
174184 u64 bad_req_id;
175185 };
176186
@@ -184,6 +194,7 @@ struct ena_stats_rx { · 7 unmodified lines
184194 u64 dma_mapping_err;
185195 u64 bad_desc_num;
186196 u64 rx_copybreak_pkt;
197+ u64 empty_rx_ring;
187198 };
188199
189200 struct ena_ring {
@@ -231,6 +242,7 @@ struct ena_ring { · 41 unmodified lines
231242 struct ena_stats_tx tx_stats;
232243 struct ena_stats_rx rx_stats;
233244 };
245+ int empty_rx_queue;
234246 } ____cacheline_aligned;
235247
236248 struct ena_stats_dev {
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h+0−3
@@ -193,9 +193,6 @@ int hw_atl_utils_hw_get_regs(struct aq_hw_s *self, · 192 unmodified lines
193193 struct aq_hw_caps_s *aq_hw_caps,
194194 u32 *regs_buff);
195195
196−int hw_atl_utils_hw_get_settings(struct aq_hw_s *self,
197− struct ethtool_cmd *cmd);
198−
199196 int hw_atl_utils_hw_set_power(struct aq_hw_s *self,
200197 unsigned int power_state);
201198
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c+15−4
@@ -3883,15 +3883,26 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) · 3882 unmodified lines
38833883 /* when transmitting in a vf, start bd must hold the ethertype
38843884 * for fw to enforce it
38853885 */
3886+ u16 vlan_tci = 0;
38863887 #ifndef BNX2X_STOP_ON_ERROR
3887− if (IS_VF(bp))
3888+ if (IS_VF(bp)) {
38883889 #endif
3889− tx_start_bd->vlan_or_ethertype =
3890− cpu_to_le16(ntohs(eth->h_proto));
3890+ /* Still need to consider inband vlan for enforced */
3891+ if (__vlan_get_tag(skb, &vlan_tci)) {
3892+ tx_start_bd->vlan_or_ethertype =
3893+ cpu_to_le16(ntohs(eth->h_proto));
3894+ } else {
3895+ tx_start_bd->bd_flags.as_bitfield |=
3896+ (X_ETH_INBAND_VLAN <<
3897+ ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT);
3898+ tx_start_bd->vlan_or_ethertype =
3899+ cpu_to_le16(vlan_tci);
3900+ }
38913901 #ifndef BNX2X_STOP_ON_ERROR
3892− else
3902+ } else {
38933903 /* used by FW for packet accounting */
38943904 tx_start_bd->vlan_or_ethertype = cpu_to_le16(pkt_prod);
3905+ }
38953906 #endif
38963907 }
38973908
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c+13−2
@@ -901,6 +901,8 @@ static void bnx2x_vf_flr(struct bnx2x *bp, struct bnx2x_virtf *vf) · 900 unmodified lines
901901 /* release VF resources */
902902 bnx2x_vf_free_resc(bp, vf);
903903
904+ vf->malicious = false;
905+
904906 /* re-open the mailbox */
905907 bnx2x_vf_enable_mbx(bp, vf->abs_vfid);
906908 return;
@@ -1822,9 +1824,11 @@ get_vf: · 915 unmodified lines
18221824 vf->abs_vfid, qidx);
18231825 bnx2x_vf_handle_rss_update_eqe(bp, vf);
18241826 case EVENT_RING_OPCODE_VF_FLR:
1825− case EVENT_RING_OPCODE_MALICIOUS_VF:
18261827 /* Do nothing for now */
18271828 return 0;
1829+ case EVENT_RING_OPCODE_MALICIOUS_VF:
1830+ vf->malicious = true;
1831+ return 0;
18281832 }
18291833
18301834 return 0;
@@ -1905,6 +1909,13 @@ void bnx2x_iov_adjust_stats_req(struct bnx2x *bp) · 74 unmodified lines
19051909 continue;
19061910 }
19071911
1912+ if (vf->malicious) {
1913+ DP_AND((BNX2X_MSG_IOV | BNX2X_MSG_STATS),
1914+ "vf %d malicious so no stats for it\n",
1915+ vf->abs_vfid);
1916+ continue;
1917+ }
1918+
19081919 DP_AND((BNX2X_MSG_IOV | BNX2X_MSG_STATS),
19091920 "add addresses for vf %d\n", vf->abs_vfid);
19101921 for_each_vfq(vf, j) {
@@ -3042,7 +3053,7 @@ void bnx2x_vf_pci_dealloc(struct bnx2x *bp) · 1131 unmodified lines
30423053 {
30433054 BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->vf2pf_mbox_mapping,
30443055 sizeof(struct bnx2x_vf_mbx_msg));
3045− BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->pf2vf_bulletin_mapping,
3056+ BNX2X_PCI_FREE(bp->pf2vf_bulletin, bp->pf2vf_bulletin_mapping,
30463057 sizeof(union pf_vf_bulletin));
30473058 }
30483059
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h+1−0
@@ -141,6 +141,7 @@ struct bnx2x_virtf { · 140 unmodified lines
141141 #define VF_RESET 3 /* VF FLR'd, pending cleanup */
142142
143143 bool flr_clnup_stage; /* true during flr cleanup */
144+ bool malicious; /* true if FW indicated so, until FLR */
144145
145146 /* dma */
146147 dma_addr_t fw_stat_map;
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c+1−1
@@ -4525,7 +4525,7 @@ static void dummy_setup(struct net_device *dev) · 4524 unmodified lines
45254525 /* Initialize the device structure. */
45264526 dev->netdev_ops = &cxgb4_mgmt_netdev_ops;
45274527 dev->ethtool_ops = &cxgb4_mgmt_ethtool_ops;
4528− dev->destructor = free_netdev;
4528+ dev->needs_free_netdev = true;
45294529 }
45304530
45314531 static int config_mgmt_dev(struct pci_dev *pdev)
drivers/net/ethernet/ibm/emac/core.c+40−27
@@ -343,6 +343,7 @@ static int emac_reset(struct emac_instance *dev) · 342 unmodified lines
343343 {
344344 struct emac_regs __iomem *p = dev->emacp;
345345 int n = 20;
346+ bool __maybe_unused try_internal_clock = false;
346347
347348 DBG(dev, "reset" NL);
348349
@@ -355,6 +356,7 @@ static int emac_reset(struct emac_instance *dev) · 6 unmodified lines
355356 }
356357
357358 #ifdef CONFIG_PPC_DCR_NATIVE
359+do_retry:
358360 /*
359361 * PPC460EX/GT Embedded Processor Advanced User's Manual
360362 * section 28.10.1 Mode Register 0 (EMACx_MR0) states:
@@ -362,10 +364,19 @@ static int emac_reset(struct emac_instance *dev) · 1 unmodified line
362364 * of the EMAC. If none is present, select the internal clock
363365 * (SDR0_ETH_CFG[EMACx_PHY_CLK] = 1).
364366 * After a soft reset, select the external clock.
367+ *
368+ * The AR8035-A PHY Meraki MR24 does not provide a TX Clk if the
369+ * ethernet cable is not attached. This causes the reset to timeout
370+ * and the PHY detection code in emac_init_phy() is unable to
371+ * communicate and detect the AR8035-A PHY. As a result, the emac
372+ * driver bails out early and the user has no ethernet.
373+ * In order to stay compatible with existing configurations, the
374+ * driver will temporarily switch to the internal clock, after
375+ * the first reset fails.
365376 */
366377 if (emac_has_feature(dev, EMAC_FTR_460EX_PHY_CLK_FIX)) {
367− if (dev->phy_address == 0xffffffff &&
368− dev->phy_map == 0xffffffff) {
378+ if (try_internal_clock || (dev->phy_address == 0xffffffff &&
379+ dev->phy_map == 0xffffffff)) {
369380 /* No PHY: select internal loop clock before reset */
370381 dcri_clrset(SDR0, SDR0_ETH_CFG,
371382 0, SDR0_ETH_CFG_ECS << dev->cell_index);
@@ -383,8 +394,15 @@ static int emac_reset(struct emac_instance *dev) · 11 unmodified lines
383394
384395 #ifdef CONFIG_PPC_DCR_NATIVE
385396 if (emac_has_feature(dev, EMAC_FTR_460EX_PHY_CLK_FIX)) {
386− if (dev->phy_address == 0xffffffff &&
387− dev->phy_map == 0xffffffff) {
397+ if (!n && !try_internal_clock) {
398+ /* first attempt has timed out. */
399+ n = 20;
400+ try_internal_clock = true;
401+ goto do_retry;
402+ }
403+
404+ if (try_internal_clock || (dev->phy_address == 0xffffffff &&
405+ dev->phy_map == 0xffffffff)) {
388406 /* No PHY: restore external clock source after reset */
389407 dcri_clrset(SDR0, SDR0_ETH_CFG,
390408 SDR0_ETH_CFG_ECS << dev->cell_index, 0);
@@ -2460,20 +2478,24 @@ static int emac_mii_bus_reset(struct mii_bus *bus) · 2069 unmodified lines
24602478 return emac_reset(dev);
24612479 }
24622480
2481+static int emac_mdio_phy_start_aneg(struct mii_phy *phy,
2482+ struct phy_device *phy_dev)
2483+{
2484+ phy_dev->autoneg = phy->autoneg;
2485+ phy_dev->speed = phy->speed;
2486+ phy_dev->duplex = phy->duplex;
2487+ phy_dev->advertising = phy->advertising;
2488+ return phy_start_aneg(phy_dev);
2489+}
2490+
24632491 static int emac_mdio_setup_aneg(struct mii_phy *phy, u32 advertise)
24642492 {
24652493 struct net_device *ndev = phy->dev;
24662494 struct emac_instance *dev = netdev_priv(ndev);
24672495
2468− dev->phy.autoneg = AUTONEG_ENABLE;
2469− dev->phy.speed = SPEED_1000;
2470− dev->phy.duplex = DUPLEX_FULL;
2471− dev->phy.advertising = advertise;
24722496 phy->autoneg = AUTONEG_ENABLE;
2473− phy->speed = dev->phy.speed;
2474− phy->duplex = dev->phy.duplex;
24752497 phy->advertising = advertise;
2476− return phy_start_aneg(dev->phy_dev);
2498+ return emac_mdio_phy_start_aneg(phy, dev->phy_dev);
24772499 }
24782500
24792501 static int emac_mdio_setup_forced(struct mii_phy *phy, int speed, int fd)
@@ -2481,13 +2503,10 @@ static int emac_mdio_setup_forced(struct mii_phy *phy, int speed, int fd) · 1 unmodified line
24812503 struct net_device *ndev = phy->dev;
24822504 struct emac_instance *dev = netdev_priv(ndev);
24832505
2484− dev->phy.autoneg = AUTONEG_DISABLE;
2485− dev->phy.speed = speed;
2486− dev->phy.duplex = fd;
24872506 phy->autoneg = AUTONEG_DISABLE;
24882507 phy->speed = speed;
24892508 phy->duplex = fd;
2490− return phy_start_aneg(dev->phy_dev);
2509+ return emac_mdio_phy_start_aneg(phy, dev->phy_dev);
24912510 }
24922511
24932512 static int emac_mdio_poll_link(struct mii_phy *phy)
@@ -2509,16 +2528,17 @@ static int emac_mdio_read_link(struct mii_phy *phy) · 15 unmodified lines
25092528 {
25102529 struct net_device *ndev = phy->dev;
25112530 struct emac_instance *dev = netdev_priv(ndev);
2531+ struct phy_device *phy_dev = dev->phy_dev;
25122532 int res;
25132533
2514− res = phy_read_status(dev->phy_dev);
2534+ res = phy_read_status(phy_dev);
25152535 if (res)
25162536 return res;
25172537
2518− dev->phy.speed = phy->speed;
2519− dev->phy.duplex = phy->duplex;
2520− dev->phy.pause = phy->pause;
2521− dev->phy.asym_pause = phy->asym_pause;
2538+ phy->speed = phy_dev->speed;
2539+ phy->duplex = phy_dev->duplex;
2540+ phy->pause = phy_dev->pause;
2541+ phy->asym_pause = phy_dev->asym_pause;
25222542 return 0;
25232543 }
25242544
@@ -2528,13 +2548,6 @@ static int emac_mdio_init_phy(struct mii_phy *phy) · 3 unmodified lines
25282548 struct emac_instance *dev = netdev_priv(ndev);
25292549
25302550 phy_start(dev->phy_dev);
2531− dev->phy.autoneg = phy->autoneg;
2532− dev->phy.speed = phy->speed;
2533− dev->phy.duplex = phy->duplex;
2534− dev->phy.advertising = phy->advertising;
2535− dev->phy.pause = phy->pause;
2536− dev->phy.asym_pause = phy->asym_pause;
2537−
25382551 return phy_init_hw(dev->phy_dev);
25392552 }
25402553
drivers/net/ethernet/ibm/ibmvnic.c+6−0
@@ -1468,6 +1468,11 @@ static void ibmvnic_netpoll_controller(struct net_device *dev) · 1467 unmodified lines
14681468 }
14691469 #endif
14701470
1471+static int ibmvnic_change_mtu(struct net_device *netdev, int new_mtu)
1472+{
1473+ return -EOPNOTSUPP;
1474+}
1475+
14711476 static const struct net_device_ops ibmvnic_netdev_ops = {
14721477 .ndo_open = ibmvnic_open,
14731478 .ndo_stop = ibmvnic_close,
@@ -1479,6 +1484,7 @@ static const struct net_device_ops ibmvnic_netdev_ops = { · 5 unmodified lines
14791484 #ifdef CONFIG_NET_POLL_CONTROLLER
14801485 .ndo_poll_controller = ibmvnic_netpoll_controller,
14811486 #endif
1487+ .ndo_change_mtu = ibmvnic_change_mtu,
14821488 };
14831489
14841490 /* ethtool functions */
drivers/net/ethernet/intel/i40e/i40e.h+1−0
@@ -399,6 +399,7 @@ struct i40e_pf { · 398 unmodified lines
399399 #define I40E_FLAG_RX_CSUM_ENABLED BIT_ULL(1)
400400 #define I40E_FLAG_MSI_ENABLED BIT_ULL(2)
401401 #define I40E_FLAG_MSIX_ENABLED BIT_ULL(3)
402+#define I40E_FLAG_HW_ATR_EVICT_ENABLED BIT_ULL(4)
402403 #define I40E_FLAG_RSS_ENABLED BIT_ULL(6)
403404 #define I40E_FLAG_VMDQ_ENABLED BIT_ULL(7)
404405 #define I40E_FLAG_IWARP_ENABLED BIT_ULL(10)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c+2−2
@@ -224,7 +224,7 @@ static const struct i40e_priv_flags i40e_gstrings_priv_flags[] = { · 223 unmodified lines
224224 I40E_PRIV_FLAG("LinkPolling", I40E_FLAG_LINK_POLLING_ENABLED, 0),
225225 I40E_PRIV_FLAG("flow-director-atr", I40E_FLAG_FD_ATR_ENABLED, 0),
226226 I40E_PRIV_FLAG("veb-stats", I40E_FLAG_VEB_STATS_ENABLED, 0),
227− I40E_PRIV_FLAG("hw-atr-eviction", I40E_FLAG_HW_ATR_EVICT_CAPABLE, 0),
227+ I40E_PRIV_FLAG("hw-atr-eviction", I40E_FLAG_HW_ATR_EVICT_ENABLED, 0),
228228 I40E_PRIV_FLAG("legacy-rx", I40E_FLAG_LEGACY_RX, 0),
229229 };
230230
@@ -4092,7 +4092,7 @@ flags_complete: · 3861 unmodified lines
40924092
40934093 /* Only allow ATR evict on hardware that is capable of handling it */
40944094 if (pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE)
4095− pf->flags &= ~I40E_FLAG_HW_ATR_EVICT_CAPABLE;
4095+ pf->flags &= ~I40E_FLAG_HW_ATR_EVICT_ENABLED;
40964096
40974097 if (changed_flags & I40E_FLAG_TRUE_PROMISC_SUPPORT) {
40984098 u16 sw_flags = 0, valid_flags = 0;
drivers/net/ethernet/intel/i40e/i40e_main.c+4−3
@@ -8821,11 +8821,12 @@ static int i40e_sw_init(struct i40e_pf *pf) · 8820 unmodified lines
88218821 (pf->hw.aq.api_min_ver > 4))) {
88228822 /* Supported in FW API version higher than 1.4 */
88238823 pf->flags |= I40E_FLAG_GENEVE_OFFLOAD_CAPABLE;
8824− pf->flags = I40E_FLAG_HW_ATR_EVICT_CAPABLE;
8825− } else {
8826− pf->flags = I40E_FLAG_HW_ATR_EVICT_CAPABLE;
88278824 }
88288825
8826+ /* Enable HW ATR eviction if possible */
8827+ if (pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE)
8828+ pf->flags |= I40E_FLAG_HW_ATR_EVICT_ENABLED;
8829+
88298830 pf->eeprom_version = 0xDEAD;
88308831 pf->lan_veb = I40E_NO_VEB;
88318832 pf->lan_vsi = I40E_NO_VSI;
drivers/net/ethernet/intel/i40e/i40e_txrx.c+2−2
@@ -2341,7 +2341,7 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb, · 2340 unmodified lines
23412341 /* Due to lack of space, no more new filters can be programmed */
23422342 if (th->syn && (pf->flags & I40E_FLAG_FD_ATR_AUTO_DISABLED))
23432343 return;
2344− if (pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE) {
2344+ if (pf->flags & I40E_FLAG_HW_ATR_EVICT_ENABLED) {
23452345 /* HW ATR eviction will take care of removing filters on FIN
23462346 * and RST packets.
23472347 */
@@ -2403,7 +2403,7 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb, · 55 unmodified lines
24032403 I40E_TXD_FLTR_QW1_CNTINDEX_SHIFT) &
24042404 I40E_TXD_FLTR_QW1_CNTINDEX_MASK;
24052405
2406− if (pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE)
2406+ if (pf->flags & I40E_FLAG_HW_ATR_EVICT_ENABLED)
24072407 dtype_cmd |= I40E_TXD_FLTR_QW1_ATR_MASK;
24082408
24092409 fdir_desc->qindex_flex_ptype_vsi = cpu_to_le32(flex_ptype);
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c+2−0
@@ -3017,10 +3017,12 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id, · 3016 unmodified lines
30173017 VLAN_VID_MASK));
30183018 }
30193019
3020+ spin_unlock_bh(&vsi->mac_filter_hash_lock);
30203021 if (vlan_id || qos)
30213022 ret = i40e_vsi_add_pvid(vsi, vlanprio);
30223023 else
30233024 i40e_vsi_remove_pvid(vsi);
3025+ spin_lock_bh(&vsi->mac_filter_hash_lock);
30243026
30253027 if (vlan_id) {
30263028 dev_info(&pf->pdev->dev, "Setting VLAN %d, QOS 0x%x on VF %d\n",
drivers/net/ethernet/marvell/mvpp2.c+33−43
@@ -3719,7 +3719,7 @@ static void mvpp2_bm_bufs_get_addrs(struct device *dev, struct mvpp2 *priv, · 3718 unmodified lines
37193719 dma_addr_t *dma_addr,
37203720 phys_addr_t *phys_addr)
37213721 {
3722− int cpu = smp_processor_id();
3722+ int cpu = get_cpu();
37233723
37243724 *dma_addr = mvpp2_percpu_read(priv, cpu,
37253725 MVPP2_BM_PHY_ALLOC_REG(bm_pool->id));
@@ -3740,6 +3740,8 @@ static void mvpp2_bm_bufs_get_addrs(struct device *dev, struct mvpp2 *priv, · 14 unmodified lines
37403740 if (sizeof(phys_addr_t) == 8)
37413741 *phys_addr |= (u64)phys_addr_highbits << 32;
37423742 }
3743+
3744+ put_cpu();
37433745 }
37443746
37453747 /* Free all buffers from the pool */
@@ -3920,18 +3922,12 @@ static inline u32 mvpp2_bm_cookie_pool_set(u32 cookie, int pool) · 174 unmodified lines
39203922 return bm;
39213923 }
39223924
3923−/* Get pool number from a BM cookie */
3924−static inline int mvpp2_bm_cookie_pool_get(unsigned long cookie)
3925−{
3926− return (cookie >> MVPP2_BM_COOKIE_POOL_OFFS) & 0xFF;
3927−}
3928−
39293925 /* Release buffer to BM */
39303926 static inline void mvpp2_bm_pool_put(struct mvpp2_port *port, int pool,
39313927 dma_addr_t buf_dma_addr,
39323928 phys_addr_t buf_phys_addr)
39333929 {
3934− int cpu = smp_processor_id();
3930+ int cpu = get_cpu();
39353931
39363932 if (port->priv->hw_version == MVPP22) {
39373933 u32 val = 0;
@@ -3958,15 +3954,15 @@ static inline void mvpp2_bm_pool_put(struct mvpp2_port *port, int pool, · 20 unmodified lines
39583954 MVPP2_BM_VIRT_RLS_REG, buf_phys_addr);
39593955 mvpp2_percpu_write(port->priv, cpu,
39603956 MVPP2_BM_PHY_RLS_REG(pool), buf_dma_addr);
3957+
3958+ put_cpu();
39613959 }
39623960
39633961 /* Refill BM pool */
3964−static void mvpp2_pool_refill(struct mvpp2_port *port, u32 bm,
3962+static void mvpp2_pool_refill(struct mvpp2_port *port, int pool,
39653963 dma_addr_t dma_addr,
39663964 phys_addr_t phys_addr)
39673965 {
3968− int pool = mvpp2_bm_cookie_pool_get(bm);
3969−
39703966 mvpp2_bm_pool_put(port, pool, dma_addr, phys_addr);
39713967 }
39723968
@@ -4186,8 +4182,6 @@ static void mvpp22_port_mii_set(struct mvpp2_port *port) · 213 unmodified lines
41864182 {
41874183 u32 val;
41884184
4189− return;
4190−
41914185 /* Only GOP port 0 has an XLG MAC */
41924186 if (port->gop_id == 0) {
41934187 val = readl(port->base + MVPP22_XLG_CTRL3_REG);
@@ -4515,21 +4509,6 @@ static void mvpp2_rxq_offset_set(struct mvpp2_port *port, · 321 unmodified lines
45154509 mvpp2_write(port->priv, MVPP2_RXQ_CONFIG_REG(prxq), val);
45164510 }
45174511
4518−/* Obtain BM cookie information from descriptor */
4519−static u32 mvpp2_bm_cookie_build(struct mvpp2_port *port,
4520− struct mvpp2_rx_desc *rx_desc)
4521−{
4522− int cpu = smp_processor_id();
4523− int pool;
4524−
4525− pool = (mvpp2_rxdesc_status_get(port, rx_desc) &
4526− MVPP2_RXD_BM_POOL_ID_MASK) >>
4527− MVPP2_RXD_BM_POOL_ID_OFFS;
4528−
4529− return ((pool & 0xFF) << MVPP2_BM_COOKIE_POOL_OFFS) |
4530− ((cpu & 0xFF) << MVPP2_BM_COOKIE_CPU_OFFS);
4531−}
4532−
45334512 /* Tx descriptors helper methods */
45344513
45354514 /* Get pointer to next Tx descriptor to be processed (send) by HW */
@@ -4757,7 +4736,7 @@ static void mvpp2_txp_max_tx_size_set(struct mvpp2_port *port) · 221 unmodified lines
47574736 static void mvpp2_rx_pkts_coal_set(struct mvpp2_port *port,
47584737 struct mvpp2_rx_queue *rxq)
47594738 {
4760− int cpu = smp_processor_id();
4739+ int cpu = get_cpu();
47614740
47624741 if (rxq->pkts_coal > MVPP2_OCCUPIED_THRESH_MASK)
47634742 rxq->pkts_coal = MVPP2_OCCUPIED_THRESH_MASK;
@@ -4765,6 +4744,8 @@ static void mvpp2_rx_pkts_coal_set(struct mvpp2_port *port, · 1 unmodified line
47654744 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_NUM_REG, rxq->id);
47664745 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_THRESH_REG,
47674746 rxq->pkts_coal);
4747+
4748+ put_cpu();
47684749 }
47694750
47704751 static u32 mvpp2_usec_to_cycles(u32 usec, unsigned long clk_hz)
@@ -4945,7 +4926,7 @@ static int mvpp2_rxq_init(struct mvpp2_port *port, · 174 unmodified lines
49454926 mvpp2_write(port->priv, MVPP2_RXQ_STATUS_REG(rxq->id), 0);
49464927
49474928 /* Set Rx descriptors queue starting address - indirect access */
4948− cpu = smp_processor_id();
4929+ cpu = get_cpu();
49494930 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_NUM_REG, rxq->id);
49504931 if (port->priv->hw_version == MVPP21)
49514932 rxq_dma = rxq->descs_dma;
@@ -4954,6 +4935,7 @@ static int mvpp2_rxq_init(struct mvpp2_port *port, · 2 unmodified lines
49544935 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_DESC_ADDR_REG, rxq_dma);
49554936 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_DESC_SIZE_REG, rxq->size);
49564937 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_INDEX_REG, 0);
4938+ put_cpu();
49574939
49584940 /* Set Offset */
49594941 mvpp2_rxq_offset_set(port, rxq->id, NET_SKB_PAD);
@@ -4980,9 +4962,13 @@ static void mvpp2_rxq_drop_pkts(struct mvpp2_port *port, · 20 unmodified lines
49804962
49814963 for (i = 0; i < rx_received; i++) {
49824964 struct mvpp2_rx_desc *rx_desc = mvpp2_rxq_next_desc_get(rxq);
4983− u32 bm = mvpp2_bm_cookie_build(port, rx_desc);
4965+ u32 status = mvpp2_rxdesc_status_get(port, rx_desc);
4966+ int pool;
4967+
4968+ pool = (status & MVPP2_RXD_BM_POOL_ID_MASK) >>
4969+ MVPP2_RXD_BM_POOL_ID_OFFS;
49844970
4985− mvpp2_pool_refill(port, bm,
4971+ mvpp2_pool_refill(port, pool,
49864972 mvpp2_rxdesc_dma_addr_get(port, rx_desc),
49874973 mvpp2_rxdesc_cookie_get(port, rx_desc));
49884974 }
@@ -5012,10 +4998,11 @@ static void mvpp2_rxq_deinit(struct mvpp2_port *port, · 23 unmodified lines
50124998 * free descriptor number
50134999 */
50145000 mvpp2_write(port->priv, MVPP2_RXQ_STATUS_REG(rxq->id), 0);
5015− cpu = smp_processor_id();
5001+ cpu = get_cpu();
50165002 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_NUM_REG, rxq->id);
50175003 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_DESC_ADDR_REG, 0);
50185004 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_DESC_SIZE_REG, 0);
5005+ put_cpu();
50195006 }
50205007
50215008 /* Create and initialize a Tx queue */
@@ -5038,7 +5025,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port, · 16 unmodified lines
50385025 txq->last_desc = txq->size - 1;
50395026
50405027 /* Set Tx descriptors queue starting address - indirect access */
5041− cpu = smp_processor_id();
5028+ cpu = get_cpu();
50425029 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_NUM_REG, txq->id);
50435030 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_DESC_ADDR_REG,
50445031 txq->descs_dma);
@@ -5063,6 +5050,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port, · 18 unmodified lines
50635050 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_PREF_BUF_REG,
50645051 MVPP2_PREF_BUF_PTR(desc) | MVPP2_PREF_BUF_SIZE_16 |
50655052 MVPP2_PREF_BUF_THRESH(desc_per_txq / 2));
5053+ put_cpu();
50665054
50675055 /* WRR / EJP configuration - indirect access */
50685056 tx_port_num = mvpp2_egress_port(port);
@@ -5133,10 +5121,11 @@ static void mvpp2_txq_deinit(struct mvpp2_port *port, · 64 unmodified lines
51335121 mvpp2_write(port->priv, MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(txq->id), 0);
51345122
51355123 /* Set Tx descriptors queue starting address and size */
5136− cpu = smp_processor_id();
5124+ cpu = get_cpu();
51375125 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_NUM_REG, txq->id);
51385126 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_DESC_ADDR_REG, 0);
51395127 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_DESC_SIZE_REG, 0);
5128+ put_cpu();
51405129 }
51415130
51425131 /* Cleanup Tx ports */
@@ -5146,7 +5135,7 @@ static void mvpp2_txq_clean(struct mvpp2_port *port, struct mvpp2_tx_queue *txq) · 3 unmodified lines
51465135 int delay, pending, cpu;
51475136 u32 val;
51485137
5149− cpu = smp_processor_id();
5138+ cpu = get_cpu();
51505139 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_NUM_REG, txq->id);
51515140 val = mvpp2_percpu_read(port->priv, cpu, MVPP2_TXQ_PREF_BUF_REG);
51525141 val |= MVPP2_TXQ_DRAIN_EN_MASK;
@@ -5173,6 +5162,7 @@ static void mvpp2_txq_clean(struct mvpp2_port *port, struct mvpp2_tx_queue *txq) · 20 unmodified lines
51735162
51745163 val &= ~MVPP2_TXQ_DRAIN_EN_MASK;
51755164 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_PREF_BUF_REG, val);
5165+ put_cpu();
51765166
51775167 for_each_present_cpu(cpu) {
51785168 txq_pcpu = per_cpu_ptr(txq->pcpu, cpu);
@@ -5420,7 +5410,7 @@ static void mvpp2_rx_csum(struct mvpp2_port *port, u32 status, · 241 unmodified lines
54205410
54215411 /* Reuse skb if possible, or allocate a new skb and add it to BM pool */
54225412 static int mvpp2_rx_refill(struct mvpp2_port *port,
5423− struct mvpp2_bm_pool *bm_pool, u32 bm)
5413+ struct mvpp2_bm_pool *bm_pool, int pool)
54245414 {
54255415 dma_addr_t dma_addr;
54265416 phys_addr_t phys_addr;
@@ -5432,7 +5422,7 @@ static int mvpp2_rx_refill(struct mvpp2_port *port, · 5 unmodified lines
54325422 if (!buf)
54335423 return -ENOMEM;
54345424
5435− mvpp2_pool_refill(port, bm, dma_addr, phys_addr);
5425+ mvpp2_pool_refill(port, pool, dma_addr, phys_addr);
54365426
54375427 return 0;
54385428 }
@@ -5490,7 +5480,7 @@ static int mvpp2_rx(struct mvpp2_port *port, int rx_todo, · 51 unmodified lines
54905480 unsigned int frag_size;
54915481 dma_addr_t dma_addr;
54925482 phys_addr_t phys_addr;
5493− u32 bm, rx_status;
5483+ u32 rx_status;
54945484 int pool, rx_bytes, err;
54955485 void *data;
54965486
@@ -5502,8 +5492,8 @@ static int mvpp2_rx(struct mvpp2_port *port, int rx_todo, · 5 unmodified lines
55025492 phys_addr = mvpp2_rxdesc_cookie_get(port, rx_desc);
55035493 data = (void *)phys_to_virt(phys_addr);
55045494
5505− bm = mvpp2_bm_cookie_build(port, rx_desc);
5506− pool = mvpp2_bm_cookie_pool_get(bm);
5495+ pool = (rx_status & MVPP2_RXD_BM_POOL_ID_MASK) >>
5496+ MVPP2_RXD_BM_POOL_ID_OFFS;
55075497 bm_pool = &port->priv->bm_pools[pool];
55085498
55095499 /* In case of an error, release the requested buffer pointer
@@ -5516,7 +5506,7 @@ err_drop_frame: · 6 unmodified lines
55165506 dev->stats.rx_errors++;
55175507 mvpp2_rx_error(port, rx_desc);
55185508 /* Return the buffer to the pool */
5519− mvpp2_pool_refill(port, bm, dma_addr, phys_addr);
5509+ mvpp2_pool_refill(port, pool, dma_addr, phys_addr);
55205510 continue;
55215511 }
55225512
@@ -5531,7 +5521,7 @@ err_drop_frame: · 8 unmodified lines
55315521 goto err_drop_frame;
55325522 }
55335523
5534− err = mvpp2_rx_refill(port, bm_pool, bm);
5524+ err = mvpp2_rx_refill(port, bm_pool, pool);
55355525 if (err) {
55365526 netdev_err(port->dev, "failed to refill BM pools\n");
55375527 goto err_drop_frame;
drivers/net/ethernet/mellanox/mlx5/core/en.h+5−3
@@ -458,13 +458,15 @@ struct mlx5e_mpw_info { · 457 unmodified lines
458458
459459 struct mlx5e_rx_am_stats {
460460 int ppms; /* packets per msec */
461+ int bpms; /* bytes per msec */
461462 int epms; /* events per msec */
462463 };
463464
464465 struct mlx5e_rx_am_sample {
465− ktime_t time;
466− unsigned int pkt_ctr;
467− u16 event_ctr;
466+ ktime_t time;
467+ u32 pkt_ctr;
468+ u32 byte_ctr;
469+ u16 event_ctr;
468470 };
469471
470472 struct mlx5e_rx_am { /* Adaptive Moderation */
drivers/net/ethernet/mellanox/mlx5/core/en_rx_am.c+26−19
@@ -183,28 +183,27 @@ static void mlx5e_am_exit_parking(struct mlx5e_rx_am *am) · 182 unmodified lines
183183 mlx5e_am_step(am);
184184 }
185185
186+#define IS_SIGNIFICANT_DIFF(val, ref) \
187+ (((100 * abs((val) - (ref))) / (ref)) > 10) /* more than 10% difference */
188+
186189 static int mlx5e_am_stats_compare(struct mlx5e_rx_am_stats *curr,
187190 struct mlx5e_rx_am_stats *prev)
188191 {
189− int diff;
190−
191− if (!prev->ppms)
192− return curr->ppms ? MLX5E_AM_STATS_BETTER :
192+ if (!prev->bpms)
193+ return curr->bpms ? MLX5E_AM_STATS_BETTER :
193194 MLX5E_AM_STATS_SAME;
194195
195− diff = curr->ppms - prev->ppms;
196− if (((100 * abs(diff)) / prev->ppms) > 10) /* more than 10% diff */
197− return (diff > 0) ? MLX5E_AM_STATS_BETTER :
198− MLX5E_AM_STATS_WORSE;
196+ if (IS_SIGNIFICANT_DIFF(curr->bpms, prev->bpms))
197+ return (curr->bpms > prev->bpms) ? MLX5E_AM_STATS_BETTER :
198+ MLX5E_AM_STATS_WORSE;
199199
200− if (!prev->epms)
201− return curr->epms ? MLX5E_AM_STATS_WORSE :
202− MLX5E_AM_STATS_SAME;
200+ if (IS_SIGNIFICANT_DIFF(curr->ppms, prev->ppms))
201+ return (curr->ppms > prev->ppms) ? MLX5E_AM_STATS_BETTER :
202+ MLX5E_AM_STATS_WORSE;
203203
204− diff = curr->epms - prev->epms;
205− if (((100 * abs(diff)) / prev->epms) > 10) /* more than 10% diff */
206− return (diff < 0) ? MLX5E_AM_STATS_BETTER :
207− MLX5E_AM_STATS_WORSE;
204+ if (IS_SIGNIFICANT_DIFF(curr->epms, prev->epms))
205+ return (curr->epms < prev->epms) ? MLX5E_AM_STATS_BETTER :
206+ MLX5E_AM_STATS_WORSE;
208207
209208 return MLX5E_AM_STATS_SAME;
210209 }
@@ -266,10 +265,13 @@ static void mlx5e_am_sample(struct mlx5e_rq *rq, · 55 unmodified lines
266265 {
267266 s->time = ktime_get();
268267 s->pkt_ctr = rq->stats.packets;
268+ s->byte_ctr = rq->stats.bytes;
269269 s->event_ctr = rq->cq.event_ctr;
270270 }
271271
272272 #define MLX5E_AM_NEVENTS 64
273+#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
274+#define BIT_GAP(bits, end, start) ((((end) - (start)) + BIT_ULL(bits)) & (BIT_ULL(bits) - 1))
273275
274276 static void mlx5e_am_calc_stats(struct mlx5e_rx_am_sample *start,
275277 struct mlx5e_rx_am_sample *end,
@@ -277,13 +279,17 @@ static void mlx5e_am_calc_stats(struct mlx5e_rx_am_sample *start, · 1 unmodified line
277279 {
278280 /* u32 holds up to 71 minutes, should be enough */
279281 u32 delta_us = ktime_us_delta(end->time, start->time);
280− unsigned int npkts = end->pkt_ctr - start->pkt_ctr;
282+ u32 npkts = BIT_GAP(BITS_PER_TYPE(u32), end->pkt_ctr, start->pkt_ctr);
283+ u32 nbytes = BIT_GAP(BITS_PER_TYPE(u32), end->byte_ctr,
284+ start->byte_ctr);
281285
282286 if (!delta_us)
283287 return;
284288
285− curr_stats->ppms = (npkts * USEC_PER_MSEC) / delta_us;
286− curr_stats->epms = (MLX5E_AM_NEVENTS * USEC_PER_MSEC) / delta_us;
289+ curr_stats->ppms = DIV_ROUND_UP(npkts * USEC_PER_MSEC, delta_us);
290+ curr_stats->bpms = DIV_ROUND_UP(nbytes * USEC_PER_MSEC, delta_us);
291+ curr_stats->epms = DIV_ROUND_UP(MLX5E_AM_NEVENTS * USEC_PER_MSEC,
292+ delta_us);
287293 }
288294
289295 void mlx5e_rx_am_work(struct work_struct *work)
@@ -308,7 +314,8 @@ void mlx5e_rx_am(struct mlx5e_rq *rq) · 18 unmodified lines
308314
309315 switch (am->state) {
310316 case MLX5E_AM_MEASURE_IN_PROGRESS:
311− nevents = rq->cq.event_ctr - am->start_sample.event_ctr;
317+ nevents = BIT_GAP(BITS_PER_TYPE(u16), rq->cq.event_ctr,
318+ am->start_sample.event_ctr);
312319 if (nevents < MLX5E_AM_NEVENTS)
313320 break;
314321 mlx5e_am_sample(rq, &end_sample);
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h+2−9
@@ -417,20 +417,13 @@ struct mlx5e_stats { · 416 unmodified lines
417417 };
418418
419419 static const struct counter_desc mlx5e_pme_status_desc[] = {
420− { "module_plug", 0 },
421420 { "module_unplug", 8 },
422421 };
423422
424423 static const struct counter_desc mlx5e_pme_error_desc[] = {
425− { "module_pwr_budget_exd", 0 }, /* power budget exceed */
426− { "module_long_range", 8 }, /* long range for non MLNX cable */
427− { "module_bus_stuck", 16 }, /* bus stuck (I2C or data shorted) */
428− { "module_no_eeprom", 24 }, /* no eeprom/retry time out */
429− { "module_enforce_part", 32 }, /* enforce part number list */
430− { "module_unknown_id", 40 }, /* unknown identifier */
431− { "module_high_temp", 48 }, /* high temperature */
424+ { "module_bus_stuck", 16 }, /* bus stuck (I2C or data shorted) */
425+ { "module_high_temp", 48 }, /* high temperature */
432426 { "module_bad_shorted", 56 }, /* bad or shorted cable/module */
433− { "module_unknown_status", 64 },
434427 };
435428
436429 #endif /* __MLX5_EN_STATS_H__ */
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c+1−1
@@ -862,7 +862,7 @@ struct mlx5_flow_table *mlx5_create_vport_flow_table(struct mlx5_flow_namespace · 861 unmodified lines
862862 ft_attr.level = level;
863863 ft_attr.prio = prio;
864864
865− return __mlx5_create_flow_table(ns, &ft_attr, FS_FT_OP_MOD_NORMAL, 0);
865+ return __mlx5_create_flow_table(ns, &ft_attr, FS_FT_OP_MOD_NORMAL, vport);
866866 }
867867
868868 struct mlx5_flow_table*
drivers/net/ethernet/mellanox/mlx5/core/health.c+5−6
@@ -275,10 +275,8 @@ static void poll_health(unsigned long data) · 274 unmodified lines
275275 struct mlx5_core_health *health = &dev->priv.health;
276276 u32 count;
277277
278− if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) {
279− mod_timer(&health->timer, get_next_poll_jiffies());
280− return;
281− }
278+ if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
279+ goto out;
282280
283281 count = ioread32be(health->health_counter);
284282 if (count == health->prev)
@@ -290,8 +288,6 @@ static void poll_health(unsigned long data) · 5 unmodified lines
290288 if (health->miss_counter == MAX_MISSES) {
291289 dev_err(&dev->pdev->dev, "device's health compromised - reached miss count\n");
292290 print_health_info(dev);
293− } else {
294− mod_timer(&health->timer, get_next_poll_jiffies());
295291 }
296292
297293 if (in_fatal(dev) && !health->sick) {
@@ -305,6 +301,9 @@ static void poll_health(unsigned long data) · 7 unmodified lines
305301 "new health works are not permitted at this stage\n");
306302 spin_unlock(&health->wq_lock);
307303 }
304+
305+out:
306+ mod_timer(&health->timer, get_next_poll_jiffies());
308307 }
309308
310309 void mlx5_start_health_poll(struct mlx5_core_dev *dev)
drivers/net/ethernet/mellanox/mlx5/core/main.c+4−2
@@ -537,8 +537,10 @@ static int handle_hca_cap(struct mlx5_core_dev *dev) · 536 unmodified lines
537537 /* disable cmdif checksum */
538538 MLX5_SET(cmd_hca_cap, set_hca_cap, cmdif_checksum, 0);
539539
540− /* If the HCA supports 4K UARs use it */
541− if (MLX5_CAP_GEN_MAX(dev, uar_4k))
540+ /* Enable 4K UAR only when HCA supports it and page size is bigger
541+ * than 4K.
542+ */
543+ if (MLX5_CAP_GEN_MAX(dev, uar_4k) && PAGE_SIZE > 4096)
542544 MLX5_SET(cmd_hca_cap, set_hca_cap, uar_4k, 1);
543545
544546 MLX5_SET(cmd_hca_cap, set_hca_cap, log_uar_page_sz, PAGE_SHIFT - 12);
drivers/net/ethernet/qlogic/qed/qed_debug.c+1−1
@@ -2956,7 +2956,7 @@ static u32 qed_grc_dump_ctx_data(struct qed_hwfn *p_hwfn, · 2955 unmodified lines
29562956 qed_wr(p_hwfn,
29572957 p_ptt,
29582958 s_storm_defs[storm_id].cm_ctx_wr_addr,
2959− BIT(9) | lid);
2959+ (i << 9) | lid);
29602960 *(dump_buf + offset) = qed_rd(p_hwfn,
29612961 p_ptt,
29622962 rd_reg_addr);
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c+7−4
@@ -214,13 +214,13 @@ static int dwmac4_wrback_get_tx_timestamp_status(struct dma_desc *p) · 213 unmodified lines
214214 {
215215 /* Context type from W/B descriptor must be zero */
216216 if (le32_to_cpu(p->des3) & TDES3_CONTEXT_TYPE)
217− return -EINVAL;
217+ return 0;
218218
219219 /* Tx Timestamp Status is 1 so des0 and des1'll have valid values */
220220 if (le32_to_cpu(p->des3) & TDES3_TIMESTAMP_STATUS)
221− return 0;
221+ return 1;
222222
223− return 1;
223+ return 0;
224224 }
225225
226226 static inline u64 dwmac4_get_timestamp(void *desc, u32 ats)
@@ -282,7 +282,10 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, u32 ats) · 55 unmodified lines
282282 }
283283 }
284284 exit:
285− return ret;
285+ if (likely(ret == 0))
286+ return 1;
287+
288+ return 0;
286289 }
287290
288291 static void dwmac4_rd_init_rx_desc(struct dma_desc *p, int disable_rx_ic,
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+17−8
@@ -434,14 +434,14 @@ static void stmmac_get_tx_hwtstamp(struct stmmac_priv *priv, · 433 unmodified lines
434434 return;
435435
436436 /* check tx tstamp status */
437− if (!priv->hw->desc->get_tx_timestamp_status(p)) {
437+ if (priv->hw->desc->get_tx_timestamp_status(p)) {
438438 /* get the valid tstamp */
439439 ns = priv->hw->desc->get_timestamp(p, priv->adv_ts);
440440
441441 memset(&shhwtstamp, 0, sizeof(struct skb_shared_hwtstamps));
442442 shhwtstamp.hwtstamp = ns_to_ktime(ns);
443443
444− netdev_info(priv->dev, "get valid TX hw timestamp %llu\n", ns);
444+ netdev_dbg(priv->dev, "get valid TX hw timestamp %llu\n", ns);
445445 /* pass tstamp to stack */
446446 skb_tstamp_tx(skb, &shhwtstamp);
447447 }
@@ -468,19 +468,19 @@ static void stmmac_get_rx_hwtstamp(struct stmmac_priv *priv, struct dma_desc *p, · 20 unmodified lines
468468 return;
469469
470470 /* Check if timestamp is available */
471− if (!priv->hw->desc->get_rx_timestamp_status(p, priv->adv_ts)) {
471+ if (priv->hw->desc->get_rx_timestamp_status(p, priv->adv_ts)) {
472472 /* For GMAC4, the valid timestamp is from CTX next desc. */
473473 if (priv->plat->has_gmac4)
474474 ns = priv->hw->desc->get_timestamp(np, priv->adv_ts);
475475 else
476476 ns = priv->hw->desc->get_timestamp(p, priv->adv_ts);
477477
478− netdev_info(priv->dev, "get valid RX hw timestamp %llu\n", ns);
478+ netdev_dbg(priv->dev, "get valid RX hw timestamp %llu\n", ns);
479479 shhwtstamp = skb_hwtstamps(skb);
480480 memset(shhwtstamp, 0, sizeof(struct skb_shared_hwtstamps));
481481 shhwtstamp->hwtstamp = ns_to_ktime(ns);
482482 } else {
483− netdev_err(priv->dev, "cannot get RX hw timestamp\n");
483+ netdev_dbg(priv->dev, "cannot get RX hw timestamp\n");
484484 }
485485 }
486486
@@ -546,7 +546,10 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) · 59 unmodified lines
546546 /* PTP v1, UDP, any kind of event packet */
547547 config.rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
548548 /* take time stamp for all event messages */
549− snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
549+ if (priv->plat->has_gmac4)
550+ snap_type_sel = PTP_GMAC4_TCR_SNAPTYPSEL_1;
551+ else
552+ snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
550553
551554 ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA;
552555 ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA;
@@ -578,7 +581,10 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) · 25 unmodified lines
578581 config.rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT;
579582 ptp_v2 = PTP_TCR_TSVER2ENA;
580583 /* take time stamp for all event messages */
581− snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
584+ if (priv->plat->has_gmac4)
585+ snap_type_sel = PTP_GMAC4_TCR_SNAPTYPSEL_1;
586+ else
587+ snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
582588
583589 ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA;
584590 ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA;
@@ -612,7 +618,10 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) · 27 unmodified lines
612618 config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
613619 ptp_v2 = PTP_TCR_TSVER2ENA;
614620 /* take time stamp for all event messages */
615− snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
621+ if (priv->plat->has_gmac4)
622+ snap_type_sel = PTP_GMAC4_TCR_SNAPTYPSEL_1;
623+ else
624+ snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
616625
617626 ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA;
618627 ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA;
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h+2−1
@@ -59,7 +59,8 @@ · 58 unmodified lines
5959 /* Enable Snapshot for Messages Relevant to Master */
6060 #define PTP_TCR_TSMSTRENA BIT(15)
6161 /* Select PTP packets for Taking Snapshots */
62−#define PTP_TCR_SNAPTYPSEL_1 GENMASK(17, 16)
62+#define PTP_TCR_SNAPTYPSEL_1 BIT(16)
63+#define PTP_GMAC4_TCR_SNAPTYPSEL_1 GENMASK(17, 16)
6364 /* Enable MAC address for PTP Frame Filtering */
6465 #define PTP_TCR_TSENMACADDR BIT(18)
6566
drivers/net/geneve.c+1−1
@@ -1007,7 +1007,7 @@ static void geneve_setup(struct net_device *dev) · 1006 unmodified lines
10071007
10081008 dev->netdev_ops = &geneve_netdev_ops;
10091009 dev->ethtool_ops = &geneve_ethtool_ops;
1010− dev->destructor = free_netdev;
1010+ dev->needs_free_netdev = true;
10111011
10121012 SET_NETDEV_DEVTYPE(dev, &geneve_type);
10131013
drivers/net/gtp.c+1−1
@@ -611,7 +611,7 @@ static const struct net_device_ops gtp_netdev_ops = { · 610 unmodified lines
611611 static void gtp_link_setup(struct net_device *dev)
612612 {
613613 dev->netdev_ops = &gtp_netdev_ops;
614− dev->destructor = free_netdev;
614+ dev->needs_free_netdev = true;
615615
616616 dev->hard_header_len = 0;
617617 dev->addr_len = 0;
drivers/net/hamradio/6pack.c+1−1
@@ -311,7 +311,7 @@ static void sp_setup(struct net_device *dev) · 310 unmodified lines
311311 {
312312 /* Finish setting up the DEVICE info. */
313313 dev->netdev_ops = &sp_netdev_ops;
314− dev->destructor = free_netdev;
314+ dev->needs_free_netdev = true;
315315 dev->mtu = SIXP_MTU;
316316 dev->hard_header_len = AX25_MAX_HEADER_LEN;
317317 dev->header_ops = &ax25_header_ops;
drivers/net/hamradio/bpqether.c+1−1
@@ -476,7 +476,7 @@ static const struct net_device_ops bpq_netdev_ops = { · 475 unmodified lines
476476 static void bpq_setup(struct net_device *dev)
477477 {
478478 dev->netdev_ops = &bpq_netdev_ops;
479− dev->destructor = free_netdev;
479+ dev->needs_free_netdev = true;
480480
481481 memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);
482482 memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN);
drivers/net/hyperv/hyperv_net.h+3−2
@@ -171,6 +171,8 @@ struct rndis_device { · 170 unmodified lines
171171 spinlock_t request_lock;
172172 struct list_head req_list;
173173
174+ struct work_struct mcast_work;
175+
174176 u8 hw_mac_adr[ETH_ALEN];
175177 u8 rss_key[NETVSC_HASH_KEYLEN];
176178 u16 ind_table[ITAB_NUM];
@@ -201,6 +203,7 @@ int rndis_filter_open(struct netvsc_device *nvdev); · 24 unmodified lines
201203 int rndis_filter_close(struct netvsc_device *nvdev);
202204 int rndis_filter_device_add(struct hv_device *dev,
203205 struct netvsc_device_info *info);
206+void rndis_filter_update(struct netvsc_device *nvdev);
204207 void rndis_filter_device_remove(struct hv_device *dev,
205208 struct netvsc_device *nvdev);
206209 int rndis_filter_set_rss_param(struct rndis_device *rdev,
@@ -211,7 +214,6 @@ int rndis_filter_receive(struct net_device *ndev, · 4 unmodified lines
211214 struct vmbus_channel *channel,
212215 void *data, u32 buflen);
213216
214−int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter);
215217 int rndis_filter_set_device_mac(struct net_device *ndev, char *mac);
216218
217219 void netvsc_switch_datapath(struct net_device *nv_dev, bool vf);
@@ -696,7 +698,6 @@ struct net_device_context { · 478 unmodified lines
696698 /* list protection */
697699 spinlock_t lock;
698700
699− struct work_struct work;
700701 u32 msg_enable; /* debug level */
701702
702703 u32 tx_checksum_mask;
drivers/net/hyperv/netvsc_drv.c+18−36
@@ -56,37 +56,12 @@ static int debug = -1; · 55 unmodified lines
5656 module_param(debug, int, S_IRUGO);
5757 MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
5858
59−static void do_set_multicast(struct work_struct *w)
60−{
61− struct net_device_context *ndevctx =
62− container_of(w, struct net_device_context, work);
63− struct hv_device *device_obj = ndevctx->device_ctx;
64− struct net_device *ndev = hv_get_drvdata(device_obj);
65− struct netvsc_device *nvdev = rcu_dereference(ndevctx->nvdev);
66− struct rndis_device *rdev;
67−
68− if (!nvdev)
69− return;
70−
71− rdev = nvdev->extension;
72− if (rdev == NULL)
73− return;
74−
75− if (ndev->flags & IFF_PROMISC)
76− rndis_filter_set_packet_filter(rdev,
77− NDIS_PACKET_TYPE_PROMISCUOUS);
78− else
79− rndis_filter_set_packet_filter(rdev,
80− NDIS_PACKET_TYPE_BROADCAST |
81− NDIS_PACKET_TYPE_ALL_MULTICAST |
82− NDIS_PACKET_TYPE_DIRECTED);
83−}
84−
8559 static void netvsc_set_multicast_list(struct net_device *net)
8660 {
8761 struct net_device_context *net_device_ctx = netdev_priv(net);
62+ struct netvsc_device *nvdev = rtnl_dereference(net_device_ctx->nvdev);
8863
89− schedule_work(&net_device_ctx->work);
64+ rndis_filter_update(nvdev);
9065 }
9166
9267 static int netvsc_open(struct net_device *net)
@@ -123,8 +98,6 @@ static int netvsc_close(struct net_device *net) · 30 unmodified lines
12398
12499 netif_tx_disable(net);
125100
126− /* Make sure netvsc_set_multicast_list doesn't re-enable filter! */
127− cancel_work_sync(&net_device_ctx->work);
128101 ret = rndis_filter_close(nvdev);
129102 if (ret != 0) {
130103 netdev_err(net, "unable to close device (ret %d).\n", ret);
@@ -1028,7 +1001,7 @@ static const struct { · 897 unmodified lines
10281001 static int netvsc_get_sset_count(struct net_device *dev, int string_set)
10291002 {
10301003 struct net_device_context *ndc = netdev_priv(dev);
1031− struct netvsc_device *nvdev = rcu_dereference(ndc->nvdev);
1004+ struct netvsc_device *nvdev = rtnl_dereference(ndc->nvdev);
10321005
10331006 if (!nvdev)
10341007 return -ENODEV;
@@ -1158,11 +1131,22 @@ netvsc_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info, · 123 unmodified lines
11581131 }
11591132
11601133 #ifdef CONFIG_NET_POLL_CONTROLLER
1161−static void netvsc_poll_controller(struct net_device *net)
1134+static void netvsc_poll_controller(struct net_device *dev)
11621135 {
1163− /* As netvsc_start_xmit() works synchronous we don't have to
1164− * trigger anything here.
1165− */
1136+ struct net_device_context *ndc = netdev_priv(dev);
1137+ struct netvsc_device *ndev;
1138+ int i;
1139+
1140+ rcu_read_lock();
1141+ ndev = rcu_dereference(ndc->nvdev);
1142+ if (ndev) {
1143+ for (i = 0; i < ndev->num_chn; i++) {
1144+ struct netvsc_channel *nvchan = &ndev->chan_table[i];
1145+
1146+ napi_schedule(&nvchan->napi);
1147+ }
1148+ }
1149+ rcu_read_unlock();
11661150 }
11671151 #endif
11681152
@@ -1552,7 +1536,6 @@ static int netvsc_probe(struct hv_device *dev, · 383 unmodified lines
15521536 hv_set_drvdata(dev, net);
15531537
15541538 INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_link_change);
1555− INIT_WORK(&net_device_ctx->work, do_set_multicast);
15561539
15571540 spin_lock_init(&net_device_ctx->lock);
15581541 INIT_LIST_HEAD(&net_device_ctx->reconfig_events);
@@ -1622,7 +1605,6 @@ static int netvsc_remove(struct hv_device *dev) · 63 unmodified lines
16221605 netif_device_detach(net);
16231606
16241607 cancel_delayed_work_sync(&ndev_ctx->dwork);
1625− cancel_work_sync(&ndev_ctx->work);
16261608
16271609 /*
16281610 * Call to the vsc driver to let it know that the device is being
drivers/net/hyperv/rndis_filter.c+29−1
@@ -31,6 +31,7 @@ · 30 unmodified lines
3131
3232 #include "hyperv_net.h"
3333
34+static void rndis_set_multicast(struct work_struct *w);
3435
3536 #define RNDIS_EXT_LEN PAGE_SIZE
3637 struct rndis_request {
@@ -76,6 +77,7 @@ static struct rndis_device *get_rndis_device(void) · 39 unmodified lines
7677 spin_lock_init(&device->request_lock);
7778
7879 INIT_LIST_HEAD(&device->req_list);
80+ INIT_WORK(&device->mcast_work, rndis_set_multicast);
7981
8082 device->state = RNDIS_DEV_UNINITIALIZED;
8183
@@ -815,7 +817,8 @@ static int rndis_filter_query_link_speed(struct rndis_device *dev) · 733 unmodified lines
815817 return ret;
816818 }
817819
818−int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter)
820+static int rndis_filter_set_packet_filter(struct rndis_device *dev,
821+ u32 new_filter)
819822 {
820823 struct rndis_request *request;
821824 struct rndis_set_request *set;
@@ -846,6 +849,28 @@ int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter) · 24 unmodified lines
846849 return ret;
847850 }
848851
852+static void rndis_set_multicast(struct work_struct *w)
853+{
854+ struct rndis_device *rdev
855+ = container_of(w, struct rndis_device, mcast_work);
856+
857+ if (rdev->ndev->flags & IFF_PROMISC)
858+ rndis_filter_set_packet_filter(rdev,
859+ NDIS_PACKET_TYPE_PROMISCUOUS);
860+ else
861+ rndis_filter_set_packet_filter(rdev,
862+ NDIS_PACKET_TYPE_BROADCAST |
863+ NDIS_PACKET_TYPE_ALL_MULTICAST |
864+ NDIS_PACKET_TYPE_DIRECTED);
865+}
866+
867+void rndis_filter_update(struct netvsc_device *nvdev)
868+{
869+ struct rndis_device *rdev = nvdev->extension;
870+
871+ schedule_work(&rdev->mcast_work);
872+}
873+
849874 static int rndis_filter_init_device(struct rndis_device *dev)
850875 {
851876 struct rndis_request *request;
@@ -973,6 +998,9 @@ static int rndis_filter_close_device(struct rndis_device *dev) · 121 unmodified lines
973998 if (dev->state != RNDIS_DEV_DATAINITIALIZED)
974999 return 0;
9751000
1001+ /* Make sure rndis_set_multicast doesn't re-enable filter! */
1002+ cancel_work_sync(&dev->mcast_work);
1003+
9761004 ret = rndis_filter_set_packet_filter(dev, 0);
9771005 if (ret == -ENODEV)
9781006 ret = 0;
drivers/net/ifb.c+2−2
@@ -207,7 +207,6 @@ static void ifb_dev_free(struct net_device *dev) · 206 unmodified lines
207207 __skb_queue_purge(&txp->tq);
208208 }
209209 kfree(dp->tx_private);
210− free_netdev(dev);
211210 }
212211
213212 static void ifb_setup(struct net_device *dev)
@@ -230,7 +229,8 @@ static void ifb_setup(struct net_device *dev) · 16 unmodified lines
230229 dev->priv_flags &= ~IFF_TX_SKB_SHARING;
231230 netif_keep_dst(dev);
232231 eth_hw_addr_random(dev);
233− dev->destructor = ifb_dev_free;
232+ dev->needs_free_netdev = true;
233+ dev->priv_destructor = ifb_dev_free;
234234 }
235235
236236 static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev)
drivers/net/ipvlan/ipvlan_main.c+1−1
@@ -632,7 +632,7 @@ void ipvlan_link_setup(struct net_device *dev) · 631 unmodified lines
632632 dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);
633633 dev->priv_flags |= IFF_UNICAST_FLT | IFF_NO_QUEUE;
634634 dev->netdev_ops = &ipvlan_netdev_ops;
635− dev->destructor = free_netdev;
635+ dev->needs_free_netdev = true;
636636 dev->header_ops = &ipvlan_header_ops;
637637 dev->ethtool_ops = &ipvlan_ethtool_ops;
638638 }
drivers/net/loopback.c+2−2
@@ -159,7 +159,6 @@ static void loopback_dev_free(struct net_device *dev) · 158 unmodified lines
159159 {
160160 dev_net(dev)->loopback_dev = NULL;
161161 free_percpu(dev->lstats);
162− free_netdev(dev);
163162 }
164163
165164 static const struct net_device_ops loopback_ops = {
@@ -196,7 +195,8 @@ static void loopback_setup(struct net_device *dev) · 30 unmodified lines
196195 dev->ethtool_ops = &loopback_ethtool_ops;
197196 dev->header_ops = &eth_header_ops;
198197 dev->netdev_ops = &loopback_ops;
199− dev->destructor = loopback_dev_free;
198+ dev->needs_free_netdev = true;
199+ dev->priv_destructor = loopback_dev_free;
200200 }
201201
202202 /* Setup and register the loopback device. */
drivers/net/macsec.c+2−2
@@ -2996,7 +2996,6 @@ static void macsec_free_netdev(struct net_device *dev) · 2995 unmodified lines
29962996 free_percpu(macsec->secy.tx_sc.stats);
29972997
29982998 dev_put(real_dev);
2999− free_netdev(dev);
30002999 }
30013000
30023001 static void macsec_setup(struct net_device *dev)
@@ -3006,7 +3005,8 @@ static void macsec_setup(struct net_device *dev) · 3 unmodified lines
30063005 dev->max_mtu = ETH_MAX_MTU;
30073006 dev->priv_flags |= IFF_NO_QUEUE;
30083007 dev->netdev_ops = &macsec_netdev_ops;
3009− dev->destructor = macsec_free_netdev;
3008+ dev->needs_free_netdev = true;
3009+ dev->priv_destructor = macsec_free_netdev;
30103010 SET_NETDEV_DEVTYPE(dev, &macsec_type);
30113011
30123012 eth_zero_addr(dev->broadcast);
drivers/net/macvlan.c+1−1
@@ -1092,7 +1092,7 @@ void macvlan_common_setup(struct net_device *dev) · 1091 unmodified lines
10921092 netif_keep_dst(dev);
10931093 dev->priv_flags |= IFF_UNICAST_FLT;
10941094 dev->netdev_ops = &macvlan_netdev_ops;
1095− dev->destructor = free_netdev;
1095+ dev->needs_free_netdev = true;
10961096 dev->header_ops = &macvlan_hard_header_ops;
10971097 dev->ethtool_ops = &macvlan_ethtool_ops;
10981098 }
drivers/net/netconsole.c+1−1
@@ -358,7 +358,7 @@ static ssize_t enabled_store(struct config_item *item, · 357 unmodified lines
358358 if (err)
359359 goto out_unlock;
360360
361− pr_info("netconsole: network logging started\n");
361+ pr_info("network logging started\n");
362362 } else { /* false */
363363 /* We need to disable the netconsole before cleaning it up
364364 * otherwise we might end up in write_msg() with
drivers/net/nlmon.c+1−1
@@ -113,7 +113,7 @@ static void nlmon_setup(struct net_device *dev) · 112 unmodified lines
113113
114114 dev->netdev_ops = &nlmon_ops;
115115 dev->ethtool_ops = &nlmon_ethtool_ops;
116− dev->destructor = free_netdev;
116+ dev->needs_free_netdev = true;
117117
118118 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST |
119119 NETIF_F_HIGHDMA | NETIF_F_LLTX;
drivers/net/phy/Kconfig+1−0
@@ -127,6 +127,7 @@ config MDIO_THUNDER · 126 unmodified lines
127127 tristate "ThunderX SOCs MDIO buses"
128128 depends on 64BIT
129129 depends on PCI
130+ depends on !(MDIO_DEVICE=y && PHYLIB=m)
130131 select MDIO_CAVIUM
131132 help
132133 This driver supports the MDIO interfaces found on Cavium
drivers/net/phy/phy.c+2−0
@@ -54,6 +54,8 @@ static const char *phy_speed_to_str(int speed) · 53 unmodified lines
5454 return "5Gbps";
5555 case SPEED_10000:
5656 return "10Gbps";
57+ case SPEED_14000:
58+ return "14Gbps";
5759 case SPEED_20000:
5860 return "20Gbps";
5961 case SPEED_25000:
drivers/net/slip/slip.c+3−4
@@ -629,7 +629,7 @@ static void sl_uninit(struct net_device *dev) · 628 unmodified lines
629629 static void sl_free_netdev(struct net_device *dev)
630630 {
631631 int i = dev->base_addr;
632− free_netdev(dev);
632+
633633 slip_devs[i] = NULL;
634634 }
635635
@@ -651,7 +651,8 @@ static const struct net_device_ops sl_netdev_ops = { · 15 unmodified lines
651651 static void sl_setup(struct net_device *dev)
652652 {
653653 dev->netdev_ops = &sl_netdev_ops;
654− dev->destructor = sl_free_netdev;
654+ dev->needs_free_netdev = true;
655+ dev->priv_destructor = sl_free_netdev;
655656
656657 dev->hard_header_len = 0;
657658 dev->addr_len = 0;
@@ -1369,8 +1370,6 @@ static void __exit slip_exit(void) · 711 unmodified lines
13691370 if (sl->tty) {
13701371 printk(KERN_ERR "%s: tty discipline still running\n",
13711372 dev->name);
1372− /* Intentionally leak the control block. */
1373− dev->destructor = NULL;
13741373 }
13751374
13761375 unregister_netdev(dev);
drivers/net/team/team.c+2−2
@@ -1643,7 +1643,6 @@ static void team_destructor(struct net_device *dev) · 1642 unmodified lines
16431643 struct team *team = netdev_priv(dev);
16441644
16451645 free_percpu(team->pcpu_stats);
1646− free_netdev(dev);
16471646 }
16481647
16491648 static int team_open(struct net_device *dev)
@@ -2079,7 +2078,8 @@ static void team_setup(struct net_device *dev) · 429 unmodified lines
20792078
20802079 dev->netdev_ops = &team_netdev_ops;
20812080 dev->ethtool_ops = &team_ethtool_ops;
2082− dev->destructor = team_destructor;
2081+ dev->needs_free_netdev = true;
2082+ dev->priv_destructor = team_destructor;
20832083 dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);
20842084 dev->priv_flags |= IFF_NO_QUEUE;
20852085 dev->priv_flags |= IFF_TEAM;
drivers/net/tun.c+2−2
@@ -1560,7 +1560,6 @@ static void tun_free_netdev(struct net_device *dev) · 1559 unmodified lines
15601560 free_percpu(tun->pcpu_stats);
15611561 tun_flow_uninit(tun);
15621562 security_tun_dev_free_security(tun->security);
1563− free_netdev(dev);
15641563 }
15651564
15661565 static void tun_setup(struct net_device *dev)
@@ -1571,7 +1570,8 @@ static void tun_setup(struct net_device *dev) · 4 unmodified lines
15711570 tun->group = INVALID_GID;
15721571
15731572 dev->ethtool_ops = &tun_ethtool_ops;
1574− dev->destructor = tun_free_netdev;
1573+ dev->needs_free_netdev = true;
1574+ dev->priv_destructor = tun_free_netdev;
15751575 /* We prefer our own queue length */
15761576 dev->tx_queue_len = TUN_READQ_SIZE;
15771577 }
drivers/net/usb/cdc-phonet.c+1−1
@@ -298,7 +298,7 @@ static void usbpn_setup(struct net_device *dev) · 297 unmodified lines
298298 dev->addr_len = 1;
299299 dev->tx_queue_len = 3;
300300
301− dev->destructor = free_netdev;
301+ dev->needs_free_netdev = true;
302302 }
303303
304304 /*
drivers/net/usb/qmi_wwan.c+5−1
@@ -123,7 +123,7 @@ static void qmimux_setup(struct net_device *dev) · 122 unmodified lines
123123 dev->addr_len = 0;
124124 dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
125125 dev->netdev_ops = &qmimux_netdev_ops;
126− dev->destructor = free_netdev;
126+ dev->needs_free_netdev = true;
127127 }
128128
129129 static struct net_device *qmimux_find_dev(struct usbnet *dev, u8 mux_id)
@@ -1192,6 +1192,8 @@ static const struct usb_device_id products[] = { · 1062 unmodified lines
11921192 {QMI_FIXED_INTF(0x1199, 0x9056, 8)}, /* Sierra Wireless Modem */
11931193 {QMI_FIXED_INTF(0x1199, 0x9057, 8)},
11941194 {QMI_FIXED_INTF(0x1199, 0x9061, 8)}, /* Sierra Wireless Modem */
1195+ {QMI_FIXED_INTF(0x1199, 0x9063, 8)}, /* Sierra Wireless EM7305 */
1196+ {QMI_FIXED_INTF(0x1199, 0x9063, 10)}, /* Sierra Wireless EM7305 */
11951197 {QMI_FIXED_INTF(0x1199, 0x9071, 8)}, /* Sierra Wireless MC74xx */
11961198 {QMI_FIXED_INTF(0x1199, 0x9071, 10)}, /* Sierra Wireless MC74xx */
11971199 {QMI_FIXED_INTF(0x1199, 0x9079, 8)}, /* Sierra Wireless EM74xx */
@@ -1206,6 +1208,8 @@ static const struct usb_device_id products[] = { · 8 unmodified lines
12061208 {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */
12071209 {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
12081210 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */
1211+ {QMI_FIXED_INTF(0x1c9e, 0x9801, 3)}, /* Telewell TW-3G HSPA+ */
1212+ {QMI_FIXED_INTF(0x1c9e, 0x9803, 4)}, /* Telewell TW-3G HSPA+ */
12091213 {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)}, /* XS Stick W100-2 from 4G Systems */
12101214 {QMI_FIXED_INTF(0x0b3c, 0xc000, 4)}, /* Olivetti Olicard 100 */
12111215 {QMI_FIXED_INTF(0x0b3c, 0xc001, 4)}, /* Olivetti Olicard 120 */
drivers/net/usb/r8152.c+2−0
@@ -4368,6 +4368,8 @@ static u8 rtl_get_version(struct usb_interface *intf) · 4367 unmodified lines
43684368 break;
43694369 }
43704370
4371+ dev_dbg(&intf->dev, "Detected version 0x%04x\n", version);
4372+
43714373 return version;
43724374 }
43734375
drivers/net/veth.c+2−2
@@ -222,7 +222,6 @@ static int veth_dev_init(struct net_device *dev) · 221 unmodified lines
222222 static void veth_dev_free(struct net_device *dev)
223223 {
224224 free_percpu(dev->vstats);
225− free_netdev(dev);
226225 }
227226
228227 #ifdef CONFIG_NET_POLL_CONTROLLER
@@ -317,7 +316,8 @@ static void veth_setup(struct net_device *dev) · 88 unmodified lines
317316 NETIF_F_HW_VLAN_STAG_TX |
318317 NETIF_F_HW_VLAN_CTAG_RX |
319318 NETIF_F_HW_VLAN_STAG_RX);
320− dev->destructor = veth_dev_free;
319+ dev->needs_free_netdev = true;
320+ dev->priv_destructor = veth_dev_free;
321321 dev->max_mtu = ETH_MAX_MTU;
322322
323323 dev->hw_features = VETH_FEATURES;
drivers/net/vrf.c+33−5
@@ -36,12 +36,14 @@ · 35 unmodified lines
3636 #include <net/addrconf.h>
3737 #include <net/l3mdev.h>
3838 #include <net/fib_rules.h>
39+#include <net/netns/generic.h>
3940
4041 #define DRV_NAME "vrf"
4142 #define DRV_VERSION "1.0"
4243
4344 #define FIB_RULE_PREF 1000 /* default preference for FIB rules */
44−static bool add_fib_rules = true;
45+
46+static unsigned int vrf_net_id;
4547
4648 struct net_vrf {
4749 struct rtable __rcu *rth;
@@ -1348,7 +1350,7 @@ static void vrf_setup(struct net_device *dev) · 1300 unmodified lines
13481350 dev->netdev_ops = &vrf_netdev_ops;
13491351 dev->l3mdev_ops = &vrf_l3mdev_ops;
13501352 dev->ethtool_ops = &vrf_ethtool_ops;
1351− dev->destructor = free_netdev;
1353+ dev->needs_free_netdev = true;
13521354
13531355 /* Fill in device structure with ethernet-generic values. */
13541356 eth_hw_addr_random(dev);
@@ -1394,6 +1396,8 @@ static int vrf_newlink(struct net *src_net, struct net_device *dev, · 39 unmodified lines
13941396 struct nlattr *tb[], struct nlattr *data[])
13951397 {
13961398 struct net_vrf *vrf = netdev_priv(dev);
1399+ bool *add_fib_rules;
1400+ struct net *net;
13971401 int err;
13981402
13991403 if (!data || !data[IFLA_VRF_TABLE])
@@ -1409,13 +1413,15 @@ static int vrf_newlink(struct net *src_net, struct net_device *dev, · 9 unmodified lines
14091413 if (err)
14101414 goto out;
14111415
1412− if (add_fib_rules) {
1416+ net = dev_net(dev);
1417+ add_fib_rules = net_generic(net, vrf_net_id);
1418+ if (*add_fib_rules) {
14131419 err = vrf_add_fib_rules(dev);
14141420 if (err) {
14151421 unregister_netdevice(dev);
14161422 goto out;
14171423 }
1418− add_fib_rules = false;
1424+ *add_fib_rules = false;
14191425 }
14201426
14211427 out:
@@ -1498,16 +1504,38 @@ static struct notifier_block vrf_notifier_block __read_mostly = { · 76 unmodified lines
14981504 .notifier_call = vrf_device_event,
14991505 };
15001506
1507+/* Initialize per network namespace state */
1508+static int __net_init vrf_netns_init(struct net *net)
1509+{
1510+ bool *add_fib_rules = net_generic(net, vrf_net_id);
1511+
1512+ *add_fib_rules = true;
1513+
1514+ return 0;
1515+}
1516+
1517+static struct pernet_operations vrf_net_ops __net_initdata = {
1518+ .init = vrf_netns_init,
1519+ .id = &vrf_net_id,
1520+ .size = sizeof(bool),
1521+};
1522+
15011523 static int __init vrf_init_module(void)
15021524 {
15031525 int rc;
15041526
15051527 register_netdevice_notifier(&vrf_notifier_block);
15061528
1507− rc = rtnl_link_register(&vrf_link_ops);
1529+ rc = register_pernet_subsys(&vrf_net_ops);
15081530 if (rc < 0)
15091531 goto error;
15101532
1533+ rc = rtnl_link_register(&vrf_link_ops);
1534+ if (rc < 0) {
1535+ unregister_pernet_subsys(&vrf_net_ops);
1536+ goto error;
1537+ }
1538+
15111539 return 0;
15121540
15131541 error:
drivers/net/vsockmon.c+1−1
@@ -135,7 +135,7 @@ static void vsockmon_setup(struct net_device *dev) · 134 unmodified lines
135135
136136 dev->netdev_ops = &vsockmon_ops;
137137 dev->ethtool_ops = &vsockmon_ethtool_ops;
138− dev->destructor = free_netdev;
138+ dev->needs_free_netdev = true;
139139
140140 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST |
141141 NETIF_F_HIGHDMA | NETIF_F_LLTX;
drivers/net/vxlan.c+1−1
@@ -2611,7 +2611,7 @@ static void vxlan_setup(struct net_device *dev) · 2610 unmodified lines
26112611 eth_hw_addr_random(dev);
26122612 ether_setup(dev);
26132613
2614− dev->destructor = free_netdev;
2614+ dev->needs_free_netdev = true;
26152615 SET_NETDEV_DEVTYPE(dev, &vxlan_type);
26162616
26172617 dev->features |= NETIF_F_LLTX;
drivers/net/wan/dlci.c+1−1
@@ -475,7 +475,7 @@ static void dlci_setup(struct net_device *dev) · 474 unmodified lines
475475 dev->flags = 0;
476476 dev->header_ops = &dlci_header_ops;
477477 dev->netdev_ops = &dlci_netdev_ops;
478− dev->destructor = free_netdev;
478+ dev->needs_free_netdev = true;
479479
480480 dlp->receive = dlci_receive;
481481
drivers/net/wan/hdlc_fr.c+1−1
@@ -1106,7 +1106,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) · 1105 unmodified lines
11061106 return -EIO;
11071107 }
11081108
1109− dev->destructor = free_netdev;
1109+ dev->needs_free_netdev = true;
11101110 *get_dev_p(pvc, type) = dev;
11111111 if (!used) {
11121112 state(hdlc)->dce_changed = 1;
drivers/net/wan/lapbether.c+1−1
@@ -306,7 +306,7 @@ static const struct net_device_ops lapbeth_netdev_ops = { · 305 unmodified lines
306306 static void lapbeth_setup(struct net_device *dev)
307307 {
308308 dev->netdev_ops = &lapbeth_netdev_ops;
309− dev->destructor = free_netdev;
309+ dev->needs_free_netdev = true;
310310 dev->type = ARPHRD_X25;
311311 dev->hard_header_len = 3;
312312 dev->mtu = 1000;
drivers/net/wireless/ath/ath6kl/main.c+1−1
@@ -1287,7 +1287,7 @@ void init_netdev(struct net_device *dev) · 1286 unmodified lines
12871287 struct ath6kl *ar = ath6kl_priv(dev);
12881288
12891289 dev->netdev_ops = &ath6kl_netdev_ops;
1290− dev->destructor = free_netdev;
1290+ dev->needs_free_netdev = true;
12911291 dev->watchdog_timeo = ATH6KL_TX_TIMEOUT;
12921292
12931293 dev->needed_headroom = ETH_HLEN;
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c+0−1
@@ -5225,7 +5225,6 @@ void brcmf_cfg80211_free_netdev(struct net_device *ndev) · 5224 unmodified lines
52255225
52265226 if (vif)
52275227 brcmf_free_vif(vif);
5228− free_netdev(ndev);
52295228 }
52305229
52315230 static bool brcmf_is_linkup(const struct brcmf_event_msg *e)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c+2−1
@@ -624,7 +624,8 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx, · 623 unmodified lines
624624 if (!ndev)
625625 return ERR_PTR(-ENOMEM);
626626
627− ndev->destructor = brcmf_cfg80211_free_netdev;
627+ ndev->needs_free_netdev = true;
628+ ndev->priv_destructor = brcmf_cfg80211_free_netdev;
628629 ifp = netdev_priv(ndev);
629630 ifp->ndev = ndev;
630631 /* store mapping ifidx to bsscfgidx */
drivers/net/wireless/intersil/hostap/hostap_main.c+1−1
@@ -73,7 +73,7 @@ struct net_device * hostap_add_interface(struct local_info *local, · 72 unmodified lines
7373 dev->mem_end = mdev->mem_end;
7474
7575 hostap_setup_dev(dev, local, type);
76− dev->destructor = free_netdev;
76+ dev->needs_free_netdev = true;
7777
7878 sprintf(dev->name, "%s%s", prefix, name);
7979 if (!rtnl_locked)
drivers/net/wireless/mac80211_hwsim.c+1−1
@@ -2861,7 +2861,7 @@ static const struct net_device_ops hwsim_netdev_ops = { · 2860 unmodified lines
28612861 static void hwsim_mon_setup(struct net_device *dev)
28622862 {
28632863 dev->netdev_ops = &hwsim_netdev_ops;
2864− dev->destructor = free_netdev;
2864+ dev->needs_free_netdev = true;
28652865 ether_setup(dev);
28662866 dev->priv_flags |= IFF_NO_QUEUE;
28672867 dev->type = ARPHRD_IEEE80211_RADIOTAP;
drivers/net/wireless/marvell/mwifiex/main.c+1−1
@@ -1280,7 +1280,7 @@ void mwifiex_init_priv_params(struct mwifiex_private *priv, · 1279 unmodified lines
12801280 struct net_device *dev)
12811281 {
12821282 dev->netdev_ops = &mwifiex_netdev_ops;
1283− dev->destructor = free_netdev;
1283+ dev->needs_free_netdev = true;
12841284 /* Initialize private structure */
12851285 priv->current_key_index = 0;
12861286 priv->media_connected = false;
drivers/s390/net/netiucv.c+2−2
@@ -1954,7 +1954,6 @@ static void netiucv_free_netdevice(struct net_device *dev) · 1953 unmodified lines
19541954 privptr->conn = NULL; privptr->fsm = NULL;
19551955 /* privptr gets freed by free_netdev() */
19561956 }
1957− free_netdev(dev);
19581957 }
19591958
19601959 /**
@@ -1972,7 +1971,8 @@ static void netiucv_setup_netdevice(struct net_device *dev) · 11 unmodified lines
19721971 dev->mtu = NETIUCV_MTU_DEFAULT;
19731972 dev->min_mtu = 576;
19741973 dev->max_mtu = NETIUCV_MTU_MAX;
1975− dev->destructor = netiucv_free_netdevice;
1974+ dev->needs_free_netdev = true;
1975+ dev->priv_destructor = netiucv_free_netdevice;
19761976 dev->hard_header_len = NETIUCV_HDRLEN;
19771977 dev->addr_len = 0;
19781978 dev->type = ARPHRD_SLIP;
drivers/staging/rtl8188eu/os_dep/mon.c+1−1
@@ -152,7 +152,7 @@ static const struct net_device_ops mon_netdev_ops = { · 151 unmodified lines
152152 static void mon_setup(struct net_device *dev)
153153 {
154154 dev->netdev_ops = &mon_netdev_ops;
155− dev->destructor = free_netdev;
155+ dev->needs_free_netdev = true;
156156 ether_setup(dev);
157157 dev->priv_flags |= IFF_NO_QUEUE;
158158 dev->type = ARPHRD_IEEE80211;
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c+2−1
@@ -2667,7 +2667,8 @@ static int rtw_cfg80211_add_monitor_if (struct adapter *padapter, char *name, st · 2666 unmodified lines
26672667 mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP;
26682668 strncpy(mon_ndev->name, name, IFNAMSIZ);
26692669 mon_ndev->name[IFNAMSIZ - 1] = 0;
2670− mon_ndev->destructor = rtw_ndev_destructor;
2670+ mon_ndev->needs_free_netdev = true;
2671+ mon_ndev->priv_destructor = rtw_ndev_destructor;
26712672
26722673 mon_ndev->netdev_ops = &rtw_cfg80211_monitor_if_ops;
26732674
drivers/staging/rtl8723bs/os_dep/os_intfs.c+0−2
@@ -1207,8 +1207,6 @@ void rtw_ndev_destructor(struct net_device *ndev) · 1206 unmodified lines
12071207
12081208 if (ndev->ieee80211_ptr)
12091209 kfree((u8 *)ndev->ieee80211_ptr);
1210−
1211− free_netdev(ndev);
12121210 }
12131211
12141212 void rtw_dev_unload(struct adapter *padapter)
drivers/usb/gadget/function/f_phonet.c+1−1
@@ -281,7 +281,7 @@ static void pn_net_setup(struct net_device *dev) · 280 unmodified lines
281281 dev->tx_queue_len = 1;
282282
283283 dev->netdev_ops = &pn_netdev_ops;
284− dev->destructor = free_netdev;
284+ dev->needs_free_netdev = true;
285285 dev->header_ops = &phonet_header_ops;
286286 }
287287
include/linux/netdevice.h+10−5
@@ -914,8 +914,7 @@ struct xfrmdev_ops { · 913 unmodified lines
914914 *
915915 * int (*ndo_change_mtu)(struct net_device *dev, int new_mtu);
916916 * Called when a user wants to change the Maximum Transfer Unit
917− * of a device. If not defined, any request to change MTU will
918− * will return an error.
917+ * of a device.
919918 *
920919 * void (*ndo_tx_timeout)(struct net_device *dev);
921920 * Callback used when the transmitter has not made any progress
@@ -1596,8 +1595,8 @@ enum netdev_priv_flags { · 674 unmodified lines
15961595 * @rtnl_link_state: This enum represents the phases of creating
15971596 * a new link
15981597 *
1599− * @destructor: Called from unregister,
1600− * can be used to call free_netdev
1598+ * @needs_free_netdev: Should unregister perform free_netdev?
1599+ * @priv_destructor: Called from unregister
16011600 * @npinfo: XXX: need comments on this one
16021601 * @nd_net: Network namespace this network device is inside
16031602 *
@@ -1858,7 +1857,8 @@ struct net_device { · 254 unmodified lines
18581857 RTNL_LINK_INITIALIZING,
18591858 } rtnl_link_state:16;
18601859
1861− void (*destructor)(struct net_device *dev);
1860+ bool needs_free_netdev;
1861+ void (*priv_destructor)(struct net_device *dev);
18621862
18631863 #ifdef CONFIG_NETPOLL
18641864 struct netpoll_info __rcu *npinfo;
@@ -4261,6 +4261,11 @@ static inline const char *netdev_name(const struct net_device *dev) · 2396 unmodified lines
42614261 return dev->name;
42624262 }
42634263
4264+static inline bool netdev_unregistering(const struct net_device *dev)
4265+{
4266+ return dev->reg_state == NETREG_UNREGISTERING;
4267+}
4268+
42644269 static inline const char *netdev_reg_state(const struct net_device *dev)
42654270 {
42664271 switch (dev->reg_state) {
include/uapi/linux/ethtool.h+4−2
@@ -1486,8 +1486,10 @@ enum ethtool_link_mode_bit_indices { · 1485 unmodified lines
14861486 * it was forced up into this mode or autonegotiated.
14871487 */
14881488
1489−/* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. */
1490−/* Update drivers/net/phy/phy.c:phy_speed_to_str() when adding new values */
1489+/* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal.
1490+ * Update drivers/net/phy/phy.c:phy_speed_to_str() and
1491+ * drivers/net/bonding/bond_3ad.c:__get_link_speed() when adding new values.
1492+ */
14911493 #define SPEED_10 10
14921494 #define SPEED_100 100
14931495 #define SPEED_1000 1000
include/uapi/linux/openvswitch.h+1−0
@@ -343,6 +343,7 @@ enum ovs_key_attr { · 342 unmodified lines
343343 #define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1)
344344
345345 enum ovs_tunnel_key_attr {
346+ /* OVS_TUNNEL_KEY_ATTR_NONE, standard nl API requires this attribute! */
346347 OVS_TUNNEL_KEY_ATTR_ID, /* be64 Tunnel ID */
347348 OVS_TUNNEL_KEY_ATTR_IPV4_SRC, /* be32 src IP address. */
348349 OVS_TUNNEL_KEY_ATTR_IPV4_DST, /* be32 dst IP address. */
net/8021q/vlan_dev.c+2−2
@@ -813,7 +813,6 @@ static void vlan_dev_free(struct net_device *dev) · 812 unmodified lines
813813
814814 free_percpu(vlan->vlan_pcpu_stats);
815815 vlan->vlan_pcpu_stats = NULL;
816− free_netdev(dev);
817816 }
818817
819818 void vlan_setup(struct net_device *dev)
@@ -826,7 +825,8 @@ void vlan_setup(struct net_device *dev) · 6 unmodified lines
826825 netif_keep_dst(dev);
827826
828827 dev->netdev_ops = &vlan_netdev_ops;
829− dev->destructor = vlan_dev_free;
828+ dev->needs_free_netdev = true;
829+ dev->priv_destructor = vlan_dev_free;
830830 dev->ethtool_ops = &vlan_ethtool_ops;
831831
832832 dev->min_mtu = 0;
net/batman-adv/distributed-arp-table.c+3−2
@@ -1064,8 +1064,9 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv, · 1063 unmodified lines
10641064
10651065 skb_new->protocol = eth_type_trans(skb_new, soft_iface);
10661066
1067− soft_iface->stats.rx_packets++;
1068− soft_iface->stats.rx_bytes += skb->len + ETH_HLEN + hdr_size;
1067+ batadv_inc_counter(bat_priv, BATADV_CNT_RX);
1068+ batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES,
1069+ skb->len + ETH_HLEN + hdr_size);
10691070
10701071 netif_rx(skb_new);
10711072 batadv_dbg(BATADV_DBG_DAT, bat_priv, "ARP request replied locally\n");
net/batman-adv/routing.c+1−1
@@ -987,7 +987,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, · 986 unmodified lines
987987 batadv_dbg(BATADV_DBG_BLA, bat_priv,
988988 "recv_unicast_packet(): Dropped unicast pkt received from another backbone gw %pM.\n",
989989 orig_addr_gw);
990− return NET_RX_DROP;
990+ goto free_skb;
991991 }
992992 }
993993
net/batman-adv/soft-interface.c+2−3
@@ -1034,8 +1034,6 @@ static void batadv_softif_free(struct net_device *dev) · 1033 unmodified lines
10341034 * netdev and its private data (bat_priv)
10351035 */
10361036 rcu_barrier();
1037−
1038− free_netdev(dev);
10391037 }
10401038
10411039 /**
@@ -1047,7 +1045,8 @@ static void batadv_softif_init_early(struct net_device *dev) · 5 unmodified lines
10471045 ether_setup(dev);
10481046
10491047 dev->netdev_ops = &batadv_netdev_ops;
1050− dev->destructor = batadv_softif_free;
1048+ dev->needs_free_netdev = true;
1049+ dev->priv_destructor = batadv_softif_free;
10511050 dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_NETNS_LOCAL;
10521051 dev->priv_flags |= IFF_NO_QUEUE;
10531052
net/bluetooth/6lowpan.c+1−1
@@ -598,7 +598,7 @@ static void netdev_setup(struct net_device *dev) · 597 unmodified lines
598598
599599 dev->netdev_ops = &netdev_ops;
600600 dev->header_ops = &header_ops;
601− dev->destructor = free_netdev;
601+ dev->needs_free_netdev = true;
602602 }
603603
604604 static struct device_type bt_type = {
net/bridge/br_device.c+1−1
@@ -379,7 +379,7 @@ void br_dev_setup(struct net_device *dev) · 378 unmodified lines
379379 ether_setup(dev);
380380
381381 dev->netdev_ops = &br_netdev_ops;
382− dev->destructor = free_netdev;
382+ dev->needs_free_netdev = true;
383383 dev->ethtool_ops = &br_ethtool_ops;
384384 SET_NETDEV_DEVTYPE(dev, &br_type);
385385 dev->priv_flags = IFF_EBRIDGE | IFF_NO_QUEUE;
net/caif/caif_socket.c+4−0
@@ -754,6 +754,10 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr, · 753 unmodified lines
754754
755755 lock_sock(sk);
756756
757+ err = -EINVAL;
758+ if (addr_len < offsetofend(struct sockaddr, sa_family))
759+ goto out;
760+
757761 err = -EAFNOSUPPORT;
758762 if (uaddr->sa_family != AF_CAIF)
759763 goto out;
net/caif/cfpkt_skbuff.c+1−5
@@ -81,11 +81,7 @@ static struct cfpkt *cfpkt_create_pfx(u16 len, u16 pfx) · 80 unmodified lines
8181 {
8282 struct sk_buff *skb;
8383
84− if (likely(in_interrupt()))
85− skb = alloc_skb(len + pfx, GFP_ATOMIC);
86− else
87− skb = alloc_skb(len + pfx, GFP_KERNEL);
88−
84+ skb = alloc_skb(len + pfx, GFP_ATOMIC);
8985 if (unlikely(skb == NULL))
9086 return NULL;
9187
net/caif/chnl_net.c+2−2
@@ -392,14 +392,14 @@ static void chnl_net_destructor(struct net_device *dev) · 391 unmodified lines
392392 {
393393 struct chnl_net *priv = netdev_priv(dev);
394394 caif_free_client(&priv->chnl);
395− free_netdev(dev);
396395 }
397396
398397 static void ipcaif_net_setup(struct net_device *dev)
399398 {
400399 struct chnl_net *priv;
401400 dev->netdev_ops = &netdev_ops;
402− dev->destructor = chnl_net_destructor;
401+ dev->needs_free_netdev = true;
402+ dev->priv_destructor = chnl_net_destructor;
403403 dev->flags |= IFF_NOARP;
404404 dev->flags |= IFF_POINTOPOINT;
405405 dev->mtu = GPRS_PDP_MTU;
net/can/af_can.c+1−2
@@ -872,8 +872,7 @@ static int can_notifier(struct notifier_block *nb, unsigned long msg, · 871 unmodified lines
872872
873873 static int can_pernet_init(struct net *net)
874874 {
875− net->can.can_rcvlists_lock =
876− __SPIN_LOCK_UNLOCKED(net->can.can_rcvlists_lock);
875+ spin_lock_init(&net->can.can_rcvlists_lock);
877876 net->can.can_rx_alldev_list =
878877 kzalloc(sizeof(struct dev_rcv_lists), GFP_KERNEL);
879878
net/core/dev.c+30−12
@@ -1253,8 +1253,9 @@ int dev_set_alias(struct net_device *dev, const char *alias, size_t len) · 1252 unmodified lines
12531253 if (!new_ifalias)
12541254 return -ENOMEM;
12551255 dev->ifalias = new_ifalias;
1256+ memcpy(dev->ifalias, alias, len);
1257+ dev->ifalias[len] = 0;
12561258
1257− strlcpy(dev->ifalias, alias, len+1);
12581259 return len;
12591260 }
12601261
@@ -4948,6 +4949,19 @@ __sum16 __skb_gro_checksum_complete(struct sk_buff *skb) · 3687 unmodified lines
49484949 }
49494950 EXPORT_SYMBOL(__skb_gro_checksum_complete);
49504951
4952+static void net_rps_send_ipi(struct softnet_data *remsd)
4953+{
4954+#ifdef CONFIG_RPS
4955+ while (remsd) {
4956+ struct softnet_data *next = remsd->rps_ipi_next;
4957+
4958+ if (cpu_online(remsd->cpu))
4959+ smp_call_function_single_async(remsd->cpu, &remsd->csd);
4960+ remsd = next;
4961+ }
4962+#endif
4963+}
4964+
49514965 /*
49524966 * net_rps_action_and_irq_enable sends any pending IPI's for rps.
49534967 * Note: called with local irq disabled, but exits with local irq enabled.
@@ -4963,14 +4977,7 @@ static void net_rps_action_and_irq_enable(struct softnet_data *sd) · 9 unmodified lines
49634977 local_irq_enable();
49644978
49654979 /* Send pending IPI's to kick RPS processing on remote cpus. */
4966− while (remsd) {
4967− struct softnet_data *next = remsd->rps_ipi_next;
4968−
4969− if (cpu_online(remsd->cpu))
4970− smp_call_function_single_async(remsd->cpu,
4971− &remsd->csd);
4972− remsd = next;
4973− }
4980+ net_rps_send_ipi(remsd);
49744981 } else
49754982 #endif
49764983 local_irq_enable();
@@ -7501,6 +7508,8 @@ out: · 2524 unmodified lines
75017508 err_uninit:
75027509 if (dev->netdev_ops->ndo_uninit)
75037510 dev->netdev_ops->ndo_uninit(dev);
7511+ if (dev->priv_destructor)
7512+ dev->priv_destructor(dev);
75047513 goto out;
75057514 }
75067515 EXPORT_SYMBOL(register_netdevice);
@@ -7708,8 +7717,10 @@ void netdev_run_todo(void) · 201 unmodified lines
77087717 WARN_ON(rcu_access_pointer(dev->ip6_ptr));
77097718 WARN_ON(dev->dn_ptr);
77107719
7711− if (dev->destructor)
7712− dev->destructor(dev);
7720+ if (dev->priv_destructor)
7721+ dev->priv_destructor(dev);
7722+ if (dev->needs_free_netdev)
7723+ free_netdev(dev);
77137724
77147725 /* Report a network device has been unregistered */
77157726 rtnl_lock();
@@ -8192,7 +8203,7 @@ static int dev_cpu_dead(unsigned int oldcpu) · 476 unmodified lines
81928203 struct sk_buff **list_skb;
81938204 struct sk_buff *skb;
81948205 unsigned int cpu;
8195− struct softnet_data *sd, *oldsd;
8206+ struct softnet_data *sd, *oldsd, *remsd = NULL;
81968207
81978208 local_irq_disable();
81988209 cpu = smp_processor_id();
@@ -8233,6 +8244,13 @@ static int dev_cpu_dead(unsigned int oldcpu) · 34 unmodified lines
82338244 raise_softirq_irqoff(NET_TX_SOFTIRQ);
82348245 local_irq_enable();
82358246
8247+#ifdef CONFIG_RPS
8248+ remsd = oldsd->rps_ipi_list;
8249+ oldsd->rps_ipi_list = NULL;
8250+#endif
8251+ /* send out pending IPI's on offline CPU */
8252+ net_rps_send_ipi(remsd);
8253+
82368254 /* Process offline CPU's input_pkt_queue */
82378255 while ((skb = __skb_dequeue(&oldsd->process_queue))) {
82388256 netif_rx_ni(skb);
net/core/dst.c+14−0
@@ -469,6 +469,20 @@ static int dst_dev_event(struct notifier_block *this, unsigned long event, · 468 unmodified lines
469469 spin_lock_bh(&dst_garbage.lock);
470470 dst = dst_garbage.list;
471471 dst_garbage.list = NULL;
472+ /* The code in dst_ifdown places a hold on the loopback device.
473+ * If the gc entry processing is set to expire after a lengthy
474+ * interval, this hold can cause netdev_wait_allrefs() to hang
475+ * out and wait for a long time -- until the the loopback
476+ * interface is released. If we're really unlucky, it'll emit
477+ * pr_emerg messages to console too. Reset the interval here,
478+ * so dst cleanups occur in a more timely fashion.
479+ */
480+ if (dst_garbage.timer_inc > DST_GC_INC) {
481+ dst_garbage.timer_inc = DST_GC_INC;
482+ dst_garbage.timer_expires = DST_GC_MIN;
483+ mod_delayed_work(system_wq, &dst_gc_work,
484+ dst_garbage.timer_expires);
485+ }
472486 spin_unlock_bh(&dst_garbage.lock);
473487
474488 if (last)
net/core/rtnetlink.c+2−1
@@ -1124,6 +1124,8 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, · 1123 unmodified lines
11241124 struct ifla_vf_mac vf_mac;
11251125 struct ifla_vf_info ivi;
11261126
1127+ memset(&ivi, 0, sizeof(ivi));
1128+
11271129 /* Not all SR-IOV capable drivers support the
11281130 * spoofcheck and "RSS query enable" query. Preset to
11291131 * -1 so the user space tool can detect that the driver
@@ -1132,7 +1134,6 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, · 2 unmodified lines
11321134 ivi.spoofchk = -1;
11331135 ivi.rss_query_en = -1;
11341136 ivi.trusted = -1;
1135− memset(ivi.mac, 0, sizeof(ivi.mac));
11361137 /* The default value for VF link state is "auto"
11371138 * IFLA_VF_LINK_STATE_AUTO which equals zero
11381139 */
net/decnet/netfilter/dn_rtmsg.c+3−1
@@ -102,7 +102,9 @@ static inline void dnrmg_receive_user_skb(struct sk_buff *skb) · 101 unmodified lines
102102 {
103103 struct nlmsghdr *nlh = nlmsg_hdr(skb);
104104
105− if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
105+ if (skb->len < sizeof(*nlh) ||
106+ nlh->nlmsg_len < sizeof(*nlh) ||
107+ skb->len < nlh->nlmsg_len)
106108 return;
107109
108110 if (!netlink_capable(skb, CAP_NET_ADMIN))
net/hsr/hsr_device.c+2−2
@@ -378,7 +378,6 @@ static void hsr_dev_destroy(struct net_device *hsr_dev) · 377 unmodified lines
378378 del_timer_sync(&hsr->announce_timer);
379379
380380 synchronize_rcu();
381− free_netdev(hsr_dev);
382381 }
383382
384383 static const struct net_device_ops hsr_device_ops = {
@@ -404,7 +403,8 @@ void hsr_dev_setup(struct net_device *dev) · 19 unmodified lines
404403 SET_NETDEV_DEVTYPE(dev, &hsr_type);
405404 dev->priv_flags |= IFF_NO_QUEUE;
406405
407− dev->destructor = hsr_dev_destroy;
406+ dev->needs_free_netdev = true;
407+ dev->priv_destructor = hsr_dev_destroy;
408408
409409 dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
410410 NETIF_F_GSO_MASK | NETIF_F_HW_CSUM |
net/hsr/hsr_forward.c+1−2
@@ -324,8 +324,7 @@ static int hsr_fill_frame_info(struct hsr_frame_info *frame, · 323 unmodified lines
324324 unsigned long irqflags;
325325
326326 frame->is_supervision = is_supervision_frame(port->hsr, skb);
327− frame->node_src = hsr_get_node(&port->hsr->node_db, skb,
328− frame->is_supervision);
327+ frame->node_src = hsr_get_node(port, skb, frame->is_supervision);
329328 if (frame->node_src == NULL)
330329 return -1; /* Unknown node and !is_supervision, or no mem */
331330
net/hsr/hsr_framereg.c+7−2
@@ -158,9 +158,10 @@ struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[], · 157 unmodified lines
158158
159159 /* Get the hsr_node from which 'skb' was sent.
160160 */
161−struct hsr_node *hsr_get_node(struct list_head *node_db, struct sk_buff *skb,
161+struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb,
162162 bool is_sup)
163163 {
164+ struct list_head *node_db = &port->hsr->node_db;
164165 struct hsr_node *node;
165166 struct ethhdr *ethhdr;
166167 u16 seq_out;
@@ -186,7 +187,11 @@ struct hsr_node *hsr_get_node(struct list_head *node_db, struct sk_buff *skb, · 19 unmodified lines
186187 */
187188 seq_out = hsr_get_skb_sequence_nr(skb) - 1;
188189 } else {
189− WARN_ONCE(1, "%s: Non-HSR frame\n", __func__);
190+ /* this is called also for frames from master port and
191+ * so warn only for non master ports
192+ */
193+ if (port->type != HSR_PT_MASTER)
194+ WARN_ONCE(1, "%s: Non-HSR frame\n", __func__);
190195 seq_out = HSR_SEQNR_START;
191196 }
192197
net/hsr/hsr_framereg.h+1−1
@@ -18,7 +18,7 @@ struct hsr_node; · 17 unmodified lines
1818
1919 struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[],
2020 u16 seq_out);
21−struct hsr_node *hsr_get_node(struct list_head *node_db, struct sk_buff *skb,
21+struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb,
2222 bool is_sup);
2323 void hsr_handle_sup_frame(struct sk_buff *skb, struct hsr_node *node_curr,
2424 struct hsr_port *port);
net/ieee802154/6lowpan/core.c+1−1
@@ -107,7 +107,7 @@ static void lowpan_setup(struct net_device *ldev) · 106 unmodified lines
107107
108108 ldev->netdev_ops = &lowpan_netdev_ops;
109109 ldev->header_ops = &lowpan_header_ops;
110− ldev->destructor = free_netdev;
110+ ldev->needs_free_netdev = true;
111111 ldev->features |= NETIF_F_NETNS_LOCAL;
112112 }
113113
net/ipv4/icmp.c+6−2
@@ -657,8 +657,12 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) · 656 unmodified lines
657657 /* Needed by both icmp_global_allow and icmp_xmit_lock */
658658 local_bh_disable();
659659
660− /* Check global sysctl_icmp_msgs_per_sec ratelimit */
661− if (!icmpv4_global_allow(net, type, code))
660+ /* Check global sysctl_icmp_msgs_per_sec ratelimit, unless
661+ * incoming dev is loopback. If outgoing dev change to not be
662+ * loopback, then peer ratelimit still work (in icmpv4_xrlim_allow)
663+ */
664+ if (!(skb_in->dev && (skb_in->dev->flags&IFF_LOOPBACK)) &&
665+ !icmpv4_global_allow(net, type, code))
662666 goto out_bh_enable;
663667
664668 sk = icmp_xmit_lock(net);
net/ipv4/igmp.c+13−8
@@ -2071,21 +2071,26 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, · 2070 unmodified lines
20712071
20722072 static void ip_mc_clear_src(struct ip_mc_list *pmc)
20732073 {
2074− struct ip_sf_list *psf, *nextpsf;
2074+ struct ip_sf_list *psf, *nextpsf, *tomb, *sources;
20752075
2076− for (psf = pmc->tomb; psf; psf = nextpsf) {
2076+ spin_lock_bh(&pmc->lock);
2077+ tomb = pmc->tomb;
2078+ pmc->tomb = NULL;
2079+ sources = pmc->sources;
2080+ pmc->sources = NULL;
2081+ pmc->sfmode = MCAST_EXCLUDE;
2082+ pmc->sfcount[MCAST_INCLUDE] = 0;
2083+ pmc->sfcount[MCAST_EXCLUDE] = 1;
2084+ spin_unlock_bh(&pmc->lock);
2085+
2086+ for (psf = tomb; psf; psf = nextpsf) {
20772087 nextpsf = psf->sf_next;
20782088 kfree(psf);
20792089 }
2080− pmc->tomb = NULL;
2081− for (psf = pmc->sources; psf; psf = nextpsf) {
2090+ for (psf = sources; psf; psf = nextpsf) {
20822091 nextpsf = psf->sf_next;
20832092 kfree(psf);
20842093 }
2085− pmc->sources = NULL;
2086− pmc->sfmode = MCAST_EXCLUDE;
2087− pmc->sfcount[MCAST_INCLUDE] = 0;
2088− pmc->sfcount[MCAST_EXCLUDE] = 1;
20892094 }
20902095
20912096 /* Join a multicast group
net/ipv4/ip_tunnel.c+2−2
@@ -967,7 +967,6 @@ static void ip_tunnel_dev_free(struct net_device *dev) · 966 unmodified lines
967967 gro_cells_destroy(&tunnel->gro_cells);
968968 dst_cache_destroy(&tunnel->dst_cache);
969969 free_percpu(dev->tstats);
970− free_netdev(dev);
971970 }
972971
973972 void ip_tunnel_dellink(struct net_device *dev, struct list_head *head)
@@ -1155,7 +1154,8 @@ int ip_tunnel_init(struct net_device *dev) · 181 unmodified lines
11551154 struct iphdr *iph = &tunnel->parms.iph;
11561155 int err;
11571156
1158− dev->destructor = ip_tunnel_dev_free;
1157+ dev->needs_free_netdev = true;
1158+ dev->priv_destructor = ip_tunnel_dev_free;
11591159 dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
11601160 if (!dev->tstats)
11611161 return -ENOMEM;
net/ipv4/ipmr.c+16−18
@@ -101,8 +101,8 @@ static struct mr_table *ipmr_new_table(struct net *net, u32 id); · 100 unmodified lines
101101 static void ipmr_free_table(struct mr_table *mrt);
102102
103103 static void ip_mr_forward(struct net *net, struct mr_table *mrt,
104− struct sk_buff *skb, struct mfc_cache *cache,
105− int local);
104+ struct net_device *dev, struct sk_buff *skb,
105+ struct mfc_cache *cache, int local);
106106 static int ipmr_cache_report(struct mr_table *mrt,
107107 struct sk_buff *pkt, vifi_t vifi, int assert);
108108 static int __ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb,
@@ -501,7 +501,7 @@ static void reg_vif_setup(struct net_device *dev) · 392 unmodified lines
501501 dev->mtu = ETH_DATA_LEN - sizeof(struct iphdr) - 8;
502502 dev->flags = IFF_NOARP;
503503 dev->netdev_ops = &reg_vif_netdev_ops;
504− dev->destructor = free_netdev;
504+ dev->needs_free_netdev = true;
505505 dev->features |= NETIF_F_NETNS_LOCAL;
506506 }
507507
@@ -988,7 +988,7 @@ static void ipmr_cache_resolve(struct net *net, struct mr_table *mrt, · 480 unmodified lines
988988
989989 rtnl_unicast(skb, net, NETLINK_CB(skb).portid);
990990 } else {
991− ip_mr_forward(net, mrt, skb, c, 0);
991+ ip_mr_forward(net, mrt, skb->dev, skb, c, 0);
992992 }
993993 }
994994 }
@@ -1073,7 +1073,7 @@ static int ipmr_cache_report(struct mr_table *mrt, · 78 unmodified lines
10731073
10741074 /* Queue a packet for resolution. It gets locked cache entry! */
10751075 static int ipmr_cache_unresolved(struct mr_table *mrt, vifi_t vifi,
1076− struct sk_buff *skb)
1076+ struct sk_buff *skb, struct net_device *dev)
10771077 {
10781078 const struct iphdr *iph = ip_hdr(skb);
10791079 struct mfc_cache *c;
@@ -1130,6 +1130,10 @@ static int ipmr_cache_unresolved(struct mr_table *mrt, vifi_t vifi, · 50 unmodified lines
11301130 kfree_skb(skb);
11311131 err = -ENOBUFS;
11321132 } else {
1133+ if (dev) {
1134+ skb->dev = dev;
1135+ skb->skb_iif = dev->ifindex;
1136+ }
11331137 skb_queue_tail(&c->mfc_un.unres.unresolved, skb);
11341138 err = 0;
11351139 }
@@ -1828,10 +1832,10 @@ static int ipmr_find_vif(struct mr_table *mrt, struct net_device *dev) · 692 unmodified lines
18281832
18291833 /* "local" means that we should preserve one skb (for local delivery) */
18301834 static void ip_mr_forward(struct net *net, struct mr_table *mrt,
1831− struct sk_buff *skb, struct mfc_cache *cache,
1832− int local)
1835+ struct net_device *dev, struct sk_buff *skb,
1836+ struct mfc_cache *cache, int local)
18331837 {
1834− int true_vifi = ipmr_find_vif(mrt, skb->dev);
1838+ int true_vifi = ipmr_find_vif(mrt, dev);
18351839 int psend = -1;
18361840 int vif, ct;
18371841
@@ -1853,13 +1857,7 @@ static void ip_mr_forward(struct net *net, struct mr_table *mrt, · 15 unmodified lines
18531857 }
18541858
18551859 /* Wrong interface: drop packet and (maybe) send PIM assert. */
1856− if (mrt->vif_table[vif].dev != skb->dev) {
1857− struct net_device *mdev;
1858−
1859− mdev = l3mdev_master_dev_rcu(mrt->vif_table[vif].dev);
1860− if (mdev == skb->dev)
1861− goto forward;
1862−
1860+ if (mrt->vif_table[vif].dev != dev) {
18631861 if (rt_is_output_route(skb_rtable(skb))) {
18641862 /* It is our own packet, looped back.
18651863 * Very complicated situation...
@@ -2053,7 +2051,7 @@ int ip_mr_input(struct sk_buff *skb) · 187 unmodified lines
20532051 read_lock(&mrt_lock);
20542052 vif = ipmr_find_vif(mrt, dev);
20552053 if (vif >= 0) {
2056− int err2 = ipmr_cache_unresolved(mrt, vif, skb);
2054+ int err2 = ipmr_cache_unresolved(mrt, vif, skb, dev);
20572055 read_unlock(&mrt_lock);
20582056
20592057 return err2;
@@ -2064,7 +2062,7 @@ int ip_mr_input(struct sk_buff *skb) · 4 unmodified lines
20642062 }
20652063
20662064 read_lock(&mrt_lock);
2067− ip_mr_forward(net, mrt, skb, cache, local);
2065+ ip_mr_forward(net, mrt, dev, skb, cache, local);
20682066 read_unlock(&mrt_lock);
20692067
20702068 if (local)
@@ -2238,7 +2236,7 @@ int ipmr_get_route(struct net *net, struct sk_buff *skb, · 167 unmodified lines
22382236 iph->saddr = saddr;
22392237 iph->daddr = daddr;
22402238 iph->version = 0;
2241− err = ipmr_cache_unresolved(mrt, vif, skb2);
2239+ err = ipmr_cache_unresolved(mrt, vif, skb2, dev);
22422240 read_unlock(&mrt_lock);
22432241 rcu_read_unlock();
22442242 return err;
net/ipv6/icmp.c+1−1
@@ -491,7 +491,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, · 490 unmodified lines
491491 local_bh_disable();
492492
493493 /* Check global sysctl_icmp_msgs_per_sec ratelimit */
494− if (!icmpv6_global_allow(type))
494+ if (!(skb->dev->flags&IFF_LOOPBACK) && !icmpv6_global_allow(type))
495495 goto out_bh_enable;
496496
497497 mip6_addr_swap(skb);
net/ipv6/ila/ila_xlat.c+1−0
@@ -62,6 +62,7 @@ static inline u32 ila_locator_hash(struct ila_locator loc) · 61 unmodified lines
6262 {
6363 u32 *v = (u32 *)loc.v32;
6464
65+ __ila_hash_secret_init();
6566 return jhash_2words(v[0], v[1], hashrnd);
6667 }
6768
net/ipv6/ip6_gre.c+5−4
@@ -991,13 +991,13 @@ static void ip6gre_dev_free(struct net_device *dev) · 990 unmodified lines
991991
992992 dst_cache_destroy(&t->dst_cache);
993993 free_percpu(dev->tstats);
994− free_netdev(dev);
995994 }
996995
997996 static void ip6gre_tunnel_setup(struct net_device *dev)
998997 {
999998 dev->netdev_ops = &ip6gre_netdev_ops;
1000− dev->destructor = ip6gre_dev_free;
999+ dev->needs_free_netdev = true;
1000+ dev->priv_destructor = ip6gre_dev_free;
10011001
10021002 dev->type = ARPHRD_IP6GRE;
10031003
@@ -1148,7 +1148,7 @@ static int __net_init ip6gre_init_net(struct net *net) · 144 unmodified lines
11481148 return 0;
11491149
11501150 err_reg_dev:
1151− ip6gre_dev_free(ign->fb_tunnel_dev);
1151+ free_netdev(ign->fb_tunnel_dev);
11521152 err_alloc_dev:
11531153 return err;
11541154 }
@@ -1300,7 +1300,8 @@ static void ip6gre_tap_setup(struct net_device *dev) · 145 unmodified lines
13001300 ether_setup(dev);
13011301
13021302 dev->netdev_ops = &ip6gre_tap_netdev_ops;
1303− dev->destructor = ip6gre_dev_free;
1303+ dev->needs_free_netdev = true;
1304+ dev->priv_destructor = ip6gre_dev_free;
13041305
13051306 dev->features |= NETIF_F_NETNS_LOCAL;
13061307 dev->priv_flags &= ~IFF_TX_SKB_SHARING;
net/ipv6/ip6_tunnel.c+4−4
@@ -254,7 +254,6 @@ static void ip6_dev_free(struct net_device *dev) · 253 unmodified lines
254254 gro_cells_destroy(&t->gro_cells);
255255 dst_cache_destroy(&t->dst_cache);
256256 free_percpu(dev->tstats);
257− free_netdev(dev);
258257 }
259258
260259 static int ip6_tnl_create2(struct net_device *dev)
@@ -322,7 +321,7 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct __ip6_tnl_parm *p) · 61 unmodified lines
322321 return t;
323322
324323 failed_free:
325− ip6_dev_free(dev);
324+ free_netdev(dev);
326325 failed:
327326 return ERR_PTR(err);
328327 }
@@ -1777,7 +1776,8 @@ static const struct net_device_ops ip6_tnl_netdev_ops = { · 1448 unmodified lines
17771776 static void ip6_tnl_dev_setup(struct net_device *dev)
17781777 {
17791778 dev->netdev_ops = &ip6_tnl_netdev_ops;
1780− dev->destructor = ip6_dev_free;
1779+ dev->needs_free_netdev = true;
1780+ dev->priv_destructor = ip6_dev_free;
17811781
17821782 dev->type = ARPHRD_TUNNEL6;
17831783 dev->flags |= IFF_NOARP;
@@ -2224,7 +2224,7 @@ static int __net_init ip6_tnl_init_net(struct net *net) · 440 unmodified lines
22242224 return 0;
22252225
22262226 err_register:
2227− ip6_dev_free(ip6n->fb_tnl_dev);
2227+ free_netdev(ip6n->fb_tnl_dev);
22282228 err_alloc_dev:
22292229 return err;
22302230 }
net/ipv6/ip6_vti.c+4−4
@@ -180,7 +180,6 @@ vti6_tnl_unlink(struct vti6_net *ip6n, struct ip6_tnl *t) · 179 unmodified lines
180180 static void vti6_dev_free(struct net_device *dev)
181181 {
182182 free_percpu(dev->tstats);
183− free_netdev(dev);
184183 }
185184
186185 static int vti6_tnl_create2(struct net_device *dev)
@@ -235,7 +234,7 @@ static struct ip6_tnl *vti6_tnl_create(struct net *net, struct __ip6_tnl_parm *p · 48 unmodified lines
235234 return t;
236235
237236 failed_free:
238− vti6_dev_free(dev);
237+ free_netdev(dev);
239238 failed:
240239 return NULL;
241240 }
@@ -842,7 +841,8 @@ static const struct net_device_ops vti6_netdev_ops = { · 600 unmodified lines
842841 static void vti6_dev_setup(struct net_device *dev)
843842 {
844843 dev->netdev_ops = &vti6_netdev_ops;
845− dev->destructor = vti6_dev_free;
844+ dev->needs_free_netdev = true;
845+ dev->priv_destructor = vti6_dev_free;
846846
847847 dev->type = ARPHRD_TUNNEL6;
848848 dev->hard_header_len = LL_MAX_HEADER + sizeof(struct ipv6hdr);
@@ -1100,7 +1100,7 @@ static int __net_init vti6_init_net(struct net *net) · 251 unmodified lines
11001100 return 0;
11011101
11021102 err_register:
1103− vti6_dev_free(ip6n->fb_tnl_dev);
1103+ free_netdev(ip6n->fb_tnl_dev);
11041104 err_alloc_dev:
11051105 return err;
11061106 }
net/ipv6/ip6mr.c+1−1
@@ -733,7 +733,7 @@ static void reg_vif_setup(struct net_device *dev) · 732 unmodified lines
733733 dev->mtu = 1500 - sizeof(struct ipv6hdr) - 8;
734734 dev->flags = IFF_NOARP;
735735 dev->netdev_ops = &reg_vif_netdev_ops;
736− dev->destructor = free_netdev;
736+ dev->needs_free_netdev = true;
737737 dev->features |= NETIF_F_NETNS_LOCAL;
738738 }
739739
net/ipv6/proc.c+1−1
@@ -219,7 +219,7 @@ static void snmp6_seq_show_item64(struct seq_file *seq, void __percpu *mib, · 218 unmodified lines
219219 u64 buff64[SNMP_MIB_MAX];
220220 int i;
221221
222− memset(buff64, 0, sizeof(unsigned long) * SNMP_MIB_MAX);
222+ memset(buff64, 0, sizeof(u64) * SNMP_MIB_MAX);
223223
224224 snmp_get_cpu_field64_batch(buff64, itemlist, mib, syncpoff);
225225 for (i = 0; itemlist[i].name; i++)
net/ipv6/route.c+1−0
@@ -2804,6 +2804,7 @@ static int fib6_ifdown(struct rt6_info *rt, void *arg) · 2803 unmodified lines
28042804 if ((rt->dst.dev == dev || !dev) &&
28052805 rt != adn->net->ipv6.ip6_null_entry &&
28062806 (rt->rt6i_nsiblings == 0 ||
2807+ (dev && netdev_unregistering(dev)) ||
28072808 !rt->rt6i_idev->cnf.ignore_routes_with_linkdown))
28082809 return -1;
28092810
net/ipv6/sit.c+3−3
@@ -265,7 +265,7 @@ static struct ip_tunnel *ipip6_tunnel_locate(struct net *net, · 264 unmodified lines
265265 return nt;
266266
267267 failed_free:
268− ipip6_dev_free(dev);
268+ free_netdev(dev);
269269 failed:
270270 return NULL;
271271 }
@@ -1336,7 +1336,6 @@ static void ipip6_dev_free(struct net_device *dev) · 1064 unmodified lines
13361336
13371337 dst_cache_destroy(&tunnel->dst_cache);
13381338 free_percpu(dev->tstats);
1339− free_netdev(dev);
13401339 }
13411340
13421341 #define SIT_FEATURES (NETIF_F_SG | \
@@ -1351,7 +1350,8 @@ static void ipip6_tunnel_setup(struct net_device *dev) · 8 unmodified lines
13511350 int t_hlen = tunnel->hlen + sizeof(struct iphdr);
13521351
13531352 dev->netdev_ops = &ipip6_netdev_ops;
1354− dev->destructor = ipip6_dev_free;
1353+ dev->needs_free_netdev = true;
1354+ dev->priv_destructor = ipip6_dev_free;
13551355
13561356 dev->type = ARPHRD_SIT;
13571357 dev->hard_header_len = LL_MAX_HEADER + t_hlen;
net/irda/irlan/irlan_eth.c+1−1
@@ -65,7 +65,7 @@ static void irlan_eth_setup(struct net_device *dev) · 64 unmodified lines
6565 ether_setup(dev);
6666
6767 dev->netdev_ops = &irlan_eth_netdev_ops;
68− dev->destructor = free_netdev;
68+ dev->needs_free_netdev = true;
6969 dev->min_mtu = 0;
7070 dev->max_mtu = ETH_MAX_MTU;
7171
net/l2tp/l2tp_eth.c+8−7
@@ -114,12 +114,13 @@ static void l2tp_eth_get_stats64(struct net_device *dev, · 113 unmodified lines
114114 {
115115 struct l2tp_eth *priv = netdev_priv(dev);
116116
117− stats->tx_bytes = atomic_long_read(&priv->tx_bytes);
118− stats->tx_packets = atomic_long_read(&priv->tx_packets);
119− stats->tx_dropped = atomic_long_read(&priv->tx_dropped);
120− stats->rx_bytes = atomic_long_read(&priv->rx_bytes);
121− stats->rx_packets = atomic_long_read(&priv->rx_packets);
122− stats->rx_errors = atomic_long_read(&priv->rx_errors);
117+ stats->tx_bytes = (unsigned long) atomic_long_read(&priv->tx_bytes);
118+ stats->tx_packets = (unsigned long) atomic_long_read(&priv->tx_packets);
119+ stats->tx_dropped = (unsigned long) atomic_long_read(&priv->tx_dropped);
120+ stats->rx_bytes = (unsigned long) atomic_long_read(&priv->rx_bytes);
121+ stats->rx_packets = (unsigned long) atomic_long_read(&priv->rx_packets);
122+ stats->rx_errors = (unsigned long) atomic_long_read(&priv->rx_errors);
123+
123124 }
124125
125126 static const struct net_device_ops l2tp_eth_netdev_ops = {
@@ -141,7 +142,7 @@ static void l2tp_eth_dev_setup(struct net_device *dev) · 15 unmodified lines
141142 dev->priv_flags &= ~IFF_TX_SKB_SHARING;
142143 dev->features |= NETIF_F_LLTX;
143144 dev->netdev_ops = &l2tp_eth_netdev_ops;
144− dev->destructor = free_netdev;
145+ dev->needs_free_netdev = true;
145146 }
146147
147148 static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb, int data_len)
net/mac80211/cfg.c+2−0
@@ -902,6 +902,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, · 901 unmodified lines
902902 default:
903903 return -EINVAL;
904904 }
905+ sdata->u.ap.req_smps = sdata->smps_mode;
906+
905907 sdata->needed_rx_chains = sdata->local->rx_chains;
906908
907909 sdata->vif.bss_conf.beacon_int = params->beacon_interval;
net/mac80211/ieee80211_i.h+1−1
@@ -1531,7 +1531,7 @@ ieee80211_have_rx_timestamp(struct ieee80211_rx_status *status) · 1530 unmodified lines
15311531 return true;
15321532 /* can't handle non-legacy preamble yet */
15331533 if (status->flag & RX_FLAG_MACTIME_PLCP_START &&
1534− status->encoding != RX_ENC_LEGACY)
1534+ status->encoding == RX_ENC_LEGACY)
15351535 return true;
15361536 return false;
15371537 }
net/mac80211/iface.c+4−3
@@ -1213,7 +1213,6 @@ static const struct net_device_ops ieee80211_monitorif_ops = { · 1212 unmodified lines
12131213 static void ieee80211_if_free(struct net_device *dev)
12141214 {
12151215 free_percpu(dev->tstats);
1216− free_netdev(dev);
12171216 }
12181217
12191218 static void ieee80211_if_setup(struct net_device *dev)
@@ -1221,7 +1220,8 @@ static void ieee80211_if_setup(struct net_device *dev) · 1 unmodified line
12211220 ether_setup(dev);
12221221 dev->priv_flags &= ~IFF_TX_SKB_SHARING;
12231222 dev->netdev_ops = &ieee80211_dataif_ops;
1224− dev->destructor = ieee80211_if_free;
1223+ dev->needs_free_netdev = true;
1224+ dev->priv_destructor = ieee80211_if_free;
12251225 }
12261226
12271227 static void ieee80211_if_setup_no_queue(struct net_device *dev)
@@ -1816,6 +1816,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, · 588 unmodified lines
18161816 ret = dev_alloc_name(ndev, ndev->name);
18171817 if (ret < 0) {
18181818 ieee80211_if_free(ndev);
1819+ free_netdev(ndev);
18191820 return ret;
18201821 }
18211822
@@ -1905,7 +1906,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, · 83 unmodified lines
19051906
19061907 ret = register_netdevice(ndev);
19071908 if (ret) {
1908− ieee80211_if_free(ndev);
1909+ free_netdev(ndev);
19091910 return ret;
19101911 }
19111912 }
net/mac80211/mlme.c+31−31
@@ -601,7 +601,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 600 unmodified lines
601601 struct ieee80211_supported_band *sband;
602602 struct ieee80211_chanctx_conf *chanctx_conf;
603603 struct ieee80211_channel *chan;
604− u32 rate_flags, rates = 0;
604+ u32 rates = 0;
605605
606606 sdata_assert_lock(sdata);
607607
@@ -612,7 +612,6 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 4 unmodified lines
612612 return;
613613 }
614614 chan = chanctx_conf->def.chan;
615− rate_flags = ieee80211_chandef_rate_flags(&chanctx_conf->def);
616615 rcu_read_unlock();
617616 sband = local->hw.wiphy->bands[chan->band];
618617 shift = ieee80211_vif_get_shift(&sdata->vif);
@@ -636,9 +635,6 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 17 unmodified lines
636635 */
637636 rates_len = 0;
638637 for (i = 0; i < sband->n_bitrates; i++) {
639− if ((rate_flags & sband->bitrates[i].flags)
640− != rate_flags)
641− continue;
642638 rates |= BIT(i);
643639 rates_len++;
644640 }
@@ -2818,7 +2814,7 @@ static void ieee80211_get_rates(struct ieee80211_supported_band *sband, · 2173 unmodified lines
28182814 u32 *rates, u32 *basic_rates,
28192815 bool *have_higher_than_11mbit,
28202816 int *min_rate, int *min_rate_index,
2821− int shift, u32 rate_flags)
2817+ int shift)
28222818 {
28232819 int i, j;
28242820
@@ -2846,8 +2842,6 @@ static void ieee80211_get_rates(struct ieee80211_supported_band *sband, · 21 unmodified lines
28462842 int brate;
28472843
28482844 br = &sband->bitrates[j];
2849− if ((rate_flags & br->flags) != rate_flags)
2850− continue;
28512845
28522846 brate = DIV_ROUND_UP(br->bitrate, (1 << shift) * 5);
28532847 if (brate == rate) {
@@ -4398,40 +4392,32 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, · 1544 unmodified lines
43984392 return -ENOMEM;
43994393 }
44004394
4401− if (new_sta || override) {
4402− err = ieee80211_prep_channel(sdata, cbss);
4403− if (err) {
4404− if (new_sta)
4405− sta_info_free(local, new_sta);
4406− return -EINVAL;
4407− }
4408− }
4409−
4395+ /*
4396+ * Set up the information for the new channel before setting the
4397+ * new channel. We can't - completely race-free - change the basic
4398+ * rates bitmap and the channel (sband) that it refers to, but if
4399+ * we set it up before we at least avoid calling into the driver's
4400+ * bss_info_changed() method with invalid information (since we do
4401+ * call that from changing the channel - only for IDLE and perhaps
4402+ * some others, but ...).
4403+ *
4404+ * So to avoid that, just set up all the new information before the
4405+ * channel, but tell the driver to apply it only afterwards, since
4406+ * it might need the new channel for that.
4407+ */
44104408 if (new_sta) {
44114409 u32 rates = 0, basic_rates = 0;
44124410 bool have_higher_than_11mbit;
44134411 int min_rate = INT_MAX, min_rate_index = -1;
4414− struct ieee80211_chanctx_conf *chanctx_conf;
44154412 const struct cfg80211_bss_ies *ies;
44164413 int shift = ieee80211_vif_get_shift(&sdata->vif);
4417− u32 rate_flags;
4418−
4419− rcu_read_lock();
4420− chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
4421− if (WARN_ON(!chanctx_conf)) {
4422− rcu_read_unlock();
4423− sta_info_free(local, new_sta);
4424− return -EINVAL;
4425− }
4426− rate_flags = ieee80211_chandef_rate_flags(&chanctx_conf->def);
4427− rcu_read_unlock();
44284414
44294415 ieee80211_get_rates(sband, bss->supp_rates,
44304416 bss->supp_rates_len,
44314417 &rates, &basic_rates,
44324418 &have_higher_than_11mbit,
44334419 &min_rate, &min_rate_index,
4434− shift, rate_flags);
4420+ shift);
44354421
44364422 /*
44374423 * This used to be a workaround for basic rates missing
@@ -4489,8 +4475,22 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, · 51 unmodified lines
44894475 sdata->vif.bss_conf.sync_dtim_count = 0;
44904476 }
44914477 rcu_read_unlock();
4478+ }
44924479
4493− /* tell driver about BSSID, basic rates and timing */
4480+ if (new_sta || override) {
4481+ err = ieee80211_prep_channel(sdata, cbss);
4482+ if (err) {
4483+ if (new_sta)
4484+ sta_info_free(local, new_sta);
4485+ return -EINVAL;
4486+ }
4487+ }
4488+
4489+ if (new_sta) {
4490+ /*
4491+ * tell driver about BSSID, basic rates and timing
4492+ * this was set up above, before setting the channel
4493+ */
44944494 ieee80211_bss_info_change_notify(sdata,
44954495 BSS_CHANGED_BSSID | BSS_CHANGED_BASIC_RATES |
44964496 BSS_CHANGED_BEACON_INT);
net/mac80211/rx.c+5−1
@@ -1613,12 +1613,16 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) · 1612 unmodified lines
16131613 */
16141614 if (!ieee80211_hw_check(&sta->local->hw, AP_LINK_PS) &&
16151615 !ieee80211_has_morefrags(hdr->frame_control) &&
1616+ !ieee80211_is_back_req(hdr->frame_control) &&
16161617 !(status->rx_flags & IEEE80211_RX_DEFERRED_RELEASE) &&
16171618 (rx->sdata->vif.type == NL80211_IFTYPE_AP ||
16181619 rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN) &&
1619− /* PM bit is only checked in frames where it isn't reserved,
1620+ /*
1621+ * PM bit is only checked in frames where it isn't reserved,
16201622 * in AP mode it's reserved in non-bufferable management frames
16211623 * (cf. IEEE 802.11-2012 8.2.4.1.7 Power Management field)
1624+ * BAR frames should be ignored as specified in
1625+ * IEEE 802.11-2012 10.2.1.2.
16221626 */
16231627 (!ieee80211_is_mgmt(hdr->frame_control) ||
16241628 ieee80211_is_bufferable_mmpdu(hdr->frame_control))) {
net/mac80211/wpa.c+5−4
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <asm/unaligned.h>
1818 #include <net/mac80211.h>
1919 #include <crypto/aes.h>
20+#include <crypto/algapi.h>
2021
2122 #include "ieee80211_i.h"
2223 #include "michael.h"
@@ -153,7 +154,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx) · 130 unmodified lines
153154 data_len = skb->len - hdrlen - MICHAEL_MIC_LEN;
154155 key = &rx->key->conf.key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY];
155156 michael_mic(key, hdr, data, data_len, mic);
156− if (memcmp(mic, data + data_len, MICHAEL_MIC_LEN) != 0)
157+ if (crypto_memneq(mic, data + data_len, MICHAEL_MIC_LEN))
157158 goto mic_fail;
158159
159160 /* remove Michael MIC from payload */
@@ -1048,7 +1049,7 @@ ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx) · 888 unmodified lines
10481049 bip_aad(skb, aad);
10491050 ieee80211_aes_cmac(key->u.aes_cmac.tfm, aad,
10501051 skb->data + 24, skb->len - 24, mic);
1051− if (memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
1052+ if (crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) {
10521053 key->u.aes_cmac.icverrors++;
10531054 return RX_DROP_UNUSABLE;
10541055 }
@@ -1098,7 +1099,7 @@ ieee80211_crypto_aes_cmac_256_decrypt(struct ieee80211_rx_data *rx) · 43 unmodified lines
10981099 bip_aad(skb, aad);
10991100 ieee80211_aes_cmac_256(key->u.aes_cmac.tfm, aad,
11001101 skb->data + 24, skb->len - 24, mic);
1101− if (memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
1102+ if (crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) {
11021103 key->u.aes_cmac.icverrors++;
11031104 return RX_DROP_UNUSABLE;
11041105 }
@@ -1202,7 +1203,7 @@ ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx) · 97 unmodified lines
12021203 if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce,
12031204 skb->data + 24, skb->len - 24,
12041205 mic) < 0 ||
1205− memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
1206+ crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) {
12061207 key->u.aes_gmac.icverrors++;
12071208 return RX_DROP_UNUSABLE;
12081209 }
net/mac802154/iface.c+3−4
@@ -526,8 +526,6 @@ static void mac802154_wpan_free(struct net_device *dev) · 525 unmodified lines
526526 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
527527
528528 mac802154_llsec_destroy(&sdata->sec);
529−
530− free_netdev(dev);
531529 }
532530
533531 static void ieee802154_if_setup(struct net_device *dev)
@@ -593,7 +591,8 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, · 59 unmodified lines
593591 sdata->dev->dev_addr);
594592
595593 sdata->dev->header_ops = &mac802154_header_ops;
596− sdata->dev->destructor = mac802154_wpan_free;
594+ sdata->dev->needs_free_netdev = true;
595+ sdata->dev->priv_destructor = mac802154_wpan_free;
597596 sdata->dev->netdev_ops = &mac802154_wpan_ops;
598597 sdata->dev->ml_priv = &mac802154_mlme_wpan;
599598 wpan_dev->promiscuous_mode = false;
@@ -608,7 +607,7 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, · 8 unmodified lines
608607
609608 break;
610609 case NL802154_IFTYPE_MONITOR:
611− sdata->dev->destructor = free_netdev;
610+ sdata->dev->needs_free_netdev = true;
612611 sdata->dev->netdev_ops = &mac802154_monitor_ops;
613612 wpan_dev->promiscuous_mode = true;
614613 break;
net/openvswitch/vport-internal_dev.c+2−2
@@ -94,7 +94,6 @@ static void internal_dev_destructor(struct net_device *dev) · 93 unmodified lines
9494 struct vport *vport = ovs_internal_dev_get_vport(dev);
9595
9696 ovs_vport_free(vport);
97− free_netdev(dev);
9897 }
9998
10099 static void
@@ -156,7 +155,8 @@ static void do_setup(struct net_device *netdev) · 55 unmodified lines
156155 netdev->priv_flags &= ~IFF_TX_SKB_SHARING;
157156 netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_OPENVSWITCH |
158157 IFF_PHONY_HEADROOM | IFF_NO_QUEUE;
159− netdev->destructor = internal_dev_destructor;
158+ netdev->needs_free_netdev = true;
159+ netdev->priv_destructor = internal_dev_destructor;
160160 netdev->ethtool_ops = &internal_dev_ethtool_ops;
161161 netdev->rtnl_link_ops = &internal_dev_link_ops;
162162
net/phonet/pep-gprs.c+1−1
@@ -236,7 +236,7 @@ static void gprs_setup(struct net_device *dev) · 235 unmodified lines
236236 dev->tx_queue_len = 10;
237237
238238 dev->netdev_ops = &gprs_netdev_ops;
239− dev->destructor = free_netdev;
239+ dev->needs_free_netdev = true;
240240 }
241241
242242 /*
net/sched/act_pedit.c+3−1
@@ -94,8 +94,10 @@ static struct tcf_pedit_key_ex *tcf_pedit_keys_ex_parse(struct nlattr *nla, · 93 unmodified lines
9494 k++;
9595 }
9696
97− if (n)
97+ if (n) {
98+ err = -EINVAL;
9899 goto err_out;
100+ }
99101
100102 return keys_ex;
101103
net/sched/act_police.c+3−5
@@ -132,21 +132,21 @@ static int tcf_act_police_init(struct net *net, struct nlattr *nla, · 131 unmodified lines
132132 }
133133 }
134134
135− spin_lock_bh(&police->tcf_lock);
136135 if (est) {
137136 err = gen_replace_estimator(&police->tcf_bstats, NULL,
138137 &police->tcf_rate_est,
139138 &police->tcf_lock,
140139 NULL, est);
141140 if (err)
142− goto failure_unlock;
141+ goto failure;
143142 } else if (tb[TCA_POLICE_AVRATE] &&
144143 (ret == ACT_P_CREATED ||
145144 !gen_estimator_active(&police->tcf_rate_est))) {
146145 err = -EINVAL;
147− goto failure_unlock;
146+ goto failure;
148147 }
149148
149+ spin_lock_bh(&police->tcf_lock);
150150 /* No failure allowed after this point */
151151 police->tcfp_mtu = parm->mtu;
152152 if (police->tcfp_mtu == 0) {
@@ -192,8 +192,6 @@ static int tcf_act_police_init(struct net *net, struct nlattr *nla, · 39 unmodified lines
192192
193193 return ret;
194194
195−failure_unlock:
196− spin_unlock_bh(&police->tcf_lock);
197195 failure:
198196 qdisc_put_rtab(P_tab);
199197 qdisc_put_rtab(R_tab);
net/sctp/socket.c+2−2
@@ -4622,13 +4622,13 @@ int sctp_for_each_endpoint(int (*cb)(struct sctp_endpoint *, void *), · 4621 unmodified lines
46224622
46234623 for (head = sctp_ep_hashtable; hash < sctp_ep_hashsize;
46244624 hash++, head++) {
4625− read_lock(&head->lock);
4625+ read_lock_bh(&head->lock);
46264626 sctp_for_each_hentry(epb, &head->chain) {
46274627 err = cb(sctp_ep(epb), p);
46284628 if (err)
46294629 break;
46304630 }
4631− read_unlock(&head->lock);
4631+ read_unlock_bh(&head->lock);
46324632 }
46334633
46344634 return err;
net/tipc/msg.c+1−1
@@ -508,7 +508,7 @@ bool tipc_msg_reverse(u32 own_node, struct sk_buff **skb, int err) · 507 unmodified lines
508508 }
509509
510510 if (skb_cloned(_skb) &&
511− pskb_expand_head(_skb, BUF_HEADROOM, BUF_TAILROOM, GFP_KERNEL))
511+ pskb_expand_head(_skb, BUF_HEADROOM, BUF_TAILROOM, GFP_ATOMIC))
512512 goto exit;
513513
514514 /* Now reverse the concerned fields */
net/unix/af_unix.c+6−1
@@ -999,7 +999,8 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) · 998 unmodified lines
999999 struct path path = { };
10001000
10011001 err = -EINVAL;
1002− if (sunaddr->sun_family != AF_UNIX)
1002+ if (addr_len < offsetofend(struct sockaddr_un, sun_family) ||
1003+ sunaddr->sun_family != AF_UNIX)
10031004 goto out;
10041005
10051006 if (addr_len == sizeof(short)) {
@@ -1110,6 +1111,10 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr, · 104 unmodified lines
11101111 unsigned int hash;
11111112 int err;
11121113
1114+ err = -EINVAL;
1115+ if (alen < offsetofend(struct sockaddr, sa_family))
1116+ goto out;
1117+
11131118 if (addr->sa_family != AF_UNSPEC) {
11141119 err = unix_mkname(sunaddr, alen, &hash);
11151120 if (err < 0)
tools/testing/selftests/bpf/bpf_endian.h+30−11
@@ -1,23 +1,42 @@
11 #ifndef __BPF_ENDIAN__
22 #define __BPF_ENDIAN__
33
4−#include <asm/byteorder.h>
4+#include <linux/swab.h>
55
6−#if __BYTE_ORDER == __LITTLE_ENDIAN
7−# define __bpf_ntohs(x) __builtin_bswap16(x)
8−# define __bpf_htons(x) __builtin_bswap16(x)
9−#elif __BYTE_ORDER == __BIG_ENDIAN
10−# define __bpf_ntohs(x) (x)
11−# define __bpf_htons(x) (x)
6+/* LLVM's BPF target selects the endianness of the CPU
7+ * it compiles on, or the user specifies (bpfel/bpfeb),
8+ * respectively. The used __BYTE_ORDER__ is defined by
9+ * the compiler, we cannot rely on __BYTE_ORDER from
10+ * libc headers, since it doesn't reflect the actual
11+ * requested byte order.
12+ *
13+ * Note, LLVM's BPF target has different __builtin_bswapX()
14+ * semantics. It does map to BPF_ALU | BPF_END | BPF_TO_BE
15+ * in bpfel and bpfeb case, which means below, that we map
16+ * to cpu_to_be16(). We could use it unconditionally in BPF
17+ * case, but better not rely on it, so that this header here
18+ * can be used from application and BPF program side, which
19+ * use different targets.
20+ */
21+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
22+# define __bpf_ntohs(x) __builtin_bswap16(x)
23+# define __bpf_htons(x) __builtin_bswap16(x)
24+# define __bpf_constant_ntohs(x) ___constant_swab16(x)
25+# define __bpf_constant_htons(x) ___constant_swab16(x)
26+#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
27+# define __bpf_ntohs(x) (x)
28+# define __bpf_htons(x) (x)
29+# define __bpf_constant_ntohs(x) (x)
30+# define __bpf_constant_htons(x) (x)
1231 #else
13−# error "Fix your __BYTE_ORDER?!"
32+# error "Fix your compiler's __BYTE_ORDER__?!"
1433 #endif
1534
1635 #define bpf_htons(x) \
1736 (__builtin_constant_p(x) ? \
18− __constant_htons(x) : __bpf_htons(x))
37+ __bpf_constant_htons(x) : __bpf_htons(x))
1938 #define bpf_ntohs(x) \
2039 (__builtin_constant_p(x) ? \
21− __constant_ntohs(x) : __bpf_ntohs(x))
40+ __bpf_constant_ntohs(x) : __bpf_ntohs(x))
2241
23−#endif
42+#endif /* __BPF_ENDIAN__ */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t