History

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

Pull networking fixes from David Miller: 1) Fix endless loop in nf_tables, from Phil Sutter. 2) Fix cross namespace ip6_gre tunnel hash list corruption, from Olivier Matz. 3) Don't be too strict in phy_start_aneg() otherwise we might not allow restarting auto negotiation. From Heiner Kallweit. 4) Fix various KMSAN uninitialized value cases in tipc, from Ying Xue. 5) Memory leak in act_tunnel_key, from Davide Caratti. 6) Handle chip errata of mv88e6390 PHY, from Andrew Lunn. 7) Remove linear SKB assumption in fou/fou6, from Eric Dumazet. 8) Missing udplite rehash callbacks, from Alexey Kodanev. 9) Log dirty pages properly in vhost, from Jason Wang. 10) Use consume_skb() in neigh_probe() as this is a normal free not a drop, from Yang Wei. Likewise in macvlan_process_broadcast(). 11) Missing device_del() in mdiobus_register() error paths, from Thomas Petazzoni. 12) Fix checksum handling of short packets in mlx5, from Cong Wang. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (96 commits) bpf: in __bpf_redirect_no_mac pull mac only if present virtio_net: bulk free tx skbs net: phy: phy driver features are mandatory isdn: avm: Fix string plus integer warning from Clang net/mlx5e: Fix cb_ident duplicate in indirect block register net/mlx5e: Fix wrong (zero) TX drop counter indication for representor net/mlx5e: Fix wrong error code return on FEC query failure net/mlx5e: Force CHECKSUM_UNNECESSARY for short ethernet frames tools: bpftool: Cleanup license mess bpf: fix inner map masking to prevent oob under speculation bpf: pull in pkt_sched.h header for tooling to fix bpftool build selftests: forwarding: Add a test case for externally learned FDB entries selftests: mlxsw: Test FDB offload indication mlxsw: spectrum_switchdev: Do not treat static FDB entries as sticky net: bridge: Mark FDB entries that were added by user as such mlxsw: spectrum_fid: Update dummy FID index mlxsw: pci: Return error on PCI reset timeout mlxsw: pci: Increase PCI SW reset timeout mlxsw: pci: Ring CQ's doorbell before RDQ's MAINTAINERS: update email addresses of liquidio driver maintainers ...

Linus Torvalds committed 7 years ago

Commit 7d0ae232 parents bb617b9 6436408114 files · +2090 −602Browse files

Unified · Split

114 files
  1. Documentation/networking/index.rst +13 −13
  2. Documentation/networking/rxrpc.txt +0 −45
  3. Documentation/networking/snmp_counter.rst +125 −5
  4. Documentation/networking/timestamping.txt +2 −2
  5. MAINTAINERS +3 −4
  6. drivers/atm/he.c +1 −1
  7. drivers/isdn/hardware/avm/b1.c +1 −1
  8. drivers/net/Kconfig +1 −1
  9. drivers/net/dsa/realtek-smi.c +13 −5
  10. drivers/net/ethernet/amd/xgbe/xgbe-common.h +0 −2
  11. drivers/net/ethernet/amd/xgbe/xgbe-dev.c +16 −6
  12. drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +6 −0
  13. drivers/net/ethernet/intel/igb/igb.h +1 −1
  14. drivers/net/ethernet/intel/igb/igb_ethtool.c +2 −2
  15. drivers/net/ethernet/intel/igb/igb_main.c +7 −7
  16. drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +4 −1
  17. drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +17 −13
  18. drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +13 −0
  19. drivers/net/ethernet/mellanox/mlxsw/pci.c +9 −7
  20. drivers/net/ethernet/mellanox/mlxsw/pci_hw.h +2 −1
  21. drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c +2 −2
  22. drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +6 −6
  23. drivers/net/macvlan.c +1 −1
  24. drivers/net/phy/bcm87xx.c +2 −0
  25. drivers/net/phy/cortina.c +1 −0
  26. drivers/net/phy/marvell.c +35 −2
  27. drivers/net/phy/mdio_bus.c +1 −0
  28. drivers/net/phy/meson-gxl.c +1 −0
  29. drivers/net/phy/micrel.c +2 −0
  30. drivers/net/phy/phy.c +7 −12
  31. drivers/net/phy/phy_device.c +17 −0
  32. drivers/net/phy/teranetics.c +1 −0
  33. drivers/net/ppp/pppoe.c +1 −0
  34. drivers/net/usb/aqc111.c +15 −0
  35. drivers/net/usb/cdc_ether.c +8 −0
  36. drivers/net/virtio_net.c +6 −6
  37. drivers/vhost/net.c +2 −1
  38. drivers/vhost/vhost.c +83 −14
  39. drivers/vhost/vhost.h +2 −1
  40. include/linux/phy.h +4 −2
  41. include/linux/skbuff.h +1 −0
  42. include/net/af_rxrpc.h +0 −16
  43. include/net/ip_fib.h +1 −1
  44. include/net/netfilter/nf_flow_table.h +0 −1
  45. include/uapi/linux/in.h +1 −1
  46. kernel/bpf/btf.c +1 −1
  47. kernel/bpf/cgroup.c +1 −0
  48. kernel/bpf/map_in_map.c +15 −2
  49. kernel/bpf/stackmap.c +7 −2
  50. net/bpfilter/bpfilter_umh_blob.S +1 −1
  51. net/bridge/br_fdb.c +5 −0
  52. net/bridge/br_forward.c +4 −5
  53. net/bridge/br_netfilter_ipv6.c +1 −0
  54. net/bridge/netfilter/ebtables.c +4 −2
  55. net/bridge/netfilter/nft_reject_bridge.c +1 −0
  56. net/core/filter.c +20 −12
  57. net/core/lwt_bpf.c +1 −0
  58. net/core/neighbour.c +2 −2
  59. net/ipv4/fib_frontend.c +2 −2
  60. net/ipv4/fib_trie.c +12 −3
  61. net/ipv4/fou.c +7 −2
  62. net/ipv4/ip_gre.c +14 −9
  63. net/ipv4/ip_input.c +1 −0
  64. net/ipv4/tcp.c +1 −1
  65. net/ipv4/udp.c +13 −5
  66. net/ipv4/udp_impl.h +1 −0
  67. net/ipv4/udplite.c +1 −0
  68. net/ipv6/fou6.c +7 −2
  69. net/ipv6/ip6_gre.c +10 −4
  70. net/ipv6/route.c +2 −12
  71. net/ipv6/udp.c +13 −5
  72. net/ipv6/udp_impl.h +1 −0
  73. net/ipv6/udplite.c +1 −0
  74. net/netfilter/nf_flow_table_core.c +3 −2
  75. net/netfilter/nf_tables_api.c +7 −7
  76. net/netfilter/nft_flow_offload.c +8 −5
  77. net/openvswitch/flow_netlink.c +1 −1
  78. net/packet/af_packet.c +2 −1
  79. net/rxrpc/af_rxrpc.c +0 −70
  80. net/rxrpc/ar-internal.h +12 −7
  81. net/rxrpc/call_object.c +0 −97
  82. net/rxrpc/conn_client.c +1 −4
  83. net/rxrpc/sendmsg.c +11 −13
  84. net/sched/act_tunnel_key.c +11 −8
  85. net/sched/cls_api.c +1 −2
  86. net/sched/cls_flower.c +14 −5
  87. net/sched/sch_cake.c +3 −2
  88. net/sched/sch_cbs.c +2 −1
  89. net/sched/sch_drr.c +5 −2
  90. net/sched/sch_dsmark.c +2 −1
  91. net/sched/sch_hfsc.c +5 −4
  92. net/sched/sch_htb.c +2 −1
  93. net/sched/sch_prio.c +2 −1
  94. net/sched/sch_qfq.c +12 −8
  95. net/sched/sch_tbf.c +2 −1
  96. net/sctp/ipv6.c +1 −4
  97. net/sctp/protocol.c +1 −3
  98. net/tipc/netlink_compat.c +49 −1
  99. net/tipc/topsrv.c +1 −1
  100. net/xdp/xdp_umem.c +13 −3
  101. samples/bpf/Makefile +1 −0
  102. samples/bpf/asm_goto_workaround.h +16 −0
  103. tools/bpf/bpftool/Makefile +8 −1
  104. tools/bpf/bpftool/json_writer.c +1 −6
  105. tools/bpf/bpftool/json_writer.h +0 −5
  106. tools/include/uapi/linux/pkt_sched.h +1163 −0
  107. tools/lib/bpf/bpf.c +15 −4
  108. tools/testing/selftests/bpf/Makefile +1 −0
  109. tools/testing/selftests/bpf/test_progs.c +30 −0
  110. tools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh +20 −0
  111. tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh +33 −1
  112. tools/testing/selftests/networking/timestamping/txtimestamp.c +1 −1
  113. tools/testing/selftests/tc-testing/tc-tests/actions/ife.json +44 −44
  114. tools/testing/selftests/tc-testing/tc-tests/actions/tunnel_key.json +1 −30
