History

Merge tag 'net-6.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from Jakub Kicinski: "Including fixes from netfilter. As Paolo promised we continue to hammer out issues in our selftests. This is not the end but probably the peak. Current release - regressions: - smc: fix incorrect SMC-D link group matching logic Current release - new code bugs: - eth: bnxt: silence WARN() when device skips a timestamp, it happens Previous releases - regressions: - ipmr: fix null-deref when forwarding mcast packets - conntrack: evaluate window negotiation only for packets in the REPLY direction, otherwise SYN retransmissions trigger incorrect window scale negotiation - ipset: fix performance regression in swap operation Previous releases - always broken: - tcp: add sanity checks to types of pages getting into the rx zerocopy path, we only support basic NIC -> user, no page cache pages etc. - ip6_tunnel: make sure to pull inner header in __ip6_tnl_rcv() - nt_tables: more input sanitization changes - dsa: mt7530: fix 10M/100M speed on MediaTek MT7988 switch - bridge: mcast: fix loss of snooping after long uptime, jiffies do wrap on 32bit - xen-netback: properly sync TX responses, protect with locking - phy: mediatek-ge-soc: sync calibration values with MediaTek SDK, increase connection stability - eth: pds: fixes for various teardown, and reset races Misc: - hsr: silence WARN() if we can't alloc supervision frame, it happens" * tag 'net-6.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (82 commits) doc/netlink/specs: Add missing attr in rt_link spec idpf: avoid compiler padding in virtchnl2_ptype struct selftests: mptcp: join: stop transfer when check is done (part 2) selftests: mptcp: join: stop transfer when check is done (part 1) selftests: mptcp: allow changing subtests prefix selftests: mptcp: decrease BW in simult flows selftests: mptcp: increase timeout to 30 min selftests: mptcp: add missing kconfig for NF Mangle selftests: mptcp: add missing kconfig for NF Filter in v6 selftests: mptcp: add missing kconfig for NF Filter mptcp: fix data re-injection from stale subflow selftests: net: enable some more knobs selftests: net: add missing config for NF_TARGET_TTL selftests: forwarding: List helper scripts in TEST_FILES Makefile variable selftests: net: List helper scripts in TEST_FILES Makefile variable selftests: net: Remove executable bits from library scripts selftests: bonding: Check initial state selftests: team: Add missing config options hv_netvsc: Fix race condition between netvsc_probe and netvsc_remove xen-netback: properly sync TX responses ...

Linus Torvalds committed 2 years ago

Commit 41b9fb32 parents 91481c9 4e192be90 files · +839 −403Browse files

Unified · Split

90 files
  1. Documentation/ABI/testing/sysfs-class-net-queues +11 −11
  2. Documentation/netlink/specs/rt_link.yaml +10 −0
  3. MAINTAINERS +2 −1
  4. drivers/net/dsa/mt7530.c +1 −2
  5. drivers/net/dsa/mv88e6xxx/chip.c +1 −1
  6. drivers/net/dsa/qca/qca8k-8xxx.c +1 −2
  7. drivers/net/ethernet/amd/pds_core/adminq.c +48 −16
  8. drivers/net/ethernet/amd/pds_core/core.c +36 −10
  9. drivers/net/ethernet/amd/pds_core/core.h +1 −1
  10. drivers/net/ethernet/amd/pds_core/debugfs.c +4 −0
  11. drivers/net/ethernet/amd/pds_core/dev.c +8 −8
  12. drivers/net/ethernet/amd/pds_core/devlink.c +2 −1
  13. drivers/net/ethernet/amd/pds_core/fw.c +3 −0
  14. drivers/net/ethernet/amd/pds_core/main.c +22 −4
  15. drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +1 −1
  16. drivers/net/ethernet/google/gve/gve_rx.c +4 −4
  17. drivers/net/ethernet/intel/e1000e/e1000.h +20 −0
  18. drivers/net/ethernet/intel/e1000e/ptp.c +15 −7
  19. drivers/net/ethernet/intel/idpf/virtchnl2.h +1 −1
  20. drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +2 −1
  21. drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +0 −1
  22. drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +1 −2
  23. drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c +3 −4
  24. drivers/net/ethernet/mediatek/mtk_eth_soc.c +4 −1
  25. drivers/net/ethernet/microchip/lan966x/lan966x_port.c +3 −2
  26. drivers/net/ethernet/netronome/nfp/flower/conntrack.c +43 −3
  27. drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +4 −0
  28. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +3 −0
  29. drivers/net/hyperv/netvsc.c +4 −1
  30. drivers/net/phy/mediatek-ge-soc.c +81 −66
  31. drivers/net/xen-netback/netback.c +40 −44
  32. include/linux/netfilter/ipset/ip_set.h +4 −0
  33. include/net/af_unix.h +14 −6
  34. include/net/ip.h +1 −1
  35. include/net/netfilter/nf_tables.h +2 −0
  36. net/batman-adv/multicast.c +3 −0
  37. net/bridge/br_multicast.c +15 −5
  38. net/bridge/br_private.h +2 −2
  39. net/devlink/port.c +1 −1
  40. net/hsr/hsr_device.c +2 −2
  41. net/ipv4/ip_output.c +6 −6
  42. net/ipv4/ip_sockglue.c +4 −2
  43. net/ipv4/ipmr.c +1 −1
  44. net/ipv4/raw.c +1 −1
  45. net/ipv4/tcp.c +11 −1
  46. net/ipv4/udp.c +1 −1
  47. net/ipv6/addrconf_core.c +14 −7
  48. net/ipv6/ip6_tunnel.c +18 −3
  49. net/llc/af_llc.c +2 −0
  50. net/mptcp/protocol.c +0 −3
  51. net/netfilter/ipset/ip_set_bitmap_gen.h +11 −3
  52. net/netfilter/ipset/ip_set_core.c +28 −9
  53. net/netfilter/ipset/ip_set_hash_gen.h +12 −3
  54. net/netfilter/ipset/ip_set_list_set.c +10 −3
  55. net/netfilter/nf_conntrack_proto_sctp.c +1 −1
  56. net/netfilter/nf_conntrack_proto_tcp.c +6 −4
  57. net/netfilter/nf_log.c +4 −3
  58. net/netfilter/nf_tables_api.c +9 −5
  59. net/netfilter/nft_ct.c +24 −0
  60. net/netfilter/nft_tunnel.c +1 −0
  61. net/nfc/nci/core.c +4 −0
  62. net/smc/smc_core.c +9 −3
  63. net/unix/af_unix.c +6 −8
  64. net/unix/diag.c +1 −1
  65. tools/testing/selftests/drivers/net/bonding/lag_lib.sh +11 −0
  66. tools/testing/selftests/drivers/net/team/config +3 −1
  67. tools/testing/selftests/net/Makefile +5 −4
  68. tools/testing/selftests/net/config +16 −0
  69. tools/testing/selftests/net/forwarding/Makefile +1 −1
  70. tools/testing/selftests/net/lib.sh +4 −1
  71. tools/testing/selftests/net/mptcp/config +3 −0
  72. tools/testing/selftests/net/mptcp/mptcp_join.sh +11 −16
  73. tools/testing/selftests/net/mptcp/mptcp_lib.sh +1 −1
  74. tools/testing/selftests/net/mptcp/settings +1 −1
  75. tools/testing/selftests/net/mptcp/simult_flows.sh +4 −4
  76. tools/testing/selftests/net/net_helper.sh +0 −0
  77. tools/testing/selftests/net/pmtu.sh +9 −9
  78. tools/testing/selftests/net/setup_loopback.sh +0 −0
  79. tools/testing/selftests/net/setup_veth.sh +1 −1
  80. tools/testing/selftests/net/tcp_ao/config +10 −0
  81. tools/testing/selftests/net/tcp_ao/key-management.c +26 −20
  82. tools/testing/selftests/net/tcp_ao/lib/sock.c +8 −4
  83. tools/testing/selftests/net/tcp_ao/rst.c +90 −48
  84. tools/testing/selftests/net/tcp_ao/settings +1 −0
  85. tools/testing/selftests/net/udpgro.sh +2 −2
  86. tools/testing/selftests/net/udpgro_bench.sh +2 −2
  87. tools/testing/selftests/net/udpgro_frglist.sh +3 −3
  88. tools/testing/selftests/net/udpgro_fwd.sh +5 −3
  89. tools/testing/selftests/net/veth.sh +2 −2
  90. tools/testing/selftests/net/xdp_dummy.c +13 −0
