History

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

Pull networking fixes from David Miller: 1) Limit xt_hashlimit hash table size to avoid OOM or hung tasks, from Cong Wang. 2) Fix deadlock in xsk by publishing global consumer pointers when NAPI is finished, from Magnus Karlsson. 3) Set table field properly to RT_TABLE_COMPAT when necessary, from Jethro Beekman. 4) NLA_STRING attributes are not necessary NULL terminated, deal wiht that in IFLA_ALT_IFNAME. From Eric Dumazet. 5) Fix checksum handling in atlantic driver, from Dmitry Bezrukov. 6) Handle mtu==0 devices properly in wireguard, from Jason A. Donenfeld. 7) Fix several lockdep warnings in bonding, from Taehee Yoo. 8) Fix cls_flower port blocking, from Jason Baron. 9) Sanitize internal map names in libbpf, from Toke Høiland-Jørgensen. 10) Fix RDMA race in qede driver, from Michal Kalderon. 11) Fix several false lockdep warnings by adding conditions to list_for_each_entry_rcu(), from Madhuparna Bhowmik. 12) Fix sleep in atomic in mlx5 driver, from Huy Nguyen. 13) Fix potential deadlock in bpf_map_do_batch(), from Yonghong Song. 14) Hey, variables declared in switch statement before any case statements are not initialized. I learn something every day. Get rids of this stuff in several parts of the networking, from Kees Cook. * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (99 commits) bnxt_en: Issue PCIe FLR in kdump kernel to cleanup pending DMAs. bnxt_en: Improve device shutdown method. net: netlink: cap max groups which will be considered in netlink_bind() net: thunderx: workaround BGX TX Underflow issue ionic: fix fw_status read net: disable BRIDGE_NETFILTER by default net: macb: Properly handle phylink on at91rm9200 s390/qeth: fix off-by-one in RX copybreak check s390/qeth: don't warn for napi with 0 budget s390/qeth: vnicc Fix EOPNOTSUPP precedence openvswitch: Distribute switch variables for initialization net: ip6_gre: Distribute switch variables for initialization net: core: Distribute switch variables for initialization udp: rehash on disconnect net/tls: Fix to avoid gettig invalid tls record bpf: Fix a potential deadlock with bpf_map_do_batch bpf: Do not grab the bucket spinlock by default on htab batch ops ice: Wait for VF to be reset/ready before configuration ice: Don't tell the OS that link is going down ice: Don't reject odd values of usecs set by user ...

Linus Torvalds committed 6 years ago

Commit 3dc55db2 parents b0dd1eb 36a44bc104 files · +1132 −506Browse files

Unified · Split

104 files
  1. drivers/net/bonding/bond_main.c +52 −3
  2. drivers/net/bonding/bond_options.c +2 −0
  3. drivers/net/dsa/b53/b53_common.c +3 −0
  4. drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +5 −0
  5. drivers/net/ethernet/aquantia/atlantic/aq_filters.c +1 −1
  6. drivers/net/ethernet/aquantia/atlantic/aq_hw.h +2 −0
  7. drivers/net/ethernet/aquantia/atlantic/aq_nic.c +3 −5
  8. drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +8 −5
  9. drivers/net/ethernet/aquantia/atlantic/aq_ring.c +7 −3
  10. drivers/net/ethernet/aquantia/atlantic/aq_ring.h +2 −1
  11. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +14 −8
  12. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c +17 −2
  13. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c +12 −0
  14. drivers/net/ethernet/broadcom/bnxt/bnxt.c +10 −2
  15. drivers/net/ethernet/broadcom/cnic_defs.h +2 −2
  16. drivers/net/ethernet/cadence/macb.h +1 −0
  17. drivers/net/ethernet/cadence/macb_main.c +37 −29
  18. drivers/net/ethernet/cavium/thunder/thunder_bgx.c +59 −3
  19. drivers/net/ethernet/cavium/thunder/thunder_bgx.h +9 −0
  20. drivers/net/ethernet/davicom/dm9000.c +2 −0
  21. drivers/net/ethernet/intel/ice/ice_ethtool.c +38 −18
  22. drivers/net/ethernet/intel/ice/ice_txrx.h +1 −1
  23. drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +74 −60
  24. drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h +2 −1
  25. drivers/net/ethernet/mellanox/mlx5/core/en/health.c +1 −1
  26. drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h +8 −0
  27. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +3 −0
  28. drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +8 −12
  29. drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +2 −2
  30. drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c +1 −1
  31. drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c +4 −1
  32. drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c +7 −2
  33. drivers/net/ethernet/mellanox/mlx5/core/wq.c +30 −9
  34. drivers/net/ethernet/mellanox/mlx5/core/wq.h +2 −0
  35. drivers/net/ethernet/micrel/ks8851_mll.c +9 −44
  36. drivers/net/ethernet/mscc/ocelot_board.c +8 −0
  37. drivers/net/ethernet/pensando/ionic/ionic_dev.c +7 −4
  38. drivers/net/ethernet/pensando/ionic/ionic_if.h +1 −0
  39. drivers/net/ethernet/qlogic/qede/qede.h +2 −0
  40. drivers/net/ethernet/qlogic/qede/qede_rdma.c +28 −1
  41. drivers/net/phy/broadcom.c +2 −2
  42. drivers/net/phy/mdio-bcm-iproc.c +20 −0
  43. drivers/net/wireguard/device.c +4 −3
  44. drivers/net/wireguard/receive.c +5 −2
  45. drivers/net/wireguard/send.c +11 −5
  46. drivers/net/wireguard/socket.c +0 −1
  47. drivers/nfc/pn544/i2c.c +1 −0
  48. drivers/nfc/pn544/pn544.c +1 −1
  49. drivers/s390/net/qeth_core_main.c +1 −2
  50. drivers/s390/net/qeth_l2_main.c +13 −16
  51. include/linux/mlx5/mlx5_ifc.h +4 −1
  52. include/linux/netdevice.h +3 −4
  53. include/linux/rculist_nulls.h +7 −0
  54. include/linux/skbuff.h +30 −0
  55. include/net/flow_dissector.h +9 −0
  56. include/net/sock.h +33 −5
  57. include/uapi/linux/bpf.h +7 −9
  58. include/uapi/linux/netfilter/nf_conntrack_common.h +11 −1
  59. kernel/bpf/btf.c +3 −3
  60. kernel/bpf/hashtab.c +53 −5
  61. kernel/bpf/offload.c +1 −1
  62. net/Kconfig +0 −1
  63. net/bridge/br_stp.c +2 −1
  64. net/core/dev.c +11 −23
  65. net/core/fib_rules.c +1 −1
  66. net/core/rtnetlink.c +12 −14
  67. net/core/skbuff.c +2 −4
  68. net/ethtool/bitset.c +3 −0
  69. net/hsr/hsr_framereg.c +2 −1
  70. net/ipv4/udp.c +5 −1
  71. net/ipv6/ip6_fib.c +4 −3
  72. net/ipv6/ip6_gre.c +5 −3
  73. net/ipv6/ip6_tunnel.c +9 −4
  74. net/ipv6/route.c +1 −0
  75. net/mptcp/Kconfig +1 −0
  76. net/mptcp/protocol.c +19 −29
  77. net/mptcp/protocol.h +2 −2
  78. net/netfilter/nf_conntrack_core.c +164 −28
  79. net/netfilter/nf_conntrack_proto_udp.c +16 −4
  80. net/netfilter/nf_flow_table_offload.c +3 −3
  81. net/netfilter/nft_set_pipapo.c +3 −3
  82. net/netfilter/xt_hashlimit.c +16 −6
  83. net/netlabel/netlabel_domainhash.c +2 −1
  84. net/netlabel/netlabel_unlabeled.c +2 −1
  85. net/netlink/af_netlink.c +3 −2
  86. net/openvswitch/datapath.c +6 −3
  87. net/openvswitch/flow_netlink.c +10 −8
  88. net/openvswitch/flow_table.c +4 −2
  89. net/openvswitch/meter.c +2 −1
  90. net/openvswitch/vport.c +2 −1
  91. net/rds/rdma.c +12 −12
  92. net/sched/cls_flower.c +1 −0
  93. net/sctp/sm_statefuns.c +20 −9
  94. net/tls/tls_device.c +19 −1
  95. net/xdp/xsk.c +2 −0
  96. net/xdp/xsk_queue.h +2 −1
  97. tools/include/uapi/linux/bpf.h +7 −9
  98. tools/lib/bpf/libbpf.c +7 −1
  99. tools/testing/selftests/bpf/prog_tests/select_reuseport.c +6 −2
  100. tools/testing/selftests/bpf/prog_tests/sockmap_basic.c +5 −0
  101. tools/testing/selftests/net/fib_tests.sh +6 −0
  102. tools/testing/selftests/net/forwarding/mirror_gre.sh +13 −12
  103. tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh +3 −3
  104. tools/testing/selftests/wireguard/qemu/Makefile +14 −24