Documentation/networking/index.rst+13−13
@@ -11,19 +11,19 @@ Contents: · 10 unmodified lines
1111 batman-adv
1212 can
1313 can_ucan_protocol
14− dpaa2/index
15− e100
16− e1000
17− e1000e
18− fm10k
19− igb
20− igbvf
21− ixgb
22− ixgbe
23− ixgbevf
24− i40e
25− iavf
26− ice
14+ device_drivers/freescale/dpaa2/index
15+ device_drivers/intel/e100
16+ device_drivers/intel/e1000
17+ device_drivers/intel/e1000e
18+ device_drivers/intel/fm10k
19+ device_drivers/intel/igb
20+ device_drivers/intel/igbvf
21+ device_drivers/intel/ixgb
22+ device_drivers/intel/ixgbe
23+ device_drivers/intel/ixgbevf
24+ device_drivers/intel/i40e
25+ device_drivers/intel/iavf
26+ device_drivers/intel/ice
2727 kapi
2828 z8530book
2929 msg_zerocopy
Documentation/networking/rxrpc.txt+0−45
@@ -1000,51 +1000,6 @@ The kernel interface functions are as follows: · 999 unmodified lines
10001000 size should be set when the call is begun. tx_total_len may not be less
10011001 than zero.
10021002
1003− (*) Check to see the completion state of a call so that the caller can assess
1004− whether it needs to be retried.
1005−
1006− enum rxrpc_call_completion {
1007− RXRPC_CALL_SUCCEEDED,
1008− RXRPC_CALL_REMOTELY_ABORTED,
1009− RXRPC_CALL_LOCALLY_ABORTED,
1010− RXRPC_CALL_LOCAL_ERROR,
1011− RXRPC_CALL_NETWORK_ERROR,
1012− };
1013−
1014− int rxrpc_kernel_check_call(struct socket *sock, struct rxrpc_call *call,
1015− enum rxrpc_call_completion *_compl,
1016− u32 *_abort_code);
1017−
1018− On return, -EINPROGRESS will be returned if the call is still ongoing; if
1019− it is finished, *_compl will be set to indicate the manner of completion,
1020− *_abort_code will be set to any abort code that occurred. 0 will be
1021− returned on a successful completion, -ECONNABORTED will be returned if the
1022− client failed due to a remote abort and anything else will return an
1023− appropriate error code.
1024−
1025− The caller should look at this information to decide if it's worth
1026− retrying the call.
1027−
1028− (*) Retry a client call.
1029−
1030− int rxrpc_kernel_retry_call(struct socket *sock,
1031− struct rxrpc_call *call,
1032− struct sockaddr_rxrpc *srx,
1033− struct key *key);
1034−
1035− This attempts to partially reinitialise a call and submit it again while
1036− reusing the original call's Tx queue to avoid the need to repackage and
1037− re-encrypt the data to be sent. call indicates the call to retry, srx the
1038− new address to send it to and key the encryption key to use for signing or
1039− encrypting the packets.
1040−
1041− For this to work, the first Tx data packet must still be in the transmit
1042− queue, and currently this is only permitted for local and network errors
1043− and the call must not have been aborted. Any partially constructed Tx
1044− packet is left as is and can continue being filled afterwards.
1045−
1046− It returns 0 if the call was requeued and an error otherwise.
1047−
10481003 (*) Get call RTT.
10491004
10501005 u64 rxrpc_kernel_get_rtt(struct socket *sock, struct rxrpc_call *call);
Documentation/networking/snmp_counter.rst+125−5
@@ -336,7 +336,26 @@ time client replies ACK, this socket will get another chance to move · 335 unmodified lines
336336 to the accept queue.
337337
338338
339−TCP Fast Open
339+* TcpEstabResets
340+Defined in `RFC1213 tcpEstabResets`_.
341+
342+.. _RFC1213 tcpEstabResets: https://tools.ietf.org/html/rfc1213#page-48
343+
344+* TcpAttemptFails
345+Defined in `RFC1213 tcpAttemptFails`_.
346+
347+.. _RFC1213 tcpAttemptFails: https://tools.ietf.org/html/rfc1213#page-48
348+
349+* TcpOutRsts
350+Defined in `RFC1213 tcpOutRsts`_. The RFC says this counter indicates
351+the 'segments sent containing the RST flag', but in linux kernel, this
352+couner indicates the segments kerenl tried to send. The sending
353+process might be failed due to some errors (e.g. memory alloc failed).
354+
355+.. _RFC1213 tcpOutRsts: https://tools.ietf.org/html/rfc1213#page-52
356+
357+
358+TCP Fast Path
340359 ============
341360 When kernel receives a TCP packet, it has two paths to handler the
342361 packet, one is fast path, another is slow path. The comment in kernel
@@ -383,8 +402,6 @@ increase 1. · 40 unmodified lines
383402
384403 TCP abort
385404 ========
386−
387−
388405 * TcpExtTCPAbortOnData
389406 It means TCP layer has data in flight, but need to close the
390407 connection. So TCP layer sends a RST to the other side, indicate the
@@ -545,7 +562,6 @@ packet yet, the sender would know packet 4 is out of order. The TCP · 154 unmodified lines
545562 stack of kernel will increase TcpExtTCPSACKReorder for both of the
546563 above scenarios.
547564
548−
549565 DSACK
550566 =====
551567 The DSACK is defined in `RFC2883`_. The receiver uses DSACK to report
@@ -566,13 +582,63 @@ The TCP stack receives an out of order duplicate packet, so it sends a · 14 unmodified lines
566582 DSACK to the sender.
567583
568584 * TcpExtTCPDSACKRecv
569−The TCP stack receives a DSACK, which indicate an acknowledged
585+The TCP stack receives a DSACK, which indicates an acknowledged
570586 duplicate packet is received.
571587
572588 * TcpExtTCPDSACKOfoRecv
573589 The TCP stack receives a DSACK, which indicate an out of order
574590 duplicate packet is received.
575591
592+invalid SACK and DSACK
593+====================
594+When a SACK (or DSACK) block is invalid, a corresponding counter would
595+be updated. The validation method is base on the start/end sequence
596+number of the SACK block. For more details, please refer the comment
597+of the function tcp_is_sackblock_valid in the kernel source code. A
598+SACK option could have up to 4 blocks, they are checked
599+individually. E.g., if 3 blocks of a SACk is invalid, the
600+corresponding counter would be updated 3 times. The comment of the
601+`Add counters for discarded SACK blocks`_ patch has additional
602+explaination:
603+
604+.. _Add counters for discarded SACK blocks: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=18f02545a9a16c9a89778b91a162ad16d510bb32
605+
606+* TcpExtTCPSACKDiscard
607+This counter indicates how many SACK blocks are invalid. If the invalid
608+SACK block is caused by ACK recording, the TCP stack will only ignore
609+it and won't update this counter.
610+
611+* TcpExtTCPDSACKIgnoredOld and TcpExtTCPDSACKIgnoredNoUndo
612+When a DSACK block is invalid, one of these two counters would be
613+updated. Which counter will be updated depends on the undo_marker flag
614+of the TCP socket. If the undo_marker is not set, the TCP stack isn't
615+likely to re-transmit any packets, and we still receive an invalid
616+DSACK block, the reason might be that the packet is duplicated in the
617+middle of the network. In such scenario, TcpExtTCPDSACKIgnoredNoUndo
618+will be updated. If the undo_marker is set, TcpExtTCPDSACKIgnoredOld
619+will be updated. As implied in its name, it might be an old packet.
620+
621+SACK shift
622+=========
623+The linux networking stack stores data in sk_buff struct (skb for
624+short). If a SACK block acrosses multiple skb, the TCP stack will try
625+to re-arrange data in these skb. E.g. if a SACK block acknowledges seq
626+10 to 15, skb1 has seq 10 to 13, skb2 has seq 14 to 20. The seq 14 and
627+15 in skb2 would be moved to skb1. This operation is 'shift'. If a
628+SACK block acknowledges seq 10 to 20, skb1 has seq 10 to 13, skb2 has
629+seq 14 to 20. All data in skb2 will be moved to skb1, and skb2 will be
630+discard, this operation is 'merge'.
631+
632+* TcpExtTCPSackShifted
633+A skb is shifted
634+
635+* TcpExtTCPSackMerged
636+A skb is merged
637+
638+* TcpExtTCPSackShiftFallback
639+A skb should be shifted or merged, but the TCP stack doesn't do it for
640+some reasons.
641+
576642 TCP out of order
577643 ===============
578644 * TcpExtTCPOFOQueue
@@ -662,6 +728,60 @@ unacknowledged number (more strict than `RFC 5961 section 5.2`_). · 83 unmodified lines
662728 .. _RFC 5961 section 4.2: https://tools.ietf.org/html/rfc5961#page-9
663729 .. _RFC 5961 section 5.2: https://tools.ietf.org/html/rfc5961#page-11
664730
731+TCP receive window
732+=================
733+* TcpExtTCPWantZeroWindowAdv
734+Depending on current memory usage, the TCP stack tries to set receive
735+window to zero. But the receive window might still be a no-zero
736+value. For example, if the previous window size is 10, and the TCP
737+stack receives 3 bytes, the current window size would be 7 even if the
738+window size calculated by the memory usage is zero.
739+
740+* TcpExtTCPToZeroWindowAdv
741+The TCP receive window is set to zero from a no-zero value.
742+
743+* TcpExtTCPFromZeroWindowAdv
744+The TCP receive window is set to no-zero value from zero.
745+
746+
747+Delayed ACK
748+==========
749+The TCP Delayed ACK is a technique which is used for reducing the
750+packet count in the network. For more details, please refer the
751+`Delayed ACK wiki`_
752+
753+.. _Delayed ACK wiki: https://en.wikipedia.org/wiki/TCP_delayed_acknowledgment
754+
755+* TcpExtDelayedACKs
756+A delayed ACK timer expires. The TCP stack will send a pure ACK packet
757+and exit the delayed ACK mode.
758+
759+* TcpExtDelayedACKLocked
760+A delayed ACK timer expires, but the TCP stack can't send an ACK
761+immediately due to the socket is locked by a userspace program. The
762+TCP stack will send a pure ACK later (after the userspace program
763+unlock the socket). When the TCP stack sends the pure ACK later, the
764+TCP stack will also update TcpExtDelayedACKs and exit the delayed ACK
765+mode.
766+
767+* TcpExtDelayedACKLost
768+It will be updated when the TCP stack receives a packet which has been
769+ACKed. A Delayed ACK loss might cause this issue, but it would also be
770+triggered by other reasons, such as a packet is duplicated in the
771+network.
772+
773+Tail Loss Probe (TLP)
774+===================
775+TLP is an algorithm which is used to detect TCP packet loss. For more
776+details, please refer the `TLP paper`_.
777+
778+.. _TLP paper: https://tools.ietf.org/html/draft-dukkipati-tcpm-tcp-loss-probe-01
779+
780+* TcpExtTCPLossProbes
781+A TLP probe packet is sent.
782+
783+* TcpExtTCPLossProbeRecovery
784+A packet loss is detected and recovered by TLP.
665785
666786 examples
667787 =======
Documentation/networking/timestamping.txt+2−2
@@ -417,7 +417,7 @@ is again deprecated and ts[2] holds a hardware timestamp if set. · 416 unmodified lines
417417
418418 Hardware time stamping must also be initialized for each device driver
419419 that is expected to do hardware time stamping. The parameter is defined in
420−/include/linux/net_tstamp.h as:
420+include/uapi/linux/net_tstamp.h as:
421421
422422 struct hwtstamp_config {
423423 int flags; /* no flags defined right now, must be zero */
@@ -487,7 +487,7 @@ enum { · 63 unmodified lines
487487 HWTSTAMP_FILTER_PTP_V1_L4_EVENT,
488488
489489 /* for the complete list of values, please check
490− * the include file /include/linux/net_tstamp.h
490+ * the include file include/uapi/linux/net_tstamp.h
491491 */
492492 };
493493
MAINTAINERS+3−4
@@ -3471,10 +3471,9 @@ F: drivers/i2c/busses/i2c-octeon* · 3470 unmodified lines
34713471 F: drivers/i2c/busses/i2c-thunderx*
34723472
34733473 CAVIUM LIQUIDIO NETWORK DRIVER
3474−M: Derek Chickles <derek.chickles@caviumnetworks.com>
3475−M: Satanand Burla <satananda.burla@caviumnetworks.com>
3476−M: Felix Manlunas <felix.manlunas@caviumnetworks.com>
3477−M: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
3474+M: Derek Chickles <dchickles@marvell.com>
3475+M: Satanand Burla <sburla@marvell.com>
3476+M: Felix Manlunas <fmanlunas@marvell.com>
34783477 L: netdev@vger.kernel.org
34793478 W: http://www.cavium.com
34803479 S: Supported
drivers/atm/he.c+1−1
@@ -718,7 +718,7 @@ static int he_init_cs_block_rcm(struct he_dev *he_dev) · 717 unmodified lines
718718 instead of '/ 512', use '>> 9' to prevent a call
719719 to divdu3 on x86 platforms
720720 */
721− rate_cps = (unsigned long long) (1 << exp) * (man + 512) >> 9;
721+ rate_cps = (unsigned long long) (1UL << exp) * (man + 512) >> 9;
722722
723723 if (rate_cps < 10)
724724 rate_cps = 10; /* 2.2.1 minimum payload rate is 10 cps */
drivers/isdn/hardware/avm/b1.c+1−1
@@ -423,7 +423,7 @@ void b1_parse_version(avmctrl_info *cinfo) · 422 unmodified lines
423423 int i, j;
424424
425425 for (j = 0; j < AVM_MAXVERSION; j++)
426− cinfo->version[j] = "\0\0" + 1;
426+ cinfo->version[j] = "";
427427 for (i = 0, j = 0;
428428 j < AVM_MAXVERSION && i < cinfo->versionlen;
429429 j++, i += cinfo->versionbuf[i] + 1)
drivers/net/Kconfig+1−1
@@ -519,7 +519,7 @@ config NET_FAILOVER · 518 unmodified lines
519519 and destroy a failover master netdev and manages a primary and
520520 standby slave netdevs that get registered via the generic failover
521521 infrastructure. This can be used by paravirtual drivers to enable
522− an alternate low latency datapath. It alsoenables live migration of
522+ an alternate low latency datapath. It also enables live migration of
523523 a VM with direct attached VF by failing over to the paravirtual
524524 datapath when the VF is unplugged.
525525
drivers/net/dsa/realtek-smi.c+13−5
@@ -347,16 +347,17 @@ int realtek_smi_setup_mdio(struct realtek_smi *smi) · 346 unmodified lines
347347 struct device_node *mdio_np;
348348 int ret;
349349
350− mdio_np = of_find_compatible_node(smi->dev->of_node, NULL,
351− "realtek,smi-mdio");
350+ mdio_np = of_get_compatible_child(smi->dev->of_node, "realtek,smi-mdio");
352351 if (!mdio_np) {
353352 dev_err(smi->dev, "no MDIO bus node\n");
354353 return -ENODEV;
355354 }
356355
357356 smi->slave_mii_bus = devm_mdiobus_alloc(smi->dev);
358− if (!smi->slave_mii_bus)
359− return -ENOMEM;
357+ if (!smi->slave_mii_bus) {
358+ ret = -ENOMEM;
359+ goto err_put_node;
360+ }
360361 smi->slave_mii_bus->priv = smi;
361362 smi->slave_mii_bus->name = "SMI slave MII";
362363 smi->slave_mii_bus->read = realtek_smi_mdio_read;
@@ -371,10 +372,15 @@ int realtek_smi_setup_mdio(struct realtek_smi *smi) · 8 unmodified lines
371372 if (ret) {
372373 dev_err(smi->dev, "unable to register MDIO bus %s\n",
373374 smi->slave_mii_bus->id);
374− of_node_put(mdio_np);
375+ goto err_put_node;
375376 }
376377
377378 return 0;
379+
380+err_put_node:
381+ of_node_put(mdio_np);
382+
383+ return ret;
378384 }
379385
380386 static int realtek_smi_probe(struct platform_device *pdev)
@@ -457,6 +463,8 @@ static int realtek_smi_remove(struct platform_device *pdev) · 76 unmodified lines
457463 struct realtek_smi *smi = dev_get_drvdata(&pdev->dev);
458464
459465 dsa_unregister_switch(smi->ds);
466+ if (smi->slave_mii_bus)
467+ of_node_put(smi->slave_mii_bus->dev.of_node);
460468 gpiod_set_value(smi->reset, 1);
461469
462470 return 0;
drivers/net/ethernet/amd/xgbe/xgbe-common.h+0−2
@@ -431,8 +431,6 @@ · 430 unmodified lines
431431 #define MAC_MDIOSCAR_PA_WIDTH 5
432432 #define MAC_MDIOSCAR_RA_INDEX 0
433433 #define MAC_MDIOSCAR_RA_WIDTH 16
434−#define MAC_MDIOSCAR_REG_INDEX 0
435−#define MAC_MDIOSCAR_REG_WIDTH 21
436434 #define MAC_MDIOSCCDR_BUSY_INDEX 22
437435 #define MAC_MDIOSCCDR_BUSY_WIDTH 1
438436 #define MAC_MDIOSCCDR_CMD_INDEX 16
drivers/net/ethernet/amd/xgbe/xgbe-dev.c+16−6
@@ -1284,6 +1284,20 @@ static void xgbe_write_mmd_regs(struct xgbe_prv_data *pdata, int prtad, · 1283 unmodified lines
12841284 }
12851285 }
12861286
1287+static unsigned int xgbe_create_mdio_sca(int port, int reg)
1288+{
1289+ unsigned int mdio_sca, da;
1290+
1291+ da = (reg & MII_ADDR_C45) ? reg >> 16 : 0;
1292+
1293+ mdio_sca = 0;
1294+ XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, RA, reg);
1295+ XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, PA, port);
1296+ XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, DA, da);
1297+
1298+ return mdio_sca;
1299+}
1300+
12871301 static int xgbe_write_ext_mii_regs(struct xgbe_prv_data *pdata, int addr,
12881302 int reg, u16 val)
12891303 {
@@ -1291,9 +1305,7 @@ static int xgbe_write_ext_mii_regs(struct xgbe_prv_data *pdata, int addr, · 1 unmodified line
12911305
12921306 reinit_completion(&pdata->mdio_complete);
12931307
1294− mdio_sca = 0;
1295− XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, REG, reg);
1296− XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, DA, addr);
1308+ mdio_sca = xgbe_create_mdio_sca(addr, reg);
12971309 XGMAC_IOWRITE(pdata, MAC_MDIOSCAR, mdio_sca);
12981310
12991311 mdio_sccd = 0;
@@ -1317,9 +1329,7 @@ static int xgbe_read_ext_mii_regs(struct xgbe_prv_data *pdata, int addr, · 17 unmodified lines
13171329
13181330 reinit_completion(&pdata->mdio_complete);
13191331
1320− mdio_sca = 0;
1321− XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, REG, reg);
1322− XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, DA, addr);
1332+ mdio_sca = xgbe_create_mdio_sca(addr, reg);
13231333 XGMAC_IOWRITE(pdata, MAC_MDIOSCAR, mdio_sca);
13241334
13251335 mdio_sccd = 0;
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c+6−0
@@ -2051,6 +2051,7 @@ dpaa_start_xmit(struct sk_buff *skb, struct net_device *net_dev) · 2050 unmodified lines
20512051 bool nonlinear = skb_is_nonlinear(skb);
20522052 struct rtnl_link_stats64 *percpu_stats;
20532053 struct dpaa_percpu_priv *percpu_priv;
2054+ struct netdev_queue *txq;
20542055 struct dpaa_priv *priv;
20552056 struct qm_fd fd;
20562057 int offset = 0;
@@ -2100,6 +2101,11 @@ dpaa_start_xmit(struct sk_buff *skb, struct net_device *net_dev) · 43 unmodified lines
21002101 if (unlikely(err < 0))
21012102 goto skb_to_fd_failed;
21022103
2104+ txq = netdev_get_tx_queue(net_dev, queue_mapping);
2105+
2106+ /* LLTX requires to do our own update of trans_start */
2107+ txq->trans_start = jiffies;
2108+
21032109 if (priv->tx_tstamp && skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) {
21042110 fd.cmd |= cpu_to_be32(FM_FD_CMD_UPD);
21052111 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
drivers/net/ethernet/intel/igb/igb.h+1−1
@@ -515,7 +515,7 @@ struct igb_adapter { · 514 unmodified lines
515515 /* OS defined structs */
516516 struct pci_dev *pdev;
517517
518− struct mutex stats64_lock;
518+ spinlock_t stats64_lock;
519519 struct rtnl_link_stats64 stats64;
520520
521521 /* structs defined in e1000_hw.h */
drivers/net/ethernet/intel/igb/igb_ethtool.c+2−2
@@ -2295,7 +2295,7 @@ static void igb_get_ethtool_stats(struct net_device *netdev, · 2294 unmodified lines
22952295 int i, j;
22962296 char *p;
22972297
2298− mutex_lock(&adapter->stats64_lock);
2298+ spin_lock(&adapter->stats64_lock);
22992299 igb_update_stats(adapter);
23002300
23012301 for (i = 0; i < IGB_GLOBAL_STATS_LEN; i++) {
@@ -2338,7 +2338,7 @@ static void igb_get_ethtool_stats(struct net_device *netdev, · 36 unmodified lines
23382338 } while (u64_stats_fetch_retry_irq(&ring->rx_syncp, start));
23392339 i += IGB_RX_QUEUE_STATS_LEN;
23402340 }
2341− mutex_unlock(&adapter->stats64_lock);
2341+ spin_unlock(&adapter->stats64_lock);
23422342 }
23432343
23442344 static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
drivers/net/ethernet/intel/igb/igb_main.c+7−7
@@ -2203,9 +2203,9 @@ void igb_down(struct igb_adapter *adapter) · 2202 unmodified lines
22032203 del_timer_sync(&adapter->phy_info_timer);
22042204
22052205 /* record the stats before reset*/
2206− mutex_lock(&adapter->stats64_lock);
2206+ spin_lock(&adapter->stats64_lock);
22072207 igb_update_stats(adapter);
2208− mutex_unlock(&adapter->stats64_lock);
2208+ spin_unlock(&adapter->stats64_lock);
22092209
22102210 adapter->link_speed = 0;
22112211 adapter->link_duplex = 0;
@@ -3840,7 +3840,7 @@ static int igb_sw_init(struct igb_adapter *adapter) · 1628 unmodified lines
38403840 adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
38413841
38423842 spin_lock_init(&adapter->nfc_lock);
3843− mutex_init(&adapter->stats64_lock);
3843+ spin_lock_init(&adapter->stats64_lock);
38443844 #ifdef CONFIG_PCI_IOV
38453845 switch (hw->mac.type) {
38463846 case e1000_82576:
@@ -5406,9 +5406,9 @@ no_wait: · 1559 unmodified lines
54065406 }
54075407 }
54085408
5409− mutex_lock(&adapter->stats64_lock);
5409+ spin_lock(&adapter->stats64_lock);
54105410 igb_update_stats(adapter);
5411− mutex_unlock(&adapter->stats64_lock);
5411+ spin_unlock(&adapter->stats64_lock);
54125412
54135413 for (i = 0; i < adapter->num_tx_queues; i++) {
54145414 struct igb_ring *tx_ring = adapter->tx_ring[i];
@@ -6235,10 +6235,10 @@ static void igb_get_stats64(struct net_device *netdev, · 820 unmodified lines
62356235 {
62366236 struct igb_adapter *adapter = netdev_priv(netdev);
62376237
6238− mutex_lock(&adapter->stats64_lock);
6238+ spin_lock(&adapter->stats64_lock);
62396239 igb_update_stats(adapter);
62406240 memcpy(stats, &adapter->stats64, sizeof(*stats));
6241− mutex_unlock(&adapter->stats64_lock);
6241+ spin_unlock(&adapter->stats64_lock);
62426242 }
62436243
62446244 /**
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c+4−1
@@ -844,9 +844,12 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, · 843 unmodified lines
844844 ethtool_link_ksettings_add_link_mode(link_ksettings, supported,
845845 Autoneg);
846846
847− if (get_fec_supported_advertised(mdev, link_ksettings))
847+ err = get_fec_supported_advertised(mdev, link_ksettings);
848+ if (err) {
848849 netdev_dbg(priv->netdev, "%s: FEC caps query failed: %d\n",
849850 __func__, err);
851+ err = 0; /* don't fail caps query because of FEC error */
852+ }
850853
851854 if (!an_disable_admin)
852855 ethtool_link_ksettings_add_link_mode(link_ksettings,
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c+17−13
@@ -58,7 +58,8 @@ struct mlx5e_rep_indr_block_priv { · 57 unmodified lines
5858 struct list_head list;
5959 };
6060
61−static void mlx5e_rep_indr_unregister_block(struct net_device *netdev);
61+static void mlx5e_rep_indr_unregister_block(struct mlx5e_rep_priv *rpriv,
62+ struct net_device *netdev);
6263
6364 static void mlx5e_rep_get_drvinfo(struct net_device *dev,
6465 struct ethtool_drvinfo *drvinfo)
@@ -179,6 +180,7 @@ static void mlx5e_rep_update_sw_counters(struct mlx5e_priv *priv) · 114 unmodified lines
179180
180181 s->tx_packets += sq_stats->packets;
181182 s->tx_bytes += sq_stats->bytes;
183+ s->tx_queue_dropped += sq_stats->dropped;
182184 }
183185 }
184186 }
@@ -663,7 +665,7 @@ static void mlx5e_rep_indr_clean_block_privs(struct mlx5e_rep_priv *rpriv) · 478 unmodified lines
663665 struct list_head *head = &rpriv->uplink_priv.tc_indr_block_priv_list;
664666
665667 list_for_each_entry_safe(cb_priv, temp, head, list) {
666− mlx5e_rep_indr_unregister_block(cb_priv->netdev);
668+ mlx5e_rep_indr_unregister_block(rpriv, cb_priv->netdev);
667669 kfree(cb_priv);
668670 }
669671 }
@@ -735,7 +737,7 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev, · 65 unmodified lines
735737
736738 err = tcf_block_cb_register(f->block,
737739 mlx5e_rep_indr_setup_block_cb,
738− netdev, indr_priv, f->extack);
740+ indr_priv, indr_priv, f->extack);
739741 if (err) {
740742 list_del(&indr_priv->list);
741743 kfree(indr_priv);
@@ -743,14 +745,15 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev, · 1 unmodified line
743745
744746 return err;
745747 case TC_BLOCK_UNBIND:
748+ indr_priv = mlx5e_rep_indr_block_priv_lookup(rpriv, netdev);
749+ if (!indr_priv)
750+ return -ENOENT;
751+
746752 tcf_block_cb_unregister(f->block,
747753 mlx5e_rep_indr_setup_block_cb,
748− netdev);
749− indr_priv = mlx5e_rep_indr_block_priv_lookup(rpriv, netdev);
750− if (indr_priv) {
751− list_del(&indr_priv->list);
752− kfree(indr_priv);
753− }
754+ indr_priv);
755+ list_del(&indr_priv->list);
756+ kfree(indr_priv);
754757
755758 return 0;
756759 default:
@@ -779,7 +782,7 @@ static int mlx5e_rep_indr_register_block(struct mlx5e_rep_priv *rpriv, · 22 unmodified lines
779782
780783 err = __tc_indr_block_cb_register(netdev, rpriv,
781784 mlx5e_rep_indr_setup_tc_cb,
782− netdev);
785+ rpriv);
783786 if (err) {
784787 struct mlx5e_priv *priv = netdev_priv(rpriv->netdev);
785788
@@ -789,10 +792,11 @@ static int mlx5e_rep_indr_register_block(struct mlx5e_rep_priv *rpriv, · 3 unmodified lines
789792 return err;
790793 }
791794
792−static void mlx5e_rep_indr_unregister_block(struct net_device *netdev)
795+static void mlx5e_rep_indr_unregister_block(struct mlx5e_rep_priv *rpriv,
796+ struct net_device *netdev)
793797 {
794798 __tc_indr_block_cb_unregister(netdev, mlx5e_rep_indr_setup_tc_cb,
795− netdev);
799+ rpriv);
796800 }
797801
798802 static int mlx5e_nic_rep_netdevice_event(struct notifier_block *nb,
@@ -811,7 +815,7 @@ static int mlx5e_nic_rep_netdevice_event(struct notifier_block *nb, · 12 unmodified lines
811815 mlx5e_rep_indr_register_block(rpriv, netdev);
812816 break;
813817 case NETDEV_UNREGISTER:
814− mlx5e_rep_indr_unregister_block(netdev);
818+ mlx5e_rep_indr_unregister_block(rpriv, netdev);
815819 break;
816820 }
817821 return NOTIFY_OK;
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c+13−0
@@ -732,6 +732,8 @@ static u8 get_ip_proto(struct sk_buff *skb, int network_depth, __be16 proto) · 731 unmodified lines
732732 ((struct ipv6hdr *)ip_p)->nexthdr;
733733 }
734734
735+#define short_frame(size) ((size) <= ETH_ZLEN + ETH_FCS_LEN)
736+
735737 static inline void mlx5e_handle_csum(struct net_device *netdev,
736738 struct mlx5_cqe64 *cqe,
737739 struct mlx5e_rq *rq,
@@ -754,6 +756,17 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, · 16 unmodified lines
754756 if (unlikely(test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state)))
755757 goto csum_unnecessary;
756758
759+ /* CQE csum doesn't cover padding octets in short ethernet
760+ * frames. And the pad field is appended prior to calculating
761+ * and appending the FCS field.
762+ *
763+ * Detecting these padded frames requires to verify and parse
764+ * IP headers, so we simply force all those small frames to be
765+ * CHECKSUM_UNNECESSARY even if they are not padded.
766+ */
767+ if (short_frame(skb->len))
768+ goto csum_unnecessary;
769+
757770 if (likely(is_last_ethertype_ip(skb, &network_depth, &proto))) {
758771 if (unlikely(get_ip_proto(skb, network_depth, proto) == IPPROTO_SCTP))
759772 goto csum_unnecessary;
drivers/net/ethernet/mellanox/mlxsw/pci.c+9−7
@@ -604,29 +604,31 @@ static void mlxsw_pci_cq_tasklet(unsigned long data) · 603 unmodified lines
604604 u16 wqe_counter = mlxsw_pci_cqe_wqe_counter_get(cqe);
605605 u8 sendq = mlxsw_pci_cqe_sr_get(q->u.cq.v, cqe);
606606 u8 dqn = mlxsw_pci_cqe_dqn_get(q->u.cq.v, cqe);
607+ char ncqe[MLXSW_PCI_CQE_SIZE_MAX];
608+
609+ memcpy(ncqe, cqe, q->elem_size);
610+ mlxsw_pci_queue_doorbell_consumer_ring(mlxsw_pci, q);
607611
608612 if (sendq) {
609613 struct mlxsw_pci_queue *sdq;
610614
611615 sdq = mlxsw_pci_sdq_get(mlxsw_pci, dqn);
612616 mlxsw_pci_cqe_sdq_handle(mlxsw_pci, sdq,
613− wqe_counter, cqe);
617+ wqe_counter, ncqe);
614618 q->u.cq.comp_sdq_count++;
615619 } else {
616620 struct mlxsw_pci_queue *rdq;
617621
618622 rdq = mlxsw_pci_rdq_get(mlxsw_pci, dqn);
619623 mlxsw_pci_cqe_rdq_handle(mlxsw_pci, rdq,
620− wqe_counter, q->u.cq.v, cqe);
624+ wqe_counter, q->u.cq.v, ncqe);
621625 q->u.cq.comp_rdq_count++;
622626 }
623627 if (++items == credits)
624628 break;
625629 }
626− if (items) {
627− mlxsw_pci_queue_doorbell_consumer_ring(mlxsw_pci, q);
630+ if (items)
628631 mlxsw_pci_queue_doorbell_arm_consumer_ring(mlxsw_pci, q);
629− }
630632 }
631633
632634 static u16 mlxsw_pci_cq_elem_count(const struct mlxsw_pci_queue *q)
@@ -1365,10 +1367,10 @@ static int mlxsw_pci_sw_reset(struct mlxsw_pci *mlxsw_pci, · 732 unmodified lines
13651367 u32 val = mlxsw_pci_read32(mlxsw_pci, FW_READY);
13661368
13671369 if ((val & MLXSW_PCI_FW_READY_MASK) == MLXSW_PCI_FW_READY_MAGIC)
1368− break;
1370+ return 0;
13691371 cond_resched();
13701372 } while (time_before(jiffies, end));
1371− return 0;
1373+ return -EBUSY;
13721374 }
13731375
13741376 static int mlxsw_pci_alloc_irq_vectors(struct mlxsw_pci *mlxsw_pci)
drivers/net/ethernet/mellanox/mlxsw/pci_hw.h+2−1
@@ -27,7 +27,7 @@ · 26 unmodified lines
2727
2828 #define MLXSW_PCI_SW_RESET 0xF0010
2929 #define MLXSW_PCI_SW_RESET_RST_BIT BIT(0)
30−#define MLXSW_PCI_SW_RESET_TIMEOUT_MSECS 5000
30+#define MLXSW_PCI_SW_RESET_TIMEOUT_MSECS 13000
3131 #define MLXSW_PCI_SW_RESET_WAIT_MSECS 100
3232 #define MLXSW_PCI_FW_READY 0xA1844
3333 #define MLXSW_PCI_FW_READY_MASK 0xFFFF
@@ -53,6 +53,7 @@ · 19 unmodified lines
5353 #define MLXSW_PCI_WQE_SIZE 32 /* 32 bytes per element */
5454 #define MLXSW_PCI_CQE01_SIZE 16 /* 16 bytes per element */
5555 #define MLXSW_PCI_CQE2_SIZE 32 /* 32 bytes per element */
56+#define MLXSW_PCI_CQE_SIZE_MAX MLXSW_PCI_CQE2_SIZE
5657 #define MLXSW_PCI_EQE_SIZE 16 /* 16 bytes per element */
5758 #define MLXSW_PCI_WQE_COUNT (MLXSW_PCI_AQ_SIZE / MLXSW_PCI_WQE_SIZE)
5859 #define MLXSW_PCI_CQE01_COUNT (MLXSW_PCI_AQ_SIZE / MLXSW_PCI_CQE01_SIZE)
drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c+2−2
@@ -997,8 +997,8 @@ static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_dummy_ops = { · 996 unmodified lines
997997 static const struct mlxsw_sp_fid_family mlxsw_sp_fid_dummy_family = {
998998 .type = MLXSW_SP_FID_TYPE_DUMMY,
999999 .fid_size = sizeof(struct mlxsw_sp_fid),
1000− .start_index = MLXSW_SP_RFID_BASE - 1,
1001− .end_index = MLXSW_SP_RFID_BASE - 1,
1000+ .start_index = VLAN_N_VID - 1,
1001+ .end_index = VLAN_N_VID - 1,
10021002 .ops = &mlxsw_sp_fid_dummy_ops,
10031003 };
10041004
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c+6−6
@@ -1233,7 +1233,7 @@ mlxsw_sp_bridge_port_fdb_flush(struct mlxsw_sp *mlxsw_sp, · 1232 unmodified lines
12331233 static enum mlxsw_reg_sfd_rec_policy mlxsw_sp_sfd_rec_policy(bool dynamic)
12341234 {
12351235 return dynamic ? MLXSW_REG_SFD_REC_POLICY_DYNAMIC_ENTRY_INGRESS :
1236− MLXSW_REG_SFD_REC_POLICY_STATIC_ENTRY;
1236+ MLXSW_REG_SFD_REC_POLICY_DYNAMIC_ENTRY_MLAG;
12371237 }
12381238
12391239 static enum mlxsw_reg_sfd_op mlxsw_sp_sfd_op(bool adding)
@@ -1290,7 +1290,7 @@ out: · 50 unmodified lines
12901290 static int __mlxsw_sp_port_fdb_uc_op(struct mlxsw_sp *mlxsw_sp, u8 local_port,
12911291 const char *mac, u16 fid, bool adding,
12921292 enum mlxsw_reg_sfd_rec_action action,
1293− bool dynamic)
1293+ enum mlxsw_reg_sfd_rec_policy policy)
12941294 {
12951295 char *sfd_pl;
12961296 u8 num_rec;
@@ -1301,8 +1301,7 @@ static int __mlxsw_sp_port_fdb_uc_op(struct mlxsw_sp *mlxsw_sp, u8 local_port, · 4 unmodified lines
13011301 return -ENOMEM;
13021302
13031303 mlxsw_reg_sfd_pack(sfd_pl, mlxsw_sp_sfd_op(adding), 0);
1304− mlxsw_reg_sfd_uc_pack(sfd_pl, 0, mlxsw_sp_sfd_rec_policy(dynamic),
1305− mac, fid, action, local_port);
1304+ mlxsw_reg_sfd_uc_pack(sfd_pl, 0, policy, mac, fid, action, local_port);
13061305 num_rec = mlxsw_reg_sfd_num_rec_get(sfd_pl);
13071306 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfd), sfd_pl);
13081307 if (err)
@@ -1321,7 +1320,8 @@ static int mlxsw_sp_port_fdb_uc_op(struct mlxsw_sp *mlxsw_sp, u8 local_port, · 12 unmodified lines
13211320 bool dynamic)
13221321 {
13231322 return __mlxsw_sp_port_fdb_uc_op(mlxsw_sp, local_port, mac, fid, adding,
1324− MLXSW_REG_SFD_REC_ACTION_NOP, dynamic);
1323+ MLXSW_REG_SFD_REC_ACTION_NOP,
1324+ mlxsw_sp_sfd_rec_policy(dynamic));
13251325 }
13261326
13271327 int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid,
@@ -1329,7 +1329,7 @@ int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid, · 1 unmodified line
13291329 {
13301330 return __mlxsw_sp_port_fdb_uc_op(mlxsw_sp, 0, mac, fid, adding,
13311331 MLXSW_REG_SFD_REC_ACTION_FORWARD_IP_ROUTER,
1332− false);
1332+ MLXSW_REG_SFD_REC_POLICY_STATIC_ENTRY);
13331333 }
13341334
13351335 static int mlxsw_sp_port_fdb_uc_lag_op(struct mlxsw_sp *mlxsw_sp, u16 lag_id,
drivers/net/macvlan.c+1−1
@@ -337,7 +337,7 @@ static void macvlan_process_broadcast(struct work_struct *w) · 336 unmodified lines
337337
338338 if (src)
339339 dev_put(src->dev);
340− kfree_skb(skb);
340+ consume_skb(skb);
341341 }
342342 }
343343
drivers/net/phy/bcm87xx.c+2−0
@@ -197,6 +197,7 @@ static struct phy_driver bcm87xx_driver[] = { · 196 unmodified lines
197197 .phy_id = PHY_ID_BCM8706,
198198 .phy_id_mask = 0xffffffff,
199199 .name = "Broadcom BCM8706",
200+ .features = PHY_10GBIT_FEC_FEATURES,
200201 .config_init = bcm87xx_config_init,
201202 .config_aneg = bcm87xx_config_aneg,
202203 .read_status = bcm87xx_read_status,
@@ -208,6 +209,7 @@ static struct phy_driver bcm87xx_driver[] = { · 5 unmodified lines
208209 .phy_id = PHY_ID_BCM8727,
209210 .phy_id_mask = 0xffffffff,
210211 .name = "Broadcom BCM8727",
212+ .features = PHY_10GBIT_FEC_FEATURES,
211213 .config_init = bcm87xx_config_init,
212214 .config_aneg = bcm87xx_config_aneg,
213215 .read_status = bcm87xx_read_status,
drivers/net/phy/cortina.c+1−0
@@ -88,6 +88,7 @@ static struct phy_driver cortina_driver[] = { · 87 unmodified lines
8888 .phy_id = PHY_ID_CS4340,
8989 .phy_id_mask = 0xffffffff,
9090 .name = "Cortina CS4340",
91+ .features = PHY_10GBIT_FEATURES,
9192 .config_init = gen10g_config_init,
9293 .config_aneg = gen10g_config_aneg,
9394 .read_status = cortina_read_status,
drivers/net/phy/marvell.c+35−2
@@ -1046,6 +1046,39 @@ static int m88e1145_config_init(struct phy_device *phydev) · 1045 unmodified lines
10461046 return 0;
10471047 }
10481048
1049+/* The VOD can be out of specification on link up. Poke an
1050+ * undocumented register, in an undocumented page, with a magic value
1051+ * to fix this.
1052+ */
1053+static int m88e6390_errata(struct phy_device *phydev)
1054+{
1055+ int err;
1056+
1057+ err = phy_write(phydev, MII_BMCR,
1058+ BMCR_ANENABLE | BMCR_SPEED1000 | BMCR_FULLDPLX);
1059+ if (err)
1060+ return err;
1061+
1062+ usleep_range(300, 400);
1063+
1064+ err = phy_write_paged(phydev, 0xf8, 0x08, 0x36);
1065+ if (err)
1066+ return err;
1067+
1068+ return genphy_soft_reset(phydev);
1069+}
1070+
1071+static int m88e6390_config_aneg(struct phy_device *phydev)
1072+{
1073+ int err;
1074+
1075+ err = m88e6390_errata(phydev);
1076+ if (err)
1077+ return err;
1078+
1079+ return m88e1510_config_aneg(phydev);
1080+}
1081+
10491082 /**
10501083 * fiber_lpa_mod_linkmode_lpa_t
10511084 * @advertising: the linkmode advertisement settings
@@ -1402,7 +1435,7 @@ static int m88e1318_set_wol(struct phy_device *phydev, · 350 unmodified lines
14021435 * before enabling it if !phy_interrupt_is_valid()
14031436 */
14041437 if (!phy_interrupt_is_valid(phydev))
1405− phy_read(phydev, MII_M1011_IEVENT);
1438+ __phy_read(phydev, MII_M1011_IEVENT);
14061439
14071440 /* Enable the WOL interrupt */
14081441 err = __phy_modify(phydev, MII_88E1318S_PHY_CSIER, 0,
@@ -2283,7 +2316,7 @@ static struct phy_driver marvell_drivers[] = { · 874 unmodified lines
22832316 .features = PHY_GBIT_FEATURES,
22842317 .probe = m88e6390_probe,
22852318 .config_init = &marvell_config_init,
2286− .config_aneg = &m88e1510_config_aneg,
2319+ .config_aneg = &m88e6390_config_aneg,
22872320 .read_status = &marvell_read_status,
22882321 .ack_interrupt = &marvell_ack_interrupt,
22892322 .config_intr = &marvell_config_intr,
drivers/net/phy/mdio_bus.c+1−0
@@ -390,6 +390,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) · 389 unmodified lines
390390 if (IS_ERR(gpiod)) {
391391 dev_err(&bus->dev, "mii_bus %s couldn't get reset GPIO\n",
392392 bus->id);
393+ device_del(&bus->dev);
393394 return PTR_ERR(gpiod);
394395 } else if (gpiod) {
395396 bus->reset_gpiod = gpiod;
drivers/net/phy/meson-gxl.c+1−0
@@ -233,6 +233,7 @@ static struct phy_driver meson_gxl_phy[] = { · 232 unmodified lines
233233 .name = "Meson GXL Internal PHY",
234234 .features = PHY_BASIC_FEATURES,
235235 .flags = PHY_IS_INTERNAL,
236+ .soft_reset = genphy_soft_reset,
236237 .config_init = meson_gxl_config_init,
237238 .aneg_done = genphy_aneg_done,
238239 .read_status = meson_gxl_read_status,
drivers/net/phy/micrel.c+2−0
@@ -1070,6 +1070,7 @@ static struct phy_driver ksphy_driver[] = { · 1069 unmodified lines
10701070 .driver_data = &ksz9021_type,
10711071 .probe = kszphy_probe,
10721072 .config_init = ksz9031_config_init,
1073+ .soft_reset = genphy_soft_reset,
10731074 .read_status = ksz9031_read_status,
10741075 .ack_interrupt = kszphy_ack_interrupt,
10751076 .config_intr = kszphy_config_intr,
@@ -1098,6 +1099,7 @@ static struct phy_driver ksphy_driver[] = { · 22 unmodified lines
10981099 .phy_id = PHY_ID_KSZ8873MLL,
10991100 .phy_id_mask = MICREL_PHY_ID_MASK,
11001101 .name = "Micrel KSZ8873MLL Switch",
1102+ .features = PHY_BASIC_FEATURES,
11011103 .config_init = kszphy_config_init,
11021104 .config_aneg = ksz8873mll_config_aneg,
11031105 .read_status = ksz8873mll_read_status,
drivers/net/phy/phy.c+7−12
@@ -543,13 +543,6 @@ int phy_start_aneg(struct phy_device *phydev) · 542 unmodified lines
543543
544544 mutex_lock(&phydev->lock);
545545
546− if (!__phy_is_started(phydev)) {
547− WARN(1, "called from state %s\n",
548− phy_state_to_str(phydev->state));
549− err = -EBUSY;
550− goto out_unlock;
551− }
552−
553546 if (AUTONEG_DISABLE == phydev->autoneg)
554547 phy_sanitize_settings(phydev);
555548
@@ -560,11 +553,13 @@ int phy_start_aneg(struct phy_device *phydev) · 4 unmodified lines
560553 if (err < 0)
561554 goto out_unlock;
562555
563− if (phydev->autoneg == AUTONEG_ENABLE) {
564− err = phy_check_link_status(phydev);
565− } else {
566− phydev->state = PHY_FORCING;
567− phydev->link_timeout = PHY_FORCE_TIMEOUT;
556+ if (__phy_is_started(phydev)) {
557+ if (phydev->autoneg == AUTONEG_ENABLE) {
558+ err = phy_check_link_status(phydev);
559+ } else {
560+ phydev->state = PHY_FORCING;
561+ phydev->link_timeout = PHY_FORCE_TIMEOUT;
562+ }
568563 }
569564
570565 out_unlock:
drivers/net/phy/phy_device.c+17−0
@@ -61,6 +61,9 @@ EXPORT_SYMBOL_GPL(phy_gbit_all_ports_features); · 60 unmodified lines
6161 __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_features) __ro_after_init;
6262 EXPORT_SYMBOL_GPL(phy_10gbit_features);
6363
64+__ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_fec_features) __ro_after_init;
65+EXPORT_SYMBOL_GPL(phy_10gbit_fec_features);
66+
6467 static const int phy_basic_ports_array[] = {
6568 ETHTOOL_LINK_MODE_Autoneg_BIT,
6669 ETHTOOL_LINK_MODE_TP_BIT,
@@ -109,6 +112,11 @@ const int phy_10gbit_features_array[1] = { · 42 unmodified lines
109112 };
110113 EXPORT_SYMBOL_GPL(phy_10gbit_features_array);
111114
115+const int phy_10gbit_fec_features_array[1] = {
116+ ETHTOOL_LINK_MODE_10000baseR_FEC_BIT,
117+};
118+EXPORT_SYMBOL_GPL(phy_10gbit_fec_features_array);
119+
112120 __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_full_features) __ro_after_init;
113121 EXPORT_SYMBOL_GPL(phy_10gbit_full_features);
114122
@@ -191,6 +199,10 @@ static void features_init(void) · 76 unmodified lines
191199 linkmode_set_bit_array(phy_10gbit_full_features_array,
192200 ARRAY_SIZE(phy_10gbit_full_features_array),
193201 phy_10gbit_full_features);
202+ /* 10G FEC only */
203+ linkmode_set_bit_array(phy_10gbit_fec_features_array,
204+ ARRAY_SIZE(phy_10gbit_fec_features_array),
205+ phy_10gbit_fec_features);
194206 }
195207
196208 void phy_device_free(struct phy_device *phydev)
@@ -2243,6 +2255,11 @@ int phy_driver_register(struct phy_driver *new_driver, struct module *owner) · 2046 unmodified lines
22432255 {
22442256 int retval;
22452257
2258+ if (WARN_ON(!new_driver->features)) {
2259+ pr_err("%s: Driver features are missing\n", new_driver->name);
2260+ return -EINVAL;
2261+ }
2262+
22462263 new_driver->mdiodrv.flags |= MDIO_DEVICE_IS_PHY;
22472264 new_driver->mdiodrv.driver.name = new_driver->name;
22482265 new_driver->mdiodrv.driver.bus = &mdio_bus_type;
drivers/net/phy/teranetics.c+1−0
@@ -80,6 +80,7 @@ static struct phy_driver teranetics_driver[] = { · 79 unmodified lines
8080 .phy_id = PHY_ID_TN2020,
8181 .phy_id_mask = 0xffffffff,
8282 .name = "Teranetics TN2020",
83+ .features = PHY_10GBIT_FEATURES,
8384 .soft_reset = gen10g_no_soft_reset,
8485 .aneg_done = teranetics_aneg_done,
8586 .config_init = gen10g_config_init,
drivers/net/ppp/pppoe.c+1−0
@@ -445,6 +445,7 @@ static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev, · 444 unmodified lines
445445 if (pskb_trim_rcsum(skb, len))
446446 goto drop;
447447
448+ ph = pppoe_hdr(skb);
448449 pn = pppoe_pernet(dev_net(dev));
449450
450451 /* Note that get_item does a sock_hold(), so sk_pppox(po)
drivers/net/usb/aqc111.c+15−0
@@ -1287,6 +1287,20 @@ static const struct driver_info asix112_info = { · 1286 unmodified lines
12871287
12881288 #undef ASIX112_DESC
12891289
1290+static const struct driver_info trendnet_info = {
1291+ .description = "USB-C 3.1 to 5GBASE-T Ethernet Adapter",
1292+ .bind = aqc111_bind,
1293+ .unbind = aqc111_unbind,
1294+ .status = aqc111_status,
1295+ .link_reset = aqc111_link_reset,
1296+ .reset = aqc111_reset,
1297+ .stop = aqc111_stop,
1298+ .flags = FLAG_ETHER | FLAG_FRAMING_AX |
1299+ FLAG_AVOID_UNLINK_URBS | FLAG_MULTI_PACKET,
1300+ .rx_fixup = aqc111_rx_fixup,
1301+ .tx_fixup = aqc111_tx_fixup,
1302+};
1303+
12901304 static int aqc111_suspend(struct usb_interface *intf, pm_message_t message)
12911305 {
12921306 struct usbnet *dev = usb_get_intfdata(intf);
@@ -1440,6 +1454,7 @@ static const struct usb_device_id products[] = { · 147 unmodified lines
14401454 {AQC111_USB_ETH_DEV(0x2eca, 0xc101, aqc111_info)},
14411455 {AQC111_USB_ETH_DEV(0x0b95, 0x2790, asix111_info)},
14421456 {AQC111_USB_ETH_DEV(0x0b95, 0x2791, asix112_info)},
1457+ {AQC111_USB_ETH_DEV(0x20f4, 0xe05a, trendnet_info)},
14431458 { },/* END */
14441459 };
14451460 MODULE_DEVICE_TABLE(usb, products);
drivers/net/usb/cdc_ether.c+8−0
@@ -843,6 +843,14 @@ static const struct usb_device_id products[] = { · 842 unmodified lines
843843 .driver_info = 0,
844844 },
845845
846+/* USB-C 3.1 to 5GBASE-T Ethernet Adapter (based on AQC111U) */
847+{
848+ USB_DEVICE_AND_INTERFACE_INFO(0x20f4, 0xe05a, USB_CLASS_COMM,
849+ USB_CDC_SUBCLASS_ETHERNET,
850+ USB_CDC_PROTO_NONE),
851+ .driver_info = 0,
852+},
853+
846854 /* WHITELIST!!!
847855 *
848856 * CDC Ether uses two interfaces, not necessarily consecutive.
drivers/net/virtio_net.c+6−6
@@ -1330,7 +1330,7 @@ static int virtnet_receive(struct receive_queue *rq, int budget, · 1329 unmodified lines
13301330 return stats.packets;
13311331 }
13321332
1333−static void free_old_xmit_skbs(struct send_queue *sq)
1333+static void free_old_xmit_skbs(struct send_queue *sq, bool in_napi)
13341334 {
13351335 struct sk_buff *skb;
13361336 unsigned int len;
@@ -1343,7 +1343,7 @@ static void free_old_xmit_skbs(struct send_queue *sq) · 6 unmodified lines
13431343 bytes += skb->len;
13441344 packets++;
13451345
1346− dev_consume_skb_any(skb);
1346+ napi_consume_skb(skb, in_napi);
13471347 }
13481348
13491349 /* Avoid overhead when no packets have been processed
@@ -1369,7 +1369,7 @@ static void virtnet_poll_cleantx(struct receive_queue *rq) · 19 unmodified lines
13691369 return;
13701370
13711371 if (__netif_tx_trylock(txq)) {
1372− free_old_xmit_skbs(sq);
1372+ free_old_xmit_skbs(sq, true);
13731373 __netif_tx_unlock(txq);
13741374 }
13751375
@@ -1445,7 +1445,7 @@ static int virtnet_poll_tx(struct napi_struct *napi, int budget) · 69 unmodified lines
14451445 struct netdev_queue *txq = netdev_get_tx_queue(vi->dev, vq2txq(sq->vq));
14461446
14471447 __netif_tx_lock(txq, raw_smp_processor_id());
1448− free_old_xmit_skbs(sq);
1448+ free_old_xmit_skbs(sq, true);
14491449 __netif_tx_unlock(txq);
14501450
14511451 virtqueue_napi_complete(napi, sq->vq, 0);
@@ -1514,7 +1514,7 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) · 62 unmodified lines
15141514 bool use_napi = sq->napi.weight;
15151515
15161516 /* Free up any pending old buffers before queueing new ones. */
1517− free_old_xmit_skbs(sq);
1517+ free_old_xmit_skbs(sq, false);
15181518
15191519 if (use_napi && kick)
15201520 virtqueue_enable_cb_delayed(sq->vq);
@@ -1557,7 +1557,7 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) · 36 unmodified lines
15571557 if (!use_napi &&
15581558 unlikely(!virtqueue_enable_cb_delayed(sq->vq))) {
15591559 /* More just got used, free them then recheck. */
1560− free_old_xmit_skbs(sq);
1560+ free_old_xmit_skbs(sq, false);
15611561 if (sq->vq->num_free >= 2+MAX_SKB_FRAGS) {
15621562 netif_start_subqueue(dev, qnum);
15631563 virtqueue_disable_cb(sq->vq);
drivers/vhost/net.c+2−1
@@ -1236,7 +1236,8 @@ static void handle_rx(struct vhost_net *net) · 1235 unmodified lines
12361236 if (nvq->done_idx > VHOST_NET_BATCH)
12371237 vhost_net_signal_used(nvq);
12381238 if (unlikely(vq_log))
1239− vhost_log_write(vq, vq_log, log, vhost_len);
1239+ vhost_log_write(vq, vq_log, log, vhost_len,
1240+ vq->iov, in);
12401241 total_len += vhost_len;
12411242 if (unlikely(vhost_exceeds_weight(++recv_pkts, total_len))) {
12421243 vhost_poll_queue(&vq->poll);
drivers/vhost/vhost.c+83−14
@@ -1737,13 +1737,87 @@ static int log_write(void __user *log_base, · 1736 unmodified lines
17371737 return r;
17381738 }
17391739
1740+static int log_write_hva(struct vhost_virtqueue *vq, u64 hva, u64 len)
1741+{
1742+ struct vhost_umem *umem = vq->umem;
1743+ struct vhost_umem_node *u;
1744+ u64 start, end, l, min;
1745+ int r;
1746+ bool hit = false;
1747+
1748+ while (len) {
1749+ min = len;
1750+ /* More than one GPAs can be mapped into a single HVA. So
1751+ * iterate all possible umems here to be safe.
1752+ */
1753+ list_for_each_entry(u, &umem->umem_list, link) {
1754+ if (u->userspace_addr > hva - 1 + len ||
1755+ u->userspace_addr - 1 + u->size < hva)
1756+ continue;
1757+ start = max(u->userspace_addr, hva);
1758+ end = min(u->userspace_addr - 1 + u->size,
1759+ hva - 1 + len);
1760+ l = end - start + 1;
1761+ r = log_write(vq->log_base,
1762+ u->start + start - u->userspace_addr,
1763+ l);
1764+ if (r < 0)
1765+ return r;
1766+ hit = true;
1767+ min = min(l, min);
1768+ }
1769+
1770+ if (!hit)
1771+ return -EFAULT;
1772+
1773+ len -= min;
1774+ hva += min;
1775+ }
1776+
1777+ return 0;
1778+}
1779+
1780+static int log_used(struct vhost_virtqueue *vq, u64 used_offset, u64 len)
1781+{
1782+ struct iovec iov[64];
1783+ int i, ret;
1784+
1785+ if (!vq->iotlb)
1786+ return log_write(vq->log_base, vq->log_addr + used_offset, len);
1787+
1788+ ret = translate_desc(vq, (uintptr_t)vq->used + used_offset,
1789+ len, iov, 64, VHOST_ACCESS_WO);
1790+ if (ret)
1791+ return ret;
1792+
1793+ for (i = 0; i < ret; i++) {
1794+ ret = log_write_hva(vq, (uintptr_t)iov[i].iov_base,
1795+ iov[i].iov_len);
1796+ if (ret)
1797+ return ret;
1798+ }
1799+
1800+ return 0;
1801+}
1802+
17401803 int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log,
1741− unsigned int log_num, u64 len)
1804+ unsigned int log_num, u64 len, struct iovec *iov, int count)
17421805 {
17431806 int i, r;
17441807
17451808 /* Make sure data written is seen before log. */
17461809 smp_wmb();
1810+
1811+ if (vq->iotlb) {
1812+ for (i = 0; i < count; i++) {
1813+ r = log_write_hva(vq, (uintptr_t)iov[i].iov_base,
1814+ iov[i].iov_len);
1815+ if (r < 0)
1816+ return r;
1817+ }
1818+ return 0;
1819+ }
1820+
17471821 for (i = 0; i < log_num; ++i) {
17481822 u64 l = min(log[i].len, len);
17491823 r = log_write(vq->log_base, log[i].addr, l);
@@ -1773,9 +1847,8 @@ static int vhost_update_used_flags(struct vhost_virtqueue *vq) · 23 unmodified lines
17731847 smp_wmb();
17741848 /* Log used flag write. */
17751849 used = &vq->used->flags;
1776− log_write(vq->log_base, vq->log_addr +
1777− (used - (void __user *)vq->used),
1778− sizeof vq->used->flags);
1850+ log_used(vq, (used - (void __user *)vq->used),
1851+ sizeof vq->used->flags);
17791852 if (vq->log_ctx)
17801853 eventfd_signal(vq->log_ctx, 1);
17811854 }
@@ -1793,9 +1866,8 @@ static int vhost_update_avail_event(struct vhost_virtqueue *vq, u16 avail_event) · 11 unmodified lines
17931866 smp_wmb();
17941867 /* Log avail event write */
17951868 used = vhost_avail_event(vq);
1796− log_write(vq->log_base, vq->log_addr +
1797− (used - (void __user *)vq->used),
1798− sizeof *vhost_avail_event(vq));
1869+ log_used(vq, (used - (void __user *)vq->used),
1870+ sizeof *vhost_avail_event(vq));
17991871 if (vq->log_ctx)
18001872 eventfd_signal(vq->log_ctx, 1);
18011873 }
@@ -2195,10 +2267,8 @@ static int __vhost_add_used_n(struct vhost_virtqueue *vq, · 393 unmodified lines
21952267 /* Make sure data is seen before log. */
21962268 smp_wmb();
21972269 /* Log used ring entry write. */
2198− log_write(vq->log_base,
2199− vq->log_addr +
2200− ((void __user *)used - (void __user *)vq->used),
2201− count * sizeof *used);
2270+ log_used(vq, ((void __user *)used - (void __user *)vq->used),
2271+ count * sizeof *used);
22022272 }
22032273 old = vq->last_used_idx;
22042274 new = (vq->last_used_idx += count);
@@ -2240,9 +2310,8 @@ int vhost_add_used_n(struct vhost_virtqueue *vq, struct vring_used_elem *heads, · 35 unmodified lines
22402310 /* Make sure used idx is seen before log. */
22412311 smp_wmb();
22422312 /* Log used index update. */
2243− log_write(vq->log_base,
2244− vq->log_addr + offsetof(struct vring_used, idx),
2245− sizeof vq->used->idx);
2313+ log_used(vq, offsetof(struct vring_used, idx),
2314+ sizeof vq->used->idx);
22462315 if (vq->log_ctx)
22472316 eventfd_signal(vq->log_ctx, 1);
22482317 }
drivers/vhost/vhost.h+2−1
@@ -205,7 +205,8 @@ bool vhost_vq_avail_empty(struct vhost_dev *, struct vhost_virtqueue *); · 204 unmodified lines
205205 bool vhost_enable_notify(struct vhost_dev *, struct vhost_virtqueue *);
206206
207207 int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log,
208− unsigned int log_num, u64 len);
208+ unsigned int log_num, u64 len,
209+ struct iovec *iov, int count);
209210 int vq_iotlb_prefetch(struct vhost_virtqueue *vq);
210211
211212 struct vhost_msg_node *vhost_new_msg(struct vhost_virtqueue *vq, int type);
include/linux/phy.h+4−2
@@ -48,6 +48,7 @@ extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_features) __ro_after_init; · 47 unmodified lines
4848 extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_fibre_features) __ro_after_init;
4949 extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_all_ports_features) __ro_after_init;
5050 extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_features) __ro_after_init;
51+extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_fec_features) __ro_after_init;
5152 extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_full_features) __ro_after_init;
5253
5354 #define PHY_BASIC_FEATURES ((unsigned long *)&phy_basic_features)
@@ -56,6 +57,7 @@ extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_full_features) __ro_after_ini · 2 unmodified lines
5657 #define PHY_GBIT_FIBRE_FEATURES ((unsigned long *)&phy_gbit_fibre_features)
5758 #define PHY_GBIT_ALL_PORTS_FEATURES ((unsigned long *)&phy_gbit_all_ports_features)
5859 #define PHY_10GBIT_FEATURES ((unsigned long *)&phy_10gbit_features)
60+#define PHY_10GBIT_FEC_FEATURES ((unsigned long *)&phy_10gbit_fec_features)
5961 #define PHY_10GBIT_FULL_FEATURES ((unsigned long *)&phy_10gbit_full_features)
6062
6163 extern const int phy_10_100_features_array[4];
@@ -467,8 +469,8 @@ struct phy_device { · 405 unmodified lines
467469 * only works for PHYs with IDs which match this field
468470 * name: The friendly name of this PHY type
469471 * phy_id_mask: Defines the important bits of the phy_id
470− * features: A list of features (speed, duplex, etc) supported
471− * by this PHY
472+ * features: A mandatory list of features (speed, duplex, etc)
473+ * supported by this PHY
472474 * flags: A bitfield defining certain other features this PHY
473475 * supports (like interrupts)
474476 *
include/linux/skbuff.h+1−0
@@ -3218,6 +3218,7 @@ int pskb_trim_rcsum_slow(struct sk_buff *skb, unsigned int len); · 3217 unmodified lines
32183218 *
32193219 * This is exactly the same as pskb_trim except that it ensures the
32203220 * checksum of received packets are still valid after the operation.
3221+ * It can change skb pointers.
32213222 */
32223223
32233224 static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
include/net/af_rxrpc.h+0−16
@@ -20,18 +20,6 @@ struct sock; · 19 unmodified lines
2020 struct socket;
2121 struct rxrpc_call;
2222
23−/*
24− * Call completion condition (state == RXRPC_CALL_COMPLETE).
25− */
26−enum rxrpc_call_completion {
27− RXRPC_CALL_SUCCEEDED, /* - Normal termination */
28− RXRPC_CALL_REMOTELY_ABORTED, /* - call aborted by peer */
29− RXRPC_CALL_LOCALLY_ABORTED, /* - call aborted locally on error or close */
30− RXRPC_CALL_LOCAL_ERROR, /* - call failed due to local error */
31− RXRPC_CALL_NETWORK_ERROR, /* - call terminated by network error */
32− NR__RXRPC_CALL_COMPLETIONS
33−};
34−
3523 /*
3624 * Debug ID counter for tracing.
3725 */
@@ -73,10 +61,6 @@ int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t, · 35 unmodified lines
7361 rxrpc_user_attach_call_t, unsigned long, gfp_t,
7462 unsigned int);
7563 void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64);
76−int rxrpc_kernel_retry_call(struct socket *, struct rxrpc_call *,
77− struct sockaddr_rxrpc *, struct key *);
78−int rxrpc_kernel_check_call(struct socket *, struct rxrpc_call *,
79− enum rxrpc_call_completion *, u32 *);
8064 u32 rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *);
8165 void rxrpc_kernel_probe_life(struct socket *, struct rxrpc_call *);
8266 u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *);
include/net/ip_fib.h+1−1
@@ -241,7 +241,7 @@ int fib_table_delete(struct net *, struct fib_table *, struct fib_config *, · 240 unmodified lines
241241 struct netlink_ext_ack *extack);
242242 int fib_table_dump(struct fib_table *table, struct sk_buff *skb,
243243 struct netlink_callback *cb, struct fib_dump_filter *filter);
244−int fib_table_flush(struct net *net, struct fib_table *table);
244+int fib_table_flush(struct net *net, struct fib_table *table, bool flush_all);
245245 struct fib_table *fib_trie_unmerge(struct fib_table *main_tb);
246246 void fib_table_flush_external(struct fib_table *table);
247247 void fib_free_table(struct fib_table *tb);
include/net/netfilter/nf_flow_table.h+0−1
@@ -84,7 +84,6 @@ struct flow_offload { · 83 unmodified lines
8484 struct nf_flow_route {
8585 struct {
8686 struct dst_entry *dst;
87− int ifindex;
8887 } tuple[FLOW_OFFLOAD_DIR_MAX];
8988 };
9089
include/uapi/linux/in.h+1−1
@@ -268,7 +268,7 @@ struct sockaddr_in { · 267 unmodified lines
268268 #define IN_MULTICAST(a) IN_CLASSD(a)
269269 #define IN_MULTICAST_NET 0xe0000000
270270
271−#define IN_BADCLASS(a) ((((long int) (a) ) == 0xffffffff)
271+#define IN_BADCLASS(a) (((long int) (a) ) == (long int)0xffffffff)
272272 #define IN_EXPERIMENTAL(a) IN_BADCLASS((a))
273273
274274 #define IN_CLASSE(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000)
kernel/bpf/btf.c+1−1
@@ -467,7 +467,7 @@ static const struct btf_kind_operations *btf_type_ops(const struct btf_type *t) · 466 unmodified lines
467467 return kind_ops[BTF_INFO_KIND(t->info)];
468468 }
469469
470−bool btf_name_offset_valid(const struct btf *btf, u32 offset)
470+static bool btf_name_offset_valid(const struct btf *btf, u32 offset)
471471 {
472472 return BTF_STR_OFFSET_VALID(offset) &&
473473 offset < btf->hdr.str_len;
kernel/bpf/cgroup.c+1−0
@@ -718,6 +718,7 @@ cgroup_dev_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) · 717 unmodified lines
718718 case BPF_FUNC_trace_printk:
719719 if (capable(CAP_SYS_ADMIN))
720720 return bpf_get_trace_printk_proto();
721+ /* fall through */
721722 default:
722723 return NULL;
723724 }
kernel/bpf/map_in_map.c+15−2
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 struct bpf_map *bpf_map_meta_alloc(int inner_map_ufd)
1313 {
1414 struct bpf_map *inner_map, *inner_map_meta;
15+ u32 inner_map_meta_size;
1516 struct fd f;
1617
1718 f = fdget(inner_map_ufd);
@@ -36,7 +37,12 @@ struct bpf_map *bpf_map_meta_alloc(int inner_map_ufd) · 18 unmodified lines
3637 return ERR_PTR(-EINVAL);
3738 }
3839
39− inner_map_meta = kzalloc(sizeof(*inner_map_meta), GFP_USER);
40+ inner_map_meta_size = sizeof(*inner_map_meta);
41+ /* In some cases verifier needs to access beyond just base map. */
42+ if (inner_map->ops == &array_map_ops)
43+ inner_map_meta_size = sizeof(struct bpf_array);
44+
45+ inner_map_meta = kzalloc(inner_map_meta_size, GFP_USER);
4046 if (!inner_map_meta) {
4147 fdput(f);
4248 return ERR_PTR(-ENOMEM);
@@ -46,9 +52,16 @@ struct bpf_map *bpf_map_meta_alloc(int inner_map_ufd) · 3 unmodified lines
4652 inner_map_meta->key_size = inner_map->key_size;
4753 inner_map_meta->value_size = inner_map->value_size;
4854 inner_map_meta->map_flags = inner_map->map_flags;
49− inner_map_meta->ops = inner_map->ops;
5055 inner_map_meta->max_entries = inner_map->max_entries;
5156
57+ /* Misc members not needed in bpf_map_meta_equal() check. */
58+ inner_map_meta->ops = inner_map->ops;
59+ if (inner_map->ops == &array_map_ops) {
60+ inner_map_meta->unpriv_array = inner_map->unpriv_array;
61+ container_of(inner_map_meta, struct bpf_array, map)->index_mask =
62+ container_of(inner_map, struct bpf_array, map)->index_mask;
63+ }
64+
5265 fdput(f);
5366 return inner_map_meta;
5467 }
kernel/bpf/stackmap.c+7−2
@@ -180,11 +180,14 @@ static inline int stack_map_parse_build_id(void *page_addr, · 179 unmodified lines
180180
181181 if (nhdr->n_type == BPF_BUILD_ID &&
182182 nhdr->n_namesz == sizeof("GNU") &&
183− nhdr->n_descsz == BPF_BUILD_ID_SIZE) {
183+ nhdr->n_descsz > 0 &&
184+ nhdr->n_descsz <= BPF_BUILD_ID_SIZE) {
184185 memcpy(build_id,
185186 note_start + note_offs +
186187 ALIGN(sizeof("GNU"), 4) + sizeof(Elf32_Nhdr),
187− BPF_BUILD_ID_SIZE);
188+ nhdr->n_descsz);
189+ memset(build_id + nhdr->n_descsz, 0,
190+ BPF_BUILD_ID_SIZE - nhdr->n_descsz);
188191 return 0;
189192 }
190193 new_offs = note_offs + sizeof(Elf32_Nhdr) +
@@ -311,6 +314,7 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs, · 120 unmodified lines
311314 for (i = 0; i < trace_nr; i++) {
312315 id_offs[i].status = BPF_STACK_BUILD_ID_IP;
313316 id_offs[i].ip = ips[i];
317+ memset(id_offs[i].build_id, 0, BPF_BUILD_ID_SIZE);
314318 }
315319 return;
316320 }
@@ -321,6 +325,7 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs, · 4 unmodified lines
321325 /* per entry fall back to ips */
322326 id_offs[i].status = BPF_STACK_BUILD_ID_IP;
323327 id_offs[i].ip = ips[i];
328+ memset(id_offs[i].build_id, 0, BPF_BUILD_ID_SIZE);
324329 continue;
325330 }
326331 id_offs[i].offset = (vma->vm_pgoff << PAGE_SHIFT) + ips[i]
net/bpfilter/bpfilter_umh_blob.S+1−1
@@ -1,5 +1,5 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
2− .section .bpfilter_umh, "a"
2+ .section .rodata, "a"
33 .global bpfilter_umh_start
44 bpfilter_umh_start:
55 .incbin "net/bpfilter/bpfilter_umh"
net/bridge/br_fdb.c+5−0
@@ -1128,6 +1128,8 @@ int br_fdb_external_learn_add(struct net_bridge *br, struct net_bridge_port *p, · 1127 unmodified lines
11281128 err = -ENOMEM;
11291129 goto err_unlock;
11301130 }
1131+ if (swdev_notify)
1132+ fdb->added_by_user = 1;
11311133 fdb->added_by_external_learn = 1;
11321134 fdb_notify(br, fdb, RTM_NEWNEIGH, swdev_notify);
11331135 } else {
@@ -1147,6 +1149,9 @@ int br_fdb_external_learn_add(struct net_bridge *br, struct net_bridge_port *p, · 13 unmodified lines
11471149 modified = true;
11481150 }
11491151
1152+ if (swdev_notify)
1153+ fdb->added_by_user = 1;
1154+
11501155 if (modified)
11511156 fdb_notify(br, fdb, RTM_NEWNEIGH, swdev_notify);
11521157 }
net/bridge/br_forward.c+4−5
@@ -36,10 +36,10 @@ static inline int should_deliver(const struct net_bridge_port *p, · 35 unmodified lines
3636
3737 int br_dev_queue_push_xmit(struct net *net, struct sock *sk, struct sk_buff *skb)
3838 {
39+ skb_push(skb, ETH_HLEN);
3940 if (!is_skb_forwardable(skb->dev, skb))
4041 goto drop;
4142
42− skb_push(skb, ETH_HLEN);
4343 br_drop_fake_rtable(skb);
4444
4545 if (skb->ip_summed == CHECKSUM_PARTIAL &&
@@ -98,12 +98,11 @@ static void __br_forward(const struct net_bridge_port *to, · 52 unmodified lines
9898 net = dev_net(indev);
9999 } else {
100100 if (unlikely(netpoll_tx_running(to->br->dev))) {
101− if (!is_skb_forwardable(skb->dev, skb)) {
101+ skb_push(skb, ETH_HLEN);
102+ if (!is_skb_forwardable(skb->dev, skb))
102103 kfree_skb(skb);
103− } else {
104− skb_push(skb, ETH_HLEN);
104+ else
105105 br_netpoll_send_skb(to, skb);
106− }
107106 return;
108107 }
109108 br_hook = NF_BR_LOCAL_OUT;
net/bridge/br_netfilter_ipv6.c+1−0
@@ -131,6 +131,7 @@ int br_validate_ipv6(struct net *net, struct sk_buff *skb) · 130 unmodified lines
131131 IPSTATS_MIB_INDISCARDS);
132132 goto drop;
133133 }
134+ hdr = ipv6_hdr(skb);
134135 }
135136 if (hdr->nexthdr == NEXTHDR_HOP && br_nf_check_hbh_len(skb))
136137 goto drop;
net/bridge/netfilter/ebtables.c+4−2
@@ -1137,14 +1137,16 @@ static int do_replace(struct net *net, const void __user *user, · 1136 unmodified lines
11371137 tmp.name[sizeof(tmp.name) - 1] = 0;
11381138
11391139 countersize = COUNTER_OFFSET(tmp.nentries) * nr_cpu_ids;
1140− newinfo = vmalloc(sizeof(*newinfo) + countersize);
1140+ newinfo = __vmalloc(sizeof(*newinfo) + countersize, GFP_KERNEL_ACCOUNT,
1141+ PAGE_KERNEL);
11411142 if (!newinfo)
11421143 return -ENOMEM;
11431144
11441145 if (countersize)
11451146 memset(newinfo->counters, 0, countersize);
11461147
1147− newinfo->entries = vmalloc(tmp.entries_size);
1148+ newinfo->entries = __vmalloc(tmp.entries_size, GFP_KERNEL_ACCOUNT,
1149+ PAGE_KERNEL);
11481150 if (!newinfo->entries) {
11491151 ret = -ENOMEM;
11501152 goto free_newinfo;
net/bridge/netfilter/nft_reject_bridge.c+1−0
@@ -229,6 +229,7 @@ static bool reject6_br_csum_ok(struct sk_buff *skb, int hook) · 228 unmodified lines
229229 pskb_trim_rcsum(skb, ntohs(ip6h->payload_len) + sizeof(*ip6h)))
230230 return false;
231231
232+ ip6h = ipv6_hdr(skb);
232233 thoff = ipv6_skip_exthdr(skb, ((u8*)(ip6h+1) - skb->data), &proto, &fo);
233234 if (thoff < 0 || thoff >= skb->len || (fo & htons(~0x7)) != 0)
234235 return false;
net/core/filter.c+20−12
@@ -2020,18 +2020,19 @@ static inline int __bpf_tx_skb(struct net_device *dev, struct sk_buff *skb) · 2019 unmodified lines
20202020 static int __bpf_redirect_no_mac(struct sk_buff *skb, struct net_device *dev,
20212021 u32 flags)
20222022 {
2023− /* skb->mac_len is not set on normal egress */
2024− unsigned int mlen = skb->network_header - skb->mac_header;
2023+ unsigned int mlen = skb_network_offset(skb);
20252024
2026− __skb_pull(skb, mlen);
2025+ if (mlen) {
2026+ __skb_pull(skb, mlen);
20272027
2028− /* At ingress, the mac header has already been pulled once.
2029− * At egress, skb_pospull_rcsum has to be done in case that
2030− * the skb is originated from ingress (i.e. a forwarded skb)
2031− * to ensure that rcsum starts at net header.
2032− */
2033− if (!skb_at_tc_ingress(skb))
2034− skb_postpull_rcsum(skb, skb_mac_header(skb), mlen);
2028+ /* At ingress, the mac header has already been pulled once.
2029+ * At egress, skb_pospull_rcsum has to be done in case that
2030+ * the skb is originated from ingress (i.e. a forwarded skb)
2031+ * to ensure that rcsum starts at net header.
2032+ */
2033+ if (!skb_at_tc_ingress(skb))
2034+ skb_postpull_rcsum(skb, skb_mac_header(skb), mlen);
2035+ }
20352036 skb_pop_mac_header(skb);
20362037 skb_reset_mac_len(skb);
20372038 return flags & BPF_F_INGRESS ?
@@ -4119,6 +4120,10 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock, · 2081 unmodified lines
41194120 sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF);
41204121 break;
41214122 case SO_MAX_PACING_RATE: /* 32bit version */
4123+ if (val != ~0U)
4124+ cmpxchg(&sk->sk_pacing_status,
4125+ SK_PACING_NONE,
4126+ SK_PACING_NEEDED);
41224127 sk->sk_max_pacing_rate = (val == ~0U) ? ~0UL : val;
41234128 sk->sk_pacing_rate = min(sk->sk_pacing_rate,
41244129 sk->sk_max_pacing_rate);
@@ -4132,7 +4137,10 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock, · 7 unmodified lines
41324137 sk->sk_rcvlowat = val ? : 1;
41334138 break;
41344139 case SO_MARK:
4135− sk->sk_mark = val;
4140+ if (sk->sk_mark != val) {
4141+ sk->sk_mark = val;
4142+ sk_dst_reset(sk);
4143+ }
41364144 break;
41374145 default:
41384146 ret = -EINVAL;
@@ -5309,7 +5317,7 @@ bpf_base_func_proto(enum bpf_func_id func_id) · 1170 unmodified lines
53095317 case BPF_FUNC_trace_printk:
53105318 if (capable(CAP_SYS_ADMIN))
53115319 return bpf_get_trace_printk_proto();
5312− /* else: fall through */
5320+ /* else, fall through */
53135321 default:
53145322 return NULL;
53155323 }
net/core/lwt_bpf.c+1−0
@@ -63,6 +63,7 @@ static int run_lwt_bpf(struct sk_buff *skb, struct bpf_lwt_prog *lwt, · 62 unmodified lines
6363 lwt->name ? : "<unknown>");
6464 ret = BPF_OK;
6565 } else {
66+ skb_reset_mac_header(skb);
6667 ret = skb_do_redirect(skb);
6768 if (ret == 0)
6869 ret = BPF_REDIRECT;
net/core/neighbour.c+2−2
@@ -450,7 +450,7 @@ static struct neigh_hash_table *neigh_hash_alloc(unsigned int shift) · 449 unmodified lines
450450 buckets = (struct neighbour __rcu **)
451451 __get_free_pages(GFP_ATOMIC | __GFP_ZERO,
452452 get_order(size));
453− kmemleak_alloc(buckets, size, 0, GFP_ATOMIC);
453+ kmemleak_alloc(buckets, size, 1, GFP_ATOMIC);
454454 }
455455 if (!buckets) {
456456 kfree(ret);
@@ -1007,7 +1007,7 @@ static void neigh_probe(struct neighbour *neigh) · 550 unmodified lines
10071007 if (neigh->ops->solicit)
10081008 neigh->ops->solicit(neigh, skb);
10091009 atomic_inc(&neigh->probes);
1010− kfree_skb(skb);
1010+ consume_skb(skb);
10111011 }
10121012
10131013 /* Called when a timer expires for a neighbour entry. */
net/ipv4/fib_frontend.c+2−2
@@ -203,7 +203,7 @@ static void fib_flush(struct net *net) · 202 unmodified lines
203203 struct fib_table *tb;
204204
205205 hlist_for_each_entry_safe(tb, tmp, head, tb_hlist)
206− flushed += fib_table_flush(net, tb);
206+ flushed += fib_table_flush(net, tb, false);
207207 }
208208
209209 if (flushed)
@@ -1463,7 +1463,7 @@ static void ip_fib_net_exit(struct net *net) · 1253 unmodified lines
14631463
14641464 hlist_for_each_entry_safe(tb, tmp, head, tb_hlist) {
14651465 hlist_del(&tb->tb_hlist);
1466− fib_table_flush(net, tb);
1466+ fib_table_flush(net, tb, true);
14671467 fib_free_table(tb);
14681468 }
14691469 }
net/ipv4/fib_trie.c+12−3
@@ -1856,7 +1856,7 @@ void fib_table_flush_external(struct fib_table *tb) · 1855 unmodified lines
18561856 }
18571857
18581858 /* Caller must hold RTNL. */
1859−int fib_table_flush(struct net *net, struct fib_table *tb)
1859+int fib_table_flush(struct net *net, struct fib_table *tb, bool flush_all)
18601860 {
18611861 struct trie *t = (struct trie *)tb->tb_data;
18621862 struct key_vector *pn = t->kv;
@@ -1904,8 +1904,17 @@ int fib_table_flush(struct net *net, struct fib_table *tb) · 41 unmodified lines
19041904 hlist_for_each_entry_safe(fa, tmp, &n->leaf, fa_list) {
19051905 struct fib_info *fi = fa->fa_info;
19061906
1907− if (!fi || !(fi->fib_flags & RTNH_F_DEAD) ||
1908− tb->tb_id != fa->tb_id) {
1907+ if (!fi || tb->tb_id != fa->tb_id ||
1908+ (!(fi->fib_flags & RTNH_F_DEAD) &&
1909+ !fib_props[fa->fa_type].error)) {
1910+ slen = fa->fa_slen;
1911+ continue;
1912+ }
1913+
1914+ /* Do not flush error routes if network namespace is
1915+ * not being dismantled
1916+ */
1917+ if (!flush_all && fib_props[fa->fa_type].error) {
19091918 slen = fa->fa_slen;
19101919 continue;
19111920 }
net/ipv4/fou.c+7−2
@@ -1020,10 +1020,11 @@ static int gue_err(struct sk_buff *skb, u32 info) · 1019 unmodified lines
10201020 {
10211021 int transport_offset = skb_transport_offset(skb);
10221022 struct guehdr *guehdr;
1023− size_t optlen;
1023+ size_t len, optlen;
10241024 int ret;
10251025
1026− if (skb->len < sizeof(struct udphdr) + sizeof(struct guehdr))
1026+ len = sizeof(struct udphdr) + sizeof(struct guehdr);
1027+ if (!pskb_may_pull(skb, len))
10271028 return -EINVAL;
10281029
10291030 guehdr = (struct guehdr *)&udp_hdr(skb)[1];
@@ -1058,6 +1059,10 @@ static int gue_err(struct sk_buff *skb, u32 info) · 28 unmodified lines
10581059
10591060 optlen = guehdr->hlen << 2;
10601061
1062+ if (!pskb_may_pull(skb, len + optlen))
1063+ return -EINVAL;
1064+
1065+ guehdr = (struct guehdr *)&udp_hdr(skb)[1];
10611066 if (validate_gue_flags(guehdr, optlen))
10621067 return -EINVAL;
10631068
net/ipv4/ip_gre.c+14−9
@@ -569,8 +569,7 @@ err_free_skb: · 568 unmodified lines
569569 dev->stats.tx_dropped++;
570570 }
571571
572−static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev,
573− __be16 proto)
572+static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev)
574573 {
575574 struct ip_tunnel *tunnel = netdev_priv(dev);
576575 struct ip_tunnel_info *tun_info;
@@ -578,10 +577,10 @@ static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev, · 1 unmodified line
578577 struct erspan_metadata *md;
579578 struct rtable *rt = NULL;
580579 bool truncate = false;
580+ __be16 df, proto;
581581 struct flowi4 fl;
582582 int tunnel_hlen;
583583 int version;
584− __be16 df;
585584 int nhoff;
586585 int thoff;
587586
@@ -626,18 +625,20 @@ static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev, · 38 unmodified lines
626625 if (version == 1) {
627626 erspan_build_header(skb, ntohl(tunnel_id_to_key32(key->tun_id)),
628627 ntohl(md->u.index), truncate, true);
628+ proto = htons(ETH_P_ERSPAN);
629629 } else if (version == 2) {
630630 erspan_build_header_v2(skb,
631631 ntohl(tunnel_id_to_key32(key->tun_id)),
632632 md->u.md2.dir,
633633 get_hwid(&md->u.md2),
634634 truncate, true);
635+ proto = htons(ETH_P_ERSPAN2);
635636 } else {
636637 goto err_free_rt;
637638 }
638639
639640 gre_build_header(skb, 8, TUNNEL_SEQ,
640− htons(ETH_P_ERSPAN), 0, htonl(tunnel->o_seqno++));
641+ proto, 0, htonl(tunnel->o_seqno++));
641642
642643 df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0;
643644
@@ -721,12 +722,13 @@ static netdev_tx_t erspan_xmit(struct sk_buff *skb, · 77 unmodified lines
721722 {
722723 struct ip_tunnel *tunnel = netdev_priv(dev);
723724 bool truncate = false;
725+ __be16 proto;
724726
725727 if (!pskb_inet_may_pull(skb))
726728 goto free_skb;
727729
728730 if (tunnel->collect_md) {
729− erspan_fb_xmit(skb, dev, skb->protocol);
731+ erspan_fb_xmit(skb, dev);
730732 return NETDEV_TX_OK;
731733 }
732734
@@ -742,19 +744,22 @@ static netdev_tx_t erspan_xmit(struct sk_buff *skb, · 9 unmodified lines
742744 }
743745
744746 /* Push ERSPAN header */
745− if (tunnel->erspan_ver == 1)
747+ if (tunnel->erspan_ver == 1) {
746748 erspan_build_header(skb, ntohl(tunnel->parms.o_key),
747749 tunnel->index,
748750 truncate, true);
749− else if (tunnel->erspan_ver == 2)
751+ proto = htons(ETH_P_ERSPAN);
752+ } else if (tunnel->erspan_ver == 2) {
750753 erspan_build_header_v2(skb, ntohl(tunnel->parms.o_key),
751754 tunnel->dir, tunnel->hwid,
752755 truncate, true);
753− else
756+ proto = htons(ETH_P_ERSPAN2);
757+ } else {
754758 goto free_skb;
759+ }
755760
756761 tunnel->parms.o_flags &= ~TUNNEL_KEY;
757− __gre_xmit(skb, dev, &tunnel->parms.iph, htons(ETH_P_ERSPAN));
762+ __gre_xmit(skb, dev, &tunnel->parms.iph, proto);
758763 return NETDEV_TX_OK;
759764
760765 free_skb:
net/ipv4/ip_input.c+1−0
@@ -488,6 +488,7 @@ static struct sk_buff *ip_rcv_core(struct sk_buff *skb, struct net *net) · 487 unmodified lines
488488 goto drop;
489489 }
490490
491+ iph = ip_hdr(skb);
491492 skb->transport_header = skb->network_header + iph->ihl*4;
492493
493494 /* Remove any debris in the socket control block */
net/ipv4/tcp.c+1−1
@@ -1186,7 +1186,7 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size) · 1185 unmodified lines
11861186 flags = msg->msg_flags;
11871187
11881188 if (flags & MSG_ZEROCOPY && size && sock_flag(sk, SOCK_ZEROCOPY)) {
1189− if (sk->sk_state != TCP_ESTABLISHED) {
1189+ if ((1 << sk->sk_state) & ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)) {
11901190 err = -EINVAL;
11911191 goto out_err;
11921192 }
net/ipv4/udp.c+13−5
@@ -847,15 +847,23 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4, · 846 unmodified lines
847847 const int hlen = skb_network_header_len(skb) +
848848 sizeof(struct udphdr);
849849
850− if (hlen + cork->gso_size > cork->fragsize)
850+ if (hlen + cork->gso_size > cork->fragsize) {
851+ kfree_skb(skb);
851852 return -EINVAL;
852− if (skb->len > cork->gso_size * UDP_MAX_SEGMENTS)
853+ }
854+ if (skb->len > cork->gso_size * UDP_MAX_SEGMENTS) {
855+ kfree_skb(skb);
853856 return -EINVAL;
854− if (sk->sk_no_check_tx)
857+ }
858+ if (sk->sk_no_check_tx) {
859+ kfree_skb(skb);
855860 return -EINVAL;
861+ }
856862 if (skb->ip_summed != CHECKSUM_PARTIAL || is_udplite ||
857− dst_xfrm(skb_dst(skb)))
863+ dst_xfrm(skb_dst(skb))) {
864+ kfree_skb(skb);
858865 return -EIO;
866+ }
859867
860868 skb_shinfo(skb)->gso_size = cork->gso_size;
861869 skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4;
@@ -1918,7 +1926,7 @@ void udp_lib_rehash(struct sock *sk, u16 newhash) · 1056 unmodified lines
19181926 }
19191927 EXPORT_SYMBOL(udp_lib_rehash);
19201928
1921−static void udp_v4_rehash(struct sock *sk)
1929+void udp_v4_rehash(struct sock *sk)
19221930 {
19231931 u16 new_hash = ipv4_portaddr_hash(sock_net(sk),
19241932 inet_sk(sk)->inet_rcv_saddr,
net/ipv4/udp_impl.h+1−0
@@ -10,6 +10,7 @@ int __udp4_lib_rcv(struct sk_buff *, struct udp_table *, int); · 9 unmodified lines
1010 int __udp4_lib_err(struct sk_buff *, u32, struct udp_table *);
1111
1212 int udp_v4_get_port(struct sock *sk, unsigned short snum);
13+void udp_v4_rehash(struct sock *sk);
1314
1415 int udp_setsockopt(struct sock *sk, int level, int optname,
1516 char __user *optval, unsigned int optlen);
net/ipv4/udplite.c+1−0
@@ -53,6 +53,7 @@ struct proto udplite_prot = { · 52 unmodified lines
5353 .sendpage = udp_sendpage,
5454 .hash = udp_lib_hash,
5555 .unhash = udp_lib_unhash,
56+ .rehash = udp_v4_rehash,
5657 .get_port = udp_v4_get_port,
5758 .memory_allocated = &udp_memory_allocated,
5859 .sysctl_mem = sysctl_udp_mem,
net/ipv6/fou6.c+7−2
@@ -90,10 +90,11 @@ static int gue6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, · 89 unmodified lines
9090 {
9191 int transport_offset = skb_transport_offset(skb);
9292 struct guehdr *guehdr;
93− size_t optlen;
93+ size_t len, optlen;
9494 int ret;
9595
96− if (skb->len < sizeof(struct udphdr) + sizeof(struct guehdr))
96+ len = sizeof(struct udphdr) + sizeof(struct guehdr);
97+ if (!pskb_may_pull(skb, len))
9798 return -EINVAL;
9899
99100 guehdr = (struct guehdr *)&udp_hdr(skb)[1];
@@ -128,6 +129,10 @@ static int gue6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, · 28 unmodified lines
128129
129130 optlen = guehdr->hlen << 2;
130131
132+ if (!pskb_may_pull(skb, len + optlen))
133+ return -EINVAL;
134+
135+ guehdr = (struct guehdr *)&udp_hdr(skb)[1];
131136 if (validate_gue_flags(guehdr, optlen))
132137 return -EINVAL;
133138
net/ipv6/ip6_gre.c+10−4
@@ -922,6 +922,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb, · 921 unmodified lines
922922 __u8 dsfield = false;
923923 struct flowi6 fl6;
924924 int err = -EINVAL;
925+ __be16 proto;
925926 __u32 mtu;
926927 int nhoff;
927928 int thoff;
@@ -1035,8 +1036,9 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb, · 107 unmodified lines
10351036 }
10361037
10371038 /* Push GRE header. */
1038− gre_build_header(skb, 8, TUNNEL_SEQ,
1039− htons(ETH_P_ERSPAN), 0, htonl(t->o_seqno++));
1039+ proto = (t->parms.erspan_ver == 1) ? htons(ETH_P_ERSPAN)
1040+ : htons(ETH_P_ERSPAN2);
1041+ gre_build_header(skb, 8, TUNNEL_SEQ, proto, 0, htonl(t->o_seqno++));
10401042
10411043 /* TooBig packet may have updated dst->dev's mtu */
10421044 if (!t->parms.collect_md && dst && dst_mtu(dst) > dst->dev->mtu)
@@ -1169,6 +1171,10 @@ static void ip6gre_tnl_copy_tnl_parm(struct ip6_tnl *t, · 126 unmodified lines
11691171 t->parms.i_flags = p->i_flags;
11701172 t->parms.o_flags = p->o_flags;
11711173 t->parms.fwmark = p->fwmark;
1174+ t->parms.erspan_ver = p->erspan_ver;
1175+ t->parms.index = p->index;
1176+ t->parms.dir = p->dir;
1177+ t->parms.hwid = p->hwid;
11721178 dst_cache_reset(&t->dst_cache);
11731179 }
11741180
@@ -2025,9 +2031,9 @@ static int ip6gre_changelink(struct net_device *dev, struct nlattr *tb[], · 850 unmodified lines
20252031 struct nlattr *data[],
20262032 struct netlink_ext_ack *extack)
20272033 {
2028− struct ip6gre_net *ign = net_generic(dev_net(dev), ip6gre_net_id);
2034+ struct ip6_tnl *t = netdev_priv(dev);
2035+ struct ip6gre_net *ign = net_generic(t->net, ip6gre_net_id);
20292036 struct __ip6_tnl_parm p;
2030− struct ip6_tnl *t;
20312037
20322038 t = ip6gre_changelink_common(dev, tb, data, &p, extack);
20332039 if (IS_ERR(t))
net/ipv6/route.c+2−12
@@ -4251,17 +4251,6 @@ struct rt6_nh { · 4250 unmodified lines
42514251 struct list_head next;
42524252 };
42534253
4254−static void ip6_print_replace_route_err(struct list_head *rt6_nh_list)
4255−{
4256− struct rt6_nh *nh;
4257−
4258− list_for_each_entry(nh, rt6_nh_list, next) {
4259− pr_warn("IPV6: multipath route replace failed (check consistency of installed routes): %pI6c nexthop %pI6c ifi %d\n",
4260− &nh->r_cfg.fc_dst, &nh->r_cfg.fc_gateway,
4261− nh->r_cfg.fc_ifindex);
4262− }
4263−}
4264−
42654254 static int ip6_route_info_append(struct net *net,
42664255 struct list_head *rt6_nh_list,
42674256 struct fib6_info *rt,
@@ -4407,7 +4396,8 @@ static int ip6_route_multipath_add(struct fib6_config *cfg, · 139 unmodified lines
44074396 nh->fib6_info = NULL;
44084397 if (err) {
44094398 if (replace && nhn)
4410− ip6_print_replace_route_err(&rt6_nh_list);
4399+ NL_SET_ERR_MSG_MOD(extack,
4400+ "multipath route replace failed (check consistency of installed routes)");
44114401 err_nh = nh;
44124402 goto add_errout;
44134403 }
net/ipv6/udp.c+13−5
@@ -102,7 +102,7 @@ int udp_v6_get_port(struct sock *sk, unsigned short snum) · 101 unmodified lines
102102 return udp_lib_get_port(sk, snum, hash2_nulladdr);
103103 }
104104
105−static void udp_v6_rehash(struct sock *sk)
105+void udp_v6_rehash(struct sock *sk)
106106 {
107107 u16 new_hash = ipv6_portaddr_hash(sock_net(sk),
108108 &sk->sk_v6_rcv_saddr,
@@ -1132,15 +1132,23 @@ static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6, · 1023 unmodified lines
11321132 const int hlen = skb_network_header_len(skb) +
11331133 sizeof(struct udphdr);
11341134
1135− if (hlen + cork->gso_size > cork->fragsize)
1135+ if (hlen + cork->gso_size > cork->fragsize) {
1136+ kfree_skb(skb);
11361137 return -EINVAL;
1137− if (skb->len > cork->gso_size * UDP_MAX_SEGMENTS)
1138+ }
1139+ if (skb->len > cork->gso_size * UDP_MAX_SEGMENTS) {
1140+ kfree_skb(skb);
11381141 return -EINVAL;
1139− if (udp_sk(sk)->no_check6_tx)
1142+ }
1143+ if (udp_sk(sk)->no_check6_tx) {
1144+ kfree_skb(skb);
11401145 return -EINVAL;
1146+ }
11411147 if (skb->ip_summed != CHECKSUM_PARTIAL || is_udplite ||
1142− dst_xfrm(skb_dst(skb)))
1148+ dst_xfrm(skb_dst(skb))) {
1149+ kfree_skb(skb);
11431150 return -EIO;
1151+ }
11441152
11451153 skb_shinfo(skb)->gso_size = cork->gso_size;
11461154 skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4;
net/ipv6/udp_impl.h+1−0
@@ -13,6 +13,7 @@ int __udp6_lib_err(struct sk_buff *, struct inet6_skb_parm *, u8, u8, int, · 12 unmodified lines
1313 __be32, struct udp_table *);
1414
1515 int udp_v6_get_port(struct sock *sk, unsigned short snum);
16+void udp_v6_rehash(struct sock *sk);
1617
1718 int udpv6_getsockopt(struct sock *sk, int level, int optname,
1819 char __user *optval, int __user *optlen);
net/ipv6/udplite.c+1−0
@@ -49,6 +49,7 @@ struct proto udplitev6_prot = { · 48 unmodified lines
4949 .recvmsg = udpv6_recvmsg,
5050 .hash = udp_lib_hash,
5151 .unhash = udp_lib_unhash,
52+ .rehash = udp_v6_rehash,
5253 .get_port = udp_v6_get_port,
5354 .memory_allocated = &udp_memory_allocated,
5455 .sysctl_mem = sysctl_udp_mem,
net/netfilter/nf_flow_table_core.c+3−2
@@ -28,6 +28,7 @@ flow_offload_fill_dir(struct flow_offload *flow, struct nf_conn *ct, · 27 unmodified lines
2828 {
2929 struct flow_offload_tuple *ft = &flow->tuplehash[dir].tuple;
3030 struct nf_conntrack_tuple *ctt = &ct->tuplehash[dir].tuple;
31+ struct dst_entry *other_dst = route->tuple[!dir].dst;
3132 struct dst_entry *dst = route->tuple[dir].dst;
3233
3334 ft->dir = dir;
@@ -50,8 +51,8 @@ flow_offload_fill_dir(struct flow_offload *flow, struct nf_conn *ct, · 16 unmodified lines
5051 ft->src_port = ctt->src.u.tcp.port;
5152 ft->dst_port = ctt->dst.u.tcp.port;
5253
53− ft->iifidx = route->tuple[dir].ifindex;
54− ft->oifidx = route->tuple[!dir].ifindex;
54+ ft->iifidx = other_dst->dev->ifindex;
55+ ft->oifidx = dst->dev->ifindex;
5556 ft->dst_cache = dst;
5657 }
5758
net/netfilter/nf_tables_api.c+7−7
@@ -2304,7 +2304,6 @@ static int __nf_tables_dump_rules(struct sk_buff *skb, · 2303 unmodified lines
23042304 struct net *net = sock_net(skb->sk);
23052305 unsigned int s_idx = cb->args[0];
23062306 const struct nft_rule *rule;
2307− int rc = 1;
23082307
23092308 list_for_each_entry_rcu(rule, &chain->rules, list) {
23102309 if (!nft_is_active(net, rule))
@@ -2321,16 +2320,13 @@ static int __nf_tables_dump_rules(struct sk_buff *skb, · 10 unmodified lines
23212320 NLM_F_MULTI | NLM_F_APPEND,
23222321 table->family,
23232322 table, chain, rule) < 0)
2324− goto out_unfinished;
2323+ return 1;
23252324
23262325 nl_dump_check_consistent(cb, nlmsg_hdr(skb));
23272326 cont:
23282327 (*idx)++;
23292328 }
2330− rc = 0;
2331−out_unfinished:
2332− cb->args[0] = *idx;
2333− return rc;
2329+ return 0;
23342330 }
23352331
23362332 static int nf_tables_dump_rules(struct sk_buff *skb,
@@ -2354,7 +2350,7 @@ static int nf_tables_dump_rules(struct sk_buff *skb, · 17 unmodified lines
23542350 if (ctx && ctx->table && strcmp(ctx->table, table->name) != 0)
23552351 continue;
23562352
2357− if (ctx && ctx->chain) {
2353+ if (ctx && ctx->table && ctx->chain) {
23582354 struct rhlist_head *list, *tmp;
23592355
23602356 list = rhltable_lookup(&table->chains_ht, ctx->chain,
@@ -2382,6 +2378,8 @@ static int nf_tables_dump_rules(struct sk_buff *skb, · 21 unmodified lines
23822378 }
23832379 done:
23842380 rcu_read_unlock();
2381+
2382+ cb->args[0] = idx;
23852383 return skb->len;
23862384 }
23872385
@@ -4508,6 +4506,8 @@ err6: · 2120 unmodified lines
45084506 err5:
45094507 kfree(trans);
45104508 err4:
4509+ if (obj)
4510+ obj->use--;
45114511 kfree(elem.priv);
45124512 err3:
45134513 if (nla[NFTA_SET_ELEM_DATA] != NULL)
net/netfilter/nft_flow_offload.c+8−5
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <net/netfilter/nf_conntrack_core.h>
1313 #include <linux/netfilter/nf_conntrack_common.h>
1414 #include <net/netfilter/nf_flow_table.h>
15+#include <net/netfilter/nf_conntrack_helper.h>
1516
1617 struct nft_flow_offload {
1718 struct nft_flowtable *flowtable;
@@ -29,10 +30,12 @@ static int nft_flow_route(const struct nft_pktinfo *pkt, · 11 unmodified lines
2930 memset(&fl, 0, sizeof(fl));
3031 switch (nft_pf(pkt)) {
3132 case NFPROTO_IPV4:
32− fl.u.ip4.daddr = ct->tuplehash[!dir].tuple.dst.u3.ip;
33+ fl.u.ip4.daddr = ct->tuplehash[dir].tuple.src.u3.ip;
34+ fl.u.ip4.flowi4_oif = nft_in(pkt)->ifindex;
3335 break;
3436 case NFPROTO_IPV6:
35− fl.u.ip6.daddr = ct->tuplehash[!dir].tuple.dst.u3.in6;
37+ fl.u.ip6.daddr = ct->tuplehash[dir].tuple.src.u3.in6;
38+ fl.u.ip6.flowi6_oif = nft_in(pkt)->ifindex;
3639 break;
3740 }
3841
@@ -41,9 +44,7 @@ static int nft_flow_route(const struct nft_pktinfo *pkt, · 2 unmodified lines
4144 return -ENOENT;
4245
4346 route->tuple[dir].dst = this_dst;
44− route->tuple[dir].ifindex = nft_in(pkt)->ifindex;
4547 route->tuple[!dir].dst = other_dst;
46− route->tuple[!dir].ifindex = nft_out(pkt)->ifindex;
4748
4849 return 0;
4950 }
@@ -66,6 +67,7 @@ static void nft_flow_offload_eval(const struct nft_expr *expr, · 16 unmodified lines
6667 {
6768 struct nft_flow_offload *priv = nft_expr_priv(expr);
6869 struct nf_flowtable *flowtable = &priv->flowtable->data;
70+ const struct nf_conn_help *help;
6971 enum ip_conntrack_info ctinfo;
7072 struct nf_flow_route route;
7173 struct flow_offload *flow;
@@ -88,7 +90,8 @@ static void nft_flow_offload_eval(const struct nft_expr *expr, · 16 unmodified lines
8890 goto out;
8991 }
9092
91− if (test_bit(IPS_HELPER_BIT, &ct->status))
93+ help = nfct_help(ct);
94+ if (help)
9295 goto out;
9396
9497 if (ctinfo == IP_CT_NEW ||
net/openvswitch/flow_netlink.c+1−1
@@ -500,7 +500,7 @@ static int __parse_flow_nlattrs(const struct nlattr *attr, · 499 unmodified lines
500500 return -EINVAL;
501501 }
502502
503− if (!nz || !is_all_zero(nla_data(nla), expected_len)) {
503+ if (!nz || !is_all_zero(nla_data(nla), nla_len(nla))) {
504504 attrs |= 1 << type;
505505 a[type] = nla;
506506 }
net/packet/af_packet.c+2−1
@@ -2887,7 +2887,8 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) · 2886 unmodified lines
28872887 goto out_free;
28882888 } else if (reserve) {
28892889 skb_reserve(skb, -reserve);
2890− if (len < reserve)
2890+ if (len < reserve + sizeof(struct ipv6hdr) &&
2891+ dev->min_header_len != dev->hard_header_len)
28912892 skb_reset_network_header(skb);
28922893 }
28932894
net/rxrpc/af_rxrpc.c+0−70
@@ -418,76 +418,6 @@ u32 rxrpc_kernel_get_epoch(struct socket *sock, struct rxrpc_call *call) · 417 unmodified lines
418418 }
419419 EXPORT_SYMBOL(rxrpc_kernel_get_epoch);
420420
421−/**
422− * rxrpc_kernel_check_call - Check a call's state
423− * @sock: The socket the call is on
424− * @call: The call to check
425− * @_compl: Where to store the completion state
426− * @_abort_code: Where to store any abort code
427− *
428− * Allow a kernel service to query the state of a call and find out the manner
429− * of its termination if it has completed. Returns -EINPROGRESS if the call is
430− * still going, 0 if the call finished successfully, -ECONNABORTED if the call
431− * was aborted and an appropriate error if the call failed in some other way.
432− */
433−int rxrpc_kernel_check_call(struct socket *sock, struct rxrpc_call *call,
434− enum rxrpc_call_completion *_compl, u32 *_abort_code)
435−{
436− if (call->state != RXRPC_CALL_COMPLETE)
437− return -EINPROGRESS;
438− smp_rmb();
439− *_compl = call->completion;
440− *_abort_code = call->abort_code;
441− return call->error;
442−}
443−EXPORT_SYMBOL(rxrpc_kernel_check_call);
444−
445−/**
446− * rxrpc_kernel_retry_call - Allow a kernel service to retry a call
447− * @sock: The socket the call is on
448− * @call: The call to retry
449− * @srx: The address of the peer to contact
450− * @key: The security context to use (defaults to socket setting)
451− *
452− * Allow a kernel service to try resending a client call that failed due to a
453− * network error to a new address. The Tx queue is maintained intact, thereby
454− * relieving the need to re-encrypt any request data that has already been
455− * buffered.
456− */
457−int rxrpc_kernel_retry_call(struct socket *sock, struct rxrpc_call *call,
458− struct sockaddr_rxrpc *srx, struct key *key)
459−{
460− struct rxrpc_conn_parameters cp;
461− struct rxrpc_sock *rx = rxrpc_sk(sock->sk);
462− int ret;
463−
464− _enter("%d{%d}", call->debug_id, atomic_read(&call->usage));
465−
466− if (!key)
467− key = rx->key;
468− if (key && !key->payload.data[0])
469− key = NULL; /* a no-security key */
470−
471− memset(&cp, 0, sizeof(cp));
472− cp.local = rx->local;
473− cp.key = key;
474− cp.security_level = 0;
475− cp.exclusive = false;
476− cp.service_id = srx->srx_service;
477−
478− mutex_lock(&call->user_mutex);
479−
480− ret = rxrpc_prepare_call_for_retry(rx, call);
481− if (ret == 0)
482− ret = rxrpc_retry_client_call(rx, call, &cp, srx, GFP_KERNEL);
483−
484− mutex_unlock(&call->user_mutex);
485− rxrpc_put_peer(cp.peer);
486− _leave(" = %d", ret);
487− return ret;
488−}
489−EXPORT_SYMBOL(rxrpc_kernel_retry_call);
490−
491421 /**
492422 * rxrpc_kernel_new_call_notification - Get notifications of new calls
493423 * @sock: The socket to intercept received messages on
net/rxrpc/ar-internal.h+12−7
@@ -476,7 +476,6 @@ enum rxrpc_call_flag { · 475 unmodified lines
476476 RXRPC_CALL_EXPOSED, /* The call was exposed to the world */
477477 RXRPC_CALL_RX_LAST, /* Received the last packet (at rxtx_top) */
478478 RXRPC_CALL_TX_LAST, /* Last packet in Tx buffer (at rxtx_top) */
479− RXRPC_CALL_TX_LASTQ, /* Last packet has been queued */
480479 RXRPC_CALL_SEND_PING, /* A ping will need to be sent */
481480 RXRPC_CALL_PINGING, /* Ping in process */
482481 RXRPC_CALL_RETRANS_TIMEOUT, /* Retransmission due to timeout occurred */
@@ -517,6 +516,18 @@ enum rxrpc_call_state { · 34 unmodified lines
517516 NR__RXRPC_CALL_STATES
518517 };
519518
519+/*
520+ * Call completion condition (state == RXRPC_CALL_COMPLETE).
521+ */
522+enum rxrpc_call_completion {
523+ RXRPC_CALL_SUCCEEDED, /* - Normal termination */
524+ RXRPC_CALL_REMOTELY_ABORTED, /* - call aborted by peer */
525+ RXRPC_CALL_LOCALLY_ABORTED, /* - call aborted locally on error or close */
526+ RXRPC_CALL_LOCAL_ERROR, /* - call failed due to local error */
527+ RXRPC_CALL_NETWORK_ERROR, /* - call terminated by network error */
528+ NR__RXRPC_CALL_COMPLETIONS
529+};
530+
520531 /*
521532 * Call Tx congestion management modes.
522533 */
@@ -761,15 +772,9 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *, · 238 unmodified lines
761772 struct sockaddr_rxrpc *,
762773 struct rxrpc_call_params *, gfp_t,
763774 unsigned int);
764−int rxrpc_retry_client_call(struct rxrpc_sock *,
765− struct rxrpc_call *,
766− struct rxrpc_conn_parameters *,
767− struct sockaddr_rxrpc *,
768− gfp_t);
769775 void rxrpc_incoming_call(struct rxrpc_sock *, struct rxrpc_call *,
770776 struct sk_buff *);
771777 void rxrpc_release_call(struct rxrpc_sock *, struct rxrpc_call *);
772−int rxrpc_prepare_call_for_retry(struct rxrpc_sock *, struct rxrpc_call *);
773778 void rxrpc_release_calls_on_socket(struct rxrpc_sock *);
774779 bool __rxrpc_queue_call(struct rxrpc_call *);
775780 bool rxrpc_queue_call(struct rxrpc_call *);
net/rxrpc/call_object.c+0−97
@@ -324,48 +324,6 @@ error: · 323 unmodified lines
324324 return ERR_PTR(ret);
325325 }
326326
327−/*
328− * Retry a call to a new address. It is expected that the Tx queue of the call
329− * will contain data previously packaged for an old call.
330− */
331−int rxrpc_retry_client_call(struct rxrpc_sock *rx,
332− struct rxrpc_call *call,
333− struct rxrpc_conn_parameters *cp,
334− struct sockaddr_rxrpc *srx,
335− gfp_t gfp)
336−{
337− const void *here = __builtin_return_address(0);
338− int ret;
339−
340− /* Set up or get a connection record and set the protocol parameters,
341− * including channel number and call ID.
342− */
343− ret = rxrpc_connect_call(rx, call, cp, srx, gfp);
344− if (ret < 0)
345− goto error;
346−
347− trace_rxrpc_call(call, rxrpc_call_connected, atomic_read(&call->usage),
348− here, NULL);
349−
350− rxrpc_start_call_timer(call);
351−
352− _net("CALL new %d on CONN %d", call->debug_id, call->conn->debug_id);
353−
354− if (!test_and_set_bit(RXRPC_CALL_EV_RESEND, &call->events))
355− rxrpc_queue_call(call);
356−
357− _leave(" = 0");
358− return 0;
359−
360−error:
361− rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR,
362− RX_CALL_DEAD, ret);
363− trace_rxrpc_call(call, rxrpc_call_error, atomic_read(&call->usage),
364− here, ERR_PTR(ret));
365− _leave(" = %d", ret);
366− return ret;
367−}
368−
369327 /*
370328 * Set up an incoming call. call->conn points to the connection.
371329 * This is called in BH context and isn't allowed to fail.
@@ -533,61 +491,6 @@ void rxrpc_release_call(struct rxrpc_sock *rx, struct rxrpc_call *call) · 161 unmodified lines
533491 _leave("");
534492 }
535493
536−/*
537− * Prepare a kernel service call for retry.
538− */
539−int rxrpc_prepare_call_for_retry(struct rxrpc_sock *rx, struct rxrpc_call *call)
540−{
541− const void *here = __builtin_return_address(0);
542− int i;
543− u8 last = 0;
544−
545− _enter("{%d,%d}", call->debug_id, atomic_read(&call->usage));
546−
547− trace_rxrpc_call(call, rxrpc_call_release, atomic_read(&call->usage),
548− here, (const void *)call->flags);
549−
550− ASSERTCMP(call->state, ==, RXRPC_CALL_COMPLETE);
551− ASSERTCMP(call->completion, !=, RXRPC_CALL_REMOTELY_ABORTED);
552− ASSERTCMP(call->completion, !=, RXRPC_CALL_LOCALLY_ABORTED);
553− ASSERT(list_empty(&call->recvmsg_link));
554−
555− del_timer_sync(&call->timer);
556−
557− _debug("RELEASE CALL %p (%d CONN %p)", call, call->debug_id, call->conn);
558−
559− if (call->conn)
560− rxrpc_disconnect_call(call);
561−
562− if (rxrpc_is_service_call(call) ||
563− !call->tx_phase ||
564− call->tx_hard_ack != 0 ||
565− call->rx_hard_ack != 0 ||
566− call->rx_top != 0)
567− return -EINVAL;
568−
569− call->state = RXRPC_CALL_UNINITIALISED;
570− call->completion = RXRPC_CALL_SUCCEEDED;
571− call->call_id = 0;
572− call->cid = 0;
573− call->cong_cwnd = 0;
574− call->cong_extra = 0;
575− call->cong_ssthresh = 0;
576− call->cong_mode = 0;
577− call->cong_dup_acks = 0;
578− call->cong_cumul_acks = 0;
579− call->acks_lowest_nak = 0;
580−
581− for (i = 0; i < RXRPC_RXTX_BUFF_SIZE; i++) {
582− last |= call->rxtx_annotations[i];
583− call->rxtx_annotations[i] &= RXRPC_TX_ANNO_LAST;
584− call->rxtx_annotations[i] |= RXRPC_TX_ANNO_RETRANS;
585− }
586−
587− _leave(" = 0");
588− return 0;
589−}
590−
591494 /*
592495 * release all the calls associated with a socket
593496 */
net/rxrpc/conn_client.c+1−4
@@ -562,10 +562,7 @@ static void rxrpc_activate_one_channel(struct rxrpc_connection *conn, · 561 unmodified lines
562562 clear_bit(RXRPC_CONN_FINAL_ACK_0 + channel, &conn->flags);
563563
564564 write_lock_bh(&call->state_lock);
565− if (!test_bit(RXRPC_CALL_TX_LASTQ, &call->flags))
566− call->state = RXRPC_CALL_CLIENT_SEND_REQUEST;
567− else
568− call->state = RXRPC_CALL_CLIENT_AWAIT_REPLY;
565+ call->state = RXRPC_CALL_CLIENT_SEND_REQUEST;
569566 write_unlock_bh(&call->state_lock);
570567
571568 rxrpc_see_call(call);
net/rxrpc/sendmsg.c+11−13
@@ -169,10 +169,8 @@ static void rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call, · 168 unmodified lines
169169
170170 ASSERTCMP(seq, ==, call->tx_top + 1);
171171
172− if (last) {
172+ if (last)
173173 annotation |= RXRPC_TX_ANNO_LAST;
174− set_bit(RXRPC_CALL_TX_LASTQ, &call->flags);
175− }
176174
177175 /* We have to set the timestamp before queueing as the retransmit
178176 * algorithm can see the packet as soon as we queue it.
@@ -386,6 +384,11 @@ static int rxrpc_send_data(struct rxrpc_sock *rx, · 207 unmodified lines
386384 call->tx_total_len -= copy;
387385 }
388386
387+ /* check for the far side aborting the call or a network error
388+ * occurring */
389+ if (call->state == RXRPC_CALL_COMPLETE)
390+ goto call_terminated;
391+
389392 /* add the packet to the send queue if it's now full */
390393 if (sp->remain <= 0 ||
391394 (msg_data_left(msg) == 0 && !more)) {
@@ -425,16 +428,6 @@ static int rxrpc_send_data(struct rxrpc_sock *rx, · 33 unmodified lines
425428 notify_end_tx);
426429 skb = NULL;
427430 }
428−
429− /* Check for the far side aborting the call or a network error
430− * occurring. If this happens, save any packet that was under
431− * construction so that in the case of a network error, the
432− * call can be retried or redirected.
433− */
434− if (call->state == RXRPC_CALL_COMPLETE) {
435− ret = call->error;
436− goto out;
437− }
438431 } while (msg_data_left(msg) > 0);
439432
440433 success:
@@ -444,6 +437,11 @@ out: · 3 unmodified lines
444437 _leave(" = %d", ret);
445438 return ret;
446439
440+call_terminated:
441+ rxrpc_free_skb(skb, rxrpc_skb_tx_freed);
442+ _leave(" = %d", call->error);
443+ return call->error;
444+
447445 maybe_error:
448446 if (copied)
449447 goto success;
net/sched/act_tunnel_key.c+11−8
@@ -197,6 +197,15 @@ static const struct nla_policy tunnel_key_policy[TCA_TUNNEL_KEY_MAX + 1] = { · 196 unmodified lines
197197 [TCA_TUNNEL_KEY_ENC_TTL] = { .type = NLA_U8 },
198198 };
199199
200+static void tunnel_key_release_params(struct tcf_tunnel_key_params *p)
201+{
202+ if (!p)
203+ return;
204+ if (p->tcft_action == TCA_TUNNEL_KEY_ACT_SET)
205+ dst_release(&p->tcft_enc_metadata->dst);
206+ kfree_rcu(p, rcu);
207+}
208+
200209 static int tunnel_key_init(struct net *net, struct nlattr *nla,
201210 struct nlattr *est, struct tc_action **a,
202211 int ovr, int bind, bool rtnl_held,
@@ -360,8 +369,7 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla, · 157 unmodified lines
360369 rcu_swap_protected(t->params, params_new,
361370 lockdep_is_held(&t->tcf_lock));
362371 spin_unlock_bh(&t->tcf_lock);
363− if (params_new)
364− kfree_rcu(params_new, rcu);
372+ tunnel_key_release_params(params_new);
365373
366374 if (ret == ACT_P_CREATED)
367375 tcf_idr_insert(tn, *a);
@@ -385,12 +393,7 @@ static void tunnel_key_release(struct tc_action *a) · 17 unmodified lines
385393 struct tcf_tunnel_key_params *params;
386394
387395 params = rcu_dereference_protected(t->params, 1);
388− if (params) {
389− if (params->tcft_action == TCA_TUNNEL_KEY_ACT_SET)
390− dst_release(&params->tcft_enc_metadata->dst);
391−
392− kfree_rcu(params, rcu);
393− }
396+ tunnel_key_release_params(params);
394397 }
395398
396399 static int tunnel_key_geneve_opts_dump(struct sk_buff *skb,
net/sched/cls_api.c+1−2
@@ -1277,7 +1277,6 @@ EXPORT_SYMBOL(tcf_block_cb_unregister); · 1276 unmodified lines
12771277 int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
12781278 struct tcf_result *res, bool compat_mode)
12791279 {
1280− __be16 protocol = tc_skb_protocol(skb);
12811280 #ifdef CONFIG_NET_CLS_ACT
12821281 const int max_reclassify_loop = 4;
12831282 const struct tcf_proto *orig_tp = tp;
@@ -1287,6 +1286,7 @@ int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp, · 3 unmodified lines
12871286 reclassify:
12881287 #endif
12891288 for (; tp; tp = rcu_dereference_bh(tp->next)) {
1289+ __be16 protocol = tc_skb_protocol(skb);
12901290 int err;
12911291
12921292 if (tp->protocol != protocol &&
@@ -1319,7 +1319,6 @@ reset: · 26 unmodified lines
13191319 }
13201320
13211321 tp = first_tp;
1322− protocol = tc_skb_protocol(skb);
13231322 goto reclassify;
13241323 #endif
13251324 }
net/sched/cls_flower.c+14−5
@@ -1290,17 +1290,23 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, · 1289 unmodified lines
12901290 struct cls_fl_head *head = rtnl_dereference(tp->root);
12911291 struct cls_fl_filter *fold = *arg;
12921292 struct cls_fl_filter *fnew;
1293+ struct fl_flow_mask *mask;
12931294 struct nlattr **tb;
1294− struct fl_flow_mask mask = {};
12951295 int err;
12961296
12971297 if (!tca[TCA_OPTIONS])
12981298 return -EINVAL;
12991299
1300− tb = kcalloc(TCA_FLOWER_MAX + 1, sizeof(struct nlattr *), GFP_KERNEL);
1301− if (!tb)
1300+ mask = kzalloc(sizeof(struct fl_flow_mask), GFP_KERNEL);
1301+ if (!mask)
13021302 return -ENOBUFS;
13031303
1304+ tb = kcalloc(TCA_FLOWER_MAX + 1, sizeof(struct nlattr *), GFP_KERNEL);
1305+ if (!tb) {
1306+ err = -ENOBUFS;
1307+ goto errout_mask_alloc;
1308+ }
1309+
13041310 err = nla_parse_nested(tb, TCA_FLOWER_MAX, tca[TCA_OPTIONS],
13051311 fl_policy, NULL);
13061312 if (err < 0)
@@ -1343,12 +1349,12 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, · 36 unmodified lines
13431349 }
13441350 }
13451351
1346− err = fl_set_parms(net, tp, fnew, &mask, base, tb, tca[TCA_RATE], ovr,
1352+ err = fl_set_parms(net, tp, fnew, mask, base, tb, tca[TCA_RATE], ovr,
13471353 tp->chain->tmplt_priv, extack);
13481354 if (err)
13491355 goto errout_idr;
13501356
1351− err = fl_check_assign_mask(head, fnew, fold, &mask);
1357+ err = fl_check_assign_mask(head, fnew, fold, mask);
13521358 if (err)
13531359 goto errout_idr;
13541360
@@ -1392,6 +1398,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, · 37 unmodified lines
13921398 }
13931399
13941400 kfree(tb);
1401+ kfree(mask);
13951402 return 0;
13961403
13971404 errout_mask:
@@ -1405,6 +1412,8 @@ errout: · 7 unmodified lines
14051412 kfree(fnew);
14061413 errout_tb:
14071414 kfree(tb);
1415+errout_mask_alloc:
1416+ kfree(mask);
14081417 return err;
14091418 }
14101419
net/sched/sch_cake.c+3−2
@@ -1667,7 +1667,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 1666 unmodified lines
16671667 if (skb_is_gso(skb) && q->rate_flags & CAKE_FLAG_SPLIT_GSO) {
16681668 struct sk_buff *segs, *nskb;
16691669 netdev_features_t features = netif_skb_features(skb);
1670− unsigned int slen = 0;
1670+ unsigned int slen = 0, numsegs = 0;
16711671
16721672 segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);
16731673 if (IS_ERR_OR_NULL(segs))
@@ -1683,6 +1683,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 9 unmodified lines
16831683 flow_queue_add(flow, segs);
16841684
16851685 sch->q.qlen++;
1686+ numsegs++;
16861687 slen += segs->len;
16871688 q->buffer_used += segs->truesize;
16881689 b->packets++;
@@ -1696,7 +1697,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 7 unmodified lines
16961697 sch->qstats.backlog += slen;
16971698 q->avg_window_bytes += slen;
16981699
1699− qdisc_tree_reduce_backlog(sch, 1, len);
1700+ qdisc_tree_reduce_backlog(sch, 1-numsegs, len-slen);
17001701 consume_skb(skb);
17011702 } else {
17021703 /* not splitting */
net/sched/sch_cbs.c+2−1
@@ -88,13 +88,14 @@ static int cbs_child_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 87 unmodified lines
8888 struct Qdisc *child,
8989 struct sk_buff **to_free)
9090 {
91+ unsigned int len = qdisc_pkt_len(skb);
9192 int err;
9293
9394 err = child->ops->enqueue(skb, child, to_free);
9495 if (err != NET_XMIT_SUCCESS)
9596 return err;
9697
97− qdisc_qstats_backlog_inc(sch, skb);
98+ sch->qstats.backlog += len;
9899 sch->q.qlen++;
99100
100101 return NET_XMIT_SUCCESS;
net/sched/sch_drr.c+5−2
@@ -350,9 +350,11 @@ static struct drr_class *drr_classify(struct sk_buff *skb, struct Qdisc *sch, · 349 unmodified lines
350350 static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch,
351351 struct sk_buff **to_free)
352352 {
353+ unsigned int len = qdisc_pkt_len(skb);
353354 struct drr_sched *q = qdisc_priv(sch);
354355 struct drr_class *cl;
355356 int err = 0;
357+ bool first;
356358
357359 cl = drr_classify(skb, sch, &err);
358360 if (cl == NULL) {
@@ -362,6 +364,7 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 3 unmodified lines
362364 return err;
363365 }
364366
367+ first = !cl->qdisc->q.qlen;
365368 err = qdisc_enqueue(skb, cl->qdisc, to_free);
366369 if (unlikely(err != NET_XMIT_SUCCESS)) {
367370 if (net_xmit_drop_count(err)) {
@@ -371,12 +374,12 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 3 unmodified lines
371374 return err;
372375 }
373376
374− if (cl->qdisc->q.qlen == 1) {
377+ if (first) {
375378 list_add_tail(&cl->alist, &q->active);
376379 cl->deficit = cl->quantum;
377380 }
378381
379− qdisc_qstats_backlog_inc(sch, skb);
382+ sch->qstats.backlog += len;
380383 sch->q.qlen++;
381384 return err;
382385 }
net/sched/sch_dsmark.c+2−1
@@ -199,6 +199,7 @@ static struct tcf_block *dsmark_tcf_block(struct Qdisc *sch, unsigned long cl, · 198 unmodified lines
199199 static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch,
200200 struct sk_buff **to_free)
201201 {
202+ unsigned int len = qdisc_pkt_len(skb);
202203 struct dsmark_qdisc_data *p = qdisc_priv(sch);
203204 int err;
204205
@@ -271,7 +272,7 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 66 unmodified lines
271272 return err;
272273 }
273274
274− qdisc_qstats_backlog_inc(sch, skb);
275+ sch->qstats.backlog += len;
275276 sch->q.qlen++;
276277
277278 return NET_XMIT_SUCCESS;
net/sched/sch_hfsc.c+5−4
@@ -1539,8 +1539,10 @@ hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb) · 1538 unmodified lines
15391539 static int
15401540 hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)
15411541 {
1542+ unsigned int len = qdisc_pkt_len(skb);
15421543 struct hfsc_class *cl;
15431544 int uninitialized_var(err);
1545+ bool first;
15441546
15451547 cl = hfsc_classify(skb, sch, &err);
15461548 if (cl == NULL) {
@@ -1550,6 +1552,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) · 3 unmodified lines
15501552 return err;
15511553 }
15521554
1555+ first = !cl->qdisc->q.qlen;
15531556 err = qdisc_enqueue(skb, cl->qdisc, to_free);
15541557 if (unlikely(err != NET_XMIT_SUCCESS)) {
15551558 if (net_xmit_drop_count(err)) {
@@ -1559,9 +1562,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) · 3 unmodified lines
15591562 return err;
15601563 }
15611564
1562− if (cl->qdisc->q.qlen == 1) {
1563− unsigned int len = qdisc_pkt_len(skb);
1564−
1565+ if (first) {
15651566 if (cl->cl_flags & HFSC_RSC)
15661567 init_ed(cl, len);
15671568 if (cl->cl_flags & HFSC_FSC)
@@ -1576,7 +1577,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) · 8 unmodified lines
15761577
15771578 }
15781579
1579− qdisc_qstats_backlog_inc(sch, skb);
1580+ sch->qstats.backlog += len;
15801581 sch->q.qlen++;
15811582
15821583 return NET_XMIT_SUCCESS;
net/sched/sch_htb.c+2−1
@@ -581,6 +581,7 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 580 unmodified lines
581581 struct sk_buff **to_free)
582582 {
583583 int uninitialized_var(ret);
584+ unsigned int len = qdisc_pkt_len(skb);
584585 struct htb_sched *q = qdisc_priv(sch);
585586 struct htb_class *cl = htb_classify(skb, sch, &ret);
586587
@@ -610,7 +611,7 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 23 unmodified lines
610611 htb_activate(q, cl);
611612 }
612613
613− qdisc_qstats_backlog_inc(sch, skb);
614+ sch->qstats.backlog += len;
614615 sch->q.qlen++;
615616 return NET_XMIT_SUCCESS;
616617 }
net/sched/sch_prio.c+2−1
@@ -72,6 +72,7 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) · 71 unmodified lines
7272 static int
7373 prio_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)
7474 {
75+ unsigned int len = qdisc_pkt_len(skb);
7576 struct Qdisc *qdisc;
7677 int ret;
7778
@@ -88,7 +89,7 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) · 10 unmodified lines
8889
8990 ret = qdisc_enqueue(skb, qdisc, to_free);
9091 if (ret == NET_XMIT_SUCCESS) {
91− qdisc_qstats_backlog_inc(sch, skb);
92+ sch->qstats.backlog += len;
9293 sch->q.qlen++;
9394 return NET_XMIT_SUCCESS;
9495 }
net/sched/sch_qfq.c+12−8
@@ -1210,10 +1210,12 @@ static struct qfq_aggregate *qfq_choose_next_agg(struct qfq_sched *q) · 1209 unmodified lines
12101210 static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch,
12111211 struct sk_buff **to_free)
12121212 {
1213+ unsigned int len = qdisc_pkt_len(skb), gso_segs;
12131214 struct qfq_sched *q = qdisc_priv(sch);
12141215 struct qfq_class *cl;
12151216 struct qfq_aggregate *agg;
12161217 int err = 0;
1218+ bool first;
12171219
12181220 cl = qfq_classify(skb, sch, &err);
12191221 if (cl == NULL) {
@@ -1224,17 +1226,18 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 4 unmodified lines
12241226 }
12251227 pr_debug("qfq_enqueue: cl = %x\n", cl->common.classid);
12261228
1227− if (unlikely(cl->agg->lmax < qdisc_pkt_len(skb))) {
1229+ if (unlikely(cl->agg->lmax < len)) {
12281230 pr_debug("qfq: increasing maxpkt from %u to %u for class %u",
1229− cl->agg->lmax, qdisc_pkt_len(skb), cl->common.classid);
1230− err = qfq_change_agg(sch, cl, cl->agg->class_weight,
1231− qdisc_pkt_len(skb));
1231+ cl->agg->lmax, len, cl->common.classid);
1232+ err = qfq_change_agg(sch, cl, cl->agg->class_weight, len);
12321233 if (err) {
12331234 cl->qstats.drops++;
12341235 return qdisc_drop(skb, sch, to_free);
12351236 }
12361237 }
12371238
1239+ gso_segs = skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1;
1240+ first = !cl->qdisc->q.qlen;
12381241 err = qdisc_enqueue(skb, cl->qdisc, to_free);
12391242 if (unlikely(err != NET_XMIT_SUCCESS)) {
12401243 pr_debug("qfq_enqueue: enqueue failed %d\n", err);
@@ -1245,16 +1248,17 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 4 unmodified lines
12451248 return err;
12461249 }
12471250
1248− bstats_update(&cl->bstats, skb);
1249− qdisc_qstats_backlog_inc(sch, skb);
1251+ cl->bstats.bytes += len;
1252+ cl->bstats.packets += gso_segs;
1253+ sch->qstats.backlog += len;
12501254 ++sch->q.qlen;
12511255
12521256 agg = cl->agg;
12531257 /* if the queue was not empty, then done here */
1254− if (cl->qdisc->q.qlen != 1) {
1258+ if (!first) {
12551259 if (unlikely(skb == cl->qdisc->ops->peek(cl->qdisc)) &&
12561260 list_first_entry(&agg->active, struct qfq_class, alist)
1257− == cl && cl->deficit < qdisc_pkt_len(skb))
1261+ == cl && cl->deficit < len)
12581262 list_move_tail(&cl->alist, &agg->active);
12591263
12601264 return err;
net/sched/sch_tbf.c+2−1
@@ -185,6 +185,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 184 unmodified lines
185185 struct sk_buff **to_free)
186186 {
187187 struct tbf_sched_data *q = qdisc_priv(sch);
188+ unsigned int len = qdisc_pkt_len(skb);
188189 int ret;
189190
190191 if (qdisc_pkt_len(skb) > q->max_size) {
@@ -200,7 +201,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 9 unmodified lines
200201 return ret;
201202 }
202203
203− qdisc_qstats_backlog_inc(sch, skb);
204+ sch->qstats.backlog += len;
204205 sch->q.qlen++;
205206 return NET_XMIT_SUCCESS;
206207 }
net/sctp/ipv6.c+1−4
@@ -97,11 +97,9 @@ static int sctp_inet6addr_event(struct notifier_block *this, unsigned long ev, · 96 unmodified lines
9797
9898 switch (ev) {
9999 case NETDEV_UP:
100− addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC);
100+ addr = kzalloc(sizeof(*addr), GFP_ATOMIC);
101101 if (addr) {
102102 addr->a.v6.sin6_family = AF_INET6;
103− addr->a.v6.sin6_port = 0;
104− addr->a.v6.sin6_flowinfo = 0;
105103 addr->a.v6.sin6_addr = ifa->addr;
106104 addr->a.v6.sin6_scope_id = ifa->idev->dev->ifindex;
107105 addr->valid = 1;
@@ -434,7 +432,6 @@ static void sctp_v6_copy_addrlist(struct list_head *addrlist, · 326 unmodified lines
434432 addr = kzalloc(sizeof(*addr), GFP_ATOMIC);
435433 if (addr) {
436434 addr->a.v6.sin6_family = AF_INET6;
437− addr->a.v6.sin6_port = 0;
438435 addr->a.v6.sin6_addr = ifp->addr;
439436 addr->a.v6.sin6_scope_id = dev->ifindex;
440437 addr->valid = 1;
net/sctp/protocol.c+1−3
@@ -101,7 +101,6 @@ static void sctp_v4_copy_addrlist(struct list_head *addrlist, · 100 unmodified lines
101101 addr = kzalloc(sizeof(*addr), GFP_ATOMIC);
102102 if (addr) {
103103 addr->a.v4.sin_family = AF_INET;
104− addr->a.v4.sin_port = 0;
105104 addr->a.v4.sin_addr.s_addr = ifa->ifa_local;
106105 addr->valid = 1;
107106 INIT_LIST_HEAD(&addr->list);
@@ -776,10 +775,9 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev, · 668 unmodified lines
776775
777776 switch (ev) {
778777 case NETDEV_UP:
779− addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC);
778+ addr = kzalloc(sizeof(*addr), GFP_ATOMIC);
780779 if (addr) {
781780 addr->a.v4.sin_family = AF_INET;
782− addr->a.v4.sin_port = 0;
783781 addr->a.v4.sin_addr.s_addr = ifa->ifa_local;
784782 addr->valid = 1;
785783 spin_lock_bh(&net->sctp.local_addr_lock);
net/tipc/netlink_compat.c+49−1
@@ -87,6 +87,11 @@ static int tipc_skb_tailroom(struct sk_buff *skb) · 86 unmodified lines
8787 return limit;
8888 }
8989
90+static inline int TLV_GET_DATA_LEN(struct tlv_desc *tlv)
91+{
92+ return TLV_GET_LEN(tlv) - TLV_SPACE(0);
93+}
94+
9095 static int tipc_add_tlv(struct sk_buff *skb, u16 type, void *data, u16 len)
9196 {
9297 struct tlv_desc *tlv = (struct tlv_desc *)skb_tail_pointer(skb);
@@ -166,6 +171,11 @@ static struct sk_buff *tipc_get_err_tlv(char *str) · 73 unmodified lines
166171 return buf;
167172 }
168173
174+static inline bool string_is_valid(char *s, int len)
175+{
176+ return memchr(s, '\0', len) ? true : false;
177+}
178+
169179 static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
170180 struct tipc_nl_compat_msg *msg,
171181 struct sk_buff *arg)
@@ -379,6 +389,7 @@ static int tipc_nl_compat_bearer_enable(struct tipc_nl_compat_cmd_doit *cmd, · 207 unmodified lines
379389 struct nlattr *prop;
380390 struct nlattr *bearer;
381391 struct tipc_bearer_config *b;
392+ int len;
382393
383394 b = (struct tipc_bearer_config *)TLV_DATA(msg->req);
384395
@@ -386,6 +397,10 @@ static int tipc_nl_compat_bearer_enable(struct tipc_nl_compat_cmd_doit *cmd, · 1 unmodified line
386397 if (!bearer)
387398 return -EMSGSIZE;
388399
400+ len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_BEARER_NAME);
401+ if (!string_is_valid(b->name, len))
402+ return -EINVAL;
403+
389404 if (nla_put_string(skb, TIPC_NLA_BEARER_NAME, b->name))
390405 return -EMSGSIZE;
391406
@@ -411,6 +426,7 @@ static int tipc_nl_compat_bearer_disable(struct tipc_nl_compat_cmd_doit *cmd, · 19 unmodified lines
411426 {
412427 char *name;
413428 struct nlattr *bearer;
429+ int len;
414430
415431 name = (char *)TLV_DATA(msg->req);
416432
@@ -418,6 +434,10 @@ static int tipc_nl_compat_bearer_disable(struct tipc_nl_compat_cmd_doit *cmd, · 1 unmodified line
418434 if (!bearer)
419435 return -EMSGSIZE;
420436
437+ len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_BEARER_NAME);
438+ if (!string_is_valid(name, len))
439+ return -EINVAL;
440+
421441 if (nla_put_string(skb, TIPC_NLA_BEARER_NAME, name))
422442 return -EMSGSIZE;
423443
@@ -478,6 +498,7 @@ static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg, · 54 unmodified lines
478498 struct nlattr *prop[TIPC_NLA_PROP_MAX + 1];
479499 struct nlattr *stats[TIPC_NLA_STATS_MAX + 1];
480500 int err;
501+ int len;
481502
482503 if (!attrs[TIPC_NLA_LINK])
483504 return -EINVAL;
@@ -504,6 +525,11 @@ static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg, · 20 unmodified lines
504525 return err;
505526
506527 name = (char *)TLV_DATA(msg->req);
528+
529+ len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_LINK_NAME);
530+ if (!string_is_valid(name, len))
531+ return -EINVAL;
532+
507533 if (strcmp(name, nla_data(link[TIPC_NLA_LINK_NAME])) != 0)
508534 return 0;
509535
@@ -644,6 +670,7 @@ static int tipc_nl_compat_media_set(struct sk_buff *skb, · 134 unmodified lines
644670 struct nlattr *prop;
645671 struct nlattr *media;
646672 struct tipc_link_config *lc;
673+ int len;
647674
648675 lc = (struct tipc_link_config *)TLV_DATA(msg->req);
649676
@@ -651,6 +678,10 @@ static int tipc_nl_compat_media_set(struct sk_buff *skb, · 1 unmodified line
651678 if (!media)
652679 return -EMSGSIZE;
653680
681+ len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_MEDIA_NAME);
682+ if (!string_is_valid(lc->name, len))
683+ return -EINVAL;
684+
654685 if (nla_put_string(skb, TIPC_NLA_MEDIA_NAME, lc->name))
655686 return -EMSGSIZE;
656687
@@ -671,6 +702,7 @@ static int tipc_nl_compat_bearer_set(struct sk_buff *skb, · 14 unmodified lines
671702 struct nlattr *prop;
672703 struct nlattr *bearer;
673704 struct tipc_link_config *lc;
705+ int len;
674706
675707 lc = (struct tipc_link_config *)TLV_DATA(msg->req);
676708
@@ -678,6 +710,10 @@ static int tipc_nl_compat_bearer_set(struct sk_buff *skb, · 1 unmodified line
678710 if (!bearer)
679711 return -EMSGSIZE;
680712
713+ len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_MEDIA_NAME);
714+ if (!string_is_valid(lc->name, len))
715+ return -EINVAL;
716+
681717 if (nla_put_string(skb, TIPC_NLA_BEARER_NAME, lc->name))
682718 return -EMSGSIZE;
683719
@@ -726,9 +762,14 @@ static int tipc_nl_compat_link_set(struct tipc_nl_compat_cmd_doit *cmd, · 42 unmodified lines
726762 struct tipc_link_config *lc;
727763 struct tipc_bearer *bearer;
728764 struct tipc_media *media;
765+ int len;
729766
730767 lc = (struct tipc_link_config *)TLV_DATA(msg->req);
731768
769+ len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_LINK_NAME);
770+ if (!string_is_valid(lc->name, len))
771+ return -EINVAL;
772+
732773 media = tipc_media_find(lc->name);
733774 if (media) {
734775 cmd->doit = &__tipc_nl_media_set;
@@ -750,6 +791,7 @@ static int tipc_nl_compat_link_reset_stats(struct tipc_nl_compat_cmd_doit *cmd, · 15 unmodified lines
750791 {
751792 char *name;
752793 struct nlattr *link;
794+ int len;
753795
754796 name = (char *)TLV_DATA(msg->req);
755797
@@ -757,6 +799,10 @@ static int tipc_nl_compat_link_reset_stats(struct tipc_nl_compat_cmd_doit *cmd, · 1 unmodified line
757799 if (!link)
758800 return -EMSGSIZE;
759801
802+ len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_LINK_NAME);
803+ if (!string_is_valid(name, len))
804+ return -EINVAL;
805+
760806 if (nla_put_string(skb, TIPC_NLA_LINK_NAME, name))
761807 return -EMSGSIZE;
762808
@@ -778,6 +824,8 @@ static int tipc_nl_compat_name_table_dump_header(struct tipc_nl_compat_msg *msg) · 15 unmodified lines
778824 };
779825
780826 ntq = (struct tipc_name_table_query *)TLV_DATA(msg->req);
827+ if (TLV_GET_DATA_LEN(msg->req) < sizeof(struct tipc_name_table_query))
828+ return -EINVAL;
781829
782830 depth = ntohl(ntq->depth);
783831
@@ -1208,7 +1256,7 @@ static int tipc_nl_compat_recv(struct sk_buff *skb, struct genl_info *info) · 424 unmodified lines
12081256 }
12091257
12101258 len = nlmsg_attrlen(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN);
1211− if (len && !TLV_OK(msg.req, len)) {
1259+ if (!len || !TLV_OK(msg.req, len)) {
12121260 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_SUPPORTED);
12131261 err = -EOPNOTSUPP;
12141262 goto send;
net/tipc/topsrv.c+1−1
@@ -398,7 +398,7 @@ static int tipc_conn_rcv_from_sock(struct tipc_conn *con) · 397 unmodified lines
398398 ret = sock_recvmsg(con->sock, &msg, MSG_DONTWAIT);
399399 if (ret == -EWOULDBLOCK)
400400 return -EWOULDBLOCK;
401− if (ret > 0) {
401+ if (ret == sizeof(s)) {
402402 read_lock_bh(&sk->sk_callback_lock);
403403 ret = tipc_conn_rcv_sub(srv, con, &s);
404404 read_unlock_bh(&sk->sk_callback_lock);
net/xdp/xdp_umem.c+13−3
@@ -41,13 +41,20 @@ void xdp_del_sk_umem(struct xdp_umem *umem, struct xdp_sock *xs) · 40 unmodified lines
4141 * not know if the device has more tx queues than rx, or the opposite.
4242 * This might also change during run time.
4343 */
44−static void xdp_reg_umem_at_qid(struct net_device *dev, struct xdp_umem *umem,
45− u16 queue_id)
44+static int xdp_reg_umem_at_qid(struct net_device *dev, struct xdp_umem *umem,
45+ u16 queue_id)
4646 {
47+ if (queue_id >= max_t(unsigned int,
48+ dev->real_num_rx_queues,
49+ dev->real_num_tx_queues))
50+ return -EINVAL;
51+
4752 if (queue_id < dev->real_num_rx_queues)
4853 dev->_rx[queue_id].umem = umem;
4954 if (queue_id < dev->real_num_tx_queues)
5055 dev->_tx[queue_id].umem = umem;
56+
57+ return 0;
5158 }
5259
5360 struct xdp_umem *xdp_get_umem_from_qid(struct net_device *dev,
@@ -88,7 +95,10 @@ int xdp_umem_assign_dev(struct xdp_umem *umem, struct net_device *dev, · 34 unmodified lines
8895 goto out_rtnl_unlock;
8996 }
9097
91− xdp_reg_umem_at_qid(dev, umem, queue_id);
98+ err = xdp_reg_umem_at_qid(dev, umem, queue_id);
99+ if (err)
100+ goto out_rtnl_unlock;
101+
92102 umem->dev = dev;
93103 umem->queue_id = queue_id;
94104 if (force_copy)
samples/bpf/Makefile+1−0
@@ -279,6 +279,7 @@ $(obj)/%.o: $(src)/%.c · 278 unmodified lines
279279 -Wno-gnu-variable-sized-type-not-at-end \
280280 -Wno-address-of-packed-member -Wno-tautological-compare \
281281 -Wno-unknown-warning-option $(CLANG_ARCH_ARGS) \
282+ -I$(srctree)/samples/bpf/ -include asm_goto_workaround.h \
282283 -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf $(LLC_FLAGS) -filetype=obj -o $@
283284 ifeq ($(DWARF2BTF),y)
284285 $(BTF_PAHOLE) -J $@
samples/bpf/asm_goto_workaround.h+16−0
@@ -0,0 +1,16 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/* Copyright (c) 2019 Facebook */
3+#ifndef __ASM_GOTO_WORKAROUND_H
4+#define __ASM_GOTO_WORKAROUND_H
5+
6+/* this will bring in asm_volatile_goto macro definition
7+ * if enabled by compiler and config options.
8+ */
9+#include <linux/types.h>
10+
11+#ifdef asm_volatile_goto
12+#undef asm_volatile_goto
13+#define asm_volatile_goto(x...) asm volatile("invalid use of asm_volatile_goto")
14+#endif
15+
16+#endif
tools/bpf/bpftool/Makefile+8−1
@@ -93,9 +93,16 @@ BFD_SRCS = jit_disasm.c · 92 unmodified lines
9393 SRCS = $(filter-out $(BFD_SRCS),$(wildcard *.c))
9494
9595 ifeq ($(feature-libbfd),1)
96+ LIBS += -lbfd -ldl -lopcodes
97+else ifeq ($(feature-libbfd-liberty),1)
98+ LIBS += -lbfd -ldl -lopcodes -liberty
99+else ifeq ($(feature-libbfd-liberty-z),1)
100+ LIBS += -lbfd -ldl -lopcodes -liberty -lz
101+endif
102+
103+ifneq ($(filter -lbfd,$(LIBS)),)
96104 CFLAGS += -DHAVE_LIBBFD_SUPPORT
97105 SRCS += $(BFD_SRCS)
98−LIBS += -lbfd -lopcodes
99106 endif
100107
101108 OBJS = $(patsubst %.c,$(OUTPUT)%.o,$(SRCS)) $(OUTPUT)disasm.o
tools/bpf/bpftool/json_writer.c+1−6
@@ -1,15 +1,10 @@
1−// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
1+// SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause)
22 /*
33 * Simple streaming JSON writer
44 *
55 * This takes care of the annoying bits of JSON syntax like the commas
66 * after elements
77 *
8− * This program is free software; you can redistribute it and/or
9− * modify it under the terms of the GNU General Public License
10− * as published by the Free Software Foundation; either version
11− * 2 of the License, or (at your option) any later version.
12− *
138 * Authors: Stephen Hemminger <stephen@networkplumber.org>
149 */
1510
tools/bpf/bpftool/json_writer.h+0−5
@@ -5,11 +5,6 @@ · 4 unmodified lines
55 * This takes care of the annoying bits of JSON syntax like the commas
66 * after elements
77 *
8− * This program is free software; you can redistribute it and/or
9− * modify it under the terms of the GNU General Public License
10− * as published by the Free Software Foundation; either version
11− * 2 of the License, or (at your option) any later version.
12− *
138 * Authors: Stephen Hemminger <stephen@networkplumber.org>
149 */
1510
tools/include/uapi/linux/pkt_sched.h+1163−0
@@ -0,0 +1,1163 @@
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+#ifndef __LINUX_PKT_SCHED_H
3+#define __LINUX_PKT_SCHED_H
4+
5+#include <linux/types.h>
6+
7+/* Logical priority bands not depending on specific packet scheduler.
8+ Every scheduler will map them to real traffic classes, if it has
9+ no more precise mechanism to classify packets.
10+
11+ These numbers have no special meaning, though their coincidence
12+ with obsolete IPv6 values is not occasional :-). New IPv6 drafts
13+ preferred full anarchy inspired by diffserv group.
14+
15+ Note: TC_PRIO_BESTEFFORT does not mean that it is the most unhappy
16+ class, actually, as rule it will be handled with more care than
17+ filler or even bulk.
18+ */
19+
20+#define TC_PRIO_BESTEFFORT 0
21+#define TC_PRIO_FILLER 1
22+#define TC_PRIO_BULK 2
23+#define TC_PRIO_INTERACTIVE_BULK 4
24+#define TC_PRIO_INTERACTIVE 6
25+#define TC_PRIO_CONTROL 7
26+
27+#define TC_PRIO_MAX 15
28+
29+/* Generic queue statistics, available for all the elements.
30+ Particular schedulers may have also their private records.
31+ */
32+
33+struct tc_stats {
34+ __u64 bytes; /* Number of enqueued bytes */
35+ __u32 packets; /* Number of enqueued packets */
36+ __u32 drops; /* Packets dropped because of lack of resources */
37+ __u32 overlimits; /* Number of throttle events when this
38+ * flow goes out of allocated bandwidth */
39+ __u32 bps; /* Current flow byte rate */
40+ __u32 pps; /* Current flow packet rate */
41+ __u32 qlen;
42+ __u32 backlog;
43+};
44+
45+struct tc_estimator {
46+ signed char interval;
47+ unsigned char ewma_log;
48+};
49+
50+/* "Handles"
51+ ---------
52+
53+ All the traffic control objects have 32bit identifiers, or "handles".
54+
55+ They can be considered as opaque numbers from user API viewpoint,
56+ but actually they always consist of two fields: major and
57+ minor numbers, which are interpreted by kernel specially,
58+ that may be used by applications, though not recommended.
59+
60+ F.e. qdisc handles always have minor number equal to zero,
61+ classes (or flows) have major equal to parent qdisc major, and
62+ minor uniquely identifying class inside qdisc.
63+
64+ Macros to manipulate handles:
65+ */
66+
67+#define TC_H_MAJ_MASK (0xFFFF0000U)
68+#define TC_H_MIN_MASK (0x0000FFFFU)
69+#define TC_H_MAJ(h) ((h)&TC_H_MAJ_MASK)
70+#define TC_H_MIN(h) ((h)&TC_H_MIN_MASK)
71+#define TC_H_MAKE(maj,min) (((maj)&TC_H_MAJ_MASK)|((min)&TC_H_MIN_MASK))
72+
73+#define TC_H_UNSPEC (0U)
74+#define TC_H_ROOT (0xFFFFFFFFU)
75+#define TC_H_INGRESS (0xFFFFFFF1U)
76+#define TC_H_CLSACT TC_H_INGRESS
77+
78+#define TC_H_MIN_PRIORITY 0xFFE0U
79+#define TC_H_MIN_INGRESS 0xFFF2U
80+#define TC_H_MIN_EGRESS 0xFFF3U
81+
82+/* Need to corrospond to iproute2 tc/tc_core.h "enum link_layer" */
83+enum tc_link_layer {
84+ TC_LINKLAYER_UNAWARE, /* Indicate unaware old iproute2 util */
85+ TC_LINKLAYER_ETHERNET,
86+ TC_LINKLAYER_ATM,
87+};
88+#define TC_LINKLAYER_MASK 0x0F /* limit use to lower 4 bits */
89+
90+struct tc_ratespec {
91+ unsigned char cell_log;
92+ __u8 linklayer; /* lower 4 bits */
93+ unsigned short overhead;
94+ short cell_align;
95+ unsigned short mpu;
96+ __u32 rate;
97+};
98+
99+#define TC_RTAB_SIZE 1024
100+
101+struct tc_sizespec {
102+ unsigned char cell_log;
103+ unsigned char size_log;
104+ short cell_align;
105+ int overhead;
106+ unsigned int linklayer;
107+ unsigned int mpu;
108+ unsigned int mtu;
109+ unsigned int tsize;
110+};
111+
112+enum {
113+ TCA_STAB_UNSPEC,
114+ TCA_STAB_BASE,
115+ TCA_STAB_DATA,
116+ __TCA_STAB_MAX
117+};
118+
119+#define TCA_STAB_MAX (__TCA_STAB_MAX - 1)
120+
121+/* FIFO section */
122+
123+struct tc_fifo_qopt {
124+ __u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */
125+};
126+
127+/* SKBPRIO section */
128+
129+/*
130+ * Priorities go from zero to (SKBPRIO_MAX_PRIORITY - 1).
131+ * SKBPRIO_MAX_PRIORITY should be at least 64 in order for skbprio to be able
132+ * to map one to one the DS field of IPV4 and IPV6 headers.
133+ * Memory allocation grows linearly with SKBPRIO_MAX_PRIORITY.
134+ */
135+
136+#define SKBPRIO_MAX_PRIORITY 64
137+
138+struct tc_skbprio_qopt {
139+ __u32 limit; /* Queue length in packets. */
140+};
141+
142+/* PRIO section */
143+
144+#define TCQ_PRIO_BANDS 16
145+#define TCQ_MIN_PRIO_BANDS 2
146+
147+struct tc_prio_qopt {
148+ int bands; /* Number of bands */
149+ __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */
150+};
151+
152+/* MULTIQ section */
153+
154+struct tc_multiq_qopt {
155+ __u16 bands; /* Number of bands */
156+ __u16 max_bands; /* Maximum number of queues */
157+};
158+
159+/* PLUG section */
160+
161+#define TCQ_PLUG_BUFFER 0
162+#define TCQ_PLUG_RELEASE_ONE 1
163+#define TCQ_PLUG_RELEASE_INDEFINITE 2
164+#define TCQ_PLUG_LIMIT 3
165+
166+struct tc_plug_qopt {
167+ /* TCQ_PLUG_BUFFER: Inset a plug into the queue and
168+ * buffer any incoming packets
169+ * TCQ_PLUG_RELEASE_ONE: Dequeue packets from queue head
170+ * to beginning of the next plug.
171+ * TCQ_PLUG_RELEASE_INDEFINITE: Dequeue all packets from queue.
172+ * Stop buffering packets until the next TCQ_PLUG_BUFFER
173+ * command is received (just act as a pass-thru queue).
174+ * TCQ_PLUG_LIMIT: Increase/decrease queue size
175+ */
176+ int action;
177+ __u32 limit;
178+};
179+
180+/* TBF section */
181+
182+struct tc_tbf_qopt {
183+ struct tc_ratespec rate;
184+ struct tc_ratespec peakrate;
185+ __u32 limit;
186+ __u32 buffer;
187+ __u32 mtu;
188+};
189+
190+enum {
191+ TCA_TBF_UNSPEC,
192+ TCA_TBF_PARMS,
193+ TCA_TBF_RTAB,
194+ TCA_TBF_PTAB,
195+ TCA_TBF_RATE64,
196+ TCA_TBF_PRATE64,
197+ TCA_TBF_BURST,
198+ TCA_TBF_PBURST,
199+ TCA_TBF_PAD,
200+ __TCA_TBF_MAX,
201+};
202+
203+#define TCA_TBF_MAX (__TCA_TBF_MAX - 1)
204+
205+
206+/* TEQL section */
207+
208+/* TEQL does not require any parameters */
209+
210+/* SFQ section */
211+
212+struct tc_sfq_qopt {
213+ unsigned quantum; /* Bytes per round allocated to flow */
214+ int perturb_period; /* Period of hash perturbation */
215+ __u32 limit; /* Maximal packets in queue */
216+ unsigned divisor; /* Hash divisor */
217+ unsigned flows; /* Maximal number of flows */
218+};
219+
220+struct tc_sfqred_stats {
221+ __u32 prob_drop; /* Early drops, below max threshold */
222+ __u32 forced_drop; /* Early drops, after max threshold */
223+ __u32 prob_mark; /* Marked packets, below max threshold */
224+ __u32 forced_mark; /* Marked packets, after max threshold */
225+ __u32 prob_mark_head; /* Marked packets, below max threshold */
226+ __u32 forced_mark_head;/* Marked packets, after max threshold */
227+};
228+
229+struct tc_sfq_qopt_v1 {
230+ struct tc_sfq_qopt v0;
231+ unsigned int depth; /* max number of packets per flow */
232+ unsigned int headdrop;
233+/* SFQRED parameters */
234+ __u32 limit; /* HARD maximal flow queue length (bytes) */
235+ __u32 qth_min; /* Min average length threshold (bytes) */
236+ __u32 qth_max; /* Max average length threshold (bytes) */
237+ unsigned char Wlog; /* log(W) */
238+ unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
239+ unsigned char Scell_log; /* cell size for idle damping */
240+ unsigned char flags;
241+ __u32 max_P; /* probability, high resolution */
242+/* SFQRED stats */
243+ struct tc_sfqred_stats stats;
244+};
245+
246+
247+struct tc_sfq_xstats {
248+ __s32 allot;
249+};
250+
251+/* RED section */
252+
253+enum {
254+ TCA_RED_UNSPEC,
255+ TCA_RED_PARMS,
256+ TCA_RED_STAB,
257+ TCA_RED_MAX_P,
258+ __TCA_RED_MAX,
259+};
260+
261+#define TCA_RED_MAX (__TCA_RED_MAX - 1)
262+
263+struct tc_red_qopt {
264+ __u32 limit; /* HARD maximal queue length (bytes) */
265+ __u32 qth_min; /* Min average length threshold (bytes) */
266+ __u32 qth_max; /* Max average length threshold (bytes) */
267+ unsigned char Wlog; /* log(W) */
268+ unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
269+ unsigned char Scell_log; /* cell size for idle damping */
270+ unsigned char flags;
271+#define TC_RED_ECN 1
272+#define TC_RED_HARDDROP 2
273+#define TC_RED_ADAPTATIVE 4
274+};
275+
276+struct tc_red_xstats {
277+ __u32 early; /* Early drops */
278+ __u32 pdrop; /* Drops due to queue limits */
279+ __u32 other; /* Drops due to drop() calls */
280+ __u32 marked; /* Marked packets */
281+};
282+
283+/* GRED section */
284+
285+#define MAX_DPs 16
286+
287+enum {
288+ TCA_GRED_UNSPEC,
289+ TCA_GRED_PARMS,
290+ TCA_GRED_STAB,
291+ TCA_GRED_DPS,
292+ TCA_GRED_MAX_P,
293+ TCA_GRED_LIMIT,
294+ TCA_GRED_VQ_LIST, /* nested TCA_GRED_VQ_ENTRY */
295+ __TCA_GRED_MAX,
296+};
297+
298+#define TCA_GRED_MAX (__TCA_GRED_MAX - 1)
299+
300+enum {
301+ TCA_GRED_VQ_ENTRY_UNSPEC,
302+ TCA_GRED_VQ_ENTRY, /* nested TCA_GRED_VQ_* */
303+ __TCA_GRED_VQ_ENTRY_MAX,
304+};
305+#define TCA_GRED_VQ_ENTRY_MAX (__TCA_GRED_VQ_ENTRY_MAX - 1)
306+
307+enum {
308+ TCA_GRED_VQ_UNSPEC,
309+ TCA_GRED_VQ_PAD,
310+ TCA_GRED_VQ_DP, /* u32 */
311+ TCA_GRED_VQ_STAT_BYTES, /* u64 */
312+ TCA_GRED_VQ_STAT_PACKETS, /* u32 */
313+ TCA_GRED_VQ_STAT_BACKLOG, /* u32 */
314+ TCA_GRED_VQ_STAT_PROB_DROP, /* u32 */
315+ TCA_GRED_VQ_STAT_PROB_MARK, /* u32 */
316+ TCA_GRED_VQ_STAT_FORCED_DROP, /* u32 */
317+ TCA_GRED_VQ_STAT_FORCED_MARK, /* u32 */
318+ TCA_GRED_VQ_STAT_PDROP, /* u32 */
319+ TCA_GRED_VQ_STAT_OTHER, /* u32 */
320+ TCA_GRED_VQ_FLAGS, /* u32 */
321+ __TCA_GRED_VQ_MAX
322+};
323+
324+#define TCA_GRED_VQ_MAX (__TCA_GRED_VQ_MAX - 1)
325+
326+struct tc_gred_qopt {
327+ __u32 limit; /* HARD maximal queue length (bytes) */
328+ __u32 qth_min; /* Min average length threshold (bytes) */
329+ __u32 qth_max; /* Max average length threshold (bytes) */
330+ __u32 DP; /* up to 2^32 DPs */
331+ __u32 backlog;
332+ __u32 qave;
333+ __u32 forced;
334+ __u32 early;
335+ __u32 other;
336+ __u32 pdrop;
337+ __u8 Wlog; /* log(W) */
338+ __u8 Plog; /* log(P_max/(qth_max-qth_min)) */
339+ __u8 Scell_log; /* cell size for idle damping */
340+ __u8 prio; /* prio of this VQ */
341+ __u32 packets;
342+ __u32 bytesin;
343+};
344+
345+/* gred setup */
346+struct tc_gred_sopt {
347+ __u32 DPs;
348+ __u32 def_DP;
349+ __u8 grio;
350+ __u8 flags;
351+ __u16 pad1;
352+};
353+
354+/* CHOKe section */
355+
356+enum {
357+ TCA_CHOKE_UNSPEC,
358+ TCA_CHOKE_PARMS,
359+ TCA_CHOKE_STAB,
360+ TCA_CHOKE_MAX_P,
361+ __TCA_CHOKE_MAX,
362+};
363+
364+#define TCA_CHOKE_MAX (__TCA_CHOKE_MAX - 1)
365+
366+struct tc_choke_qopt {
367+ __u32 limit; /* Hard queue length (packets) */
368+ __u32 qth_min; /* Min average threshold (packets) */
369+ __u32 qth_max; /* Max average threshold (packets) */
370+ unsigned char Wlog; /* log(W) */
371+ unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
372+ unsigned char Scell_log; /* cell size for idle damping */
373+ unsigned char flags; /* see RED flags */
374+};
375+
376+struct tc_choke_xstats {
377+ __u32 early; /* Early drops */
378+ __u32 pdrop; /* Drops due to queue limits */
379+ __u32 other; /* Drops due to drop() calls */
380+ __u32 marked; /* Marked packets */
381+ __u32 matched; /* Drops due to flow match */
382+};
383+
384+/* HTB section */
385+#define TC_HTB_NUMPRIO 8
386+#define TC_HTB_MAXDEPTH 8
387+#define TC_HTB_PROTOVER 3 /* the same as HTB and TC's major */
388+
389+struct tc_htb_opt {
390+ struct tc_ratespec rate;
391+ struct tc_ratespec ceil;
392+ __u32 buffer;
393+ __u32 cbuffer;
394+ __u32 quantum;
395+ __u32 level; /* out only */
396+ __u32 prio;
397+};
398+struct tc_htb_glob {
399+ __u32 version; /* to match HTB/TC */
400+ __u32 rate2quantum; /* bps->quantum divisor */
401+ __u32 defcls; /* default class number */
402+ __u32 debug; /* debug flags */
403+
404+ /* stats */
405+ __u32 direct_pkts; /* count of non shaped packets */
406+};
407+enum {
408+ TCA_HTB_UNSPEC,
409+ TCA_HTB_PARMS,
410+ TCA_HTB_INIT,
411+ TCA_HTB_CTAB,
412+ TCA_HTB_RTAB,
413+ TCA_HTB_DIRECT_QLEN,
414+ TCA_HTB_RATE64,
415+ TCA_HTB_CEIL64,
416+ TCA_HTB_PAD,
417+ __TCA_HTB_MAX,
418+};
419+
420+#define TCA_HTB_MAX (__TCA_HTB_MAX - 1)
421+
422+struct tc_htb_xstats {
423+ __u32 lends;
424+ __u32 borrows;
425+ __u32 giants; /* unused since 'Make HTB scheduler work with TSO.' */
426+ __s32 tokens;
427+ __s32 ctokens;
428+};
429+
430+/* HFSC section */
431+
432+struct tc_hfsc_qopt {
433+ __u16 defcls; /* default class */
434+};
435+
436+struct tc_service_curve {
437+ __u32 m1; /* slope of the first segment in bps */
438+ __u32 d; /* x-projection of the first segment in us */
439+ __u32 m2; /* slope of the second segment in bps */
440+};
441+
442+struct tc_hfsc_stats {
443+ __u64 work; /* total work done */
444+ __u64 rtwork; /* work done by real-time criteria */
445+ __u32 period; /* current period */
446+ __u32 level; /* class level in hierarchy */
447+};
448+
449+enum {
450+ TCA_HFSC_UNSPEC,
451+ TCA_HFSC_RSC,
452+ TCA_HFSC_FSC,
453+ TCA_HFSC_USC,
454+ __TCA_HFSC_MAX,
455+};
456+
457+#define TCA_HFSC_MAX (__TCA_HFSC_MAX - 1)
458+
459+
460+/* CBQ section */
461+
462+#define TC_CBQ_MAXPRIO 8
463+#define TC_CBQ_MAXLEVEL 8
464+#define TC_CBQ_DEF_EWMA 5
465+
466+struct tc_cbq_lssopt {
467+ unsigned char change;
468+ unsigned char flags;
469+#define TCF_CBQ_LSS_BOUNDED 1
470+#define TCF_CBQ_LSS_ISOLATED 2
471+ unsigned char ewma_log;
472+ unsigned char level;
473+#define TCF_CBQ_LSS_FLAGS 1
474+#define TCF_CBQ_LSS_EWMA 2
475+#define TCF_CBQ_LSS_MAXIDLE 4
476+#define TCF_CBQ_LSS_MINIDLE 8
477+#define TCF_CBQ_LSS_OFFTIME 0x10
478+#define TCF_CBQ_LSS_AVPKT 0x20
479+ __u32 maxidle;
480+ __u32 minidle;
481+ __u32 offtime;
482+ __u32 avpkt;
483+};
484+
485+struct tc_cbq_wrropt {
486+ unsigned char flags;
487+ unsigned char priority;
488+ unsigned char cpriority;
489+ unsigned char __reserved;
490+ __u32 allot;
491+ __u32 weight;
492+};
493+
494+struct tc_cbq_ovl {
495+ unsigned char strategy;
496+#define TC_CBQ_OVL_CLASSIC 0
497+#define TC_CBQ_OVL_DELAY 1
498+#define TC_CBQ_OVL_LOWPRIO 2
499+#define TC_CBQ_OVL_DROP 3
500+#define TC_CBQ_OVL_RCLASSIC 4
501+ unsigned char priority2;
502+ __u16 pad;
503+ __u32 penalty;
504+};
505+
506+struct tc_cbq_police {
507+ unsigned char police;
508+ unsigned char __res1;
509+ unsigned short __res2;
510+};
511+
512+struct tc_cbq_fopt {
513+ __u32 split;
514+ __u32 defmap;
515+ __u32 defchange;
516+};
517+
518+struct tc_cbq_xstats {
519+ __u32 borrows;
520+ __u32 overactions;
521+ __s32 avgidle;
522+ __s32 undertime;
523+};
524+
525+enum {
526+ TCA_CBQ_UNSPEC,
527+ TCA_CBQ_LSSOPT,
528+ TCA_CBQ_WRROPT,
529+ TCA_CBQ_FOPT,
530+ TCA_CBQ_OVL_STRATEGY,
531+ TCA_CBQ_RATE,
532+ TCA_CBQ_RTAB,
533+ TCA_CBQ_POLICE,
534+ __TCA_CBQ_MAX,
535+};
536+
537+#define TCA_CBQ_MAX (__TCA_CBQ_MAX - 1)
538+
539+/* dsmark section */
540+
541+enum {
542+ TCA_DSMARK_UNSPEC,
543+ TCA_DSMARK_INDICES,
544+ TCA_DSMARK_DEFAULT_INDEX,
545+ TCA_DSMARK_SET_TC_INDEX,
546+ TCA_DSMARK_MASK,
547+ TCA_DSMARK_VALUE,
548+ __TCA_DSMARK_MAX,
549+};
550+
551+#define TCA_DSMARK_MAX (__TCA_DSMARK_MAX - 1)
552+
553+/* ATM section */
554+
555+enum {
556+ TCA_ATM_UNSPEC,
557+ TCA_ATM_FD, /* file/socket descriptor */
558+ TCA_ATM_PTR, /* pointer to descriptor - later */
559+ TCA_ATM_HDR, /* LL header */
560+ TCA_ATM_EXCESS, /* excess traffic class (0 for CLP) */
561+ TCA_ATM_ADDR, /* PVC address (for output only) */
562+ TCA_ATM_STATE, /* VC state (ATM_VS_*; for output only) */
563+ __TCA_ATM_MAX,
564+};
565+
566+#define TCA_ATM_MAX (__TCA_ATM_MAX - 1)
567+
568+/* Network emulator */
569+
570+enum {
571+ TCA_NETEM_UNSPEC,
572+ TCA_NETEM_CORR,
573+ TCA_NETEM_DELAY_DIST,
574+ TCA_NETEM_REORDER,
575+ TCA_NETEM_CORRUPT,
576+ TCA_NETEM_LOSS,
577+ TCA_NETEM_RATE,
578+ TCA_NETEM_ECN,
579+ TCA_NETEM_RATE64,
580+ TCA_NETEM_PAD,
581+ TCA_NETEM_LATENCY64,
582+ TCA_NETEM_JITTER64,
583+ TCA_NETEM_SLOT,
584+ TCA_NETEM_SLOT_DIST,
585+ __TCA_NETEM_MAX,
586+};
587+
588+#define TCA_NETEM_MAX (__TCA_NETEM_MAX - 1)
589+
590+struct tc_netem_qopt {
591+ __u32 latency; /* added delay (us) */
592+ __u32 limit; /* fifo limit (packets) */
593+ __u32 loss; /* random packet loss (0=none ~0=100%) */
594+ __u32 gap; /* re-ordering gap (0 for none) */
595+ __u32 duplicate; /* random packet dup (0=none ~0=100%) */
596+ __u32 jitter; /* random jitter in latency (us) */
597+};
598+
599+struct tc_netem_corr {
600+ __u32 delay_corr; /* delay correlation */
601+ __u32 loss_corr; /* packet loss correlation */
602+ __u32 dup_corr; /* duplicate correlation */
603+};
604+
605+struct tc_netem_reorder {
606+ __u32 probability;
607+ __u32 correlation;
608+};
609+
610+struct tc_netem_corrupt {
611+ __u32 probability;
612+ __u32 correlation;
613+};
614+
615+struct tc_netem_rate {
616+ __u32 rate; /* byte/s */
617+ __s32 packet_overhead;
618+ __u32 cell_size;
619+ __s32 cell_overhead;
620+};
621+
622+struct tc_netem_slot {
623+ __s64 min_delay; /* nsec */
624+ __s64 max_delay;
625+ __s32 max_packets;
626+ __s32 max_bytes;
627+ __s64 dist_delay; /* nsec */
628+ __s64 dist_jitter; /* nsec */
629+};
630+
631+enum {
632+ NETEM_LOSS_UNSPEC,
633+ NETEM_LOSS_GI, /* General Intuitive - 4 state model */
634+ NETEM_LOSS_GE, /* Gilbert Elliot models */
635+ __NETEM_LOSS_MAX
636+};
637+#define NETEM_LOSS_MAX (__NETEM_LOSS_MAX - 1)
638+
639+/* State transition probabilities for 4 state model */
640+struct tc_netem_gimodel {
641+ __u32 p13;
642+ __u32 p31;
643+ __u32 p32;
644+ __u32 p14;
645+ __u32 p23;
646+};
647+
648+/* Gilbert-Elliot models */
649+struct tc_netem_gemodel {
650+ __u32 p;
651+ __u32 r;
652+ __u32 h;
653+ __u32 k1;
654+};
655+
656+#define NETEM_DIST_SCALE 8192
657+#define NETEM_DIST_MAX 16384
658+
659+/* DRR */
660+
661+enum {
662+ TCA_DRR_UNSPEC,
663+ TCA_DRR_QUANTUM,
664+ __TCA_DRR_MAX
665+};
666+
667+#define TCA_DRR_MAX (__TCA_DRR_MAX - 1)
668+
669+struct tc_drr_stats {
670+ __u32 deficit;
671+};
672+
673+/* MQPRIO */
674+#define TC_QOPT_BITMASK 15
675+#define TC_QOPT_MAX_QUEUE 16
676+
677+enum {
678+ TC_MQPRIO_HW_OFFLOAD_NONE, /* no offload requested */
679+ TC_MQPRIO_HW_OFFLOAD_TCS, /* offload TCs, no queue counts */
680+ __TC_MQPRIO_HW_OFFLOAD_MAX
681+};
682+
683+#define TC_MQPRIO_HW_OFFLOAD_MAX (__TC_MQPRIO_HW_OFFLOAD_MAX - 1)
684+
685+enum {
686+ TC_MQPRIO_MODE_DCB,
687+ TC_MQPRIO_MODE_CHANNEL,
688+ __TC_MQPRIO_MODE_MAX
689+};
690+
691+#define __TC_MQPRIO_MODE_MAX (__TC_MQPRIO_MODE_MAX - 1)
692+
693+enum {
694+ TC_MQPRIO_SHAPER_DCB,
695+ TC_MQPRIO_SHAPER_BW_RATE, /* Add new shapers below */
696+ __TC_MQPRIO_SHAPER_MAX
697+};
698+
699+#define __TC_MQPRIO_SHAPER_MAX (__TC_MQPRIO_SHAPER_MAX - 1)
700+
701+struct tc_mqprio_qopt {
702+ __u8 num_tc;
703+ __u8 prio_tc_map[TC_QOPT_BITMASK + 1];
704+ __u8 hw;
705+ __u16 count[TC_QOPT_MAX_QUEUE];
706+ __u16 offset[TC_QOPT_MAX_QUEUE];
707+};
708+
709+#define TC_MQPRIO_F_MODE 0x1
710+#define TC_MQPRIO_F_SHAPER 0x2
711+#define TC_MQPRIO_F_MIN_RATE 0x4
712+#define TC_MQPRIO_F_MAX_RATE 0x8
713+
714+enum {
715+ TCA_MQPRIO_UNSPEC,
716+ TCA_MQPRIO_MODE,
717+ TCA_MQPRIO_SHAPER,
718+ TCA_MQPRIO_MIN_RATE64,
719+ TCA_MQPRIO_MAX_RATE64,
720+ __TCA_MQPRIO_MAX,
721+};
722+
723+#define TCA_MQPRIO_MAX (__TCA_MQPRIO_MAX - 1)
724+
725+/* SFB */
726+
727+enum {
728+ TCA_SFB_UNSPEC,
729+ TCA_SFB_PARMS,
730+ __TCA_SFB_MAX,
731+};
732+
733+#define TCA_SFB_MAX (__TCA_SFB_MAX - 1)
734+
735+/*
736+ * Note: increment, decrement are Q0.16 fixed-point values.
737+ */
738+struct tc_sfb_qopt {
739+ __u32 rehash_interval; /* delay between hash move, in ms */
740+ __u32 warmup_time; /* double buffering warmup time in ms (warmup_time < rehash_interval) */
741+ __u32 max; /* max len of qlen_min */
742+ __u32 bin_size; /* maximum queue length per bin */
743+ __u32 increment; /* probability increment, (d1 in Blue) */
744+ __u32 decrement; /* probability decrement, (d2 in Blue) */
745+ __u32 limit; /* max SFB queue length */
746+ __u32 penalty_rate; /* inelastic flows are rate limited to 'rate' pps */
747+ __u32 penalty_burst;
748+};
749+
750+struct tc_sfb_xstats {
751+ __u32 earlydrop;
752+ __u32 penaltydrop;
753+ __u32 bucketdrop;
754+ __u32 queuedrop;
755+ __u32 childdrop; /* drops in child qdisc */
756+ __u32 marked;
757+ __u32 maxqlen;
758+ __u32 maxprob;
759+ __u32 avgprob;
760+};
761+
762+#define SFB_MAX_PROB 0xFFFF
763+
764+/* QFQ */
765+enum {
766+ TCA_QFQ_UNSPEC,
767+ TCA_QFQ_WEIGHT,
768+ TCA_QFQ_LMAX,
769+ __TCA_QFQ_MAX
770+};
771+
772+#define TCA_QFQ_MAX (__TCA_QFQ_MAX - 1)
773+
774+struct tc_qfq_stats {
775+ __u32 weight;
776+ __u32 lmax;
777+};
778+
779+/* CODEL */
780+
781+enum {
782+ TCA_CODEL_UNSPEC,
783+ TCA_CODEL_TARGET,
784+ TCA_CODEL_LIMIT,
785+ TCA_CODEL_INTERVAL,
786+ TCA_CODEL_ECN,
787+ TCA_CODEL_CE_THRESHOLD,
788+ __TCA_CODEL_MAX
789+};
790+
791+#define TCA_CODEL_MAX (__TCA_CODEL_MAX - 1)
792+
793+struct tc_codel_xstats {
794+ __u32 maxpacket; /* largest packet we've seen so far */
795+ __u32 count; /* how many drops we've done since the last time we
796+ * entered dropping state
797+ */
798+ __u32 lastcount; /* count at entry to dropping state */
799+ __u32 ldelay; /* in-queue delay seen by most recently dequeued packet */
800+ __s32 drop_next; /* time to drop next packet */
801+ __u32 drop_overlimit; /* number of time max qdisc packet limit was hit */
802+ __u32 ecn_mark; /* number of packets we ECN marked instead of dropped */
803+ __u32 dropping; /* are we in dropping state ? */
804+ __u32 ce_mark; /* number of CE marked packets because of ce_threshold */
805+};
806+
807+/* FQ_CODEL */
808+
809+enum {
810+ TCA_FQ_CODEL_UNSPEC,
811+ TCA_FQ_CODEL_TARGET,
812+ TCA_FQ_CODEL_LIMIT,
813+ TCA_FQ_CODEL_INTERVAL,
814+ TCA_FQ_CODEL_ECN,
815+ TCA_FQ_CODEL_FLOWS,
816+ TCA_FQ_CODEL_QUANTUM,
817+ TCA_FQ_CODEL_CE_THRESHOLD,
818+ TCA_FQ_CODEL_DROP_BATCH_SIZE,
819+ TCA_FQ_CODEL_MEMORY_LIMIT,
820+ __TCA_FQ_CODEL_MAX
821+};
822+
823+#define TCA_FQ_CODEL_MAX (__TCA_FQ_CODEL_MAX - 1)
824+
825+enum {
826+ TCA_FQ_CODEL_XSTATS_QDISC,
827+ TCA_FQ_CODEL_XSTATS_CLASS,
828+};
829+
830+struct tc_fq_codel_qd_stats {
831+ __u32 maxpacket; /* largest packet we've seen so far */
832+ __u32 drop_overlimit; /* number of time max qdisc
833+ * packet limit was hit
834+ */
835+ __u32 ecn_mark; /* number of packets we ECN marked
836+ * instead of being dropped
837+ */
838+ __u32 new_flow_count; /* number of time packets
839+ * created a 'new flow'
840+ */
841+ __u32 new_flows_len; /* count of flows in new list */
842+ __u32 old_flows_len; /* count of flows in old list */
843+ __u32 ce_mark; /* packets above ce_threshold */
844+ __u32 memory_usage; /* in bytes */
845+ __u32 drop_overmemory;
846+};
847+
848+struct tc_fq_codel_cl_stats {
849+ __s32 deficit;
850+ __u32 ldelay; /* in-queue delay seen by most recently
851+ * dequeued packet
852+ */
853+ __u32 count;
854+ __u32 lastcount;
855+ __u32 dropping;
856+ __s32 drop_next;
857+};
858+
859+struct tc_fq_codel_xstats {
860+ __u32 type;
861+ union {
862+ struct tc_fq_codel_qd_stats qdisc_stats;
863+ struct tc_fq_codel_cl_stats class_stats;
864+ };
865+};
866+
867+/* FQ */
868+
869+enum {
870+ TCA_FQ_UNSPEC,
871+
872+ TCA_FQ_PLIMIT, /* limit of total number of packets in queue */
873+
874+ TCA_FQ_FLOW_PLIMIT, /* limit of packets per flow */
875+
876+ TCA_FQ_QUANTUM, /* RR quantum */
877+
878+ TCA_FQ_INITIAL_QUANTUM, /* RR quantum for new flow */
879+
880+ TCA_FQ_RATE_ENABLE, /* enable/disable rate limiting */
881+
882+ TCA_FQ_FLOW_DEFAULT_RATE,/* obsolete, do not use */
883+
884+ TCA_FQ_FLOW_MAX_RATE, /* per flow max rate */
885+
886+ TCA_FQ_BUCKETS_LOG, /* log2(number of buckets) */
887+
888+ TCA_FQ_FLOW_REFILL_DELAY, /* flow credit refill delay in usec */
889+
890+ TCA_FQ_ORPHAN_MASK, /* mask applied to orphaned skb hashes */
891+
892+ TCA_FQ_LOW_RATE_THRESHOLD, /* per packet delay under this rate */
893+
894+ TCA_FQ_CE_THRESHOLD, /* DCTCP-like CE-marking threshold */
895+
896+ __TCA_FQ_MAX
897+};
898+
899+#define TCA_FQ_MAX (__TCA_FQ_MAX - 1)
900+
901+struct tc_fq_qd_stats {
902+ __u64 gc_flows;
903+ __u64 highprio_packets;
904+ __u64 tcp_retrans;
905+ __u64 throttled;
906+ __u64 flows_plimit;
907+ __u64 pkts_too_long;
908+ __u64 allocation_errors;
909+ __s64 time_next_delayed_flow;
910+ __u32 flows;
911+ __u32 inactive_flows;
912+ __u32 throttled_flows;
913+ __u32 unthrottle_latency_ns;
914+ __u64 ce_mark; /* packets above ce_threshold */
915+};
916+
917+/* Heavy-Hitter Filter */
918+
919+enum {
920+ TCA_HHF_UNSPEC,
921+ TCA_HHF_BACKLOG_LIMIT,
922+ TCA_HHF_QUANTUM,
923+ TCA_HHF_HH_FLOWS_LIMIT,
924+ TCA_HHF_RESET_TIMEOUT,
925+ TCA_HHF_ADMIT_BYTES,
926+ TCA_HHF_EVICT_TIMEOUT,
927+ TCA_HHF_NON_HH_WEIGHT,
928+ __TCA_HHF_MAX
929+};
930+
931+#define TCA_HHF_MAX (__TCA_HHF_MAX - 1)
932+
933+struct tc_hhf_xstats {
934+ __u32 drop_overlimit; /* number of times max qdisc packet limit
935+ * was hit
936+ */
937+ __u32 hh_overlimit; /* number of times max heavy-hitters was hit */
938+ __u32 hh_tot_count; /* number of captured heavy-hitters so far */
939+ __u32 hh_cur_count; /* number of current heavy-hitters */
940+};
941+
942+/* PIE */
943+enum {
944+ TCA_PIE_UNSPEC,
945+ TCA_PIE_TARGET,
946+ TCA_PIE_LIMIT,
947+ TCA_PIE_TUPDATE,
948+ TCA_PIE_ALPHA,
949+ TCA_PIE_BETA,
950+ TCA_PIE_ECN,
951+ TCA_PIE_BYTEMODE,
952+ __TCA_PIE_MAX
953+};
954+#define TCA_PIE_MAX (__TCA_PIE_MAX - 1)
955+
956+struct tc_pie_xstats {
957+ __u32 prob; /* current probability */
958+ __u32 delay; /* current delay in ms */
959+ __u32 avg_dq_rate; /* current average dq_rate in bits/pie_time */
960+ __u32 packets_in; /* total number of packets enqueued */
961+ __u32 dropped; /* packets dropped due to pie_action */
962+ __u32 overlimit; /* dropped due to lack of space in queue */
963+ __u32 maxq; /* maximum queue size */
964+ __u32 ecn_mark; /* packets marked with ecn*/
965+};
966+
967+/* CBS */
968+struct tc_cbs_qopt {
969+ __u8 offload;
970+ __u8 _pad[3];
971+ __s32 hicredit;
972+ __s32 locredit;
973+ __s32 idleslope;
974+ __s32 sendslope;
975+};
976+
977+enum {
978+ TCA_CBS_UNSPEC,
979+ TCA_CBS_PARMS,
980+ __TCA_CBS_MAX,
981+};
982+
983+#define TCA_CBS_MAX (__TCA_CBS_MAX - 1)
984+
985+
986+/* ETF */
987+struct tc_etf_qopt {
988+ __s32 delta;
989+ __s32 clockid;
990+ __u32 flags;
991+#define TC_ETF_DEADLINE_MODE_ON BIT(0)
992+#define TC_ETF_OFFLOAD_ON BIT(1)
993+};
994+
995+enum {
996+ TCA_ETF_UNSPEC,
997+ TCA_ETF_PARMS,
998+ __TCA_ETF_MAX,
999+};
1000+
1001+#define TCA_ETF_MAX (__TCA_ETF_MAX - 1)
1002+
1003+
1004+/* CAKE */
1005+enum {
1006+ TCA_CAKE_UNSPEC,
1007+ TCA_CAKE_PAD,
1008+ TCA_CAKE_BASE_RATE64,
1009+ TCA_CAKE_DIFFSERV_MODE,
1010+ TCA_CAKE_ATM,
1011+ TCA_CAKE_FLOW_MODE,
1012+ TCA_CAKE_OVERHEAD,
1013+ TCA_CAKE_RTT,
1014+ TCA_CAKE_TARGET,
1015+ TCA_CAKE_AUTORATE,
1016+ TCA_CAKE_MEMORY,
1017+ TCA_CAKE_NAT,
1018+ TCA_CAKE_RAW,
1019+ TCA_CAKE_WASH,
1020+ TCA_CAKE_MPU,
1021+ TCA_CAKE_INGRESS,
1022+ TCA_CAKE_ACK_FILTER,
1023+ TCA_CAKE_SPLIT_GSO,
1024+ __TCA_CAKE_MAX
1025+};
1026+#define TCA_CAKE_MAX (__TCA_CAKE_MAX - 1)
1027+
1028+enum {
1029+ __TCA_CAKE_STATS_INVALID,
1030+ TCA_CAKE_STATS_PAD,
1031+ TCA_CAKE_STATS_CAPACITY_ESTIMATE64,
1032+ TCA_CAKE_STATS_MEMORY_LIMIT,
1033+ TCA_CAKE_STATS_MEMORY_USED,
1034+ TCA_CAKE_STATS_AVG_NETOFF,
1035+ TCA_CAKE_STATS_MIN_NETLEN,
1036+ TCA_CAKE_STATS_MAX_NETLEN,
1037+ TCA_CAKE_STATS_MIN_ADJLEN,
1038+ TCA_CAKE_STATS_MAX_ADJLEN,
1039+ TCA_CAKE_STATS_TIN_STATS,
1040+ TCA_CAKE_STATS_DEFICIT,
1041+ TCA_CAKE_STATS_COBALT_COUNT,
1042+ TCA_CAKE_STATS_DROPPING,
1043+ TCA_CAKE_STATS_DROP_NEXT_US,
1044+ TCA_CAKE_STATS_P_DROP,
1045+ TCA_CAKE_STATS_BLUE_TIMER_US,
1046+ __TCA_CAKE_STATS_MAX
1047+};
1048+#define TCA_CAKE_STATS_MAX (__TCA_CAKE_STATS_MAX - 1)
1049+
1050+enum {
1051+ __TCA_CAKE_TIN_STATS_INVALID,
1052+ TCA_CAKE_TIN_STATS_PAD,
1053+ TCA_CAKE_TIN_STATS_SENT_PACKETS,
1054+ TCA_CAKE_TIN_STATS_SENT_BYTES64,
1055+ TCA_CAKE_TIN_STATS_DROPPED_PACKETS,
1056+ TCA_CAKE_TIN_STATS_DROPPED_BYTES64,
1057+ TCA_CAKE_TIN_STATS_ACKS_DROPPED_PACKETS,
1058+ TCA_CAKE_TIN_STATS_ACKS_DROPPED_BYTES64,
1059+ TCA_CAKE_TIN_STATS_ECN_MARKED_PACKETS,
1060+ TCA_CAKE_TIN_STATS_ECN_MARKED_BYTES64,
1061+ TCA_CAKE_TIN_STATS_BACKLOG_PACKETS,
1062+ TCA_CAKE_TIN_STATS_BACKLOG_BYTES,
1063+ TCA_CAKE_TIN_STATS_THRESHOLD_RATE64,
1064+ TCA_CAKE_TIN_STATS_TARGET_US,
1065+ TCA_CAKE_TIN_STATS_INTERVAL_US,
1066+ TCA_CAKE_TIN_STATS_WAY_INDIRECT_HITS,
1067+ TCA_CAKE_TIN_STATS_WAY_MISSES,
1068+ TCA_CAKE_TIN_STATS_WAY_COLLISIONS,
1069+ TCA_CAKE_TIN_STATS_PEAK_DELAY_US,
1070+ TCA_CAKE_TIN_STATS_AVG_DELAY_US,
1071+ TCA_CAKE_TIN_STATS_BASE_DELAY_US,
1072+ TCA_CAKE_TIN_STATS_SPARSE_FLOWS,
1073+ TCA_CAKE_TIN_STATS_BULK_FLOWS,
1074+ TCA_CAKE_TIN_STATS_UNRESPONSIVE_FLOWS,
1075+ TCA_CAKE_TIN_STATS_MAX_SKBLEN,
1076+ TCA_CAKE_TIN_STATS_FLOW_QUANTUM,
1077+ __TCA_CAKE_TIN_STATS_MAX
1078+};
1079+#define TCA_CAKE_TIN_STATS_MAX (__TCA_CAKE_TIN_STATS_MAX - 1)
1080+#define TC_CAKE_MAX_TINS (8)
1081+
1082+enum {
1083+ CAKE_FLOW_NONE = 0,
1084+ CAKE_FLOW_SRC_IP,
1085+ CAKE_FLOW_DST_IP,
1086+ CAKE_FLOW_HOSTS, /* = CAKE_FLOW_SRC_IP | CAKE_FLOW_DST_IP */
1087+ CAKE_FLOW_FLOWS,
1088+ CAKE_FLOW_DUAL_SRC, /* = CAKE_FLOW_SRC_IP | CAKE_FLOW_FLOWS */
1089+ CAKE_FLOW_DUAL_DST, /* = CAKE_FLOW_DST_IP | CAKE_FLOW_FLOWS */
1090+ CAKE_FLOW_TRIPLE, /* = CAKE_FLOW_HOSTS | CAKE_FLOW_FLOWS */
1091+ CAKE_FLOW_MAX,
1092+};
1093+
1094+enum {
1095+ CAKE_DIFFSERV_DIFFSERV3 = 0,
1096+ CAKE_DIFFSERV_DIFFSERV4,
1097+ CAKE_DIFFSERV_DIFFSERV8,
1098+ CAKE_DIFFSERV_BESTEFFORT,
1099+ CAKE_DIFFSERV_PRECEDENCE,
1100+ CAKE_DIFFSERV_MAX
1101+};
1102+
1103+enum {
1104+ CAKE_ACK_NONE = 0,
1105+ CAKE_ACK_FILTER,
1106+ CAKE_ACK_AGGRESSIVE,
1107+ CAKE_ACK_MAX
1108+};
1109+
1110+enum {
1111+ CAKE_ATM_NONE = 0,
1112+ CAKE_ATM_ATM,
1113+ CAKE_ATM_PTM,
1114+ CAKE_ATM_MAX
1115+};
1116+
1117+
1118+/* TAPRIO */
1119+enum {
1120+ TC_TAPRIO_CMD_SET_GATES = 0x00,
1121+ TC_TAPRIO_CMD_SET_AND_HOLD = 0x01,
1122+ TC_TAPRIO_CMD_SET_AND_RELEASE = 0x02,
1123+};
1124+
1125+enum {
1126+ TCA_TAPRIO_SCHED_ENTRY_UNSPEC,
1127+ TCA_TAPRIO_SCHED_ENTRY_INDEX, /* u32 */
1128+ TCA_TAPRIO_SCHED_ENTRY_CMD, /* u8 */
1129+ TCA_TAPRIO_SCHED_ENTRY_GATE_MASK, /* u32 */
1130+ TCA_TAPRIO_SCHED_ENTRY_INTERVAL, /* u32 */
1131+ __TCA_TAPRIO_SCHED_ENTRY_MAX,
1132+};
1133+#define TCA_TAPRIO_SCHED_ENTRY_MAX (__TCA_TAPRIO_SCHED_ENTRY_MAX - 1)
1134+
1135+/* The format for schedule entry list is:
1136+ * [TCA_TAPRIO_SCHED_ENTRY_LIST]
1137+ * [TCA_TAPRIO_SCHED_ENTRY]
1138+ * [TCA_TAPRIO_SCHED_ENTRY_CMD]
1139+ * [TCA_TAPRIO_SCHED_ENTRY_GATES]
1140+ * [TCA_TAPRIO_SCHED_ENTRY_INTERVAL]
1141+ */
1142+enum {
1143+ TCA_TAPRIO_SCHED_UNSPEC,
1144+ TCA_TAPRIO_SCHED_ENTRY,
1145+ __TCA_TAPRIO_SCHED_MAX,
1146+};
1147+
1148+#define TCA_TAPRIO_SCHED_MAX (__TCA_TAPRIO_SCHED_MAX - 1)
1149+
1150+enum {
1151+ TCA_TAPRIO_ATTR_UNSPEC,
1152+ TCA_TAPRIO_ATTR_PRIOMAP, /* struct tc_mqprio_qopt */
1153+ TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST, /* nested of entry */
1154+ TCA_TAPRIO_ATTR_SCHED_BASE_TIME, /* s64 */
1155+ TCA_TAPRIO_ATTR_SCHED_SINGLE_ENTRY, /* single entry */
1156+ TCA_TAPRIO_ATTR_SCHED_CLOCKID, /* s32 */
1157+ TCA_TAPRIO_PAD,
1158+ __TCA_TAPRIO_ATTR_MAX,
1159+};
1160+
1161+#define TCA_TAPRIO_ATTR_MAX (__TCA_TAPRIO_ATTR_MAX - 1)
1162+
1163+#endif
tools/lib/bpf/bpf.c+15−4
@@ -65,6 +65,17 @@ static inline int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr, · 64 unmodified lines
6565 return syscall(__NR_bpf, cmd, attr, size);
6666 }
6767
68+static inline int sys_bpf_prog_load(union bpf_attr *attr, unsigned int size)
69+{
70+ int fd;
71+
72+ do {
73+ fd = sys_bpf(BPF_PROG_LOAD, attr, size);
74+ } while (fd < 0 && errno == EAGAIN);
75+
76+ return fd;
77+}
78+
6879 int bpf_create_map_xattr(const struct bpf_create_map_attr *create_attr)
6980 {
7081 __u32 name_len = create_attr->name ? strlen(create_attr->name) : 0;
@@ -232,7 +243,7 @@ int bpf_load_program_xattr(const struct bpf_load_program_attr *load_attr, · 161 unmodified lines
232243 memcpy(attr.prog_name, load_attr->name,
233244 min(name_len, BPF_OBJ_NAME_LEN - 1));
234245
235− fd = sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr));
246+ fd = sys_bpf_prog_load(&attr, sizeof(attr));
236247 if (fd >= 0)
237248 return fd;
238249
@@ -269,7 +280,7 @@ int bpf_load_program_xattr(const struct bpf_load_program_attr *load_attr, · 30 unmodified lines
269280 break;
270281 }
271282
272− fd = sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr));
283+ fd = sys_bpf_prog_load(&attr, sizeof(attr));
273284
274285 if (fd >= 0)
275286 goto done;
@@ -283,7 +294,7 @@ int bpf_load_program_xattr(const struct bpf_load_program_attr *load_attr, · 7 unmodified lines
283294 attr.log_size = log_buf_sz;
284295 attr.log_level = 1;
285296 log_buf[0] = 0;
286− fd = sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr));
297+ fd = sys_bpf_prog_load(&attr, sizeof(attr));
287298 done:
288299 free(finfo);
289300 free(linfo);
@@ -328,7 +339,7 @@ int bpf_verify_program(enum bpf_prog_type type, const struct bpf_insn *insns, · 38 unmodified lines
328339 attr.kern_version = kern_version;
329340 attr.prog_flags = prog_flags;
330341
331− return sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr));
342+ return sys_bpf_prog_load(&attr, sizeof(attr));
332343 }
333344
334345 int bpf_map_update_elem(int fd, const void *key, const void *value,
tools/testing/selftests/bpf/Makefile+1−0
@@ -56,6 +56,7 @@ TEST_PROGS := test_kmod.sh \ · 55 unmodified lines
5656 test_xdp_vlan.sh
5757
5858 TEST_PROGS_EXTENDED := with_addr.sh \
59+ with_tunnels.sh \
5960 tcp_client.py \
6061 tcp_server.py
6162
tools/testing/selftests/bpf/test_progs.c+30−0
@@ -1188,7 +1188,9 @@ static void test_stacktrace_build_id(void) · 1187 unmodified lines
11881188 int i, j;
11891189 struct bpf_stack_build_id id_offs[PERF_MAX_STACK_DEPTH];
11901190 int build_id_matches = 0;
1191+ int retry = 1;
11911192
1193+retry:
11921194 err = bpf_prog_load(file, BPF_PROG_TYPE_TRACEPOINT, &obj, &prog_fd);
11931195 if (CHECK(err, "prog_load", "err %d errno %d\n", err, errno))
11941196 goto out;
@@ -1301,6 +1303,19 @@ static void test_stacktrace_build_id(void) · 106 unmodified lines
13011303 previous_key = key;
13021304 } while (bpf_map_get_next_key(stackmap_fd, &previous_key, &key) == 0);
13031305
1306+ /* stack_map_get_build_id_offset() is racy and sometimes can return
1307+ * BPF_STACK_BUILD_ID_IP instead of BPF_STACK_BUILD_ID_VALID;
1308+ * try it one more time.
1309+ */
1310+ if (build_id_matches < 1 && retry--) {
1311+ ioctl(pmu_fd, PERF_EVENT_IOC_DISABLE);
1312+ close(pmu_fd);
1313+ bpf_object__close(obj);
1314+ printf("%s:WARN:Didn't find expected build ID from the map, retrying\n",
1315+ __func__);
1316+ goto retry;
1317+ }
1318+
13041319 if (CHECK(build_id_matches < 1, "build id match",
13051320 "Didn't find expected build ID from the map\n"))
13061321 goto disable_pmu;
@@ -1341,7 +1356,9 @@ static void test_stacktrace_build_id_nmi(void) · 34 unmodified lines
13411356 int i, j;
13421357 struct bpf_stack_build_id id_offs[PERF_MAX_STACK_DEPTH];
13431358 int build_id_matches = 0;
1359+ int retry = 1;
13441360
1361+retry:
13451362 err = bpf_prog_load(file, BPF_PROG_TYPE_PERF_EVENT, &obj, &prog_fd);
13461363 if (CHECK(err, "prog_load", "err %d errno %d\n", err, errno))
13471364 return;
@@ -1436,6 +1453,19 @@ static void test_stacktrace_build_id_nmi(void) · 88 unmodified lines
14361453 previous_key = key;
14371454 } while (bpf_map_get_next_key(stackmap_fd, &previous_key, &key) == 0);
14381455
1456+ /* stack_map_get_build_id_offset() is racy and sometimes can return
1457+ * BPF_STACK_BUILD_ID_IP instead of BPF_STACK_BUILD_ID_VALID;
1458+ * try it one more time.
1459+ */
1460+ if (build_id_matches < 1 && retry--) {
1461+ ioctl(pmu_fd, PERF_EVENT_IOC_DISABLE);
1462+ close(pmu_fd);
1463+ bpf_object__close(obj);
1464+ printf("%s:WARN:Didn't find expected build ID from the map, retrying\n",
1465+ __func__);
1466+ goto retry;
1467+ }
1468+
14391469 if (CHECK(build_id_matches < 1, "build id match",
14401470 "Didn't find expected build ID from the map\n"))
14411471 goto disable_pmu;
tools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh+20−0
@@ -25,6 +25,7 @@ ALL_TESTS=" · 24 unmodified lines
2525 lag_unlink_slaves_test
2626 lag_dev_deletion_test
2727 vlan_interface_uppers_test
28+ bridge_extern_learn_test
2829 devlink_reload_test
2930 "
3031 NUM_NETIFS=2
@@ -541,6 +542,25 @@ vlan_interface_uppers_test() · 510 unmodified lines
541542 ip link del dev br0
542543 }
543544
545+bridge_extern_learn_test()
546+{
547+ # Test that externally learned entries added from user space are
548+ # marked as offloaded
549+ RET=0
550+
551+ ip link add name br0 type bridge
552+ ip link set dev $swp1 master br0
553+
554+ bridge fdb add de:ad:be:ef:13:37 dev $swp1 master extern_learn
555+
556+ bridge fdb show brport $swp1 | grep de:ad:be:ef:13:37 | grep -q offload
557+ check_err $? "fdb entry not marked as offloaded when should"
558+
559+ log_test "externally learned fdb entry"
560+
561+ ip link del dev br0
562+}
563+
544564 devlink_reload_test()
545565 {
546566 # Test that after executing all the above configuration tests, a
tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh+33−1
@@ -1,7 +1,7 @@
11 #!/bin/bash
22 # SPDX-License-Identifier: GPL-2.0
33
4−ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding vlan_deletion"
4+ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding vlan_deletion extern_learn"
55 NUM_NETIFS=4
66 CHECK_TC="yes"
77 source lib.sh
@@ -109,6 +109,38 @@ vlan_deletion() · 101 unmodified lines
109109 ping_ipv6
110110 }
111111
112+extern_learn()
113+{
114+ local mac=de:ad:be:ef:13:37
115+ local ageing_time
116+
117+ # Test that externally learned FDB entries can roam, but not age out
118+ RET=0
119+
120+ bridge fdb add de:ad:be:ef:13:37 dev $swp1 master extern_learn vlan 1
121+
122+ bridge fdb show brport $swp1 | grep -q de:ad:be:ef:13:37
123+ check_err $? "Did not find FDB entry when should"
124+
125+ # Wait for 10 seconds after the ageing time to make sure the FDB entry
126+ # was not aged out
127+ ageing_time=$(bridge_ageing_time_get br0)
128+ sleep $((ageing_time + 10))
129+
130+ bridge fdb show brport $swp1 | grep -q de:ad:be:ef:13:37
131+ check_err $? "FDB entry was aged out when should not"
132+
133+ $MZ $h2 -c 1 -p 64 -a $mac -t ip -q
134+
135+ bridge fdb show brport $swp2 | grep -q de:ad:be:ef:13:37
136+ check_err $? "FDB entry did not roam when should"
137+
138+ log_test "Externally learned FDB entry - ageing & roaming"
139+
140+ bridge fdb del de:ad:be:ef:13:37 dev $swp2 master vlan 1 &> /dev/null
141+ bridge fdb del de:ad:be:ef:13:37 dev $swp1 master vlan 1 &> /dev/null
142+}
143+
112144 trap cleanup EXIT
113145
114146 setup_prepare
tools/testing/selftests/networking/timestamping/txtimestamp.c+1−1
@@ -240,7 +240,7 @@ static void __recv_errmsg_cmsg(struct msghdr *msg, int payload_len) · 239 unmodified lines
240240 cm->cmsg_type == IP_RECVERR) ||
241241 (cm->cmsg_level == SOL_IPV6 &&
242242 cm->cmsg_type == IPV6_RECVERR) ||
243− (cm->cmsg_level = SOL_PACKET &&
243+ (cm->cmsg_level == SOL_PACKET &&
244244 cm->cmsg_type == PACKET_TX_TIMESTAMP)) {
245245 serr = (void *) CMSG_DATA(cm);
246246 if (serr->ee_errno != ENOMSG ||
tools/testing/selftests/tc-testing/tc-tests/actions/ife.json+44−44
@@ -17,7 +17,7 @@ · 16 unmodified lines
1717 "cmdUnderTest": "$TC actions add action ife encode allow mark pass index 2",
1818 "expExitCode": "0",
1919 "verifyCmd": "$TC actions get action ife index 2",
20− "matchPattern": "action order [0-9]*: ife encode action pass.*type 0xED3E.*allow mark.*index 2",
20+ "matchPattern": "action order [0-9]*: ife encode action pass.*type 0[xX]ED3E.*allow mark.*index 2",
2121 "matchCount": "1",
2222 "teardown": [
2323 "$TC actions flush action ife"
@@ -41,7 +41,7 @@ · 17 unmodified lines
4141 "cmdUnderTest": "$TC actions add action ife encode use mark 10 pipe index 2",
4242 "expExitCode": "0",
4343 "verifyCmd": "$TC actions get action ife index 2",
44− "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0xED3E.*use mark.*index 2",
44+ "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0[xX]ED3E.*use mark.*index 2",
4545 "matchCount": "1",
4646 "teardown": [
4747 "$TC actions flush action ife"
@@ -65,7 +65,7 @@ · 17 unmodified lines
6565 "cmdUnderTest": "$TC actions add action ife encode allow mark continue index 2",
6666 "expExitCode": "0",
6767 "verifyCmd": "$TC actions get action ife index 2",
68− "matchPattern": "action order [0-9]*: ife encode action continue.*type 0xED3E.*allow mark.*index 2",
68+ "matchPattern": "action order [0-9]*: ife encode action continue.*type 0[xX]ED3E.*allow mark.*index 2",
6969 "matchCount": "1",
7070 "teardown": [
7171 "$TC actions flush action ife"
@@ -89,7 +89,7 @@ · 17 unmodified lines
8989 "cmdUnderTest": "$TC actions add action ife encode use mark 789 drop index 2",
9090 "expExitCode": "0",
9191 "verifyCmd": "$TC actions get action ife index 2",
92− "matchPattern": "action order [0-9]*: ife encode action drop.*type 0xED3E.*use mark 789.*index 2",
92+ "matchPattern": "action order [0-9]*: ife encode action drop.*type 0[xX]ED3E.*use mark 789.*index 2",
9393 "matchCount": "1",
9494 "teardown": [
9595 "$TC actions flush action ife"
@@ -113,7 +113,7 @@ · 17 unmodified lines
113113 "cmdUnderTest": "$TC actions add action ife encode use mark 656768 reclassify index 2",
114114 "expExitCode": "0",
115115 "verifyCmd": "$TC actions get action ife index 2",
116− "matchPattern": "action order [0-9]*: ife encode action reclassify.*type 0xED3E.*use mark 656768.*index 2",
116+ "matchPattern": "action order [0-9]*: ife encode action reclassify.*type 0[xX]ED3E.*use mark 656768.*index 2",
117117 "matchCount": "1",
118118 "teardown": [
119119 "$TC actions flush action ife"
@@ -137,7 +137,7 @@ · 17 unmodified lines
137137 "cmdUnderTest": "$TC actions add action ife encode use mark 65 jump 1 index 2",
138138 "expExitCode": "0",
139139 "verifyCmd": "$TC actions get action ife index 2",
140− "matchPattern": "action order [0-9]*: ife encode action jump 1.*type 0xED3E.*use mark 65.*index 2",
140+ "matchPattern": "action order [0-9]*: ife encode action jump 1.*type 0[xX]ED3E.*use mark 65.*index 2",
141141 "matchCount": "1",
142142 "teardown": [
143143 "$TC actions flush action ife"
@@ -161,7 +161,7 @@ · 17 unmodified lines
161161 "cmdUnderTest": "$TC actions add action ife encode use mark 4294967295 reclassify index 90",
162162 "expExitCode": "0",
163163 "verifyCmd": "$TC actions get action ife index 90",
164− "matchPattern": "action order [0-9]*: ife encode action reclassify.*type 0xED3E.*use mark 4294967295.*index 90",
164+ "matchPattern": "action order [0-9]*: ife encode action reclassify.*type 0[xX]ED3E.*use mark 4294967295.*index 90",
165165 "matchCount": "1",
166166 "teardown": [
167167 "$TC actions flush action ife"
@@ -185,7 +185,7 @@ · 17 unmodified lines
185185 "cmdUnderTest": "$TC actions add action ife encode use mark 4294967295999 pipe index 90",
186186 "expExitCode": "255",
187187 "verifyCmd": "$TC actions get action ife index 90",
188− "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0xED3E.*use mark 4294967295999.*index 90",
188+ "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0[xX]ED3E.*use mark 4294967295999.*index 90",
189189 "matchCount": "0",
190190 "teardown": []
191191 },
@@ -207,7 +207,7 @@ · 15 unmodified lines
207207 "cmdUnderTest": "$TC actions add action ife encode allow prio pass index 9",
208208 "expExitCode": "0",
209209 "verifyCmd": "$TC actions get action ife index 9",
210− "matchPattern": "action order [0-9]*: ife encode action pass.*type 0xED3E.*allow prio.*index 9",
210+ "matchPattern": "action order [0-9]*: ife encode action pass.*type 0[xX]ED3E.*allow prio.*index 9",
211211 "matchCount": "1",
212212 "teardown": [
213213 "$TC actions flush action ife"
@@ -231,7 +231,7 @@ · 17 unmodified lines
231231 "cmdUnderTest": "$TC actions add action ife encode use prio 7 pipe index 9",
232232 "expExitCode": "0",
233233 "verifyCmd": "$TC actions get action ife index 9",
234− "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0xED3E.*use prio 7.*index 9",
234+ "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0[xX]ED3E.*use prio 7.*index 9",
235235 "matchCount": "1",
236236 "teardown": [
237237 "$TC actions flush action ife"
@@ -255,7 +255,7 @@ · 17 unmodified lines
255255 "cmdUnderTest": "$TC actions add action ife encode use prio 3 continue index 9",
256256 "expExitCode": "0",
257257 "verifyCmd": "$TC actions get action ife index 9",
258− "matchPattern": "action order [0-9]*: ife encode action continue.*type 0xED3E.*use prio 3.*index 9",
258+ "matchPattern": "action order [0-9]*: ife encode action continue.*type 0[xX]ED3E.*use prio 3.*index 9",
259259 "matchCount": "1",
260260 "teardown": [
261261 "$TC actions flush action ife"
@@ -279,7 +279,7 @@ · 17 unmodified lines
279279 "cmdUnderTest": "$TC actions add action ife encode allow prio drop index 9",
280280 "expExitCode": "0",
281281 "verifyCmd": "$TC actions get action ife index 9",
282− "matchPattern": "action order [0-9]*: ife encode action drop.*type 0xED3E.*allow prio.*index 9",
282+ "matchPattern": "action order [0-9]*: ife encode action drop.*type 0[xX]ED3E.*allow prio.*index 9",
283283 "matchCount": "1",
284284 "teardown": [
285285 "$TC actions flush action ife"
@@ -303,7 +303,7 @@ · 17 unmodified lines
303303 "cmdUnderTest": "$TC actions add action ife encode use prio 998877 reclassify index 9",
304304 "expExitCode": "0",
305305 "verifyCmd": "$TC actions get action ife index 9",
306− "matchPattern": "action order [0-9]*: ife encode action reclassify.*type 0xED3E.*use prio 998877.*index 9",
306+ "matchPattern": "action order [0-9]*: ife encode action reclassify.*type 0[xX]ED3E.*use prio 998877.*index 9",
307307 "matchCount": "1",
308308 "teardown": [
309309 "$TC actions flush action ife"
@@ -327,7 +327,7 @@ · 17 unmodified lines
327327 "cmdUnderTest": "$TC actions add action ife encode use prio 998877 jump 10 index 9",
328328 "expExitCode": "0",
329329 "verifyCmd": "$TC actions get action ife index 9",
330− "matchPattern": "action order [0-9]*: ife encode action jump 10.*type 0xED3E.*use prio 998877.*index 9",
330+ "matchPattern": "action order [0-9]*: ife encode action jump 10.*type 0[xX]ED3E.*use prio 998877.*index 9",
331331 "matchCount": "1",
332332 "teardown": [
333333 "$TC actions flush action ife"
@@ -351,7 +351,7 @@ · 17 unmodified lines
351351 "cmdUnderTest": "$TC actions add action ife encode use prio 4294967295 reclassify index 99",
352352 "expExitCode": "0",
353353 "verifyCmd": "$TC actions get action ife index 99",
354− "matchPattern": "action order [0-9]*: ife encode action reclassify.*type 0xED3E.*use prio 4294967295.*index 99",
354+ "matchPattern": "action order [0-9]*: ife encode action reclassify.*type 0[xX]ED3E.*use prio 4294967295.*index 99",
355355 "matchCount": "1",
356356 "teardown": [
357357 "$TC actions flush action ife"
@@ -375,7 +375,7 @@ · 17 unmodified lines
375375 "cmdUnderTest": "$TC actions add action ife encode use prio 4294967298 pipe index 99",
376376 "expExitCode": "255",
377377 "verifyCmd": "$TC actions get action ife index 99",
378− "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0xED3E.*use prio 4294967298.*index 99",
378+ "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0[xX]ED3E.*use prio 4294967298.*index 99",
379379 "matchCount": "0",
380380 "teardown": []
381381 },
@@ -397,7 +397,7 @@ · 15 unmodified lines
397397 "cmdUnderTest": "$TC actions add action ife encode allow tcindex pass index 1",
398398 "expExitCode": "0",
399399 "verifyCmd": "$TC actions get action ife index 1",
400− "matchPattern": "action order [0-9]*: ife encode action pass.*type 0xED3E.*allow tcindex.*index 1",
400+ "matchPattern": "action order [0-9]*: ife encode action pass.*type 0[xX]ED3E.*allow tcindex.*index 1",
401401 "matchCount": "1",
402402 "teardown": [
403403 "$TC actions flush action ife"
@@ -421,7 +421,7 @@ · 17 unmodified lines
421421 "cmdUnderTest": "$TC actions add action ife encode use tcindex 111 pipe index 1",
422422 "expExitCode": "0",
423423 "verifyCmd": "$TC actions get action ife index 1",
424− "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0xED3E.*use tcindex 111.*index 1",
424+ "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0[xX]ED3E.*use tcindex 111.*index 1",
425425 "matchCount": "1",
426426 "teardown": [
427427 "$TC actions flush action ife"
@@ -445,7 +445,7 @@ · 17 unmodified lines
445445 "cmdUnderTest": "$TC actions add action ife encode use tcindex 1 continue index 1",
446446 "expExitCode": "0",
447447 "verifyCmd": "$TC actions get action ife index 1",
448− "matchPattern": "action order [0-9]*: ife encode action continue.*type 0xED3E.*use tcindex 1.*index 1",
448+ "matchPattern": "action order [0-9]*: ife encode action continue.*type 0[xX]ED3E.*use tcindex 1.*index 1",
449449 "matchCount": "1",
450450 "teardown": [
451451 "$TC actions flush action ife"
@@ -469,7 +469,7 @@ · 17 unmodified lines
469469 "cmdUnderTest": "$TC actions add action ife encode use tcindex 1 continue index 1",
470470 "expExitCode": "0",
471471 "verifyCmd": "$TC actions get action ife index 1",
472− "matchPattern": "action order [0-9]*: ife encode action continue.*type 0xED3E.*use tcindex 1.*index 1",
472+ "matchPattern": "action order [0-9]*: ife encode action continue.*type 0[xX]ED3E.*use tcindex 1.*index 1",
473473 "matchCount": "1",
474474 "teardown": [
475475 "$TC actions flush action ife"
@@ -493,7 +493,7 @@ · 17 unmodified lines
493493 "cmdUnderTest": "$TC actions add action ife encode allow tcindex drop index 77",
494494 "expExitCode": "0",
495495 "verifyCmd": "$TC actions get action ife index 77",
496− "matchPattern": "action order [0-9]*: ife encode action drop.*type 0xED3E.*allow tcindex.*index 77",
496+ "matchPattern": "action order [0-9]*: ife encode action drop.*type 0[xX]ED3E.*allow tcindex.*index 77",
497497 "matchCount": "1",
498498 "teardown": [
499499 "$TC actions flush action ife"
@@ -517,7 +517,7 @@ · 17 unmodified lines
517517 "cmdUnderTest": "$TC actions add action ife encode allow tcindex reclassify index 77",
518518 "expExitCode": "0",
519519 "verifyCmd": "$TC actions get action ife index 77",
520− "matchPattern": "action order [0-9]*: ife encode action reclassify.*type 0xED3E.*allow tcindex.*index 77",
520+ "matchPattern": "action order [0-9]*: ife encode action reclassify.*type 0[xX]ED3E.*allow tcindex.*index 77",
521521 "matchCount": "1",
522522 "teardown": [
523523 "$TC actions flush action ife"
@@ -541,7 +541,7 @@ · 17 unmodified lines
541541 "cmdUnderTest": "$TC actions add action ife encode allow tcindex jump 999 index 77",
542542 "expExitCode": "0",
543543 "verifyCmd": "$TC actions get action ife index 77",
544− "matchPattern": "action order [0-9]*: ife encode action jump 999.*type 0xED3E.*allow tcindex.*index 77",
544+ "matchPattern": "action order [0-9]*: ife encode action jump 999.*type 0[xX]ED3E.*allow tcindex.*index 77",
545545 "matchCount": "1",
546546 "teardown": [
547547 "$TC actions flush action ife"
@@ -565,7 +565,7 @@ · 17 unmodified lines
565565 "cmdUnderTest": "$TC actions add action ife encode use tcindex 65535 pass index 1",
566566 "expExitCode": "0",
567567 "verifyCmd": "$TC actions get action ife index 1",
568− "matchPattern": "action order [0-9]*: ife encode action pass.*type 0xED3E.*use tcindex 65535.*index 1",
568+ "matchPattern": "action order [0-9]*: ife encode action pass.*type 0[xX]ED3E.*use tcindex 65535.*index 1",
569569 "matchCount": "1",
570570 "teardown": [
571571 "$TC actions flush action ife"
@@ -589,7 +589,7 @@ · 17 unmodified lines
589589 "cmdUnderTest": "$TC actions add action ife encode use tcindex 65539 pipe index 1",
590590 "expExitCode": "255",
591591 "verifyCmd": "$TC actions get action ife index 1",
592− "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0xED3E.*use tcindex 65539.*index 1",
592+ "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0[xX]ED3E.*use tcindex 65539.*index 1",
593593 "matchCount": "0",
594594 "teardown": []
595595 },
@@ -611,7 +611,7 @@ · 15 unmodified lines
611611 "cmdUnderTest": "$TC actions add action ife encode allow mark src 00:11:22:33:44:55 pipe index 1",
612612 "expExitCode": "0",
613613 "verifyCmd": "$TC actions get action ife index 1",
614− "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0xED3E.*allow mark src 00:11:22:33:44:55.*index 1",
614+ "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0[xX]ED3E.*allow mark src 00:11:22:33:44:55.*index 1",
615615 "matchCount": "1",
616616 "teardown": [
617617 "$TC actions flush action ife"
@@ -635,7 +635,7 @@ · 17 unmodified lines
635635 "cmdUnderTest": "$TC actions add action ife encode use prio 9876 dst 00:11:22:33:44:55 reclassify index 1",
636636 "expExitCode": "0",
637637 "verifyCmd": "$TC actions get action ife index 1",
638− "matchPattern": "action order [0-9]*: ife encode action reclassify.*type 0xED3E.*use prio 9876 dst 00:11:22:33:44:55.*index 1",
638+ "matchPattern": "action order [0-9]*: ife encode action reclassify.*type 0[xX]ED3E.*use prio 9876 dst 00:11:22:33:44:55.*index 1",
639639 "matchCount": "1",
640640 "teardown": [
641641 "$TC actions flush action ife"
@@ -659,7 +659,7 @@ · 17 unmodified lines
659659 "cmdUnderTest": "$TC actions add action ife encode allow tcindex src 00:aa:bb:cc:dd:ee dst 00:11:22:33:44:55 pass index 11",
660660 "expExitCode": "0",
661661 "verifyCmd": "$TC actions get action ife index 11",
662− "matchPattern": "action order [0-9]*: ife encode action pass.*type 0xED3E.*allow tcindex dst 00:11:22:33:44:55 src 00:aa:bb:cc:dd:ee .*index 11",
662+ "matchPattern": "action order [0-9]*: ife encode action pass.*type 0[xX]ED3E.*allow tcindex dst 00:11:22:33:44:55 src 00:aa:bb:cc:dd:ee .*index 11",
663663 "matchCount": "1",
664664 "teardown": [
665665 "$TC actions flush action ife"
@@ -683,7 +683,7 @@ · 17 unmodified lines
683683 "cmdUnderTest": "$TC actions add action ife encode use mark 7 type 0xfefe pass index 1",
684684 "expExitCode": "0",
685685 "verifyCmd": "$TC actions get action ife index 1",
686− "matchPattern": "action order [0-9]*: ife encode action pass.*type 0xFEFE.*use mark 7.*index 1",
686+ "matchPattern": "action order [0-9]*: ife encode action pass.*type 0[xX]FEFE.*use mark 7.*index 1",
687687 "matchCount": "1",
688688 "teardown": [
689689 "$TC actions flush action ife"
@@ -707,7 +707,7 @@ · 17 unmodified lines
707707 "cmdUnderTest": "$TC actions add action ife encode use prio 444 type 0xabba pipe index 21",
708708 "expExitCode": "0",
709709 "verifyCmd": "$TC actions get action ife index 21",
710− "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0xABBA.*use prio 444.*index 21",
710+ "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0[xX]ABBA.*use prio 444.*index 21",
711711 "matchCount": "1",
712712 "teardown": [
713713 "$TC actions flush action ife"
@@ -731,7 +731,7 @@ · 17 unmodified lines
731731 "cmdUnderTest": "$TC actions add action ife encode use tcindex 5000 type 0xabcd reclassify index 21",
732732 "expExitCode": "0",
733733 "verifyCmd": "$TC actions get action ife index 21",
734− "matchPattern": "action order [0-9]*: ife encode action reclassify.*type 0xABCD.*use tcindex 5000.*index 21",
734+ "matchPattern": "action order [0-9]*: ife encode action reclassify.*type 0[xX]ABCD.*use tcindex 5000.*index 21",
735735 "matchCount": "1",
736736 "teardown": [
737737 "$TC actions flush action ife"
@@ -739,7 +739,7 @@ · 1 unmodified line
739739 },
740740 {
741741 "id": "fac3",
742− "name": "Create valid ife encode action with index at 32-bit maximnum",
742+ "name": "Create valid ife encode action with index at 32-bit maximum",
743743 "category": [
744744 "actions",
745745 "ife"
@@ -755,7 +755,7 @@ · 9 unmodified lines
755755 "cmdUnderTest": "$TC actions add action ife encode allow mark pass index 4294967295",
756756 "expExitCode": "0",
757757 "verifyCmd": "$TC actions get action ife index 4294967295",
758− "matchPattern": "action order [0-9]*: ife encode action pass.*type 0xED3E.*allow mark.*index 4294967295",
758+ "matchPattern": "action order [0-9]*: ife encode action pass.*type 0[xX]ED3E.*allow mark.*index 4294967295",
759759 "matchCount": "1",
760760 "teardown": [
761761 "$TC actions flush action ife"
@@ -779,7 +779,7 @@ · 17 unmodified lines
779779 "cmdUnderTest": "$TC actions add action ife decode pass index 1",
780780 "expExitCode": "0",
781781 "verifyCmd": "$TC actions get action ife index 1",
782− "matchPattern": "action order [0-9]*: ife decode action pass.*type 0x0.*allow mark allow tcindex allow prio.*index 1",
782+ "matchPattern": "action order [0-9]*: ife decode action pass.*type 0(x0)?.*allow mark allow tcindex allow prio.*index 1",
783783 "matchCount": "1",
784784 "teardown": [
785785 "$TC actions flush action ife"
@@ -803,7 +803,7 @@ · 17 unmodified lines
803803 "cmdUnderTest": "$TC actions add action ife decode pipe index 1",
804804 "expExitCode": "0",
805805 "verifyCmd": "$TC actions get action ife index 1",
806− "matchPattern": "action order [0-9]*: ife decode action pipe.*type 0x0.*allow mark allow tcindex allow prio.*index 1",
806+ "matchPattern": "action order [0-9]*: ife decode action pipe.*type 0(x0)?.*allow mark allow tcindex allow prio.*index 1",
807807 "matchCount": "1",
808808 "teardown": [
809809 "$TC actions flush action ife"
@@ -827,7 +827,7 @@ · 17 unmodified lines
827827 "cmdUnderTest": "$TC actions add action ife decode continue index 1",
828828 "expExitCode": "0",
829829 "verifyCmd": "$TC actions get action ife index 1",
830− "matchPattern": "action order [0-9]*: ife decode action continue.*type 0x0.*allow mark allow tcindex allow prio.*index 1",
830+ "matchPattern": "action order [0-9]*: ife decode action continue.*type 0(x0)?.*allow mark allow tcindex allow prio.*index 1",
831831 "matchCount": "1",
832832 "teardown": [
833833 "$TC actions flush action ife"
@@ -851,7 +851,7 @@ · 17 unmodified lines
851851 "cmdUnderTest": "$TC actions add action ife decode drop index 1",
852852 "expExitCode": "0",
853853 "verifyCmd": "$TC actions get action ife index 1",
854− "matchPattern": "action order [0-9]*: ife decode action drop.*type 0x0.*allow mark allow tcindex allow prio.*index 1",
854+ "matchPattern": "action order [0-9]*: ife decode action drop.*type 0(x0)?.*allow mark allow tcindex allow prio.*index 1",
855855 "matchCount": "1",
856856 "teardown": [
857857 "$TC actions flush action ife"
@@ -875,7 +875,7 @@ · 17 unmodified lines
875875 "cmdUnderTest": "$TC actions add action ife decode reclassify index 1",
876876 "expExitCode": "0",
877877 "verifyCmd": "$TC actions get action ife index 1",
878− "matchPattern": "action order [0-9]*: ife decode action reclassify.*type 0x0.*allow mark allow tcindex allow prio.*index 1",
878+ "matchPattern": "action order [0-9]*: ife decode action reclassify.*type 0(x0)?.*allow mark allow tcindex allow prio.*index 1",
879879 "matchCount": "1",
880880 "teardown": [
881881 "$TC actions flush action ife"
@@ -899,7 +899,7 @@ · 17 unmodified lines
899899 "cmdUnderTest": "$TC actions add action ife decode jump 10 index 1",
900900 "expExitCode": "0",
901901 "verifyCmd": "$TC actions get action ife index 1",
902− "matchPattern": "action order [0-9]*: ife decode action jump 10.*type 0x0.*allow mark allow tcindex allow prio.*index 1",
902+ "matchPattern": "action order [0-9]*: ife decode action jump 10.*type 0(x0)?.*allow mark allow tcindex allow prio.*index 1",
903903 "matchCount": "1",
904904 "teardown": [
905905 "$TC actions flush action ife"
@@ -923,7 +923,7 @@ · 17 unmodified lines
923923 "cmdUnderTest": "$TC actions add action ife encode allow mark pass index 4294967295999",
924924 "expExitCode": "255",
925925 "verifyCmd": "$TC actions get action ife index 4294967295999",
926− "matchPattern": "action order [0-9]*: ife encode action pass.*type 0xED3E.*allow mark.*index 4294967295999",
926+ "matchPattern": "action order [0-9]*: ife encode action pass.*type 0[xX]ED3E.*allow mark.*index 4294967295999",
927927 "matchCount": "0",
928928 "teardown": []
929929 },
@@ -945,7 +945,7 @@ · 15 unmodified lines
945945 "cmdUnderTest": "$TC actions add action ife encode allow mark kuka index 4",
946946 "expExitCode": "255",
947947 "verifyCmd": "$TC actions get action ife index 4",
948− "matchPattern": "action order [0-9]*: ife encode action kuka.*type 0xED3E.*allow mark.*index 4",
948+ "matchPattern": "action order [0-9]*: ife encode action kuka.*type 0[xX]ED3E.*allow mark.*index 4",
949949 "matchCount": "0",
950950 "teardown": []
951951 },
@@ -967,7 +967,7 @@ · 15 unmodified lines
967967 "cmdUnderTest": "$TC actions add action ife encode allow prio pipe index 4 cookie aabbccddeeff112233445566778800a1",
968968 "expExitCode": "0",
969969 "verifyCmd": "$TC actions get action ife index 4",
970− "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0xED3E.*allow prio.*index 4.*cookie aabbccddeeff112233445566778800a1",
970+ "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0[xX]ED3E.*allow prio.*index 4.*cookie aabbccddeeff112233445566778800a1",
971971 "matchCount": "1",
972972 "teardown": [
973973 "$TC actions flush action ife"
@@ -991,7 +991,7 @@ · 17 unmodified lines
991991 "cmdUnderTest": "$TC actions add action ife encode allow foo pipe index 4",
992992 "expExitCode": "255",
993993 "verifyCmd": "$TC actions get action ife index 4",
994− "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0xED3E.*allow foo.*index 4",
994+ "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0[xX]ED3E.*allow foo.*index 4",
995995 "matchCount": "0",
996996 "teardown": []
997997 },
@@ -1013,7 +1013,7 @@ · 15 unmodified lines
10131013 "cmdUnderTest": "$TC actions add action ife encode allow prio type 70000 pipe index 4",
10141014 "expExitCode": "255",
10151015 "verifyCmd": "$TC actions get action ife index 4",
1016− "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0x11170.*allow prio.*index 4",
1016+ "matchPattern": "action order [0-9]*: ife encode action pipe.*type 0[xX]11170.*allow prio.*index 4",
10171017 "matchCount": "0",
10181018 "teardown": []
10191019 },
tools/testing/selftests/tc-testing/tc-tests/actions/tunnel_key.json+1−30
@@ -81,35 +81,6 @@ · 80 unmodified lines
8181 ]
8282 ]
8383 },
84− {
85− "id": "ba4e",
86− "name": "Add tunnel_key set action with missing mandatory id parameter",
87− "category": [
88− "actions",
89− "tunnel_key"
90− ],
91− "setup": [
92− [
93− "$TC actions flush action tunnel_key",
94− 0,
95− 1,
96− 255
97− ]
98− ],
99− "cmdUnderTest": "$TC actions add action tunnel_key set src_ip 10.10.10.1 dst_ip 20.20.20.2",
100− "expExitCode": "255",
101− "verifyCmd": "$TC actions list action tunnel_key",
102− "matchPattern": "action order [0-9]+: tunnel_key set.*src_ip 10.10.10.1.*dst_ip 20.20.20.2",
103− "matchCount": "0",
104− "teardown": [
105− [
106− "$TC actions flush action tunnel_key",
107− 0,
108− 1,
109− 255
110− ]
111− ]
112− },
11384 {
11485 "id": "a5e0",
11586 "name": "Add tunnel_key set action with invalid src_ip parameter",
@@ -634,7 +605,7 @@ · 518 unmodified lines
634605 "cmdUnderTest": "$TC actions add action tunnel_key set src_ip 10.10.10.1 dst_ip 10.10.10.2 id 7 index 4 cookie aa11bb22cc33dd44ee55ff66aa11b1b2",
635606 "expExitCode": "0",
636607 "verifyCmd": "$TC actions get action tunnel_key index 4",
637− "matchPattern": "action order [0-9]+: tunnel_key.*set.*src_ip 10.10.10.1.*dst_ip 10.10.10.2.*key_id 7.*dst_port 0.*csum pipe.*index 4 ref.*cookie aa11bb22cc33dd44ee55ff66aa11b1b2",
608+ "matchPattern": "action order [0-9]+: tunnel_key.*set.*src_ip 10.10.10.1.*dst_ip 10.10.10.2.*key_id 7.*csum pipe.*index 4 ref.*cookie aa11bb22cc33dd44ee55ff66aa11b1b2",
638609 "matchCount": "1",
639610 "teardown": [
640611 "$TC actions flush action tunnel_key"

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