Documentation/ABI/testing/sysfs-class-net-queues+11−11
@@ -1,4 +1,4 @@
1−What: /sys/class/<iface>/queues/rx-<queue>/rps_cpus
1+What: /sys/class/net/<iface>/queues/rx-<queue>/rps_cpus
22 Date: March 2010
33 KernelVersion: 2.6.35
44 Contact: netdev@vger.kernel.org
@@ -8,7 +8,7 @@ Description: · 3 unmodified lines
88 network device queue. Possible values depend on the number
99 of available CPU(s) in the system.
1010
11−What: /sys/class/<iface>/queues/rx-<queue>/rps_flow_cnt
11+What: /sys/class/net/<iface>/queues/rx-<queue>/rps_flow_cnt
1212 Date: April 2010
1313 KernelVersion: 2.6.35
1414 Contact: netdev@vger.kernel.org
@@ -16,7 +16,7 @@ Description: · 1 unmodified line
1616 Number of Receive Packet Steering flows being currently
1717 processed by this particular network device receive queue.
1818
19−What: /sys/class/<iface>/queues/tx-<queue>/tx_timeout
19+What: /sys/class/net/<iface>/queues/tx-<queue>/tx_timeout
2020 Date: November 2011
2121 KernelVersion: 3.3
2222 Contact: netdev@vger.kernel.org
@@ -24,7 +24,7 @@ Description: · 1 unmodified line
2424 Indicates the number of transmit timeout events seen by this
2525 network interface transmit queue.
2626
27−What: /sys/class/<iface>/queues/tx-<queue>/tx_maxrate
27+What: /sys/class/net/<iface>/queues/tx-<queue>/tx_maxrate
2828 Date: March 2015
2929 KernelVersion: 4.1
3030 Contact: netdev@vger.kernel.org
@@ -32,7 +32,7 @@ Description: · 1 unmodified line
3232 A Mbps max-rate set for the queue, a value of zero means disabled,
3333 default is disabled.
3434
35−What: /sys/class/<iface>/queues/tx-<queue>/xps_cpus
35+What: /sys/class/net/<iface>/queues/tx-<queue>/xps_cpus
3636 Date: November 2010
3737 KernelVersion: 2.6.38
3838 Contact: netdev@vger.kernel.org
@@ -42,7 +42,7 @@ Description: · 3 unmodified lines
4242 network device transmit queue. Possible values depend on the
4343 number of available CPU(s) in the system.
4444
45−What: /sys/class/<iface>/queues/tx-<queue>/xps_rxqs
45+What: /sys/class/net/<iface>/queues/tx-<queue>/xps_rxqs
4646 Date: June 2018
4747 KernelVersion: 4.18.0
4848 Contact: netdev@vger.kernel.org
@@ -53,7 +53,7 @@ Description: · 4 unmodified lines
5353 number of available receive queue(s) in the network device.
5454 Default is disabled.
5555
56−What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/hold_time
56+What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/hold_time
5757 Date: November 2011
5858 KernelVersion: 3.3
5959 Contact: netdev@vger.kernel.org
@@ -62,7 +62,7 @@ Description: · 2 unmodified lines
6262 of this particular network device transmit queue.
6363 Default value is 1000.
6464
65−What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/inflight
65+What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/inflight
6666 Date: November 2011
6767 KernelVersion: 3.3
6868 Contact: netdev@vger.kernel.org
@@ -70,7 +70,7 @@ Description: · 1 unmodified line
7070 Indicates the number of bytes (objects) in flight on this
7171 network device transmit queue.
7272
73−What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/limit
73+What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/limit
7474 Date: November 2011
7575 KernelVersion: 3.3
7676 Contact: netdev@vger.kernel.org
@@ -79,7 +79,7 @@ Description: · 2 unmodified lines
7979 on this network device transmit queue. This value is clamped
8080 to be within the bounds defined by limit_max and limit_min.
8181
82−What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/limit_max
82+What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/limit_max
8383 Date: November 2011
8484 KernelVersion: 3.3
8585 Contact: netdev@vger.kernel.org
@@ -88,7 +88,7 @@ Description: · 2 unmodified lines
8888 queued on this network device transmit queue. See
8989 include/linux/dynamic_queue_limits.h for the default value.
9090
91−What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/limit_min
91+What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/limit_min
9292 Date: November 2011
9393 KernelVersion: 3.3
9494 Contact: netdev@vger.kernel.org
Documentation/netlink/specs/rt_link.yaml+10−0
@@ -942,6 +942,10 @@ attribute-sets: · 941 unmodified lines
942942 -
943943 name: gro-ipv4-max-size
944944 type: u32
945+ -
946+ name: dpll-pin
947+ type: nest
948+ nested-attributes: link-dpll-pin-attrs
945949 -
946950 name: af-spec-attrs
947951 attributes:
@@ -1627,6 +1631,12 @@ attribute-sets: · 679 unmodified lines
16271631 -
16281632 name: used
16291633 type: u8
1634+ -
1635+ name: link-dpll-pin-attrs
1636+ attributes:
1637+ -
1638+ name: id
1639+ type: u32
16301640
16311641 sub-messages:
16321642 -
MAINTAINERS+2−1
@@ -15181,6 +15181,7 @@ F: Documentation/networking/net_cachelines/net_device.rst · 15180 unmodified lines
1518115181 F: drivers/connector/
1518215182 F: drivers/net/
1518315183 F: include/dt-bindings/net/
15184+F: include/linux/cn_proc.h
1518415185 F: include/linux/etherdevice.h
1518515186 F: include/linux/fcdevice.h
1518615187 F: include/linux/fddidevice.h
@@ -15188,6 +15189,7 @@ F: include/linux/hippidevice.h · 1 unmodified line
1518815189 F: include/linux/if_*
1518915190 F: include/linux/inetdevice.h
1519015191 F: include/linux/netdevice.h
15192+F: include/uapi/linux/cn_proc.h
1519115193 F: include/uapi/linux/if_*
1519215194 F: include/uapi/linux/netdevice.h
1519315195 X: drivers/net/wireless/
@@ -18085,7 +18087,6 @@ F: drivers/net/ethernet/qualcomm/emac/ · 2891 unmodified lines
1808518087
1808618088 QUALCOMM ETHQOS ETHERNET DRIVER
1808718089 M: Vinod Koul <vkoul@kernel.org>
18088−R: Bhupesh Sharma <bhupesh.sharma@linaro.org>
1808918090 L: netdev@vger.kernel.org
1809018091 L: linux-arm-msm@vger.kernel.org
1809118092 S: Maintained
drivers/net/dsa/mt7530.c+1−2
@@ -2838,8 +2838,7 @@ static void mt753x_phylink_mac_link_up(struct dsa_switch *ds, int port, · 2837 unmodified lines
28382838 /* MT753x MAC works in 1G full duplex mode for all up-clocked
28392839 * variants.
28402840 */
2841− if (interface == PHY_INTERFACE_MODE_INTERNAL ||
2842− interface == PHY_INTERFACE_MODE_TRGMII ||
2841+ if (interface == PHY_INTERFACE_MODE_TRGMII ||
28432842 (phy_interface_mode_is_8023z(interface))) {
28442843 speed = SPEED_1000;
28452844 duplex = DUPLEX_FULL;
drivers/net/dsa/mv88e6xxx/chip.c+1−1
@@ -3659,7 +3659,7 @@ static int mv88e6xxx_mdio_read_c45(struct mii_bus *bus, int phy, int devad, · 3658 unmodified lines
36593659 int err;
36603660
36613661 if (!chip->info->ops->phy_read_c45)
3662− return -EOPNOTSUPP;
3662+ return 0xffff;
36633663
36643664 mv88e6xxx_reg_lock(chip);
36653665 err = chip->info->ops->phy_read_c45(chip, bus, phy, devad, reg, &val);
drivers/net/dsa/qca/qca8k-8xxx.c+1−2
@@ -2051,12 +2051,11 @@ qca8k_sw_probe(struct mdio_device *mdiodev) · 2050 unmodified lines
20512051 priv->info = of_device_get_match_data(priv->dev);
20522052
20532053 priv->reset_gpio = devm_gpiod_get_optional(priv->dev, "reset",
2054− GPIOD_ASIS);
2054+ GPIOD_OUT_HIGH);
20552055 if (IS_ERR(priv->reset_gpio))
20562056 return PTR_ERR(priv->reset_gpio);
20572057
20582058 if (priv->reset_gpio) {
2059− gpiod_set_value_cansleep(priv->reset_gpio, 1);
20602059 /* The active low duration must be greater than 10 ms
20612060 * and checkpatch.pl wants 20 ms.
20622061 */
drivers/net/ethernet/amd/pds_core/adminq.c+48−16
@@ -63,6 +63,15 @@ static int pdsc_process_notifyq(struct pdsc_qcq *qcq) · 62 unmodified lines
6363 return nq_work;
6464 }
6565
66+static bool pdsc_adminq_inc_if_up(struct pdsc *pdsc)
67+{
68+ if (pdsc->state & BIT_ULL(PDSC_S_STOPPING_DRIVER) ||
69+ pdsc->state & BIT_ULL(PDSC_S_FW_DEAD))
70+ return false;
71+
72+ return refcount_inc_not_zero(&pdsc->adminq_refcnt);
73+}
74+
6675 void pdsc_process_adminq(struct pdsc_qcq *qcq)
6776 {
6877 union pds_core_adminq_comp *comp;
@@ -75,9 +84,9 @@ void pdsc_process_adminq(struct pdsc_qcq *qcq) · 6 unmodified lines
7584 int aq_work = 0;
7685 int credits;
7786
78− /* Don't process AdminQ when shutting down */
79− if (pdsc->state & BIT_ULL(PDSC_S_STOPPING_DRIVER)) {
80− dev_err(pdsc->dev, "%s: called while PDSC_S_STOPPING_DRIVER\n",
87+ /* Don't process AdminQ when it's not up */
88+ if (!pdsc_adminq_inc_if_up(pdsc)) {
89+ dev_err(pdsc->dev, "%s: called while adminq is unavailable\n",
8190 __func__);
8291 return;
8392 }
@@ -124,6 +133,7 @@ credits: · 40 unmodified lines
124133 pds_core_intr_credits(&pdsc->intr_ctrl[qcq->intx],
125134 credits,
126135 PDS_CORE_INTR_CRED_REARM);
136+ refcount_dec(&pdsc->adminq_refcnt);
127137 }
128138
129139 void pdsc_work_thread(struct work_struct *work)
@@ -135,18 +145,20 @@ void pdsc_work_thread(struct work_struct *work) · 5 unmodified lines
135145
136146 irqreturn_t pdsc_adminq_isr(int irq, void *data)
137147 {
138− struct pdsc_qcq *qcq = data;
139− struct pdsc *pdsc = qcq->pdsc;
148+ struct pdsc *pdsc = data;
149+ struct pdsc_qcq *qcq;
140150
141− /* Don't process AdminQ when shutting down */
142− if (pdsc->state & BIT_ULL(PDSC_S_STOPPING_DRIVER)) {
143− dev_err(pdsc->dev, "%s: called while PDSC_S_STOPPING_DRIVER\n",
151+ /* Don't process AdminQ when it's not up */
152+ if (!pdsc_adminq_inc_if_up(pdsc)) {
153+ dev_err(pdsc->dev, "%s: called while adminq is unavailable\n",
144154 __func__);
145155 return IRQ_HANDLED;
146156 }
147157
158+ qcq = &pdsc->adminqcq;
148159 queue_work(pdsc->wq, &qcq->work);
149160 pds_core_intr_mask(&pdsc->intr_ctrl[qcq->intx], PDS_CORE_INTR_MASK_CLEAR);
161+ refcount_dec(&pdsc->adminq_refcnt);
150162
151163 return IRQ_HANDLED;
152164 }
@@ -179,10 +191,16 @@ static int __pdsc_adminq_post(struct pdsc *pdsc, · 26 unmodified lines
179191
180192 /* Check that the FW is running */
181193 if (!pdsc_is_fw_running(pdsc)) {
182− u8 fw_status = ioread8(&pdsc->info_regs->fw_status);
183−
184− dev_info(pdsc->dev, "%s: post failed - fw not running %#02x:\n",
185− __func__, fw_status);
194+ if (pdsc->info_regs) {
195+ u8 fw_status =
196+ ioread8(&pdsc->info_regs->fw_status);
197+
198+ dev_info(pdsc->dev, "%s: post failed - fw not running %#02x:\n",
199+ __func__, fw_status);
200+ } else {
201+ dev_info(pdsc->dev, "%s: post failed - BARs not setup\n",
202+ __func__);
203+ }
186204 ret = -ENXIO;
187205
188206 goto err_out_unlock;
@@ -230,6 +248,12 @@ int pdsc_adminq_post(struct pdsc *pdsc, · 41 unmodified lines
230248 int err = 0;
231249 int index;
232250
251+ if (!pdsc_adminq_inc_if_up(pdsc)) {
252+ dev_dbg(pdsc->dev, "%s: preventing adminq cmd %u\n",
253+ __func__, cmd->opcode);
254+ return -ENXIO;
255+ }
256+
233257 wc.qcq = &pdsc->adminqcq;
234258 index = __pdsc_adminq_post(pdsc, &pdsc->adminqcq, cmd, comp, &wc);
235259 if (index < 0) {
@@ -248,10 +272,16 @@ int pdsc_adminq_post(struct pdsc *pdsc, · 12 unmodified lines
248272 break;
249273
250274 if (!pdsc_is_fw_running(pdsc)) {
251− u8 fw_status = ioread8(&pdsc->info_regs->fw_status);
252−
253− dev_dbg(pdsc->dev, "%s: post wait failed - fw not running %#02x:\n",
254− __func__, fw_status);
275+ if (pdsc->info_regs) {
276+ u8 fw_status =
277+ ioread8(&pdsc->info_regs->fw_status);
278+
279+ dev_dbg(pdsc->dev, "%s: post wait failed - fw not running %#02x:\n",
280+ __func__, fw_status);
281+ } else {
282+ dev_dbg(pdsc->dev, "%s: post wait failed - BARs not setup\n",
283+ __func__);
284+ }
255285 err = -ENXIO;
256286 break;
257287 }
@@ -285,6 +315,8 @@ err_out: · 27 unmodified lines
285315 queue_work(pdsc->wq, &pdsc->health_work);
286316 }
287317
318+ refcount_dec(&pdsc->adminq_refcnt);
319+
288320 return err;
289321 }
290322 EXPORT_SYMBOL_GPL(pdsc_adminq_post);
drivers/net/ethernet/amd/pds_core/core.c+36−10
@@ -125,7 +125,7 @@ static int pdsc_qcq_intr_alloc(struct pdsc *pdsc, struct pdsc_qcq *qcq) · 124 unmodified lines
125125
126126 snprintf(name, sizeof(name), "%s-%d-%s",
127127 PDS_CORE_DRV_NAME, pdsc->pdev->bus->number, qcq->q.name);
128− index = pdsc_intr_alloc(pdsc, name, pdsc_adminq_isr, qcq);
128+ index = pdsc_intr_alloc(pdsc, name, pdsc_adminq_isr, pdsc);
129129 if (index < 0)
130130 return index;
131131 qcq->intx = index;
@@ -404,10 +404,7 @@ int pdsc_setup(struct pdsc *pdsc, bool init) · 272 unmodified lines
404404 int numdescs;
405405 int err;
406406
407− if (init)
408− err = pdsc_dev_init(pdsc);
409− else
410− err = pdsc_dev_reinit(pdsc);
407+ err = pdsc_dev_init(pdsc);
411408 if (err)
412409 return err;
413410
@@ -450,6 +447,7 @@ int pdsc_setup(struct pdsc *pdsc, bool init) · 36 unmodified lines
450447 pdsc_debugfs_add_viftype(pdsc);
451448 }
452449
450+ refcount_set(&pdsc->adminq_refcnt, 1);
453451 clear_bit(PDSC_S_FW_DEAD, &pdsc->state);
454452 return 0;
455453
@@ -464,6 +462,8 @@ void pdsc_teardown(struct pdsc *pdsc, bool removing) · 8 unmodified lines
464462
465463 if (!pdsc->pdev->is_virtfn)
466464 pdsc_devcmd_reset(pdsc);
465+ if (pdsc->adminqcq.work.func)
466+ cancel_work_sync(&pdsc->adminqcq.work);
467467 pdsc_qcq_free(pdsc, &pdsc->notifyqcq);
468468 pdsc_qcq_free(pdsc, &pdsc->adminqcq);
469469
@@ -476,10 +476,9 @@ void pdsc_teardown(struct pdsc *pdsc, bool removing) · 6 unmodified lines
476476 for (i = 0; i < pdsc->nintrs; i++)
477477 pdsc_intr_free(pdsc, i);
478478
479− if (removing) {
480− kfree(pdsc->intr_info);
481− pdsc->intr_info = NULL;
482− }
479+ kfree(pdsc->intr_info);
480+ pdsc->intr_info = NULL;
481+ pdsc->nintrs = 0;
483482 }
484483
485484 if (pdsc->kern_dbpage) {
@@ -487,6 +486,7 @@ void pdsc_teardown(struct pdsc *pdsc, bool removing) · 1 unmodified line
487486 pdsc->kern_dbpage = NULL;
488487 }
489488
489+ pci_free_irq_vectors(pdsc->pdev);
490490 set_bit(PDSC_S_FW_DEAD, &pdsc->state);
491491 }
492492
@@ -512,6 +512,24 @@ void pdsc_stop(struct pdsc *pdsc) · 19 unmodified lines
512512 PDS_CORE_INTR_MASK_SET);
513513 }
514514
515+static void pdsc_adminq_wait_and_dec_once_unused(struct pdsc *pdsc)
516+{
517+ /* The driver initializes the adminq_refcnt to 1 when the adminq is
518+ * allocated and ready for use. Other users/requesters will increment
519+ * the refcnt while in use. If the refcnt is down to 1 then the adminq
520+ * is not in use and the refcnt can be cleared and adminq freed. Before
521+ * calling this function the driver will set PDSC_S_FW_DEAD, which
522+ * prevent subsequent attempts to use the adminq and increment the
523+ * refcnt to fail. This guarantees that this function will eventually
524+ * exit.
525+ */
526+ while (!refcount_dec_if_one(&pdsc->adminq_refcnt)) {
527+ dev_dbg_ratelimited(pdsc->dev, "%s: adminq in use\n",
528+ __func__);
529+ cpu_relax();
530+ }
531+}
532+
515533 void pdsc_fw_down(struct pdsc *pdsc)
516534 {
517535 union pds_core_notifyq_comp reset_event = {
@@ -527,6 +545,8 @@ void pdsc_fw_down(struct pdsc *pdsc) · 9 unmodified lines
527545 if (pdsc->pdev->is_virtfn)
528546 return;
529547
548+ pdsc_adminq_wait_and_dec_once_unused(pdsc);
549+
530550 /* Notify clients of fw_down */
531551 if (pdsc->fw_reporter)
532552 devlink_health_report(pdsc->fw_reporter, "FW down reported", pdsc);
@@ -577,7 +597,13 @@ err_out: · 44 unmodified lines
577597
578598 static void pdsc_check_pci_health(struct pdsc *pdsc)
579599 {
580− u8 fw_status = ioread8(&pdsc->info_regs->fw_status);
600+ u8 fw_status;
601+
602+ /* some sort of teardown already in progress */
603+ if (!pdsc->info_regs)
604+ return;
605+
606+ fw_status = ioread8(&pdsc->info_regs->fw_status);
581607
582608 /* is PCI broken? */
583609 if (fw_status != PDS_RC_BAD_PCI)
drivers/net/ethernet/amd/pds_core/core.h+1−1
@@ -184,6 +184,7 @@ struct pdsc { · 183 unmodified lines
184184 struct mutex devcmd_lock; /* lock for dev_cmd operations */
185185 struct mutex config_lock; /* lock for configuration operations */
186186 spinlock_t adminq_lock; /* lock for adminq operations */
187+ refcount_t adminq_refcnt;
187188 struct pds_core_dev_info_regs __iomem *info_regs;
188189 struct pds_core_dev_cmd_regs __iomem *cmd_regs;
189190 struct pds_core_intr __iomem *intr_ctrl;
@@ -280,7 +281,6 @@ int pdsc_devcmd_locked(struct pdsc *pdsc, union pds_core_dev_cmd *cmd, · 90 unmodified lines
280281 union pds_core_dev_comp *comp, int max_seconds);
281282 int pdsc_devcmd_init(struct pdsc *pdsc);
282283 int pdsc_devcmd_reset(struct pdsc *pdsc);
283−int pdsc_dev_reinit(struct pdsc *pdsc);
284284 int pdsc_dev_init(struct pdsc *pdsc);
285285
286286 void pdsc_reset_prepare(struct pci_dev *pdev);
drivers/net/ethernet/amd/pds_core/debugfs.c+4−0
@@ -64,6 +64,10 @@ DEFINE_SHOW_ATTRIBUTE(identity); · 63 unmodified lines
6464
6565 void pdsc_debugfs_add_ident(struct pdsc *pdsc)
6666 {
67+ /* This file will already exist in the reset flow */
68+ if (debugfs_lookup("identity", pdsc->dentry))
69+ return;
70+
6771 debugfs_create_file("identity", 0400, pdsc->dentry,
6872 pdsc, &identity_fops);
6973 }
drivers/net/ethernet/amd/pds_core/dev.c+8−8
@@ -57,6 +57,9 @@ int pdsc_err_to_errno(enum pds_core_status_code code) · 56 unmodified lines
5757
5858 bool pdsc_is_fw_running(struct pdsc *pdsc)
5959 {
60+ if (!pdsc->info_regs)
61+ return false;
62+
6063 pdsc->fw_status = ioread8(&pdsc->info_regs->fw_status);
6164 pdsc->last_fw_time = jiffies;
6265 pdsc->last_hb = ioread32(&pdsc->info_regs->fw_heartbeat);
@@ -182,13 +185,17 @@ int pdsc_devcmd_locked(struct pdsc *pdsc, union pds_core_dev_cmd *cmd, · 119 unmodified lines
182185 {
183186 int err;
184187
188+ if (!pdsc->cmd_regs)
189+ return -ENXIO;
190+
185191 memcpy_toio(&pdsc->cmd_regs->cmd, cmd, sizeof(*cmd));
186192 pdsc_devcmd_dbell(pdsc);
187193 err = pdsc_devcmd_wait(pdsc, cmd->opcode, max_seconds);
188− memcpy_fromio(comp, &pdsc->cmd_regs->comp, sizeof(*comp));
189194
190195 if ((err == -ENXIO || err == -ETIMEDOUT) && pdsc->wq)
191196 queue_work(pdsc->wq, &pdsc->health_work);
197+ else
198+ memcpy_fromio(comp, &pdsc->cmd_regs->comp, sizeof(*comp));
192199
193200 return err;
194201 }
@@ -309,13 +316,6 @@ static int pdsc_identify(struct pdsc *pdsc) · 114 unmodified lines
309316 return 0;
310317 }
311318
312−int pdsc_dev_reinit(struct pdsc *pdsc)
313−{
314− pdsc_init_devinfo(pdsc);
315−
316− return pdsc_identify(pdsc);
317−}
318−
319319 int pdsc_dev_init(struct pdsc *pdsc)
320320 {
321321 unsigned int nintrs;
drivers/net/ethernet/amd/pds_core/devlink.c+2−1
@@ -111,7 +111,8 @@ int pdsc_dl_info_get(struct devlink *dl, struct devlink_info_req *req, · 110 unmodified lines
111111
112112 mutex_lock(&pdsc->devcmd_lock);
113113 err = pdsc_devcmd_locked(pdsc, &cmd, &comp, pdsc->devcmd_timeout * 2);
114− memcpy_fromio(&fw_list, pdsc->cmd_regs->data, sizeof(fw_list));
114+ if (!err)
115+ memcpy_fromio(&fw_list, pdsc->cmd_regs->data, sizeof(fw_list));
115116 mutex_unlock(&pdsc->devcmd_lock);
116117 if (err && err != -EIO)
117118 return err;
drivers/net/ethernet/amd/pds_core/fw.c+3−0
@@ -107,6 +107,9 @@ int pdsc_firmware_update(struct pdsc *pdsc, const struct firmware *fw, · 106 unmodified lines
107107
108108 dev_info(pdsc->dev, "Installing firmware\n");
109109
110+ if (!pdsc->cmd_regs)
111+ return -ENXIO;
112+
110113 dl = priv_to_devlink(pdsc);
111114 devlink_flash_update_status_notify(dl, "Preparing to flash",
112115 NULL, 0, 0);
drivers/net/ethernet/amd/pds_core/main.c+22−4
@@ -37,6 +37,11 @@ static void pdsc_unmap_bars(struct pdsc *pdsc) · 36 unmodified lines
3737 struct pdsc_dev_bar *bars = pdsc->bars;
3838 unsigned int i;
3939
40+ pdsc->info_regs = NULL;
41+ pdsc->cmd_regs = NULL;
42+ pdsc->intr_status = NULL;
43+ pdsc->intr_ctrl = NULL;
44+
4045 for (i = 0; i < PDS_CORE_BARS_MAX; i++) {
4146 if (bars[i].vaddr)
4247 pci_iounmap(pdsc->pdev, bars[i].vaddr);
@@ -293,7 +298,7 @@ err_out_stop: · 250 unmodified lines
293298 err_out_teardown:
294299 pdsc_teardown(pdsc, PDSC_TEARDOWN_REMOVING);
295300 err_out_unmap_bars:
296− del_timer_sync(&pdsc->wdtimer);
301+ timer_shutdown_sync(&pdsc->wdtimer);
297302 if (pdsc->wq)
298303 destroy_workqueue(pdsc->wq);
299304 mutex_destroy(&pdsc->config_lock);
@@ -420,7 +425,7 @@ static void pdsc_remove(struct pci_dev *pdev) · 120 unmodified lines
420425 */
421426 pdsc_sriov_configure(pdev, 0);
422427
423− del_timer_sync(&pdsc->wdtimer);
428+ timer_shutdown_sync(&pdsc->wdtimer);
424429 if (pdsc->wq)
425430 destroy_workqueue(pdsc->wq);
426431
@@ -433,7 +438,6 @@ static void pdsc_remove(struct pci_dev *pdev) · 6 unmodified lines
433438 mutex_destroy(&pdsc->config_lock);
434439 mutex_destroy(&pdsc->devcmd_lock);
435440
436− pci_free_irq_vectors(pdev);
437441 pdsc_unmap_bars(pdsc);
438442 pci_release_regions(pdev);
439443 }
@@ -445,13 +449,26 @@ static void pdsc_remove(struct pci_dev *pdev) · 5 unmodified lines
445449 devlink_free(dl);
446450 }
447451
452+static void pdsc_stop_health_thread(struct pdsc *pdsc)
453+{
454+ timer_shutdown_sync(&pdsc->wdtimer);
455+ if (pdsc->health_work.func)
456+ cancel_work_sync(&pdsc->health_work);
457+}
458+
459+static void pdsc_restart_health_thread(struct pdsc *pdsc)
460+{
461+ timer_setup(&pdsc->wdtimer, pdsc_wdtimer_cb, 0);
462+ mod_timer(&pdsc->wdtimer, jiffies + 1);
463+}
464+
448465 void pdsc_reset_prepare(struct pci_dev *pdev)
449466 {
450467 struct pdsc *pdsc = pci_get_drvdata(pdev);
451468
469+ pdsc_stop_health_thread(pdsc);
452470 pdsc_fw_down(pdsc);
453471
454− pci_free_irq_vectors(pdev);
455472 pdsc_unmap_bars(pdsc);
456473 pci_release_regions(pdev);
457474 pci_disable_device(pdev);
@@ -486,6 +503,7 @@ void pdsc_reset_done(struct pci_dev *pdev) · 28 unmodified lines
486503 }
487504
488505 pdsc_fw_up(pdsc);
506+ pdsc_restart_health_thread(pdsc);
489507 }
490508
491509 static const struct pci_error_handlers pdsc_err_handler = {
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c+1−1
@@ -684,7 +684,7 @@ static void bnxt_stamp_tx_skb(struct bnxt *bp, struct sk_buff *skb) · 683 unmodified lines
684684 timestamp.hwtstamp = ns_to_ktime(ns);
685685 skb_tstamp_tx(ptp->tx_skb, &timestamp);
686686 } else {
687− netdev_WARN_ONCE(bp->dev,
687+ netdev_warn_once(bp->dev,
688688 "TS query for TX timer failed rc = %x\n", rc);
689689 }
690690
drivers/net/ethernet/google/gve/gve_rx.c+4−4
@@ -356,7 +356,7 @@ static enum pkt_hash_types gve_rss_type(__be16 pkt_flags) · 355 unmodified lines
356356
357357 static struct sk_buff *gve_rx_add_frags(struct napi_struct *napi,
358358 struct gve_rx_slot_page_info *page_info,
359− u16 packet_buffer_size, u16 len,
359+ unsigned int truesize, u16 len,
360360 struct gve_rx_ctx *ctx)
361361 {
362362 u32 offset = page_info->page_offset + page_info->pad;
@@ -389,10 +389,10 @@ static struct sk_buff *gve_rx_add_frags(struct napi_struct *napi, · 26 unmodified lines
389389 if (skb != ctx->skb_head) {
390390 ctx->skb_head->len += len;
391391 ctx->skb_head->data_len += len;
392− ctx->skb_head->truesize += packet_buffer_size;
392+ ctx->skb_head->truesize += truesize;
393393 }
394394 skb_add_rx_frag(skb, num_frags, page_info->page,
395− offset, len, packet_buffer_size);
395+ offset, len, truesize);
396396
397397 return ctx->skb_head;
398398 }
@@ -486,7 +486,7 @@ static struct sk_buff *gve_rx_copy_to_pool(struct gve_rx_ring *rx, · 87 unmodified lines
486486
487487 memcpy(alloc_page_info.page_address, src, page_info->pad + len);
488488 skb = gve_rx_add_frags(napi, &alloc_page_info,
489− rx->packet_buffer_size,
489+ PAGE_SIZE,
490490 len, ctx);
491491
492492 u64_stats_update_begin(&rx->statss);
drivers/net/ethernet/intel/e1000e/e1000.h+20−0
@@ -360,23 +360,43 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca); · 359 unmodified lines
360360 * As a result, a shift of INCVALUE_SHIFT_n is used to fit a value of
361361 * INCVALUE_n into the TIMINCA register allowing 32+8+(24-INCVALUE_SHIFT_n)
362362 * bits to count nanoseconds leaving the rest for fractional nonseconds.
363+ *
364+ * Any given INCVALUE also has an associated maximum adjustment value. This
365+ * maximum adjustment value is the largest increase (or decrease) which can be
366+ * safely applied without overflowing the INCVALUE. Since INCVALUE has
367+ * a maximum range of 24 bits, its largest value is 0xFFFFFF.
368+ *
369+ * To understand where the maximum value comes from, consider the following
370+ * equation:
371+ *
372+ * new_incval = base_incval + (base_incval * adjustment) / 1billion
373+ *
374+ * To avoid overflow that means:
375+ * max_incval = base_incval + (base_incval * max_adj) / billion
376+ *
377+ * Re-arranging:
378+ * max_adj = floor(((max_incval - base_incval) * 1billion) / 1billion)
363379 */
364380 #define INCVALUE_96MHZ 125
365381 #define INCVALUE_SHIFT_96MHZ 17
366382 #define INCPERIOD_SHIFT_96MHZ 2
367383 #define INCPERIOD_96MHZ (12 >> INCPERIOD_SHIFT_96MHZ)
384+#define MAX_PPB_96MHZ 23999900 /* 23,999,900 ppb */
368385
369386 #define INCVALUE_25MHZ 40
370387 #define INCVALUE_SHIFT_25MHZ 18
371388 #define INCPERIOD_25MHZ 1
389+#define MAX_PPB_25MHZ 599999900 /* 599,999,900 ppb */
372390
373391 #define INCVALUE_24MHZ 125
374392 #define INCVALUE_SHIFT_24MHZ 14
375393 #define INCPERIOD_24MHZ 3
394+#define MAX_PPB_24MHZ 999999999 /* 999,999,999 ppb */
376395
377396 #define INCVALUE_38400KHZ 26
378397 #define INCVALUE_SHIFT_38400KHZ 19
379398 #define INCPERIOD_38400KHZ 1
399+#define MAX_PPB_38400KHZ 230769100 /* 230,769,100 ppb */
380400
381401 /* Another drawback of scaling the incvalue by a large factor is the
382402 * 64-bit SYSTIM register overflows more quickly. This is dealt with
drivers/net/ethernet/intel/e1000e/ptp.c+15−7
@@ -280,8 +280,17 @@ void e1000e_ptp_init(struct e1000_adapter *adapter) · 279 unmodified lines
280280
281281 switch (hw->mac.type) {
282282 case e1000_pch2lan:
283+ adapter->ptp_clock_info.max_adj = MAX_PPB_96MHZ;
284+ break;
283285 case e1000_pch_lpt:
286+ if (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI)
287+ adapter->ptp_clock_info.max_adj = MAX_PPB_96MHZ;
288+ else
289+ adapter->ptp_clock_info.max_adj = MAX_PPB_25MHZ;
290+ break;
284291 case e1000_pch_spt:
292+ adapter->ptp_clock_info.max_adj = MAX_PPB_24MHZ;
293+ break;
285294 case e1000_pch_cnp:
286295 case e1000_pch_tgp:
287296 case e1000_pch_adp:
@@ -289,15 +298,14 @@ void e1000e_ptp_init(struct e1000_adapter *adapter) · 1 unmodified line
289298 case e1000_pch_lnp:
290299 case e1000_pch_ptp:
291300 case e1000_pch_nvp:
292− if ((hw->mac.type < e1000_pch_lpt) ||
293− (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI)) {
294− adapter->ptp_clock_info.max_adj = 24000000 - 1;
295− break;
296− }
297− fallthrough;
301+ if (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI)
302+ adapter->ptp_clock_info.max_adj = MAX_PPB_24MHZ;
303+ else
304+ adapter->ptp_clock_info.max_adj = MAX_PPB_38400KHZ;
305+ break;
298306 case e1000_82574:
299307 case e1000_82583:
300− adapter->ptp_clock_info.max_adj = 600000000 - 1;
308+ adapter->ptp_clock_info.max_adj = MAX_PPB_25MHZ;
301309 break;
302310 default:
303311 break;
drivers/net/ethernet/intel/idpf/virtchnl2.h+1−1
@@ -978,7 +978,7 @@ struct virtchnl2_ptype { · 977 unmodified lines
978978 u8 proto_id_count;
979979 __le16 pad;
980980 __le16 proto_id[];
981−};
981+} __packed __aligned(2);
982982 VIRTCHNL2_CHECK_STRUCT_LEN(6, virtchnl2_ptype);
983983
984984 /**
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c+2−1
@@ -716,7 +716,8 @@ static s32 ixgbe_read_iosf_sb_reg_x550(struct ixgbe_hw *hw, u32 reg_addr, · 715 unmodified lines
716716 if ((command & IXGBE_SB_IOSF_CTRL_RESP_STAT_MASK) != 0) {
717717 error = FIELD_GET(IXGBE_SB_IOSF_CTRL_CMPL_ERR_MASK, command);
718718 hw_dbg(hw, "Failed to read, error %x\n", error);
719− return -EIO;
719+ ret = -EIO;
720+ goto out;
720721 }
721722
722723 if (!ret)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c+0−1
@@ -314,7 +314,6 @@ static int otx2_set_channels(struct net_device *dev, · 313 unmodified lines
314314 pfvf->hw.tx_queues = channel->tx_count;
315315 if (pfvf->xdp_prog)
316316 pfvf->hw.xdp_queues = channel->rx_count;
317− pfvf->hw.non_qos_queues = pfvf->hw.tx_queues + pfvf->hw.xdp_queues;
318317
319318 if (if_up)
320319 err = dev->netdev_ops->ndo_open(dev);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c+1−2
@@ -1744,6 +1744,7 @@ int otx2_open(struct net_device *netdev) · 1743 unmodified lines
17441744 /* RQ and SQs are mapped to different CQs,
17451745 * so find out max CQ IRQs (i.e CINTs) needed.
17461746 */
1747+ pf->hw.non_qos_queues = pf->hw.tx_queues + pf->hw.xdp_queues;
17471748 pf->hw.cint_cnt = max3(pf->hw.rx_queues, pf->hw.tx_queues,
17481749 pf->hw.tc_tx_queues);
17491750
@@ -2643,8 +2644,6 @@ static int otx2_xdp_setup(struct otx2_nic *pf, struct bpf_prog *prog) · 893 unmodified lines
26432644 xdp_features_clear_redirect_target(dev);
26442645 }
26452646
2646− pf->hw.non_qos_queues += pf->hw.xdp_queues;
2647−
26482647 if (if_up)
26492648 otx2_open(pf->netdev);
26502649
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c+3−4
@@ -1403,7 +1403,7 @@ static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf, · 1402 unmodified lines
14031403 struct otx2_cq_queue *cq,
14041404 bool *need_xdp_flush)
14051405 {
1406− unsigned char *hard_start, *data;
1406+ unsigned char *hard_start;
14071407 int qidx = cq->cq_idx;
14081408 struct xdp_buff xdp;
14091409 struct page *page;
@@ -1417,9 +1417,8 @@ static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf, · 7 unmodified lines
14171417
14181418 xdp_init_buff(&xdp, pfvf->rbsize, &cq->xdp_rxq);
14191419
1420− data = (unsigned char *)phys_to_virt(pa);
1421− hard_start = page_address(page);
1422− xdp_prepare_buff(&xdp, hard_start, data - hard_start,
1420+ hard_start = (unsigned char *)phys_to_virt(pa);
1421+ xdp_prepare_buff(&xdp, hard_start, OTX2_HEAD_ROOM,
14231422 cqe->sg.seg_size, false);
14241423
14251424 act = bpf_prog_run_xdp(prog, &xdp);
drivers/net/ethernet/mediatek/mtk_eth_soc.c+4−1
@@ -4761,7 +4761,10 @@ static int mtk_probe(struct platform_device *pdev) · 4760 unmodified lines
47614761 }
47624762
47634763 if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA)) {
4764− err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(36));
4764+ err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(36));
4765+ if (!err)
4766+ err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
4767+
47654768 if (err) {
47664769 dev_err(&pdev->dev, "Wrong DMA config\n");
47674770 return -EINVAL;
drivers/net/ethernet/microchip/lan966x/lan966x_port.c+3−2
@@ -168,9 +168,10 @@ static void lan966x_port_link_up(struct lan966x_port *port) · 167 unmodified lines
168168 lan966x_taprio_speed_set(port, config->speed);
169169
170170 /* Also the GIGA_MODE_ENA(1) needs to be set regardless of the
171− * port speed for QSGMII ports.
171+ * port speed for QSGMII or SGMII ports.
172172 */
173− if (phy_interface_num_ports(config->portmode) == 4)
173+ if (phy_interface_num_ports(config->portmode) == 4 ||
174+ config->portmode == PHY_INTERFACE_MODE_SGMII)
174175 mode = DEV_MAC_MODE_CFG_GIGA_MODE_ENA_SET(1);
175176
176177 lan_wr(config->duplex | mode,
drivers/net/ethernet/netronome/nfp/flower/conntrack.c+43−3
@@ -1424,10 +1424,30 @@ static void nfp_nft_ct_translate_mangle_action(struct flow_action_entry *mangle_ · 1423 unmodified lines
14241424 mangle_action->mangle.mask = (__force u32)cpu_to_be32(mangle_action->mangle.mask);
14251425 return;
14261426
1427+ /* Both struct tcphdr and struct udphdr start with
1428+ * __be16 source;
1429+ * __be16 dest;
1430+ * so we can use the same code for both.
1431+ */
14271432 case FLOW_ACT_MANGLE_HDR_TYPE_TCP:
14281433 case FLOW_ACT_MANGLE_HDR_TYPE_UDP:
1429− mangle_action->mangle.val = (__force u16)cpu_to_be16(mangle_action->mangle.val);
1430− mangle_action->mangle.mask = (__force u16)cpu_to_be16(mangle_action->mangle.mask);
1434+ if (mangle_action->mangle.offset == offsetof(struct tcphdr, source)) {
1435+ mangle_action->mangle.val =
1436+ (__force u32)cpu_to_be32(mangle_action->mangle.val << 16);
1437+ /* The mask of mangle action is inverse mask,
1438+ * so clear the dest tp port with 0xFFFF to
1439+ * instead of rotate-left operation.
1440+ */
1441+ mangle_action->mangle.mask =
1442+ (__force u32)cpu_to_be32(mangle_action->mangle.mask << 16 | 0xFFFF);
1443+ }
1444+ if (mangle_action->mangle.offset == offsetof(struct tcphdr, dest)) {
1445+ mangle_action->mangle.offset = 0;
1446+ mangle_action->mangle.val =
1447+ (__force u32)cpu_to_be32(mangle_action->mangle.val);
1448+ mangle_action->mangle.mask =
1449+ (__force u32)cpu_to_be32(mangle_action->mangle.mask);
1450+ }
14311451 return;
14321452
14331453 default:
@@ -1864,10 +1884,30 @@ int nfp_fl_ct_handle_post_ct(struct nfp_flower_priv *priv, · 430 unmodified lines
18641884 {
18651885 struct flow_rule *rule = flow_cls_offload_flow_rule(flow);
18661886 struct nfp_fl_ct_flow_entry *ct_entry;
1887+ struct flow_action_entry *ct_goto;
18671888 struct nfp_fl_ct_zone_entry *zt;
1889+ struct flow_action_entry *act;
18681890 bool wildcarded = false;
18691891 struct flow_match_ct ct;
1870− struct flow_action_entry *ct_goto;
1892+ int i;
1893+
1894+ flow_action_for_each(i, act, &rule->action) {
1895+ switch (act->id) {
1896+ case FLOW_ACTION_REDIRECT:
1897+ case FLOW_ACTION_REDIRECT_INGRESS:
1898+ case FLOW_ACTION_MIRRED:
1899+ case FLOW_ACTION_MIRRED_INGRESS:
1900+ if (act->dev->rtnl_link_ops &&
1901+ !strcmp(act->dev->rtnl_link_ops->kind, "openvswitch")) {
1902+ NL_SET_ERR_MSG_MOD(extack,
1903+ "unsupported offload: out port is openvswitch internal port");
1904+ return -EOPNOTSUPP;
1905+ }
1906+ break;
1907+ default:
1908+ break;
1909+ }
1910+ }
18711911
18721912 flow_rule_match_ct(rule, &ct);
18731913 if (!ct.mask->ct_zone) {
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c+4−0
@@ -353,6 +353,10 @@ static int imx_dwmac_probe(struct platform_device *pdev) · 352 unmodified lines
353353 if (data->flags & STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY)
354354 plat_dat->flags |= STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY;
355355
356+ /* Default TX Q0 to use TSO and rest TXQ for TBS */
357+ for (int i = 1; i < plat_dat->tx_queues_to_use; i++)
358+ plat_dat->tx_queues_cfg[i].tbs_en = 1;
359+
356360 plat_dat->host_dma_width = dwmac->ops->addr_width;
357361 plat_dat->init = imx_dwmac_init;
358362 plat_dat->exit = imx_dwmac_exit;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+3−0
@@ -3932,6 +3932,9 @@ static int __stmmac_open(struct net_device *dev, · 3931 unmodified lines
39323932 priv->rx_copybreak = STMMAC_RX_COPYBREAK;
39333933
39343934 buf_sz = dma_conf->dma_buf_sz;
3935+ for (int i = 0; i < MTL_MAX_TX_QUEUES; i++)
3936+ if (priv->dma_conf.tx_queue[i].tbs & STMMAC_TBS_EN)
3937+ dma_conf->tx_queue[i].tbs = priv->dma_conf.tx_queue[i].tbs;
39353938 memcpy(&priv->dma_conf, dma_conf, sizeof(*dma_conf));
39363939
39373940 stmmac_reset_queues_param(priv);
drivers/net/hyperv/netvsc.c+4−1
@@ -708,7 +708,10 @@ void netvsc_device_remove(struct hv_device *device) · 707 unmodified lines
708708 /* Disable NAPI and disassociate its context from the device. */
709709 for (i = 0; i < net_device->num_chn; i++) {
710710 /* See also vmbus_reset_channel_cb(). */
711− napi_disable(&net_device->chan_table[i].napi);
711+ /* only disable enabled NAPI channel */
712+ if (i < ndev->real_num_rx_queues)
713+ napi_disable(&net_device->chan_table[i].napi);
714+
712715 netif_napi_del(&net_device->chan_table[i].napi);
713716 }
714717
drivers/net/phy/mediatek-ge-soc.c+81−66
@@ -489,7 +489,7 @@ static int tx_r50_fill_result(struct phy_device *phydev, u16 tx_r50_cal_val, · 488 unmodified lines
489489 u16 reg, val;
490490
491491 if (phydev->drv->phy_id == MTK_GPHY_ID_MT7988)
492− bias = -2;
492+ bias = -1;
493493
494494 val = clamp_val(bias + tx_r50_cal_val, 0, 63);
495495
@@ -705,6 +705,11 @@ restore: · 209 unmodified lines
705705 static void mt798x_phy_common_finetune(struct phy_device *phydev)
706706 {
707707 phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5);
708+ /* SlvDSPreadyTime = 24, MasDSPreadyTime = 24 */
709+ __phy_write(phydev, 0x11, 0xc71);
710+ __phy_write(phydev, 0x12, 0xc);
711+ __phy_write(phydev, 0x10, 0x8fae);
712+
708713 /* EnabRandUpdTrig = 1 */
709714 __phy_write(phydev, 0x11, 0x2f00);
710715 __phy_write(phydev, 0x12, 0xe);
@@ -715,15 +720,56 @@ static void mt798x_phy_common_finetune(struct phy_device *phydev) · 4 unmodified lines
715720 __phy_write(phydev, 0x12, 0x0);
716721 __phy_write(phydev, 0x10, 0x83aa);
717722
718− /* TrFreeze = 0 */
723+ /* FfeUpdGainForce = 1(Enable), FfeUpdGainForceVal = 4 */
724+ __phy_write(phydev, 0x11, 0x240);
725+ __phy_write(phydev, 0x12, 0x0);
726+ __phy_write(phydev, 0x10, 0x9680);
727+
728+ /* TrFreeze = 0 (mt7988 default) */
719729 __phy_write(phydev, 0x11, 0x0);
720730 __phy_write(phydev, 0x12, 0x0);
721731 __phy_write(phydev, 0x10, 0x9686);
722732
733+ /* SSTrKp100 = 5 */
734+ /* SSTrKf100 = 6 */
735+ /* SSTrKp1000Mas = 5 */
736+ /* SSTrKf1000Mas = 6 */
723737 /* SSTrKp1000Slv = 5 */
738+ /* SSTrKf1000Slv = 6 */
724739 __phy_write(phydev, 0x11, 0xbaef);
725740 __phy_write(phydev, 0x12, 0x2e);
726741 __phy_write(phydev, 0x10, 0x968c);
742+ phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0);
743+}
744+
745+static void mt7981_phy_finetune(struct phy_device *phydev)
746+{
747+ u16 val[8] = { 0x01ce, 0x01c1,
748+ 0x020f, 0x0202,
749+ 0x03d0, 0x03c0,
750+ 0x0013, 0x0005 };
751+ int i, k;
752+
753+ /* 100M eye finetune:
754+ * Keep middle level of TX MLT3 shapper as default.
755+ * Only change TX MLT3 overshoot level here.
756+ */
757+ for (k = 0, i = 1; i < 12; i++) {
758+ if (i % 3 == 0)
759+ continue;
760+ phy_write_mmd(phydev, MDIO_MMD_VEND1, i, val[k++]);
761+ }
762+
763+ phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5);
764+ /* ResetSyncOffset = 6 */
765+ __phy_write(phydev, 0x11, 0x600);
766+ __phy_write(phydev, 0x12, 0x0);
767+ __phy_write(phydev, 0x10, 0x8fc0);
768+
769+ /* VgaDecRate = 1 */
770+ __phy_write(phydev, 0x11, 0x4c2a);
771+ __phy_write(phydev, 0x12, 0x3e);
772+ __phy_write(phydev, 0x10, 0x8fa4);
727773
728774 /* MrvlTrFix100Kp = 3, MrvlTrFix100Kf = 2,
729775 * MrvlTrFix1000Kp = 3, MrvlTrFix1000Kf = 2
@@ -738,7 +784,7 @@ static void mt798x_phy_common_finetune(struct phy_device *phydev) · 8 unmodified lines
738784 __phy_write(phydev, 0x10, 0x8ec0);
739785 phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0);
740786
741− /* TR_OPEN_LOOP_EN = 1, lpf_x_average = 9*/
787+ /* TR_OPEN_LOOP_EN = 1, lpf_x_average = 9 */
742788 phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG234,
743789 MTK_PHY_TR_OPEN_LOOP_EN_MASK | MTK_PHY_LPF_X_AVERAGE_MASK,
744790 BIT(0) | FIELD_PREP(MTK_PHY_LPF_X_AVERAGE_MASK, 0x9));
@@ -771,48 +817,6 @@ static void mt798x_phy_common_finetune(struct phy_device *phydev) · 26 unmodified lines
771817 phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_LDO_OUTPUT_V, 0x2222);
772818 }
773819
774−static void mt7981_phy_finetune(struct phy_device *phydev)
775−{
776− u16 val[8] = { 0x01ce, 0x01c1,
777− 0x020f, 0x0202,
778− 0x03d0, 0x03c0,
779− 0x0013, 0x0005 };
780− int i, k;
781−
782− /* 100M eye finetune:
783− * Keep middle level of TX MLT3 shapper as default.
784− * Only change TX MLT3 overshoot level here.
785− */
786− for (k = 0, i = 1; i < 12; i++) {
787− if (i % 3 == 0)
788− continue;
789− phy_write_mmd(phydev, MDIO_MMD_VEND1, i, val[k++]);
790− }
791−
792− phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5);
793− /* SlvDSPreadyTime = 24, MasDSPreadyTime = 24 */
794− __phy_write(phydev, 0x11, 0xc71);
795− __phy_write(phydev, 0x12, 0xc);
796− __phy_write(phydev, 0x10, 0x8fae);
797−
798− /* ResetSyncOffset = 6 */
799− __phy_write(phydev, 0x11, 0x600);
800− __phy_write(phydev, 0x12, 0x0);
801− __phy_write(phydev, 0x10, 0x8fc0);
802−
803− /* VgaDecRate = 1 */
804− __phy_write(phydev, 0x11, 0x4c2a);
805− __phy_write(phydev, 0x12, 0x3e);
806− __phy_write(phydev, 0x10, 0x8fa4);
807−
808− /* FfeUpdGainForce = 4 */
809− __phy_write(phydev, 0x11, 0x240);
810− __phy_write(phydev, 0x12, 0x0);
811− __phy_write(phydev, 0x10, 0x9680);
812−
813− phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0);
814−}
815−
816820 static void mt7988_phy_finetune(struct phy_device *phydev)
817821 {
818822 u16 val[12] = { 0x0187, 0x01cd, 0x01c8, 0x0182,
@@ -827,17 +831,7 @@ static void mt7988_phy_finetune(struct phy_device *phydev) · 8 unmodified lines
827831 /* TCT finetune */
828832 phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_TX_FILTER, 0x5);
829833
830− /* Disable TX power saving */
831− phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG7,
832− MTK_PHY_DA_AD_BUF_BIAS_LP_MASK, 0x3 << 8);
833−
834834 phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5);
835−
836− /* SlvDSPreadyTime = 24, MasDSPreadyTime = 12 */
837− __phy_write(phydev, 0x11, 0x671);
838− __phy_write(phydev, 0x12, 0xc);
839− __phy_write(phydev, 0x10, 0x8fae);
840−
841835 /* ResetSyncOffset = 5 */
842836 __phy_write(phydev, 0x11, 0x500);
843837 __phy_write(phydev, 0x12, 0x0);
@@ -845,13 +839,27 @@ static void mt7988_phy_finetune(struct phy_device *phydev) · 1 unmodified line
845839
846840 /* VgaDecRate is 1 at default on mt7988 */
847841
848− phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0);
842+ /* MrvlTrFix100Kp = 6, MrvlTrFix100Kf = 7,
843+ * MrvlTrFix1000Kp = 6, MrvlTrFix1000Kf = 7
844+ */
845+ __phy_write(phydev, 0x11, 0xb90a);
846+ __phy_write(phydev, 0x12, 0x6f);
847+ __phy_write(phydev, 0x10, 0x8f82);
848+
849+ /* RemAckCntLimitCtrl = 1 */
850+ __phy_write(phydev, 0x11, 0xfbba);
851+ __phy_write(phydev, 0x12, 0xc3);
852+ __phy_write(phydev, 0x10, 0x87f8);
849853
850− phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_2A30);
851− /* TxClkOffset = 2 */
852− __phy_modify(phydev, MTK_PHY_ANARG_RG, MTK_PHY_TCLKOFFSET_MASK,
853− FIELD_PREP(MTK_PHY_TCLKOFFSET_MASK, 0x2));
854854 phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0);
855+
856+ /* TR_OPEN_LOOP_EN = 1, lpf_x_average = 10 */
857+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG234,
858+ MTK_PHY_TR_OPEN_LOOP_EN_MASK | MTK_PHY_LPF_X_AVERAGE_MASK,
859+ BIT(0) | FIELD_PREP(MTK_PHY_LPF_X_AVERAGE_MASK, 0xa));
860+
861+ /* rg_tr_lpf_cnt_val = 1023 */
862+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LPF_CNT_VAL, 0x3ff);
855863 }
856864
857865 static void mt798x_phy_eee(struct phy_device *phydev)
@@ -884,11 +892,11 @@ static void mt798x_phy_eee(struct phy_device *phydev) · 26 unmodified lines
884892 MTK_PHY_LPI_SLV_SEND_TX_EN,
885893 FIELD_PREP(MTK_PHY_LPI_SLV_SEND_TX_TIMER_MASK, 0x120));
886894
887− phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG239,
888− MTK_PHY_LPI_SEND_LOC_TIMER_MASK |
889− MTK_PHY_LPI_TXPCS_LOC_RCV,
890− FIELD_PREP(MTK_PHY_LPI_SEND_LOC_TIMER_MASK, 0x117));
895+ /* Keep MTK_PHY_LPI_SEND_LOC_TIMER as 375 */
896+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG239,
897+ MTK_PHY_LPI_TXPCS_LOC_RCV);
891898
899+ /* This also fixes some IoT issues, such as CH340 */
892900 phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG2C7,
893901 MTK_PHY_MAX_GAIN_MASK | MTK_PHY_MIN_GAIN_MASK,
894902 FIELD_PREP(MTK_PHY_MAX_GAIN_MASK, 0x8) |
@@ -922,7 +930,7 @@ static void mt798x_phy_eee(struct phy_device *phydev) · 27 unmodified lines
922930 __phy_write(phydev, 0x12, 0x0);
923931 __phy_write(phydev, 0x10, 0x9690);
924932
925− /* REG_EEE_st2TrKf1000 = 3 */
933+ /* REG_EEE_st2TrKf1000 = 2 */
926934 __phy_write(phydev, 0x11, 0x114f);
927935 __phy_write(phydev, 0x12, 0x2);
928936 __phy_write(phydev, 0x10, 0x969a);
@@ -947,7 +955,7 @@ static void mt798x_phy_eee(struct phy_device *phydev) · 18 unmodified lines
947955 __phy_write(phydev, 0x12, 0x0);
948956 __phy_write(phydev, 0x10, 0x96b8);
949957
950− /* REGEEE_wake_slv_tr_wait_dfesigdet_en = 1 */
958+ /* REGEEE_wake_slv_tr_wait_dfesigdet_en = 0 */
951959 __phy_write(phydev, 0x11, 0x1463);
952960 __phy_write(phydev, 0x12, 0x0);
953961 __phy_write(phydev, 0x10, 0x96ca);
@@ -1459,6 +1467,13 @@ static int mt7988_phy_probe(struct phy_device *phydev) · 505 unmodified lines
14591467 if (err)
14601468 return err;
14611469
1470+ /* Disable TX power saving at probing to:
1471+ * 1. Meet common mode compliance test criteria
1472+ * 2. Make sure that TX-VCM calibration works fine
1473+ */
1474+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG7,
1475+ MTK_PHY_DA_AD_BUF_BIAS_LP_MASK, 0x3 << 8);
1476+
14621477 return mt798x_phy_calibration(phydev);
14631478 }
14641479
drivers/net/xen-netback/netback.c+40−44
@@ -104,13 +104,12 @@ bool provides_xdp_headroom = true; · 103 unmodified lines
104104 module_param(provides_xdp_headroom, bool, 0644);
105105
106106 static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx,
107− u8 status);
107+ s8 status);
108108
109109 static void make_tx_response(struct xenvif_queue *queue,
110− struct xen_netif_tx_request *txp,
110+ const struct xen_netif_tx_request *txp,
111111 unsigned int extra_count,
112− s8 st);
113−static void push_tx_responses(struct xenvif_queue *queue);
112+ s8 status);
114113
115114 static void xenvif_idx_unmap(struct xenvif_queue *queue, u16 pending_idx);
116115
@@ -208,13 +207,9 @@ static void xenvif_tx_err(struct xenvif_queue *queue, · 91 unmodified lines
208207 unsigned int extra_count, RING_IDX end)
209208 {
210209 RING_IDX cons = queue->tx.req_cons;
211− unsigned long flags;
212210
213211 do {
214− spin_lock_irqsave(&queue->response_lock, flags);
215212 make_tx_response(queue, txp, extra_count, XEN_NETIF_RSP_ERROR);
216− push_tx_responses(queue);
217− spin_unlock_irqrestore(&queue->response_lock, flags);
218213 if (cons == end)
219214 break;
220215 RING_COPY_REQUEST(&queue->tx, cons++, txp);
@@ -465,12 +460,7 @@ static void xenvif_get_requests(struct xenvif_queue *queue, · 244 unmodified lines
465460 for (shinfo->nr_frags = 0; nr_slots > 0 && shinfo->nr_frags < MAX_SKB_FRAGS;
466461 nr_slots--) {
467462 if (unlikely(!txp->size)) {
468− unsigned long flags;
469−
470− spin_lock_irqsave(&queue->response_lock, flags);
471463 make_tx_response(queue, txp, 0, XEN_NETIF_RSP_OKAY);
472− push_tx_responses(queue);
473− spin_unlock_irqrestore(&queue->response_lock, flags);
474464 ++txp;
475465 continue;
476466 }
@@ -496,14 +486,8 @@ static void xenvif_get_requests(struct xenvif_queue *queue, · 19 unmodified lines
496486
497487 for (shinfo->nr_frags = 0; shinfo->nr_frags < nr_slots; ++txp) {
498488 if (unlikely(!txp->size)) {
499− unsigned long flags;
500−
501− spin_lock_irqsave(&queue->response_lock, flags);
502489 make_tx_response(queue, txp, 0,
503490 XEN_NETIF_RSP_OKAY);
504− push_tx_responses(queue);
505− spin_unlock_irqrestore(&queue->response_lock,
506− flags);
507491 continue;
508492 }
509493
@@ -995,7 +979,6 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, · 485 unmodified lines
995979 (ret == 0) ?
996980 XEN_NETIF_RSP_OKAY :
997981 XEN_NETIF_RSP_ERROR);
998− push_tx_responses(queue);
999982 continue;
1000983 }
1001984
@@ -1007,7 +990,6 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, · 5 unmodified lines
1007990
1008991 make_tx_response(queue, &txreq, extra_count,
1009992 XEN_NETIF_RSP_OKAY);
1010− push_tx_responses(queue);
1011993 continue;
1012994 }
1013995
@@ -1433,8 +1415,35 @@ int xenvif_tx_action(struct xenvif_queue *queue, int budget) · 419 unmodified lines
14331415 return work_done;
14341416 }
14351417
1418+static void _make_tx_response(struct xenvif_queue *queue,
1419+ const struct xen_netif_tx_request *txp,
1420+ unsigned int extra_count,
1421+ s8 status)
1422+{
1423+ RING_IDX i = queue->tx.rsp_prod_pvt;
1424+ struct xen_netif_tx_response *resp;
1425+
1426+ resp = RING_GET_RESPONSE(&queue->tx, i);
1427+ resp->id = txp->id;
1428+ resp->status = status;
1429+
1430+ while (extra_count-- != 0)
1431+ RING_GET_RESPONSE(&queue->tx, ++i)->status = XEN_NETIF_RSP_NULL;
1432+
1433+ queue->tx.rsp_prod_pvt = ++i;
1434+}
1435+
1436+static void push_tx_responses(struct xenvif_queue *queue)
1437+{
1438+ int notify;
1439+
1440+ RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&queue->tx, notify);
1441+ if (notify)
1442+ notify_remote_via_irq(queue->tx_irq);
1443+}
1444+
14361445 static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx,
1437− u8 status)
1446+ s8 status)
14381447 {
14391448 struct pending_tx_info *pending_tx_info;
14401449 pending_ring_idx_t index;
@@ -1444,8 +1453,8 @@ static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx, · 3 unmodified lines
14441453
14451454 spin_lock_irqsave(&queue->response_lock, flags);
14461455
1447− make_tx_response(queue, &pending_tx_info->req,
1448− pending_tx_info->extra_count, status);
1456+ _make_tx_response(queue, &pending_tx_info->req,
1457+ pending_tx_info->extra_count, status);
14491458
14501459 /* Release the pending index before pusing the Tx response so
14511460 * its available before a new Tx request is pushed by the
@@ -1459,32 +1468,19 @@ static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx, · 7 unmodified lines
14591468 spin_unlock_irqrestore(&queue->response_lock, flags);
14601469 }
14611470
1462−
14631471 static void make_tx_response(struct xenvif_queue *queue,
1464− struct xen_netif_tx_request *txp,
1472+ const struct xen_netif_tx_request *txp,
14651473 unsigned int extra_count,
1466− s8 st)
1474+ s8 status)
14671475 {
1468− RING_IDX i = queue->tx.rsp_prod_pvt;
1469− struct xen_netif_tx_response *resp;
1470−
1471− resp = RING_GET_RESPONSE(&queue->tx, i);
1472− resp->id = txp->id;
1473− resp->status = st;
1474−
1475− while (extra_count-- != 0)
1476− RING_GET_RESPONSE(&queue->tx, ++i)->status = XEN_NETIF_RSP_NULL;
1476+ unsigned long flags;
14771477
1478− queue->tx.rsp_prod_pvt = ++i;
1479−}
1478+ spin_lock_irqsave(&queue->response_lock, flags);
14801479
1481−static void push_tx_responses(struct xenvif_queue *queue)
1482−{
1483− int notify;
1480+ _make_tx_response(queue, txp, extra_count, status);
1481+ push_tx_responses(queue);
14841482
1485− RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&queue->tx, notify);
1486− if (notify)
1487− notify_remote_via_irq(queue->tx_irq);
1483+ spin_unlock_irqrestore(&queue->response_lock, flags);
14881484 }
14891485
14901486 static void xenvif_idx_unmap(struct xenvif_queue *queue, u16 pending_idx)
include/linux/netfilter/ipset/ip_set.h+4−0
@@ -186,6 +186,8 @@ struct ip_set_type_variant { · 185 unmodified lines
186186 /* Return true if "b" set is the same as "a"
187187 * according to the create set parameters */
188188 bool (*same_set)(const struct ip_set *a, const struct ip_set *b);
189+ /* Cancel ongoing garbage collectors before destroying the set*/
190+ void (*cancel_gc)(struct ip_set *set);
189191 /* Region-locking is used */
190192 bool region_lock;
191193 };
@@ -242,6 +244,8 @@ extern void ip_set_type_unregister(struct ip_set_type *set_type); · 50 unmodified lines
242244
243245 /* A generic IP set */
244246 struct ip_set {
247+ /* For call_cru in destroy */
248+ struct rcu_head rcu;
245249 /* The name of the set */
246250 char name[IPSET_MAXNAMELEN];
247251 /* Lock protecting the set data */
include/net/af_unix.h+14−6
@@ -46,12 +46,6 @@ struct scm_stat { · 45 unmodified lines
4646
4747 #define UNIXCB(skb) (*(struct unix_skb_parms *)&((skb)->cb))
4848
49−#define unix_state_lock(s) spin_lock(&unix_sk(s)->lock)
50−#define unix_state_unlock(s) spin_unlock(&unix_sk(s)->lock)
51−#define unix_state_lock_nested(s) \
52− spin_lock_nested(&unix_sk(s)->lock, \
53− SINGLE_DEPTH_NESTING)
54−
5549 /* The AF_UNIX socket */
5650 struct unix_sock {
5751 /* WARNING: sk has to be the first member */
@@ -77,6 +71,20 @@ struct unix_sock { · 19 unmodified lines
7771 #define unix_sk(ptr) container_of_const(ptr, struct unix_sock, sk)
7872 #define unix_peer(sk) (unix_sk(sk)->peer)
7973
74+#define unix_state_lock(s) spin_lock(&unix_sk(s)->lock)
75+#define unix_state_unlock(s) spin_unlock(&unix_sk(s)->lock)
76+enum unix_socket_lock_class {
77+ U_LOCK_NORMAL,
78+ U_LOCK_SECOND, /* for double locking, see unix_state_double_lock(). */
79+ U_LOCK_DIAG, /* used while dumping icons, see sk_diag_dump_icons(). */
80+};
81+
82+static inline void unix_state_lock_nested(struct sock *sk,
83+ enum unix_socket_lock_class subclass)
84+{
85+ spin_lock_nested(&unix_sk(sk)->lock, subclass);
86+}
87+
8088 #define peer_wait peer_wq.wait
8189
8290 long unix_inq_len(struct sock *sk);
include/net/ip.h+1−1
@@ -767,7 +767,7 @@ int ip_options_rcv_srr(struct sk_buff *skb, struct net_device *dev); · 766 unmodified lines
767767 * Functions provided by ip_sockglue.c
768768 */
769769
770−void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb);
770+void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb, bool drop_dst);
771771 void ip_cmsg_recv_offset(struct msghdr *msg, struct sock *sk,
772772 struct sk_buff *skb, int tlen, int offset);
773773 int ip_cmsg_send(struct sock *sk, struct msghdr *msg,
include/net/netfilter/nf_tables.h+2−0
@@ -1351,6 +1351,7 @@ void nft_obj_notify(struct net *net, const struct nft_table *table, · 1350 unmodified lines
13511351 * @type: stateful object numeric type
13521352 * @owner: module owner
13531353 * @maxattr: maximum netlink attribute
1354+ * @family: address family for AF-specific object types
13541355 * @policy: netlink attribute policy
13551356 */
13561357 struct nft_object_type {
@@ -1360,6 +1361,7 @@ struct nft_object_type { · 3 unmodified lines
13601361 struct list_head list;
13611362 u32 type;
13621363 unsigned int maxattr;
1364+ u8 family;
13631365 struct module *owner;
13641366 const struct nla_policy *policy;
13651367 };
net/batman-adv/multicast.c+3−0
@@ -2175,6 +2175,7 @@ void batadv_mcast_free(struct batadv_priv *bat_priv) · 2174 unmodified lines
21752175 cancel_delayed_work_sync(&bat_priv->mcast.work);
21762176
21772177 batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_MCAST, 2);
2178+ batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_MCAST_TRACKER, 1);
21782179 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_MCAST, 2);
21792180
21802181 /* safely calling outside of worker, as worker was canceled above */
@@ -2198,6 +2199,8 @@ void batadv_mcast_purge_orig(struct batadv_orig_node *orig) · 17 unmodified lines
21982199 BATADV_MCAST_WANT_NO_RTR4);
21992200 batadv_mcast_want_rtr6_update(bat_priv, orig,
22002201 BATADV_MCAST_WANT_NO_RTR6);
2202+ batadv_mcast_have_mc_ptype_update(bat_priv, orig,
2203+ BATADV_MCAST_HAVE_MC_PTYPE_CAPA);
22012204
22022205 spin_unlock_bh(&orig->mcast_handler_lock);
22032206 }
net/bridge/br_multicast.c+15−5
@@ -1762,6 +1762,10 @@ static void br_ip6_multicast_querier_expired(struct timer_list *t) · 1761 unmodified lines
17621762 }
17631763 #endif
17641764
1765+static void br_multicast_query_delay_expired(struct timer_list *t)
1766+{
1767+}
1768+
17651769 static void br_multicast_select_own_querier(struct net_bridge_mcast *brmctx,
17661770 struct br_ip *ip,
17671771 struct sk_buff *skb)
@@ -3198,7 +3202,7 @@ br_multicast_update_query_timer(struct net_bridge_mcast *brmctx, · 1430 unmodified lines
31983202 unsigned long max_delay)
31993203 {
32003204 if (!timer_pending(&query->timer))
3201− query->delay_time = jiffies + max_delay;
3205+ mod_timer(&query->delay_timer, jiffies + max_delay);
32023206
32033207 mod_timer(&query->timer, jiffies + brmctx->multicast_querier_interval);
32043208 }
@@ -4041,13 +4045,11 @@ void br_multicast_ctx_init(struct net_bridge *br, · 836 unmodified lines
40414045 brmctx->multicast_querier_interval = 255 * HZ;
40424046 brmctx->multicast_membership_interval = 260 * HZ;
40434047
4044− brmctx->ip4_other_query.delay_time = 0;
40454048 brmctx->ip4_querier.port_ifidx = 0;
40464049 seqcount_spinlock_init(&brmctx->ip4_querier.seq, &br->multicast_lock);
40474050 brmctx->multicast_igmp_version = 2;
40484051 #if IS_ENABLED(CONFIG_IPV6)
40494052 brmctx->multicast_mld_version = 1;
4050− brmctx->ip6_other_query.delay_time = 0;
40514053 brmctx->ip6_querier.port_ifidx = 0;
40524054 seqcount_spinlock_init(&brmctx->ip6_querier.seq, &br->multicast_lock);
40534055 #endif
@@ -4056,6 +4058,8 @@ void br_multicast_ctx_init(struct net_bridge *br, · 2 unmodified lines
40564058 br_ip4_multicast_local_router_expired, 0);
40574059 timer_setup(&brmctx->ip4_other_query.timer,
40584060 br_ip4_multicast_querier_expired, 0);
4061+ timer_setup(&brmctx->ip4_other_query.delay_timer,
4062+ br_multicast_query_delay_expired, 0);
40594063 timer_setup(&brmctx->ip4_own_query.timer,
40604064 br_ip4_multicast_query_expired, 0);
40614065 #if IS_ENABLED(CONFIG_IPV6)
@@ -4063,6 +4067,8 @@ void br_multicast_ctx_init(struct net_bridge *br, · 1 unmodified line
40634067 br_ip6_multicast_local_router_expired, 0);
40644068 timer_setup(&brmctx->ip6_other_query.timer,
40654069 br_ip6_multicast_querier_expired, 0);
4070+ timer_setup(&brmctx->ip6_other_query.delay_timer,
4071+ br_multicast_query_delay_expired, 0);
40664072 timer_setup(&brmctx->ip6_own_query.timer,
40674073 br_ip6_multicast_query_expired, 0);
40684074 #endif
@@ -4197,10 +4203,12 @@ static void __br_multicast_stop(struct net_bridge_mcast *brmctx) · 128 unmodified lines
41974203 {
41984204 del_timer_sync(&brmctx->ip4_mc_router_timer);
41994205 del_timer_sync(&brmctx->ip4_other_query.timer);
4206+ del_timer_sync(&brmctx->ip4_other_query.delay_timer);
42004207 del_timer_sync(&brmctx->ip4_own_query.timer);
42014208 #if IS_ENABLED(CONFIG_IPV6)
42024209 del_timer_sync(&brmctx->ip6_mc_router_timer);
42034210 del_timer_sync(&brmctx->ip6_other_query.timer);
4211+ del_timer_sync(&brmctx->ip6_other_query.delay_timer);
42044212 del_timer_sync(&brmctx->ip6_own_query.timer);
42054213 #endif
42064214 }
@@ -4643,13 +4651,15 @@ int br_multicast_set_querier(struct net_bridge_mcast *brmctx, unsigned long val) · 436 unmodified lines
46434651 max_delay = brmctx->multicast_query_response_interval;
46444652
46454653 if (!timer_pending(&brmctx->ip4_other_query.timer))
4646− brmctx->ip4_other_query.delay_time = jiffies + max_delay;
4654+ mod_timer(&brmctx->ip4_other_query.delay_timer,
4655+ jiffies + max_delay);
46474656
46484657 br_multicast_start_querier(brmctx, &brmctx->ip4_own_query);
46494658
46504659 #if IS_ENABLED(CONFIG_IPV6)
46514660 if (!timer_pending(&brmctx->ip6_other_query.timer))
4652− brmctx->ip6_other_query.delay_time = jiffies + max_delay;
4661+ mod_timer(&brmctx->ip6_other_query.delay_timer,
4662+ jiffies + max_delay);
46534663
46544664 br_multicast_start_querier(brmctx, &brmctx->ip6_own_query);
46554665 #endif
net/bridge/br_private.h+2−2
@@ -78,7 +78,7 @@ struct bridge_mcast_own_query { · 77 unmodified lines
7878 /* other querier */
7979 struct bridge_mcast_other_query {
8080 struct timer_list timer;
81− unsigned long delay_time;
81+ struct timer_list delay_timer;
8282 };
8383
8484 /* selected querier */
@@ -1159,7 +1159,7 @@ __br_multicast_querier_exists(struct net_bridge_mcast *brmctx, · 1074 unmodified lines
11591159 own_querier_enabled = false;
11601160 }
11611161
1162− return time_is_before_jiffies(querier->delay_time) &&
1162+ return !timer_pending(&querier->delay_timer) &&
11631163 (own_querier_enabled || timer_pending(&querier->timer));
11641164 }
11651165
net/devlink/port.c+1−1
@@ -674,7 +674,7 @@ static int devlink_port_function_validate(struct devlink_port *devlink_port, · 673 unmodified lines
674674 return -EOPNOTSUPP;
675675 }
676676 if (tb[DEVLINK_PORT_FN_ATTR_STATE] && !ops->port_fn_state_set) {
677− NL_SET_ERR_MSG_ATTR(extack, tb[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR],
677+ NL_SET_ERR_MSG_ATTR(extack, tb[DEVLINK_PORT_FN_ATTR_STATE],
678678 "Function does not support state setting");
679679 return -EOPNOTSUPP;
680680 }
net/hsr/hsr_device.c+2−2
@@ -308,7 +308,7 @@ static void send_hsr_supervision_frame(struct hsr_port *master, · 307 unmodified lines
308308
309309 skb = hsr_init_skb(master);
310310 if (!skb) {
311− WARN_ONCE(1, "HSR: Could not send supervision frame\n");
311+ netdev_warn_once(master->dev, "HSR: Could not send supervision frame\n");
312312 return;
313313 }
314314
@@ -355,7 +355,7 @@ static void send_prp_supervision_frame(struct hsr_port *master, · 40 unmodified lines
355355
356356 skb = hsr_init_skb(master);
357357 if (!skb) {
358− WARN_ONCE(1, "PRP: Could not send supervision frame\n");
358+ netdev_warn_once(master->dev, "PRP: Could not send supervision frame\n");
359359 return;
360360 }
361361
net/ipv4/ip_output.c+6−6
@@ -1287,6 +1287,12 @@ static int ip_setup_cork(struct sock *sk, struct inet_cork *cork, · 1286 unmodified lines
12871287 if (unlikely(!rt))
12881288 return -EFAULT;
12891289
1290+ cork->fragsize = ip_sk_use_pmtu(sk) ?
1291+ dst_mtu(&rt->dst) : READ_ONCE(rt->dst.dev->mtu);
1292+
1293+ if (!inetdev_valid_mtu(cork->fragsize))
1294+ return -ENETUNREACH;
1295+
12901296 /*
12911297 * setup for corking.
12921298 */
@@ -1303,12 +1309,6 @@ static int ip_setup_cork(struct sock *sk, struct inet_cork *cork, · 10 unmodified lines
13031309 cork->addr = ipc->addr;
13041310 }
13051311
1306− cork->fragsize = ip_sk_use_pmtu(sk) ?
1307− dst_mtu(&rt->dst) : READ_ONCE(rt->dst.dev->mtu);
1308−
1309− if (!inetdev_valid_mtu(cork->fragsize))
1310− return -ENETUNREACH;
1311−
13121312 cork->gso_size = ipc->gso_size;
13131313
13141314 cork->dst = &rt->dst;
net/ipv4/ip_sockglue.c+4−2
@@ -1363,12 +1363,13 @@ e_inval: · 1362 unmodified lines
13631363 * ipv4_pktinfo_prepare - transfer some info from rtable to skb
13641364 * @sk: socket
13651365 * @skb: buffer
1366+ * @drop_dst: if true, drops skb dst
13661367 *
13671368 * To support IP_CMSG_PKTINFO option, we store rt_iif and specific
13681369 * destination in skb->cb[] before dst drop.
13691370 * This way, receiver doesn't make cache line misses to read rtable.
13701371 */
1371−void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb)
1372+void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb, bool drop_dst)
13721373 {
13731374 struct in_pktinfo *pktinfo = PKTINFO_SKB_CB(skb);
13741375 bool prepare = inet_test_bit(PKTINFO, sk) ||
@@ -1397,7 +1398,8 @@ void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb) · 22 unmodified lines
13971398 pktinfo->ipi_ifindex = 0;
13981399 pktinfo->ipi_spec_dst.s_addr = 0;
13991400 }
1400− skb_dst_drop(skb);
1401+ if (drop_dst)
1402+ skb_dst_drop(skb);
14011403 }
14021404
14031405 int ip_setsockopt(struct sock *sk, int level, int optname, sockptr_t optval,
net/ipv4/ipmr.c+1−1
@@ -1073,7 +1073,7 @@ static int ipmr_cache_report(const struct mr_table *mrt, · 1072 unmodified lines
10731073 msg = (struct igmpmsg *)skb_network_header(skb);
10741074 msg->im_vif = vifi;
10751075 msg->im_vif_hi = vifi >> 8;
1076− ipv4_pktinfo_prepare(mroute_sk, pkt);
1076+ ipv4_pktinfo_prepare(mroute_sk, pkt, false);
10771077 memcpy(skb->cb, pkt->cb, sizeof(skb->cb));
10781078 /* Add our header */
10791079 igmp = skb_put(skb, sizeof(struct igmphdr));
net/ipv4/raw.c+1−1
@@ -292,7 +292,7 @@ static int raw_rcv_skb(struct sock *sk, struct sk_buff *skb) · 291 unmodified lines
292292
293293 /* Charge it to the socket. */
294294
295− ipv4_pktinfo_prepare(sk, skb);
295+ ipv4_pktinfo_prepare(sk, skb, true);
296296 if (sock_queue_rcv_skb_reason(sk, skb, &reason) < 0) {
297297 kfree_skb_reason(skb, reason);
298298 return NET_RX_DROP;
net/ipv4/tcp.c+11−1
@@ -1786,7 +1786,17 @@ static skb_frag_t *skb_advance_to_frag(struct sk_buff *skb, u32 offset_skb, · 1785 unmodified lines
17861786
17871787 static bool can_map_frag(const skb_frag_t *frag)
17881788 {
1789− return skb_frag_size(frag) == PAGE_SIZE && !skb_frag_off(frag);
1789+ struct page *page;
1790+
1791+ if (skb_frag_size(frag) != PAGE_SIZE || skb_frag_off(frag))
1792+ return false;
1793+
1794+ page = skb_frag_page(frag);
1795+
1796+ if (PageCompound(page) || page->mapping)
1797+ return false;
1798+
1799+ return true;
17901800 }
17911801
17921802 static int find_next_mappable_frag(const skb_frag_t *frag,
net/ipv4/udp.c+1−1
@@ -2169,7 +2169,7 @@ static int udp_queue_rcv_one_skb(struct sock *sk, struct sk_buff *skb) · 2168 unmodified lines
21692169
21702170 udp_csum_pull_header(skb);
21712171
2172− ipv4_pktinfo_prepare(sk, skb);
2172+ ipv4_pktinfo_prepare(sk, skb, true);
21732173 return __udp_queue_rcv_skb(sk, skb);
21742174
21752175 csum_error:
net/ipv6/addrconf_core.c+14−7
@@ -220,19 +220,26 @@ const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) { · 219 unmodified lines
220220 EXPORT_SYMBOL_GPL(ipv6_stub);
221221
222222 /* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */
223−const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
223+const struct in6_addr in6addr_loopback __aligned(BITS_PER_LONG/8)
224+ = IN6ADDR_LOOPBACK_INIT;
224225 EXPORT_SYMBOL(in6addr_loopback);
225−const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
226+const struct in6_addr in6addr_any __aligned(BITS_PER_LONG/8)
227+ = IN6ADDR_ANY_INIT;
226228 EXPORT_SYMBOL(in6addr_any);
227−const struct in6_addr in6addr_linklocal_allnodes = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
229+const struct in6_addr in6addr_linklocal_allnodes __aligned(BITS_PER_LONG/8)
230+ = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
228231 EXPORT_SYMBOL(in6addr_linklocal_allnodes);
229−const struct in6_addr in6addr_linklocal_allrouters = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT;
232+const struct in6_addr in6addr_linklocal_allrouters __aligned(BITS_PER_LONG/8)
233+ = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT;
230234 EXPORT_SYMBOL(in6addr_linklocal_allrouters);
231−const struct in6_addr in6addr_interfacelocal_allnodes = IN6ADDR_INTERFACELOCAL_ALLNODES_INIT;
235+const struct in6_addr in6addr_interfacelocal_allnodes __aligned(BITS_PER_LONG/8)
236+ = IN6ADDR_INTERFACELOCAL_ALLNODES_INIT;
232237 EXPORT_SYMBOL(in6addr_interfacelocal_allnodes);
233−const struct in6_addr in6addr_interfacelocal_allrouters = IN6ADDR_INTERFACELOCAL_ALLROUTERS_INIT;
238+const struct in6_addr in6addr_interfacelocal_allrouters __aligned(BITS_PER_LONG/8)
239+ = IN6ADDR_INTERFACELOCAL_ALLROUTERS_INIT;
234240 EXPORT_SYMBOL(in6addr_interfacelocal_allrouters);
235−const struct in6_addr in6addr_sitelocal_allrouters = IN6ADDR_SITELOCAL_ALLROUTERS_INIT;
241+const struct in6_addr in6addr_sitelocal_allrouters __aligned(BITS_PER_LONG/8)
242+ = IN6ADDR_SITELOCAL_ALLROUTERS_INIT;
236243 EXPORT_SYMBOL(in6addr_sitelocal_allrouters);
237244
238245 static void snmp6_free_dev(struct inet6_dev *idev)
net/ipv6/ip6_tunnel.c+18−3
@@ -796,8 +796,8 @@ static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb, · 795 unmodified lines
796796 struct sk_buff *skb),
797797 bool log_ecn_err)
798798 {
799− const struct ipv6hdr *ipv6h = ipv6_hdr(skb);
800− int err;
799+ const struct ipv6hdr *ipv6h;
800+ int nh, err;
801801
802802 if ((!(tpi->flags & TUNNEL_CSUM) &&
803803 (tunnel->parms.i_flags & TUNNEL_CSUM)) ||
@@ -829,7 +829,6 @@ static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb, · 25 unmodified lines
829829 goto drop;
830830 }
831831
832− ipv6h = ipv6_hdr(skb);
833832 skb->protocol = eth_type_trans(skb, tunnel->dev);
834833 skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
835834 } else {
@@ -837,7 +836,23 @@ static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb, · 1 unmodified line
837836 skb_reset_mac_header(skb);
838837 }
839838
839+ /* Save offset of outer header relative to skb->head,
840+ * because we are going to reset the network header to the inner header
841+ * and might change skb->head.
842+ */
843+ nh = skb_network_header(skb) - skb->head;
844+
840845 skb_reset_network_header(skb);
846+
847+ if (!pskb_inet_may_pull(skb)) {
848+ DEV_STATS_INC(tunnel->dev, rx_length_errors);
849+ DEV_STATS_INC(tunnel->dev, rx_errors);
850+ goto drop;
851+ }
852+
853+ /* Get the outer header. */
854+ ipv6h = (struct ipv6hdr *)(skb->head + nh);
855+
841856 memset(skb->cb, 0, sizeof(struct inet6_skb_parm));
842857
843858 __skb_tunnel_rx(skb, tunnel->dev, tunnel->net);
net/llc/af_llc.c+2−0
@@ -226,6 +226,8 @@ static int llc_ui_release(struct socket *sock) · 225 unmodified lines
226226 }
227227 netdev_put(llc->dev, &llc->dev_tracker);
228228 sock_put(sk);
229+ sock_orphan(sk);
230+ sock->sk = NULL;
229231 llc_sk_free(sk);
230232 out:
231233 return 0;
net/mptcp/protocol.c+0−3
@@ -2314,9 +2314,6 @@ bool __mptcp_retransmit_pending_data(struct sock *sk) · 2313 unmodified lines
23142314 if (__mptcp_check_fallback(msk))
23152315 return false;
23162316
2317− if (tcp_rtx_and_write_queues_empty(sk))
2318− return false;
2319−
23202317 /* the closing socket has some data untransmitted and/or unacked:
23212318 * some data in the mptcp rtx queue has not really xmitted yet.
23222319 * keep it simple and re-inject the whole mptcp level rtx queue
net/netfilter/ipset/ip_set_bitmap_gen.h+11−3
@@ -30,6 +30,7 @@ · 29 unmodified lines
3030 #define mtype_del IPSET_TOKEN(MTYPE, _del)
3131 #define mtype_list IPSET_TOKEN(MTYPE, _list)
3232 #define mtype_gc IPSET_TOKEN(MTYPE, _gc)
33+#define mtype_cancel_gc IPSET_TOKEN(MTYPE, _cancel_gc)
3334 #define mtype MTYPE
3435
3536 #define get_ext(set, map, id) ((map)->extensions + ((set)->dsize * (id)))
@@ -59,9 +60,6 @@ mtype_destroy(struct ip_set *set) · 23 unmodified lines
5960 {
6061 struct mtype *map = set->data;
6162
62− if (SET_WITH_TIMEOUT(set))
63− del_timer_sync(&map->gc);
64−
6563 if (set->dsize && set->extensions & IPSET_EXT_DESTROY)
6664 mtype_ext_cleanup(set);
6765 ip_set_free(map->members);
@@ -290,6 +288,15 @@ mtype_gc(struct timer_list *t) · 222 unmodified lines
290288 add_timer(&map->gc);
291289 }
292290
291+static void
292+mtype_cancel_gc(struct ip_set *set)
293+{
294+ struct mtype *map = set->data;
295+
296+ if (SET_WITH_TIMEOUT(set))
297+ del_timer_sync(&map->gc);
298+}
299+
293300 static const struct ip_set_type_variant mtype = {
294301 .kadt = mtype_kadt,
295302 .uadt = mtype_uadt,
@@ -303,6 +310,7 @@ static const struct ip_set_type_variant mtype = { · 7 unmodified lines
303310 .head = mtype_head,
304311 .list = mtype_list,
305312 .same_set = mtype_same_set,
313+ .cancel_gc = mtype_cancel_gc,
306314 };
307315
308316 #endif /* __IP_SET_BITMAP_IP_GEN_H */
net/netfilter/ipset/ip_set_core.c+28−9
@@ -1182,6 +1182,14 @@ ip_set_destroy_set(struct ip_set *set) · 1181 unmodified lines
11821182 kfree(set);
11831183 }
11841184
1185+static void
1186+ip_set_destroy_set_rcu(struct rcu_head *head)
1187+{
1188+ struct ip_set *set = container_of(head, struct ip_set, rcu);
1189+
1190+ ip_set_destroy_set(set);
1191+}
1192+
11851193 static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info,
11861194 const struct nlattr * const attr[])
11871195 {
@@ -1193,8 +1201,6 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info, · 5 unmodified lines
11931201 if (unlikely(protocol_min_failed(attr)))
11941202 return -IPSET_ERR_PROTOCOL;
11951203
1196− /* Must wait for flush to be really finished in list:set */
1197− rcu_barrier();
11981204
11991205 /* Commands are serialized and references are
12001206 * protected by the ip_set_ref_lock.
@@ -1206,8 +1212,10 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info, · 5 unmodified lines
12061212 * counter, so if it's already zero, we can proceed
12071213 * without holding the lock.
12081214 */
1209− read_lock_bh(&ip_set_ref_lock);
12101215 if (!attr[IPSET_ATTR_SETNAME]) {
1216+ /* Must wait for flush to be really finished in list:set */
1217+ rcu_barrier();
1218+ read_lock_bh(&ip_set_ref_lock);
12111219 for (i = 0; i < inst->ip_set_max; i++) {
12121220 s = ip_set(inst, i);
12131221 if (s && (s->ref || s->ref_netlink)) {
@@ -1221,6 +1229,8 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info, · 7 unmodified lines
12211229 s = ip_set(inst, i);
12221230 if (s) {
12231231 ip_set(inst, i) = NULL;
1232+ /* Must cancel garbage collectors */
1233+ s->variant->cancel_gc(s);
12241234 ip_set_destroy_set(s);
12251235 }
12261236 }
@@ -1228,6 +1238,9 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info, · 1 unmodified line
12281238 inst->is_destroyed = false;
12291239 } else {
12301240 u32 flags = flag_exist(info->nlh);
1241+ u16 features = 0;
1242+
1243+ read_lock_bh(&ip_set_ref_lock);
12311244 s = find_set_and_id(inst, nla_data(attr[IPSET_ATTR_SETNAME]),
12321245 &i);
12331246 if (!s) {
@@ -1238,10 +1251,16 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info, · 4 unmodified lines
12381251 ret = -IPSET_ERR_BUSY;
12391252 goto out;
12401253 }
1254+ features = s->type->features;
12411255 ip_set(inst, i) = NULL;
12421256 read_unlock_bh(&ip_set_ref_lock);
1243−
1244− ip_set_destroy_set(s);
1257+ if (features & IPSET_TYPE_NAME) {
1258+ /* Must wait for flush to be really finished */
1259+ rcu_barrier();
1260+ }
1261+ /* Must cancel garbage collectors */
1262+ s->variant->cancel_gc(s);
1263+ call_rcu(&s->rcu, ip_set_destroy_set_rcu);
12451264 }
12461265 return 0;
12471266 out:
@@ -1394,9 +1413,6 @@ static int ip_set_swap(struct sk_buff *skb, const struct nfnl_info *info, · 146 unmodified lines
13941413 ip_set(inst, to_id) = from;
13951414 write_unlock_bh(&ip_set_ref_lock);
13961415
1397− /* Make sure all readers of the old set pointers are completed. */
1398− synchronize_rcu();
1399−
14001416 return 0;
14011417 }
14021418
@@ -2409,8 +2425,11 @@ ip_set_fini(void) · 1006 unmodified lines
24092425 {
24102426 nf_unregister_sockopt(&so_set);
24112427 nfnetlink_subsys_unregister(&ip_set_netlink_subsys);
2412−
24132428 unregister_pernet_subsys(&ip_set_net_ops);
2429+
2430+ /* Wait for call_rcu() in destroy */
2431+ rcu_barrier();
2432+
24142433 pr_debug("these are the famous last words\n");
24152434 }
24162435
net/netfilter/ipset/ip_set_hash_gen.h+12−3
@@ -222,6 +222,7 @@ static const union nf_inet_addr zeromask = {}; · 221 unmodified lines
222222 #undef mtype_gc_do
223223 #undef mtype_gc
224224 #undef mtype_gc_init
225+#undef mtype_cancel_gc
225226 #undef mtype_variant
226227 #undef mtype_data_match
227228
@@ -266,6 +267,7 @@ static const union nf_inet_addr zeromask = {}; · 38 unmodified lines
266267 #define mtype_gc_do IPSET_TOKEN(MTYPE, _gc_do)
267268 #define mtype_gc IPSET_TOKEN(MTYPE, _gc)
268269 #define mtype_gc_init IPSET_TOKEN(MTYPE, _gc_init)
270+#define mtype_cancel_gc IPSET_TOKEN(MTYPE, _cancel_gc)
269271 #define mtype_variant IPSET_TOKEN(MTYPE, _variant)
270272 #define mtype_data_match IPSET_TOKEN(MTYPE, _data_match)
271273
@@ -450,9 +452,6 @@ mtype_destroy(struct ip_set *set) · 178 unmodified lines
450452 struct htype *h = set->data;
451453 struct list_head *l, *lt;
452454
453− if (SET_WITH_TIMEOUT(set))
454− cancel_delayed_work_sync(&h->gc.dwork);
455−
456455 mtype_ahash_destroy(set, ipset_dereference_nfnl(h->table), true);
457456 list_for_each_safe(l, lt, &h->ad) {
458457 list_del(l);
@@ -599,6 +598,15 @@ mtype_gc_init(struct htable_gc *gc) · 140 unmodified lines
599598 queue_delayed_work(system_power_efficient_wq, &gc->dwork, HZ);
600599 }
601600
601+static void
602+mtype_cancel_gc(struct ip_set *set)
603+{
604+ struct htype *h = set->data;
605+
606+ if (SET_WITH_TIMEOUT(set))
607+ cancel_delayed_work_sync(&h->gc.dwork);
608+}
609+
602610 static int
603611 mtype_add(struct ip_set *set, void *value, const struct ip_set_ext *ext,
604612 struct ip_set_ext *mext, u32 flags);
@@ -1441,6 +1449,7 @@ static const struct ip_set_type_variant mtype_variant = { · 836 unmodified lines
14411449 .uref = mtype_uref,
14421450 .resize = mtype_resize,
14431451 .same_set = mtype_same_set,
1452+ .cancel_gc = mtype_cancel_gc,
14441453 .region_lock = true,
14451454 };
14461455
net/netfilter/ipset/ip_set_list_set.c+10−3
@@ -426,9 +426,6 @@ list_set_destroy(struct ip_set *set) · 425 unmodified lines
426426 struct list_set *map = set->data;
427427 struct set_elem *e, *n;
428428
429− if (SET_WITH_TIMEOUT(set))
430− timer_shutdown_sync(&map->gc);
431−
432429 list_for_each_entry_safe(e, n, &map->members, list) {
433430 list_del(&e->list);
434431 ip_set_put_byindex(map->net, e->id);
@@ -545,6 +542,15 @@ list_set_same_set(const struct ip_set *a, const struct ip_set *b) · 110 unmodified lines
545542 a->extensions == b->extensions;
546543 }
547544
545+static void
546+list_set_cancel_gc(struct ip_set *set)
547+{
548+ struct list_set *map = set->data;
549+
550+ if (SET_WITH_TIMEOUT(set))
551+ timer_shutdown_sync(&map->gc);
552+}
553+
548554 static const struct ip_set_type_variant set_variant = {
549555 .kadt = list_set_kadt,
550556 .uadt = list_set_uadt,
@@ -558,6 +564,7 @@ static const struct ip_set_type_variant set_variant = { · 7 unmodified lines
558564 .head = list_set_head,
559565 .list = list_set_list,
560566 .same_set = list_set_same_set,
567+ .cancel_gc = list_set_cancel_gc,
561568 };
562569
563570 static void
net/netfilter/nf_conntrack_proto_sctp.c+1−1
@@ -283,7 +283,7 @@ sctp_new(struct nf_conn *ct, const struct sk_buff *skb, · 282 unmodified lines
283283 pr_debug("Setting vtag %x for secondary conntrack\n",
284284 sh->vtag);
285285 ct->proto.sctp.vtag[IP_CT_DIR_ORIGINAL] = sh->vtag;
286− } else {
286+ } else if (sch->type == SCTP_CID_SHUTDOWN_ACK) {
287287 /* If it is a shutdown ack OOTB packet, we expect a return
288288 shutdown complete, otherwise an ABORT Sec 8.4 (5) and (8) */
289289 pr_debug("Setting vtag %x for new conn OOTB\n",
net/netfilter/nf_conntrack_proto_tcp.c+6−4
@@ -457,7 +457,8 @@ static void tcp_init_sender(struct ip_ct_tcp_state *sender, · 456 unmodified lines
457457 const struct sk_buff *skb,
458458 unsigned int dataoff,
459459 const struct tcphdr *tcph,
460− u32 end, u32 win)
460+ u32 end, u32 win,
461+ enum ip_conntrack_dir dir)
461462 {
462463 /* SYN-ACK in reply to a SYN
463464 * or SYN from reply direction in simultaneous open.
@@ -471,7 +472,8 @@ static void tcp_init_sender(struct ip_ct_tcp_state *sender, · 7 unmodified lines
471472 * Both sides must send the Window Scale option
472473 * to enable window scaling in either direction.
473474 */
474− if (!(sender->flags & IP_CT_TCP_FLAG_WINDOW_SCALE &&
475+ if (dir == IP_CT_DIR_REPLY &&
476+ !(sender->flags & IP_CT_TCP_FLAG_WINDOW_SCALE &&
475477 receiver->flags & IP_CT_TCP_FLAG_WINDOW_SCALE)) {
476478 sender->td_scale = 0;
477479 receiver->td_scale = 0;
@@ -542,7 +544,7 @@ tcp_in_window(struct nf_conn *ct, enum ip_conntrack_dir dir, · 64 unmodified lines
542544 if (tcph->syn) {
543545 tcp_init_sender(sender, receiver,
544546 skb, dataoff, tcph,
545− end, win);
547+ end, win, dir);
546548 if (!tcph->ack)
547549 /* Simultaneous open */
548550 return NFCT_TCP_ACCEPT;
@@ -585,7 +587,7 @@ tcp_in_window(struct nf_conn *ct, enum ip_conntrack_dir dir, · 36 unmodified lines
585587 */
586588 tcp_init_sender(sender, receiver,
587589 skb, dataoff, tcph,
588− end, win);
590+ end, win, dir);
589591
590592 if (dir == IP_CT_DIR_REPLY && !tcph->ack)
591593 return NFCT_TCP_ACCEPT;
net/netfilter/nf_log.c+4−3
@@ -193,11 +193,12 @@ void nf_logger_put(int pf, enum nf_log_type type) · 192 unmodified lines
193193 return;
194194 }
195195
196− BUG_ON(loggers[pf][type] == NULL);
197−
198196 rcu_read_lock();
199197 logger = rcu_dereference(loggers[pf][type]);
200− module_put(logger->me);
198+ if (!logger)
199+ WARN_ON_ONCE(1);
200+ else
201+ module_put(logger->me);
201202 rcu_read_unlock();
202203 }
203204 EXPORT_SYMBOL_GPL(nf_logger_put);
net/netfilter/nf_tables_api.c+9−5
@@ -7551,11 +7551,15 @@ nla_put_failure: · 7550 unmodified lines
75517551 return -1;
75527552 }
75537553
7554−static const struct nft_object_type *__nft_obj_type_get(u32 objtype)
7554+static const struct nft_object_type *__nft_obj_type_get(u32 objtype, u8 family)
75557555 {
75567556 const struct nft_object_type *type;
75577557
75587558 list_for_each_entry(type, &nf_tables_objects, list) {
7559+ if (type->family != NFPROTO_UNSPEC &&
7560+ type->family != family)
7561+ continue;
7562+
75597563 if (objtype == type->type)
75607564 return type;
75617565 }
@@ -7563,11 +7567,11 @@ static const struct nft_object_type *__nft_obj_type_get(u32 objtype) · 1 unmodified line
75637567 }
75647568
75657569 static const struct nft_object_type *
7566−nft_obj_type_get(struct net *net, u32 objtype)
7570+nft_obj_type_get(struct net *net, u32 objtype, u8 family)
75677571 {
75687572 const struct nft_object_type *type;
75697573
7570− type = __nft_obj_type_get(objtype);
7574+ type = __nft_obj_type_get(objtype, family);
75717575 if (type != NULL && try_module_get(type->owner))
75727576 return type;
75737577
@@ -7660,7 +7664,7 @@ static int nf_tables_newobj(struct sk_buff *skb, const struct nfnl_info *info, · 86 unmodified lines
76607664 if (info->nlh->nlmsg_flags & NLM_F_REPLACE)
76617665 return -EOPNOTSUPP;
76627666
7663− type = __nft_obj_type_get(objtype);
7667+ type = __nft_obj_type_get(objtype, family);
76647668 if (WARN_ON_ONCE(!type))
76657669 return -ENOENT;
76667670
@@ -7674,7 +7678,7 @@ static int nf_tables_newobj(struct sk_buff *skb, const struct nfnl_info *info, · 7 unmodified lines
76747678 if (!nft_use_inc(&table->use))
76757679 return -EMFILE;
76767680
7677− type = nft_obj_type_get(net, objtype);
7681+ type = nft_obj_type_get(net, objtype, family);
76787682 if (IS_ERR(type)) {
76797683 err = PTR_ERR(type);
76807684 goto err_type;
net/netfilter/nft_ct.c+24−0
@@ -1250,7 +1250,31 @@ static int nft_ct_expect_obj_init(const struct nft_ctx *ctx, · 1249 unmodified lines
12501250 if (tb[NFTA_CT_EXPECT_L3PROTO])
12511251 priv->l3num = ntohs(nla_get_be16(tb[NFTA_CT_EXPECT_L3PROTO]));
12521252
1253+ switch (priv->l3num) {
1254+ case NFPROTO_IPV4:
1255+ case NFPROTO_IPV6:
1256+ if (priv->l3num != ctx->family)
1257+ return -EINVAL;
1258+
1259+ fallthrough;
1260+ case NFPROTO_INET:
1261+ break;
1262+ default:
1263+ return -EOPNOTSUPP;
1264+ }
1265+
12531266 priv->l4proto = nla_get_u8(tb[NFTA_CT_EXPECT_L4PROTO]);
1267+ switch (priv->l4proto) {
1268+ case IPPROTO_TCP:
1269+ case IPPROTO_UDP:
1270+ case IPPROTO_UDPLITE:
1271+ case IPPROTO_DCCP:
1272+ case IPPROTO_SCTP:
1273+ break;
1274+ default:
1275+ return -EOPNOTSUPP;
1276+ }
1277+
12541278 priv->dport = nla_get_be16(tb[NFTA_CT_EXPECT_DPORT]);
12551279 priv->timeout = nla_get_u32(tb[NFTA_CT_EXPECT_TIMEOUT]);
12561280 priv->size = nla_get_u8(tb[NFTA_CT_EXPECT_SIZE]);
net/netfilter/nft_tunnel.c+1−0
@@ -713,6 +713,7 @@ static const struct nft_object_ops nft_tunnel_obj_ops = { · 712 unmodified lines
713713
714714 static struct nft_object_type nft_tunnel_obj_type __read_mostly = {
715715 .type = NFT_OBJECT_TUNNEL,
716+ .family = NFPROTO_NETDEV,
716717 .ops = &nft_tunnel_obj_ops,
717718 .maxattr = NFTA_TUNNEL_KEY_MAX,
718719 .policy = nft_tunnel_key_policy,
net/nfc/nci/core.c+4−0
@@ -1208,6 +1208,10 @@ void nci_free_device(struct nci_dev *ndev) · 1207 unmodified lines
12081208 {
12091209 nfc_free_device(ndev->nfc_dev);
12101210 nci_hci_deallocate(ndev);
1211+
1212+ /* drop partial rx data packet if present */
1213+ if (ndev->rx_data_reassembly)
1214+ kfree_skb(ndev->rx_data_reassembly);
12111215 kfree(ndev);
12121216 }
12131217 EXPORT_SYMBOL(nci_free_device);
net/smc/smc_core.c+9−3
@@ -1877,9 +1877,15 @@ static bool smcd_lgr_match(struct smc_link_group *lgr, · 1876 unmodified lines
18771877 struct smcd_dev *smcismdev,
18781878 struct smcd_gid *peer_gid)
18791879 {
1880− return lgr->peer_gid.gid == peer_gid->gid && lgr->smcd == smcismdev &&
1881− smc_ism_is_virtual(smcismdev) ?
1882− (lgr->peer_gid.gid_ext == peer_gid->gid_ext) : 1;
1880+ if (lgr->peer_gid.gid != peer_gid->gid ||
1881+ lgr->smcd != smcismdev)
1882+ return false;
1883+
1884+ if (smc_ism_is_virtual(smcismdev) &&
1885+ lgr->peer_gid.gid_ext != peer_gid->gid_ext)
1886+ return false;
1887+
1888+ return true;
18831889 }
18841890
18851891 /* create a new SMC connection (and a new link group if necessary) */
net/unix/af_unix.c+6−8
@@ -1344,13 +1344,11 @@ static void unix_state_double_lock(struct sock *sk1, struct sock *sk2) · 1343 unmodified lines
13441344 unix_state_lock(sk1);
13451345 return;
13461346 }
1347− if (sk1 < sk2) {
1348− unix_state_lock(sk1);
1349− unix_state_lock_nested(sk2);
1350− } else {
1351− unix_state_lock(sk2);
1352− unix_state_lock_nested(sk1);
1353− }
1347+ if (sk1 > sk2)
1348+ swap(sk1, sk2);
1349+
1350+ unix_state_lock(sk1);
1351+ unix_state_lock_nested(sk2, U_LOCK_SECOND);
13541352 }
13551353
13561354 static void unix_state_double_unlock(struct sock *sk1, struct sock *sk2)
@@ -1591,7 +1589,7 @@ restart: · 234 unmodified lines
15911589 goto out_unlock;
15921590 }
15931591
1594− unix_state_lock_nested(sk);
1592+ unix_state_lock_nested(sk, U_LOCK_SECOND);
15951593
15961594 if (sk->sk_state != st) {
15971595 unix_state_unlock(sk);
net/unix/diag.c+1−1
@@ -84,7 +84,7 @@ static int sk_diag_dump_icons(struct sock *sk, struct sk_buff *nlskb) · 83 unmodified lines
8484 * queue lock. With the other's queue locked it's
8585 * OK to lock the state.
8686 */
87− unix_state_lock_nested(req);
87+ unix_state_lock_nested(req, U_LOCK_DIAG);
8888 peer = unix_sk(req)->peer;
8989 buf[i++] = (peer ? sock_i_ino(peer) : 0);
9090 unix_state_unlock(req);
tools/testing/selftests/drivers/net/bonding/lag_lib.sh+11−0
@@ -48,6 +48,17 @@ test_LAG_cleanup() · 47 unmodified lines
4848 ip link add mv0 link "$name" up address "$ucaddr" type macvlan
4949 # Used to test dev->mc handling
5050 ip address add "$addr6" dev "$name"
51+
52+ # Check that addresses were added as expected
53+ (grep_bridge_fdb "$ucaddr" bridge fdb show dev dummy1 ||
54+ grep_bridge_fdb "$ucaddr" bridge fdb show dev dummy2) >/dev/null
55+ check_err $? "macvlan unicast address not found on a slave"
56+
57+ # mcaddr is added asynchronously by addrconf_dad_work(), use busywait
58+ (busywait 10000 grep_bridge_fdb "$mcaddr" bridge fdb show dev dummy1 ||
59+ grep_bridge_fdb "$mcaddr" bridge fdb show dev dummy2) >/dev/null
60+ check_err $? "IPv6 solicited-node multicast mac address not found on a slave"
61+
5162 ip link set dev "$name" down
5263 ip link del "$name"
5364
tools/testing/selftests/drivers/net/team/config+3−1
@@ -1,3 +1,5 @@
1+CONFIG_DUMMY=y
2+CONFIG_IPV6=y
3+CONFIG_MACVLAN=y
14 CONFIG_NET_TEAM=y
25 CONFIG_NET_TEAM_MODE_LOADBALANCE=y
3−CONFIG_MACVLAN=y
tools/testing/selftests/net/Makefile+5−4
@@ -53,8 +53,7 @@ TEST_PROGS += bind_bhash.sh · 52 unmodified lines
5353 TEST_PROGS += ip_local_port_range.sh
5454 TEST_PROGS += rps_default_mask.sh
5555 TEST_PROGS += big_tcp.sh
56−TEST_PROGS_EXTENDED := in_netns.sh setup_loopback.sh setup_veth.sh
57−TEST_PROGS_EXTENDED += toeplitz_client.sh toeplitz.sh lib.sh
56+TEST_PROGS_EXTENDED := toeplitz_client.sh toeplitz.sh
5857 TEST_GEN_FILES = socket nettest
5958 TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy reuseport_addr_any
6059 TEST_GEN_FILES += tcp_mmap tcp_inq psock_snd txring_overwrite
@@ -84,6 +83,7 @@ TEST_PROGS += sctp_vrf.sh · 23 unmodified lines
8483 TEST_GEN_FILES += sctp_hello
8584 TEST_GEN_FILES += csum
8685 TEST_GEN_FILES += nat6to4.o
86+TEST_GEN_FILES += xdp_dummy.o
8787 TEST_GEN_FILES += ip_local_port_range
8888 TEST_GEN_FILES += bind_wildcard
8989 TEST_PROGS += test_vxlan_mdb.sh
@@ -95,6 +95,7 @@ TEST_PROGS += fq_band_pktlimit.sh · 5 unmodified lines
9595 TEST_PROGS += vlan_hw_filter.sh
9696
9797 TEST_FILES := settings
98+TEST_FILES += in_netns.sh lib.sh net_helper.sh setup_loopback.sh setup_veth.sh
9899
99100 include ../lib.mk
100101
@@ -104,7 +105,7 @@ $(OUTPUT)/tcp_inq: LDLIBS += -lpthread · 3 unmodified lines
104105 $(OUTPUT)/bind_bhash: LDLIBS += -lpthread
105106 $(OUTPUT)/io_uring_zerocopy_tx: CFLAGS += -I../../../include/
106107
107−# Rules to generate bpf obj nat6to4.o
108+# Rules to generate bpf objs
108109 CLANG ?= clang
109110 SCRATCH_DIR := $(OUTPUT)/tools
110111 BUILD_DIR := $(SCRATCH_DIR)/build
@@ -139,7 +140,7 @@ endif · 28 unmodified lines
139140
140141 CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH))
141142
142−$(OUTPUT)/nat6to4.o: nat6to4.c $(BPFOBJ) | $(MAKE_DIRS)
143+$(OUTPUT)/nat6to4.o $(OUTPUT)/xdp_dummy.o: $(OUTPUT)/%.o : %.c $(BPFOBJ) | $(MAKE_DIRS)
143144 $(CLANG) -O2 --target=bpf -c $< $(CCINCLUDE) $(CLANG_SYS_INCLUDES) -o $@
144145
145146 $(BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile) \
tools/testing/selftests/net/config+16−0
@@ -19,8 +19,11 @@ CONFIG_BRIDGE_VLAN_FILTERING=y · 18 unmodified lines
1919 CONFIG_BRIDGE=y
2020 CONFIG_CRYPTO_CHACHA20POLY1305=m
2121 CONFIG_VLAN_8021Q=y
22+CONFIG_GENEVE=m
2223 CONFIG_IFB=y
2324 CONFIG_INET_DIAG=y
25+CONFIG_INET_ESP=y
26+CONFIG_INET_ESP_OFFLOAD=y
2427 CONFIG_IP_GRE=m
2528 CONFIG_NETFILTER=y
2629 CONFIG_NETFILTER_ADVANCED=y
@@ -29,7 +32,10 @@ CONFIG_NF_NAT=m · 2 unmodified lines
2932 CONFIG_IP6_NF_IPTABLES=m
3033 CONFIG_IP_NF_IPTABLES=m
3134 CONFIG_IP6_NF_NAT=m
35+CONFIG_IP6_NF_RAW=m
3236 CONFIG_IP_NF_NAT=m
37+CONFIG_IP_NF_RAW=m
38+CONFIG_IP_NF_TARGET_TTL=m
3339 CONFIG_IPV6_GRE=m
3440 CONFIG_IPV6_SEG6_LWTUNNEL=y
3541 CONFIG_L2TP_ETH=m
@@ -45,8 +51,14 @@ CONFIG_NF_TABLES=m · 9 unmodified lines
4551 CONFIG_NF_TABLES_IPV6=y
4652 CONFIG_NF_TABLES_IPV4=y
4753 CONFIG_NFT_NAT=m
54+CONFIG_NETFILTER_XT_MATCH_LENGTH=m
55+CONFIG_NET_ACT_CSUM=m
56+CONFIG_NET_ACT_CT=m
4857 CONFIG_NET_ACT_GACT=m
58+CONFIG_NET_ACT_PEDIT=m
4959 CONFIG_NET_CLS_BASIC=m
60+CONFIG_NET_CLS_BPF=m
61+CONFIG_NET_CLS_MATCHALL=m
5062 CONFIG_NET_CLS_U32=m
5163 CONFIG_NET_IPGRE_DEMUX=m
5264 CONFIG_NET_IPGRE=m
@@ -55,6 +67,9 @@ CONFIG_NET_SCH_HTB=m · 2 unmodified lines
5567 CONFIG_NET_SCH_FQ=m
5668 CONFIG_NET_SCH_ETF=m
5769 CONFIG_NET_SCH_NETEM=y
70+CONFIG_NET_SCH_PRIO=m
71+CONFIG_NFT_COMPAT=m
72+CONFIG_NF_FLOW_TABLE=m
5873 CONFIG_PSAMPLE=m
5974 CONFIG_TCP_MD5SIG=y
6075 CONFIG_TEST_BLACKHOLE_DEV=m
@@ -80,3 +95,4 @@ CONFIG_IP_SCTP=m · 19 unmodified lines
8095 CONFIG_NETFILTER_XT_MATCH_POLICY=m
8196 CONFIG_CRYPTO_ARIA=y
8297 CONFIG_XFRM_INTERFACE=m
98+CONFIG_XFRM_USER=m
tools/testing/selftests/net/forwarding/Makefile+1−1
@@ -112,7 +112,7 @@ TEST_PROGS = bridge_fdb_learning_limit.sh \ · 111 unmodified lines
112112 vxlan_symmetric_ipv6.sh \
113113 vxlan_symmetric.sh
114114
115−TEST_PROGS_EXTENDED := devlink_lib.sh \
115+TEST_FILES := devlink_lib.sh \
116116 ethtool_lib.sh \
117117 fib_offload_lib.sh \
118118 forwarding.config.sample \
tools/testing/selftests/net/lib.sh+4−1
@@ -4,6 +4,9 @@ · 3 unmodified lines
44 ##############################################################################
55 # Defines
66
7+WAIT_TIMEOUT=${WAIT_TIMEOUT:=20}
8+BUSYWAIT_TIMEOUT=$((WAIT_TIMEOUT * 1000)) # ms
9+
710 # Kselftest framework requirement - SKIP code is 4.
811 ksft_skip=4
912 # namespace list created by setup_ns
@@ -48,7 +51,7 @@ cleanup_ns() · 38 unmodified lines
4851
4952 for ns in "$@"; do
5053 ip netns delete "${ns}" &> /dev/null
51− if ! busywait 2 ip netns list \| grep -vq "^$ns$" &> /dev/null; then
54+ if ! busywait $BUSYWAIT_TIMEOUT ip netns list \| grep -vq "^$ns$" &> /dev/null; then
5255 echo "Warn: Failed to remove namespace $ns"
5356 ret=1
5457 fi
tools/testing/selftests/net/mptcp/config+3−0
@@ -22,8 +22,11 @@ CONFIG_NFT_TPROXY=m · 21 unmodified lines
2222 CONFIG_NFT_SOCKET=m
2323 CONFIG_IP_ADVANCED_ROUTER=y
2424 CONFIG_IP_MULTIPLE_TABLES=y
25+CONFIG_IP_NF_FILTER=m
26+CONFIG_IP_NF_MANGLE=m
2527 CONFIG_IP_NF_TARGET_REJECT=m
2628 CONFIG_IPV6_MULTIPLE_TABLES=y
29+CONFIG_IP6_NF_FILTER=m
2730 CONFIG_NET_ACT_CSUM=m
2831 CONFIG_NET_ACT_PEDIT=m
2932 CONFIG_NET_CLS_ACT=y
tools/testing/selftests/net/mptcp/mptcp_join.sh+11−16
@@ -643,13 +643,6 @@ kill_events_pids() · 642 unmodified lines
643643 mptcp_lib_kill_wait $evts_ns2_pid
644644 }
645645
646−kill_tests_wait()
647−{
648− #shellcheck disable=SC2046
649− kill -SIGUSR1 $(ip netns pids $ns2) $(ip netns pids $ns1)
650− wait
651−}
652−
653646 pm_nl_set_limits()
654647 {
655648 local ns=$1
@@ -3453,7 +3446,7 @@ userspace_tests() · 2797 unmodified lines
34533446 chk_mptcp_info subflows 0 subflows 0
34543447 chk_subflows_total 1 1
34553448 kill_events_pids
3456− wait $tests_pid
3449+ mptcp_lib_kill_wait $tests_pid
34573450 fi
34583451
34593452 # userspace pm create destroy subflow
@@ -3475,7 +3468,7 @@ userspace_tests() · 15 unmodified lines
34753468 chk_mptcp_info subflows 0 subflows 0
34763469 chk_subflows_total 1 1
34773470 kill_events_pids
3478− wait $tests_pid
3471+ mptcp_lib_kill_wait $tests_pid
34793472 fi
34803473
34813474 # userspace pm create id 0 subflow
@@ -3494,7 +3487,7 @@ userspace_tests() · 12 unmodified lines
34943487 chk_mptcp_info subflows 1 subflows 1
34953488 chk_subflows_total 2 2
34963489 kill_events_pids
3497− wait $tests_pid
3490+ mptcp_lib_kill_wait $tests_pid
34983491 fi
34993492
35003493 # userspace pm remove initial subflow
@@ -3518,7 +3511,7 @@ userspace_tests() · 17 unmodified lines
35183511 chk_mptcp_info subflows 1 subflows 1
35193512 chk_subflows_total 1 1
35203513 kill_events_pids
3521− wait $tests_pid
3514+ mptcp_lib_kill_wait $tests_pid
35223515 fi
35233516
35243517 # userspace pm send RM_ADDR for ID 0
@@ -3544,7 +3537,7 @@ userspace_tests() · 19 unmodified lines
35443537 chk_mptcp_info subflows 1 subflows 1
35453538 chk_subflows_total 1 1
35463539 kill_events_pids
3547− wait $tests_pid
3540+ mptcp_lib_kill_wait $tests_pid
35483541 fi
35493542 }
35503543
@@ -3558,7 +3551,8 @@ endpoint_tests() · 7 unmodified lines
35583551 pm_nl_set_limits $ns2 2 2
35593552 pm_nl_add_endpoint $ns1 10.0.2.1 flags signal
35603553 speed=slow \
3561− run_tests $ns1 $ns2 10.0.1.1 2>/dev/null &
3554+ run_tests $ns1 $ns2 10.0.1.1 &
3555+ local tests_pid=$!
35623556
35633557 wait_mpj $ns1
35643558 pm_nl_check_endpoint "creation" \
@@ -3573,7 +3567,7 @@ endpoint_tests() · 8 unmodified lines
35733567 pm_nl_add_endpoint $ns2 10.0.2.2 flags signal
35743568 pm_nl_check_endpoint "modif is allowed" \
35753569 $ns2 10.0.2.2 id 1 flags signal
3576− kill_tests_wait
3570+ mptcp_lib_kill_wait $tests_pid
35773571 fi
35783572
35793573 if reset "delete and re-add" &&
@@ -3582,7 +3576,8 @@ endpoint_tests() · 2 unmodified lines
35823576 pm_nl_set_limits $ns2 1 1
35833577 pm_nl_add_endpoint $ns2 10.0.2.2 id 2 dev ns2eth2 flags subflow
35843578 test_linkfail=4 speed=20 \
3585− run_tests $ns1 $ns2 10.0.1.1 2>/dev/null &
3579+ run_tests $ns1 $ns2 10.0.1.1 &
3580+ local tests_pid=$!
35863581
35873582 wait_mpj $ns2
35883583 chk_subflow_nr "before delete" 2
@@ -3597,7 +3592,7 @@ endpoint_tests() · 8 unmodified lines
35973592 wait_mpj $ns2
35983593 chk_subflow_nr "after re-add" 2
35993594 chk_mptcp_info subflows 1 subflows 1
3600− kill_tests_wait
3595+ mptcp_lib_kill_wait $tests_pid
36013596 fi
36023597 }
36033598
tools/testing/selftests/net/mptcp/mptcp_lib.sh+1−1
@@ -6,7 +6,7 @@ readonly KSFT_FAIL=1 · 5 unmodified lines
66 readonly KSFT_SKIP=4
77
88 # shellcheck disable=SC2155 # declare and assign separately
9−readonly KSFT_TEST=$(basename "${0}" | sed 's/\.sh$//g')
9+readonly KSFT_TEST="${MPTCP_LIB_KSFT_TEST:-$(basename "${0}" .sh)}"
1010
1111 MPTCP_LIB_SUBTESTS=()
1212
tools/testing/selftests/net/mptcp/settings+1−1
@@ -1 +1 @@
1−timeout=1200
1+timeout=1800
tools/testing/selftests/net/mptcp/simult_flows.sh+4−4
@@ -284,12 +284,12 @@ done · 283 unmodified lines
284284
285285 setup
286286 run_test 10 10 0 0 "balanced bwidth"
287−run_test 10 10 1 50 "balanced bwidth with unbalanced delay"
287+run_test 10 10 1 25 "balanced bwidth with unbalanced delay"
288288
289289 # we still need some additional infrastructure to pass the following test-cases
290−run_test 30 10 0 0 "unbalanced bwidth"
291−run_test 30 10 1 50 "unbalanced bwidth with unbalanced delay"
292−run_test 30 10 50 1 "unbalanced bwidth with opposed, unbalanced delay"
290+run_test 10 3 0 0 "unbalanced bwidth"
291+run_test 10 3 1 25 "unbalanced bwidth with unbalanced delay"
292+run_test 10 3 25 1 "unbalanced bwidth with opposed, unbalanced delay"
293293
294294 mptcp_lib_result_print_all_tap
295295 exit $ret
tools/testing/selftests/net/net_helper.sh+0−0

File mode changed from 100755 to 100644.

tools/testing/selftests/net/pmtu.sh+9−9
@@ -707,23 +707,23 @@ setup_xfrm6() { · 706 unmodified lines
707707 }
708708
709709 setup_xfrm4udp() {
710− setup_xfrm 4 ${veth4_a_addr} ${veth4_b_addr} "encap espinudp 4500 4500 0.0.0.0"
711− setup_nettest_xfrm 4 4500
710+ setup_xfrm 4 ${veth4_a_addr} ${veth4_b_addr} "encap espinudp 4500 4500 0.0.0.0" && \
711+ setup_nettest_xfrm 4 4500
712712 }
713713
714714 setup_xfrm6udp() {
715− setup_xfrm 6 ${veth6_a_addr} ${veth6_b_addr} "encap espinudp 4500 4500 0.0.0.0"
716− setup_nettest_xfrm 6 4500
715+ setup_xfrm 6 ${veth6_a_addr} ${veth6_b_addr} "encap espinudp 4500 4500 0.0.0.0" && \
716+ setup_nettest_xfrm 6 4500
717717 }
718718
719719 setup_xfrm4udprouted() {
720− setup_xfrm 4 ${prefix4}.${a_r1}.1 ${prefix4}.${b_r1}.1 "encap espinudp 4500 4500 0.0.0.0"
721− setup_nettest_xfrm 4 4500
720+ setup_xfrm 4 ${prefix4}.${a_r1}.1 ${prefix4}.${b_r1}.1 "encap espinudp 4500 4500 0.0.0.0" && \
721+ setup_nettest_xfrm 4 4500
722722 }
723723
724724 setup_xfrm6udprouted() {
725− setup_xfrm 6 ${prefix6}:${a_r1}::1 ${prefix6}:${b_r1}::1 "encap espinudp 4500 4500 0.0.0.0"
726− setup_nettest_xfrm 6 4500
725+ setup_xfrm 6 ${prefix6}:${a_r1}::1 ${prefix6}:${b_r1}::1 "encap espinudp 4500 4500 0.0.0.0" && \
726+ setup_nettest_xfrm 6 4500
727727 }
728728
729729 setup_routing_old() {
@@ -1339,7 +1339,7 @@ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception() { · 609 unmodified lines
13391339
13401340 sleep 1
13411341
1342− dd if=/dev/zero of=/dev/stdout status=none bs=1M count=1 | ${target} socat -T 3 -u STDIN $TCPDST,connect-timeout=3
1342+ dd if=/dev/zero status=none bs=1M count=1 | ${target} socat -T 3 -u STDIN $TCPDST,connect-timeout=3
13431343
13441344 size=$(du -sb $tmpoutfile)
13451345 size=${size%%/tmp/*}
tools/testing/selftests/net/setup_loopback.sh+0−0

File mode changed from 100755 to 100644.

tools/testing/selftests/net/setup_veth.sh+1−1
@@ -11,7 +11,7 @@ setup_veth_ns() { · 10 unmodified lines
1111 local -r ns_mac="$4"
1212
1313 [[ -e /var/run/netns/"${ns_name}" ]] || ip netns add "${ns_name}"
14− echo 100000 > "/sys/class/net/${ns_dev}/gro_flush_timeout"
14+ echo 1000000 > "/sys/class/net/${ns_dev}/gro_flush_timeout"
1515 ip link set dev "${ns_dev}" netns "${ns_name}" mtu 65535
1616 ip -netns "${ns_name}" link set dev "${ns_dev}" up
1717
tools/testing/selftests/net/tcp_ao/config+10−0
@@ -0,0 +1,10 @@
1+CONFIG_CRYPTO_HMAC=y
2+CONFIG_CRYPTO_RMD160=y
3+CONFIG_CRYPTO_SHA1=y
4+CONFIG_IPV6_MULTIPLE_TABLES=y
5+CONFIG_IPV6=y
6+CONFIG_NET_L3_MASTER_DEV=y
7+CONFIG_NET_VRF=y
8+CONFIG_TCP_AO=y
9+CONFIG_TCP_MD5SIG=y
10+CONFIG_VETH=m
tools/testing/selftests/net/tcp_ao/key-management.c+26−20
@@ -417,9 +417,9 @@ struct test_key { · 416 unmodified lines
417417 matches_vrf : 1,
418418 is_current : 1,
419419 is_rnext : 1,
420− used_on_handshake : 1,
421− used_after_accept : 1,
422− used_on_client : 1;
420+ used_on_server_tx : 1,
421+ used_on_client_tx : 1,
422+ skip_counters_checks : 1;
423423 };
424424
425425 struct key_collection {
@@ -609,16 +609,14 @@ static int key_collection_socket(bool server, unsigned int port) · 183 unmodified lines
609609 addr = &this_ip_dest;
610610 sndid = key->client_keyid;
611611 rcvid = key->server_keyid;
612− set_current = key->is_current;
613− set_rnext = key->is_rnext;
612+ key->used_on_client_tx = set_current = key->is_current;
613+ key->used_on_server_tx = set_rnext = key->is_rnext;
614614 }
615615
616616 if (test_add_key_cr(sk, key->password, key->len,
617617 *addr, vrf, sndid, rcvid, key->maclen,
618618 key->alg, set_current, set_rnext))
619619 test_key_error("setsockopt(TCP_AO_ADD_KEY)", key);
620− if (set_current || set_rnext)
621− key->used_on_handshake = 1;
622620 #ifdef DEBUG
623621 test_print("%s [%u/%u] key: { %s, %u:%u, %u, %u:%u:%u:%u (%u)}",
624622 server ? "server" : "client", i, collection.nr_keys,
@@ -640,22 +638,22 @@ static void verify_counters(const char *tst_name, bool is_listen_sk, bool server · 15 unmodified lines
640638 for (i = 0; i < collection.nr_keys; i++) {
641639 struct test_key *key = &collection.keys[i];
642640 uint8_t sndid, rcvid;
643− bool was_used;
641+ bool rx_cnt_expected;
644642
643+ if (key->skip_counters_checks)
644+ continue;
645645 if (server) {
646646 sndid = key->server_keyid;
647647 rcvid = key->client_keyid;
648− if (is_listen_sk)
649− was_used = key->used_on_handshake;
650− else
651− was_used = key->used_after_accept;
648+ rx_cnt_expected = key->used_on_client_tx;
652649 } else {
653650 sndid = key->client_keyid;
654651 rcvid = key->server_keyid;
655− was_used = key->used_on_client;
652+ rx_cnt_expected = key->used_on_server_tx;
656653 }
657654
658− test_tcp_ao_key_counters_cmp(tst_name, a, b, was_used,
655+ test_tcp_ao_key_counters_cmp(tst_name, a, b,
656+ rx_cnt_expected ? TEST_CNT_KEY_GOOD : 0,
659657 sndid, rcvid);
660658 }
661659 test_tcp_ao_counters_free(a);
@@ -843,7 +841,7 @@ static void end_server(const char *tst_name, int sk, · 181 unmodified lines
843841 synchronize_threads(); /* 4: verified => closed */
844842 close(sk);
845843
846− verify_counters(tst_name, true, false, begin, &end);
844+ verify_counters(tst_name, false, true, begin, &end);
847845 synchronize_threads(); /* 5: counters */
848846 }
849847
@@ -916,9 +914,8 @@ static int run_client(const char *tst_name, unsigned int port, · 66 unmodified lines
916914 current_index = nr_keys - 1;
917915 if (rnext_index < 0)
918916 rnext_index = nr_keys - 1;
919− collection.keys[current_index].used_on_handshake = 1;
920− collection.keys[rnext_index].used_after_accept = 1;
921− collection.keys[rnext_index].used_on_client = 1;
917+ collection.keys[current_index].used_on_client_tx = 1;
918+ collection.keys[rnext_index].used_on_server_tx = 1;
922919
923920 synchronize_threads(); /* 3: accepted => send data */
924921 if (test_client_verify(sk, msg_sz, msg_nr, TEST_TIMEOUT_SEC)) {
@@ -1059,7 +1056,16 @@ static void check_current_back(const char *tst_name, unsigned int port, · 134 unmodified lines
10591056 test_error("Can't change the current key");
10601057 if (test_client_verify(sk, msg_len, nr_packets, TEST_TIMEOUT_SEC))
10611058 test_fail("verify failed");
1062− collection.keys[rotate_to_index].used_after_accept = 1;
1059+ /* There is a race here: between setting the current_key with
1060+ * setsockopt(TCP_AO_INFO) and starting to send some data - there
1061+ * might have been a segment received with the desired
1062+ * RNext_key set. In turn that would mean that the first outgoing
1063+ * segment will have the desired current_key (flipped back).
1064+ * Which is what the user/test wants. As it's racy, skip checking
1065+ * the counters, yet check what are the resulting current/rnext
1066+ * keys on both sides.
1067+ */
1068+ collection.keys[rotate_to_index].skip_counters_checks = 1;
10631069
10641070 end_client(tst_name, sk, nr_keys, current_index, rnext_index, &tmp);
10651071 }
@@ -1089,7 +1095,7 @@ static void roll_over_keys(const char *tst_name, unsigned int port, · 23 unmodified lines
10891095 }
10901096 verify_current_rnext(tst_name, sk, -1,
10911097 collection.keys[i].server_keyid);
1092− collection.keys[i].used_on_client = 1;
1098+ collection.keys[i].used_on_server_tx = 1;
10931099 synchronize_threads(); /* verify current/rnext */
10941100 }
10951101 end_client(tst_name, sk, nr_keys, current_index, rnext_index, &tmp);
tools/testing/selftests/net/tcp_ao/lib/sock.c+8−4
@@ -62,7 +62,9 @@ int test_wait_fd(int sk, time_t sec, bool write) · 61 unmodified lines
6262 return -ETIMEDOUT;
6363 }
6464
65− if (getsockopt(sk, SOL_SOCKET, SO_ERROR, &ret, &slen) || ret)
65+ if (getsockopt(sk, SOL_SOCKET, SO_ERROR, &ret, &slen))
66+ return -errno;
67+ if (ret)
6668 return -ret;
6769 return 0;
6870 }
@@ -584,9 +586,11 @@ int test_client_verify(int sk, const size_t msg_len, const size_t nr, · 515 unmodified lines
584586 {
585587 size_t buf_sz = msg_len * nr;
586588 char *buf = alloca(buf_sz);
589+ ssize_t ret;
587590
588591 randomize_buffer(buf, buf_sz);
589− if (test_client_loop(sk, buf, buf_sz, msg_len, timeout_sec) != buf_sz)
590− return -1;
591− return 0;
592+ ret = test_client_loop(sk, buf, buf_sz, msg_len, timeout_sec);
593+ if (ret < 0)
594+ return (int)ret;
595+ return ret != buf_sz ? -1 : 0;
592596 }
tools/testing/selftests/net/tcp_ao/rst.c+90−48
@@ -1,10 +1,33 @@
11 // SPDX-License-Identifier: GPL-2.0
2−/* Author: Dmitry Safonov <dima@arista.com> */
2+/*
3+ * The test checks that both active and passive reset have correct TCP-AO
4+ * signature. An "active" reset (abort) here is procured from closing
5+ * listen() socket with non-accepted connections in the queue:
6+ * inet_csk_listen_stop() => inet_child_forget() =>
7+ * => tcp_disconnect() => tcp_send_active_reset()
8+ *
9+ * The passive reset is quite hard to get on established TCP connections.
10+ * It could be procured from non-established states, but the synchronization
11+ * part from userspace in order to reliably get RST seems uneasy.
12+ * So, instead it's procured by corrupting SEQ number on TIMED-WAIT state.
13+ *
14+ * It's important to test both passive and active RST as they go through
15+ * different code-paths:
16+ * - tcp_send_active_reset() makes no-data skb, sends it with tcp_transmit_skb()
17+ * - tcp_v*_send_reset() create their reply skbs and send them with
18+ * ip_send_unicast_reply()
19+ *
20+ * In both cases TCP-AO signatures have to be correct, which is verified by
21+ * (1) checking that the TCP-AO connection was reset and (2) TCP-AO counters.
22+ *
23+ * Author: Dmitry Safonov <dima@arista.com>
24+ */
325 #include <inttypes.h>
426 #include "../../../../include/linux/kernel.h"
527 #include "aolib.h"
628
729 const size_t quota = 1000;
30+const size_t packet_sz = 100;
831 /*
932 * Backlog == 0 means 1 connection in queue, see:
1033 * commit 64a146513f8f ("[NET]: Revert incorrect accept queue...")
@@ -59,26 +82,6 @@ static void close_forced(int sk) · 48 unmodified lines
5982 close(sk);
6083 }
6184
62−static int test_wait_for_exception(int sk, time_t sec)
63−{
64− struct timeval tv = { .tv_sec = sec };
65− struct timeval *ptv = NULL;
66− fd_set efds;
67− int ret;
68−
69− FD_ZERO(&efds);
70− FD_SET(sk, &efds);
71−
72− if (sec)
73− ptv = &tv;
74−
75− errno = 0;
76− ret = select(sk + 1, NULL, NULL, &efds, ptv);
77− if (ret < 0)
78− return -errno;
79− return ret ? sk : 0;
80−}
81−
8285 static void test_server_active_rst(unsigned int port)
8386 {
8487 struct tcp_ao_counters cnt1, cnt2;
@@ -155,17 +158,16 @@ static void test_server_passive_rst(unsigned int port) · 70 unmodified lines
155158 test_fail("server returned %zd", bytes);
156159 }
157160
158− synchronize_threads(); /* 3: chekpoint/restore the connection */
161+ synchronize_threads(); /* 3: checkpoint the client */
162+ synchronize_threads(); /* 4: close the server, creating twsk */
159163 if (test_get_tcp_ao_counters(sk, &ao2))
160164 test_error("test_get_tcp_ao_counters()");
161−
162− synchronize_threads(); /* 4: terminate server + send more on client */
163− bytes = test_server_run(sk, quota, TEST_RETRANSMIT_SEC);
164165 close(sk);
166+
167+ synchronize_threads(); /* 5: restore the socket, send more data */
165168 test_tcp_ao_counters_cmp("passive RST server", &ao1, &ao2, TEST_CNT_GOOD);
166169
167− synchronize_threads(); /* 5: verified => closed */
168− close(sk);
170+ synchronize_threads(); /* 6: server exits */
169171 }
170172
171173 static void *server_fn(void *arg)
@@ -284,7 +286,7 @@ static void test_client_active_rst(unsigned int port) · 112 unmodified lines
284286 test_error("test_wait_fds(): %d", err);
285287
286288 synchronize_threads(); /* 3: close listen socket */
287− if (test_client_verify(sk[0], 100, quota / 100, TEST_TIMEOUT_SEC))
289+ if (test_client_verify(sk[0], packet_sz, quota / packet_sz, TEST_TIMEOUT_SEC))
288290 test_fail("Failed to send data on connected socket");
289291 else
290292 test_ok("Verified established tcp connection");
@@ -323,7 +325,6 @@ static void test_client_passive_rst(unsigned int port) · 32 unmodified lines
323325 struct tcp_sock_state img;
324326 sockaddr_af saddr;
325327 int sk, err;
326− socklen_t slen = sizeof(err);
327328
328329 sk = socket(test_family, SOCK_STREAM, IPPROTO_TCP);
329330 if (sk < 0)
@@ -337,18 +338,51 @@ static void test_client_passive_rst(unsigned int port) · 7 unmodified lines
337338 test_error("failed to connect()");
338339
339340 synchronize_threads(); /* 2: accepted => send data */
340− if (test_client_verify(sk, 100, quota / 100, TEST_TIMEOUT_SEC))
341+ if (test_client_verify(sk, packet_sz, quota / packet_sz, TEST_TIMEOUT_SEC))
341342 test_fail("Failed to send data on connected socket");
342343 else
343344 test_ok("Verified established tcp connection");
344345
345− synchronize_threads(); /* 3: chekpoint/restore the connection */
346+ synchronize_threads(); /* 3: checkpoint the client */
346347 test_enable_repair(sk);
347348 test_sock_checkpoint(sk, &img, &saddr);
348349 test_ao_checkpoint(sk, &ao_img);
349− test_kill_sk(sk);
350+ test_disable_repair(sk);
350351
351− img.out.seq += quota;
352+ synchronize_threads(); /* 4: close the server, creating twsk */
353+
354+ /*
355+ * The "corruption" in SEQ has to be small enough to fit into TCP
356+ * window, see tcp_timewait_state_process() for out-of-window
357+ * segments.
358+ */
359+ img.out.seq += 5; /* 5 is more noticeable in tcpdump than 1 */
360+
361+ /*
362+ * FIXME: This is kind-of ugly and dirty, but it works.
363+ *
364+ * At this moment, the server has close'ed(sk).
365+ * The passive RST that is being targeted here is new data after
366+ * half-duplex close, see tcp_timewait_state_process() => TCP_TW_RST
367+ *
368+ * What is needed here is:
369+ * (1) wait for FIN from the server
370+ * (2) make sure that the ACK from the client went out
371+ * (3) make sure that the ACK was received and processed by the server
372+ *
373+ * Otherwise, the data that will be sent from "repaired" socket
374+ * post SEQ corruption may get to the server before it's in
375+ * TCP_FIN_WAIT2.
376+ *
377+ * (1) is easy with select()/poll()
378+ * (2) is possible by polling tcpi_state from TCP_INFO
379+ * (3) is quite complex: as server's socket was already closed,
380+ * probably the way to do it would be tcp-diag.
381+ */
382+ sleep(TEST_RETRANSMIT_SEC);
383+
384+ synchronize_threads(); /* 5: restore the socket, send more data */
385+ test_kill_sk(sk);
352386
353387 sk = socket(test_family, SOCK_STREAM, IPPROTO_TCP);
354388 if (sk < 0)
@@ -366,25 +400,33 @@ static void test_client_passive_rst(unsigned int port) · 11 unmodified lines
366400 test_disable_repair(sk);
367401 test_sock_state_free(&img);
368402
369− synchronize_threads(); /* 4: terminate server + send more on client */
370− if (test_client_verify(sk, 100, quota / 100, 2 * TEST_TIMEOUT_SEC))
371− test_ok("client connection broken post-seq-adjust");
372− else
373− test_fail("client connection still works post-seq-adjust");
374−
375− test_wait_for_exception(sk, TEST_TIMEOUT_SEC);
376−
377− if (getsockopt(sk, SOL_SOCKET, SO_ERROR, &err, &slen))
378− test_error("getsockopt()");
379− if (err != ECONNRESET && err != EPIPE)
380− test_fail("client connection was not reset: %d", err);
403+ /*
404+ * This is how "passive reset" is acquired in this test from TCP_TW_RST:
405+ *
406+ * IP 10.0.254.1.7011 > 10.0.1.1.59772: Flags [P.], seq 901:1001, ack 1001, win 249,
407+ * options [tcp-ao keyid 100 rnextkeyid 100 mac 0x10217d6c36a22379086ef3b1], length 100
408+ * IP 10.0.254.1.7011 > 10.0.1.1.59772: Flags [F.], seq 1001, ack 1001, win 249,
409+ * options [tcp-ao keyid 100 rnextkeyid 100 mac 0x104ffc99b98c10a5298cc268], length 0
410+ * IP 10.0.1.1.59772 > 10.0.254.1.7011: Flags [.], ack 1002, win 251,
411+ * options [tcp-ao keyid 100 rnextkeyid 100 mac 0xe496dd4f7f5a8a66873c6f93,nop,nop,sack 1 {1001:1002}], length 0
412+ * IP 10.0.1.1.59772 > 10.0.254.1.7011: Flags [P.], seq 1006:1106, ack 1001, win 251,
413+ * options [tcp-ao keyid 100 rnextkeyid 100 mac 0x1b5f3330fb23fbcd0c77d0ca], length 100
414+ * IP 10.0.254.1.7011 > 10.0.1.1.59772: Flags [R], seq 3215596252, win 0,
415+ * options [tcp-ao keyid 100 rnextkeyid 100 mac 0x0bcfbbf497bce844312304b2], length 0
416+ */
417+ err = test_client_verify(sk, packet_sz, quota / packet_sz, 2 * TEST_TIMEOUT_SEC);
418+ /* Make sure that the connection was reset, not timeouted */
419+ if (err && err == -ECONNRESET)
420+ test_ok("client sock was passively reset post-seq-adjust");
421+ else if (err)
422+ test_fail("client sock was not reset post-seq-adjust: %d", err);
381423 else
382− test_ok("client connection was reset");
424+ test_fail("client sock is yet connected post-seq-adjust");
383425
384426 if (test_get_tcp_ao_counters(sk, &ao2))
385427 test_error("test_get_tcp_ao_counters()");
386428
387− synchronize_threads(); /* 5: verified => closed */
429+ synchronize_threads(); /* 6: server exits */
388430 close(sk);
389431 test_tcp_ao_counters_cmp("client passive RST", &ao1, &ao2, TEST_CNT_GOOD);
390432 }
@@ -410,6 +452,6 @@ static void *client_fn(void *arg) · 19 unmodified lines
410452
411453 int main(int argc, char *argv[])
412454 {
413− test_init(15, server_fn, client_fn);
455+ test_init(14, server_fn, client_fn);
414456 return 0;
415457 }
tools/testing/selftests/net/tcp_ao/settings+1−0
@@ -0,0 +1 @@
1+timeout=120
tools/testing/selftests/net/udpgro.sh+2−2
@@ -7,7 +7,7 @@ source net_helper.sh · 6 unmodified lines
77
88 readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)"
99
10−BPF_FILE="../bpf/xdp_dummy.bpf.o"
10+BPF_FILE="xdp_dummy.o"
1111
1212 # set global exit status, but never reset nonzero one.
1313 check_err()
@@ -197,7 +197,7 @@ run_all() { · 183 unmodified lines
197197 }
198198
199199 if [ ! -f ${BPF_FILE} ]; then
200− echo "Missing ${BPF_FILE}. Build bpf selftest first"
200+ echo "Missing ${BPF_FILE}. Run 'make' first"
201201 exit -1
202202 fi
203203
tools/testing/selftests/net/udpgro_bench.sh+2−2
@@ -7,7 +7,7 @@ source net_helper.sh · 6 unmodified lines
77
88 readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)"
99
10−BPF_FILE="../bpf/xdp_dummy.bpf.o"
10+BPF_FILE="xdp_dummy.o"
1111
1212 cleanup() {
1313 local -r jobs="$(jobs -p)"
@@ -84,7 +84,7 @@ run_all() { · 70 unmodified lines
8484 }
8585
8686 if [ ! -f ${BPF_FILE} ]; then
87− echo "Missing ${BPF_FILE}. Build bpf selftest first"
87+ echo "Missing ${BPF_FILE}. Run 'make' first"
8888 exit -1
8989 fi
9090
tools/testing/selftests/net/udpgro_frglist.sh+3−3
@@ -7,7 +7,7 @@ source net_helper.sh · 6 unmodified lines
77
88 readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)"
99
10−BPF_FILE="../bpf/xdp_dummy.bpf.o"
10+BPF_FILE="xdp_dummy.o"
1111
1212 cleanup() {
1313 local -r jobs="$(jobs -p)"
@@ -85,12 +85,12 @@ run_all() { · 71 unmodified lines
8585 }
8686
8787 if [ ! -f ${BPF_FILE} ]; then
88− echo "Missing ${BPF_FILE}. Build bpf selftest first"
88+ echo "Missing ${BPF_FILE}. Run 'make' first"
8989 exit -1
9090 fi
9191
9292 if [ ! -f nat6to4.o ]; then
93− echo "Missing nat6to4 helper. Build bpf nat6to4.o selftest first"
93+ echo "Missing nat6to4 helper. Run 'make' first"
9494 exit -1
9595 fi
9696
tools/testing/selftests/net/udpgro_fwd.sh+5−3
@@ -1,7 +1,9 @@
11 #!/bin/bash
22 # SPDX-License-Identifier: GPL-2.0
33
4−BPF_FILE="../bpf/xdp_dummy.bpf.o"
4+source net_helper.sh
5+
6+BPF_FILE="xdp_dummy.o"
57 readonly BASE="ns-$(mktemp -u XXXXXX)"
68 readonly SRC=2
79 readonly DST=1
@@ -119,7 +121,7 @@ run_test() { · 111 unmodified lines
119121 ip netns exec $NS_DST $ipt -A INPUT -p udp --dport 8000
120122 ip netns exec $NS_DST ./udpgso_bench_rx -C 1000 -R 10 -n 10 -l 1300 $rx_args &
121123 local spid=$!
122− sleep 0.1
124+ wait_local_port_listen "$NS_DST" 8000 udp
123125 ip netns exec $NS_SRC ./udpgso_bench_tx $family -M 1 -s 13000 -S 1300 -D $dst
124126 local retc=$?
125127 wait $spid
@@ -168,7 +170,7 @@ run_bench() { · 42 unmodified lines
168170 ip netns exec $NS_DST bash -c "echo 2 > /sys/class/net/veth$DST/queues/rx-0/rps_cpus"
169171 ip netns exec $NS_DST taskset 0x2 ./udpgso_bench_rx -C 1000 -R 10 &
170172 local spid=$!
171− sleep 0.1
173+ wait_local_port_listen "$NS_DST" 8000 udp
172174 ip netns exec $NS_SRC taskset 0x1 ./udpgso_bench_tx $family -l 3 -S 1300 -D $dst
173175 local retc=$?
174176 wait $spid
tools/testing/selftests/net/veth.sh+2−2
@@ -1,7 +1,7 @@
11 #!/bin/sh
22 # SPDX-License-Identifier: GPL-2.0
33
4−BPF_FILE="../bpf/xdp_dummy.bpf.o"
4+BPF_FILE="xdp_dummy.o"
55 readonly STATS="$(mktemp -p /tmp ns-XXXXXX)"
66 readonly BASE=`basename $STATS`
77 readonly SRC=2
@@ -218,7 +218,7 @@ while getopts "hs:" option; do · 210 unmodified lines
218218 done
219219
220220 if [ ! -f ${BPF_FILE} ]; then
221− echo "Missing ${BPF_FILE}. Build bpf selftest first"
221+ echo "Missing ${BPF_FILE}. Run 'make' first"
222222 exit 1
223223 fi
224224
tools/testing/selftests/net/xdp_dummy.c+13−0
@@ -0,0 +1,13 @@
1+// SPDX-License-Identifier: GPL-2.0
2+
3+#define KBUILD_MODNAME "xdp_dummy"
4+#include <linux/bpf.h>
5+#include <bpf/bpf_helpers.h>
6+
7+SEC("xdp")
8+int xdp_dummy_prog(struct xdp_md *ctx)
9+{
10+ return XDP_PASS;
11+}
12+
13+char _license[] SEC("license") = "GPL";

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

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

Repository code

Go to file
t