drivers/net/bonding/bond_main.c+52−3
@@ -3526,6 +3526,47 @@ static void bond_fold_stats(struct rtnl_link_stats64 *_res, · 3525 unmodified lines
35263526 }
35273527 }
35283528
3529+#ifdef CONFIG_LOCKDEP
3530+static int bond_get_lowest_level_rcu(struct net_device *dev)
3531+{
3532+ struct net_device *ldev, *next, *now, *dev_stack[MAX_NEST_DEV + 1];
3533+ struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1];
3534+ int cur = 0, max = 0;
3535+
3536+ now = dev;
3537+ iter = &dev->adj_list.lower;
3538+
3539+ while (1) {
3540+ next = NULL;
3541+ while (1) {
3542+ ldev = netdev_next_lower_dev_rcu(now, &iter);
3543+ if (!ldev)
3544+ break;
3545+
3546+ next = ldev;
3547+ niter = &ldev->adj_list.lower;
3548+ dev_stack[cur] = now;
3549+ iter_stack[cur++] = iter;
3550+ if (max <= cur)
3551+ max = cur;
3552+ break;
3553+ }
3554+
3555+ if (!next) {
3556+ if (!cur)
3557+ return max;
3558+ next = dev_stack[--cur];
3559+ niter = iter_stack[cur];
3560+ }
3561+
3562+ now = next;
3563+ iter = niter;
3564+ }
3565+
3566+ return max;
3567+}
3568+#endif
3569+
35293570 static void bond_get_stats(struct net_device *bond_dev,
35303571 struct rtnl_link_stats64 *stats)
35313572 {
@@ -3533,11 +3574,17 @@ static void bond_get_stats(struct net_device *bond_dev, · 1 unmodified line
35333574 struct rtnl_link_stats64 temp;
35343575 struct list_head *iter;
35353576 struct slave *slave;
3577+ int nest_level = 0;
35363578
3537− spin_lock(&bond->stats_lock);
3538− memcpy(stats, &bond->bond_stats, sizeof(*stats));
35393579
35403580 rcu_read_lock();
3581+#ifdef CONFIG_LOCKDEP
3582+ nest_level = bond_get_lowest_level_rcu(bond_dev);
3583+#endif
3584+
3585+ spin_lock_nested(&bond->stats_lock, nest_level);
3586+ memcpy(stats, &bond->bond_stats, sizeof(*stats));
3587+
35413588 bond_for_each_slave_rcu(bond, slave, iter) {
35423589 const struct rtnl_link_stats64 *new =
35433590 dev_get_stats(slave->dev, &temp);
@@ -3547,10 +3594,10 @@ static void bond_get_stats(struct net_device *bond_dev, · 3 unmodified lines
35473594 /* save off the slave stats for the next run */
35483595 memcpy(&slave->slave_stats, new, sizeof(*new));
35493596 }
3550− rcu_read_unlock();
35513597
35523598 memcpy(&bond->bond_stats, stats, sizeof(*stats));
35533599 spin_unlock(&bond->stats_lock);
3600+ rcu_read_unlock();
35543601 }
35553602
35563603 static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd)
@@ -3640,6 +3687,8 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd · 83 unmodified lines
36403687 case BOND_RELEASE_OLD:
36413688 case SIOCBONDRELEASE:
36423689 res = bond_release(bond_dev, slave_dev);
3690+ if (!res)
3691+ netdev_update_lockdep_key(slave_dev);
36433692 break;
36443693 case BOND_SETHWADDR_OLD:
36453694 case SIOCBONDSETHWADDR:
drivers/net/bonding/bond_options.c+2−0
@@ -1398,6 +1398,8 @@ static int bond_option_slaves_set(struct bonding *bond, · 1397 unmodified lines
13981398 case '-':
13991399 slave_dbg(bond->dev, dev, "Releasing interface\n");
14001400 ret = bond_release(bond->dev, dev);
1401+ if (!ret)
1402+ netdev_update_lockdep_key(dev);
14011403 break;
14021404
14031405 default:
drivers/net/dsa/b53/b53_common.c+3−0
@@ -1366,6 +1366,9 @@ void b53_vlan_add(struct dsa_switch *ds, int port, · 1365 unmodified lines
13661366
13671367 b53_get_vlan_entry(dev, vid, vl);
13681368
1369+ if (vid == 0 && vid == b53_default_pvid(dev))
1370+ untagged = true;
1371+
13691372 vl->members |= BIT(port);
13701373 if (untagged && !dsa_is_cpu_port(ds, port))
13711374 vl->untag |= BIT(port);
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c+5−0
@@ -722,6 +722,11 @@ static int aq_ethtool_set_priv_flags(struct net_device *ndev, u32 flags) · 721 unmodified lines
722722 if (flags & ~AQ_PRIV_FLAGS_MASK)
723723 return -EOPNOTSUPP;
724724
725+ if (hweight32((flags | priv_flags) & AQ_HW_LOOPBACK_MASK) > 1) {
726+ netdev_info(ndev, "Can't enable more than one loopback simultaneously\n");
727+ return -EINVAL;
728+ }
729+
725730 cfg->priv_flags = flags;
726731
727732 if ((priv_flags ^ flags) & BIT(AQ_HW_LOOPBACK_DMA_NET)) {
drivers/net/ethernet/aquantia/atlantic/aq_filters.c+1−1
@@ -163,7 +163,7 @@ aq_check_approve_fvlan(struct aq_nic_s *aq_nic, · 162 unmodified lines
163163 }
164164
165165 if ((aq_nic->ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) &&
166− (!test_bit(be16_to_cpu(fsp->h_ext.vlan_tci),
166+ (!test_bit(be16_to_cpu(fsp->h_ext.vlan_tci) & VLAN_VID_MASK,
167167 aq_nic->active_vlans))) {
168168 netdev_err(aq_nic->ndev,
169169 "ethtool: unknown vlan-id specified");
drivers/net/ethernet/aquantia/atlantic/aq_hw.h+2−0
@@ -337,6 +337,8 @@ struct aq_fw_ops { · 336 unmodified lines
337337
338338 void (*enable_ptp)(struct aq_hw_s *self, int enable);
339339
340+ void (*adjust_ptp)(struct aq_hw_s *self, uint64_t adj);
341+
340342 int (*set_eee_rate)(struct aq_hw_s *self, u32 speed);
341343
342344 int (*get_eee_rate)(struct aq_hw_s *self, u32 *rate,
drivers/net/ethernet/aquantia/atlantic/aq_nic.c+3−5
@@ -533,8 +533,10 @@ unsigned int aq_nic_map_skb(struct aq_nic_s *self, struct sk_buff *skb, · 532 unmodified lines
533533 dx_buff->len,
534534 DMA_TO_DEVICE);
535535
536− if (unlikely(dma_mapping_error(aq_nic_get_dev(self), dx_buff->pa)))
536+ if (unlikely(dma_mapping_error(aq_nic_get_dev(self), dx_buff->pa))) {
537+ ret = 0;
537538 goto exit;
539+ }
538540
539541 first = dx_buff;
540542 dx_buff->len_pkt = skb->len;
@@ -655,10 +657,6 @@ int aq_nic_xmit(struct aq_nic_s *self, struct sk_buff *skb) · 114 unmodified lines
655657 if (likely(frags)) {
656658 err = self->aq_hw_ops->hw_ring_tx_xmit(self->aq_hw,
657659 ring, frags);
658− if (err >= 0) {
659− ++ring->stats.tx.packets;
660− ring->stats.tx.bytes += skb->len;
661− }
662660 } else {
663661 err = NETDEV_TX_BUSY;
664662 }
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c+8−5
@@ -359,7 +359,8 @@ static int aq_suspend_common(struct device *dev, bool deep) · 358 unmodified lines
359359 netif_device_detach(nic->ndev);
360360 netif_tx_stop_all_queues(nic->ndev);
361361
362− aq_nic_stop(nic);
362+ if (netif_running(nic->ndev))
363+ aq_nic_stop(nic);
363364
364365 if (deep) {
365366 aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol);
@@ -375,7 +376,7 @@ static int atl_resume_common(struct device *dev, bool deep) · 9 unmodified lines
375376 {
376377 struct pci_dev *pdev = to_pci_dev(dev);
377378 struct aq_nic_s *nic;
378− int ret;
379+ int ret = 0;
379380
380381 nic = pci_get_drvdata(pdev);
381382
@@ -390,9 +391,11 @@ static int atl_resume_common(struct device *dev, bool deep) · 8 unmodified lines
390391 goto err_exit;
391392 }
392393
393− ret = aq_nic_start(nic);
394− if (ret)
395− goto err_exit;
394+ if (netif_running(nic->ndev)) {
395+ ret = aq_nic_start(nic);
396+ if (ret)
397+ goto err_exit;
398+ }
396399
397400 netif_device_attach(nic->ndev);
398401 netif_tx_start_all_queues(nic->ndev);
drivers/net/ethernet/aquantia/atlantic/aq_ring.c+7−3
@@ -272,9 +272,12 @@ bool aq_ring_tx_clean(struct aq_ring_s *self) · 271 unmodified lines
272272 }
273273 }
274274
275− if (unlikely(buff->is_eop))
276− dev_kfree_skb_any(buff->skb);
275+ if (unlikely(buff->is_eop)) {
276+ ++self->stats.rx.packets;
277+ self->stats.tx.bytes += buff->skb->len;
277278
279+ dev_kfree_skb_any(buff->skb);
280+ }
278281 buff->pa = 0U;
279282 buff->eop_index = 0xffffU;
280283 self->sw_head = aq_ring_next_dx(self, self->sw_head);
@@ -351,7 +354,8 @@ int aq_ring_rx_clean(struct aq_ring_s *self, · 70 unmodified lines
351354 err = 0;
352355 goto err_exit;
353356 }
354− if (buff->is_error || buff->is_cso_err) {
357+ if (buff->is_error ||
358+ (buff->is_lro && buff->is_cso_err)) {
355359 buff_ = buff;
356360 do {
357361 next_ = buff_->next,
drivers/net/ethernet/aquantia/atlantic/aq_ring.h+2−1
@@ -78,7 +78,8 @@ struct __packed aq_ring_buff_s { · 77 unmodified lines
7878 u32 is_cleaned:1;
7979 u32 is_error:1;
8080 u32 is_vlan:1;
81− u32 rsvd3:4;
81+ u32 is_lro:1;
82+ u32 rsvd3:3;
8283 u16 eop_index;
8384 u16 rsvd4;
8485 };
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c+14−8
@@ -823,6 +823,8 @@ static int hw_atl_b0_hw_ring_rx_receive(struct aq_hw_s *self, · 822 unmodified lines
823823 }
824824 }
825825
826+ buff->is_lro = !!(HW_ATL_B0_RXD_WB_STAT2_RSCCNT &
827+ rxd_wb->status);
826828 if (HW_ATL_B0_RXD_WB_STAT2_EOP & rxd_wb->status) {
827829 buff->len = rxd_wb->pkt_len %
828830 AQ_CFG_RX_FRAME_MAX;
@@ -835,8 +837,7 @@ static int hw_atl_b0_hw_ring_rx_receive(struct aq_hw_s *self, · 6 unmodified lines
835837 rxd_wb->pkt_len > AQ_CFG_RX_FRAME_MAX ?
836838 AQ_CFG_RX_FRAME_MAX : rxd_wb->pkt_len;
837839
838− if (HW_ATL_B0_RXD_WB_STAT2_RSCCNT &
839− rxd_wb->status) {
840+ if (buff->is_lro) {
840841 /* LRO */
841842 buff->next = rxd_wb->next_desc_ptr;
842843 ++ring->stats.rx.lro_packets;
@@ -884,13 +885,16 @@ static int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self, · 41 unmodified lines
884885 {
885886 struct aq_nic_cfg_s *cfg = self->aq_nic_cfg;
886887 unsigned int i = 0U;
888+ u32 vlan_promisc;
889+ u32 l2_promisc;
887890
888− hw_atl_rpfl2promiscuous_mode_en_set(self,
889− IS_FILTER_ENABLED(IFF_PROMISC));
891+ l2_promisc = IS_FILTER_ENABLED(IFF_PROMISC) ||
892+ !!(cfg->priv_flags & BIT(AQ_HW_LOOPBACK_DMA_NET));
893+ vlan_promisc = l2_promisc || cfg->is_vlan_force_promisc;
890894
891− hw_atl_rpf_vlan_prom_mode_en_set(self,
892− IS_FILTER_ENABLED(IFF_PROMISC) ||
893− cfg->is_vlan_force_promisc);
895+ hw_atl_rpfl2promiscuous_mode_en_set(self, l2_promisc);
896+
897+ hw_atl_rpf_vlan_prom_mode_en_set(self, vlan_promisc);
894898
895899 hw_atl_rpfl2multicast_flr_en_set(self,
896900 IS_FILTER_ENABLED(IFF_ALLMULTI) &&
@@ -1161,6 +1165,8 @@ static int hw_atl_b0_adj_sys_clock(struct aq_hw_s *self, s64 delta) · 264 unmodified lines
11611165 {
11621166 self->ptp_clk_offset += delta;
11631167
1168+ self->aq_fw_ops->adjust_ptp(self, self->ptp_clk_offset);
1169+
11641170 return 0;
11651171 }
11661172
@@ -1211,7 +1217,7 @@ static int hw_atl_b0_gpio_pulse(struct aq_hw_s *self, u32 index, · 44 unmodified lines
12111217 fwreq.ptp_gpio_ctrl.index = index;
12121218 fwreq.ptp_gpio_ctrl.period = period;
12131219 /* Apply time offset */
1214− fwreq.ptp_gpio_ctrl.start = start - self->ptp_clk_offset;
1220+ fwreq.ptp_gpio_ctrl.start = start;
12151221
12161222 size = sizeof(fwreq.msg_id) + sizeof(fwreq.ptp_gpio_ctrl);
12171223 return self->aq_fw_ops->send_fw_request(self, &fwreq, size);
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c+17−2
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #define HW_ATL_MIF_ADDR 0x0208U
2323 #define HW_ATL_MIF_VAL 0x020CU
2424
25+#define HW_ATL_MPI_RPC_ADDR 0x0334U
2526 #define HW_ATL_RPC_CONTROL_ADR 0x0338U
2627 #define HW_ATL_RPC_STATE_ADR 0x033CU
2728
@@ -53,15 +54,14 @@ enum mcp_area { · 25 unmodified lines
5354 };
5455
5556 static int hw_atl_utils_ver_match(u32 ver_expected, u32 ver_actual);
56−
5757 static int hw_atl_utils_mpi_set_state(struct aq_hw_s *self,
5858 enum hal_atl_utils_fw_state_e state);
59−
6059 static u32 hw_atl_utils_get_mpi_mbox_tid(struct aq_hw_s *self);
6160 static u32 hw_atl_utils_mpi_get_state(struct aq_hw_s *self);
6261 static u32 hw_atl_utils_mif_cmd_get(struct aq_hw_s *self);
6362 static u32 hw_atl_utils_mif_addr_get(struct aq_hw_s *self);
6463 static u32 hw_atl_utils_rpc_state_get(struct aq_hw_s *self);
64+static u32 aq_fw1x_rpc_get(struct aq_hw_s *self);
6565
6666 int hw_atl_utils_initfw(struct aq_hw_s *self, const struct aq_fw_ops **fw_ops)
6767 {
@@ -476,6 +476,10 @@ static int hw_atl_utils_init_ucp(struct aq_hw_s *self, · 408 unmodified lines
476476 self, self->mbox_addr,
477477 self->mbox_addr != 0U,
478478 1000U, 10000U);
479+ err = readx_poll_timeout_atomic(aq_fw1x_rpc_get, self,
480+ self->rpc_addr,
481+ self->rpc_addr != 0U,
482+ 1000U, 100000U);
479483
480484 return err;
481485 }
@@ -531,6 +535,12 @@ int hw_atl_utils_fw_rpc_wait(struct aq_hw_s *self, · 49 unmodified lines
531535 self, fw.val,
532536 sw.tid == fw.tid,
533537 1000U, 100000U);
538+ if (err < 0)
539+ goto err_exit;
540+
541+ err = aq_hw_err_from_flags(self);
542+ if (err < 0)
543+ goto err_exit;
534544
535545 if (fw.len == 0xFFFFU) {
536546 err = hw_atl_utils_fw_rpc_call(self, sw.len);
@@ -1025,6 +1035,11 @@ static u32 hw_atl_utils_rpc_state_get(struct aq_hw_s *self) · 488 unmodified lines
10251035 return aq_hw_read_reg(self, HW_ATL_RPC_STATE_ADR);
10261036 }
10271037
1038+static u32 aq_fw1x_rpc_get(struct aq_hw_s *self)
1039+{
1040+ return aq_hw_read_reg(self, HW_ATL_MPI_RPC_ADDR);
1041+}
1042+
10281043 const struct aq_fw_ops aq_fw_1x_ops = {
10291044 .init = hw_atl_utils_mpi_create,
10301045 .deinit = hw_atl_fw1x_deinit,
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c+12−0
@@ -30,6 +30,9 @@ · 29 unmodified lines
3030 #define HW_ATL_FW3X_EXT_CONTROL_ADDR 0x378
3131 #define HW_ATL_FW3X_EXT_STATE_ADDR 0x37c
3232
33+#define HW_ATL_FW3X_PTP_ADJ_LSW_ADDR 0x50a0
34+#define HW_ATL_FW3X_PTP_ADJ_MSW_ADDR 0x50a4
35+
3336 #define HW_ATL_FW2X_CAP_PAUSE BIT(CAPS_HI_PAUSE)
3437 #define HW_ATL_FW2X_CAP_ASYM_PAUSE BIT(CAPS_HI_ASYMMETRIC_PAUSE)
3538 #define HW_ATL_FW2X_CAP_SLEEP_PROXY BIT(CAPS_HI_SLEEP_PROXY)
@@ -475,6 +478,14 @@ static void aq_fw3x_enable_ptp(struct aq_hw_s *self, int enable) · 439 unmodified lines
475478 aq_hw_write_reg(self, HW_ATL_FW3X_EXT_CONTROL_ADDR, ptp_opts);
476479 }
477480
481+static void aq_fw3x_adjust_ptp(struct aq_hw_s *self, uint64_t adj)
482+{
483+ aq_hw_write_reg(self, HW_ATL_FW3X_PTP_ADJ_LSW_ADDR,
484+ (adj >> 0) & 0xffffffff);
485+ aq_hw_write_reg(self, HW_ATL_FW3X_PTP_ADJ_MSW_ADDR,
486+ (adj >> 32) & 0xffffffff);
487+}
488+
478489 static int aq_fw2x_led_control(struct aq_hw_s *self, u32 mode)
479490 {
480491 if (self->fw_ver_actual < HW_ATL_FW_VER_LED)
@@ -633,4 +644,5 @@ const struct aq_fw_ops aq_fw_2x_ops = { · 152 unmodified lines
633644 .enable_ptp = aq_fw3x_enable_ptp,
634645 .led_control = aq_fw2x_led_control,
635646 .set_phyloopback = aq_fw2x_set_phyloopback,
647+ .adjust_ptp = aq_fw3x_adjust_ptp,
636648 };
drivers/net/ethernet/broadcom/bnxt/bnxt.c+10−2
@@ -11786,6 +11786,14 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 11785 unmodified lines
1178611786 if (version_printed++ == 0)
1178711787 pr_info("%s", version);
1178811788
11789+ /* Clear any pending DMA transactions from crash kernel
11790+ * while loading driver in capture kernel.
11791+ */
11792+ if (is_kdump_kernel()) {
11793+ pci_clear_master(pdev);
11794+ pcie_flr(pdev);
11795+ }
11796+
1178911797 max_irqs = bnxt_get_max_irq(pdev);
1179011798 dev = alloc_etherdev_mq(sizeof(*bp), max_irqs);
1179111799 if (!dev)
@@ -11983,10 +11991,10 @@ static void bnxt_shutdown(struct pci_dev *pdev) · 191 unmodified lines
1198311991 dev_close(dev);
1198411992
1198511993 bnxt_ulp_shutdown(bp);
11994+ bnxt_clear_int_mode(bp);
11995+ pci_disable_device(pdev);
1198611996
1198711997 if (system_state == SYSTEM_POWER_OFF) {
11988− bnxt_clear_int_mode(bp);
11989− pci_disable_device(pdev);
1199011998 pci_wake_from_d3(pdev, bp->wol);
1199111999 pci_set_power_state(pdev, PCI_D3hot);
1199212000 }
drivers/net/ethernet/broadcom/cnic_defs.h+2−2
@@ -543,13 +543,13 @@ struct l4_kwq_update_pg { · 542 unmodified lines
543543 #define L4_KWQ_UPDATE_PG_RESERVERD2_SHIFT 2
544544 #endif
545545 #if defined(__BIG_ENDIAN)
546− u16 reserverd3;
546+ u16 reserved3;
547547 u8 da0;
548548 u8 da1;
549549 #elif defined(__LITTLE_ENDIAN)
550550 u8 da1;
551551 u8 da0;
552− u16 reserverd3;
552+ u16 reserved3;
553553 #endif
554554 #if defined(__BIG_ENDIAN)
555555 u8 da2;
drivers/net/ethernet/cadence/macb.h+1−0
@@ -652,6 +652,7 @@ · 651 unmodified lines
652652 #define MACB_CAPS_GEM_HAS_PTP 0x00000040
653653 #define MACB_CAPS_BD_RD_PREFETCH 0x00000080
654654 #define MACB_CAPS_NEEDS_RSTONUBR 0x00000100
655+#define MACB_CAPS_MACB_IS_EMAC 0x08000000
655656 #define MACB_CAPS_FIFO_MODE 0x10000000
656657 #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000
657658 #define MACB_CAPS_SG_DISABLED 0x40000000
drivers/net/ethernet/cadence/macb_main.c+37−29
@@ -572,8 +572,21 @@ static void macb_mac_config(struct phylink_config *config, unsigned int mode, · 571 unmodified lines
572572 old_ctrl = ctrl = macb_or_gem_readl(bp, NCFGR);
573573
574574 /* Clear all the bits we might set later */
575− ctrl &= ~(GEM_BIT(GBE) | MACB_BIT(SPD) | MACB_BIT(FD) | MACB_BIT(PAE) |
576− GEM_BIT(SGMIIEN) | GEM_BIT(PCSSEL));
575+ ctrl &= ~(MACB_BIT(SPD) | MACB_BIT(FD) | MACB_BIT(PAE));
576+
577+ if (bp->caps & MACB_CAPS_MACB_IS_EMAC) {
578+ if (state->interface == PHY_INTERFACE_MODE_RMII)
579+ ctrl |= MACB_BIT(RM9200_RMII);
580+ } else {
581+ ctrl &= ~(GEM_BIT(GBE) | GEM_BIT(SGMIIEN) | GEM_BIT(PCSSEL));
582+
583+ /* We do not support MLO_PAUSE_RX yet */
584+ if (state->pause & MLO_PAUSE_TX)
585+ ctrl |= MACB_BIT(PAE);
586+
587+ if (state->interface == PHY_INTERFACE_MODE_SGMII)
588+ ctrl |= GEM_BIT(SGMIIEN) | GEM_BIT(PCSSEL);
589+ }
577590
578591 if (state->speed == SPEED_1000)
579592 ctrl |= GEM_BIT(GBE);
@@ -583,13 +596,6 @@ static void macb_mac_config(struct phylink_config *config, unsigned int mode, · 3 unmodified lines
583596 if (state->duplex)
584597 ctrl |= MACB_BIT(FD);
585598
586− /* We do not support MLO_PAUSE_RX yet */
587− if (state->pause & MLO_PAUSE_TX)
588− ctrl |= MACB_BIT(PAE);
589−
590− if (state->interface == PHY_INTERFACE_MODE_SGMII)
591− ctrl |= GEM_BIT(SGMIIEN) | GEM_BIT(PCSSEL);
592−
593599 /* Apply the new configuration, if any */
594600 if (old_ctrl ^ ctrl)
595601 macb_or_gem_writel(bp, NCFGR, ctrl);
@@ -608,9 +614,10 @@ static void macb_mac_link_down(struct phylink_config *config, unsigned int mode, · 12 unmodified lines
608614 unsigned int q;
609615 u32 ctrl;
610616
611− for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue)
612− queue_writel(queue, IDR,
613− bp->rx_intr_mask | MACB_TX_INT_FLAGS | MACB_BIT(HRESP));
617+ if (!(bp->caps & MACB_CAPS_MACB_IS_EMAC))
618+ for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue)
619+ queue_writel(queue, IDR,
620+ bp->rx_intr_mask | MACB_TX_INT_FLAGS | MACB_BIT(HRESP));
614621
615622 /* Disable Rx and Tx */
616623 ctrl = macb_readl(bp, NCR) & ~(MACB_BIT(RE) | MACB_BIT(TE));
@@ -627,17 +634,19 @@ static void macb_mac_link_up(struct phylink_config *config, unsigned int mode, · 10 unmodified lines
627634 struct macb_queue *queue;
628635 unsigned int q;
629636
630− macb_set_tx_clk(bp->tx_clk, bp->speed, ndev);
637+ if (!(bp->caps & MACB_CAPS_MACB_IS_EMAC)) {
638+ macb_set_tx_clk(bp->tx_clk, bp->speed, ndev);
631639
632− /* Initialize rings & buffers as clearing MACB_BIT(TE) in link down
633− * cleared the pipeline and control registers.
634− */
635− bp->macbgem_ops.mog_init_rings(bp);
636− macb_init_buffers(bp);
640+ /* Initialize rings & buffers as clearing MACB_BIT(TE) in link down
641+ * cleared the pipeline and control registers.
642+ */
643+ bp->macbgem_ops.mog_init_rings(bp);
644+ macb_init_buffers(bp);
637645
638− for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue)
639− queue_writel(queue, IER,
640− bp->rx_intr_mask | MACB_TX_INT_FLAGS | MACB_BIT(HRESP));
646+ for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue)
647+ queue_writel(queue, IER,
648+ bp->rx_intr_mask | MACB_TX_INT_FLAGS | MACB_BIT(HRESP));
649+ }
641650
642651 /* Enable Rx and Tx */
643652 macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(RE) | MACB_BIT(TE));
@@ -3790,6 +3799,10 @@ static int at91ether_open(struct net_device *dev) · 3146 unmodified lines
37903799 u32 ctl;
37913800 int ret;
37923801
3802+ ret = pm_runtime_get_sync(&lp->pdev->dev);
3803+ if (ret < 0)
3804+ return ret;
3805+
37933806 /* Clear internal statistics */
37943807 ctl = macb_readl(lp, NCR);
37953808 macb_writel(lp, NCR, ctl | MACB_BIT(CLRSTAT));
@@ -3854,7 +3867,7 @@ static int at91ether_close(struct net_device *dev) · 58 unmodified lines
38543867 q->rx_buffers, q->rx_buffers_dma);
38553868 q->rx_buffers = NULL;
38563869
3857− return 0;
3870+ return pm_runtime_put(&lp->pdev->dev);
38583871 }
38593872
38603873 /* Transmit packet */
@@ -4037,7 +4050,6 @@ static int at91ether_init(struct platform_device *pdev) · 176 unmodified lines
40374050 struct net_device *dev = platform_get_drvdata(pdev);
40384051 struct macb *bp = netdev_priv(dev);
40394052 int err;
4040− u32 reg;
40414053
40424054 bp->queues[0].bp = bp;
40434055
@@ -4051,11 +4063,7 @@ static int at91ether_init(struct platform_device *pdev) · 7 unmodified lines
40514063
40524064 macb_writel(bp, NCR, 0);
40534065
4054− reg = MACB_BF(CLK, MACB_CLK_DIV32) | MACB_BIT(BIG);
4055− if (bp->phy_interface == PHY_INTERFACE_MODE_RMII)
4056− reg |= MACB_BIT(RM9200_RMII);
4057−
4058− macb_writel(bp, NCFGR, reg);
4066+ macb_writel(bp, NCFGR, MACB_BF(CLK, MACB_CLK_DIV32) | MACB_BIT(BIG));
40594067
40604068 return 0;
40614069 }
@@ -4214,7 +4222,7 @@ static const struct macb_config sama5d4_config = { · 152 unmodified lines
42144222 };
42154223
42164224 static const struct macb_config emac_config = {
4217− .caps = MACB_CAPS_NEEDS_RSTONUBR,
4225+ .caps = MACB_CAPS_NEEDS_RSTONUBR | MACB_CAPS_MACB_IS_EMAC,
42184226 .clk_init = at91ether_clk_init,
42194227 .init = at91ether_init,
42204228 };
drivers/net/ethernet/cavium/thunder/thunder_bgx.c+59−3
@@ -410,10 +410,19 @@ void bgx_lmac_rx_tx_enable(int node, int bgx_idx, int lmacid, bool enable) · 409 unmodified lines
410410 lmac = &bgx->lmac[lmacid];
411411
412412 cfg = bgx_reg_read(bgx, lmacid, BGX_CMRX_CFG);
413− if (enable)
413+ if (enable) {
414414 cfg |= CMR_PKT_RX_EN | CMR_PKT_TX_EN;
415− else
415+
416+ /* enable TX FIFO Underflow interrupt */
417+ bgx_reg_modify(bgx, lmacid, BGX_GMP_GMI_TXX_INT_ENA_W1S,
418+ GMI_TXX_INT_UNDFLW);
419+ } else {
416420 cfg &= ~(CMR_PKT_RX_EN | CMR_PKT_TX_EN);
421+
422+ /* Disable TX FIFO Underflow interrupt */
423+ bgx_reg_modify(bgx, lmacid, BGX_GMP_GMI_TXX_INT_ENA_W1C,
424+ GMI_TXX_INT_UNDFLW);
425+ }
417426 bgx_reg_write(bgx, lmacid, BGX_CMRX_CFG, cfg);
418427
419428 if (bgx->is_rgx)
@@ -1535,6 +1544,48 @@ static int bgx_init_phy(struct bgx *bgx) · 1115 unmodified lines
15351544 return bgx_init_of_phy(bgx);
15361545 }
15371546
1547+static irqreturn_t bgx_intr_handler(int irq, void *data)
1548+{
1549+ struct bgx *bgx = (struct bgx *)data;
1550+ u64 status, val;
1551+ int lmac;
1552+
1553+ for (lmac = 0; lmac < bgx->lmac_count; lmac++) {
1554+ status = bgx_reg_read(bgx, lmac, BGX_GMP_GMI_TXX_INT);
1555+ if (status & GMI_TXX_INT_UNDFLW) {
1556+ pci_err(bgx->pdev, "BGX%d lmac%d UNDFLW\n",
1557+ bgx->bgx_id, lmac);
1558+ val = bgx_reg_read(bgx, lmac, BGX_CMRX_CFG);
1559+ val &= ~CMR_EN;
1560+ bgx_reg_write(bgx, lmac, BGX_CMRX_CFG, val);
1561+ val |= CMR_EN;
1562+ bgx_reg_write(bgx, lmac, BGX_CMRX_CFG, val);
1563+ }
1564+ /* clear interrupts */
1565+ bgx_reg_write(bgx, lmac, BGX_GMP_GMI_TXX_INT, status);
1566+ }
1567+
1568+ return IRQ_HANDLED;
1569+}
1570+
1571+static void bgx_register_intr(struct pci_dev *pdev)
1572+{
1573+ struct bgx *bgx = pci_get_drvdata(pdev);
1574+ int ret;
1575+
1576+ ret = pci_alloc_irq_vectors(pdev, BGX_LMAC_VEC_OFFSET,
1577+ BGX_LMAC_VEC_OFFSET, PCI_IRQ_ALL_TYPES);
1578+ if (ret < 0) {
1579+ pci_err(pdev, "Req for #%d msix vectors failed\n",
1580+ BGX_LMAC_VEC_OFFSET);
1581+ return;
1582+ }
1583+ ret = pci_request_irq(pdev, GMPX_GMI_TX_INT, bgx_intr_handler, NULL,
1584+ bgx, "BGX%d", bgx->bgx_id);
1585+ if (ret)
1586+ pci_free_irq(pdev, GMPX_GMI_TX_INT, bgx);
1587+}
1588+
15381589 static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
15391590 {
15401591 int err;
@@ -1550,7 +1601,7 @@ static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 9 unmodified lines
15501601
15511602 pci_set_drvdata(pdev, bgx);
15521603
1553− err = pci_enable_device(pdev);
1604+ err = pcim_enable_device(pdev);
15541605 if (err) {
15551606 dev_err(dev, "Failed to enable PCI device\n");
15561607 pci_set_drvdata(pdev, NULL);
@@ -1604,6 +1655,8 @@ static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 47 unmodified lines
16041655
16051656 bgx_init_hw(bgx);
16061657
1658+ bgx_register_intr(pdev);
1659+
16071660 /* Enable all LMACs */
16081661 for (lmac = 0; lmac < bgx->lmac_count; lmac++) {
16091662 err = bgx_lmac_enable(bgx, lmac);
@@ -1620,6 +1673,7 @@ static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 10 unmodified lines
16201673
16211674 err_enable:
16221675 bgx_vnic[bgx->bgx_id] = NULL;
1676+ pci_free_irq(pdev, GMPX_GMI_TX_INT, bgx);
16231677 err_release_regions:
16241678 pci_release_regions(pdev);
16251679 err_disable_device:
@@ -1637,6 +1691,8 @@ static void bgx_remove(struct pci_dev *pdev) · 11 unmodified lines
16371691 for (lmac = 0; lmac < bgx->lmac_count; lmac++)
16381692 bgx_lmac_disable(bgx, lmac);
16391693
1694+ pci_free_irq(pdev, GMPX_GMI_TX_INT, bgx);
1695+
16401696 bgx_vnic[bgx->bgx_id] = NULL;
16411697 pci_release_regions(pdev);
16421698 pci_disable_device(pdev);
drivers/net/ethernet/cavium/thunder/thunder_bgx.h+9−0
@@ -180,6 +180,15 @@ · 179 unmodified lines
180180 #define BGX_GMP_GMI_TXX_BURST 0x38228
181181 #define BGX_GMP_GMI_TXX_MIN_PKT 0x38240
182182 #define BGX_GMP_GMI_TXX_SGMII_CTL 0x38300
183+#define BGX_GMP_GMI_TXX_INT 0x38500
184+#define BGX_GMP_GMI_TXX_INT_W1S 0x38508
185+#define BGX_GMP_GMI_TXX_INT_ENA_W1C 0x38510
186+#define BGX_GMP_GMI_TXX_INT_ENA_W1S 0x38518
187+#define GMI_TXX_INT_PTP_LOST BIT_ULL(4)
188+#define GMI_TXX_INT_LATE_COL BIT_ULL(3)
189+#define GMI_TXX_INT_XSDEF BIT_ULL(2)
190+#define GMI_TXX_INT_XSCOL BIT_ULL(1)
191+#define GMI_TXX_INT_UNDFLW BIT_ULL(0)
183192
184193 #define BGX_MSIX_VEC_0_29_ADDR 0x400000 /* +(0..29) << 4 */
185194 #define BGX_MSIX_VEC_0_29_CTL 0x400008
drivers/net/ethernet/davicom/dm9000.c+2−0
@@ -1405,6 +1405,8 @@ static struct dm9000_plat_data *dm9000_parse_dt(struct device *dev) · 1404 unmodified lines
14051405 mac_addr = of_get_mac_address(np);
14061406 if (!IS_ERR(mac_addr))
14071407 ether_addr_copy(pdata->dev_addr, mac_addr);
1408+ else if (PTR_ERR(mac_addr) == -EPROBE_DEFER)
1409+ return ERR_CAST(mac_addr);
14081410
14091411 return pdata;
14101412 }
drivers/net/ethernet/intel/ice/ice_ethtool.c+38−18
@@ -2936,13 +2936,6 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause) · 2935 unmodified lines
29362936 else
29372937 return -EINVAL;
29382938
2939− /* Tell the OS link is going down, the link will go back up when fw
2940− * says it is ready asynchronously
2941− */
2942− ice_print_link_msg(vsi, false);
2943− netif_carrier_off(netdev);
2944− netif_tx_stop_all_queues(netdev);
2945−
29462939 /* Set the FC mode and only restart AN if link is up */
29472940 status = ice_set_fc(pi, &aq_failures, link_up);
29482941
@@ -3489,21 +3482,13 @@ ice_set_rc_coalesce(enum ice_container_type c_type, struct ethtool_coalesce *ec, · 540 unmodified lines
34893482 return -EINVAL;
34903483 }
34913484
3492− /* hardware only supports an ITR granularity of 2us */
3493− if (coalesce_usecs % 2 != 0) {
3494− netdev_info(vsi->netdev, "Invalid value, %s-usecs must be even\n",
3495− c_type_str);
3496− return -EINVAL;
3497− }
3498−
34993485 if (use_adaptive_coalesce) {
35003486 rc->itr_setting |= ICE_ITR_DYNAMIC;
35013487 } else {
3502− /* store user facing value how it was set */
3488+ /* save the user set usecs */
35033489 rc->itr_setting = coalesce_usecs;
3504− /* set to static and convert to value HW understands */
3505− rc->target_itr =
3506− ITR_TO_REG(ITR_REG_ALIGN(rc->itr_setting));
3490+ /* device ITR granularity is in 2 usec increments */
3491+ rc->target_itr = ITR_REG_ALIGN(rc->itr_setting);
35073492 }
35083493
35093494 return 0;
@@ -3596,6 +3581,30 @@ ice_is_coalesce_param_invalid(struct net_device *netdev, · 86 unmodified lines
35963581 return 0;
35973582 }
35983583
3584+/**
3585+ * ice_print_if_odd_usecs - print message if user tries to set odd [tx|rx]-usecs
3586+ * @netdev: netdev used for print
3587+ * @itr_setting: previous user setting
3588+ * @use_adaptive_coalesce: if adaptive coalesce is enabled or being enabled
3589+ * @coalesce_usecs: requested value of [tx|rx]-usecs
3590+ * @c_type_str: either "rx" or "tx" to match user set field of [tx|rx]-usecs
3591+ */
3592+static void
3593+ice_print_if_odd_usecs(struct net_device *netdev, u16 itr_setting,
3594+ u32 use_adaptive_coalesce, u32 coalesce_usecs,
3595+ const char *c_type_str)
3596+{
3597+ if (use_adaptive_coalesce)
3598+ return;
3599+
3600+ itr_setting = ITR_TO_REG(itr_setting);
3601+
3602+ if (itr_setting != coalesce_usecs && (coalesce_usecs % 2))
3603+ netdev_info(netdev, "User set %s-usecs to %d, device only supports even values. Rounding down and attempting to set %s-usecs to %d\n",
3604+ c_type_str, coalesce_usecs, c_type_str,
3605+ ITR_REG_ALIGN(coalesce_usecs));
3606+}
3607+
35993608 /**
36003609 * __ice_set_coalesce - set ITR/INTRL values for the device
36013610 * @netdev: pointer to the netdev associated with this query
@@ -3616,8 +3625,19 @@ __ice_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *ec, · 14 unmodified lines
36163625 return -EINVAL;
36173626
36183627 if (q_num < 0) {
3628+ struct ice_q_vector *q_vector = vsi->q_vectors[0];
36193629 int v_idx;
36203630
3631+ if (q_vector) {
3632+ ice_print_if_odd_usecs(netdev, q_vector->rx.itr_setting,
3633+ ec->use_adaptive_rx_coalesce,
3634+ ec->rx_coalesce_usecs, "rx");
3635+
3636+ ice_print_if_odd_usecs(netdev, q_vector->tx.itr_setting,
3637+ ec->use_adaptive_tx_coalesce,
3638+ ec->tx_coalesce_usecs, "tx");
3639+ }
3640+
36213641 ice_for_each_q_vector(vsi, v_idx) {
36223642 /* In some cases if DCB is configured the num_[rx|tx]q
36233643 * can be less than vsi->num_q_vectors. This check
drivers/net/ethernet/intel/ice/ice_txrx.h+1−1
@@ -222,7 +222,7 @@ enum ice_rx_dtype { · 221 unmodified lines
222222 #define ICE_ITR_GRAN_S 1 /* ITR granularity is always 2us */
223223 #define ICE_ITR_GRAN_US BIT(ICE_ITR_GRAN_S)
224224 #define ICE_ITR_MASK 0x1FFE /* ITR register value alignment mask */
225−#define ITR_REG_ALIGN(setting) __ALIGN_MASK(setting, ~ICE_ITR_MASK)
225+#define ITR_REG_ALIGN(setting) ((setting) & ICE_ITR_MASK)
226226
227227 #define ICE_ITR_ADAPTIVE_MIN_INC 0x0002
228228 #define ICE_ITR_ADAPTIVE_MIN_USECS 0x0002
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c+74−60
@@ -1873,6 +1873,48 @@ error_param: · 1872 unmodified lines
18731873 NULL, 0);
18741874 }
18751875
1876+/**
1877+ * ice_wait_on_vf_reset - poll to make sure a given VF is ready after reset
1878+ * @vf: The VF being resseting
1879+ *
1880+ * The max poll time is about ~800ms, which is about the maximum time it takes
1881+ * for a VF to be reset and/or a VF driver to be removed.
1882+ */
1883+static void ice_wait_on_vf_reset(struct ice_vf *vf)
1884+{
1885+ int i;
1886+
1887+ for (i = 0; i < ICE_MAX_VF_RESET_TRIES; i++) {
1888+ if (test_bit(ICE_VF_STATE_INIT, vf->vf_states))
1889+ break;
1890+ msleep(ICE_MAX_VF_RESET_SLEEP_MS);
1891+ }
1892+}
1893+
1894+/**
1895+ * ice_check_vf_ready_for_cfg - check if VF is ready to be configured/queried
1896+ * @vf: VF to check if it's ready to be configured/queried
1897+ *
1898+ * The purpose of this function is to make sure the VF is not in reset, not
1899+ * disabled, and initialized so it can be configured and/or queried by a host
1900+ * administrator.
1901+ */
1902+static int ice_check_vf_ready_for_cfg(struct ice_vf *vf)
1903+{
1904+ struct ice_pf *pf;
1905+
1906+ ice_wait_on_vf_reset(vf);
1907+
1908+ if (ice_is_vf_disabled(vf))
1909+ return -EINVAL;
1910+
1911+ pf = vf->pf;
1912+ if (ice_check_vf_init(pf, vf))
1913+ return -EBUSY;
1914+
1915+ return 0;
1916+}
1917+
18761918 /**
18771919 * ice_set_vf_spoofchk
18781920 * @netdev: network interface device structure
@@ -1890,16 +1932,16 @@ int ice_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool ena) · 11 unmodified lines
18901932 enum ice_status status;
18911933 struct device *dev;
18921934 struct ice_vf *vf;
1893− int ret = 0;
1935+ int ret;
18941936
18951937 dev = ice_pf_to_dev(pf);
18961938 if (ice_validate_vf_id(pf, vf_id))
18971939 return -EINVAL;
18981940
18991941 vf = &pf->vf[vf_id];
1900−
1901− if (ice_check_vf_init(pf, vf))
1902− return -EBUSY;
1942+ ret = ice_check_vf_ready_for_cfg(vf);
1943+ if (ret)
1944+ return ret;
19031945
19041946 vf_vsi = pf->vsi[vf->lan_vsi_idx];
19051947 if (!vf_vsi) {
@@ -2696,7 +2738,7 @@ ice_set_vf_port_vlan(struct net_device *netdev, int vf_id, u16 vlan_id, u8 qos, · 790 unmodified lines
26962738 struct ice_vsi *vsi;
26972739 struct device *dev;
26982740 struct ice_vf *vf;
2699− int ret = 0;
2741+ int ret;
27002742
27012743 dev = ice_pf_to_dev(pf);
27022744 if (ice_validate_vf_id(pf, vf_id))
@@ -2714,13 +2756,15 @@ ice_set_vf_port_vlan(struct net_device *netdev, int vf_id, u16 vlan_id, u8 qos, · 11 unmodified lines
27142756
27152757 vf = &pf->vf[vf_id];
27162758 vsi = pf->vsi[vf->lan_vsi_idx];
2717− if (ice_check_vf_init(pf, vf))
2718− return -EBUSY;
2759+
2760+ ret = ice_check_vf_ready_for_cfg(vf);
2761+ if (ret)
2762+ return ret;
27192763
27202764 if (le16_to_cpu(vsi->info.pvid) == vlanprio) {
27212765 /* duplicate request, so just return success */
27222766 dev_dbg(dev, "Duplicate pvid %d request\n", vlanprio);
2723− return ret;
2767+ return 0;
27242768 }
27252769
27262770 /* If PVID, then remove all filters on the old VLAN */
@@ -2731,7 +2775,7 @@ ice_set_vf_port_vlan(struct net_device *netdev, int vf_id, u16 vlan_id, u8 qos, · 4 unmodified lines
27312775 if (vlan_id || qos) {
27322776 ret = ice_vsi_manage_pvid(vsi, vlanprio, true);
27332777 if (ret)
2734− goto error_set_pvid;
2778+ return ret;
27352779 } else {
27362780 ice_vsi_manage_pvid(vsi, 0, false);
27372781 vsi->info.pvid = 0;
@@ -2744,7 +2788,7 @@ ice_set_vf_port_vlan(struct net_device *netdev, int vf_id, u16 vlan_id, u8 qos, · 6 unmodified lines
27442788 /* add new VLAN filter for each MAC */
27452789 ret = ice_vsi_add_vlan(vsi, vlan_id);
27462790 if (ret)
2747− goto error_set_pvid;
2791+ return ret;
27482792 }
27492793
27502794 /* The Port VLAN needs to be saved across resets the same as the
@@ -2752,8 +2796,7 @@ ice_set_vf_port_vlan(struct net_device *netdev, int vf_id, u16 vlan_id, u8 qos, · 1 unmodified line
27522796 */
27532797 vf->port_vlan_id = le16_to_cpu(vsi->info.pvid);
27542798
2755−error_set_pvid:
2756− return ret;
2799+ return 0;
27572800 }
27582801
27592802 /**
@@ -3236,23 +3279,6 @@ ice_get_vf_cfg(struct net_device *netdev, int vf_id, struct ifla_vf_info *ivi) · 476 unmodified lines
32363279 return 0;
32373280 }
32383281
3239−/**
3240− * ice_wait_on_vf_reset
3241− * @vf: The VF being resseting
3242− *
3243− * Poll to make sure a given VF is ready after reset
3244− */
3245−static void ice_wait_on_vf_reset(struct ice_vf *vf)
3246−{
3247− int i;
3248−
3249− for (i = 0; i < ICE_MAX_VF_RESET_WAIT; i++) {
3250− if (test_bit(ICE_VF_STATE_INIT, vf->vf_states))
3251− break;
3252− msleep(20);
3253− }
3254−}
3255−
32563282 /**
32573283 * ice_set_vf_mac
32583284 * @netdev: network interface device structure
@@ -3265,29 +3291,21 @@ int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac) · 6 unmodified lines
32653291 {
32663292 struct ice_pf *pf = ice_netdev_to_pf(netdev);
32673293 struct ice_vf *vf;
3268− int ret = 0;
3294+ int ret;
32693295
32703296 if (ice_validate_vf_id(pf, vf_id))
32713297 return -EINVAL;
32723298
3273− vf = &pf->vf[vf_id];
3274− /* Don't set MAC on disabled VF */
3275− if (ice_is_vf_disabled(vf))
3276− return -EINVAL;
3277−
3278− /* In case VF is in reset mode, wait until it is completed. Depending
3279− * on factors like queue disabling routine, this could take ~250ms
3280− */
3281− ice_wait_on_vf_reset(vf);
3282−
3283− if (ice_check_vf_init(pf, vf))
3284− return -EBUSY;
3285−
32863299 if (is_zero_ether_addr(mac) || is_multicast_ether_addr(mac)) {
32873300 netdev_err(netdev, "%pM not a valid unicast address\n", mac);
32883301 return -EINVAL;
32893302 }
32903303
3304+ vf = &pf->vf[vf_id];
3305+ ret = ice_check_vf_ready_for_cfg(vf);
3306+ if (ret)
3307+ return ret;
3308+
32913309 /* copy MAC into dflt_lan_addr and trigger a VF reset. The reset
32923310 * flow will use the updated dflt_lan_addr and add a MAC filter
32933311 * using ice_add_mac. Also set pf_set_mac to indicate that the PF has
@@ -3299,7 +3317,7 @@ int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac) · 5 unmodified lines
32993317 vf_id, mac);
33003318
33013319 ice_vc_reset_vf(vf);
3302− return ret;
3320+ return 0;
33033321 }
33043322
33053323 /**
@@ -3314,22 +3332,15 @@ int ice_set_vf_trust(struct net_device *netdev, int vf_id, bool trusted) · 8 unmodified lines
33143332 {
33153333 struct ice_pf *pf = ice_netdev_to_pf(netdev);
33163334 struct ice_vf *vf;
3335+ int ret;
33173336
33183337 if (ice_validate_vf_id(pf, vf_id))
33193338 return -EINVAL;
33203339
33213340 vf = &pf->vf[vf_id];
3322− /* Don't set Trusted Mode on disabled VF */
3323− if (ice_is_vf_disabled(vf))
3324− return -EINVAL;
3325−
3326− /* In case VF is in reset mode, wait until it is completed. Depending
3327− * on factors like queue disabling routine, this could take ~250ms
3328− */
3329− ice_wait_on_vf_reset(vf);
3330−
3331− if (ice_check_vf_init(pf, vf))
3332− return -EBUSY;
3341+ ret = ice_check_vf_ready_for_cfg(vf);
3342+ if (ret)
3343+ return ret;
33333344
33343345 /* Check if already trusted */
33353346 if (trusted == vf->trusted)
@@ -3355,13 +3366,15 @@ int ice_set_vf_link_state(struct net_device *netdev, int vf_id, int link_state) · 19 unmodified lines
33553366 {
33563367 struct ice_pf *pf = ice_netdev_to_pf(netdev);
33573368 struct ice_vf *vf;
3369+ int ret;
33583370
33593371 if (ice_validate_vf_id(pf, vf_id))
33603372 return -EINVAL;
33613373
33623374 vf = &pf->vf[vf_id];
3363− if (ice_check_vf_init(pf, vf))
3364− return -EBUSY;
3375+ ret = ice_check_vf_ready_for_cfg(vf);
3376+ if (ret)
3377+ return ret;
33653378
33663379 switch (link_state) {
33673380 case IFLA_VF_LINK_STATE_AUTO:
@@ -3397,14 +3410,15 @@ int ice_get_vf_stats(struct net_device *netdev, int vf_id, · 29 unmodified lines
33973410 struct ice_eth_stats *stats;
33983411 struct ice_vsi *vsi;
33993412 struct ice_vf *vf;
3413+ int ret;
34003414
34013415 if (ice_validate_vf_id(pf, vf_id))
34023416 return -EINVAL;
34033417
34043418 vf = &pf->vf[vf_id];
3405−
3406− if (ice_check_vf_init(pf, vf))
3407− return -EBUSY;
3419+ ret = ice_check_vf_ready_for_cfg(vf);
3420+ if (ret)
3421+ return ret;
34083422
34093423 vsi = pf->vsi[vf->lan_vsi_idx];
34103424 if (!vsi)
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h+2−1
@@ -38,7 +38,8 @@ · 37 unmodified lines
3838 #define ICE_MAX_POLICY_INTR_PER_VF 33
3939 #define ICE_MIN_INTR_PER_VF (ICE_MIN_QS_PER_VF + 1)
4040 #define ICE_DFLT_INTR_PER_VF (ICE_DFLT_QS_PER_VF + 1)
41−#define ICE_MAX_VF_RESET_WAIT 15
41+#define ICE_MAX_VF_RESET_TRIES 40
42+#define ICE_MAX_VF_RESET_SLEEP_MS 20
4243
4344 #define ice_for_each_vf(pf, i) \
4445 for ((i) = 0; (i) < (pf)->num_alloc_vfs; (i)++)
drivers/net/ethernet/mellanox/mlx5/core/en/health.c+1−1
@@ -200,7 +200,7 @@ int mlx5e_health_report(struct mlx5e_priv *priv, · 199 unmodified lines
200200 netdev_err(priv->netdev, err_str);
201201
202202 if (!reporter)
203− return err_ctx->recover(&err_ctx->ctx);
203+ return err_ctx->recover(err_ctx->ctx);
204204
205205 return devlink_health_report(reporter, err_str, err_ctx);
206206 }
drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h+8−0
@@ -179,6 +179,14 @@ mlx5e_tx_dma_unmap(struct device *pdev, struct mlx5e_sq_dma *dma) · 178 unmodified lines
179179 }
180180 }
181181
182+static inline void mlx5e_rqwq_reset(struct mlx5e_rq *rq)
183+{
184+ if (rq->wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ)
185+ mlx5_wq_ll_reset(&rq->mpwqe.wq);
186+ else
187+ mlx5_wq_cyc_reset(&rq->wqe.wq);
188+}
189+
182190 /* SW parser related functions */
183191
184192 struct mlx5e_swp_spec {
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+3−0
@@ -712,6 +712,9 @@ int mlx5e_modify_rq_state(struct mlx5e_rq *rq, int curr_state, int next_state) · 711 unmodified lines
712712 if (!in)
713713 return -ENOMEM;
714714
715+ if (curr_state == MLX5_RQC_STATE_RST && next_state == MLX5_RQC_STATE_RDY)
716+ mlx5e_rqwq_reset(rq);
717+
715718 rqc = MLX5_ADDR_OF(modify_rq_in, in, ctx);
716719
717720 MLX5_SET(modify_rq_in, in, rq_state, curr_state);
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c+8−12
@@ -459,12 +459,16 @@ static void esw_destroy_legacy_table(struct mlx5_eswitch *esw) · 458 unmodified lines
459459
460460 static int esw_legacy_enable(struct mlx5_eswitch *esw)
461461 {
462− int ret;
462+ struct mlx5_vport *vport;
463+ int ret, i;
463464
464465 ret = esw_create_legacy_table(esw);
465466 if (ret)
466467 return ret;
467468
469+ mlx5_esw_for_each_vf_vport(esw, i, vport, esw->esw_funcs.num_vfs)
470+ vport->info.link_state = MLX5_VPORT_ADMIN_STATE_AUTO;
471+
468472 ret = mlx5_eswitch_enable_pf_vf_vports(esw, MLX5_LEGACY_SRIOV_VPORT_EVENTS);
469473 if (ret)
470474 esw_destroy_legacy_table(esw);
@@ -2452,25 +2456,17 @@ out: · 1981 unmodified lines
24522456
24532457 int mlx5_eswitch_get_vepa(struct mlx5_eswitch *esw, u8 *setting)
24542458 {
2455− int err = 0;
2456−
24572459 if (!esw)
24582460 return -EOPNOTSUPP;
24592461
24602462 if (!ESW_ALLOWED(esw))
24612463 return -EPERM;
24622464
2463− mutex_lock(&esw->state_lock);
2464− if (esw->mode != MLX5_ESWITCH_LEGACY) {
2465− err = -EOPNOTSUPP;
2466− goto out;
2467− }
2465+ if (esw->mode != MLX5_ESWITCH_LEGACY)
2466+ return -EOPNOTSUPP;
24682467
24692468 *setting = esw->fdb_table.legacy.vepa_uplink_rule ? 1 : 0;
2470−
2471−out:
2472− mutex_unlock(&esw->state_lock);
2473− return err;
2469+ return 0;
24742470 }
24752471
24762472 int mlx5_eswitch_set_vport_trust(struct mlx5_eswitch *esw,
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c+2−2
@@ -1172,7 +1172,7 @@ static int esw_offloads_start(struct mlx5_eswitch *esw, · 1171 unmodified lines
11721172 return -EINVAL;
11731173 }
11741174
1175− mlx5_eswitch_disable(esw, true);
1175+ mlx5_eswitch_disable(esw, false);
11761176 mlx5_eswitch_update_num_of_vfs(esw, esw->dev->priv.sriov.num_vfs);
11771177 err = mlx5_eswitch_enable(esw, MLX5_ESWITCH_OFFLOADS);
11781178 if (err) {
@@ -2065,7 +2065,7 @@ static int esw_offloads_stop(struct mlx5_eswitch *esw, · 886 unmodified lines
20652065 {
20662066 int err, err1;
20672067
2068− mlx5_eswitch_disable(esw, true);
2068+ mlx5_eswitch_disable(esw, false);
20692069 err = mlx5_eswitch_enable(esw, MLX5_ESWITCH_LEGACY);
20702070 if (err) {
20712071 NL_SET_ERR_MSG_MOD(extack, "Failed setting eswitch to legacy");
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c+1−1
@@ -35,7 +35,7 @@ · 34 unmodified lines
3535 static const unsigned int ESW_POOLS[] = { 4 * 1024 * 1024,
3636 1 * 1024 * 1024,
3737 64 * 1024,
38− 4 * 1024, };
38+ 128 };
3939
4040 struct mlx5_esw_chains_priv {
4141 struct rhashtable chains_ht;
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c+4−1
@@ -2307,7 +2307,9 @@ static int dr_ste_build_src_gvmi_qpn_tag(struct mlx5dr_match_param *value, · 2306 unmodified lines
23072307 struct mlx5dr_cmd_vport_cap *vport_cap;
23082308 struct mlx5dr_domain *dmn = sb->dmn;
23092309 struct mlx5dr_cmd_caps *caps;
2310+ u8 *bit_mask = sb->bit_mask;
23102311 u8 *tag = hw_ste->tag;
2312+ bool source_gvmi_set;
23112313
23122314 DR_STE_SET_TAG(src_gvmi_qp, tag, source_qp, misc, source_sqn);
23132315
@@ -2328,7 +2330,8 @@ static int dr_ste_build_src_gvmi_qpn_tag(struct mlx5dr_match_param *value, · 14 unmodified lines
23282330 if (!vport_cap)
23292331 return -EINVAL;
23302332
2331− if (vport_cap->vport_gvmi)
2333+ source_gvmi_set = MLX5_GET(ste_src_gvmi_qp, bit_mask, source_gvmi);
2334+ if (vport_cap->vport_gvmi && source_gvmi_set)
23322335 MLX5_SET(ste_src_gvmi_qp, tag, source_gvmi, vport_cap->vport_gvmi);
23332336
23342337 misc->source_eswitch_owner_vhca_id = 0;
drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c+7−2
@@ -66,15 +66,20 @@ static int mlx5_cmd_dr_create_flow_table(struct mlx5_flow_root_namespace *ns, · 65 unmodified lines
6666 struct mlx5_flow_table *next_ft)
6767 {
6868 struct mlx5dr_table *tbl;
69+ u32 flags;
6970 int err;
7071
7172 if (mlx5_dr_is_fw_table(ft->flags))
7273 return mlx5_fs_cmd_get_fw_cmds()->create_flow_table(ns, ft,
7374 log_size,
7475 next_ft);
76+ flags = ft->flags;
77+ /* turn off encap/decap if not supported for sw-str by fw */
78+ if (!MLX5_CAP_FLOWTABLE(ns->dev, sw_owner_reformat_supported))
79+ flags = ft->flags & ~(MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT |
80+ MLX5_FLOW_TABLE_TUNNEL_EN_DECAP);
7581
76− tbl = mlx5dr_table_create(ns->fs_dr_domain.dr_domain,
77− ft->level, ft->flags);
82+ tbl = mlx5dr_table_create(ns->fs_dr_domain.dr_domain, ft->level, flags);
7883 if (!tbl) {
7984 mlx5_core_err(ns->dev, "Failed creating dr flow_table\n");
8085 return -EINVAL;
drivers/net/ethernet/mellanox/mlx5/core/wq.c+30−9
@@ -94,6 +94,13 @@ void mlx5_wq_cyc_wqe_dump(struct mlx5_wq_cyc *wq, u16 ix, u8 nstrides) · 93 unmodified lines
9494 print_hex_dump(KERN_WARNING, "", DUMP_PREFIX_OFFSET, 16, 1, wqe, len, false);
9595 }
9696
97+void mlx5_wq_cyc_reset(struct mlx5_wq_cyc *wq)
98+{
99+ wq->wqe_ctr = 0;
100+ wq->cur_sz = 0;
101+ mlx5_wq_cyc_update_db_record(wq);
102+}
103+
97104 int mlx5_wq_qp_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param,
98105 void *qpc, struct mlx5_wq_qp *wq,
99106 struct mlx5_wq_ctrl *wq_ctrl)
@@ -192,6 +199,19 @@ err_db_free: · 92 unmodified lines
192199 return err;
193200 }
194201
202+static void mlx5_wq_ll_init_list(struct mlx5_wq_ll *wq)
203+{
204+ struct mlx5_wqe_srq_next_seg *next_seg;
205+ int i;
206+
207+ for (i = 0; i < wq->fbc.sz_m1; i++) {
208+ next_seg = mlx5_wq_ll_get_wqe(wq, i);
209+ next_seg->next_wqe_index = cpu_to_be16(i + 1);
210+ }
211+ next_seg = mlx5_wq_ll_get_wqe(wq, i);
212+ wq->tail_next = &next_seg->next_wqe_index;
213+}
214+
195215 int mlx5_wq_ll_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param,
196216 void *wqc, struct mlx5_wq_ll *wq,
197217 struct mlx5_wq_ctrl *wq_ctrl)
@@ -199,9 +219,7 @@ int mlx5_wq_ll_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, · 1 unmodified line
199219 u8 log_wq_stride = MLX5_GET(wq, wqc, log_wq_stride);
200220 u8 log_wq_sz = MLX5_GET(wq, wqc, log_wq_sz);
201221 struct mlx5_frag_buf_ctrl *fbc = &wq->fbc;
202− struct mlx5_wqe_srq_next_seg *next_seg;
203222 int err;
204− int i;
205223
206224 err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node);
207225 if (err) {
@@ -220,13 +238,7 @@ int mlx5_wq_ll_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, · 12 unmodified lines
220238
221239 mlx5_init_fbc(wq_ctrl->buf.frags, log_wq_stride, log_wq_sz, fbc);
222240
223− for (i = 0; i < fbc->sz_m1; i++) {
224− next_seg = mlx5_wq_ll_get_wqe(wq, i);
225− next_seg->next_wqe_index = cpu_to_be16(i + 1);
226− }
227− next_seg = mlx5_wq_ll_get_wqe(wq, i);
228− wq->tail_next = &next_seg->next_wqe_index;
229−
241+ mlx5_wq_ll_init_list(wq);
230242 wq_ctrl->mdev = mdev;
231243
232244 return 0;
@@ -237,6 +249,15 @@ err_db_free: · 4 unmodified lines
237249 return err;
238250 }
239251
252+void mlx5_wq_ll_reset(struct mlx5_wq_ll *wq)
253+{
254+ wq->head = 0;
255+ wq->wqe_ctr = 0;
256+ wq->cur_sz = 0;
257+ mlx5_wq_ll_init_list(wq);
258+ mlx5_wq_ll_update_db_record(wq);
259+}
260+
240261 void mlx5_wq_destroy(struct mlx5_wq_ctrl *wq_ctrl)
241262 {
242263 mlx5_frag_buf_free(wq_ctrl->mdev, &wq_ctrl->buf);
drivers/net/ethernet/mellanox/mlx5/core/wq.h+2−0
@@ -80,6 +80,7 @@ int mlx5_wq_cyc_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, · 79 unmodified lines
8080 void *wqc, struct mlx5_wq_cyc *wq,
8181 struct mlx5_wq_ctrl *wq_ctrl);
8282 void mlx5_wq_cyc_wqe_dump(struct mlx5_wq_cyc *wq, u16 ix, u8 nstrides);
83+void mlx5_wq_cyc_reset(struct mlx5_wq_cyc *wq);
8384
8485 int mlx5_wq_qp_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param,
8586 void *qpc, struct mlx5_wq_qp *wq,
@@ -92,6 +93,7 @@ int mlx5_cqwq_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, · 6 unmodified lines
9293 int mlx5_wq_ll_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param,
9394 void *wqc, struct mlx5_wq_ll *wq,
9495 struct mlx5_wq_ctrl *wq_ctrl);
96+void mlx5_wq_ll_reset(struct mlx5_wq_ll *wq);
9597
9698 void mlx5_wq_destroy(struct mlx5_wq_ctrl *wq_ctrl);
9799
drivers/net/ethernet/micrel/ks8851_mll.c+9−44
@@ -156,24 +156,6 @@ static int msg_enable; · 155 unmodified lines
156156 * chip is busy transferring packet data (RX/TX FIFO accesses).
157157 */
158158
159−/**
160− * ks_rdreg8 - read 8 bit register from device
161− * @ks : The chip information
162− * @offset: The register address
163− *
164− * Read a 8bit register from the chip, returning the result
165− */
166−static u8 ks_rdreg8(struct ks_net *ks, int offset)
167−{
168− u16 data;
169− u8 shift_bit = offset & 0x03;
170− u8 shift_data = (offset & 1) << 3;
171− ks->cmd_reg_cache = (u16) offset | (u16)(BE0 << shift_bit);
172− iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
173− data = ioread16(ks->hw_addr);
174− return (u8)(data >> shift_data);
175−}
176−
177159 /**
178160 * ks_rdreg16 - read 16 bit register from device
179161 * @ks : The chip information
@@ -184,27 +166,11 @@ static u8 ks_rdreg8(struct ks_net *ks, int offset) · 4 unmodified lines
184166
185167 static u16 ks_rdreg16(struct ks_net *ks, int offset)
186168 {
187− ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02));
169+ ks->cmd_reg_cache = (u16)offset | ((BE3 | BE2) >> (offset & 0x02));
188170 iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
189171 return ioread16(ks->hw_addr);
190172 }
191173
192−/**
193− * ks_wrreg8 - write 8bit register value to chip
194− * @ks: The chip information
195− * @offset: The register address
196− * @value: The value to write
197− *
198− */
199−static void ks_wrreg8(struct ks_net *ks, int offset, u8 value)
200−{
201− u8 shift_bit = (offset & 0x03);
202− u16 value_write = (u16)(value << ((offset & 1) << 3));
203− ks->cmd_reg_cache = (u16)offset | (BE0 << shift_bit);
204− iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
205− iowrite16(value_write, ks->hw_addr);
206−}
207−
208174 /**
209175 * ks_wrreg16 - write 16bit register value to chip
210176 * @ks: The chip information
@@ -215,7 +181,7 @@ static void ks_wrreg8(struct ks_net *ks, int offset, u8 value) · 4 unmodified lines
215181
216182 static void ks_wrreg16(struct ks_net *ks, int offset, u16 value)
217183 {
218− ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02));
184+ ks->cmd_reg_cache = (u16)offset | ((BE3 | BE2) >> (offset & 0x02));
219185 iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
220186 iowrite16(value, ks->hw_addr);
221187 }
@@ -231,7 +197,7 @@ static inline void ks_inblk(struct ks_net *ks, u16 *wptr, u32 len) · 9 unmodified lines
231197 {
232198 len >>= 1;
233199 while (len--)
234− *wptr++ = (u16)ioread16(ks->hw_addr);
200+ *wptr++ = be16_to_cpu(ioread16(ks->hw_addr));
235201 }
236202
237203 /**
@@ -245,7 +211,7 @@ static inline void ks_outblk(struct ks_net *ks, u16 *wptr, u32 len) · 7 unmodified lines
245211 {
246212 len >>= 1;
247213 while (len--)
248− iowrite16(*wptr++, ks->hw_addr);
214+ iowrite16(cpu_to_be16(*wptr++), ks->hw_addr);
249215 }
250216
251217 static void ks_disable_int(struct ks_net *ks)
@@ -324,8 +290,7 @@ static void ks_read_config(struct ks_net *ks) · 72 unmodified lines
324290 u16 reg_data = 0;
325291
326292 /* Regardless of bus width, 8 bit read should always work.*/
327− reg_data = ks_rdreg8(ks, KS_CCR) & 0x00FF;
328− reg_data |= ks_rdreg8(ks, KS_CCR+1) << 8;
293+ reg_data = ks_rdreg16(ks, KS_CCR);
329294
330295 /* addr/data bus are multiplexed */
331296 ks->sharedbus = (reg_data & CCR_SHARED) == CCR_SHARED;
@@ -429,7 +394,7 @@ static inline void ks_read_qmu(struct ks_net *ks, u16 *buf, u32 len) · 97 unmodified lines
429394
430395 /* 1. set sudo DMA mode */
431396 ks_wrreg16(ks, KS_RXFDPR, RXFDPR_RXFPAI);
432− ks_wrreg8(ks, KS_RXQCR, (ks->rc_rxqcr | RXQCR_SDA) & 0xff);
397+ ks_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr | RXQCR_SDA);
433398
434399 /* 2. read prepend data */
435400 /**
@@ -446,7 +411,7 @@ static inline void ks_read_qmu(struct ks_net *ks, u16 *buf, u32 len) · 10 unmodified lines
446411 ks_inblk(ks, buf, ALIGN(len, 4));
447412
448413 /* 4. reset sudo DMA Mode */
449− ks_wrreg8(ks, KS_RXQCR, ks->rc_rxqcr);
414+ ks_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr);
450415 }
451416
452417 /**
@@ -679,13 +644,13 @@ static void ks_write_qmu(struct ks_net *ks, u8 *pdata, u16 len) · 226 unmodified lines
679644 ks->txh.txw[1] = cpu_to_le16(len);
680645
681646 /* 1. set sudo-DMA mode */
682− ks_wrreg8(ks, KS_RXQCR, (ks->rc_rxqcr | RXQCR_SDA) & 0xff);
647+ ks_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr | RXQCR_SDA);
683648 /* 2. write status/lenth info */
684649 ks_outblk(ks, ks->txh.txw, 4);
685650 /* 3. write pkt data */
686651 ks_outblk(ks, (u16 *)pdata, ALIGN(len, 4));
687652 /* 4. reset sudo-DMA mode */
688− ks_wrreg8(ks, KS_RXQCR, ks->rc_rxqcr);
653+ ks_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr);
689654 /* 5. Enqueue Tx(move the pkt from TX buffer into TXQ) */
690655 ks_wrreg16(ks, KS_TXQCR, TXQCR_METFE);
691656 /* 6. wait until TXQCR_METFE is auto-cleared */
drivers/net/ethernet/mscc/ocelot_board.c+8−0
@@ -114,6 +114,14 @@ static irqreturn_t ocelot_xtr_irq_handler(int irq, void *arg) · 113 unmodified lines
114114 if (err != 4)
115115 break;
116116
117+ /* At this point the IFH was read correctly, so it is safe to
118+ * presume that there is no error. The err needs to be reset
119+ * otherwise a frame could come in CPU queue between the while
120+ * condition and the check for error later on. And in that case
121+ * the new frame is just removed and not processed.
122+ */
123+ err = 0;
124+
117125 ocelot_parse_ifh(ifh, &info);
118126
119127 ocelot_port = ocelot->ports[info.port];
drivers/net/ethernet/pensando/ionic/ionic_dev.c+7−4
@@ -103,7 +103,7 @@ int ionic_heartbeat_check(struct ionic *ionic) · 102 unmodified lines
103103 {
104104 struct ionic_dev *idev = &ionic->idev;
105105 unsigned long hb_time;
106− u32 fw_status;
106+ u8 fw_status;
107107 u32 hb;
108108
109109 /* wait a little more than one second before testing again */
@@ -111,9 +111,12 @@ int ionic_heartbeat_check(struct ionic *ionic) · 1 unmodified line
111111 if (time_before(hb_time, (idev->last_hb_time + ionic->watchdog_period)))
112112 return 0;
113113
114− /* firmware is useful only if fw_status is non-zero */
115− fw_status = ioread32(&idev->dev_info_regs->fw_status);
116− if (!fw_status)
114+ /* firmware is useful only if the running bit is set and
115+ * fw_status != 0xff (bad PCI read)
116+ */
117+ fw_status = ioread8(&idev->dev_info_regs->fw_status);
118+ if (fw_status == 0xff ||
119+ !(fw_status & IONIC_FW_STS_F_RUNNING))
117120 return -ENXIO;
118121
119122 /* early FW has no heartbeat, else FW will return non-zero */
drivers/net/ethernet/pensando/ionic/ionic_if.h+1−0
@@ -2445,6 +2445,7 @@ union ionic_dev_info_regs { · 2444 unmodified lines
24452445 u8 version;
24462446 u8 asic_type;
24472447 u8 asic_rev;
2448+#define IONIC_FW_STS_F_RUNNING 0x1
24482449 u8 fw_status;
24492450 u32 fw_heartbeat;
24502451 char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN];
drivers/net/ethernet/qlogic/qede/qede.h+2−0
@@ -163,6 +163,8 @@ struct qede_rdma_dev { · 162 unmodified lines
163163 struct list_head entry;
164164 struct list_head rdma_event_list;
165165 struct workqueue_struct *rdma_wq;
166+ struct kref refcnt;
167+ struct completion event_comp;
166168 bool exp_recovery;
167169 };
168170
drivers/net/ethernet/qlogic/qede/qede_rdma.c+28−1
@@ -59,6 +59,9 @@ static void _qede_rdma_dev_add(struct qede_dev *edev) · 58 unmodified lines
5959 static int qede_rdma_create_wq(struct qede_dev *edev)
6060 {
6161 INIT_LIST_HEAD(&edev->rdma_info.rdma_event_list);
62+ kref_init(&edev->rdma_info.refcnt);
63+ init_completion(&edev->rdma_info.event_comp);
64+
6265 edev->rdma_info.rdma_wq = create_singlethread_workqueue("rdma_wq");
6366 if (!edev->rdma_info.rdma_wq) {
6467 DP_NOTICE(edev, "qedr: Could not create workqueue\n");
@@ -83,8 +86,23 @@ static void qede_rdma_cleanup_event(struct qede_dev *edev) · 18 unmodified lines
8386 }
8487 }
8588
89+static void qede_rdma_complete_event(struct kref *ref)
90+{
91+ struct qede_rdma_dev *rdma_dev =
92+ container_of(ref, struct qede_rdma_dev, refcnt);
93+
94+ /* no more events will be added after this */
95+ complete(&rdma_dev->event_comp);
96+}
97+
8698 static void qede_rdma_destroy_wq(struct qede_dev *edev)
8799 {
100+ /* Avoid race with add_event flow, make sure it finishes before
101+ * we start accessing the list and cleaning up the work
102+ */
103+ kref_put(&edev->rdma_info.refcnt, qede_rdma_complete_event);
104+ wait_for_completion(&edev->rdma_info.event_comp);
105+
88106 qede_rdma_cleanup_event(edev);
89107 destroy_workqueue(edev->rdma_info.rdma_wq);
90108 }
@@ -310,15 +328,24 @@ static void qede_rdma_add_event(struct qede_dev *edev, · 219 unmodified lines
310328 if (!edev->rdma_info.qedr_dev)
311329 return;
312330
331+ /* We don't want the cleanup flow to start while we're allocating and
332+ * scheduling the work
333+ */
334+ if (!kref_get_unless_zero(&edev->rdma_info.refcnt))
335+ return; /* already being destroyed */
336+
313337 event_node = qede_rdma_get_free_event_node(edev);
314338 if (!event_node)
315− return;
339+ goto out;
316340
317341 event_node->event = event;
318342 event_node->ptr = edev;
319343
320344 INIT_WORK(&event_node->work, qede_rdma_handle_event);
321345 queue_work(edev->rdma_info.rdma_wq, &event_node->work);
346+
347+out:
348+ kref_put(&edev->rdma_info.refcnt, qede_rdma_complete_event);
322349 }
323350
324351 void qede_rdma_dev_event_open(struct qede_dev *edev)
drivers/net/phy/broadcom.c+2−2
@@ -410,7 +410,7 @@ static int bcm5481_config_aneg(struct phy_device *phydev) · 409 unmodified lines
410410 struct device_node *np = phydev->mdio.dev.of_node;
411411 int ret;
412412
413− /* Aneg firsly. */
413+ /* Aneg firstly. */
414414 ret = genphy_config_aneg(phydev);
415415
416416 /* Then we can set up the delay. */
@@ -463,7 +463,7 @@ static int bcm54616s_config_aneg(struct phy_device *phydev) · 46 unmodified lines
463463 {
464464 int ret;
465465
466− /* Aneg firsly. */
466+ /* Aneg firstly. */
467467 if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX)
468468 ret = genphy_c37_config_aneg(phydev);
469469 else
drivers/net/phy/mdio-bcm-iproc.c+20−0
@@ -178,6 +178,23 @@ static int iproc_mdio_remove(struct platform_device *pdev) · 177 unmodified lines
178178 return 0;
179179 }
180180
181+#ifdef CONFIG_PM_SLEEP
182+int iproc_mdio_resume(struct device *dev)
183+{
184+ struct platform_device *pdev = to_platform_device(dev);
185+ struct iproc_mdio_priv *priv = platform_get_drvdata(pdev);
186+
187+ /* restore the mii clock configuration */
188+ iproc_mdio_config_clk(priv->base);
189+
190+ return 0;
191+}
192+
193+static const struct dev_pm_ops iproc_mdio_pm_ops = {
194+ .resume = iproc_mdio_resume
195+};
196+#endif /* CONFIG_PM_SLEEP */
197+
181198 static const struct of_device_id iproc_mdio_of_match[] = {
182199 { .compatible = "brcm,iproc-mdio", },
183200 { /* sentinel */ },
@@ -188,6 +205,9 @@ static struct platform_driver iproc_mdio_driver = { · 4 unmodified lines
188205 .driver = {
189206 .name = "iproc-mdio",
190207 .of_match_table = iproc_mdio_of_match,
208+#ifdef CONFIG_PM_SLEEP
209+ .pm = &iproc_mdio_pm_ops,
210+#endif
191211 },
192212 .probe = iproc_mdio_probe,
193213 .remove = iproc_mdio_remove,
drivers/net/wireguard/device.c+4−3
@@ -258,6 +258,8 @@ static void wg_setup(struct net_device *dev) · 257 unmodified lines
258258 enum { WG_NETDEV_FEATURES = NETIF_F_HW_CSUM | NETIF_F_RXCSUM |
259259 NETIF_F_SG | NETIF_F_GSO |
260260 NETIF_F_GSO_SOFTWARE | NETIF_F_HIGHDMA };
261+ const int overhead = MESSAGE_MINIMUM_LENGTH + sizeof(struct udphdr) +
262+ max(sizeof(struct ipv6hdr), sizeof(struct iphdr));
261263
262264 dev->netdev_ops = &netdev_ops;
263265 dev->hard_header_len = 0;
@@ -271,9 +273,8 @@ static void wg_setup(struct net_device *dev) · 7 unmodified lines
271273 dev->features |= WG_NETDEV_FEATURES;
272274 dev->hw_features |= WG_NETDEV_FEATURES;
273275 dev->hw_enc_features |= WG_NETDEV_FEATURES;
274− dev->mtu = ETH_DATA_LEN - MESSAGE_MINIMUM_LENGTH -
275− sizeof(struct udphdr) -
276− max(sizeof(struct ipv6hdr), sizeof(struct iphdr));
276+ dev->mtu = ETH_DATA_LEN - overhead;
277+ dev->max_mtu = round_down(INT_MAX, MESSAGE_PADDING_MULTIPLE) - overhead;
277278
278279 SET_NETDEV_DEVTYPE(dev, &device_type);
279280
drivers/net/wireguard/receive.c+5−2
@@ -118,10 +118,13 @@ static void wg_receive_handshake_packet(struct wg_device *wg, · 117 unmodified lines
118118
119119 under_load = skb_queue_len(&wg->incoming_handshakes) >=
120120 MAX_QUEUED_INCOMING_HANDSHAKES / 8;
121− if (under_load)
121+ if (under_load) {
122122 last_under_load = ktime_get_coarse_boottime_ns();
123− else if (last_under_load)
123+ } else if (last_under_load) {
124124 under_load = !wg_birthdate_has_expired(last_under_load, 1);
125+ if (!under_load)
126+ last_under_load = 0;
127+ }
125128 mac_state = wg_cookie_validate_packet(&wg->cookie_checker, skb,
126129 under_load);
127130 if ((under_load && mac_state == VALID_MAC_WITH_COOKIE) ||
drivers/net/wireguard/send.c+11−5
@@ -143,16 +143,22 @@ static void keep_key_fresh(struct wg_peer *peer) · 142 unmodified lines
143143
144144 static unsigned int calculate_skb_padding(struct sk_buff *skb)
145145 {
146+ unsigned int padded_size, last_unit = skb->len;
147+
148+ if (unlikely(!PACKET_CB(skb)->mtu))
149+ return ALIGN(last_unit, MESSAGE_PADDING_MULTIPLE) - last_unit;
150+
146151 /* We do this modulo business with the MTU, just in case the networking
147152 * layer gives us a packet that's bigger than the MTU. In that case, we
148153 * wouldn't want the final subtraction to overflow in the case of the
149− * padded_size being clamped.
154+ * padded_size being clamped. Fortunately, that's very rarely the case,
155+ * so we optimize for that not happening.
150156 */
151− unsigned int last_unit = skb->len % PACKET_CB(skb)->mtu;
152− unsigned int padded_size = ALIGN(last_unit, MESSAGE_PADDING_MULTIPLE);
157+ if (unlikely(last_unit > PACKET_CB(skb)->mtu))
158+ last_unit %= PACKET_CB(skb)->mtu;
153159
154− if (padded_size > PACKET_CB(skb)->mtu)
155− padded_size = PACKET_CB(skb)->mtu;
160+ padded_size = min(PACKET_CB(skb)->mtu,
161+ ALIGN(last_unit, MESSAGE_PADDING_MULTIPLE));
156162 return padded_size - last_unit;
157163 }
158164
drivers/net/wireguard/socket.c+0−1
@@ -432,7 +432,6 @@ void wg_socket_reinit(struct wg_device *wg, struct sock *new4, · 431 unmodified lines
432432 wg->incoming_port = ntohs(inet_sk(new4)->inet_sport);
433433 mutex_unlock(&wg->socket_update_lock);
434434 synchronize_rcu();
435− synchronize_net();
436435 sock_free(old4);
437436 sock_free(old6);
438437 }
drivers/nfc/pn544/i2c.c+1−0
@@ -225,6 +225,7 @@ static void pn544_hci_i2c_platform_init(struct pn544_i2c_phy *phy) · 224 unmodified lines
225225
226226 out:
227227 gpiod_set_value_cansleep(phy->gpiod_en, !phy->en_polarity);
228+ usleep_range(10000, 15000);
228229 }
229230
230231 static void pn544_hci_i2c_enable_mode(struct pn544_i2c_phy *phy, int run_mode)
drivers/nfc/pn544/pn544.c+1−1
@@ -682,7 +682,7 @@ static int pn544_hci_tm_send(struct nfc_hci_dev *hdev, struct sk_buff *skb) · 681 unmodified lines
682682 static int pn544_hci_check_presence(struct nfc_hci_dev *hdev,
683683 struct nfc_target *target)
684684 {
685− pr_debug("supported protocol %d\b", target->supported_protocols);
685+ pr_debug("supported protocol %d\n", target->supported_protocols);
686686 if (target->supported_protocols & (NFC_PROTO_ISO14443_MASK |
687687 NFC_PROTO_ISO14443_B_MASK)) {
688688 return nfc_hci_send_cmd(hdev, target->hci_reader_gate,
drivers/s390/net/qeth_core_main.c+1−2
@@ -5344,7 +5344,7 @@ next_packet: · 5343 unmodified lines
53445344 }
53455345
53465346 use_rx_sg = (card->options.cq == QETH_CQ_ENABLED) ||
5347− ((skb_len >= card->options.rx_sg_cb) &&
5347+ (skb_len > card->options.rx_sg_cb &&
53485348 !atomic_read(&card->force_alloc_skb) &&
53495349 !IS_OSN(card));
53505350
@@ -5447,7 +5447,6 @@ static int qeth_extract_skbs(struct qeth_card *card, int budget, · 96 unmodified lines
54475447 {
54485448 int work_done = 0;
54495449
5450− WARN_ON_ONCE(!budget);
54515450 *done = false;
54525451
54535452 while (budget) {
drivers/s390/net/qeth_l2_main.c+13−16
@@ -1707,15 +1707,14 @@ int qeth_l2_vnicc_set_state(struct qeth_card *card, u32 vnicc, bool state) · 1706 unmodified lines
17071707
17081708 QETH_CARD_TEXT(card, 2, "vniccsch");
17091709
1710− /* do not change anything if BridgePort is enabled */
1711− if (qeth_bridgeport_is_in_use(card))
1712− return -EBUSY;
1713−
17141710 /* check if characteristic and enable/disable are supported */
17151711 if (!(card->options.vnicc.sup_chars & vnicc) ||
17161712 !(card->options.vnicc.set_char_sup & vnicc))
17171713 return -EOPNOTSUPP;
17181714
1715+ if (qeth_bridgeport_is_in_use(card))
1716+ return -EBUSY;
1717+
17191718 /* set enable/disable command and store wanted characteristic */
17201719 if (state) {
17211720 cmd = IPA_VNICC_ENABLE;
@@ -1761,14 +1760,13 @@ int qeth_l2_vnicc_get_state(struct qeth_card *card, u32 vnicc, bool *state) · 39 unmodified lines
17611760
17621761 QETH_CARD_TEXT(card, 2, "vniccgch");
17631762
1764− /* do not get anything if BridgePort is enabled */
1765− if (qeth_bridgeport_is_in_use(card))
1766− return -EBUSY;
1767−
17681763 /* check if characteristic is supported */
17691764 if (!(card->options.vnicc.sup_chars & vnicc))
17701765 return -EOPNOTSUPP;
17711766
1767+ if (qeth_bridgeport_is_in_use(card))
1768+ return -EBUSY;
1769+
17721770 /* if card is ready, query current VNICC state */
17731771 if (qeth_card_hw_is_reachable(card))
17741772 rc = qeth_l2_vnicc_query_chars(card);
@@ -1786,15 +1784,14 @@ int qeth_l2_vnicc_set_timeout(struct qeth_card *card, u32 timeout) · 11 unmodified lines
17861784
17871785 QETH_CARD_TEXT(card, 2, "vniccsto");
17881786
1789− /* do not change anything if BridgePort is enabled */
1790− if (qeth_bridgeport_is_in_use(card))
1791− return -EBUSY;
1792−
17931787 /* check if characteristic and set_timeout are supported */
17941788 if (!(card->options.vnicc.sup_chars & QETH_VNICC_LEARNING) ||
17951789 !(card->options.vnicc.getset_timeout_sup & QETH_VNICC_LEARNING))
17961790 return -EOPNOTSUPP;
17971791
1792+ if (qeth_bridgeport_is_in_use(card))
1793+ return -EBUSY;
1794+
17981795 /* do we need to do anything? */
17991796 if (card->options.vnicc.learning_timeout == timeout)
18001797 return rc;
@@ -1823,14 +1820,14 @@ int qeth_l2_vnicc_get_timeout(struct qeth_card *card, u32 *timeout) · 22 unmodified lines
18231820
18241821 QETH_CARD_TEXT(card, 2, "vniccgto");
18251822
1826− /* do not get anything if BridgePort is enabled */
1827− if (qeth_bridgeport_is_in_use(card))
1828− return -EBUSY;
1829−
18301823 /* check if characteristic and get_timeout are supported */
18311824 if (!(card->options.vnicc.sup_chars & QETH_VNICC_LEARNING) ||
18321825 !(card->options.vnicc.getset_timeout_sup & QETH_VNICC_LEARNING))
18331826 return -EOPNOTSUPP;
1827+
1828+ if (qeth_bridgeport_is_in_use(card))
1829+ return -EBUSY;
1830+
18341831 /* if card is ready, get timeout. Otherwise, just return stored value */
18351832 *timeout = card->options.vnicc.learning_timeout;
18361833 if (qeth_card_hw_is_reachable(card))
include/linux/mlx5/mlx5_ifc.h+4−1
@@ -688,7 +688,10 @@ struct mlx5_ifc_flow_table_nic_cap_bits { · 687 unmodified lines
688688 u8 nic_rx_multi_path_tirs[0x1];
689689 u8 nic_rx_multi_path_tirs_fts[0x1];
690690 u8 allow_sniffer_and_nic_rx_shared_tir[0x1];
691− u8 reserved_at_3[0x1d];
691+ u8 reserved_at_3[0x4];
692+ u8 sw_owner_reformat_supported[0x1];
693+ u8 reserved_at_8[0x18];
694+
692695 u8 encap_general_header[0x1];
693696 u8 reserved_at_21[0xa];
694697 u8 log_max_packet_reformat_context[0x5];
include/linux/netdevice.h+3−4
@@ -72,6 +72,8 @@ void netdev_set_default_ethtool_ops(struct net_device *dev, · 71 unmodified lines
7272 #define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
7373 #define NET_RX_DROP 1 /* packet dropped */
7474
75+#define MAX_NEST_DEV 8
76+
7577 /*
7678 * Transmit return codes: transmit return codes originate from three different
7779 * namespaces:
@@ -4389,11 +4391,8 @@ void *netdev_lower_get_next(struct net_device *dev, · 4311 unmodified lines
43894391 ldev; \
43904392 ldev = netdev_lower_get_next(dev, &(iter)))
43914393
4392−struct net_device *netdev_all_lower_get_next(struct net_device *dev,
4394+struct net_device *netdev_next_lower_dev_rcu(struct net_device *dev,
43934395 struct list_head **iter);
4394−struct net_device *netdev_all_lower_get_next_rcu(struct net_device *dev,
4395− struct list_head **iter);
4396−
43974396 int netdev_walk_all_lower_dev(struct net_device *dev,
43984397 int (*fn)(struct net_device *lower_dev,
43994398 void *data),
include/linux/rculist_nulls.h+7−0
@@ -145,6 +145,13 @@ static inline void hlist_nulls_add_tail_rcu(struct hlist_nulls_node *n, · 144 unmodified lines
145145 }
146146 }
147147
148+/* after that hlist_nulls_del will work */
149+static inline void hlist_nulls_add_fake(struct hlist_nulls_node *n)
150+{
151+ n->pprev = &n->next;
152+ n->next = (struct hlist_nulls_node *)NULLS_MARKER(NULL);
153+}
154+
148155 /**
149156 * hlist_nulls_for_each_entry_rcu - iterate over rcu list of given type
150157 * @tpos: the type * to use as a loop cursor.
include/linux/skbuff.h+30−0
@@ -611,9 +611,15 @@ typedef unsigned char *sk_buff_data_t; · 610 unmodified lines
611611 * @next: Next buffer in list
612612 * @prev: Previous buffer in list
613613 * @tstamp: Time we arrived/left
614+ * @skb_mstamp_ns: (aka @tstamp) earliest departure time; start point
615+ * for retransmit timer
614616 * @rbnode: RB tree node, alternative to next/prev for netem/tcp
617+ * @list: queue head
615618 * @sk: Socket we are owned by
619+ * @ip_defrag_offset: (aka @sk) alternate use of @sk, used in
620+ * fragmentation management
616621 * @dev: Device we arrived on/are leaving by
622+ * @dev_scratch: (aka @dev) alternate use of @dev when @dev would be %NULL
617623 * @cb: Control buffer. Free for use by every layer. Put private vars here
618624 * @_skb_refdst: destination entry (with norefcount bit)
619625 * @sp: the security path, used for xfrm
@@ -632,6 +638,9 @@ typedef unsigned char *sk_buff_data_t; · 12 unmodified lines
632638 * @pkt_type: Packet class
633639 * @fclone: skbuff clone status
634640 * @ipvs_property: skbuff is owned by ipvs
641+ * @inner_protocol_type: whether the inner protocol is
642+ * ENCAP_TYPE_ETHER or ENCAP_TYPE_IPPROTO
643+ * @remcsum_offload: remote checksum offload is enabled
635644 * @offload_fwd_mark: Packet was L2-forwarded in hardware
636645 * @offload_l3_fwd_mark: Packet was L3-forwarded in hardware
637646 * @tc_skip_classify: do not classify packet. set by IFB device
@@ -650,6 +659,8 @@ typedef unsigned char *sk_buff_data_t; · 12 unmodified lines
650659 * @tc_index: Traffic control index
651660 * @hash: the packet hash
652661 * @queue_mapping: Queue mapping for multiqueue devices
662+ * @head_frag: skb was allocated from page fragments,
663+ * not allocated by kmalloc() or vmalloc().
653664 * @pfmemalloc: skbuff was allocated from PFMEMALLOC reserves
654665 * @active_extensions: active extensions (skb_ext_id types)
655666 * @ndisc_nodetype: router type (from link layer)
@@ -660,15 +671,28 @@ typedef unsigned char *sk_buff_data_t; · 4 unmodified lines
660671 * @wifi_acked_valid: wifi_acked was set
661672 * @wifi_acked: whether frame was acked on wifi or not
662673 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS
674+ * @encapsulation: indicates the inner headers in the skbuff are valid
675+ * @encap_hdr_csum: software checksum is needed
676+ * @csum_valid: checksum is already valid
663677 * @csum_not_inet: use CRC32c to resolve CHECKSUM_PARTIAL
678+ * @csum_complete_sw: checksum was completed by software
679+ * @csum_level: indicates the number of consecutive checksums found in
680+ * the packet minus one that have been verified as
681+ * CHECKSUM_UNNECESSARY (max 3)
664682 * @dst_pending_confirm: need to confirm neighbour
665683 * @decrypted: Decrypted SKB
666684 * @napi_id: id of the NAPI struct this skb came from
685+ * @sender_cpu: (aka @napi_id) source CPU in XPS
667686 * @secmark: security marking
668687 * @mark: Generic packet mark
688+ * @reserved_tailroom: (aka @mark) number of bytes of free space available
689+ * at the tail of an sk_buff
690+ * @vlan_present: VLAN tag is present
669691 * @vlan_proto: vlan encapsulation protocol
670692 * @vlan_tci: vlan tag control information
671693 * @inner_protocol: Protocol (encapsulation)
694+ * @inner_ipproto: (aka @inner_protocol) stores ipproto when
695+ * skb->inner_protocol_type == ENCAP_TYPE_IPPROTO;
672696 * @inner_transport_header: Inner transport layer header (encapsulation)
673697 * @inner_network_header: Network layer header (encapsulation)
674698 * @inner_mac_header: Link layer header (encapsulation)
@@ -750,7 +774,9 @@ struct sk_buff { · 75 unmodified lines
750774 #endif
751775 #define CLONED_OFFSET() offsetof(struct sk_buff, __cloned_offset)
752776
777+ /* private: */
753778 __u8 __cloned_offset[0];
779+ /* public: */
754780 __u8 cloned:1,
755781 nohdr:1,
756782 fclone:2,
@@ -775,7 +801,9 @@ struct sk_buff { · 18 unmodified lines
775801 #endif
776802 #define PKT_TYPE_OFFSET() offsetof(struct sk_buff, __pkt_type_offset)
777803
804+ /* private: */
778805 __u8 __pkt_type_offset[0];
806+ /* public: */
779807 __u8 pkt_type:3;
780808 __u8 ignore_df:1;
781809 __u8 nf_trace:1;
@@ -798,7 +826,9 @@ struct sk_buff { · 16 unmodified lines
798826 #define PKT_VLAN_PRESENT_BIT 0
799827 #endif
800828 #define PKT_VLAN_PRESENT_OFFSET() offsetof(struct sk_buff, __pkt_vlan_present_offset)
829+ /* private: */
801830 __u8 __pkt_vlan_present_offset[0];
831+ /* public: */
802832 __u8 vlan_present:1;
803833 __u8 csum_complete_sw:1;
804834 __u8 csum_level:2;
include/net/flow_dissector.h+9−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 #include <linux/types.h>
66 #include <linux/in6.h>
77 #include <linux/siphash.h>
8+#include <linux/string.h>
89 #include <uapi/linux/if_ether.h>
910
1011 struct sk_buff;
@@ -348,4 +349,12 @@ struct bpf_flow_dissector { · 337 unmodified lines
348349 void *data_end;
349350 };
350351
352+static inline void
353+flow_dissector_init_keys(struct flow_dissector_key_control *key_control,
354+ struct flow_dissector_key_basic *key_basic)
355+{
356+ memset(key_control, 0, sizeof(*key_control));
357+ memset(key_basic, 0, sizeof(*key_basic));
358+}
359+
351360 #endif
include/net/sock.h+33−5
@@ -117,19 +117,26 @@ typedef __u64 __bitwise __addrpair; · 116 unmodified lines
117117 * struct sock_common - minimal network layer representation of sockets
118118 * @skc_daddr: Foreign IPv4 addr
119119 * @skc_rcv_saddr: Bound local IPv4 addr
120+ * @skc_addrpair: 8-byte-aligned __u64 union of @skc_daddr & @skc_rcv_saddr
120121 * @skc_hash: hash value used with various protocol lookup tables
121122 * @skc_u16hashes: two u16 hash values used by UDP lookup tables
122123 * @skc_dport: placeholder for inet_dport/tw_dport
123124 * @skc_num: placeholder for inet_num/tw_num
125+ * @skc_portpair: __u32 union of @skc_dport & @skc_num
124126 * @skc_family: network address family
125127 * @skc_state: Connection state
126128 * @skc_reuse: %SO_REUSEADDR setting
127129 * @skc_reuseport: %SO_REUSEPORT setting
130+ * @skc_ipv6only: socket is IPV6 only
131+ * @skc_net_refcnt: socket is using net ref counting
128132 * @skc_bound_dev_if: bound device index if != 0
129133 * @skc_bind_node: bind hash linkage for various protocol lookup tables
130134 * @skc_portaddr_node: second hash linkage for UDP/UDP-Lite protocol
131135 * @skc_prot: protocol handlers inside a network family
132136 * @skc_net: reference to the network namespace of this socket
137+ * @skc_v6_daddr: IPV6 destination address
138+ * @skc_v6_rcv_saddr: IPV6 source address
139+ * @skc_cookie: socket's cookie value
133140 * @skc_node: main hash linkage for various protocol lookup tables
134141 * @skc_nulls_node: main hash linkage for TCP/UDP/UDP-Lite protocol
135142 * @skc_tx_queue_mapping: tx queue number for this connection
@@ -137,7 +144,15 @@ typedef __u64 __bitwise __addrpair; · 1 unmodified line
137144 * @skc_flags: place holder for sk_flags
138145 * %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE,
139146 * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings
147+ * @skc_listener: connection request listener socket (aka rsk_listener)
148+ * [union with @skc_flags]
149+ * @skc_tw_dr: (aka tw_dr) ptr to &struct inet_timewait_death_row
150+ * [union with @skc_flags]
140151 * @skc_incoming_cpu: record/match cpu processing incoming packets
152+ * @skc_rcv_wnd: (aka rsk_rcv_wnd) TCP receive window size (possibly scaled)
153+ * [union with @skc_incoming_cpu]
154+ * @skc_tw_rcv_nxt: (aka tw_rcv_nxt) TCP window next expected seq number
155+ * [union with @skc_incoming_cpu]
141156 * @skc_refcnt: reference count
142157 *
143158 * This is the minimal network layer representation of sockets, the header
@@ -245,6 +260,7 @@ struct bpf_sk_storage; · 101 unmodified lines
245260 * @sk_dst_cache: destination cache
246261 * @sk_dst_pending_confirm: need to confirm neighbour
247262 * @sk_policy: flow policy
263+ * @sk_rx_skb_cache: cache copy of recently accessed RX skb
248264 * @sk_receive_queue: incoming packets
249265 * @sk_wmem_alloc: transmit queue bytes committed
250266 * @sk_tsq_flags: TCP Small Queues flags
@@ -265,6 +281,8 @@ struct bpf_sk_storage; · 14 unmodified lines
265281 * @sk_no_check_rx: allow zero checksum in RX packets
266282 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO)
267283 * @sk_route_nocaps: forbidden route capabilities (e.g NETIF_F_GSO_MASK)
284+ * @sk_route_forced_caps: static, forced route capabilities
285+ * (set in tcp_init_sock())
268286 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4)
269287 * @sk_gso_max_size: Maximum GSO segment size to build
270288 * @sk_gso_max_segs: Maximum number of GSO segments
@@ -303,6 +321,8 @@ struct bpf_sk_storage; · 32 unmodified lines
303321 * @sk_frag: cached page frag
304322 * @sk_peek_off: current peek_offset value
305323 * @sk_send_head: front of stuff to transmit
324+ * @tcp_rtx_queue: TCP re-transmit queue [union with @sk_send_head]
325+ * @sk_tx_skb_cache: cache copy of recently accessed TX skb
306326 * @sk_security: used by security modules
307327 * @sk_mark: generic packet mark
308328 * @sk_cgrp_data: cgroup data for this cgroup
@@ -313,11 +333,14 @@ struct bpf_sk_storage; · 4 unmodified lines
313333 * @sk_write_space: callback to indicate there is bf sending space available
314334 * @sk_error_report: callback to indicate errors (e.g. %MSG_ERRQUEUE)
315335 * @sk_backlog_rcv: callback to process the backlog
336+ * @sk_validate_xmit_skb: ptr to an optional validate function
316337 * @sk_destruct: called at sock freeing time, i.e. when all refcnt == 0
317338 * @sk_reuseport_cb: reuseport group container
339+ * @sk_bpf_storage: ptr to cache and control for bpf_sk_storage
318340 * @sk_rcu: used during RCU grace period
319341 * @sk_clockid: clockid used by time-based scheduling (SO_TXTIME)
320342 * @sk_txtime_deadline_mode: set deadline mode for SO_TXTIME
343+ * @sk_txtime_report_errors: set report errors mode for SO_TXTIME
321344 * @sk_txtime_unused: unused txtime flags
322345 */
323346 struct sock {
@@ -393,7 +416,9 @@ struct sock { · 69 unmodified lines
393416 struct sk_filter __rcu *sk_filter;
394417 union {
395418 struct socket_wq __rcu *sk_wq;
419+ /* private: */
396420 struct socket_wq *sk_wq_raw;
421+ /* public: */
397422 };
398423 #ifdef CONFIG_XFRM
399424 struct xfrm_policy __rcu *sk_policy[2];
@@ -2017,7 +2042,7 @@ static inline int skb_copy_to_page_nocache(struct sock *sk, struct iov_iter *fro · 1617 unmodified lines
20172042 * sk_wmem_alloc_get - returns write allocations
20182043 * @sk: socket
20192044 *
2020− * Returns sk_wmem_alloc minus initial offset of one
2045+ * Return: sk_wmem_alloc minus initial offset of one
20212046 */
20222047 static inline int sk_wmem_alloc_get(const struct sock *sk)
20232048 {
@@ -2028,7 +2053,7 @@ static inline int sk_wmem_alloc_get(const struct sock *sk) · 4 unmodified lines
20282053 * sk_rmem_alloc_get - returns read allocations
20292054 * @sk: socket
20302055 *
2031− * Returns sk_rmem_alloc
2056+ * Return: sk_rmem_alloc
20322057 */
20332058 static inline int sk_rmem_alloc_get(const struct sock *sk)
20342059 {
@@ -2039,7 +2064,7 @@ static inline int sk_rmem_alloc_get(const struct sock *sk) · 4 unmodified lines
20392064 * sk_has_allocations - check if allocations are outstanding
20402065 * @sk: socket
20412066 *
2042− * Returns true if socket has write or read allocations
2067+ * Return: true if socket has write or read allocations
20432068 */
20442069 static inline bool sk_has_allocations(const struct sock *sk)
20452070 {
@@ -2050,7 +2075,7 @@ static inline bool sk_has_allocations(const struct sock *sk) · 4 unmodified lines
20502075 * skwq_has_sleeper - check if there are any waiting processes
20512076 * @wq: struct socket_wq
20522077 *
2053− * Returns true if socket_wq has waiting processes
2078+ * Return: true if socket_wq has waiting processes
20542079 *
20552080 * The purpose of the skwq_has_sleeper and sock_poll_wait is to wrap the memory
20562081 * barrier call. They were added due to the race found within the tcp code.
@@ -2238,6 +2263,9 @@ struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp, · 181 unmodified lines
22382263 * gfpflags_allow_blocking() isn't enough here as direct reclaim may nest
22392264 * inside other socket operations and end up recursing into sk_page_frag()
22402265 * while it's already in use.
2266+ *
2267+ * Return: a per task page_frag if context allows that,
2268+ * otherwise a per socket one.
22412269 */
22422270 static inline struct page_frag *sk_page_frag(struct sock *sk)
22432271 {
@@ -2432,6 +2460,7 @@ static inline void skb_setup_tx_timestamp(struct sk_buff *skb, __u16 tsflags) · 188 unmodified lines
24322460 &skb_shinfo(skb)->tskey);
24332461 }
24342462
2463+DECLARE_STATIC_KEY_FALSE(tcp_rx_skb_cache_key);
24352464 /**
24362465 * sk_eat_skb - Release a skb if it is no longer needed
24372466 * @sk: socket to eat this skb from
@@ -2440,7 +2469,6 @@ static inline void skb_setup_tx_timestamp(struct sk_buff *skb, __u16 tsflags) · 2 unmodified lines
24402469 * This routine must be called with interrupts disabled or with the socket
24412470 * locked so that the sk_buff queue operation is ok.
24422471 */
2443−DECLARE_STATIC_KEY_FALSE(tcp_rx_skb_cache_key);
24442472 static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb)
24452473 {
24462474 __skb_unlink(skb, &sk->sk_receive_queue);
include/uapi/linux/bpf.h+7−9
@@ -1045,9 +1045,9 @@ union bpf_attr { · 1044 unmodified lines
10451045 * supports redirection to the egress interface, and accepts no
10461046 * flag at all.
10471047 *
1048− * The same effect can be attained with the more generic
1049− * **bpf_redirect_map**\ (), which requires specific maps to be
1050− * used but offers better performance.
1048+ * The same effect can also be attained with the more generic
1049+ * **bpf_redirect_map**\ (), which uses a BPF map to store the
1050+ * redirect target instead of providing it directly to the helper.
10511051 * Return
10521052 * For XDP, the helper returns **XDP_REDIRECT** on success or
10531053 * **XDP_ABORTED** on error. For other program types, the values
@@ -1611,13 +1611,11 @@ union bpf_attr { · 557 unmodified lines
16111611 * the caller. Any higher bits in the *flags* argument must be
16121612 * unset.
16131613 *
1614− * When used to redirect packets to net devices, this helper
1615− * provides a high performance increase over **bpf_redirect**\ ().
1616− * This is due to various implementation details of the underlying
1617− * mechanisms, one of which is the fact that **bpf_redirect_map**\
1618− * () tries to send packet as a "bulk" to the device.
1614+ * See also bpf_redirect(), which only supports redirecting to an
1615+ * ifindex, but doesn't require a map to do so.
16191616 * Return
1620− * **XDP_REDIRECT** on success, or **XDP_ABORTED** on error.
1617+ * **XDP_REDIRECT** on success, or the value of the two lower bits
1618+ * of the **flags* argument on error.
16211619 *
16221620 * int bpf_sk_redirect_map(struct sk_buff *skb, struct bpf_map *map, u32 key, u64 flags)
16231621 * Description
include/uapi/linux/netfilter/nf_conntrack_common.h+11−1
@@ -97,6 +97,15 @@ enum ip_conntrack_status { · 96 unmodified lines
9797 IPS_UNTRACKED_BIT = 12,
9898 IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT),
9999
100+#ifdef __KERNEL__
101+ /* Re-purposed for in-kernel use:
102+ * Tags a conntrack entry that clashed with an existing entry
103+ * on insert.
104+ */
105+ IPS_NAT_CLASH_BIT = IPS_UNTRACKED_BIT,
106+ IPS_NAT_CLASH = IPS_UNTRACKED,
107+#endif
108+
100109 /* Conntrack got a helper explicitly attached via CT target. */
101110 IPS_HELPER_BIT = 13,
102111 IPS_HELPER = (1 << IPS_HELPER_BIT),
@@ -110,7 +119,8 @@ enum ip_conntrack_status { · 7 unmodified lines
110119 */
111120 IPS_UNCHANGEABLE_MASK = (IPS_NAT_DONE_MASK | IPS_NAT_MASK |
112121 IPS_EXPECTED | IPS_CONFIRMED | IPS_DYING |
113− IPS_SEQ_ADJUST | IPS_TEMPLATE | IPS_OFFLOAD),
122+ IPS_SEQ_ADJUST | IPS_TEMPLATE | IPS_UNTRACKED |
123+ IPS_OFFLOAD),
114124
115125 __IPS_MAX_BIT = 15,
116126 };
kernel/bpf/btf.c+3−3
@@ -4142,9 +4142,9 @@ int btf_distill_func_proto(struct bpf_verifier_log *log, · 4141 unmodified lines
41424142 * EFAULT - verifier bug
41434143 * 0 - 99% match. The last 1% is validated by the verifier.
41444144 */
4145−int btf_check_func_type_match(struct bpf_verifier_log *log,
4146− struct btf *btf1, const struct btf_type *t1,
4147− struct btf *btf2, const struct btf_type *t2)
4145+static int btf_check_func_type_match(struct bpf_verifier_log *log,
4146+ struct btf *btf1, const struct btf_type *t1,
4147+ struct btf *btf2, const struct btf_type *t2)
41484148 {
41494149 const struct btf_param *args1, *args2;
41504150 const char *fn1, *fn2, *s1, *s2;
kernel/bpf/hashtab.c+53−5
@@ -56,6 +56,7 @@ struct htab_elem { · 55 unmodified lines
5656 union {
5757 struct bpf_htab *htab;
5858 struct pcpu_freelist_node fnode;
59+ struct htab_elem *batch_flink;
5960 };
6061 };
6162 };
@@ -126,6 +127,17 @@ free_elems: · 64 unmodified lines
126127 bpf_map_area_free(htab->elems);
127128 }
128129
130+/* The LRU list has a lock (lru_lock). Each htab bucket has a lock
131+ * (bucket_lock). If both locks need to be acquired together, the lock
132+ * order is always lru_lock -> bucket_lock and this only happens in
133+ * bpf_lru_list.c logic. For example, certain code path of
134+ * bpf_lru_pop_free(), which is called by function prealloc_lru_pop(),
135+ * will acquire lru_lock first followed by acquiring bucket_lock.
136+ *
137+ * In hashtab.c, to avoid deadlock, lock acquisition of
138+ * bucket_lock followed by lru_lock is not allowed. In such cases,
139+ * bucket_lock needs to be released first before acquiring lru_lock.
140+ */
129141 static struct htab_elem *prealloc_lru_pop(struct bpf_htab *htab, void *key,
130142 u32 hash)
131143 {
@@ -1256,10 +1268,12 @@ __htab_map_lookup_and_delete_batch(struct bpf_map *map, · 1124 unmodified lines
12561268 void __user *ukeys = u64_to_user_ptr(attr->batch.keys);
12571269 void *ubatch = u64_to_user_ptr(attr->batch.in_batch);
12581270 u32 batch, max_count, size, bucket_size;
1271+ struct htab_elem *node_to_free = NULL;
12591272 u64 elem_map_flags, map_flags;
12601273 struct hlist_nulls_head *head;
12611274 struct hlist_nulls_node *n;
1262− unsigned long flags;
1275+ unsigned long flags = 0;
1276+ bool locked = false;
12631277 struct htab_elem *l;
12641278 struct bucket *b;
12651279 int ret = 0;
@@ -1319,15 +1333,25 @@ again_nocopy: · 53 unmodified lines
13191333 dst_val = values;
13201334 b = &htab->buckets[batch];
13211335 head = &b->head;
1322− raw_spin_lock_irqsave(&b->lock, flags);
1336+ /* do not grab the lock unless need it (bucket_cnt > 0). */
1337+ if (locked)
1338+ raw_spin_lock_irqsave(&b->lock, flags);
13231339
13241340 bucket_cnt = 0;
13251341 hlist_nulls_for_each_entry_rcu(l, n, head, hash_node)
13261342 bucket_cnt++;
13271343
1344+ if (bucket_cnt && !locked) {
1345+ locked = true;
1346+ goto again_nocopy;
1347+ }
1348+
13281349 if (bucket_cnt > (max_count - total)) {
13291350 if (total == 0)
13301351 ret = -ENOSPC;
1352+ /* Note that since bucket_cnt > 0 here, it is implicit
1353+ * that the locked was grabbed, so release it.
1354+ */
13311355 raw_spin_unlock_irqrestore(&b->lock, flags);
13321356 rcu_read_unlock();
13331357 this_cpu_dec(bpf_prog_active);
@@ -1337,6 +1361,9 @@ again_nocopy: · 3 unmodified lines
13371361
13381362 if (bucket_cnt > bucket_size) {
13391363 bucket_size = bucket_cnt;
1364+ /* Note that since bucket_cnt > 0 here, it is implicit
1365+ * that the locked was grabbed, so release it.
1366+ */
13401367 raw_spin_unlock_irqrestore(&b->lock, flags);
13411368 rcu_read_unlock();
13421369 this_cpu_dec(bpf_prog_active);
@@ -1346,6 +1373,10 @@ again_nocopy: · 3 unmodified lines
13461373 goto alloc;
13471374 }
13481375
1376+ /* Next block is only safe to run if you have grabbed the lock */
1377+ if (!locked)
1378+ goto next_batch;
1379+
13491380 hlist_nulls_for_each_entry_safe(l, n, head, hash_node) {
13501381 memcpy(dst_key, l->key, key_size);
13511382
@@ -1370,16 +1401,33 @@ again_nocopy: · 18 unmodified lines
13701401 }
13711402 if (do_delete) {
13721403 hlist_nulls_del_rcu(&l->hash_node);
1373− if (is_lru_map)
1374− bpf_lru_push_free(&htab->lru, &l->lru_node);
1375− else
1404+
1405+ /* bpf_lru_push_free() will acquire lru_lock, which
1406+ * may cause deadlock. See comments in function
1407+ * prealloc_lru_pop(). Let us do bpf_lru_push_free()
1408+ * after releasing the bucket lock.
1409+ */
1410+ if (is_lru_map) {
1411+ l->batch_flink = node_to_free;
1412+ node_to_free = l;
1413+ } else {
13761414 free_htab_elem(htab, l);
1415+ }
13771416 }
13781417 dst_key += key_size;
13791418 dst_val += value_size;
13801419 }
13811420
13821421 raw_spin_unlock_irqrestore(&b->lock, flags);
1422+ locked = false;
1423+
1424+ while (node_to_free) {
1425+ l = node_to_free;
1426+ node_to_free = node_to_free->batch_flink;
1427+ bpf_lru_push_free(&htab->lru, &l->lru_node);
1428+ }
1429+
1430+next_batch:
13831431 /* If we are not copying data, we can go to next bucket and avoid
13841432 * unlocking the rcu.
13851433 */
kernel/bpf/offload.c+1−1
@@ -321,7 +321,7 @@ int bpf_prog_offload_info_fill(struct bpf_prog_info *info, · 320 unmodified lines
321321
322322 ulen = info->jited_prog_len;
323323 info->jited_prog_len = aux->offload->jited_len;
324− if (info->jited_prog_len & ulen) {
324+ if (info->jited_prog_len && ulen) {
325325 uinsns = u64_to_user_ptr(info->jited_prog_insns);
326326 ulen = min_t(u32, info->jited_prog_len, ulen);
327327 if (copy_to_user(uinsns, aux->offload->jited_image, ulen)) {
net/Kconfig+0−1
@@ -189,7 +189,6 @@ config BRIDGE_NETFILTER · 188 unmodified lines
189189 depends on NETFILTER_ADVANCED
190190 select NETFILTER_FAMILY_BRIDGE
191191 select SKB_EXTENSIONS
192− default m
193192 ---help---
194193 Enabling this option will let arptables resp. iptables see bridged
195194 ARP resp. IP traffic. If you want a bridging firewall, you probably
net/bridge/br_stp.c+2−1
@@ -63,7 +63,8 @@ struct net_bridge_port *br_get_port(struct net_bridge *br, u16 port_no) · 62 unmodified lines
6363 {
6464 struct net_bridge_port *p;
6565
66− list_for_each_entry_rcu(p, &br->port_list, list) {
66+ list_for_each_entry_rcu(p, &br->port_list, list,
67+ lockdep_is_held(&br->lock)) {
6768 if (p->port_no == port_no)
6869 return p;
6970 }
net/core/dev.c+11−23
@@ -146,7 +146,6 @@ · 145 unmodified lines
146146 #include "net-sysfs.h"
147147
148148 #define MAX_GRO_SKBS 8
149−#define MAX_NEST_DEV 8
150149
151150 /* This should be increased if a protocol with a bigger head is added. */
152151 #define GRO_MAX_HEAD (MAX_HEADER + 128)
@@ -331,6 +330,12 @@ int netdev_name_node_alt_destroy(struct net_device *dev, const char *name) · 178 unmodified lines
331330 name_node = netdev_name_node_lookup(net, name);
332331 if (!name_node)
333332 return -ENOENT;
333+ /* lookup might have found our primary name or a name belonging
334+ * to another device.
335+ */
336+ if (name_node == dev->name_node || name_node->dev != dev)
337+ return -EINVAL;
338+
334339 __netdev_name_node_alt_destroy(name_node);
335340
336341 return 0;
@@ -3657,26 +3662,8 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q, · 3320 unmodified lines
36573662 qdisc_calculate_pkt_len(skb, q);
36583663
36593664 if (q->flags & TCQ_F_NOLOCK) {
3660− if ((q->flags & TCQ_F_CAN_BYPASS) && READ_ONCE(q->empty) &&
3661− qdisc_run_begin(q)) {
3662− if (unlikely(test_bit(__QDISC_STATE_DEACTIVATED,
3663− &q->state))) {
3664− __qdisc_drop(skb, &to_free);
3665− rc = NET_XMIT_DROP;
3666− goto end_run;
3667− }
3668− qdisc_bstats_cpu_update(q, skb);
3669−
3670− rc = NET_XMIT_SUCCESS;
3671− if (sch_direct_xmit(skb, q, dev, txq, NULL, true))
3672− __qdisc_run(q);
3673−
3674−end_run:
3675− qdisc_run_end(q);
3676− } else {
3677− rc = q->enqueue(skb, q, &to_free) & NET_XMIT_MASK;
3678− qdisc_run(q);
3679− }
3665+ rc = q->enqueue(skb, q, &to_free) & NET_XMIT_MASK;
3666+ qdisc_run(q);
36803667
36813668 if (unlikely(to_free))
36823669 kfree_skb_list(to_free);
@@ -7201,8 +7188,8 @@ static int __netdev_walk_all_lower_dev(struct net_device *dev, · 3518 unmodified lines
72017188 return 0;
72027189 }
72037190
7204−static struct net_device *netdev_next_lower_dev_rcu(struct net_device *dev,
7205− struct list_head **iter)
7191+struct net_device *netdev_next_lower_dev_rcu(struct net_device *dev,
7192+ struct list_head **iter)
72067193 {
72077194 struct netdev_adjacent *lower;
72087195
@@ -7214,6 +7201,7 @@ static struct net_device *netdev_next_lower_dev_rcu(struct net_device *dev, · 5 unmodified lines
72147201
72157202 return lower->dev;
72167203 }
7204+EXPORT_SYMBOL(netdev_next_lower_dev_rcu);
72177205
72187206 static u8 __netdev_upper_depth(struct net_device *dev)
72197207 {
net/core/fib_rules.c+1−1
@@ -974,7 +974,7 @@ static int fib_nl_fill_rule(struct sk_buff *skb, struct fib_rule *rule, · 973 unmodified lines
974974
975975 frh = nlmsg_data(nlh);
976976 frh->family = ops->family;
977− frh->table = rule->table;
977+ frh->table = rule->table < 256 ? rule->table : RT_TABLE_COMPAT;
978978 if (nla_put_u32(skb, FRA_TABLE, rule->table))
979979 goto nla_put_failure;
980980 if (nla_put_u32(skb, FRA_SUPPRESS_PREFIXLEN, rule->suppress_prefixlen))
net/core/rtnetlink.c+12−14
@@ -3504,27 +3504,25 @@ static int rtnl_alt_ifname(int cmd, struct net_device *dev, struct nlattr *attr, · 3503 unmodified lines
35043504 if (err)
35053505 return err;
35063506
3507− alt_ifname = nla_data(attr);
3507+ alt_ifname = nla_strdup(attr, GFP_KERNEL);
3508+ if (!alt_ifname)
3509+ return -ENOMEM;
3510+
35083511 if (cmd == RTM_NEWLINKPROP) {
3509− alt_ifname = kstrdup(alt_ifname, GFP_KERNEL);
3510− if (!alt_ifname)
3511− return -ENOMEM;
35123512 err = netdev_name_node_alt_create(dev, alt_ifname);
3513− if (err) {
3514− kfree(alt_ifname);
3515− return err;
3516− }
3513+ if (!err)
3514+ alt_ifname = NULL;
35173515 } else if (cmd == RTM_DELLINKPROP) {
35183516 err = netdev_name_node_alt_destroy(dev, alt_ifname);
3519− if (err)
3520− return err;
35213517 } else {
3522− WARN_ON(1);
3523− return 0;
3518+ WARN_ON_ONCE(1);
3519+ err = -EINVAL;
35243520 }
35253521
3526− *changed = true;
3527− return 0;
3522+ kfree(alt_ifname);
3523+ if (!err)
3524+ *changed = true;
3525+ return err;
35283526 }
35293527
35303528 static int rtnl_linkprop(int cmd, struct sk_buff *skb, struct nlmsghdr *nlh,
net/core/skbuff.c+2−4
@@ -467,7 +467,6 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int len, · 466 unmodified lines
467467 return NULL;
468468 }
469469
470− /* use OR instead of assignment to avoid clearing of bits in mask */
471470 if (pfmemalloc)
472471 skb->pfmemalloc = 1;
473472 skb->head_frag = 1;
@@ -527,7 +526,6 @@ struct sk_buff *__napi_alloc_skb(struct napi_struct *napi, unsigned int len, · 53 unmodified lines
527526 return NULL;
528527 }
529528
530− /* use OR instead of assignment to avoid clearing of bits in mask */
531529 if (nc->page.pfmemalloc)
532530 skb->pfmemalloc = 1;
533531 skb->head_frag = 1;
@@ -4805,9 +4803,9 @@ static __sum16 *skb_checksum_setup_ip(struct sk_buff *skb, · 4271 unmodified lines
48054803 typeof(IPPROTO_IP) proto,
48064804 unsigned int off)
48074805 {
4808− switch (proto) {
4809− int err;
4806+ int err;
48104807
4808+ switch (proto) {
48114809 case IPPROTO_TCP:
48124810 err = skb_maybe_pull_tail(skb, off + sizeof(struct tcphdr),
48134811 off + MAX_TCP_HDR_LEN);
net/ethtool/bitset.c+3−0
@@ -447,7 +447,10 @@ ethnl_update_bitset32_verbose(u32 *bitmap, unsigned int nbits, · 446 unmodified lines
447447 "mask only allowed in compact bitset");
448448 return -EINVAL;
449449 }
450+
450451 no_mask = tb[ETHTOOL_A_BITSET_NOMASK];
452+ if (no_mask)
453+ ethnl_bitmap32_clear(bitmap, 0, nbits, mod);
451454
452455 nla_for_each_nested(bit_attr, tb[ETHTOOL_A_BITSET_BITS], rem) {
453456 bool old_val, new_val;
net/hsr/hsr_framereg.c+2−1
@@ -155,7 +155,8 @@ static struct hsr_node *hsr_add_node(struct hsr_priv *hsr, · 154 unmodified lines
155155 new_node->seq_out[i] = seq_out;
156156
157157 spin_lock_bh(&hsr->list_lock);
158− list_for_each_entry_rcu(node, node_db, mac_list) {
158+ list_for_each_entry_rcu(node, node_db, mac_list,
159+ lockdep_is_held(&hsr->list_lock)) {
159160 if (ether_addr_equal(node->macaddress_A, addr))
160161 goto out;
161162 if (ether_addr_equal(node->macaddress_B, addr))
net/ipv4/udp.c+5−1
@@ -1857,8 +1857,12 @@ int __udp_disconnect(struct sock *sk, int flags) · 1856 unmodified lines
18571857 inet->inet_dport = 0;
18581858 sock_rps_reset_rxhash(sk);
18591859 sk->sk_bound_dev_if = 0;
1860− if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK))
1860+ if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK)) {
18611861 inet_reset_saddr(sk);
1862+ if (sk->sk_prot->rehash &&
1863+ (sk->sk_userlocks & SOCK_BINDPORT_LOCK))
1864+ sk->sk_prot->rehash(sk);
1865+ }
18621866
18631867 if (!(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) {
18641868 sk->sk_prot->unhash(sk);
net/ipv6/ip6_fib.c+4−3
@@ -1102,8 +1102,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt, · 1101 unmodified lines
11021102 found++;
11031103 break;
11041104 }
1105− if (rt_can_ecmp)
1106− fallback_ins = fallback_ins ?: ins;
1105+ fallback_ins = fallback_ins ?: ins;
11071106 goto next_iter;
11081107 }
11091108
@@ -1146,7 +1145,9 @@ next_iter: · 36 unmodified lines
11461145 }
11471146
11481147 if (fallback_ins && !found) {
1149− /* No ECMP-able route found, replace first non-ECMP one */
1148+ /* No matching route with same ecmp-able-ness found, replace
1149+ * first matching route
1150+ */
11501151 ins = fallback_ins;
11511152 iter = rcu_dereference_protected(*ins,
11521153 lockdep_is_held(&rt->fib6_table->tb6_lock));
net/ipv6/ip6_gre.c+5−3
@@ -437,8 +437,6 @@ static int ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt, · 436 unmodified lines
437437 return -ENOENT;
438438
439439 switch (type) {
440− struct ipv6_tlv_tnl_enc_lim *tel;
441− __u32 teli;
442440 case ICMPV6_DEST_UNREACH:
443441 net_dbg_ratelimited("%s: Path to destination invalid or inactive!\n",
444442 t->parms.name);
@@ -452,7 +450,10 @@ static int ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt, · 7 unmodified lines
452450 break;
453451 }
454452 return 0;
455− case ICMPV6_PARAMPROB:
453+ case ICMPV6_PARAMPROB: {
454+ struct ipv6_tlv_tnl_enc_lim *tel;
455+ __u32 teli;
456+
456457 teli = 0;
457458 if (code == ICMPV6_HDR_FIELD)
458459 teli = ip6_tnl_parse_tlv_enc_lim(skb, skb->data);
@@ -468,6 +469,7 @@ static int ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt, · 9 unmodified lines
468469 t->parms.name);
469470 }
470471 return 0;
472+ }
471473 case ICMPV6_PKT_TOOBIG:
472474 ip6_update_pmtu(skb, net, info, 0, 0, sock_net_uid(net, NULL));
473475 return 0;
net/ipv6/ip6_tunnel.c+9−4
@@ -517,8 +517,6 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt, · 516 unmodified lines
517517 err = 0;
518518
519519 switch (*type) {
520− struct ipv6_tlv_tnl_enc_lim *tel;
521− __u32 mtu, teli;
522520 case ICMPV6_DEST_UNREACH:
523521 net_dbg_ratelimited("%s: Path to destination invalid or inactive!\n",
524522 t->parms.name);
@@ -531,7 +529,10 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt, · 6 unmodified lines
531529 rel_msg = 1;
532530 }
533531 break;
534− case ICMPV6_PARAMPROB:
532+ case ICMPV6_PARAMPROB: {
533+ struct ipv6_tlv_tnl_enc_lim *tel;
534+ __u32 teli;
535+
535536 teli = 0;
536537 if ((*code) == ICMPV6_HDR_FIELD)
537538 teli = ip6_tnl_parse_tlv_enc_lim(skb, skb->data);
@@ -548,7 +549,10 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt, · 10 unmodified lines
548549 t->parms.name);
549550 }
550551 break;
551− case ICMPV6_PKT_TOOBIG:
552+ }
553+ case ICMPV6_PKT_TOOBIG: {
554+ __u32 mtu;
555+
552556 ip6_update_pmtu(skb, net, htonl(*info), 0, 0,
553557 sock_net_uid(net, NULL));
554558 mtu = *info - offset;
@@ -562,6 +566,7 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt, · 7 unmodified lines
562566 rel_msg = 1;
563567 }
564568 break;
569+ }
565570 case NDISC_REDIRECT:
566571 ip6_redirect(skb, net, skb->dev->ifindex, 0,
567572 sock_net_uid(net, NULL));
net/ipv6/route.c+1−0
@@ -5198,6 +5198,7 @@ static int ip6_route_multipath_add(struct fib6_config *cfg, · 5197 unmodified lines
51985198 */
51995199 cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL |
52005200 NLM_F_REPLACE);
5201+ cfg->fc_nlinfo.nlh->nlmsg_flags |= NLM_F_CREATE;
52015202 nhn++;
52025203 }
52035204
net/mptcp/Kconfig+1−0
@@ -4,6 +4,7 @@ config MPTCP · 3 unmodified lines
44 depends on INET
55 select SKB_EXTENSIONS
66 select CRYPTO_LIB_SHA256
7+ select CRYPTO
78 help
89 Multipath TCP (MPTCP) connections send and receive data over multiple
910 subflows in order to utilize multiple network paths. Each subflow
net/mptcp/protocol.c+19−29
@@ -755,60 +755,50 @@ static int mptcp_setsockopt(struct sock *sk, int level, int optname, · 754 unmodified lines
755755 char __user *optval, unsigned int optlen)
756756 {
757757 struct mptcp_sock *msk = mptcp_sk(sk);
758− int ret = -EOPNOTSUPP;
759758 struct socket *ssock;
760− struct sock *ssk;
761759
762760 pr_debug("msk=%p", msk);
763761
764762 /* @@ the meaning of setsockopt() when the socket is connected and
765− * there are multiple subflows is not defined.
763+ * there are multiple subflows is not yet defined. It is up to the
764+ * MPTCP-level socket to configure the subflows until the subflow
765+ * is in TCP fallback, when TCP socket options are passed through
766+ * to the one remaining subflow.
766767 */
767768 lock_sock(sk);
768− ssock = __mptcp_socket_create(msk, MPTCP_SAME_STATE);
769− if (IS_ERR(ssock)) {
770− release_sock(sk);
771− return ret;
772− }
769+ ssock = __mptcp_tcp_fallback(msk);
770+ if (ssock)
771+ return tcp_setsockopt(ssock->sk, level, optname, optval,
772+ optlen);
773773
774− ssk = ssock->sk;
775− sock_hold(ssk);
776774 release_sock(sk);
777775
778− ret = tcp_setsockopt(ssk, level, optname, optval, optlen);
779− sock_put(ssk);
780−
781− return ret;
776+ return -EOPNOTSUPP;
782777 }
783778
784779 static int mptcp_getsockopt(struct sock *sk, int level, int optname,
785780 char __user *optval, int __user *option)
786781 {
787782 struct mptcp_sock *msk = mptcp_sk(sk);
788− int ret = -EOPNOTSUPP;
789783 struct socket *ssock;
790− struct sock *ssk;
791784
792785 pr_debug("msk=%p", msk);
793786
794− /* @@ the meaning of getsockopt() when the socket is connected and
795− * there are multiple subflows is not defined.
787+ /* @@ the meaning of setsockopt() when the socket is connected and
788+ * there are multiple subflows is not yet defined. It is up to the
789+ * MPTCP-level socket to configure the subflows until the subflow
790+ * is in TCP fallback, when socket options are passed through
791+ * to the one remaining subflow.
796792 */
797793 lock_sock(sk);
798− ssock = __mptcp_socket_create(msk, MPTCP_SAME_STATE);
799− if (IS_ERR(ssock)) {
800− release_sock(sk);
801− return ret;
802− }
794+ ssock = __mptcp_tcp_fallback(msk);
795+ if (ssock)
796+ return tcp_getsockopt(ssock->sk, level, optname, optval,
797+ option);
803798
804− ssk = ssock->sk;
805− sock_hold(ssk);
806799 release_sock(sk);
807800
808− ret = tcp_getsockopt(ssk, level, optname, optval, option);
809− sock_put(ssk);
810−
811− return ret;
801+ return -EOPNOTSUPP;
812802 }
813803
814804 static int mptcp_get_port(struct sock *sk, unsigned short snum)
net/mptcp/protocol.h+2−2
@@ -56,8 +56,8 @@ · 55 unmodified lines
5656 #define MPTCP_DSS_FLAG_MASK (0x1F)
5757
5858 /* MPTCP socket flags */
59−#define MPTCP_DATA_READY BIT(0)
60−#define MPTCP_SEND_SPACE BIT(1)
59+#define MPTCP_DATA_READY 0
60+#define MPTCP_SEND_SPACE 1
6161
6262 /* MPTCP connection sock */
6363 struct mptcp_sock {
net/netfilter/nf_conntrack_core.c+164−28
@@ -894,32 +894,175 @@ static void nf_ct_acct_merge(struct nf_conn *ct, enum ip_conntrack_info ctinfo, · 893 unmodified lines
894894 }
895895 }
896896
897−/* Resolve race on insertion if this protocol allows this. */
897+static void __nf_conntrack_insert_prepare(struct nf_conn *ct)
898+{
899+ struct nf_conn_tstamp *tstamp;
900+
901+ atomic_inc(&ct->ct_general.use);
902+ ct->status |= IPS_CONFIRMED;
903+
904+ /* set conntrack timestamp, if enabled. */
905+ tstamp = nf_conn_tstamp_find(ct);
906+ if (tstamp)
907+ tstamp->start = ktime_get_real_ns();
908+}
909+
910+static int __nf_ct_resolve_clash(struct sk_buff *skb,
911+ struct nf_conntrack_tuple_hash *h)
912+{
913+ /* This is the conntrack entry already in hashes that won race. */
914+ struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(h);
915+ enum ip_conntrack_info ctinfo;
916+ struct nf_conn *loser_ct;
917+
918+ loser_ct = nf_ct_get(skb, &ctinfo);
919+
920+ if (nf_ct_is_dying(ct))
921+ return NF_DROP;
922+
923+ if (!atomic_inc_not_zero(&ct->ct_general.use))
924+ return NF_DROP;
925+
926+ if (((ct->status & IPS_NAT_DONE_MASK) == 0) ||
927+ nf_ct_match(ct, loser_ct)) {
928+ struct net *net = nf_ct_net(ct);
929+
930+ nf_ct_acct_merge(ct, ctinfo, loser_ct);
931+ nf_ct_add_to_dying_list(loser_ct);
932+ nf_conntrack_put(&loser_ct->ct_general);
933+ nf_ct_set(skb, ct, ctinfo);
934+
935+ NF_CT_STAT_INC(net, insert_failed);
936+ return NF_ACCEPT;
937+ }
938+
939+ nf_ct_put(ct);
940+ return NF_DROP;
941+}
942+
943+/**
944+ * nf_ct_resolve_clash_harder - attempt to insert clashing conntrack entry
945+ *
946+ * @skb: skb that causes the collision
947+ * @repl_idx: hash slot for reply direction
948+ *
949+ * Called when origin or reply direction had a clash.
950+ * The skb can be handled without packet drop provided the reply direction
951+ * is unique or there the existing entry has the identical tuple in both
952+ * directions.
953+ *
954+ * Caller must hold conntrack table locks to prevent concurrent updates.
955+ *
956+ * Returns NF_DROP if the clash could not be handled.
957+ */
958+static int nf_ct_resolve_clash_harder(struct sk_buff *skb, u32 repl_idx)
959+{
960+ struct nf_conn *loser_ct = (struct nf_conn *)skb_nfct(skb);
961+ const struct nf_conntrack_zone *zone;
962+ struct nf_conntrack_tuple_hash *h;
963+ struct hlist_nulls_node *n;
964+ struct net *net;
965+
966+ zone = nf_ct_zone(loser_ct);
967+ net = nf_ct_net(loser_ct);
968+
969+ /* Reply direction must never result in a clash, unless both origin
970+ * and reply tuples are identical.
971+ */
972+ hlist_nulls_for_each_entry(h, n, &nf_conntrack_hash[repl_idx], hnnode) {
973+ if (nf_ct_key_equal(h,
974+ &loser_ct->tuplehash[IP_CT_DIR_REPLY].tuple,
975+ zone, net))
976+ return __nf_ct_resolve_clash(skb, h);
977+ }
978+
979+ /* We want the clashing entry to go away real soon: 1 second timeout. */
980+ loser_ct->timeout = nfct_time_stamp + HZ;
981+
982+ /* IPS_NAT_CLASH removes the entry automatically on the first
983+ * reply. Also prevents UDP tracker from moving the entry to
984+ * ASSURED state, i.e. the entry can always be evicted under
985+ * pressure.
986+ */
987+ loser_ct->status |= IPS_FIXED_TIMEOUT | IPS_NAT_CLASH;
988+
989+ __nf_conntrack_insert_prepare(loser_ct);
990+
991+ /* fake add for ORIGINAL dir: we want lookups to only find the entry
992+ * already in the table. This also hides the clashing entry from
993+ * ctnetlink iteration, i.e. conntrack -L won't show them.
994+ */
995+ hlist_nulls_add_fake(&loser_ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode);
996+
997+ hlist_nulls_add_head_rcu(&loser_ct->tuplehash[IP_CT_DIR_REPLY].hnnode,
998+ &nf_conntrack_hash[repl_idx]);
999+ return NF_ACCEPT;
1000+}
1001+
1002+/**
1003+ * nf_ct_resolve_clash - attempt to handle clash without packet drop
1004+ *
1005+ * @skb: skb that causes the clash
1006+ * @h: tuplehash of the clashing entry already in table
1007+ * @hash_reply: hash slot for reply direction
1008+ *
1009+ * A conntrack entry can be inserted to the connection tracking table
1010+ * if there is no existing entry with an identical tuple.
1011+ *
1012+ * If there is one, @skb (and the assocated, unconfirmed conntrack) has
1013+ * to be dropped. In case @skb is retransmitted, next conntrack lookup
1014+ * will find the already-existing entry.
1015+ *
1016+ * The major problem with such packet drop is the extra delay added by
1017+ * the packet loss -- it will take some time for a retransmit to occur
1018+ * (or the sender to time out when waiting for a reply).
1019+ *
1020+ * This function attempts to handle the situation without packet drop.
1021+ *
1022+ * If @skb has no NAT transformation or if the colliding entries are
1023+ * exactly the same, only the to-be-confirmed conntrack entry is discarded
1024+ * and @skb is associated with the conntrack entry already in the table.
1025+ *
1026+ * Failing that, the new, unconfirmed conntrack is still added to the table
1027+ * provided that the collision only occurs in the ORIGINAL direction.
1028+ * The new entry will be added after the existing one in the hash list,
1029+ * so packets in the ORIGINAL direction will continue to match the existing
1030+ * entry. The new entry will also have a fixed timeout so it expires --
1031+ * due to the collision, it will not see bidirectional traffic.
1032+ *
1033+ * Returns NF_DROP if the clash could not be resolved.
1034+ */
8981035 static __cold noinline int
899−nf_ct_resolve_clash(struct net *net, struct sk_buff *skb,
900− enum ip_conntrack_info ctinfo,
901− struct nf_conntrack_tuple_hash *h)
1036+nf_ct_resolve_clash(struct sk_buff *skb, struct nf_conntrack_tuple_hash *h,
1037+ u32 reply_hash)
9021038 {
9031039 /* This is the conntrack entry already in hashes that won race. */
9041040 struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(h);
9051041 const struct nf_conntrack_l4proto *l4proto;
906− enum ip_conntrack_info oldinfo;
907− struct nf_conn *loser_ct = nf_ct_get(skb, &oldinfo);
1042+ enum ip_conntrack_info ctinfo;
1043+ struct nf_conn *loser_ct;
1044+ struct net *net;
1045+ int ret;
1046+
1047+ loser_ct = nf_ct_get(skb, &ctinfo);
1048+ net = nf_ct_net(loser_ct);
9081049
9091050 l4proto = nf_ct_l4proto_find(nf_ct_protonum(ct));
910− if (l4proto->allow_clash &&
911− !nf_ct_is_dying(ct) &&
912− atomic_inc_not_zero(&ct->ct_general.use)) {
913− if (((ct->status & IPS_NAT_DONE_MASK) == 0) ||
914− nf_ct_match(ct, loser_ct)) {
915− nf_ct_acct_merge(ct, ctinfo, loser_ct);
916− nf_conntrack_put(&loser_ct->ct_general);
917− nf_ct_set(skb, ct, oldinfo);
918− return NF_ACCEPT;
919− }
920− nf_ct_put(ct);
921− }
1051+ if (!l4proto->allow_clash)
1052+ goto drop;
1053+
1054+ ret = __nf_ct_resolve_clash(skb, h);
1055+ if (ret == NF_ACCEPT)
1056+ return ret;
1057+
1058+ ret = nf_ct_resolve_clash_harder(skb, reply_hash);
1059+ if (ret == NF_ACCEPT)
1060+ return ret;
1061+
1062+drop:
1063+ nf_ct_add_to_dying_list(loser_ct);
9221064 NF_CT_STAT_INC(net, drop);
1065+ NF_CT_STAT_INC(net, insert_failed);
9231066 return NF_DROP;
9241067 }
9251068
@@ -932,7 +1075,6 @@ __nf_conntrack_confirm(struct sk_buff *skb) · 6 unmodified lines
9321075 struct nf_conntrack_tuple_hash *h;
9331076 struct nf_conn *ct;
9341077 struct nf_conn_help *help;
935− struct nf_conn_tstamp *tstamp;
9361078 struct hlist_nulls_node *n;
9371079 enum ip_conntrack_info ctinfo;
9381080 struct net *net;
@@ -989,6 +1131,7 @@ __nf_conntrack_confirm(struct sk_buff *skb) · 50 unmodified lines
9891131
9901132 if (unlikely(nf_ct_is_dying(ct))) {
9911133 nf_ct_add_to_dying_list(ct);
1134+ NF_CT_STAT_INC(net, insert_failed);
9921135 goto dying;
9931136 }
9941137
@@ -1009,13 +1152,8 @@ __nf_conntrack_confirm(struct sk_buff *skb) · 14 unmodified lines
10091152 setting time, otherwise we'd get timer wrap in
10101153 weird delay cases. */
10111154 ct->timeout += nfct_time_stamp;
1012− atomic_inc(&ct->ct_general.use);
1013− ct->status |= IPS_CONFIRMED;
10141155
1015− /* set conntrack timestamp, if enabled. */
1016− tstamp = nf_conn_tstamp_find(ct);
1017− if (tstamp)
1018− tstamp->start = ktime_get_real_ns();
1156+ __nf_conntrack_insert_prepare(ct);
10191157
10201158 /* Since the lookup is lockless, hash insertion must be done after
10211159 * starting the timer and setting the CONFIRMED bit. The RCU barriers
@@ -1035,11 +1173,9 @@ __nf_conntrack_confirm(struct sk_buff *skb) · 13 unmodified lines
10351173 return NF_ACCEPT;
10361174
10371175 out:
1038− nf_ct_add_to_dying_list(ct);
1039− ret = nf_ct_resolve_clash(net, skb, ctinfo, h);
1176+ ret = nf_ct_resolve_clash(skb, h, reply_hash);
10401177 dying:
10411178 nf_conntrack_double_unlock(hash, reply_hash);
1042− NF_CT_STAT_INC(net, insert_failed);
10431179 local_bh_enable();
10441180 return ret;
10451181 }
net/netfilter/nf_conntrack_proto_udp.c+16−4
@@ -81,6 +81,18 @@ static bool udp_error(struct sk_buff *skb, · 80 unmodified lines
8181 return false;
8282 }
8383
84+static void nf_conntrack_udp_refresh_unreplied(struct nf_conn *ct,
85+ struct sk_buff *skb,
86+ enum ip_conntrack_info ctinfo,
87+ u32 extra_jiffies)
88+{
89+ if (unlikely(ctinfo == IP_CT_ESTABLISHED_REPLY &&
90+ ct->status & IPS_NAT_CLASH))
91+ nf_ct_kill(ct);
92+ else
93+ nf_ct_refresh_acct(ct, ctinfo, skb, extra_jiffies);
94+}
95+
8496 /* Returns verdict for packet, and may modify conntracktype */
8597 int nf_conntrack_udp_packet(struct nf_conn *ct,
8698 struct sk_buff *skb,
@@ -116,8 +128,8 @@ int nf_conntrack_udp_packet(struct nf_conn *ct, · 29 unmodified lines
116128 if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status))
117129 nf_conntrack_event_cache(IPCT_ASSURED, ct);
118130 } else {
119− nf_ct_refresh_acct(ct, ctinfo, skb,
120− timeouts[UDP_CT_UNREPLIED]);
131+ nf_conntrack_udp_refresh_unreplied(ct, skb, ctinfo,
132+ timeouts[UDP_CT_UNREPLIED]);
121133 }
122134 return NF_ACCEPT;
123135 }
@@ -198,8 +210,8 @@ int nf_conntrack_udplite_packet(struct nf_conn *ct, · 74 unmodified lines
198210 if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status))
199211 nf_conntrack_event_cache(IPCT_ASSURED, ct);
200212 } else {
201− nf_ct_refresh_acct(ct, ctinfo, skb,
202− timeouts[UDP_CT_UNREPLIED]);
213+ nf_conntrack_udp_refresh_unreplied(ct, skb, ctinfo,
214+ timeouts[UDP_CT_UNREPLIED]);
203215 }
204216 return NF_ACCEPT;
205217 }
net/netfilter/nf_flow_table_offload.c+3−3
@@ -847,9 +847,6 @@ static int nf_flow_table_offload_cmd(struct flow_block_offload *bo, · 846 unmodified lines
847847 {
848848 int err;
849849
850− if (!nf_flowtable_hw_offload(flowtable))
851− return 0;
852−
853850 if (!dev->netdev_ops->ndo_setup_tc)
854851 return -EOPNOTSUPP;
855852
@@ -876,6 +873,9 @@ int nf_flow_table_offload_setup(struct nf_flowtable *flowtable, · 20 unmodified lines
876873 struct flow_block_offload bo;
877874 int err;
878875
876+ if (!nf_flowtable_hw_offload(flowtable))
877+ return 0;
878+
879879 err = nf_flow_table_offload_cmd(&bo, flowtable, dev, cmd, &extack);
880880 if (err < 0)
881881 return err;
net/netfilter/nft_set_pipapo.c+3−3
@@ -203,7 +203,7 @@ · 202 unmodified lines
203203 * ::
204204 *
205205 * rule indices in last field: 0 1
206− * map to elements: 0x42 0x66
206+ * map to elements: 0x66 0x42
207207 *
208208 *
209209 * Matching
@@ -298,7 +298,7 @@ · 88 unmodified lines
298298 * ::
299299 *
300300 * rule indices in last field: 0 1
301− * map to elements: 0x42 0x66
301+ * map to elements: 0x66 0x42
302302 *
303303 * the matching element is at 0x42.
304304 *
@@ -503,7 +503,7 @@ static int pipapo_refill(unsigned long *map, int len, int rules, · 198 unmodified lines
503503 return -1;
504504 }
505505
506− if (unlikely(match_only)) {
506+ if (match_only) {
507507 bitmap_clear(map, i, 1);
508508 return i;
509509 }
net/netfilter/xt_hashlimit.c+16−6
@@ -36,6 +36,7 @@ · 35 unmodified lines
3636 #include <linux/netfilter_ipv6/ip6_tables.h>
3737 #include <linux/mutex.h>
3838 #include <linux/kernel.h>
39+#include <linux/refcount.h>
3940 #include <uapi/linux/netfilter/xt_hashlimit.h>
4041
4142 #define XT_HASHLIMIT_ALL (XT_HASHLIMIT_HASH_DIP | XT_HASHLIMIT_HASH_DPT | \
@@ -114,7 +115,7 @@ struct dsthash_ent { · 72 unmodified lines
114115
115116 struct xt_hashlimit_htable {
116117 struct hlist_node node; /* global list of all htables */
117− int use;
118+ refcount_t use;
118119 u_int8_t family;
119120 bool rnd_initialized;
120121
@@ -315,7 +316,7 @@ static int htable_create(struct net *net, struct hashlimit_cfg3 *cfg, · 194 unmodified lines
315316 for (i = 0; i < hinfo->cfg.size; i++)
316317 INIT_HLIST_HEAD(&hinfo->hash[i]);
317318
318− hinfo->use = 1;
319+ refcount_set(&hinfo->use, 1);
319320 hinfo->count = 0;
320321 hinfo->family = family;
321322 hinfo->rnd_initialized = false;
@@ -420,7 +421,7 @@ static struct xt_hashlimit_htable *htable_find_get(struct net *net, · 98 unmodified lines
420421 hlist_for_each_entry(hinfo, &hashlimit_net->htables, node) {
421422 if (!strcmp(name, hinfo->name) &&
422423 hinfo->family == family) {
423− hinfo->use++;
424+ refcount_inc(&hinfo->use);
424425 return hinfo;
425426 }
426427 }
@@ -429,12 +430,11 @@ static struct xt_hashlimit_htable *htable_find_get(struct net *net, · 2 unmodified lines
429430
430431 static void htable_put(struct xt_hashlimit_htable *hinfo)
431432 {
432− mutex_lock(&hashlimit_mutex);
433− if (--hinfo->use == 0) {
433+ if (refcount_dec_and_mutex_lock(&hinfo->use, &hashlimit_mutex)) {
434434 hlist_del(&hinfo->node);
435+ mutex_unlock(&hashlimit_mutex);
435436 htable_destroy(hinfo);
436437 }
437− mutex_unlock(&hashlimit_mutex);
438438 }
439439
440440 /* The algorithm used is the Simple Token Bucket Filter (TBF)
@@ -837,6 +837,8 @@ hashlimit_mt(const struct sk_buff *skb, struct xt_action_param *par) · 396 unmodified lines
837837 return hashlimit_mt_common(skb, par, hinfo, &info->cfg, 3);
838838 }
839839
840+#define HASHLIMIT_MAX_SIZE 1048576
841+
840842 static int hashlimit_mt_check_common(const struct xt_mtchk_param *par,
841843 struct xt_hashlimit_htable **hinfo,
842844 struct hashlimit_cfg3 *cfg,
@@ -847,6 +849,14 @@ static int hashlimit_mt_check_common(const struct xt_mtchk_param *par, · 4 unmodified lines
847849
848850 if (cfg->gc_interval == 0 || cfg->expire == 0)
849851 return -EINVAL;
852+ if (cfg->size > HASHLIMIT_MAX_SIZE) {
853+ cfg->size = HASHLIMIT_MAX_SIZE;
854+ pr_info_ratelimited("size too large, truncated to %u\n", cfg->size);
855+ }
856+ if (cfg->max > HASHLIMIT_MAX_SIZE) {
857+ cfg->max = HASHLIMIT_MAX_SIZE;
858+ pr_info_ratelimited("max too large, truncated to %u\n", cfg->max);
859+ }
850860 if (par->family == NFPROTO_IPV4) {
851861 if (cfg->srcmask > 32 || cfg->dstmask > 32)
852862 return -EINVAL;
net/netlabel/netlabel_domainhash.c+2−1
@@ -143,7 +143,8 @@ static struct netlbl_dom_map *netlbl_domhsh_search(const char *domain, · 142 unmodified lines
143143 if (domain != NULL) {
144144 bkt = netlbl_domhsh_hash(domain);
145145 bkt_list = &netlbl_domhsh_rcu_deref(netlbl_domhsh)->tbl[bkt];
146− list_for_each_entry_rcu(iter, bkt_list, list)
146+ list_for_each_entry_rcu(iter, bkt_list, list,
147+ lockdep_is_held(&netlbl_domhsh_lock))
147148 if (iter->valid &&
148149 netlbl_family_match(iter->family, family) &&
149150 strcmp(iter->domain, domain) == 0)
net/netlabel/netlabel_unlabeled.c+2−1
@@ -207,7 +207,8 @@ static struct netlbl_unlhsh_iface *netlbl_unlhsh_search_iface(int ifindex) · 206 unmodified lines
207207
208208 bkt = netlbl_unlhsh_hash(ifindex);
209209 bkt_list = &netlbl_unlhsh_rcu_deref(netlbl_unlhsh)->tbl[bkt];
210− list_for_each_entry_rcu(iter, bkt_list, list)
210+ list_for_each_entry_rcu(iter, bkt_list, list,
211+ lockdep_is_held(&netlbl_unlhsh_lock))
211212 if (iter->valid && iter->ifindex == ifindex)
212213 return iter;
213214
net/netlink/af_netlink.c+3−2
@@ -1014,7 +1014,8 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, · 1013 unmodified lines
10141014 if (nlk->netlink_bind && groups) {
10151015 int group;
10161016
1017− for (group = 0; group < nlk->ngroups; group++) {
1017+ /* nl_groups is a u32, so cap the maximum groups we can bind */
1018+ for (group = 0; group < BITS_PER_TYPE(u32); group++) {
10181019 if (!test_bit(group, &groups))
10191020 continue;
10201021 err = nlk->netlink_bind(net, group + 1);
@@ -1033,7 +1034,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, · 12 unmodified lines
10331034 netlink_insert(sk, nladdr->nl_pid) :
10341035 netlink_autobind(sock);
10351036 if (err) {
1036− netlink_undo_bind(nlk->ngroups, groups, sk);
1037+ netlink_undo_bind(BITS_PER_TYPE(u32), groups, sk);
10371038 goto unlock;
10381039 }
10391040 }
net/openvswitch/datapath.c+6−3
@@ -179,7 +179,8 @@ struct vport *ovs_lookup_vport(const struct datapath *dp, u16 port_no) · 178 unmodified lines
179179 struct hlist_head *head;
180180
181181 head = vport_hash_bucket(dp, port_no);
182− hlist_for_each_entry_rcu(vport, head, dp_hash_node) {
182+ hlist_for_each_entry_rcu(vport, head, dp_hash_node,
183+ lockdep_ovsl_is_held()) {
183184 if (vport->port_no == port_no)
184185 return vport;
185186 }
@@ -2042,7 +2043,8 @@ static unsigned int ovs_get_max_headroom(struct datapath *dp) · 1856 unmodified lines
20422043 int i;
20432044
20442045 for (i = 0; i < DP_VPORT_HASH_BUCKETS; i++) {
2045− hlist_for_each_entry_rcu(vport, &dp->ports[i], dp_hash_node) {
2046+ hlist_for_each_entry_rcu(vport, &dp->ports[i], dp_hash_node,
2047+ lockdep_ovsl_is_held()) {
20462048 dev = vport->dev;
20472049 dev_headroom = netdev_get_fwd_headroom(dev);
20482050 if (dev_headroom > max_headroom)
@@ -2061,7 +2063,8 @@ static void ovs_update_headroom(struct datapath *dp, unsigned int new_headroom) · 12 unmodified lines
20612063
20622064 dp->max_headroom = new_headroom;
20632065 for (i = 0; i < DP_VPORT_HASH_BUCKETS; i++)
2064− hlist_for_each_entry_rcu(vport, &dp->ports[i], dp_hash_node)
2066+ hlist_for_each_entry_rcu(vport, &dp->ports[i], dp_hash_node,
2067+ lockdep_ovsl_is_held())
20652068 netdev_set_rx_headroom(vport->dev, new_headroom);
20662069 }
20672070
net/openvswitch/flow_netlink.c+10−8
@@ -2708,10 +2708,6 @@ static int validate_set(const struct nlattr *a, · 2707 unmodified lines
27082708 return -EINVAL;
27092709
27102710 switch (key_type) {
2711− const struct ovs_key_ipv4 *ipv4_key;
2712− const struct ovs_key_ipv6 *ipv6_key;
2713− int err;
2714−
27152711 case OVS_KEY_ATTR_PRIORITY:
27162712 case OVS_KEY_ATTR_SKB_MARK:
27172713 case OVS_KEY_ATTR_CT_MARK:
@@ -2723,7 +2719,9 @@ static int validate_set(const struct nlattr *a, · 5 unmodified lines
27232719 return -EINVAL;
27242720 break;
27252721
2726− case OVS_KEY_ATTR_TUNNEL:
2722+ case OVS_KEY_ATTR_TUNNEL: {
2723+ int err;
2724+
27272725 if (masked)
27282726 return -EINVAL; /* Masked tunnel set not supported. */
27292727
@@ -2732,8 +2730,10 @@ static int validate_set(const struct nlattr *a, · 2 unmodified lines
27322730 if (err)
27332731 return err;
27342732 break;
2733+ }
2734+ case OVS_KEY_ATTR_IPV4: {
2735+ const struct ovs_key_ipv4 *ipv4_key;
27352736
2736− case OVS_KEY_ATTR_IPV4:
27372737 if (eth_type != htons(ETH_P_IP))
27382738 return -EINVAL;
27392739
@@ -2753,8 +2753,10 @@ static int validate_set(const struct nlattr *a, · 13 unmodified lines
27532753 return -EINVAL;
27542754 }
27552755 break;
2756+ }
2757+ case OVS_KEY_ATTR_IPV6: {
2758+ const struct ovs_key_ipv6 *ipv6_key;
27562759
2757− case OVS_KEY_ATTR_IPV6:
27582760 if (eth_type != htons(ETH_P_IPV6))
27592761 return -EINVAL;
27602762
@@ -2781,7 +2783,7 @@ static int validate_set(const struct nlattr *a, · 20 unmodified lines
27812783 return -EINVAL;
27822784
27832785 break;
2784−
2786+ }
27852787 case OVS_KEY_ATTR_TCP:
27862788 if ((eth_type != htons(ETH_P_IP) &&
27872789 eth_type != htons(ETH_P_IPV6)) ||
net/openvswitch/flow_table.c+4−2
@@ -585,7 +585,8 @@ static struct sw_flow *masked_flow_lookup(struct table_instance *ti, · 584 unmodified lines
585585 head = find_bucket(ti, hash);
586586 (*n_mask_hit)++;
587587
588− hlist_for_each_entry_rcu(flow, head, flow_table.node[ti->node_ver]) {
588+ hlist_for_each_entry_rcu(flow, head, flow_table.node[ti->node_ver],
589+ lockdep_ovsl_is_held()) {
589590 if (flow->mask == mask && flow->flow_table.hash == hash &&
590591 flow_cmp_masked_key(flow, &masked_key, &mask->range))
591592 return flow;
@@ -769,7 +770,8 @@ struct sw_flow *ovs_flow_tbl_lookup_ufid(struct flow_table *tbl, · 177 unmodified lines
769770
770771 hash = ufid_hash(ufid);
771772 head = find_bucket(ti, hash);
772− hlist_for_each_entry_rcu(flow, head, ufid_table.node[ti->node_ver]) {
773+ hlist_for_each_entry_rcu(flow, head, ufid_table.node[ti->node_ver],
774+ lockdep_ovsl_is_held()) {
773775 if (flow->ufid_table.hash == hash &&
774776 ovs_flow_cmp_ufid(flow, ufid))
775777 return flow;
net/openvswitch/meter.c+2−1
@@ -61,7 +61,8 @@ static struct dp_meter *lookup_meter(const struct datapath *dp, · 60 unmodified lines
6161 struct hlist_head *head;
6262
6363 head = meter_hash_bucket(dp, meter_id);
64− hlist_for_each_entry_rcu(meter, head, dp_hash_node) {
64+ hlist_for_each_entry_rcu(meter, head, dp_hash_node,
65+ lockdep_ovsl_is_held()) {
6566 if (meter->id == meter_id)
6667 return meter;
6768 }
net/openvswitch/vport.c+2−1
@@ -96,7 +96,8 @@ struct vport *ovs_vport_locate(const struct net *net, const char *name) · 95 unmodified lines
9696 struct hlist_head *bucket = hash_bucket(net, name);
9797 struct vport *vport;
9898
99− hlist_for_each_entry_rcu(vport, bucket, hash_node)
99+ hlist_for_each_entry_rcu(vport, bucket, hash_node,
100+ lockdep_ovsl_is_held())
100101 if (!strcmp(name, ovs_vport_name(vport)) &&
101102 net_eq(ovs_dp_get_net(vport->dp), net))
102103 return vport;
net/rds/rdma.c+12−12
@@ -162,10 +162,9 @@ static int rds_pin_pages(unsigned long user_addr, unsigned int nr_pages, · 161 unmodified lines
162162 if (write)
163163 gup_flags |= FOLL_WRITE;
164164
165− ret = get_user_pages_fast(user_addr, nr_pages, gup_flags, pages);
165+ ret = pin_user_pages_fast(user_addr, nr_pages, gup_flags, pages);
166166 if (ret >= 0 && ret < nr_pages) {
167− while (ret--)
168− put_page(pages[ret]);
167+ unpin_user_pages(pages, ret);
169168 ret = -EFAULT;
170169 }
171170
@@ -300,8 +299,7 @@ static int __rds_rdma_map(struct rds_sock *rs, struct rds_get_mr_args *args, · 128 unmodified lines
300299 * to release anything.
301300 */
302301 if (!need_odp) {
303− for (i = 0 ; i < nents; i++)
304− put_page(sg_page(&sg[i]));
302+ unpin_user_pages(pages, nr_pages);
305303 kfree(sg);
306304 }
307305 ret = PTR_ERR(trans_private);
@@ -325,7 +323,12 @@ static int __rds_rdma_map(struct rds_sock *rs, struct rds_get_mr_args *args, · 17 unmodified lines
325323 if (cookie_ret)
326324 *cookie_ret = cookie;
327325
328− if (args->cookie_addr && put_user(cookie, (u64 __user *)(unsigned long) args->cookie_addr)) {
326+ if (args->cookie_addr &&
327+ put_user(cookie, (u64 __user *)(unsigned long)args->cookie_addr)) {
328+ if (!need_odp) {
329+ unpin_user_pages(pages, nr_pages);
330+ kfree(sg);
331+ }
329332 ret = -EFAULT;
330333 goto out;
331334 }
@@ -496,9 +499,7 @@ void rds_rdma_free_op(struct rm_rdma_op *ro) · 164 unmodified lines
496499 * is the case for a RDMA_READ which copies from remote
497500 * to local memory
498501 */
499− if (!ro->op_write)
500− set_page_dirty(page);
501− put_page(page);
502+ unpin_user_pages_dirty_lock(&page, 1, !ro->op_write);
502503 }
503504 }
504505
@@ -515,8 +516,7 @@ void rds_atomic_free_op(struct rm_atomic_op *ao) · 10 unmodified lines
515516 /* Mark page dirty if it was possibly modified, which
516517 * is the case for a RDMA_READ which copies from remote
517518 * to local memory */
518− set_page_dirty(page);
519− put_page(page);
519+ unpin_user_pages_dirty_lock(&page, 1, true);
520520
521521 kfree(ao->op_notifier);
522522 ao->op_notifier = NULL;
@@ -944,7 +944,7 @@ int rds_cmsg_atomic(struct rds_sock *rs, struct rds_message *rm, · 421 unmodified lines
944944 return ret;
945945 err:
946946 if (page)
947− put_page(page);
947+ unpin_user_page(page);
948948 rm->atomic.op_active = 0;
949949 kfree(rm->atomic.op_notifier);
950950
net/sched/cls_flower.c+1−0
@@ -305,6 +305,7 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp, · 304 unmodified lines
305305 struct cls_fl_filter *f;
306306
307307 list_for_each_entry_rcu(mask, &head->masks, list) {
308+ flow_dissector_init_keys(&skb_key.control, &skb_key.basic);
308309 fl_clear_masked_range(&skb_key, mask);
309310
310311 skb_flow_dissect_meta(skb, &mask->dissector, &skb_key);
net/sctp/sm_statefuns.c+20−9
@@ -170,6 +170,16 @@ static inline bool sctp_chunk_length_valid(struct sctp_chunk *chunk, · 169 unmodified lines
170170 return true;
171171 }
172172
173+/* Check for format error in an ABORT chunk */
174+static inline bool sctp_err_chunk_valid(struct sctp_chunk *chunk)
175+{
176+ struct sctp_errhdr *err;
177+
178+ sctp_walk_errors(err, chunk->chunk_hdr);
179+
180+ return (void *)err == (void *)chunk->chunk_end;
181+}
182+
173183 /**********************************************************
174184 * These are the state functions for handling chunk events.
175185 **********************************************************/
@@ -2255,6 +2265,9 @@ enum sctp_disposition sctp_sf_shutdown_pending_abort( · 2079 unmodified lines
22552265 sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest))
22562266 return sctp_sf_discard_chunk(net, ep, asoc, type, arg, commands);
22572267
2268+ if (!sctp_err_chunk_valid(chunk))
2269+ return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
2270+
22582271 return __sctp_sf_do_9_1_abort(net, ep, asoc, type, arg, commands);
22592272 }
22602273
@@ -2298,6 +2311,9 @@ enum sctp_disposition sctp_sf_shutdown_sent_abort( · 37 unmodified lines
22982311 sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest))
22992312 return sctp_sf_discard_chunk(net, ep, asoc, type, arg, commands);
23002313
2314+ if (!sctp_err_chunk_valid(chunk))
2315+ return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
2316+
23012317 /* Stop the T2-shutdown timer. */
23022318 sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,
23032319 SCTP_TO(SCTP_EVENT_TIMEOUT_T2_SHUTDOWN));
@@ -2565,6 +2581,9 @@ enum sctp_disposition sctp_sf_do_9_1_abort( · 261 unmodified lines
25652581 sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest))
25662582 return sctp_sf_discard_chunk(net, ep, asoc, type, arg, commands);
25672583
2584+ if (!sctp_err_chunk_valid(chunk))
2585+ return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
2586+
25682587 return __sctp_sf_do_9_1_abort(net, ep, asoc, type, arg, commands);
25692588 }
25702589
@@ -2582,16 +2601,8 @@ static enum sctp_disposition __sctp_sf_do_9_1_abort( · 11 unmodified lines
25822601
25832602 /* See if we have an error cause code in the chunk. */
25842603 len = ntohs(chunk->chunk_hdr->length);
2585− if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr)) {
2586− struct sctp_errhdr *err;
2587−
2588− sctp_walk_errors(err, chunk->chunk_hdr);
2589− if ((void *)err != (void *)chunk->chunk_end)
2590− return sctp_sf_pdiscard(net, ep, asoc, type, arg,
2591− commands);
2592−
2604+ if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr))
25932605 error = ((struct sctp_errhdr *)chunk->skb->data)->cause;
2594− }
25952606
25962607 sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(ECONNRESET));
25972608 /* ASSOC_FAILED will DELETE_TCB. */
net/tls/tls_device.c+19−1
@@ -593,7 +593,7 @@ struct tls_record_info *tls_get_record(struct tls_offload_context_tx *context, · 592 unmodified lines
593593 u32 seq, u64 *p_record_sn)
594594 {
595595 u64 record_sn = context->hint_record_sn;
596− struct tls_record_info *info;
596+ struct tls_record_info *info, *last;
597597
598598 info = context->retransmit_hint;
599599 if (!info ||
@@ -605,6 +605,24 @@ struct tls_record_info *tls_get_record(struct tls_offload_context_tx *context, · 5 unmodified lines
605605 struct tls_record_info, list);
606606 if (!info)
607607 return NULL;
608+ /* send the start_marker record if seq number is before the
609+ * tls offload start marker sequence number. This record is
610+ * required to handle TCP packets which are before TLS offload
611+ * started.
612+ * And if it's not start marker, look if this seq number
613+ * belongs to the list.
614+ */
615+ if (likely(!tls_record_is_start_marker(info))) {
616+ /* we have the first record, get the last record to see
617+ * if this seq number belongs to the list.
618+ */
619+ last = list_last_entry(&context->records_list,
620+ struct tls_record_info, list);
621+
622+ if (!between(seq, tls_record_start_seq(info),
623+ last->end_seq))
624+ return NULL;
625+ }
608626 record_sn = context->unacked_record_sn;
609627 }
610628
net/xdp/xsk.c+2−0
@@ -217,6 +217,7 @@ static int xsk_rcv(struct xdp_sock *xs, struct xdp_buff *xdp) · 216 unmodified lines
217217 static void xsk_flush(struct xdp_sock *xs)
218218 {
219219 xskq_prod_submit(xs->rx);
220+ __xskq_cons_release(xs->umem->fq);
220221 sock_def_readable(&xs->sk);
221222 }
222223
@@ -304,6 +305,7 @@ void xsk_umem_consume_tx_done(struct xdp_umem *umem) · 81 unmodified lines
304305
305306 rcu_read_lock();
306307 list_for_each_entry_rcu(xs, &umem->xsk_list, list) {
308+ __xskq_cons_release(xs->tx);
307309 xs->sk.sk_write_space(&xs->sk);
308310 }
309311 rcu_read_unlock();
net/xdp/xsk_queue.h+2−1
@@ -271,7 +271,8 @@ static inline void xskq_cons_release(struct xsk_queue *q) · 270 unmodified lines
271271 {
272272 /* To improve performance, only update local state here.
273273 * Reflect this to global state when we get new entries
274− * from the ring in xskq_cons_get_entries().
274+ * from the ring in xskq_cons_get_entries() and whenever
275+ * Rx or Tx processing are completed in the NAPI loop.
275276 */
276277 q->cached_cons++;
277278 }
tools/include/uapi/linux/bpf.h+7−9
@@ -1045,9 +1045,9 @@ union bpf_attr { · 1044 unmodified lines
10451045 * supports redirection to the egress interface, and accepts no
10461046 * flag at all.
10471047 *
1048− * The same effect can be attained with the more generic
1049− * **bpf_redirect_map**\ (), which requires specific maps to be
1050− * used but offers better performance.
1048+ * The same effect can also be attained with the more generic
1049+ * **bpf_redirect_map**\ (), which uses a BPF map to store the
1050+ * redirect target instead of providing it directly to the helper.
10511051 * Return
10521052 * For XDP, the helper returns **XDP_REDIRECT** on success or
10531053 * **XDP_ABORTED** on error. For other program types, the values
@@ -1611,13 +1611,11 @@ union bpf_attr { · 557 unmodified lines
16111611 * the caller. Any higher bits in the *flags* argument must be
16121612 * unset.
16131613 *
1614− * When used to redirect packets to net devices, this helper
1615− * provides a high performance increase over **bpf_redirect**\ ().
1616− * This is due to various implementation details of the underlying
1617− * mechanisms, one of which is the fact that **bpf_redirect_map**\
1618− * () tries to send packet as a "bulk" to the device.
1614+ * See also bpf_redirect(), which only supports redirecting to an
1615+ * ifindex, but doesn't require a map to do so.
16191616 * Return
1620− * **XDP_REDIRECT** on success, or **XDP_ABORTED** on error.
1617+ * **XDP_REDIRECT** on success, or the value of the two lower bits
1618+ * of the **flags* argument on error.
16211619 *
16221620 * int bpf_sk_redirect_map(struct sk_buff *skb, struct bpf_map *map, u32 key, u64 flags)
16231621 * Description
tools/lib/bpf/libbpf.c+7−1
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 #include <endian.h>
2525 #include <fcntl.h>
2626 #include <errno.h>
27+#include <ctype.h>
2728 #include <asm/unistd.h>
2829 #include <linux/err.h>
2930 #include <linux/kernel.h>
@@ -1283,7 +1284,7 @@ static size_t bpf_map_mmap_sz(const struct bpf_map *map) · 1253 unmodified lines
12831284 static char *internal_map_name(struct bpf_object *obj,
12841285 enum libbpf_map_type type)
12851286 {
1286− char map_name[BPF_OBJ_NAME_LEN];
1287+ char map_name[BPF_OBJ_NAME_LEN], *p;
12871288 const char *sfx = libbpf_type_to_btf_name[type];
12881289 int sfx_len = max((size_t)7, strlen(sfx));
12891290 int pfx_len = min((size_t)BPF_OBJ_NAME_LEN - sfx_len - 1,
@@ -1292,6 +1293,11 @@ static char *internal_map_name(struct bpf_object *obj, · 2 unmodified lines
12921293 snprintf(map_name, sizeof(map_name), "%.*s%.*s", pfx_len, obj->name,
12931294 sfx_len, libbpf_type_to_btf_name[type]);
12941295
1296+ /* sanitise map name to characters allowed by kernel */
1297+ for (p = map_name; *p && p < map_name + sizeof(map_name); p++)
1298+ if (!isalnum(*p) && *p != '_' && *p != '.')
1299+ *p = '_';
1300+
12951301 return strdup(map_name);
12961302 }
12971303
tools/testing/selftests/bpf/prog_tests/select_reuseport.c+6−2
@@ -506,8 +506,10 @@ static void test_syncookie(int type, sa_family_t family) · 505 unmodified lines
506506 .pass_on_failure = 0,
507507 };
508508
509− if (type != SOCK_STREAM)
509+ if (type != SOCK_STREAM) {
510+ test__skip();
510511 return;
512+ }
511513
512514 /*
513515 * +1 for TCP-SYN and
@@ -822,8 +824,10 @@ void test_select_reuseport(void) · 308 unmodified lines
822824 goto out;
823825
824826 saved_tcp_fo = read_int_sysctl(TCP_FO_SYSCTL);
827+ if (saved_tcp_fo < 0)
828+ goto out;
825829 saved_tcp_syncookie = read_int_sysctl(TCP_SYNCOOKIE_SYSCTL);
826− if (saved_tcp_syncookie < 0 || saved_tcp_syncookie < 0)
830+ if (saved_tcp_syncookie < 0)
827831 goto out;
828832
829833 if (enable_fastopen())
tools/testing/selftests/bpf/prog_tests/sockmap_basic.c+5−0
@@ -3,6 +3,11 @@ · 2 unmodified lines
33
44 #include "test_progs.h"
55
6+#define TCP_REPAIR 19 /* TCP sock is under repair right now */
7+
8+#define TCP_REPAIR_ON 1
9+#define TCP_REPAIR_OFF_NO_WP -1 /* Turn off without window probes */
10+
611 static int connected_socket_v4(void)
712 {
813 struct sockaddr_in addr = {
tools/testing/selftests/net/fib_tests.sh+6−0
@@ -910,6 +910,12 @@ ipv6_rt_replace_mpath() · 909 unmodified lines
910910 check_route6 "2001:db8:104::/64 via 2001:db8:101::3 dev veth1 metric 1024"
911911 log_test $? 0 "Multipath with single path via multipath attribute"
912912
913+ # multipath with dev-only
914+ add_initial_route6 "nexthop via 2001:db8:101::2 nexthop via 2001:db8:103::2"
915+ run_cmd "$IP -6 ro replace 2001:db8:104::/64 dev veth1"
916+ check_route6 "2001:db8:104::/64 dev veth1 metric 1024"
917+ log_test $? 0 "Multipath with dev-only"
918+
913919 # route replace fails - invalid nexthop 1
914920 add_initial_route6 "nexthop via 2001:db8:101::2 nexthop via 2001:db8:103::2"
915921 run_cmd "$IP -6 ro replace 2001:db8:104::/64 nexthop via 2001:db8:111::3 nexthop via 2001:db8:103::3"
tools/testing/selftests/net/forwarding/mirror_gre.sh+13−12
@@ -63,22 +63,23 @@ test_span_gre_mac() · 62 unmodified lines
6363 {
6464 local tundev=$1; shift
6565 local direction=$1; shift
66− local prot=$1; shift
6766 local what=$1; shift
6867
69− local swp3mac=$(mac_get $swp3)
70− local h3mac=$(mac_get $h3)
68+ case "$direction" in
69+ ingress) local src_mac=$(mac_get $h1); local dst_mac=$(mac_get $h2)
70+ ;;
71+ egress) local src_mac=$(mac_get $h2); local dst_mac=$(mac_get $h1)
72+ ;;
73+ esac
7174
7275 RET=0
7376
7477 mirror_install $swp1 $direction $tundev "matchall $tcflags"
75− tc filter add dev $h3 ingress pref 77 prot $prot \
76− flower ip_proto 0x2f src_mac $swp3mac dst_mac $h3mac \
77− action pass
78+ icmp_capture_install h3-${tundev} "src_mac $src_mac dst_mac $dst_mac"
7879
79− mirror_test v$h1 192.0.2.1 192.0.2.2 $h3 77 10
80+ mirror_test v$h1 192.0.2.1 192.0.2.2 h3-${tundev} 100 10
8081
81− tc filter del dev $h3 ingress pref 77
82+ icmp_capture_uninstall h3-${tundev}
8283 mirror_uninstall $swp1 $direction
8384
8485 log_test "$direction $what: envelope MAC ($tcflags)"
@@ -120,14 +121,14 @@ test_ip6gretap() · 35 unmodified lines
120121
121122 test_gretap_mac()
122123 {
123− test_span_gre_mac gt4 ingress ip "mirror to gretap"
124− test_span_gre_mac gt4 egress ip "mirror to gretap"
124+ test_span_gre_mac gt4 ingress "mirror to gretap"
125+ test_span_gre_mac gt4 egress "mirror to gretap"
125126 }
126127
127128 test_ip6gretap_mac()
128129 {
129− test_span_gre_mac gt6 ingress ipv6 "mirror to ip6gretap"
130− test_span_gre_mac gt6 egress ipv6 "mirror to ip6gretap"
130+ test_span_gre_mac gt6 ingress "mirror to ip6gretap"
131+ test_span_gre_mac gt6 egress "mirror to ip6gretap"
131132 }
132133
133134 test_all()
tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh+3−3
@@ -516,9 +516,9 @@ test_tos() · 515 unmodified lines
516516 RET=0
517517
518518 tc filter add dev v1 egress pref 77 prot ip \
519− flower ip_tos 0x40 action pass
520− vxlan_ping_test $h1 192.0.2.3 "-Q 0x40" v1 egress 77 10
521− vxlan_ping_test $h1 192.0.2.3 "-Q 0x30" v1 egress 77 0
519+ flower ip_tos 0x14 action pass
520+ vxlan_ping_test $h1 192.0.2.3 "-Q 0x14" v1 egress 77 10
521+ vxlan_ping_test $h1 192.0.2.3 "-Q 0x18" v1 egress 77 0
522522 tc filter del dev v1 egress pref 77 prot ip
523523
524524 log_test "VXLAN: envelope TOS inheritance"
tools/testing/selftests/wireguard/qemu/Makefile+14−24
@@ -38,19 +38,17 @@ endef · 37 unmodified lines
3838 define file_download =
3939 $(DISTFILES_PATH)/$(1):
4040 mkdir -p $(DISTFILES_PATH)
41− flock -x $$@.lock -c '[ -f $$@ ] && exit 0; wget -O $$@.tmp $(MIRROR)$(1) || wget -O $$@.tmp $(2)$(1) || rm -f $$@.tmp'
42− if echo "$(3) $$@.tmp" | sha256sum -c -; then mv $$@.tmp $$@; else rm -f $$@.tmp; exit 71; fi
41+ flock -x $$@.lock -c '[ -f $$@ ] && exit 0; wget -O $$@.tmp $(MIRROR)$(1) || wget -O $$@.tmp $(2)$(1) || rm -f $$@.tmp; [ -f $$@.tmp ] || exit 1; if echo "$(3) $$@.tmp" | sha256sum -c -; then mv $$@.tmp $$@; else rm -f $$@.tmp; exit 71; fi'
4342 endef
4443
4544 $(eval $(call tar_download,MUSL,musl,1.1.24,.tar.gz,https://www.musl-libc.org/releases/,1370c9a812b2cf2a7d92802510cca0058cc37e66a7bedd70051f0a34015022a3))
46−$(eval $(call tar_download,LIBMNL,libmnl,1.0.4,.tar.bz2,https://www.netfilter.org/projects/libmnl/files/,171f89699f286a5854b72b91d06e8f8e3683064c5901fb09d954a9ab6f551f81))
4745 $(eval $(call tar_download,IPERF,iperf,3.7,.tar.gz,https://downloads.es.net/pub/iperf/,d846040224317caf2f75c843d309a950a7db23f9b44b94688ccbe557d6d1710c))
4846 $(eval $(call tar_download,BASH,bash,5.0,.tar.gz,https://ftp.gnu.org/gnu/bash/,b4a80f2ac66170b2913efbfb9f2594f1f76c7b1afd11f799e22035d63077fb4d))
4947 $(eval $(call tar_download,IPROUTE2,iproute2,5.4.0,.tar.xz,https://www.kernel.org/pub/linux/utils/net/iproute2/,fe97aa60a0d4c5ac830be18937e18dc3400ca713a33a89ad896ff1e3d46086ae))
5048 $(eval $(call tar_download,IPTABLES,iptables,1.8.4,.tar.bz2,https://www.netfilter.org/projects/iptables/files/,993a3a5490a544c2cbf2ef15cf7e7ed21af1845baf228318d5c36ef8827e157c))
5149 $(eval $(call tar_download,NMAP,nmap,7.80,.tar.bz2,https://nmap.org/dist/,fcfa5a0e42099e12e4bf7a68ebe6fde05553383a682e816a7ec9256ab4773faa))
5250 $(eval $(call tar_download,IPUTILS,iputils,s20190709,.tar.gz,https://github.com/iputils/iputils/archive/s20190709.tar.gz/#,a15720dd741d7538dd2645f9f516d193636ae4300ff7dbc8bfca757bf166490a))
53−$(eval $(call tar_download,WIREGUARD_TOOLS,wireguard-tools,1.0.20191226,.tar.xz,https://git.zx2c4.com/wireguard-tools/snapshot/,aa8af0fdc9872d369d8c890a84dbc2a2466b55795dccd5b47721b2d97644b04f))
51+$(eval $(call tar_download,WIREGUARD_TOOLS,wireguard-tools,1.0.20200206,.tar.xz,https://git.zx2c4.com/wireguard-tools/snapshot/,f5207248c6a3c3e3bfc9ab30b91c1897b00802ed861e1f9faaed873366078c64))
5452
5553 KERNEL_BUILD_PATH := $(BUILD_PATH)/kernel$(if $(findstring yes,$(DEBUG_KERNEL)),-debug)
5654 rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
@@ -295,21 +293,13 @@ $(IPERF_PATH)/src/iperf3: | $(IPERF_PATH)/.installed $(USERSPACE_DEPS) · 238 unmodified lines
295293 $(MAKE) -C $(IPERF_PATH)
296294 $(STRIP) -s $@
297295
298−$(LIBMNL_PATH)/.installed: $(LIBMNL_TAR)
299− flock -s $<.lock tar -C $(BUILD_PATH) -xf $<
300− touch $@
301−
302−$(LIBMNL_PATH)/src/.libs/libmnl.a: | $(LIBMNL_PATH)/.installed $(USERSPACE_DEPS)
303− cd $(LIBMNL_PATH) && ./configure --prefix=/ $(CROSS_COMPILE_FLAG) --enable-static --disable-shared
304− $(MAKE) -C $(LIBMNL_PATH)
305− sed -i 's:prefix=.*:prefix=$(LIBMNL_PATH):' $(LIBMNL_PATH)/libmnl.pc
306−
307296 $(WIREGUARD_TOOLS_PATH)/.installed: $(WIREGUARD_TOOLS_TAR)
297+ mkdir -p $(BUILD_PATH)
308298 flock -s $<.lock tar -C $(BUILD_PATH) -xf $<
309299 touch $@
310300
311−$(WIREGUARD_TOOLS_PATH)/src/wg: | $(WIREGUARD_TOOLS_PATH)/.installed $(LIBMNL_PATH)/src/.libs/libmnl.a $(USERSPACE_DEPS)
312− LDFLAGS="$(LDFLAGS) -L$(LIBMNL_PATH)/src/.libs" $(MAKE) -C $(WIREGUARD_TOOLS_PATH)/src LIBMNL_CFLAGS="-I$(LIBMNL_PATH)/include" LIBMNL_LDLIBS="-lmnl" wg
301+$(WIREGUARD_TOOLS_PATH)/src/wg: | $(WIREGUARD_TOOLS_PATH)/.installed $(USERSPACE_DEPS)
302+ $(MAKE) -C $(WIREGUARD_TOOLS_PATH)/src wg
313303 $(STRIP) -s $@
314304
315305 $(BUILD_PATH)/init: init.c | $(USERSPACE_DEPS)
@@ -340,17 +330,17 @@ $(BASH_PATH)/bash: | $(BASH_PATH)/.installed $(USERSPACE_DEPS) · 24 unmodified lines
340330 $(IPROUTE2_PATH)/.installed: $(IPROUTE2_TAR)
341331 mkdir -p $(BUILD_PATH)
342332 flock -s $<.lock tar -C $(BUILD_PATH) -xf $<
343− printf 'CC:=$(CC)\nPKG_CONFIG:=pkg-config\nTC_CONFIG_XT:=n\nTC_CONFIG_ATM:=n\nTC_CONFIG_IPSET:=n\nIP_CONFIG_SETNS:=y\nHAVE_ELF:=n\nHAVE_MNL:=y\nHAVE_BERKELEY_DB:=n\nHAVE_LATEX:=n\nHAVE_PDFLATEX:=n\nCFLAGS+=-DHAVE_SETNS -DHAVE_LIBMNL -I$(LIBMNL_PATH)/include\nLDLIBS+=-lmnl' > $(IPROUTE2_PATH)/config.mk
333+ printf 'CC:=$(CC)\nPKG_CONFIG:=pkg-config\nTC_CONFIG_XT:=n\nTC_CONFIG_ATM:=n\nTC_CONFIG_IPSET:=n\nIP_CONFIG_SETNS:=y\nHAVE_ELF:=n\nHAVE_MNL:=n\nHAVE_BERKELEY_DB:=n\nHAVE_LATEX:=n\nHAVE_PDFLATEX:=n\nCFLAGS+=-DHAVE_SETNS\n' > $(IPROUTE2_PATH)/config.mk
344334 printf 'lib: snapshot\n\t$$(MAKE) -C lib\nip/ip: lib\n\t$$(MAKE) -C ip ip\nmisc/ss: lib\n\t$$(MAKE) -C misc ss\n' >> $(IPROUTE2_PATH)/Makefile
345335 touch $@
346336
347−$(IPROUTE2_PATH)/ip/ip: | $(IPROUTE2_PATH)/.installed $(LIBMNL_PATH)/src/.libs/libmnl.a $(USERSPACE_DEPS)
348− LDFLAGS="$(LDFLAGS) -L$(LIBMNL_PATH)/src/.libs" PKG_CONFIG_LIBDIR="$(LIBMNL_PATH)" $(MAKE) -C $(IPROUTE2_PATH) PREFIX=/ ip/ip
349− $(STRIP) -s $(IPROUTE2_PATH)/ip/ip
337+$(IPROUTE2_PATH)/ip/ip: | $(IPROUTE2_PATH)/.installed $(USERSPACE_DEPS)
338+ $(MAKE) -C $(IPROUTE2_PATH) PREFIX=/ ip/ip
339+ $(STRIP) -s $@
350340
351−$(IPROUTE2_PATH)/misc/ss: | $(IPROUTE2_PATH)/.installed $(LIBMNL_PATH)/src/.libs/libmnl.a $(USERSPACE_DEPS)
352− LDFLAGS="$(LDFLAGS) -L$(LIBMNL_PATH)/src/.libs" PKG_CONFIG_LIBDIR="$(LIBMNL_PATH)" $(MAKE) -C $(IPROUTE2_PATH) PREFIX=/ misc/ss
353− $(STRIP) -s $(IPROUTE2_PATH)/misc/ss
341+$(IPROUTE2_PATH)/misc/ss: | $(IPROUTE2_PATH)/.installed $(USERSPACE_DEPS)
342+ $(MAKE) -C $(IPROUTE2_PATH) PREFIX=/ misc/ss
343+ $(STRIP) -s $@
354344
355345 $(IPTABLES_PATH)/.installed: $(IPTABLES_TAR)
356346 mkdir -p $(BUILD_PATH)
@@ -358,8 +348,8 @@ $(IPTABLES_PATH)/.installed: $(IPTABLES_TAR) · 1 unmodified line
358348 sed -i -e "/nfnetlink=[01]/s:=[01]:=0:" -e "/nfconntrack=[01]/s:=[01]:=0:" $(IPTABLES_PATH)/configure
359349 touch $@
360350
361−$(IPTABLES_PATH)/iptables/xtables-legacy-multi: | $(IPTABLES_PATH)/.installed $(LIBMNL_PATH)/src/.libs/libmnl.a $(USERSPACE_DEPS)
362− cd $(IPTABLES_PATH) && PKG_CONFIG_LIBDIR="$(LIBMNL_PATH)" ./configure --prefix=/ $(CROSS_COMPILE_FLAG) --enable-static --disable-shared --disable-nftables --disable-bpf-compiler --disable-nfsynproxy --disable-libipq --with-kernel=$(BUILD_PATH)/include
351+$(IPTABLES_PATH)/iptables/xtables-legacy-multi: | $(IPTABLES_PATH)/.installed $(USERSPACE_DEPS)
352+ cd $(IPTABLES_PATH) && ./configure --prefix=/ $(CROSS_COMPILE_FLAG) --enable-static --disable-shared --disable-nftables --disable-bpf-compiler --disable-nfsynproxy --disable-libipq --disable-connlabel --with-kernel=$(BUILD_PATH)/include
363353 $(MAKE) -C $(IPTABLES_PATH)
364354 $(STRIP) -s $@
365355