aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/networking/index.rst26
-rw-r--r--Documentation/networking/rxrpc.txt45
-rw-r--r--Documentation/networking/snmp_counter.rst130
-rw-r--r--Documentation/networking/timestamping.txt4
-rw-r--r--MAINTAINERS7
-rw-r--r--drivers/atm/he.c2
-rw-r--r--drivers/isdn/hardware/avm/b1.c2
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/dsa/realtek-smi.c18
-rw-r--r--drivers/net/ethernet/amd/xgbe/xgbe-common.h2
-rw-r--r--drivers/net/ethernet/amd/xgbe/xgbe-dev.c22
-rw-r--r--drivers/net/ethernet/freescale/dpaa/dpaa_eth.c6
-rw-r--r--drivers/net/ethernet/intel/igb/igb.h2
-rw-r--r--drivers/net/ethernet/intel/igb/igb_ethtool.c4
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c14
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c5
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_rep.c30
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_rx.c13
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/pci.c16
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/pci_hw.h3
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c12
-rw-r--r--drivers/net/macvlan.c2
-rw-r--r--drivers/net/phy/bcm87xx.c2
-rw-r--r--drivers/net/phy/cortina.c1
-rw-r--r--drivers/net/phy/marvell.c37
-rw-r--r--drivers/net/phy/mdio_bus.c1
-rw-r--r--drivers/net/phy/meson-gxl.c1
-rw-r--r--drivers/net/phy/micrel.c2
-rw-r--r--drivers/net/phy/phy.c19
-rw-r--r--drivers/net/phy/phy_device.c17
-rw-r--r--drivers/net/phy/teranetics.c1
-rw-r--r--drivers/net/ppp/pppoe.c1
-rw-r--r--drivers/net/usb/aqc111.c15
-rw-r--r--drivers/net/usb/cdc_ether.c8
-rw-r--r--drivers/net/virtio_net.c12
-rw-r--r--drivers/vhost/net.c3
-rw-r--r--drivers/vhost/vhost.c97
-rw-r--r--drivers/vhost/vhost.h3
-rw-r--r--include/linux/phy.h6
-rw-r--r--include/linux/skbuff.h1
-rw-r--r--include/net/af_rxrpc.h16
-rw-r--r--include/net/ip_fib.h2
-rw-r--r--include/net/netfilter/nf_flow_table.h1
-rw-r--r--include/uapi/linux/in.h2
-rw-r--r--kernel/bpf/btf.c2
-rw-r--r--kernel/bpf/cgroup.c1
-rw-r--r--kernel/bpf/map_in_map.c17
-rw-r--r--kernel/bpf/stackmap.c9
-rw-r--r--net/bpfilter/bpfilter_umh_blob.S2
-rw-r--r--net/bridge/br_fdb.c5
-rw-r--r--net/bridge/br_forward.c9
-rw-r--r--net/bridge/br_netfilter_ipv6.c1
-rw-r--r--net/bridge/netfilter/ebtables.c6
-rw-r--r--net/bridge/netfilter/nft_reject_bridge.c1
-rw-r--r--net/core/filter.c32
-rw-r--r--net/core/lwt_bpf.c1
-rw-r--r--net/core/neighbour.c4
-rw-r--r--net/ipv4/fib_frontend.c4
-rw-r--r--net/ipv4/fib_trie.c15
-rw-r--r--net/ipv4/fou.c9
-rw-r--r--net/ipv4/ip_gre.c23
-rw-r--r--net/ipv4/ip_input.c1
-rw-r--r--net/ipv4/tcp.c2
-rw-r--r--net/ipv4/udp.c18
-rw-r--r--net/ipv4/udp_impl.h1
-rw-r--r--net/ipv4/udplite.c1
-rw-r--r--net/ipv6/fou6.c9
-rw-r--r--net/ipv6/ip6_gre.c14
-rw-r--r--net/ipv6/route.c14
-rw-r--r--net/ipv6/udp.c18
-rw-r--r--net/ipv6/udp_impl.h1
-rw-r--r--net/ipv6/udplite.c1
-rw-r--r--net/netfilter/nf_flow_table_core.c5
-rw-r--r--net/netfilter/nf_tables_api.c14
-rw-r--r--net/netfilter/nft_flow_offload.c13
-rw-r--r--net/openvswitch/flow_netlink.c2
-rw-r--r--net/packet/af_packet.c3
-rw-r--r--net/rxrpc/af_rxrpc.c70
-rw-r--r--net/rxrpc/ar-internal.h19
-rw-r--r--net/rxrpc/call_object.c97
-rw-r--r--net/rxrpc/conn_client.c5
-rw-r--r--net/rxrpc/sendmsg.c24
-rw-r--r--net/sched/act_tunnel_key.c19
-rw-r--r--net/sched/cls_api.c3
-rw-r--r--net/sched/cls_flower.c19
-rw-r--r--net/sched/sch_cake.c5
-rw-r--r--net/sched/sch_cbs.c3
-rw-r--r--net/sched/sch_drr.c7
-rw-r--r--net/sched/sch_dsmark.c3
-rw-r--r--net/sched/sch_hfsc.c9
-rw-r--r--net/sched/sch_htb.c3
-rw-r--r--net/sched/sch_prio.c3
-rw-r--r--net/sched/sch_qfq.c20
-rw-r--r--net/sched/sch_tbf.c3
-rw-r--r--net/sctp/ipv6.c5
-rw-r--r--net/sctp/protocol.c4
-rw-r--r--net/tipc/netlink_compat.c50
-rw-r--r--net/tipc/topsrv.c2
-rw-r--r--net/xdp/xdp_umem.c16
-rw-r--r--samples/bpf/Makefile1
-rw-r--r--samples/bpf/asm_goto_workaround.h16
-rw-r--r--tools/bpf/bpftool/Makefile9
-rw-r--r--tools/bpf/bpftool/json_writer.c7
-rw-r--r--tools/bpf/bpftool/json_writer.h5
-rw-r--r--tools/include/uapi/linux/pkt_sched.h1163
-rw-r--r--tools/lib/bpf/bpf.c19
-rw-r--r--tools/testing/selftests/bpf/Makefile1
-rw-r--r--tools/testing/selftests/bpf/test_progs.c30
-rwxr-xr-xtools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh20
-rwxr-xr-xtools/testing/selftests/net/forwarding/bridge_vlan_aware.sh34
-rw-r--r--tools/testing/selftests/networking/timestamping/txtimestamp.c2
-rw-r--r--tools/testing/selftests/tc-testing/tc-tests/actions/ife.json88
-rw-r--r--tools/testing/selftests/tc-testing/tc-tests/actions/tunnel_key.json31
114 files changed, 2090 insertions, 602 deletions
diff --git a/Documentation/networking/index.rst b/Documentation/networking/index.rst
index 6a47629ef8ed..59e86de662cd 100644
--- a/Documentation/networking/index.rst
+++ b/Documentation/networking/index.rst
@@ -11,19 +11,19 @@ Contents:
11 batman-adv 11 batman-adv
12 can 12 can
13 can_ucan_protocol 13 can_ucan_protocol
14 dpaa2/index 14 device_drivers/freescale/dpaa2/index
15 e100 15 device_drivers/intel/e100
16 e1000 16 device_drivers/intel/e1000
17 e1000e 17 device_drivers/intel/e1000e
18 fm10k 18 device_drivers/intel/fm10k
19 igb 19 device_drivers/intel/igb
20 igbvf 20 device_drivers/intel/igbvf
21 ixgb 21 device_drivers/intel/ixgb
22 ixgbe 22 device_drivers/intel/ixgbe
23 ixgbevf 23 device_drivers/intel/ixgbevf
24 i40e 24 device_drivers/intel/i40e
25 iavf 25 device_drivers/intel/iavf
26 ice 26 device_drivers/intel/ice
27 kapi 27 kapi
28 z8530book 28 z8530book
29 msg_zerocopy 29 msg_zerocopy
diff --git a/Documentation/networking/rxrpc.txt b/Documentation/networking/rxrpc.txt
index c9d052e0cf51..2df5894353d6 100644
--- a/Documentation/networking/rxrpc.txt
+++ b/Documentation/networking/rxrpc.txt
@@ -1000,51 +1000,6 @@ The kernel interface functions are as follows:
1000 size should be set when the call is begun. tx_total_len may not be less 1000 size should be set when the call is begun. tx_total_len may not be less
1001 than zero. 1001 than zero.
1002 1002
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
1048 (*) Get call RTT. 1003 (*) Get call RTT.
1049 1004
1050 u64 rxrpc_kernel_get_rtt(struct socket *sock, struct rxrpc_call *call); 1005 u64 rxrpc_kernel_get_rtt(struct socket *sock, struct rxrpc_call *call);
diff --git a/Documentation/networking/snmp_counter.rst b/Documentation/networking/snmp_counter.rst
index b0dfdaaca512..fe8f741193be 100644
--- a/Documentation/networking/snmp_counter.rst
+++ b/Documentation/networking/snmp_counter.rst
@@ -336,7 +336,26 @@ time client replies ACK, this socket will get another chance to move
336to the accept queue. 336to the accept queue.
337 337
338 338
339TCP Fast Open 339* TcpEstabResets
340Defined in `RFC1213 tcpEstabResets`_.
341
342.. _RFC1213 tcpEstabResets: https://tools.ietf.org/html/rfc1213#page-48
343
344* TcpAttemptFails
345Defined in `RFC1213 tcpAttemptFails`_.
346
347.. _RFC1213 tcpAttemptFails: https://tools.ietf.org/html/rfc1213#page-48
348
349* TcpOutRsts
350Defined in `RFC1213 tcpOutRsts`_. The RFC says this counter indicates
351the 'segments sent containing the RST flag', but in linux kernel, this
352couner indicates the segments kerenl tried to send. The sending
353process 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
358TCP Fast Path
340============ 359============
341When kernel receives a TCP packet, it has two paths to handler the 360When kernel receives a TCP packet, it has two paths to handler the
342packet, one is fast path, another is slow path. The comment in kernel 361packet, one is fast path, another is slow path. The comment in kernel
@@ -383,8 +402,6 @@ increase 1.
383 402
384TCP abort 403TCP abort
385======== 404========
386
387
388* TcpExtTCPAbortOnData 405* TcpExtTCPAbortOnData
389It means TCP layer has data in flight, but need to close the 406It means TCP layer has data in flight, but need to close the
390connection. So TCP layer sends a RST to the other side, indicate the 407connection. 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
545stack of kernel will increase TcpExtTCPSACKReorder for both of the 562stack of kernel will increase TcpExtTCPSACKReorder for both of the
546above scenarios. 563above scenarios.
547 564
548
549DSACK 565DSACK
550===== 566=====
551The DSACK is defined in `RFC2883`_. The receiver uses DSACK to report 567The 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
566DSACK to the sender. 582DSACK to the sender.
567 583
568* TcpExtTCPDSACKRecv 584* TcpExtTCPDSACKRecv
569The TCP stack receives a DSACK, which indicate an acknowledged 585The TCP stack receives a DSACK, which indicates an acknowledged
570duplicate packet is received. 586duplicate packet is received.
571 587
572* TcpExtTCPDSACKOfoRecv 588* TcpExtTCPDSACKOfoRecv
573The TCP stack receives a DSACK, which indicate an out of order 589The TCP stack receives a DSACK, which indicate an out of order
574duplicate packet is received. 590duplicate packet is received.
575 591
592invalid SACK and DSACK
593====================
594When a SACK (or DSACK) block is invalid, a corresponding counter would
595be updated. The validation method is base on the start/end sequence
596number of the SACK block. For more details, please refer the comment
597of the function tcp_is_sackblock_valid in the kernel source code. A
598SACK option could have up to 4 blocks, they are checked
599individually. E.g., if 3 blocks of a SACk is invalid, the
600corresponding counter would be updated 3 times. The comment of the
601`Add counters for discarded SACK blocks`_ patch has additional
602explaination:
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
607This counter indicates how many SACK blocks are invalid. If the invalid
608SACK block is caused by ACK recording, the TCP stack will only ignore
609it and won't update this counter.
610
611* TcpExtTCPDSACKIgnoredOld and TcpExtTCPDSACKIgnoredNoUndo
612When a DSACK block is invalid, one of these two counters would be
613updated. Which counter will be updated depends on the undo_marker flag
614of the TCP socket. If the undo_marker is not set, the TCP stack isn't
615likely to re-transmit any packets, and we still receive an invalid
616DSACK block, the reason might be that the packet is duplicated in the
617middle of the network. In such scenario, TcpExtTCPDSACKIgnoredNoUndo
618will be updated. If the undo_marker is set, TcpExtTCPDSACKIgnoredOld
619will be updated. As implied in its name, it might be an old packet.
620
621SACK shift
622=========
623The linux networking stack stores data in sk_buff struct (skb for
624short). If a SACK block acrosses multiple skb, the TCP stack will try
625to re-arrange data in these skb. E.g. if a SACK block acknowledges seq
62610 to 15, skb1 has seq 10 to 13, skb2 has seq 14 to 20. The seq 14 and
62715 in skb2 would be moved to skb1. This operation is 'shift'. If a
628SACK block acknowledges seq 10 to 20, skb1 has seq 10 to 13, skb2 has
629seq 14 to 20. All data in skb2 will be moved to skb1, and skb2 will be
630discard, this operation is 'merge'.
631
632* TcpExtTCPSackShifted
633A skb is shifted
634
635* TcpExtTCPSackMerged
636A skb is merged
637
638* TcpExtTCPSackShiftFallback
639A skb should be shifted or merged, but the TCP stack doesn't do it for
640some reasons.
641
576TCP out of order 642TCP out of order
577=============== 643===============
578* TcpExtTCPOFOQueue 644* TcpExtTCPOFOQueue
@@ -662,6 +728,60 @@ unacknowledged number (more strict than `RFC 5961 section 5.2`_).
662.. _RFC 5961 section 4.2: https://tools.ietf.org/html/rfc5961#page-9 728.. _RFC 5961 section 4.2: https://tools.ietf.org/html/rfc5961#page-9
663.. _RFC 5961 section 5.2: https://tools.ietf.org/html/rfc5961#page-11 729.. _RFC 5961 section 5.2: https://tools.ietf.org/html/rfc5961#page-11
664 730
731TCP receive window
732=================
733* TcpExtTCPWantZeroWindowAdv
734Depending on current memory usage, the TCP stack tries to set receive
735window to zero. But the receive window might still be a no-zero
736value. For example, if the previous window size is 10, and the TCP
737stack receives 3 bytes, the current window size would be 7 even if the
738window size calculated by the memory usage is zero.
739
740* TcpExtTCPToZeroWindowAdv
741The TCP receive window is set to zero from a no-zero value.
742
743* TcpExtTCPFromZeroWindowAdv
744The TCP receive window is set to no-zero value from zero.
745
746
747Delayed ACK
748==========
749The TCP Delayed ACK is a technique which is used for reducing the
750packet 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
756A delayed ACK timer expires. The TCP stack will send a pure ACK packet
757and exit the delayed ACK mode.
758
759* TcpExtDelayedACKLocked
760A delayed ACK timer expires, but the TCP stack can't send an ACK
761immediately due to the socket is locked by a userspace program. The
762TCP stack will send a pure ACK later (after the userspace program
763unlock the socket). When the TCP stack sends the pure ACK later, the
764TCP stack will also update TcpExtDelayedACKs and exit the delayed ACK
765mode.
766
767* TcpExtDelayedACKLost
768It will be updated when the TCP stack receives a packet which has been
769ACKed. A Delayed ACK loss might cause this issue, but it would also be
770triggered by other reasons, such as a packet is duplicated in the
771network.
772
773Tail Loss Probe (TLP)
774===================
775TLP is an algorithm which is used to detect TCP packet loss. For more
776details, please refer the `TLP paper`_.
777
778.. _TLP paper: https://tools.ietf.org/html/draft-dukkipati-tcpm-tcp-loss-probe-01
779
780* TcpExtTCPLossProbes
781A TLP probe packet is sent.
782
783* TcpExtTCPLossProbeRecovery
784A packet loss is detected and recovered by TLP.
665 785
666examples 786examples
667======= 787=======
diff --git a/Documentation/networking/timestamping.txt b/Documentation/networking/timestamping.txt
index 1be0b6f9e0cb..9d1432e0aaa8 100644
--- a/Documentation/networking/timestamping.txt
+++ b/Documentation/networking/timestamping.txt
@@ -417,7 +417,7 @@ is again deprecated and ts[2] holds a hardware timestamp if set.
417 417
418Hardware time stamping must also be initialized for each device driver 418Hardware time stamping must also be initialized for each device driver
419that is expected to do hardware time stamping. The parameter is defined in 419that is expected to do hardware time stamping. The parameter is defined in
420/include/linux/net_tstamp.h as: 420include/uapi/linux/net_tstamp.h as:
421 421
422struct hwtstamp_config { 422struct hwtstamp_config {
423 int flags; /* no flags defined right now, must be zero */ 423 int flags; /* no flags defined right now, must be zero */
@@ -487,7 +487,7 @@ enum {
487 HWTSTAMP_FILTER_PTP_V1_L4_EVENT, 487 HWTSTAMP_FILTER_PTP_V1_L4_EVENT,
488 488
489 /* for the complete list of values, please check 489 /* 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
491 */ 491 */
492}; 492};
493 493
diff --git a/MAINTAINERS b/MAINTAINERS
index 4d04cebb4a71..51029a425dbe 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3471,10 +3471,9 @@ F: drivers/i2c/busses/i2c-octeon*
3471F: drivers/i2c/busses/i2c-thunderx* 3471F: drivers/i2c/busses/i2c-thunderx*
3472 3472
3473CAVIUM LIQUIDIO NETWORK DRIVER 3473CAVIUM LIQUIDIO NETWORK DRIVER
3474M: Derek Chickles <derek.chickles@caviumnetworks.com> 3474M: Derek Chickles <dchickles@marvell.com>
3475M: Satanand Burla <satananda.burla@caviumnetworks.com> 3475M: Satanand Burla <sburla@marvell.com>
3476M: Felix Manlunas <felix.manlunas@caviumnetworks.com> 3476M: Felix Manlunas <fmanlunas@marvell.com>
3477M: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
3478L: netdev@vger.kernel.org 3477L: netdev@vger.kernel.org
3479W: http://www.cavium.com 3478W: http://www.cavium.com
3480S: Supported 3479S: Supported
diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index 2e9d1cfe3aeb..211607986134 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -718,7 +718,7 @@ static int he_init_cs_block_rcm(struct he_dev *he_dev)
718 instead of '/ 512', use '>> 9' to prevent a call 718 instead of '/ 512', use '>> 9' to prevent a call
719 to divdu3 on x86 platforms 719 to divdu3 on x86 platforms
720 */ 720 */
721 rate_cps = (unsigned long long) (1 << exp) * (man + 512) >> 9; 721 rate_cps = (unsigned long long) (1UL << exp) * (man + 512) >> 9;
722 722
723 if (rate_cps < 10) 723 if (rate_cps < 10)
724 rate_cps = 10; /* 2.2.1 minimum payload rate is 10 cps */ 724 rate_cps = 10; /* 2.2.1 minimum payload rate is 10 cps */
diff --git a/drivers/isdn/hardware/avm/b1.c b/drivers/isdn/hardware/avm/b1.c
index 4ac378e48902..40ca1e8fa09f 100644
--- a/drivers/isdn/hardware/avm/b1.c
+++ b/drivers/isdn/hardware/avm/b1.c
@@ -423,7 +423,7 @@ void b1_parse_version(avmctrl_info *cinfo)
423 int i, j; 423 int i, j;
424 424
425 for (j = 0; j < AVM_MAXVERSION; j++) 425 for (j = 0; j < AVM_MAXVERSION; j++)
426 cinfo->version[j] = "\0\0" + 1; 426 cinfo->version[j] = "";
427 for (i = 0, j = 0; 427 for (i = 0, j = 0;
428 j < AVM_MAXVERSION && i < cinfo->versionlen; 428 j < AVM_MAXVERSION && i < cinfo->versionlen;
429 j++, i += cinfo->versionbuf[i] + 1) 429 j++, i += cinfo->versionbuf[i] + 1)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 6371958dd170..edb1c023a753 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -519,7 +519,7 @@ config NET_FAILOVER
519 and destroy a failover master netdev and manages a primary and 519 and destroy a failover master netdev and manages a primary and
520 standby slave netdevs that get registered via the generic failover 520 standby slave netdevs that get registered via the generic failover
521 infrastructure. This can be used by paravirtual drivers to enable 521 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
523 a VM with direct attached VF by failing over to the paravirtual 523 a VM with direct attached VF by failing over to the paravirtual
524 datapath when the VF is unplugged. 524 datapath when the VF is unplugged.
525 525
diff --git a/drivers/net/dsa/realtek-smi.c b/drivers/net/dsa/realtek-smi.c
index b4b839a1d095..ad41ec63cc9f 100644
--- a/drivers/net/dsa/realtek-smi.c
+++ b/drivers/net/dsa/realtek-smi.c
@@ -347,16 +347,17 @@ int realtek_smi_setup_mdio(struct realtek_smi *smi)
347 struct device_node *mdio_np; 347 struct device_node *mdio_np;
348 int ret; 348 int ret;
349 349
350 mdio_np = of_find_compatible_node(smi->dev->of_node, NULL, 350 mdio_np = of_get_compatible_child(smi->dev->of_node, "realtek,smi-mdio");
351 "realtek,smi-mdio");
352 if (!mdio_np) { 351 if (!mdio_np) {
353 dev_err(smi->dev, "no MDIO bus node\n"); 352 dev_err(smi->dev, "no MDIO bus node\n");
354 return -ENODEV; 353 return -ENODEV;
355 } 354 }
356 355
357 smi->slave_mii_bus = devm_mdiobus_alloc(smi->dev); 356 smi->slave_mii_bus = devm_mdiobus_alloc(smi->dev);
358 if (!smi->slave_mii_bus) 357 if (!smi->slave_mii_bus) {
359 return -ENOMEM; 358 ret = -ENOMEM;
359 goto err_put_node;
360 }
360 smi->slave_mii_bus->priv = smi; 361 smi->slave_mii_bus->priv = smi;
361 smi->slave_mii_bus->name = "SMI slave MII"; 362 smi->slave_mii_bus->name = "SMI slave MII";
362 smi->slave_mii_bus->read = realtek_smi_mdio_read; 363 smi->slave_mii_bus->read = realtek_smi_mdio_read;
@@ -371,10 +372,15 @@ int realtek_smi_setup_mdio(struct realtek_smi *smi)
371 if (ret) { 372 if (ret) {
372 dev_err(smi->dev, "unable to register MDIO bus %s\n", 373 dev_err(smi->dev, "unable to register MDIO bus %s\n",
373 smi->slave_mii_bus->id); 374 smi->slave_mii_bus->id);
374 of_node_put(mdio_np); 375 goto err_put_node;
375 } 376 }
376 377
377 return 0; 378 return 0;
379
380err_put_node:
381 of_node_put(mdio_np);
382
383 return ret;
378} 384}
379 385
380static int realtek_smi_probe(struct platform_device *pdev) 386static int realtek_smi_probe(struct platform_device *pdev)
@@ -457,6 +463,8 @@ static int realtek_smi_remove(struct platform_device *pdev)
457 struct realtek_smi *smi = dev_get_drvdata(&pdev->dev); 463 struct realtek_smi *smi = dev_get_drvdata(&pdev->dev);
458 464
459 dsa_unregister_switch(smi->ds); 465 dsa_unregister_switch(smi->ds);
466 if (smi->slave_mii_bus)
467 of_node_put(smi->slave_mii_bus->dev.of_node);
460 gpiod_set_value(smi->reset, 1); 468 gpiod_set_value(smi->reset, 1);
461 469
462 return 0; 470 return 0;
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-common.h b/drivers/net/ethernet/amd/xgbe/xgbe-common.h
index d272dc6984ac..b40d4377cc71 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-common.h
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-common.h
@@ -431,8 +431,6 @@
431#define MAC_MDIOSCAR_PA_WIDTH 5 431#define MAC_MDIOSCAR_PA_WIDTH 5
432#define MAC_MDIOSCAR_RA_INDEX 0 432#define MAC_MDIOSCAR_RA_INDEX 0
433#define MAC_MDIOSCAR_RA_WIDTH 16 433#define MAC_MDIOSCAR_RA_WIDTH 16
434#define MAC_MDIOSCAR_REG_INDEX 0
435#define MAC_MDIOSCAR_REG_WIDTH 21
436#define MAC_MDIOSCCDR_BUSY_INDEX 22 434#define MAC_MDIOSCCDR_BUSY_INDEX 22
437#define MAC_MDIOSCCDR_BUSY_WIDTH 1 435#define MAC_MDIOSCCDR_BUSY_WIDTH 1
438#define MAC_MDIOSCCDR_CMD_INDEX 16 436#define MAC_MDIOSCCDR_CMD_INDEX 16
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
index 1e929a1e4ca7..4666084eda16 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
@@ -1284,6 +1284,20 @@ static void xgbe_write_mmd_regs(struct xgbe_prv_data *pdata, int prtad,
1284 } 1284 }
1285} 1285}
1286 1286
1287static 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
1287static int xgbe_write_ext_mii_regs(struct xgbe_prv_data *pdata, int addr, 1301static int xgbe_write_ext_mii_regs(struct xgbe_prv_data *pdata, int addr,
1288 int reg, u16 val) 1302 int reg, u16 val)
1289{ 1303{
@@ -1291,9 +1305,7 @@ static int xgbe_write_ext_mii_regs(struct xgbe_prv_data *pdata, int addr,
1291 1305
1292 reinit_completion(&pdata->mdio_complete); 1306 reinit_completion(&pdata->mdio_complete);
1293 1307
1294 mdio_sca = 0; 1308 mdio_sca = xgbe_create_mdio_sca(addr, reg);
1295 XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, REG, reg);
1296 XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, DA, addr);
1297 XGMAC_IOWRITE(pdata, MAC_MDIOSCAR, mdio_sca); 1309 XGMAC_IOWRITE(pdata, MAC_MDIOSCAR, mdio_sca);
1298 1310
1299 mdio_sccd = 0; 1311 mdio_sccd = 0;
@@ -1317,9 +1329,7 @@ static int xgbe_read_ext_mii_regs(struct xgbe_prv_data *pdata, int addr,
1317 1329
1318 reinit_completion(&pdata->mdio_complete); 1330 reinit_completion(&pdata->mdio_complete);
1319 1331
1320 mdio_sca = 0; 1332 mdio_sca = xgbe_create_mdio_sca(addr, reg);
1321 XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, REG, reg);
1322 XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, DA, addr);
1323 XGMAC_IOWRITE(pdata, MAC_MDIOSCAR, mdio_sca); 1333 XGMAC_IOWRITE(pdata, MAC_MDIOSCAR, mdio_sca);
1324 1334
1325 mdio_sccd = 0; 1335 mdio_sccd = 0;
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index f53090cde041..dfebc30c4841 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -2051,6 +2051,7 @@ dpaa_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
2051 bool nonlinear = skb_is_nonlinear(skb); 2051 bool nonlinear = skb_is_nonlinear(skb);
2052 struct rtnl_link_stats64 *percpu_stats; 2052 struct rtnl_link_stats64 *percpu_stats;
2053 struct dpaa_percpu_priv *percpu_priv; 2053 struct dpaa_percpu_priv *percpu_priv;
2054 struct netdev_queue *txq;
2054 struct dpaa_priv *priv; 2055 struct dpaa_priv *priv;
2055 struct qm_fd fd; 2056 struct qm_fd fd;
2056 int offset = 0; 2057 int offset = 0;
@@ -2100,6 +2101,11 @@ dpaa_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
2100 if (unlikely(err < 0)) 2101 if (unlikely(err < 0))
2101 goto skb_to_fd_failed; 2102 goto skb_to_fd_failed;
2102 2103
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
2103 if (priv->tx_tstamp && skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) { 2109 if (priv->tx_tstamp && skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) {
2104 fd.cmd |= cpu_to_be32(FM_FD_CMD_UPD); 2110 fd.cmd |= cpu_to_be32(FM_FD_CMD_UPD);
2105 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; 2111 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h
index fe1592ae8769..ca54e268d157 100644
--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -515,7 +515,7 @@ struct igb_adapter {
515 /* OS defined structs */ 515 /* OS defined structs */
516 struct pci_dev *pdev; 516 struct pci_dev *pdev;
517 517
518 struct mutex stats64_lock; 518 spinlock_t stats64_lock;
519 struct rtnl_link_stats64 stats64; 519 struct rtnl_link_stats64 stats64;
520 520
521 /* structs defined in e1000_hw.h */ 521 /* structs defined in e1000_hw.h */
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index 7426060b678f..c57671068245 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -2295,7 +2295,7 @@ static void igb_get_ethtool_stats(struct net_device *netdev,
2295 int i, j; 2295 int i, j;
2296 char *p; 2296 char *p;
2297 2297
2298 mutex_lock(&adapter->stats64_lock); 2298 spin_lock(&adapter->stats64_lock);
2299 igb_update_stats(adapter); 2299 igb_update_stats(adapter);
2300 2300
2301 for (i = 0; i < IGB_GLOBAL_STATS_LEN; i++) { 2301 for (i = 0; i < IGB_GLOBAL_STATS_LEN; i++) {
@@ -2338,7 +2338,7 @@ static void igb_get_ethtool_stats(struct net_device *netdev,
2338 } while (u64_stats_fetch_retry_irq(&ring->rx_syncp, start)); 2338 } while (u64_stats_fetch_retry_irq(&ring->rx_syncp, start));
2339 i += IGB_RX_QUEUE_STATS_LEN; 2339 i += IGB_RX_QUEUE_STATS_LEN;
2340 } 2340 }
2341 mutex_unlock(&adapter->stats64_lock); 2341 spin_unlock(&adapter->stats64_lock);
2342} 2342}
2343 2343
2344static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data) 2344static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 87bdf1604ae2..7137e7f9c7f3 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -2203,9 +2203,9 @@ void igb_down(struct igb_adapter *adapter)
2203 del_timer_sync(&adapter->phy_info_timer); 2203 del_timer_sync(&adapter->phy_info_timer);
2204 2204
2205 /* record the stats before reset*/ 2205 /* record the stats before reset*/
2206 mutex_lock(&adapter->stats64_lock); 2206 spin_lock(&adapter->stats64_lock);
2207 igb_update_stats(adapter); 2207 igb_update_stats(adapter);
2208 mutex_unlock(&adapter->stats64_lock); 2208 spin_unlock(&adapter->stats64_lock);
2209 2209
2210 adapter->link_speed = 0; 2210 adapter->link_speed = 0;
2211 adapter->link_duplex = 0; 2211 adapter->link_duplex = 0;
@@ -3840,7 +3840,7 @@ static int igb_sw_init(struct igb_adapter *adapter)
3840 adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; 3840 adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
3841 3841
3842 spin_lock_init(&adapter->nfc_lock); 3842 spin_lock_init(&adapter->nfc_lock);
3843 mutex_init(&adapter->stats64_lock); 3843 spin_lock_init(&adapter->stats64_lock);
3844#ifdef CONFIG_PCI_IOV 3844#ifdef CONFIG_PCI_IOV
3845 switch (hw->mac.type) { 3845 switch (hw->mac.type) {
3846 case e1000_82576: 3846 case e1000_82576:
@@ -5406,9 +5406,9 @@ no_wait:
5406 } 5406 }
5407 } 5407 }
5408 5408
5409 mutex_lock(&adapter->stats64_lock); 5409 spin_lock(&adapter->stats64_lock);
5410 igb_update_stats(adapter); 5410 igb_update_stats(adapter);
5411 mutex_unlock(&adapter->stats64_lock); 5411 spin_unlock(&adapter->stats64_lock);
5412 5412
5413 for (i = 0; i < adapter->num_tx_queues; i++) { 5413 for (i = 0; i < adapter->num_tx_queues; i++) {
5414 struct igb_ring *tx_ring = adapter->tx_ring[i]; 5414 struct igb_ring *tx_ring = adapter->tx_ring[i];
@@ -6235,10 +6235,10 @@ static void igb_get_stats64(struct net_device *netdev,
6235{ 6235{
6236 struct igb_adapter *adapter = netdev_priv(netdev); 6236 struct igb_adapter *adapter = netdev_priv(netdev);
6237 6237
6238 mutex_lock(&adapter->stats64_lock); 6238 spin_lock(&adapter->stats64_lock);
6239 igb_update_stats(adapter); 6239 igb_update_stats(adapter);
6240 memcpy(stats, &adapter->stats64, sizeof(*stats)); 6240 memcpy(stats, &adapter->stats64, sizeof(*stats));
6241 mutex_unlock(&adapter->stats64_lock); 6241 spin_unlock(&adapter->stats64_lock);
6242} 6242}
6243 6243
6244/** 6244/**
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index c9df08133718..3bbccead2f63 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -844,9 +844,12 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv,
844 ethtool_link_ksettings_add_link_mode(link_ksettings, supported, 844 ethtool_link_ksettings_add_link_mode(link_ksettings, supported,
845 Autoneg); 845 Autoneg);
846 846
847 if (get_fec_supported_advertised(mdev, link_ksettings)) 847 err = get_fec_supported_advertised(mdev, link_ksettings);
848 if (err) {
848 netdev_dbg(priv->netdev, "%s: FEC caps query failed: %d\n", 849 netdev_dbg(priv->netdev, "%s: FEC caps query failed: %d\n",
849 __func__, err); 850 __func__, err);
851 err = 0; /* don't fail caps query because of FEC error */
852 }
850 853
851 if (!an_disable_admin) 854 if (!an_disable_admin)
852 ethtool_link_ksettings_add_link_mode(link_ksettings, 855 ethtool_link_ksettings_add_link_mode(link_ksettings,
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 96cc0c6a4014..04736212a21c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -58,7 +58,8 @@ struct mlx5e_rep_indr_block_priv {
58 struct list_head list; 58 struct list_head list;
59}; 59};
60 60
61static void mlx5e_rep_indr_unregister_block(struct net_device *netdev); 61static void mlx5e_rep_indr_unregister_block(struct mlx5e_rep_priv *rpriv,
62 struct net_device *netdev);
62 63
63static void mlx5e_rep_get_drvinfo(struct net_device *dev, 64static void mlx5e_rep_get_drvinfo(struct net_device *dev,
64 struct ethtool_drvinfo *drvinfo) 65 struct ethtool_drvinfo *drvinfo)
@@ -179,6 +180,7 @@ static void mlx5e_rep_update_sw_counters(struct mlx5e_priv *priv)
179 180
180 s->tx_packets += sq_stats->packets; 181 s->tx_packets += sq_stats->packets;
181 s->tx_bytes += sq_stats->bytes; 182 s->tx_bytes += sq_stats->bytes;
183 s->tx_queue_dropped += sq_stats->dropped;
182 } 184 }
183 } 185 }
184} 186}
@@ -663,7 +665,7 @@ static void mlx5e_rep_indr_clean_block_privs(struct mlx5e_rep_priv *rpriv)
663 struct list_head *head = &rpriv->uplink_priv.tc_indr_block_priv_list; 665 struct list_head *head = &rpriv->uplink_priv.tc_indr_block_priv_list;
664 666
665 list_for_each_entry_safe(cb_priv, temp, head, list) { 667 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);
667 kfree(cb_priv); 669 kfree(cb_priv);
668 } 670 }
669} 671}
@@ -735,7 +737,7 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev,
735 737
736 err = tcf_block_cb_register(f->block, 738 err = tcf_block_cb_register(f->block,
737 mlx5e_rep_indr_setup_block_cb, 739 mlx5e_rep_indr_setup_block_cb,
738 netdev, indr_priv, f->extack); 740 indr_priv, indr_priv, f->extack);
739 if (err) { 741 if (err) {
740 list_del(&indr_priv->list); 742 list_del(&indr_priv->list);
741 kfree(indr_priv); 743 kfree(indr_priv);
@@ -743,14 +745,15 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev,
743 745
744 return err; 746 return err;
745 case TC_BLOCK_UNBIND: 747 case TC_BLOCK_UNBIND:
748 indr_priv = mlx5e_rep_indr_block_priv_lookup(rpriv, netdev);
749 if (!indr_priv)
750 return -ENOENT;
751
746 tcf_block_cb_unregister(f->block, 752 tcf_block_cb_unregister(f->block,
747 mlx5e_rep_indr_setup_block_cb, 753 mlx5e_rep_indr_setup_block_cb,
748 netdev); 754 indr_priv);
749 indr_priv = mlx5e_rep_indr_block_priv_lookup(rpriv, netdev); 755 list_del(&indr_priv->list);
750 if (indr_priv) { 756 kfree(indr_priv);
751 list_del(&indr_priv->list);
752 kfree(indr_priv);
753 }
754 757
755 return 0; 758 return 0;
756 default: 759 default:
@@ -779,7 +782,7 @@ static int mlx5e_rep_indr_register_block(struct mlx5e_rep_priv *rpriv,
779 782
780 err = __tc_indr_block_cb_register(netdev, rpriv, 783 err = __tc_indr_block_cb_register(netdev, rpriv,
781 mlx5e_rep_indr_setup_tc_cb, 784 mlx5e_rep_indr_setup_tc_cb,
782 netdev); 785 rpriv);
783 if (err) { 786 if (err) {
784 struct mlx5e_priv *priv = netdev_priv(rpriv->netdev); 787 struct mlx5e_priv *priv = netdev_priv(rpriv->netdev);
785 788
@@ -789,10 +792,11 @@ static int mlx5e_rep_indr_register_block(struct mlx5e_rep_priv *rpriv,
789 return err; 792 return err;
790} 793}
791 794
792static void mlx5e_rep_indr_unregister_block(struct net_device *netdev) 795static void mlx5e_rep_indr_unregister_block(struct mlx5e_rep_priv *rpriv,
796 struct net_device *netdev)
793{ 797{
794 __tc_indr_block_cb_unregister(netdev, mlx5e_rep_indr_setup_tc_cb, 798 __tc_indr_block_cb_unregister(netdev, mlx5e_rep_indr_setup_tc_cb,
795 netdev); 799 rpriv);
796} 800}
797 801
798static int mlx5e_nic_rep_netdevice_event(struct notifier_block *nb, 802static 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,
811 mlx5e_rep_indr_register_block(rpriv, netdev); 815 mlx5e_rep_indr_register_block(rpriv, netdev);
812 break; 816 break;
813 case NETDEV_UNREGISTER: 817 case NETDEV_UNREGISTER:
814 mlx5e_rep_indr_unregister_block(netdev); 818 mlx5e_rep_indr_unregister_block(rpriv, netdev);
815 break; 819 break;
816 } 820 }
817 return NOTIFY_OK; 821 return NOTIFY_OK;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index 1d0bb5ff8c26..f86e4804e83e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -732,6 +732,8 @@ static u8 get_ip_proto(struct sk_buff *skb, int network_depth, __be16 proto)
732 ((struct ipv6hdr *)ip_p)->nexthdr; 732 ((struct ipv6hdr *)ip_p)->nexthdr;
733} 733}
734 734
735#define short_frame(size) ((size) <= ETH_ZLEN + ETH_FCS_LEN)
736
735static inline void mlx5e_handle_csum(struct net_device *netdev, 737static inline void mlx5e_handle_csum(struct net_device *netdev,
736 struct mlx5_cqe64 *cqe, 738 struct mlx5_cqe64 *cqe,
737 struct mlx5e_rq *rq, 739 struct mlx5e_rq *rq,
@@ -754,6 +756,17 @@ static inline void mlx5e_handle_csum(struct net_device *netdev,
754 if (unlikely(test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state))) 756 if (unlikely(test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state)))
755 goto csum_unnecessary; 757 goto csum_unnecessary;
756 758
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
757 if (likely(is_last_ethertype_ip(skb, &network_depth, &proto))) { 770 if (likely(is_last_ethertype_ip(skb, &network_depth, &proto))) {
758 if (unlikely(get_ip_proto(skb, network_depth, proto) == IPPROTO_SCTP)) 771 if (unlikely(get_ip_proto(skb, network_depth, proto) == IPPROTO_SCTP))
759 goto csum_unnecessary; 772 goto csum_unnecessary;
diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c
index 66b8098c6fd2..a2321fe8d6a0 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/pci.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c
@@ -604,29 +604,31 @@ static void mlxsw_pci_cq_tasklet(unsigned long data)
604 u16 wqe_counter = mlxsw_pci_cqe_wqe_counter_get(cqe); 604 u16 wqe_counter = mlxsw_pci_cqe_wqe_counter_get(cqe);
605 u8 sendq = mlxsw_pci_cqe_sr_get(q->u.cq.v, cqe); 605 u8 sendq = mlxsw_pci_cqe_sr_get(q->u.cq.v, cqe);
606 u8 dqn = mlxsw_pci_cqe_dqn_get(q->u.cq.v, cqe); 606 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);
607 611
608 if (sendq) { 612 if (sendq) {
609 struct mlxsw_pci_queue *sdq; 613 struct mlxsw_pci_queue *sdq;
610 614
611 sdq = mlxsw_pci_sdq_get(mlxsw_pci, dqn); 615 sdq = mlxsw_pci_sdq_get(mlxsw_pci, dqn);
612 mlxsw_pci_cqe_sdq_handle(mlxsw_pci, sdq, 616 mlxsw_pci_cqe_sdq_handle(mlxsw_pci, sdq,
613 wqe_counter, cqe); 617 wqe_counter, ncqe);
614 q->u.cq.comp_sdq_count++; 618 q->u.cq.comp_sdq_count++;
615 } else { 619 } else {
616 struct mlxsw_pci_queue *rdq; 620 struct mlxsw_pci_queue *rdq;
617 621
618 rdq = mlxsw_pci_rdq_get(mlxsw_pci, dqn); 622 rdq = mlxsw_pci_rdq_get(mlxsw_pci, dqn);
619 mlxsw_pci_cqe_rdq_handle(mlxsw_pci, rdq, 623 mlxsw_pci_cqe_rdq_handle(mlxsw_pci, rdq,
620 wqe_counter, q->u.cq.v, cqe); 624 wqe_counter, q->u.cq.v, ncqe);
621 q->u.cq.comp_rdq_count++; 625 q->u.cq.comp_rdq_count++;
622 } 626 }
623 if (++items == credits) 627 if (++items == credits)
624 break; 628 break;
625 } 629 }
626 if (items) { 630 if (items)
627 mlxsw_pci_queue_doorbell_consumer_ring(mlxsw_pci, q);
628 mlxsw_pci_queue_doorbell_arm_consumer_ring(mlxsw_pci, q); 631 mlxsw_pci_queue_doorbell_arm_consumer_ring(mlxsw_pci, q);
629 }
630} 632}
631 633
632static u16 mlxsw_pci_cq_elem_count(const struct mlxsw_pci_queue *q) 634static 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,
1365 u32 val = mlxsw_pci_read32(mlxsw_pci, FW_READY); 1367 u32 val = mlxsw_pci_read32(mlxsw_pci, FW_READY);
1366 1368
1367 if ((val & MLXSW_PCI_FW_READY_MASK) == MLXSW_PCI_FW_READY_MAGIC) 1369 if ((val & MLXSW_PCI_FW_READY_MASK) == MLXSW_PCI_FW_READY_MAGIC)
1368 break; 1370 return 0;
1369 cond_resched(); 1371 cond_resched();
1370 } while (time_before(jiffies, end)); 1372 } while (time_before(jiffies, end));
1371 return 0; 1373 return -EBUSY;
1372} 1374}
1373 1375
1374static int mlxsw_pci_alloc_irq_vectors(struct mlxsw_pci *mlxsw_pci) 1376static int mlxsw_pci_alloc_irq_vectors(struct mlxsw_pci *mlxsw_pci)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci_hw.h b/drivers/net/ethernet/mellanox/mlxsw/pci_hw.h
index bb99f6d41fe0..ffee38e36ce8 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/pci_hw.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/pci_hw.h
@@ -27,7 +27,7 @@
27 27
28#define MLXSW_PCI_SW_RESET 0xF0010 28#define MLXSW_PCI_SW_RESET 0xF0010
29#define MLXSW_PCI_SW_RESET_RST_BIT BIT(0) 29#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
31#define MLXSW_PCI_SW_RESET_WAIT_MSECS 100 31#define MLXSW_PCI_SW_RESET_WAIT_MSECS 100
32#define MLXSW_PCI_FW_READY 0xA1844 32#define MLXSW_PCI_FW_READY 0xA1844
33#define MLXSW_PCI_FW_READY_MASK 0xFFFF 33#define MLXSW_PCI_FW_READY_MASK 0xFFFF
@@ -53,6 +53,7 @@
53#define MLXSW_PCI_WQE_SIZE 32 /* 32 bytes per element */ 53#define MLXSW_PCI_WQE_SIZE 32 /* 32 bytes per element */
54#define MLXSW_PCI_CQE01_SIZE 16 /* 16 bytes per element */ 54#define MLXSW_PCI_CQE01_SIZE 16 /* 16 bytes per element */
55#define MLXSW_PCI_CQE2_SIZE 32 /* 32 bytes per element */ 55#define MLXSW_PCI_CQE2_SIZE 32 /* 32 bytes per element */
56#define MLXSW_PCI_CQE_SIZE_MAX MLXSW_PCI_CQE2_SIZE
56#define MLXSW_PCI_EQE_SIZE 16 /* 16 bytes per element */ 57#define MLXSW_PCI_EQE_SIZE 16 /* 16 bytes per element */
57#define MLXSW_PCI_WQE_COUNT (MLXSW_PCI_AQ_SIZE / MLXSW_PCI_WQE_SIZE) 58#define MLXSW_PCI_WQE_COUNT (MLXSW_PCI_AQ_SIZE / MLXSW_PCI_WQE_SIZE)
58#define MLXSW_PCI_CQE01_COUNT (MLXSW_PCI_AQ_SIZE / MLXSW_PCI_CQE01_SIZE) 59#define MLXSW_PCI_CQE01_COUNT (MLXSW_PCI_AQ_SIZE / MLXSW_PCI_CQE01_SIZE)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c
index 055cc6943b34..9d9aa28684af 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c
@@ -997,8 +997,8 @@ static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_dummy_ops = {
997static const struct mlxsw_sp_fid_family mlxsw_sp_fid_dummy_family = { 997static const struct mlxsw_sp_fid_family mlxsw_sp_fid_dummy_family = {
998 .type = MLXSW_SP_FID_TYPE_DUMMY, 998 .type = MLXSW_SP_FID_TYPE_DUMMY,
999 .fid_size = sizeof(struct mlxsw_sp_fid), 999 .fid_size = sizeof(struct mlxsw_sp_fid),
1000 .start_index = MLXSW_SP_RFID_BASE - 1, 1000 .start_index = VLAN_N_VID - 1,
1001 .end_index = MLXSW_SP_RFID_BASE - 1, 1001 .end_index = VLAN_N_VID - 1,
1002 .ops = &mlxsw_sp_fid_dummy_ops, 1002 .ops = &mlxsw_sp_fid_dummy_ops,
1003}; 1003};
1004 1004
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index 0abbaa0fbf14..c772109b638d 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -1233,7 +1233,7 @@ mlxsw_sp_bridge_port_fdb_flush(struct mlxsw_sp *mlxsw_sp,
1233static enum mlxsw_reg_sfd_rec_policy mlxsw_sp_sfd_rec_policy(bool dynamic) 1233static enum mlxsw_reg_sfd_rec_policy mlxsw_sp_sfd_rec_policy(bool dynamic)
1234{ 1234{
1235 return dynamic ? MLXSW_REG_SFD_REC_POLICY_DYNAMIC_ENTRY_INGRESS : 1235 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;
1237} 1237}
1238 1238
1239static enum mlxsw_reg_sfd_op mlxsw_sp_sfd_op(bool adding) 1239static enum mlxsw_reg_sfd_op mlxsw_sp_sfd_op(bool adding)
@@ -1290,7 +1290,7 @@ out:
1290static int __mlxsw_sp_port_fdb_uc_op(struct mlxsw_sp *mlxsw_sp, u8 local_port, 1290static int __mlxsw_sp_port_fdb_uc_op(struct mlxsw_sp *mlxsw_sp, u8 local_port,
1291 const char *mac, u16 fid, bool adding, 1291 const char *mac, u16 fid, bool adding,
1292 enum mlxsw_reg_sfd_rec_action action, 1292 enum mlxsw_reg_sfd_rec_action action,
1293 bool dynamic) 1293 enum mlxsw_reg_sfd_rec_policy policy)
1294{ 1294{
1295 char *sfd_pl; 1295 char *sfd_pl;
1296 u8 num_rec; 1296 u8 num_rec;
@@ -1301,8 +1301,7 @@ static int __mlxsw_sp_port_fdb_uc_op(struct mlxsw_sp *mlxsw_sp, u8 local_port,
1301 return -ENOMEM; 1301 return -ENOMEM;
1302 1302
1303 mlxsw_reg_sfd_pack(sfd_pl, mlxsw_sp_sfd_op(adding), 0); 1303 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), 1304 mlxsw_reg_sfd_uc_pack(sfd_pl, 0, policy, mac, fid, action, local_port);
1305 mac, fid, action, local_port);
1306 num_rec = mlxsw_reg_sfd_num_rec_get(sfd_pl); 1305 num_rec = mlxsw_reg_sfd_num_rec_get(sfd_pl);
1307 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfd), sfd_pl); 1306 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfd), sfd_pl);
1308 if (err) 1307 if (err)
@@ -1321,7 +1320,8 @@ static int mlxsw_sp_port_fdb_uc_op(struct mlxsw_sp *mlxsw_sp, u8 local_port,
1321 bool dynamic) 1320 bool dynamic)
1322{ 1321{
1323 return __mlxsw_sp_port_fdb_uc_op(mlxsw_sp, local_port, mac, fid, adding, 1322 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));
1325} 1325}
1326 1326
1327int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid, 1327int 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,
1329{ 1329{
1330 return __mlxsw_sp_port_fdb_uc_op(mlxsw_sp, 0, mac, fid, adding, 1330 return __mlxsw_sp_port_fdb_uc_op(mlxsw_sp, 0, mac, fid, adding,
1331 MLXSW_REG_SFD_REC_ACTION_FORWARD_IP_ROUTER, 1331 MLXSW_REG_SFD_REC_ACTION_FORWARD_IP_ROUTER,
1332 false); 1332 MLXSW_REG_SFD_REC_POLICY_STATIC_ENTRY);
1333} 1333}
1334 1334
1335static int mlxsw_sp_port_fdb_uc_lag_op(struct mlxsw_sp *mlxsw_sp, u16 lag_id, 1335static int mlxsw_sp_port_fdb_uc_lag_op(struct mlxsw_sp *mlxsw_sp, u16 lag_id,
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index fc726ce4c164..6d067176320f 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -337,7 +337,7 @@ static void macvlan_process_broadcast(struct work_struct *w)
337 337
338 if (src) 338 if (src)
339 dev_put(src->dev); 339 dev_put(src->dev);
340 kfree_skb(skb); 340 consume_skb(skb);
341 } 341 }
342} 342}
343 343
diff --git a/drivers/net/phy/bcm87xx.c b/drivers/net/phy/bcm87xx.c
index 1b350183bffb..a271239748f2 100644
--- a/drivers/net/phy/bcm87xx.c
+++ b/drivers/net/phy/bcm87xx.c
@@ -197,6 +197,7 @@ static struct phy_driver bcm87xx_driver[] = {
197 .phy_id = PHY_ID_BCM8706, 197 .phy_id = PHY_ID_BCM8706,
198 .phy_id_mask = 0xffffffff, 198 .phy_id_mask = 0xffffffff,
199 .name = "Broadcom BCM8706", 199 .name = "Broadcom BCM8706",
200 .features = PHY_10GBIT_FEC_FEATURES,
200 .config_init = bcm87xx_config_init, 201 .config_init = bcm87xx_config_init,
201 .config_aneg = bcm87xx_config_aneg, 202 .config_aneg = bcm87xx_config_aneg,
202 .read_status = bcm87xx_read_status, 203 .read_status = bcm87xx_read_status,
@@ -208,6 +209,7 @@ static struct phy_driver bcm87xx_driver[] = {
208 .phy_id = PHY_ID_BCM8727, 209 .phy_id = PHY_ID_BCM8727,
209 .phy_id_mask = 0xffffffff, 210 .phy_id_mask = 0xffffffff,
210 .name = "Broadcom BCM8727", 211 .name = "Broadcom BCM8727",
212 .features = PHY_10GBIT_FEC_FEATURES,
211 .config_init = bcm87xx_config_init, 213 .config_init = bcm87xx_config_init,
212 .config_aneg = bcm87xx_config_aneg, 214 .config_aneg = bcm87xx_config_aneg,
213 .read_status = bcm87xx_read_status, 215 .read_status = bcm87xx_read_status,
diff --git a/drivers/net/phy/cortina.c b/drivers/net/phy/cortina.c
index 8022cd317f62..1a4d04afb7f0 100644
--- a/drivers/net/phy/cortina.c
+++ b/drivers/net/phy/cortina.c
@@ -88,6 +88,7 @@ static struct phy_driver cortina_driver[] = {
88 .phy_id = PHY_ID_CS4340, 88 .phy_id = PHY_ID_CS4340,
89 .phy_id_mask = 0xffffffff, 89 .phy_id_mask = 0xffffffff,
90 .name = "Cortina CS4340", 90 .name = "Cortina CS4340",
91 .features = PHY_10GBIT_FEATURES,
91 .config_init = gen10g_config_init, 92 .config_init = gen10g_config_init,
92 .config_aneg = gen10g_config_aneg, 93 .config_aneg = gen10g_config_aneg,
93 .read_status = cortina_read_status, 94 .read_status = cortina_read_status,
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index a9c7c7f41b0c..2e12f982534f 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -1046,6 +1046,39 @@ static int m88e1145_config_init(struct phy_device *phydev)
1046 return 0; 1046 return 0;
1047} 1047}
1048 1048
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 */
1053static 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
1071static 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
1049/** 1082/**
1050 * fiber_lpa_mod_linkmode_lpa_t 1083 * fiber_lpa_mod_linkmode_lpa_t
1051 * @advertising: the linkmode advertisement settings 1084 * @advertising: the linkmode advertisement settings
@@ -1402,7 +1435,7 @@ static int m88e1318_set_wol(struct phy_device *phydev,
1402 * before enabling it if !phy_interrupt_is_valid() 1435 * before enabling it if !phy_interrupt_is_valid()
1403 */ 1436 */
1404 if (!phy_interrupt_is_valid(phydev)) 1437 if (!phy_interrupt_is_valid(phydev))
1405 phy_read(phydev, MII_M1011_IEVENT); 1438 __phy_read(phydev, MII_M1011_IEVENT);
1406 1439
1407 /* Enable the WOL interrupt */ 1440 /* Enable the WOL interrupt */
1408 err = __phy_modify(phydev, MII_88E1318S_PHY_CSIER, 0, 1441 err = __phy_modify(phydev, MII_88E1318S_PHY_CSIER, 0,
@@ -2283,7 +2316,7 @@ static struct phy_driver marvell_drivers[] = {
2283 .features = PHY_GBIT_FEATURES, 2316 .features = PHY_GBIT_FEATURES,
2284 .probe = m88e6390_probe, 2317 .probe = m88e6390_probe,
2285 .config_init = &marvell_config_init, 2318 .config_init = &marvell_config_init,
2286 .config_aneg = &m88e1510_config_aneg, 2319 .config_aneg = &m88e6390_config_aneg,
2287 .read_status = &marvell_read_status, 2320 .read_status = &marvell_read_status,
2288 .ack_interrupt = &marvell_ack_interrupt, 2321 .ack_interrupt = &marvell_ack_interrupt,
2289 .config_intr = &marvell_config_intr, 2322 .config_intr = &marvell_config_intr,
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 2e59a8419b17..66b9cfe692fc 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -390,6 +390,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
390 if (IS_ERR(gpiod)) { 390 if (IS_ERR(gpiod)) {
391 dev_err(&bus->dev, "mii_bus %s couldn't get reset GPIO\n", 391 dev_err(&bus->dev, "mii_bus %s couldn't get reset GPIO\n",
392 bus->id); 392 bus->id);
393 device_del(&bus->dev);
393 return PTR_ERR(gpiod); 394 return PTR_ERR(gpiod);
394 } else if (gpiod) { 395 } else if (gpiod) {
395 bus->reset_gpiod = gpiod; 396 bus->reset_gpiod = gpiod;
diff --git a/drivers/net/phy/meson-gxl.c b/drivers/net/phy/meson-gxl.c
index b03bcf2c388a..3ddaf9595697 100644
--- a/drivers/net/phy/meson-gxl.c
+++ b/drivers/net/phy/meson-gxl.c
@@ -233,6 +233,7 @@ static struct phy_driver meson_gxl_phy[] = {
233 .name = "Meson GXL Internal PHY", 233 .name = "Meson GXL Internal PHY",
234 .features = PHY_BASIC_FEATURES, 234 .features = PHY_BASIC_FEATURES,
235 .flags = PHY_IS_INTERNAL, 235 .flags = PHY_IS_INTERNAL,
236 .soft_reset = genphy_soft_reset,
236 .config_init = meson_gxl_config_init, 237 .config_init = meson_gxl_config_init,
237 .aneg_done = genphy_aneg_done, 238 .aneg_done = genphy_aneg_done,
238 .read_status = meson_gxl_read_status, 239 .read_status = meson_gxl_read_status,
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index c33384710d26..b1f959935f50 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -1070,6 +1070,7 @@ static struct phy_driver ksphy_driver[] = {
1070 .driver_data = &ksz9021_type, 1070 .driver_data = &ksz9021_type,
1071 .probe = kszphy_probe, 1071 .probe = kszphy_probe,
1072 .config_init = ksz9031_config_init, 1072 .config_init = ksz9031_config_init,
1073 .soft_reset = genphy_soft_reset,
1073 .read_status = ksz9031_read_status, 1074 .read_status = ksz9031_read_status,
1074 .ack_interrupt = kszphy_ack_interrupt, 1075 .ack_interrupt = kszphy_ack_interrupt,
1075 .config_intr = kszphy_config_intr, 1076 .config_intr = kszphy_config_intr,
@@ -1098,6 +1099,7 @@ static struct phy_driver ksphy_driver[] = {
1098 .phy_id = PHY_ID_KSZ8873MLL, 1099 .phy_id = PHY_ID_KSZ8873MLL,
1099 .phy_id_mask = MICREL_PHY_ID_MASK, 1100 .phy_id_mask = MICREL_PHY_ID_MASK,
1100 .name = "Micrel KSZ8873MLL Switch", 1101 .name = "Micrel KSZ8873MLL Switch",
1102 .features = PHY_BASIC_FEATURES,
1101 .config_init = kszphy_config_init, 1103 .config_init = kszphy_config_init,
1102 .config_aneg = ksz8873mll_config_aneg, 1104 .config_aneg = ksz8873mll_config_aneg,
1103 .read_status = ksz8873mll_read_status, 1105 .read_status = ksz8873mll_read_status,
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index d33e7b3caf03..189cd2048c3a 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -543,13 +543,6 @@ int phy_start_aneg(struct phy_device *phydev)
543 543
544 mutex_lock(&phydev->lock); 544 mutex_lock(&phydev->lock);
545 545
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
553 if (AUTONEG_DISABLE == phydev->autoneg) 546 if (AUTONEG_DISABLE == phydev->autoneg)
554 phy_sanitize_settings(phydev); 547 phy_sanitize_settings(phydev);
555 548
@@ -560,11 +553,13 @@ int phy_start_aneg(struct phy_device *phydev)
560 if (err < 0) 553 if (err < 0)
561 goto out_unlock; 554 goto out_unlock;
562 555
563 if (phydev->autoneg == AUTONEG_ENABLE) { 556 if (__phy_is_started(phydev)) {
564 err = phy_check_link_status(phydev); 557 if (phydev->autoneg == AUTONEG_ENABLE) {
565 } else { 558 err = phy_check_link_status(phydev);
566 phydev->state = PHY_FORCING; 559 } else {
567 phydev->link_timeout = PHY_FORCE_TIMEOUT; 560 phydev->state = PHY_FORCING;
561 phydev->link_timeout = PHY_FORCE_TIMEOUT;
562 }
568 } 563 }
569 564
570out_unlock: 565out_unlock:
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 51990002d495..46c86725a693 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -61,6 +61,9 @@ EXPORT_SYMBOL_GPL(phy_gbit_all_ports_features);
61__ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_features) __ro_after_init; 61__ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_features) __ro_after_init;
62EXPORT_SYMBOL_GPL(phy_10gbit_features); 62EXPORT_SYMBOL_GPL(phy_10gbit_features);
63 63
64__ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_fec_features) __ro_after_init;
65EXPORT_SYMBOL_GPL(phy_10gbit_fec_features);
66
64static const int phy_basic_ports_array[] = { 67static const int phy_basic_ports_array[] = {
65 ETHTOOL_LINK_MODE_Autoneg_BIT, 68 ETHTOOL_LINK_MODE_Autoneg_BIT,
66 ETHTOOL_LINK_MODE_TP_BIT, 69 ETHTOOL_LINK_MODE_TP_BIT,
@@ -109,6 +112,11 @@ const int phy_10gbit_features_array[1] = {
109}; 112};
110EXPORT_SYMBOL_GPL(phy_10gbit_features_array); 113EXPORT_SYMBOL_GPL(phy_10gbit_features_array);
111 114
115const int phy_10gbit_fec_features_array[1] = {
116 ETHTOOL_LINK_MODE_10000baseR_FEC_BIT,
117};
118EXPORT_SYMBOL_GPL(phy_10gbit_fec_features_array);
119
112__ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_full_features) __ro_after_init; 120__ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_full_features) __ro_after_init;
113EXPORT_SYMBOL_GPL(phy_10gbit_full_features); 121EXPORT_SYMBOL_GPL(phy_10gbit_full_features);
114 122
@@ -191,6 +199,10 @@ static void features_init(void)
191 linkmode_set_bit_array(phy_10gbit_full_features_array, 199 linkmode_set_bit_array(phy_10gbit_full_features_array,
192 ARRAY_SIZE(phy_10gbit_full_features_array), 200 ARRAY_SIZE(phy_10gbit_full_features_array),
193 phy_10gbit_full_features); 201 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);
194} 206}
195 207
196void phy_device_free(struct phy_device *phydev) 208void phy_device_free(struct phy_device *phydev)
@@ -2243,6 +2255,11 @@ int phy_driver_register(struct phy_driver *new_driver, struct module *owner)
2243{ 2255{
2244 int retval; 2256 int retval;
2245 2257
2258 if (WARN_ON(!new_driver->features)) {
2259 pr_err("%s: Driver features are missing\n", new_driver->name);
2260 return -EINVAL;
2261 }
2262
2246 new_driver->mdiodrv.flags |= MDIO_DEVICE_IS_PHY; 2263 new_driver->mdiodrv.flags |= MDIO_DEVICE_IS_PHY;
2247 new_driver->mdiodrv.driver.name = new_driver->name; 2264 new_driver->mdiodrv.driver.name = new_driver->name;
2248 new_driver->mdiodrv.driver.bus = &mdio_bus_type; 2265 new_driver->mdiodrv.driver.bus = &mdio_bus_type;
diff --git a/drivers/net/phy/teranetics.c b/drivers/net/phy/teranetics.c
index 22f3bdd8206c..91247182bc52 100644
--- a/drivers/net/phy/teranetics.c
+++ b/drivers/net/phy/teranetics.c
@@ -80,6 +80,7 @@ static struct phy_driver teranetics_driver[] = {
80 .phy_id = PHY_ID_TN2020, 80 .phy_id = PHY_ID_TN2020,
81 .phy_id_mask = 0xffffffff, 81 .phy_id_mask = 0xffffffff,
82 .name = "Teranetics TN2020", 82 .name = "Teranetics TN2020",
83 .features = PHY_10GBIT_FEATURES,
83 .soft_reset = gen10g_no_soft_reset, 84 .soft_reset = gen10g_no_soft_reset,
84 .aneg_done = teranetics_aneg_done, 85 .aneg_done = teranetics_aneg_done,
85 .config_init = gen10g_config_init, 86 .config_init = gen10g_config_init,
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index 62dc564b251d..f22639f0116a 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -445,6 +445,7 @@ static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev,
445 if (pskb_trim_rcsum(skb, len)) 445 if (pskb_trim_rcsum(skb, len))
446 goto drop; 446 goto drop;
447 447
448 ph = pppoe_hdr(skb);
448 pn = pppoe_pernet(dev_net(dev)); 449 pn = pppoe_pernet(dev_net(dev));
449 450
450 /* Note that get_item does a sock_hold(), so sk_pppox(po) 451 /* Note that get_item does a sock_hold(), so sk_pppox(po)
diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c
index 57f1c94fca0b..820a2fe7d027 100644
--- a/drivers/net/usb/aqc111.c
+++ b/drivers/net/usb/aqc111.c
@@ -1287,6 +1287,20 @@ static const struct driver_info asix112_info = {
1287 1287
1288#undef ASIX112_DESC 1288#undef ASIX112_DESC
1289 1289
1290static 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
1290static int aqc111_suspend(struct usb_interface *intf, pm_message_t message) 1304static int aqc111_suspend(struct usb_interface *intf, pm_message_t message)
1291{ 1305{
1292 struct usbnet *dev = usb_get_intfdata(intf); 1306 struct usbnet *dev = usb_get_intfdata(intf);
@@ -1440,6 +1454,7 @@ static const struct usb_device_id products[] = {
1440 {AQC111_USB_ETH_DEV(0x2eca, 0xc101, aqc111_info)}, 1454 {AQC111_USB_ETH_DEV(0x2eca, 0xc101, aqc111_info)},
1441 {AQC111_USB_ETH_DEV(0x0b95, 0x2790, asix111_info)}, 1455 {AQC111_USB_ETH_DEV(0x0b95, 0x2790, asix111_info)},
1442 {AQC111_USB_ETH_DEV(0x0b95, 0x2791, asix112_info)}, 1456 {AQC111_USB_ETH_DEV(0x0b95, 0x2791, asix112_info)},
1457 {AQC111_USB_ETH_DEV(0x20f4, 0xe05a, trendnet_info)},
1443 { },/* END */ 1458 { },/* END */
1444}; 1459};
1445MODULE_DEVICE_TABLE(usb, products); 1460MODULE_DEVICE_TABLE(usb, products);
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 3305f23793c7..5512a1038721 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -843,6 +843,14 @@ static const struct usb_device_id products[] = {
843 .driver_info = 0, 843 .driver_info = 0,
844}, 844},
845 845
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
846/* WHITELIST!!! 854/* WHITELIST!!!
847 * 855 *
848 * CDC Ether uses two interfaces, not necessarily consecutive. 856 * CDC Ether uses two interfaces, not necessarily consecutive.
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 023725086046..8fadd8eaf601 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1330,7 +1330,7 @@ static int virtnet_receive(struct receive_queue *rq, int budget,
1330 return stats.packets; 1330 return stats.packets;
1331} 1331}
1332 1332
1333static void free_old_xmit_skbs(struct send_queue *sq) 1333static void free_old_xmit_skbs(struct send_queue *sq, bool in_napi)
1334{ 1334{
1335 struct sk_buff *skb; 1335 struct sk_buff *skb;
1336 unsigned int len; 1336 unsigned int len;
@@ -1343,7 +1343,7 @@ static void free_old_xmit_skbs(struct send_queue *sq)
1343 bytes += skb->len; 1343 bytes += skb->len;
1344 packets++; 1344 packets++;
1345 1345
1346 dev_consume_skb_any(skb); 1346 napi_consume_skb(skb, in_napi);
1347 } 1347 }
1348 1348
1349 /* Avoid overhead when no packets have been processed 1349 /* Avoid overhead when no packets have been processed
@@ -1369,7 +1369,7 @@ static void virtnet_poll_cleantx(struct receive_queue *rq)
1369 return; 1369 return;
1370 1370
1371 if (__netif_tx_trylock(txq)) { 1371 if (__netif_tx_trylock(txq)) {
1372 free_old_xmit_skbs(sq); 1372 free_old_xmit_skbs(sq, true);
1373 __netif_tx_unlock(txq); 1373 __netif_tx_unlock(txq);
1374 } 1374 }
1375 1375
@@ -1445,7 +1445,7 @@ static int virtnet_poll_tx(struct napi_struct *napi, int budget)
1445 struct netdev_queue *txq = netdev_get_tx_queue(vi->dev, vq2txq(sq->vq)); 1445 struct netdev_queue *txq = netdev_get_tx_queue(vi->dev, vq2txq(sq->vq));
1446 1446
1447 __netif_tx_lock(txq, raw_smp_processor_id()); 1447 __netif_tx_lock(txq, raw_smp_processor_id());
1448 free_old_xmit_skbs(sq); 1448 free_old_xmit_skbs(sq, true);
1449 __netif_tx_unlock(txq); 1449 __netif_tx_unlock(txq);
1450 1450
1451 virtqueue_napi_complete(napi, sq->vq, 0); 1451 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)
1514 bool use_napi = sq->napi.weight; 1514 bool use_napi = sq->napi.weight;
1515 1515
1516 /* Free up any pending old buffers before queueing new ones. */ 1516 /* Free up any pending old buffers before queueing new ones. */
1517 free_old_xmit_skbs(sq); 1517 free_old_xmit_skbs(sq, false);
1518 1518
1519 if (use_napi && kick) 1519 if (use_napi && kick)
1520 virtqueue_enable_cb_delayed(sq->vq); 1520 virtqueue_enable_cb_delayed(sq->vq);
@@ -1557,7 +1557,7 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
1557 if (!use_napi && 1557 if (!use_napi &&
1558 unlikely(!virtqueue_enable_cb_delayed(sq->vq))) { 1558 unlikely(!virtqueue_enable_cb_delayed(sq->vq))) {
1559 /* More just got used, free them then recheck. */ 1559 /* More just got used, free them then recheck. */
1560 free_old_xmit_skbs(sq); 1560 free_old_xmit_skbs(sq, false);
1561 if (sq->vq->num_free >= 2+MAX_SKB_FRAGS) { 1561 if (sq->vq->num_free >= 2+MAX_SKB_FRAGS) {
1562 netif_start_subqueue(dev, qnum); 1562 netif_start_subqueue(dev, qnum);
1563 virtqueue_disable_cb(sq->vq); 1563 virtqueue_disable_cb(sq->vq);
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 36f3d0f49e60..bca86bf7189f 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -1236,7 +1236,8 @@ static void handle_rx(struct vhost_net *net)
1236 if (nvq->done_idx > VHOST_NET_BATCH) 1236 if (nvq->done_idx > VHOST_NET_BATCH)
1237 vhost_net_signal_used(nvq); 1237 vhost_net_signal_used(nvq);
1238 if (unlikely(vq_log)) 1238 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);
1240 total_len += vhost_len; 1241 total_len += vhost_len;
1241 if (unlikely(vhost_exceeds_weight(++recv_pkts, total_len))) { 1242 if (unlikely(vhost_exceeds_weight(++recv_pkts, total_len))) {
1242 vhost_poll_queue(&vq->poll); 1243 vhost_poll_queue(&vq->poll);
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index bac939af8dbb..15a216cdd507 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -1737,13 +1737,87 @@ static int log_write(void __user *log_base,
1737 return r; 1737 return r;
1738} 1738}
1739 1739
1740static 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
1780static 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
1740int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log, 1803int 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)
1742{ 1805{
1743 int i, r; 1806 int i, r;
1744 1807
1745 /* Make sure data written is seen before log. */ 1808 /* Make sure data written is seen before log. */
1746 smp_wmb(); 1809 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
1747 for (i = 0; i < log_num; ++i) { 1821 for (i = 0; i < log_num; ++i) {
1748 u64 l = min(log[i].len, len); 1822 u64 l = min(log[i].len, len);
1749 r = log_write(vq->log_base, log[i].addr, l); 1823 r = log_write(vq->log_base, log[i].addr, l);
@@ -1773,9 +1847,8 @@ static int vhost_update_used_flags(struct vhost_virtqueue *vq)
1773 smp_wmb(); 1847 smp_wmb();
1774 /* Log used flag write. */ 1848 /* Log used flag write. */
1775 used = &vq->used->flags; 1849 used = &vq->used->flags;
1776 log_write(vq->log_base, vq->log_addr + 1850 log_used(vq, (used - (void __user *)vq->used),
1777 (used - (void __user *)vq->used), 1851 sizeof vq->used->flags);
1778 sizeof vq->used->flags);
1779 if (vq->log_ctx) 1852 if (vq->log_ctx)
1780 eventfd_signal(vq->log_ctx, 1); 1853 eventfd_signal(vq->log_ctx, 1);
1781 } 1854 }
@@ -1793,9 +1866,8 @@ static int vhost_update_avail_event(struct vhost_virtqueue *vq, u16 avail_event)
1793 smp_wmb(); 1866 smp_wmb();
1794 /* Log avail event write */ 1867 /* Log avail event write */
1795 used = vhost_avail_event(vq); 1868 used = vhost_avail_event(vq);
1796 log_write(vq->log_base, vq->log_addr + 1869 log_used(vq, (used - (void __user *)vq->used),
1797 (used - (void __user *)vq->used), 1870 sizeof *vhost_avail_event(vq));
1798 sizeof *vhost_avail_event(vq));
1799 if (vq->log_ctx) 1871 if (vq->log_ctx)
1800 eventfd_signal(vq->log_ctx, 1); 1872 eventfd_signal(vq->log_ctx, 1);
1801 } 1873 }
@@ -2195,10 +2267,8 @@ static int __vhost_add_used_n(struct vhost_virtqueue *vq,
2195 /* Make sure data is seen before log. */ 2267 /* Make sure data is seen before log. */
2196 smp_wmb(); 2268 smp_wmb();
2197 /* Log used ring entry write. */ 2269 /* Log used ring entry write. */
2198 log_write(vq->log_base, 2270 log_used(vq, ((void __user *)used - (void __user *)vq->used),
2199 vq->log_addr + 2271 count * sizeof *used);
2200 ((void __user *)used - (void __user *)vq->used),
2201 count * sizeof *used);
2202 } 2272 }
2203 old = vq->last_used_idx; 2273 old = vq->last_used_idx;
2204 new = (vq->last_used_idx += count); 2274 new = (vq->last_used_idx += count);
@@ -2240,9 +2310,8 @@ int vhost_add_used_n(struct vhost_virtqueue *vq, struct vring_used_elem *heads,
2240 /* Make sure used idx is seen before log. */ 2310 /* Make sure used idx is seen before log. */
2241 smp_wmb(); 2311 smp_wmb();
2242 /* Log used index update. */ 2312 /* Log used index update. */
2243 log_write(vq->log_base, 2313 log_used(vq, offsetof(struct vring_used, idx),
2244 vq->log_addr + offsetof(struct vring_used, idx), 2314 sizeof vq->used->idx);
2245 sizeof vq->used->idx);
2246 if (vq->log_ctx) 2315 if (vq->log_ctx)
2247 eventfd_signal(vq->log_ctx, 1); 2316 eventfd_signal(vq->log_ctx, 1);
2248 } 2317 }
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index 466ef7542291..1b675dad5e05 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -205,7 +205,8 @@ bool vhost_vq_avail_empty(struct vhost_dev *, struct vhost_virtqueue *);
205bool vhost_enable_notify(struct vhost_dev *, struct vhost_virtqueue *); 205bool vhost_enable_notify(struct vhost_dev *, struct vhost_virtqueue *);
206 206
207int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log, 207int 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);
209int vq_iotlb_prefetch(struct vhost_virtqueue *vq); 210int vq_iotlb_prefetch(struct vhost_virtqueue *vq);
210 211
211struct vhost_msg_node *vhost_new_msg(struct vhost_virtqueue *vq, int type); 212struct vhost_msg_node *vhost_new_msg(struct vhost_virtqueue *vq, int type);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 3b051f761450..ef20aeea10cc 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -48,6 +48,7 @@ extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_features) __ro_after_init;
48extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_fibre_features) __ro_after_init; 48extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_fibre_features) __ro_after_init;
49extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_all_ports_features) __ro_after_init; 49extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_all_ports_features) __ro_after_init;
50extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_features) __ro_after_init; 50extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_features) __ro_after_init;
51extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_fec_features) __ro_after_init;
51extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_full_features) __ro_after_init; 52extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_full_features) __ro_after_init;
52 53
53#define PHY_BASIC_FEATURES ((unsigned long *)&phy_basic_features) 54#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
56#define PHY_GBIT_FIBRE_FEATURES ((unsigned long *)&phy_gbit_fibre_features) 57#define PHY_GBIT_FIBRE_FEATURES ((unsigned long *)&phy_gbit_fibre_features)
57#define PHY_GBIT_ALL_PORTS_FEATURES ((unsigned long *)&phy_gbit_all_ports_features) 58#define PHY_GBIT_ALL_PORTS_FEATURES ((unsigned long *)&phy_gbit_all_ports_features)
58#define PHY_10GBIT_FEATURES ((unsigned long *)&phy_10gbit_features) 59#define PHY_10GBIT_FEATURES ((unsigned long *)&phy_10gbit_features)
60#define PHY_10GBIT_FEC_FEATURES ((unsigned long *)&phy_10gbit_fec_features)
59#define PHY_10GBIT_FULL_FEATURES ((unsigned long *)&phy_10gbit_full_features) 61#define PHY_10GBIT_FULL_FEATURES ((unsigned long *)&phy_10gbit_full_features)
60 62
61extern const int phy_10_100_features_array[4]; 63extern const int phy_10_100_features_array[4];
@@ -467,8 +469,8 @@ struct phy_device {
467 * only works for PHYs with IDs which match this field 469 * only works for PHYs with IDs which match this field
468 * name: The friendly name of this PHY type 470 * name: The friendly name of this PHY type
469 * phy_id_mask: Defines the important bits of the phy_id 471 * phy_id_mask: Defines the important bits of the phy_id
470 * features: A list of features (speed, duplex, etc) supported 472 * features: A mandatory list of features (speed, duplex, etc)
471 * by this PHY 473 * supported by this PHY
472 * flags: A bitfield defining certain other features this PHY 474 * flags: A bitfield defining certain other features this PHY
473 * supports (like interrupts) 475 * supports (like interrupts)
474 * 476 *
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 93f56fddd92a..95d25b010a25 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -3218,6 +3218,7 @@ int pskb_trim_rcsum_slow(struct sk_buff *skb, unsigned int len);
3218 * 3218 *
3219 * This is exactly the same as pskb_trim except that it ensures the 3219 * This is exactly the same as pskb_trim except that it ensures the
3220 * checksum of received packets are still valid after the operation. 3220 * checksum of received packets are still valid after the operation.
3221 * It can change skb pointers.
3221 */ 3222 */
3222 3223
3223static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) 3224static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
diff --git a/include/net/af_rxrpc.h b/include/net/af_rxrpc.h
index 1adefe42c0a6..2bfb87eb98ce 100644
--- a/include/net/af_rxrpc.h
+++ b/include/net/af_rxrpc.h
@@ -21,18 +21,6 @@ struct socket;
21struct rxrpc_call; 21struct rxrpc_call;
22 22
23/* 23/*
24 * Call completion condition (state == RXRPC_CALL_COMPLETE).
25 */
26enum 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
35/*
36 * Debug ID counter for tracing. 24 * Debug ID counter for tracing.
37 */ 25 */
38extern atomic_t rxrpc_debug_id; 26extern atomic_t rxrpc_debug_id;
@@ -73,10 +61,6 @@ int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,
73 rxrpc_user_attach_call_t, unsigned long, gfp_t, 61 rxrpc_user_attach_call_t, unsigned long, gfp_t,
74 unsigned int); 62 unsigned int);
75void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64); 63void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64);
76int rxrpc_kernel_retry_call(struct socket *, struct rxrpc_call *,
77 struct sockaddr_rxrpc *, struct key *);
78int rxrpc_kernel_check_call(struct socket *, struct rxrpc_call *,
79 enum rxrpc_call_completion *, u32 *);
80u32 rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *); 64u32 rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *);
81void rxrpc_kernel_probe_life(struct socket *, struct rxrpc_call *); 65void rxrpc_kernel_probe_life(struct socket *, struct rxrpc_call *);
82u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *); 66u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *);
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index c5969762a8f4..9c8214d2116d 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -241,7 +241,7 @@ int fib_table_delete(struct net *, struct fib_table *, struct fib_config *,
241 struct netlink_ext_ack *extack); 241 struct netlink_ext_ack *extack);
242int fib_table_dump(struct fib_table *table, struct sk_buff *skb, 242int fib_table_dump(struct fib_table *table, struct sk_buff *skb,
243 struct netlink_callback *cb, struct fib_dump_filter *filter); 243 struct netlink_callback *cb, struct fib_dump_filter *filter);
244int fib_table_flush(struct net *net, struct fib_table *table); 244int fib_table_flush(struct net *net, struct fib_table *table, bool flush_all);
245struct fib_table *fib_trie_unmerge(struct fib_table *main_tb); 245struct fib_table *fib_trie_unmerge(struct fib_table *main_tb);
246void fib_table_flush_external(struct fib_table *table); 246void fib_table_flush_external(struct fib_table *table);
247void fib_free_table(struct fib_table *tb); 247void fib_free_table(struct fib_table *tb);
diff --git a/include/net/netfilter/nf_flow_table.h b/include/net/netfilter/nf_flow_table.h
index 7d5cda7ce32a..3e370cb36263 100644
--- a/include/net/netfilter/nf_flow_table.h
+++ b/include/net/netfilter/nf_flow_table.h
@@ -84,7 +84,6 @@ struct flow_offload {
84struct nf_flow_route { 84struct nf_flow_route {
85 struct { 85 struct {
86 struct dst_entry *dst; 86 struct dst_entry *dst;
87 int ifindex;
88 } tuple[FLOW_OFFLOAD_DIR_MAX]; 87 } tuple[FLOW_OFFLOAD_DIR_MAX];
89}; 88};
90 89
diff --git a/include/uapi/linux/in.h b/include/uapi/linux/in.h
index f6052e70bf40..a55cb8b10165 100644
--- a/include/uapi/linux/in.h
+++ b/include/uapi/linux/in.h
@@ -268,7 +268,7 @@ struct sockaddr_in {
268#define IN_MULTICAST(a) IN_CLASSD(a) 268#define IN_MULTICAST(a) IN_CLASSD(a)
269#define IN_MULTICAST_NET 0xe0000000 269#define IN_MULTICAST_NET 0xe0000000
270 270
271#define IN_BADCLASS(a) ((((long int) (a) ) == 0xffffffff) 271#define IN_BADCLASS(a) (((long int) (a) ) == (long int)0xffffffff)
272#define IN_EXPERIMENTAL(a) IN_BADCLASS((a)) 272#define IN_EXPERIMENTAL(a) IN_BADCLASS((a))
273 273
274#define IN_CLASSE(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) 274#define IN_CLASSE(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000)
diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index a2f53642592b..befe570be5ba 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -467,7 +467,7 @@ static const struct btf_kind_operations *btf_type_ops(const struct btf_type *t)
467 return kind_ops[BTF_INFO_KIND(t->info)]; 467 return kind_ops[BTF_INFO_KIND(t->info)];
468} 468}
469 469
470bool btf_name_offset_valid(const struct btf *btf, u32 offset) 470static bool btf_name_offset_valid(const struct btf *btf, u32 offset)
471{ 471{
472 return BTF_STR_OFFSET_VALID(offset) && 472 return BTF_STR_OFFSET_VALID(offset) &&
473 offset < btf->hdr.str_len; 473 offset < btf->hdr.str_len;
diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c
index 9425c2fb872f..ab612fe9862f 100644
--- a/kernel/bpf/cgroup.c
+++ b/kernel/bpf/cgroup.c
@@ -718,6 +718,7 @@ cgroup_dev_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
718 case BPF_FUNC_trace_printk: 718 case BPF_FUNC_trace_printk:
719 if (capable(CAP_SYS_ADMIN)) 719 if (capable(CAP_SYS_ADMIN))
720 return bpf_get_trace_printk_proto(); 720 return bpf_get_trace_printk_proto();
721 /* fall through */
721 default: 722 default:
722 return NULL; 723 return NULL;
723 } 724 }
diff --git a/kernel/bpf/map_in_map.c b/kernel/bpf/map_in_map.c
index 99d243e1ad6e..52378d3e34b3 100644
--- a/kernel/bpf/map_in_map.c
+++ b/kernel/bpf/map_in_map.c
@@ -12,6 +12,7 @@
12struct bpf_map *bpf_map_meta_alloc(int inner_map_ufd) 12struct bpf_map *bpf_map_meta_alloc(int inner_map_ufd)
13{ 13{
14 struct bpf_map *inner_map, *inner_map_meta; 14 struct bpf_map *inner_map, *inner_map_meta;
15 u32 inner_map_meta_size;
15 struct fd f; 16 struct fd f;
16 17
17 f = fdget(inner_map_ufd); 18 f = fdget(inner_map_ufd);
@@ -36,7 +37,12 @@ struct bpf_map *bpf_map_meta_alloc(int inner_map_ufd)
36 return ERR_PTR(-EINVAL); 37 return ERR_PTR(-EINVAL);
37 } 38 }
38 39
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);
40 if (!inner_map_meta) { 46 if (!inner_map_meta) {
41 fdput(f); 47 fdput(f);
42 return ERR_PTR(-ENOMEM); 48 return ERR_PTR(-ENOMEM);
@@ -46,9 +52,16 @@ struct bpf_map *bpf_map_meta_alloc(int inner_map_ufd)
46 inner_map_meta->key_size = inner_map->key_size; 52 inner_map_meta->key_size = inner_map->key_size;
47 inner_map_meta->value_size = inner_map->value_size; 53 inner_map_meta->value_size = inner_map->value_size;
48 inner_map_meta->map_flags = inner_map->map_flags; 54 inner_map_meta->map_flags = inner_map->map_flags;
49 inner_map_meta->ops = inner_map->ops;
50 inner_map_meta->max_entries = inner_map->max_entries; 55 inner_map_meta->max_entries = inner_map->max_entries;
51 56
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
52 fdput(f); 65 fdput(f);
53 return inner_map_meta; 66 return inner_map_meta;
54} 67}
diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
index d9e2483669d0..d43b14535827 100644
--- a/kernel/bpf/stackmap.c
+++ b/kernel/bpf/stackmap.c
@@ -180,11 +180,14 @@ static inline int stack_map_parse_build_id(void *page_addr,
180 180
181 if (nhdr->n_type == BPF_BUILD_ID && 181 if (nhdr->n_type == BPF_BUILD_ID &&
182 nhdr->n_namesz == sizeof("GNU") && 182 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) {
184 memcpy(build_id, 185 memcpy(build_id,
185 note_start + note_offs + 186 note_start + note_offs +
186 ALIGN(sizeof("GNU"), 4) + sizeof(Elf32_Nhdr), 187 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);
188 return 0; 191 return 0;
189 } 192 }
190 new_offs = note_offs + sizeof(Elf32_Nhdr) + 193 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,
311 for (i = 0; i < trace_nr; i++) { 314 for (i = 0; i < trace_nr; i++) {
312 id_offs[i].status = BPF_STACK_BUILD_ID_IP; 315 id_offs[i].status = BPF_STACK_BUILD_ID_IP;
313 id_offs[i].ip = ips[i]; 316 id_offs[i].ip = ips[i];
317 memset(id_offs[i].build_id, 0, BPF_BUILD_ID_SIZE);
314 } 318 }
315 return; 319 return;
316 } 320 }
@@ -321,6 +325,7 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs,
321 /* per entry fall back to ips */ 325 /* per entry fall back to ips */
322 id_offs[i].status = BPF_STACK_BUILD_ID_IP; 326 id_offs[i].status = BPF_STACK_BUILD_ID_IP;
323 id_offs[i].ip = ips[i]; 327 id_offs[i].ip = ips[i];
328 memset(id_offs[i].build_id, 0, BPF_BUILD_ID_SIZE);
324 continue; 329 continue;
325 } 330 }
326 id_offs[i].offset = (vma->vm_pgoff << PAGE_SHIFT) + ips[i] 331 id_offs[i].offset = (vma->vm_pgoff << PAGE_SHIFT) + ips[i]
diff --git a/net/bpfilter/bpfilter_umh_blob.S b/net/bpfilter/bpfilter_umh_blob.S
index 7f1c521dcc2f..9ea6100dca87 100644
--- a/net/bpfilter/bpfilter_umh_blob.S
+++ b/net/bpfilter/bpfilter_umh_blob.S
@@ -1,5 +1,5 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 */
2 .section .bpfilter_umh, "a" 2 .section .rodata, "a"
3 .global bpfilter_umh_start 3 .global bpfilter_umh_start
4bpfilter_umh_start: 4bpfilter_umh_start:
5 .incbin "net/bpfilter/bpfilter_umh" 5 .incbin "net/bpfilter/bpfilter_umh"
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index fe3c758791ca..9e14767500ea 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -1128,6 +1128,8 @@ int br_fdb_external_learn_add(struct net_bridge *br, struct net_bridge_port *p,
1128 err = -ENOMEM; 1128 err = -ENOMEM;
1129 goto err_unlock; 1129 goto err_unlock;
1130 } 1130 }
1131 if (swdev_notify)
1132 fdb->added_by_user = 1;
1131 fdb->added_by_external_learn = 1; 1133 fdb->added_by_external_learn = 1;
1132 fdb_notify(br, fdb, RTM_NEWNEIGH, swdev_notify); 1134 fdb_notify(br, fdb, RTM_NEWNEIGH, swdev_notify);
1133 } else { 1135 } else {
@@ -1147,6 +1149,9 @@ int br_fdb_external_learn_add(struct net_bridge *br, struct net_bridge_port *p,
1147 modified = true; 1149 modified = true;
1148 } 1150 }
1149 1151
1152 if (swdev_notify)
1153 fdb->added_by_user = 1;
1154
1150 if (modified) 1155 if (modified)
1151 fdb_notify(br, fdb, RTM_NEWNEIGH, swdev_notify); 1156 fdb_notify(br, fdb, RTM_NEWNEIGH, swdev_notify);
1152 } 1157 }
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index 2cb8da465b98..48ddc60b4fbd 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -36,10 +36,10 @@ static inline int should_deliver(const struct net_bridge_port *p,
36 36
37int br_dev_queue_push_xmit(struct net *net, struct sock *sk, struct sk_buff *skb) 37int br_dev_queue_push_xmit(struct net *net, struct sock *sk, struct sk_buff *skb)
38{ 38{
39 skb_push(skb, ETH_HLEN);
39 if (!is_skb_forwardable(skb->dev, skb)) 40 if (!is_skb_forwardable(skb->dev, skb))
40 goto drop; 41 goto drop;
41 42
42 skb_push(skb, ETH_HLEN);
43 br_drop_fake_rtable(skb); 43 br_drop_fake_rtable(skb);
44 44
45 if (skb->ip_summed == CHECKSUM_PARTIAL && 45 if (skb->ip_summed == CHECKSUM_PARTIAL &&
@@ -98,12 +98,11 @@ static void __br_forward(const struct net_bridge_port *to,
98 net = dev_net(indev); 98 net = dev_net(indev);
99 } else { 99 } else {
100 if (unlikely(netpoll_tx_running(to->br->dev))) { 100 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))
102 kfree_skb(skb); 103 kfree_skb(skb);
103 } else { 104 else
104 skb_push(skb, ETH_HLEN);
105 br_netpoll_send_skb(to, skb); 105 br_netpoll_send_skb(to, skb);
106 }
107 return; 106 return;
108 } 107 }
109 br_hook = NF_BR_LOCAL_OUT; 108 br_hook = NF_BR_LOCAL_OUT;
diff --git a/net/bridge/br_netfilter_ipv6.c b/net/bridge/br_netfilter_ipv6.c
index 94039f588f1d..564710f88f93 100644
--- a/net/bridge/br_netfilter_ipv6.c
+++ b/net/bridge/br_netfilter_ipv6.c
@@ -131,6 +131,7 @@ int br_validate_ipv6(struct net *net, struct sk_buff *skb)
131 IPSTATS_MIB_INDISCARDS); 131 IPSTATS_MIB_INDISCARDS);
132 goto drop; 132 goto drop;
133 } 133 }
134 hdr = ipv6_hdr(skb);
134 } 135 }
135 if (hdr->nexthdr == NEXTHDR_HOP && br_nf_check_hbh_len(skb)) 136 if (hdr->nexthdr == NEXTHDR_HOP && br_nf_check_hbh_len(skb))
136 goto drop; 137 goto drop;
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 491828713e0b..5e55cef0cec3 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -1137,14 +1137,16 @@ static int do_replace(struct net *net, const void __user *user,
1137 tmp.name[sizeof(tmp.name) - 1] = 0; 1137 tmp.name[sizeof(tmp.name) - 1] = 0;
1138 1138
1139 countersize = COUNTER_OFFSET(tmp.nentries) * nr_cpu_ids; 1139 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);
1141 if (!newinfo) 1142 if (!newinfo)
1142 return -ENOMEM; 1143 return -ENOMEM;
1143 1144
1144 if (countersize) 1145 if (countersize)
1145 memset(newinfo->counters, 0, countersize); 1146 memset(newinfo->counters, 0, countersize);
1146 1147
1147 newinfo->entries = vmalloc(tmp.entries_size); 1148 newinfo->entries = __vmalloc(tmp.entries_size, GFP_KERNEL_ACCOUNT,
1149 PAGE_KERNEL);
1148 if (!newinfo->entries) { 1150 if (!newinfo->entries) {
1149 ret = -ENOMEM; 1151 ret = -ENOMEM;
1150 goto free_newinfo; 1152 goto free_newinfo;
diff --git a/net/bridge/netfilter/nft_reject_bridge.c b/net/bridge/netfilter/nft_reject_bridge.c
index 08cbed7d940e..419e8edf23ba 100644
--- a/net/bridge/netfilter/nft_reject_bridge.c
+++ b/net/bridge/netfilter/nft_reject_bridge.c
@@ -229,6 +229,7 @@ static bool reject6_br_csum_ok(struct sk_buff *skb, int hook)
229 pskb_trim_rcsum(skb, ntohs(ip6h->payload_len) + sizeof(*ip6h))) 229 pskb_trim_rcsum(skb, ntohs(ip6h->payload_len) + sizeof(*ip6h)))
230 return false; 230 return false;
231 231
232 ip6h = ipv6_hdr(skb);
232 thoff = ipv6_skip_exthdr(skb, ((u8*)(ip6h+1) - skb->data), &proto, &fo); 233 thoff = ipv6_skip_exthdr(skb, ((u8*)(ip6h+1) - skb->data), &proto, &fo);
233 if (thoff < 0 || thoff >= skb->len || (fo & htons(~0x7)) != 0) 234 if (thoff < 0 || thoff >= skb->len || (fo & htons(~0x7)) != 0)
234 return false; 235 return false;
diff --git a/net/core/filter.c b/net/core/filter.c
index 2b3b436ef545..7559d6835ecb 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -2020,18 +2020,19 @@ static inline int __bpf_tx_skb(struct net_device *dev, struct sk_buff *skb)
2020static int __bpf_redirect_no_mac(struct sk_buff *skb, struct net_device *dev, 2020static int __bpf_redirect_no_mac(struct sk_buff *skb, struct net_device *dev,
2021 u32 flags) 2021 u32 flags)
2022{ 2022{
2023 /* skb->mac_len is not set on normal egress */ 2023 unsigned int mlen = skb_network_offset(skb);
2024 unsigned int mlen = skb->network_header - skb->mac_header;
2025 2024
2026 __skb_pull(skb, mlen); 2025 if (mlen) {
2026 __skb_pull(skb, mlen);
2027 2027
2028 /* At ingress, the mac header has already been pulled once. 2028 /* At ingress, the mac header has already been pulled once.
2029 * At egress, skb_pospull_rcsum has to be done in case that 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) 2030 * the skb is originated from ingress (i.e. a forwarded skb)
2031 * to ensure that rcsum starts at net header. 2031 * to ensure that rcsum starts at net header.
2032 */ 2032 */
2033 if (!skb_at_tc_ingress(skb)) 2033 if (!skb_at_tc_ingress(skb))
2034 skb_postpull_rcsum(skb, skb_mac_header(skb), mlen); 2034 skb_postpull_rcsum(skb, skb_mac_header(skb), mlen);
2035 }
2035 skb_pop_mac_header(skb); 2036 skb_pop_mac_header(skb);
2036 skb_reset_mac_len(skb); 2037 skb_reset_mac_len(skb);
2037 return flags & BPF_F_INGRESS ? 2038 return flags & BPF_F_INGRESS ?
@@ -4119,6 +4120,10 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock,
4119 sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF); 4120 sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF);
4120 break; 4121 break;
4121 case SO_MAX_PACING_RATE: /* 32bit version */ 4122 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);
4122 sk->sk_max_pacing_rate = (val == ~0U) ? ~0UL : val; 4127 sk->sk_max_pacing_rate = (val == ~0U) ? ~0UL : val;
4123 sk->sk_pacing_rate = min(sk->sk_pacing_rate, 4128 sk->sk_pacing_rate = min(sk->sk_pacing_rate,
4124 sk->sk_max_pacing_rate); 4129 sk->sk_max_pacing_rate);
@@ -4132,7 +4137,10 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock,
4132 sk->sk_rcvlowat = val ? : 1; 4137 sk->sk_rcvlowat = val ? : 1;
4133 break; 4138 break;
4134 case SO_MARK: 4139 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 }
4136 break; 4144 break;
4137 default: 4145 default:
4138 ret = -EINVAL; 4146 ret = -EINVAL;
@@ -5309,7 +5317,7 @@ bpf_base_func_proto(enum bpf_func_id func_id)
5309 case BPF_FUNC_trace_printk: 5317 case BPF_FUNC_trace_printk:
5310 if (capable(CAP_SYS_ADMIN)) 5318 if (capable(CAP_SYS_ADMIN))
5311 return bpf_get_trace_printk_proto(); 5319 return bpf_get_trace_printk_proto();
5312 /* else: fall through */ 5320 /* else, fall through */
5313 default: 5321 default:
5314 return NULL; 5322 return NULL;
5315 } 5323 }
diff --git a/net/core/lwt_bpf.c b/net/core/lwt_bpf.c
index 3e85437f7106..a648568c5e8f 100644
--- a/net/core/lwt_bpf.c
+++ b/net/core/lwt_bpf.c
@@ -63,6 +63,7 @@ static int run_lwt_bpf(struct sk_buff *skb, struct bpf_lwt_prog *lwt,
63 lwt->name ? : "<unknown>"); 63 lwt->name ? : "<unknown>");
64 ret = BPF_OK; 64 ret = BPF_OK;
65 } else { 65 } else {
66 skb_reset_mac_header(skb);
66 ret = skb_do_redirect(skb); 67 ret = skb_do_redirect(skb);
67 if (ret == 0) 68 if (ret == 0)
68 ret = BPF_REDIRECT; 69 ret = BPF_REDIRECT;
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 3e27a779f288..4230400b9a30 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -450,7 +450,7 @@ static struct neigh_hash_table *neigh_hash_alloc(unsigned int shift)
450 buckets = (struct neighbour __rcu **) 450 buckets = (struct neighbour __rcu **)
451 __get_free_pages(GFP_ATOMIC | __GFP_ZERO, 451 __get_free_pages(GFP_ATOMIC | __GFP_ZERO,
452 get_order(size)); 452 get_order(size));
453 kmemleak_alloc(buckets, size, 0, GFP_ATOMIC); 453 kmemleak_alloc(buckets, size, 1, GFP_ATOMIC);
454 } 454 }
455 if (!buckets) { 455 if (!buckets) {
456 kfree(ret); 456 kfree(ret);
@@ -1007,7 +1007,7 @@ static void neigh_probe(struct neighbour *neigh)
1007 if (neigh->ops->solicit) 1007 if (neigh->ops->solicit)
1008 neigh->ops->solicit(neigh, skb); 1008 neigh->ops->solicit(neigh, skb);
1009 atomic_inc(&neigh->probes); 1009 atomic_inc(&neigh->probes);
1010 kfree_skb(skb); 1010 consume_skb(skb);
1011} 1011}
1012 1012
1013/* Called when a timer expires for a neighbour entry. */ 1013/* Called when a timer expires for a neighbour entry. */
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 6df95be96311..fe4f6a624238 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -203,7 +203,7 @@ static void fib_flush(struct net *net)
203 struct fib_table *tb; 203 struct fib_table *tb;
204 204
205 hlist_for_each_entry_safe(tb, tmp, head, tb_hlist) 205 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);
207 } 207 }
208 208
209 if (flushed) 209 if (flushed)
@@ -1463,7 +1463,7 @@ static void ip_fib_net_exit(struct net *net)
1463 1463
1464 hlist_for_each_entry_safe(tb, tmp, head, tb_hlist) { 1464 hlist_for_each_entry_safe(tb, tmp, head, tb_hlist) {
1465 hlist_del(&tb->tb_hlist); 1465 hlist_del(&tb->tb_hlist);
1466 fib_table_flush(net, tb); 1466 fib_table_flush(net, tb, true);
1467 fib_free_table(tb); 1467 fib_free_table(tb);
1468 } 1468 }
1469 } 1469 }
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 237c9f72b265..a573e37e0615 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1856,7 +1856,7 @@ void fib_table_flush_external(struct fib_table *tb)
1856} 1856}
1857 1857
1858/* Caller must hold RTNL. */ 1858/* Caller must hold RTNL. */
1859int fib_table_flush(struct net *net, struct fib_table *tb) 1859int fib_table_flush(struct net *net, struct fib_table *tb, bool flush_all)
1860{ 1860{
1861 struct trie *t = (struct trie *)tb->tb_data; 1861 struct trie *t = (struct trie *)tb->tb_data;
1862 struct key_vector *pn = t->kv; 1862 struct key_vector *pn = t->kv;
@@ -1904,8 +1904,17 @@ int fib_table_flush(struct net *net, struct fib_table *tb)
1904 hlist_for_each_entry_safe(fa, tmp, &n->leaf, fa_list) { 1904 hlist_for_each_entry_safe(fa, tmp, &n->leaf, fa_list) {
1905 struct fib_info *fi = fa->fa_info; 1905 struct fib_info *fi = fa->fa_info;
1906 1906
1907 if (!fi || !(fi->fib_flags & RTNH_F_DEAD) || 1907 if (!fi || tb->tb_id != fa->tb_id ||
1908 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) {
1909 slen = fa->fa_slen; 1918 slen = fa->fa_slen;
1910 continue; 1919 continue;
1911 } 1920 }
diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c
index 632863541082..437070d1ffb1 100644
--- a/net/ipv4/fou.c
+++ b/net/ipv4/fou.c
@@ -1020,10 +1020,11 @@ static int gue_err(struct sk_buff *skb, u32 info)
1020{ 1020{
1021 int transport_offset = skb_transport_offset(skb); 1021 int transport_offset = skb_transport_offset(skb);
1022 struct guehdr *guehdr; 1022 struct guehdr *guehdr;
1023 size_t optlen; 1023 size_t len, optlen;
1024 int ret; 1024 int ret;
1025 1025
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))
1027 return -EINVAL; 1028 return -EINVAL;
1028 1029
1029 guehdr = (struct guehdr *)&udp_hdr(skb)[1]; 1030 guehdr = (struct guehdr *)&udp_hdr(skb)[1];
@@ -1058,6 +1059,10 @@ static int gue_err(struct sk_buff *skb, u32 info)
1058 1059
1059 optlen = guehdr->hlen << 2; 1060 optlen = guehdr->hlen << 2;
1060 1061
1062 if (!pskb_may_pull(skb, len + optlen))
1063 return -EINVAL;
1064
1065 guehdr = (struct guehdr *)&udp_hdr(skb)[1];
1061 if (validate_gue_flags(guehdr, optlen)) 1066 if (validate_gue_flags(guehdr, optlen))
1062 return -EINVAL; 1067 return -EINVAL;
1063 1068
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index d1d09f3e5f9e..b1a74d80d868 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -569,8 +569,7 @@ err_free_skb:
569 dev->stats.tx_dropped++; 569 dev->stats.tx_dropped++;
570} 570}
571 571
572static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev, 572static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev)
573 __be16 proto)
574{ 573{
575 struct ip_tunnel *tunnel = netdev_priv(dev); 574 struct ip_tunnel *tunnel = netdev_priv(dev);
576 struct ip_tunnel_info *tun_info; 575 struct ip_tunnel_info *tun_info;
@@ -578,10 +577,10 @@ static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev,
578 struct erspan_metadata *md; 577 struct erspan_metadata *md;
579 struct rtable *rt = NULL; 578 struct rtable *rt = NULL;
580 bool truncate = false; 579 bool truncate = false;
580 __be16 df, proto;
581 struct flowi4 fl; 581 struct flowi4 fl;
582 int tunnel_hlen; 582 int tunnel_hlen;
583 int version; 583 int version;
584 __be16 df;
585 int nhoff; 584 int nhoff;
586 int thoff; 585 int thoff;
587 586
@@ -626,18 +625,20 @@ static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev,
626 if (version == 1) { 625 if (version == 1) {
627 erspan_build_header(skb, ntohl(tunnel_id_to_key32(key->tun_id)), 626 erspan_build_header(skb, ntohl(tunnel_id_to_key32(key->tun_id)),
628 ntohl(md->u.index), truncate, true); 627 ntohl(md->u.index), truncate, true);
628 proto = htons(ETH_P_ERSPAN);
629 } else if (version == 2) { 629 } else if (version == 2) {
630 erspan_build_header_v2(skb, 630 erspan_build_header_v2(skb,
631 ntohl(tunnel_id_to_key32(key->tun_id)), 631 ntohl(tunnel_id_to_key32(key->tun_id)),
632 md->u.md2.dir, 632 md->u.md2.dir,
633 get_hwid(&md->u.md2), 633 get_hwid(&md->u.md2),
634 truncate, true); 634 truncate, true);
635 proto = htons(ETH_P_ERSPAN2);
635 } else { 636 } else {
636 goto err_free_rt; 637 goto err_free_rt;
637 } 638 }
638 639
639 gre_build_header(skb, 8, TUNNEL_SEQ, 640 gre_build_header(skb, 8, TUNNEL_SEQ,
640 htons(ETH_P_ERSPAN), 0, htonl(tunnel->o_seqno++)); 641 proto, 0, htonl(tunnel->o_seqno++));
641 642
642 df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0; 643 df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0;
643 644
@@ -721,12 +722,13 @@ static netdev_tx_t erspan_xmit(struct sk_buff *skb,
721{ 722{
722 struct ip_tunnel *tunnel = netdev_priv(dev); 723 struct ip_tunnel *tunnel = netdev_priv(dev);
723 bool truncate = false; 724 bool truncate = false;
725 __be16 proto;
724 726
725 if (!pskb_inet_may_pull(skb)) 727 if (!pskb_inet_may_pull(skb))
726 goto free_skb; 728 goto free_skb;
727 729
728 if (tunnel->collect_md) { 730 if (tunnel->collect_md) {
729 erspan_fb_xmit(skb, dev, skb->protocol); 731 erspan_fb_xmit(skb, dev);
730 return NETDEV_TX_OK; 732 return NETDEV_TX_OK;
731 } 733 }
732 734
@@ -742,19 +744,22 @@ static netdev_tx_t erspan_xmit(struct sk_buff *skb,
742 } 744 }
743 745
744 /* Push ERSPAN header */ 746 /* Push ERSPAN header */
745 if (tunnel->erspan_ver == 1) 747 if (tunnel->erspan_ver == 1) {
746 erspan_build_header(skb, ntohl(tunnel->parms.o_key), 748 erspan_build_header(skb, ntohl(tunnel->parms.o_key),
747 tunnel->index, 749 tunnel->index,
748 truncate, true); 750 truncate, true);
749 else if (tunnel->erspan_ver == 2) 751 proto = htons(ETH_P_ERSPAN);
752 } else if (tunnel->erspan_ver == 2) {
750 erspan_build_header_v2(skb, ntohl(tunnel->parms.o_key), 753 erspan_build_header_v2(skb, ntohl(tunnel->parms.o_key),
751 tunnel->dir, tunnel->hwid, 754 tunnel->dir, tunnel->hwid,
752 truncate, true); 755 truncate, true);
753 else 756 proto = htons(ETH_P_ERSPAN2);
757 } else {
754 goto free_skb; 758 goto free_skb;
759 }
755 760
756 tunnel->parms.o_flags &= ~TUNNEL_KEY; 761 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);
758 return NETDEV_TX_OK; 763 return NETDEV_TX_OK;
759 764
760free_skb: 765free_skb:
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 26921f6b3b92..51d8efba6de2 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -488,6 +488,7 @@ static struct sk_buff *ip_rcv_core(struct sk_buff *skb, struct net *net)
488 goto drop; 488 goto drop;
489 } 489 }
490 490
491 iph = ip_hdr(skb);
491 skb->transport_header = skb->network_header + iph->ihl*4; 492 skb->transport_header = skb->network_header + iph->ihl*4;
492 493
493 /* Remove any debris in the socket control block */ 494 /* Remove any debris in the socket control block */
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 27e2f6837062..2079145a3b7c 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1186,7 +1186,7 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size)
1186 flags = msg->msg_flags; 1186 flags = msg->msg_flags;
1187 1187
1188 if (flags & MSG_ZEROCOPY && size && sock_flag(sk, SOCK_ZEROCOPY)) { 1188 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)) {
1190 err = -EINVAL; 1190 err = -EINVAL;
1191 goto out_err; 1191 goto out_err;
1192 } 1192 }
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 3fb0ed5e4789..5c3cd5d84a6f 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -847,15 +847,23 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4,
847 const int hlen = skb_network_header_len(skb) + 847 const int hlen = skb_network_header_len(skb) +
848 sizeof(struct udphdr); 848 sizeof(struct udphdr);
849 849
850 if (hlen + cork->gso_size > cork->fragsize) 850 if (hlen + cork->gso_size > cork->fragsize) {
851 kfree_skb(skb);
851 return -EINVAL; 852 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);
853 return -EINVAL; 856 return -EINVAL;
854 if (sk->sk_no_check_tx) 857 }
858 if (sk->sk_no_check_tx) {
859 kfree_skb(skb);
855 return -EINVAL; 860 return -EINVAL;
861 }
856 if (skb->ip_summed != CHECKSUM_PARTIAL || is_udplite || 862 if (skb->ip_summed != CHECKSUM_PARTIAL || is_udplite ||
857 dst_xfrm(skb_dst(skb))) 863 dst_xfrm(skb_dst(skb))) {
864 kfree_skb(skb);
858 return -EIO; 865 return -EIO;
866 }
859 867
860 skb_shinfo(skb)->gso_size = cork->gso_size; 868 skb_shinfo(skb)->gso_size = cork->gso_size;
861 skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4; 869 skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4;
@@ -1918,7 +1926,7 @@ void udp_lib_rehash(struct sock *sk, u16 newhash)
1918} 1926}
1919EXPORT_SYMBOL(udp_lib_rehash); 1927EXPORT_SYMBOL(udp_lib_rehash);
1920 1928
1921static void udp_v4_rehash(struct sock *sk) 1929void udp_v4_rehash(struct sock *sk)
1922{ 1930{
1923 u16 new_hash = ipv4_portaddr_hash(sock_net(sk), 1931 u16 new_hash = ipv4_portaddr_hash(sock_net(sk),
1924 inet_sk(sk)->inet_rcv_saddr, 1932 inet_sk(sk)->inet_rcv_saddr,
diff --git a/net/ipv4/udp_impl.h b/net/ipv4/udp_impl.h
index 322672655419..6b2fa77eeb1c 100644
--- a/net/ipv4/udp_impl.h
+++ b/net/ipv4/udp_impl.h
@@ -10,6 +10,7 @@ int __udp4_lib_rcv(struct sk_buff *, struct udp_table *, int);
10int __udp4_lib_err(struct sk_buff *, u32, struct udp_table *); 10int __udp4_lib_err(struct sk_buff *, u32, struct udp_table *);
11 11
12int udp_v4_get_port(struct sock *sk, unsigned short snum); 12int udp_v4_get_port(struct sock *sk, unsigned short snum);
13void udp_v4_rehash(struct sock *sk);
13 14
14int udp_setsockopt(struct sock *sk, int level, int optname, 15int udp_setsockopt(struct sock *sk, int level, int optname,
15 char __user *optval, unsigned int optlen); 16 char __user *optval, unsigned int optlen);
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c
index 39c7f17d916f..3c94b8f0ff27 100644
--- a/net/ipv4/udplite.c
+++ b/net/ipv4/udplite.c
@@ -53,6 +53,7 @@ struct proto udplite_prot = {
53 .sendpage = udp_sendpage, 53 .sendpage = udp_sendpage,
54 .hash = udp_lib_hash, 54 .hash = udp_lib_hash,
55 .unhash = udp_lib_unhash, 55 .unhash = udp_lib_unhash,
56 .rehash = udp_v4_rehash,
56 .get_port = udp_v4_get_port, 57 .get_port = udp_v4_get_port,
57 .memory_allocated = &udp_memory_allocated, 58 .memory_allocated = &udp_memory_allocated,
58 .sysctl_mem = sysctl_udp_mem, 59 .sysctl_mem = sysctl_udp_mem,
diff --git a/net/ipv6/fou6.c b/net/ipv6/fou6.c
index 7da7bf3b7fe3..b858bd5280bf 100644
--- a/net/ipv6/fou6.c
+++ b/net/ipv6/fou6.c
@@ -90,10 +90,11 @@ static int gue6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
90{ 90{
91 int transport_offset = skb_transport_offset(skb); 91 int transport_offset = skb_transport_offset(skb);
92 struct guehdr *guehdr; 92 struct guehdr *guehdr;
93 size_t optlen; 93 size_t len, optlen;
94 int ret; 94 int ret;
95 95
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))
97 return -EINVAL; 98 return -EINVAL;
98 99
99 guehdr = (struct guehdr *)&udp_hdr(skb)[1]; 100 guehdr = (struct guehdr *)&udp_hdr(skb)[1];
@@ -128,6 +129,10 @@ static int gue6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
128 129
129 optlen = guehdr->hlen << 2; 130 optlen = guehdr->hlen << 2;
130 131
132 if (!pskb_may_pull(skb, len + optlen))
133 return -EINVAL;
134
135 guehdr = (struct guehdr *)&udp_hdr(skb)[1];
131 if (validate_gue_flags(guehdr, optlen)) 136 if (validate_gue_flags(guehdr, optlen))
132 return -EINVAL; 137 return -EINVAL;
133 138
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 09d0826742f8..b1be67ca6768 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -922,6 +922,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
922 __u8 dsfield = false; 922 __u8 dsfield = false;
923 struct flowi6 fl6; 923 struct flowi6 fl6;
924 int err = -EINVAL; 924 int err = -EINVAL;
925 __be16 proto;
925 __u32 mtu; 926 __u32 mtu;
926 int nhoff; 927 int nhoff;
927 int thoff; 928 int thoff;
@@ -1035,8 +1036,9 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
1035 } 1036 }
1036 1037
1037 /* Push GRE header. */ 1038 /* Push GRE header. */
1038 gre_build_header(skb, 8, TUNNEL_SEQ, 1039 proto = (t->parms.erspan_ver == 1) ? htons(ETH_P_ERSPAN)
1039 htons(ETH_P_ERSPAN), 0, htonl(t->o_seqno++)); 1040 : htons(ETH_P_ERSPAN2);
1041 gre_build_header(skb, 8, TUNNEL_SEQ, proto, 0, htonl(t->o_seqno++));
1040 1042
1041 /* TooBig packet may have updated dst->dev's mtu */ 1043 /* TooBig packet may have updated dst->dev's mtu */
1042 if (!t->parms.collect_md && dst && dst_mtu(dst) > dst->dev->mtu) 1044 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,
1169 t->parms.i_flags = p->i_flags; 1171 t->parms.i_flags = p->i_flags;
1170 t->parms.o_flags = p->o_flags; 1172 t->parms.o_flags = p->o_flags;
1171 t->parms.fwmark = p->fwmark; 1173 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;
1172 dst_cache_reset(&t->dst_cache); 1178 dst_cache_reset(&t->dst_cache);
1173} 1179}
1174 1180
@@ -2025,9 +2031,9 @@ static int ip6gre_changelink(struct net_device *dev, struct nlattr *tb[],
2025 struct nlattr *data[], 2031 struct nlattr *data[],
2026 struct netlink_ext_ack *extack) 2032 struct netlink_ext_ack *extack)
2027{ 2033{
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);
2029 struct __ip6_tnl_parm p; 2036 struct __ip6_tnl_parm p;
2030 struct ip6_tnl *t;
2031 2037
2032 t = ip6gre_changelink_common(dev, tb, data, &p, extack); 2038 t = ip6gre_changelink_common(dev, tb, data, &p, extack);
2033 if (IS_ERR(t)) 2039 if (IS_ERR(t))
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 40b225f87d5e..964491cf3672 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -4251,17 +4251,6 @@ struct rt6_nh {
4251 struct list_head next; 4251 struct list_head next;
4252}; 4252};
4253 4253
4254static 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
4265static int ip6_route_info_append(struct net *net, 4254static int ip6_route_info_append(struct net *net,
4266 struct list_head *rt6_nh_list, 4255 struct list_head *rt6_nh_list,
4267 struct fib6_info *rt, 4256 struct fib6_info *rt,
@@ -4407,7 +4396,8 @@ static int ip6_route_multipath_add(struct fib6_config *cfg,
4407 nh->fib6_info = NULL; 4396 nh->fib6_info = NULL;
4408 if (err) { 4397 if (err) {
4409 if (replace && nhn) 4398 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)");
4411 err_nh = nh; 4401 err_nh = nh;
4412 goto add_errout; 4402 goto add_errout;
4413 } 4403 }
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 7c3505006f8e..2596ffdeebea 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -102,7 +102,7 @@ int udp_v6_get_port(struct sock *sk, unsigned short snum)
102 return udp_lib_get_port(sk, snum, hash2_nulladdr); 102 return udp_lib_get_port(sk, snum, hash2_nulladdr);
103} 103}
104 104
105static void udp_v6_rehash(struct sock *sk) 105void udp_v6_rehash(struct sock *sk)
106{ 106{
107 u16 new_hash = ipv6_portaddr_hash(sock_net(sk), 107 u16 new_hash = ipv6_portaddr_hash(sock_net(sk),
108 &sk->sk_v6_rcv_saddr, 108 &sk->sk_v6_rcv_saddr,
@@ -1132,15 +1132,23 @@ static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6,
1132 const int hlen = skb_network_header_len(skb) + 1132 const int hlen = skb_network_header_len(skb) +
1133 sizeof(struct udphdr); 1133 sizeof(struct udphdr);
1134 1134
1135 if (hlen + cork->gso_size > cork->fragsize) 1135 if (hlen + cork->gso_size > cork->fragsize) {
1136 kfree_skb(skb);
1136 return -EINVAL; 1137 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);
1138 return -EINVAL; 1141 return -EINVAL;
1139 if (udp_sk(sk)->no_check6_tx) 1142 }
1143 if (udp_sk(sk)->no_check6_tx) {
1144 kfree_skb(skb);
1140 return -EINVAL; 1145 return -EINVAL;
1146 }
1141 if (skb->ip_summed != CHECKSUM_PARTIAL || is_udplite || 1147 if (skb->ip_summed != CHECKSUM_PARTIAL || is_udplite ||
1142 dst_xfrm(skb_dst(skb))) 1148 dst_xfrm(skb_dst(skb))) {
1149 kfree_skb(skb);
1143 return -EIO; 1150 return -EIO;
1151 }
1144 1152
1145 skb_shinfo(skb)->gso_size = cork->gso_size; 1153 skb_shinfo(skb)->gso_size = cork->gso_size;
1146 skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4; 1154 skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4;
diff --git a/net/ipv6/udp_impl.h b/net/ipv6/udp_impl.h
index 5730e6503cb4..20e324b6f358 100644
--- a/net/ipv6/udp_impl.h
+++ b/net/ipv6/udp_impl.h
@@ -13,6 +13,7 @@ int __udp6_lib_err(struct sk_buff *, struct inet6_skb_parm *, u8, u8, int,
13 __be32, struct udp_table *); 13 __be32, struct udp_table *);
14 14
15int udp_v6_get_port(struct sock *sk, unsigned short snum); 15int udp_v6_get_port(struct sock *sk, unsigned short snum);
16void udp_v6_rehash(struct sock *sk);
16 17
17int udpv6_getsockopt(struct sock *sk, int level, int optname, 18int udpv6_getsockopt(struct sock *sk, int level, int optname,
18 char __user *optval, int __user *optlen); 19 char __user *optval, int __user *optlen);
diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c
index a125aebc29e5..f35907836444 100644
--- a/net/ipv6/udplite.c
+++ b/net/ipv6/udplite.c
@@ -49,6 +49,7 @@ struct proto udplitev6_prot = {
49 .recvmsg = udpv6_recvmsg, 49 .recvmsg = udpv6_recvmsg,
50 .hash = udp_lib_hash, 50 .hash = udp_lib_hash,
51 .unhash = udp_lib_unhash, 51 .unhash = udp_lib_unhash,
52 .rehash = udp_v6_rehash,
52 .get_port = udp_v6_get_port, 53 .get_port = udp_v6_get_port,
53 .memory_allocated = &udp_memory_allocated, 54 .memory_allocated = &udp_memory_allocated,
54 .sysctl_mem = sysctl_udp_mem, 55 .sysctl_mem = sysctl_udp_mem,
diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
index fa0844e2a68d..c0c72ae9df42 100644
--- a/net/netfilter/nf_flow_table_core.c
+++ b/net/netfilter/nf_flow_table_core.c
@@ -28,6 +28,7 @@ flow_offload_fill_dir(struct flow_offload *flow, struct nf_conn *ct,
28{ 28{
29 struct flow_offload_tuple *ft = &flow->tuplehash[dir].tuple; 29 struct flow_offload_tuple *ft = &flow->tuplehash[dir].tuple;
30 struct nf_conntrack_tuple *ctt = &ct->tuplehash[dir].tuple; 30 struct nf_conntrack_tuple *ctt = &ct->tuplehash[dir].tuple;
31 struct dst_entry *other_dst = route->tuple[!dir].dst;
31 struct dst_entry *dst = route->tuple[dir].dst; 32 struct dst_entry *dst = route->tuple[dir].dst;
32 33
33 ft->dir = dir; 34 ft->dir = dir;
@@ -50,8 +51,8 @@ flow_offload_fill_dir(struct flow_offload *flow, struct nf_conn *ct,
50 ft->src_port = ctt->src.u.tcp.port; 51 ft->src_port = ctt->src.u.tcp.port;
51 ft->dst_port = ctt->dst.u.tcp.port; 52 ft->dst_port = ctt->dst.u.tcp.port;
52 53
53 ft->iifidx = route->tuple[dir].ifindex; 54 ft->iifidx = other_dst->dev->ifindex;
54 ft->oifidx = route->tuple[!dir].ifindex; 55 ft->oifidx = dst->dev->ifindex;
55 ft->dst_cache = dst; 56 ft->dst_cache = dst;
56} 57}
57 58
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 2b0a93300dd7..fb07f6cfc719 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -2304,7 +2304,6 @@ static int __nf_tables_dump_rules(struct sk_buff *skb,
2304 struct net *net = sock_net(skb->sk); 2304 struct net *net = sock_net(skb->sk);
2305 unsigned int s_idx = cb->args[0]; 2305 unsigned int s_idx = cb->args[0];
2306 const struct nft_rule *rule; 2306 const struct nft_rule *rule;
2307 int rc = 1;
2308 2307
2309 list_for_each_entry_rcu(rule, &chain->rules, list) { 2308 list_for_each_entry_rcu(rule, &chain->rules, list) {
2310 if (!nft_is_active(net, rule)) 2309 if (!nft_is_active(net, rule))
@@ -2321,16 +2320,13 @@ static int __nf_tables_dump_rules(struct sk_buff *skb,
2321 NLM_F_MULTI | NLM_F_APPEND, 2320 NLM_F_MULTI | NLM_F_APPEND,
2322 table->family, 2321 table->family,
2323 table, chain, rule) < 0) 2322 table, chain, rule) < 0)
2324 goto out_unfinished; 2323 return 1;
2325 2324
2326 nl_dump_check_consistent(cb, nlmsg_hdr(skb)); 2325 nl_dump_check_consistent(cb, nlmsg_hdr(skb));
2327cont: 2326cont:
2328 (*idx)++; 2327 (*idx)++;
2329 } 2328 }
2330 rc = 0; 2329 return 0;
2331out_unfinished:
2332 cb->args[0] = *idx;
2333 return rc;
2334} 2330}
2335 2331
2336static int nf_tables_dump_rules(struct sk_buff *skb, 2332static int nf_tables_dump_rules(struct sk_buff *skb,
@@ -2354,7 +2350,7 @@ static int nf_tables_dump_rules(struct sk_buff *skb,
2354 if (ctx && ctx->table && strcmp(ctx->table, table->name) != 0) 2350 if (ctx && ctx->table && strcmp(ctx->table, table->name) != 0)
2355 continue; 2351 continue;
2356 2352
2357 if (ctx && ctx->chain) { 2353 if (ctx && ctx->table && ctx->chain) {
2358 struct rhlist_head *list, *tmp; 2354 struct rhlist_head *list, *tmp;
2359 2355
2360 list = rhltable_lookup(&table->chains_ht, ctx->chain, 2356 list = rhltable_lookup(&table->chains_ht, ctx->chain,
@@ -2382,6 +2378,8 @@ static int nf_tables_dump_rules(struct sk_buff *skb,
2382 } 2378 }
2383done: 2379done:
2384 rcu_read_unlock(); 2380 rcu_read_unlock();
2381
2382 cb->args[0] = idx;
2385 return skb->len; 2383 return skb->len;
2386} 2384}
2387 2385
@@ -4508,6 +4506,8 @@ err6:
4508err5: 4506err5:
4509 kfree(trans); 4507 kfree(trans);
4510err4: 4508err4:
4509 if (obj)
4510 obj->use--;
4511 kfree(elem.priv); 4511 kfree(elem.priv);
4512err3: 4512err3:
4513 if (nla[NFTA_SET_ELEM_DATA] != NULL) 4513 if (nla[NFTA_SET_ELEM_DATA] != NULL)
diff --git a/net/netfilter/nft_flow_offload.c b/net/netfilter/nft_flow_offload.c
index 974525eb92df..6e6b9adf7d38 100644
--- a/net/netfilter/nft_flow_offload.c
+++ b/net/netfilter/nft_flow_offload.c
@@ -12,6 +12,7 @@
12#include <net/netfilter/nf_conntrack_core.h> 12#include <net/netfilter/nf_conntrack_core.h>
13#include <linux/netfilter/nf_conntrack_common.h> 13#include <linux/netfilter/nf_conntrack_common.h>
14#include <net/netfilter/nf_flow_table.h> 14#include <net/netfilter/nf_flow_table.h>
15#include <net/netfilter/nf_conntrack_helper.h>
15 16
16struct nft_flow_offload { 17struct nft_flow_offload {
17 struct nft_flowtable *flowtable; 18 struct nft_flowtable *flowtable;
@@ -29,10 +30,12 @@ static int nft_flow_route(const struct nft_pktinfo *pkt,
29 memset(&fl, 0, sizeof(fl)); 30 memset(&fl, 0, sizeof(fl));
30 switch (nft_pf(pkt)) { 31 switch (nft_pf(pkt)) {
31 case NFPROTO_IPV4: 32 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;
33 break; 35 break;
34 case NFPROTO_IPV6: 36 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;
36 break; 39 break;
37 } 40 }
38 41
@@ -41,9 +44,7 @@ static int nft_flow_route(const struct nft_pktinfo *pkt,
41 return -ENOENT; 44 return -ENOENT;
42 45
43 route->tuple[dir].dst = this_dst; 46 route->tuple[dir].dst = this_dst;
44 route->tuple[dir].ifindex = nft_in(pkt)->ifindex;
45 route->tuple[!dir].dst = other_dst; 47 route->tuple[!dir].dst = other_dst;
46 route->tuple[!dir].ifindex = nft_out(pkt)->ifindex;
47 48
48 return 0; 49 return 0;
49} 50}
@@ -66,6 +67,7 @@ static void nft_flow_offload_eval(const struct nft_expr *expr,
66{ 67{
67 struct nft_flow_offload *priv = nft_expr_priv(expr); 68 struct nft_flow_offload *priv = nft_expr_priv(expr);
68 struct nf_flowtable *flowtable = &priv->flowtable->data; 69 struct nf_flowtable *flowtable = &priv->flowtable->data;
70 const struct nf_conn_help *help;
69 enum ip_conntrack_info ctinfo; 71 enum ip_conntrack_info ctinfo;
70 struct nf_flow_route route; 72 struct nf_flow_route route;
71 struct flow_offload *flow; 73 struct flow_offload *flow;
@@ -88,7 +90,8 @@ static void nft_flow_offload_eval(const struct nft_expr *expr,
88 goto out; 90 goto out;
89 } 91 }
90 92
91 if (test_bit(IPS_HELPER_BIT, &ct->status)) 93 help = nfct_help(ct);
94 if (help)
92 goto out; 95 goto out;
93 96
94 if (ctinfo == IP_CT_NEW || 97 if (ctinfo == IP_CT_NEW ||
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index 435a4bdf8f89..691da853bef5 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -500,7 +500,7 @@ static int __parse_flow_nlattrs(const struct nlattr *attr,
500 return -EINVAL; 500 return -EINVAL;
501 } 501 }
502 502
503 if (!nz || !is_all_zero(nla_data(nla), expected_len)) { 503 if (!nz || !is_all_zero(nla_data(nla), nla_len(nla))) {
504 attrs |= 1 << type; 504 attrs |= 1 << type;
505 a[type] = nla; 505 a[type] = nla;
506 } 506 }
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index d0945253f43b..3b1a78906bc0 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2887,7 +2887,8 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
2887 goto out_free; 2887 goto out_free;
2888 } else if (reserve) { 2888 } else if (reserve) {
2889 skb_reserve(skb, -reserve); 2889 skb_reserve(skb, -reserve);
2890 if (len < reserve) 2890 if (len < reserve + sizeof(struct ipv6hdr) &&
2891 dev->min_header_len != dev->hard_header_len)
2891 skb_reset_network_header(skb); 2892 skb_reset_network_header(skb);
2892 } 2893 }
2893 2894
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index a2522f9d71e2..96f2952bbdfd 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -419,76 +419,6 @@ u32 rxrpc_kernel_get_epoch(struct socket *sock, struct rxrpc_call *call)
419EXPORT_SYMBOL(rxrpc_kernel_get_epoch); 419EXPORT_SYMBOL(rxrpc_kernel_get_epoch);
420 420
421/** 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 */
433int 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}
443EXPORT_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 */
457int 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}
489EXPORT_SYMBOL(rxrpc_kernel_retry_call);
490
491/**
492 * rxrpc_kernel_new_call_notification - Get notifications of new calls 422 * rxrpc_kernel_new_call_notification - Get notifications of new calls
493 * @sock: The socket to intercept received messages on 423 * @sock: The socket to intercept received messages on
494 * @notify_new_call: Function to be called when new calls appear 424 * @notify_new_call: Function to be called when new calls appear
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index bc628acf4f4f..4b1a534d290a 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -476,7 +476,6 @@ enum rxrpc_call_flag {
476 RXRPC_CALL_EXPOSED, /* The call was exposed to the world */ 476 RXRPC_CALL_EXPOSED, /* The call was exposed to the world */
477 RXRPC_CALL_RX_LAST, /* Received the last packet (at rxtx_top) */ 477 RXRPC_CALL_RX_LAST, /* Received the last packet (at rxtx_top) */
478 RXRPC_CALL_TX_LAST, /* Last packet in Tx buffer (at rxtx_top) */ 478 RXRPC_CALL_TX_LAST, /* Last packet in Tx buffer (at rxtx_top) */
479 RXRPC_CALL_TX_LASTQ, /* Last packet has been queued */
480 RXRPC_CALL_SEND_PING, /* A ping will need to be sent */ 479 RXRPC_CALL_SEND_PING, /* A ping will need to be sent */
481 RXRPC_CALL_PINGING, /* Ping in process */ 480 RXRPC_CALL_PINGING, /* Ping in process */
482 RXRPC_CALL_RETRANS_TIMEOUT, /* Retransmission due to timeout occurred */ 481 RXRPC_CALL_RETRANS_TIMEOUT, /* Retransmission due to timeout occurred */
@@ -518,6 +517,18 @@ enum rxrpc_call_state {
518}; 517};
519 518
520/* 519/*
520 * Call completion condition (state == RXRPC_CALL_COMPLETE).
521 */
522enum 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
531/*
521 * Call Tx congestion management modes. 532 * Call Tx congestion management modes.
522 */ 533 */
523enum rxrpc_congest_mode { 534enum rxrpc_congest_mode {
@@ -761,15 +772,9 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *,
761 struct sockaddr_rxrpc *, 772 struct sockaddr_rxrpc *,
762 struct rxrpc_call_params *, gfp_t, 773 struct rxrpc_call_params *, gfp_t,
763 unsigned int); 774 unsigned int);
764int rxrpc_retry_client_call(struct rxrpc_sock *,
765 struct rxrpc_call *,
766 struct rxrpc_conn_parameters *,
767 struct sockaddr_rxrpc *,
768 gfp_t);
769void rxrpc_incoming_call(struct rxrpc_sock *, struct rxrpc_call *, 775void rxrpc_incoming_call(struct rxrpc_sock *, struct rxrpc_call *,
770 struct sk_buff *); 776 struct sk_buff *);
771void rxrpc_release_call(struct rxrpc_sock *, struct rxrpc_call *); 777void rxrpc_release_call(struct rxrpc_sock *, struct rxrpc_call *);
772int rxrpc_prepare_call_for_retry(struct rxrpc_sock *, struct rxrpc_call *);
773void rxrpc_release_calls_on_socket(struct rxrpc_sock *); 778void rxrpc_release_calls_on_socket(struct rxrpc_sock *);
774bool __rxrpc_queue_call(struct rxrpc_call *); 779bool __rxrpc_queue_call(struct rxrpc_call *);
775bool rxrpc_queue_call(struct rxrpc_call *); 780bool rxrpc_queue_call(struct rxrpc_call *);
diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c
index 8f1a8f85b1f9..8aa2937b069f 100644
--- a/net/rxrpc/call_object.c
+++ b/net/rxrpc/call_object.c
@@ -325,48 +325,6 @@ error:
325} 325}
326 326
327/* 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 */
331int 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
360error:
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
369/*
370 * Set up an incoming call. call->conn points to the connection. 328 * Set up an incoming call. call->conn points to the connection.
371 * This is called in BH context and isn't allowed to fail. 329 * This is called in BH context and isn't allowed to fail.
372 */ 330 */
@@ -534,61 +492,6 @@ void rxrpc_release_call(struct rxrpc_sock *rx, struct rxrpc_call *call)
534} 492}
535 493
536/* 494/*
537 * Prepare a kernel service call for retry.
538 */
539int 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
591/*
592 * release all the calls associated with a socket 495 * release all the calls associated with a socket
593 */ 496 */
594void rxrpc_release_calls_on_socket(struct rxrpc_sock *rx) 497void rxrpc_release_calls_on_socket(struct rxrpc_sock *rx)
diff --git a/net/rxrpc/conn_client.c b/net/rxrpc/conn_client.c
index 521189f4b666..b2adfa825363 100644
--- a/net/rxrpc/conn_client.c
+++ b/net/rxrpc/conn_client.c
@@ -562,10 +562,7 @@ static void rxrpc_activate_one_channel(struct rxrpc_connection *conn,
562 clear_bit(RXRPC_CONN_FINAL_ACK_0 + channel, &conn->flags); 562 clear_bit(RXRPC_CONN_FINAL_ACK_0 + channel, &conn->flags);
563 563
564 write_lock_bh(&call->state_lock); 564 write_lock_bh(&call->state_lock);
565 if (!test_bit(RXRPC_CALL_TX_LASTQ, &call->flags)) 565 call->state = RXRPC_CALL_CLIENT_SEND_REQUEST;
566 call->state = RXRPC_CALL_CLIENT_SEND_REQUEST;
567 else
568 call->state = RXRPC_CALL_CLIENT_AWAIT_REPLY;
569 write_unlock_bh(&call->state_lock); 566 write_unlock_bh(&call->state_lock);
570 567
571 rxrpc_see_call(call); 568 rxrpc_see_call(call);
diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c
index be01f9c5d963..46c9312085b1 100644
--- a/net/rxrpc/sendmsg.c
+++ b/net/rxrpc/sendmsg.c
@@ -169,10 +169,8 @@ static void rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call,
169 169
170 ASSERTCMP(seq, ==, call->tx_top + 1); 170 ASSERTCMP(seq, ==, call->tx_top + 1);
171 171
172 if (last) { 172 if (last)
173 annotation |= RXRPC_TX_ANNO_LAST; 173 annotation |= RXRPC_TX_ANNO_LAST;
174 set_bit(RXRPC_CALL_TX_LASTQ, &call->flags);
175 }
176 174
177 /* We have to set the timestamp before queueing as the retransmit 175 /* We have to set the timestamp before queueing as the retransmit
178 * algorithm can see the packet as soon as we queue it. 176 * algorithm can see the packet as soon as we queue it.
@@ -386,6 +384,11 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
386 call->tx_total_len -= copy; 384 call->tx_total_len -= copy;
387 } 385 }
388 386
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
389 /* add the packet to the send queue if it's now full */ 392 /* add the packet to the send queue if it's now full */
390 if (sp->remain <= 0 || 393 if (sp->remain <= 0 ||
391 (msg_data_left(msg) == 0 && !more)) { 394 (msg_data_left(msg) == 0 && !more)) {
@@ -425,16 +428,6 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
425 notify_end_tx); 428 notify_end_tx);
426 skb = NULL; 429 skb = NULL;
427 } 430 }
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 }
438 } while (msg_data_left(msg) > 0); 431 } while (msg_data_left(msg) > 0);
439 432
440success: 433success:
@@ -444,6 +437,11 @@ out:
444 _leave(" = %d", ret); 437 _leave(" = %d", ret);
445 return ret; 438 return ret;
446 439
440call_terminated:
441 rxrpc_free_skb(skb, rxrpc_skb_tx_freed);
442 _leave(" = %d", call->error);
443 return call->error;
444
447maybe_error: 445maybe_error:
448 if (copied) 446 if (copied)
449 goto success; 447 goto success;
diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
index c3b90fadaff6..8b43fe0130f7 100644
--- a/net/sched/act_tunnel_key.c
+++ b/net/sched/act_tunnel_key.c
@@ -197,6 +197,15 @@ static const struct nla_policy tunnel_key_policy[TCA_TUNNEL_KEY_MAX + 1] = {
197 [TCA_TUNNEL_KEY_ENC_TTL] = { .type = NLA_U8 }, 197 [TCA_TUNNEL_KEY_ENC_TTL] = { .type = NLA_U8 },
198}; 198};
199 199
200static 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
200static int tunnel_key_init(struct net *net, struct nlattr *nla, 209static int tunnel_key_init(struct net *net, struct nlattr *nla,
201 struct nlattr *est, struct tc_action **a, 210 struct nlattr *est, struct tc_action **a,
202 int ovr, int bind, bool rtnl_held, 211 int ovr, int bind, bool rtnl_held,
@@ -360,8 +369,7 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
360 rcu_swap_protected(t->params, params_new, 369 rcu_swap_protected(t->params, params_new,
361 lockdep_is_held(&t->tcf_lock)); 370 lockdep_is_held(&t->tcf_lock));
362 spin_unlock_bh(&t->tcf_lock); 371 spin_unlock_bh(&t->tcf_lock);
363 if (params_new) 372 tunnel_key_release_params(params_new);
364 kfree_rcu(params_new, rcu);
365 373
366 if (ret == ACT_P_CREATED) 374 if (ret == ACT_P_CREATED)
367 tcf_idr_insert(tn, *a); 375 tcf_idr_insert(tn, *a);
@@ -385,12 +393,7 @@ static void tunnel_key_release(struct tc_action *a)
385 struct tcf_tunnel_key_params *params; 393 struct tcf_tunnel_key_params *params;
386 394
387 params = rcu_dereference_protected(t->params, 1); 395 params = rcu_dereference_protected(t->params, 1);
388 if (params) { 396 tunnel_key_release_params(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 }
394} 397}
395 398
396static int tunnel_key_geneve_opts_dump(struct sk_buff *skb, 399static int tunnel_key_geneve_opts_dump(struct sk_buff *skb,
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 8ce2a0507970..e2b5cb2eb34e 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -1277,7 +1277,6 @@ EXPORT_SYMBOL(tcf_block_cb_unregister);
1277int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp, 1277int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
1278 struct tcf_result *res, bool compat_mode) 1278 struct tcf_result *res, bool compat_mode)
1279{ 1279{
1280 __be16 protocol = tc_skb_protocol(skb);
1281#ifdef CONFIG_NET_CLS_ACT 1280#ifdef CONFIG_NET_CLS_ACT
1282 const int max_reclassify_loop = 4; 1281 const int max_reclassify_loop = 4;
1283 const struct tcf_proto *orig_tp = tp; 1282 const struct tcf_proto *orig_tp = tp;
@@ -1287,6 +1286,7 @@ int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
1287reclassify: 1286reclassify:
1288#endif 1287#endif
1289 for (; tp; tp = rcu_dereference_bh(tp->next)) { 1288 for (; tp; tp = rcu_dereference_bh(tp->next)) {
1289 __be16 protocol = tc_skb_protocol(skb);
1290 int err; 1290 int err;
1291 1291
1292 if (tp->protocol != protocol && 1292 if (tp->protocol != protocol &&
@@ -1319,7 +1319,6 @@ reset:
1319 } 1319 }
1320 1320
1321 tp = first_tp; 1321 tp = first_tp;
1322 protocol = tc_skb_protocol(skb);
1323 goto reclassify; 1322 goto reclassify;
1324#endif 1323#endif
1325} 1324}
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index dad04e710493..f6aa57fbbbaf 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -1290,17 +1290,23 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
1290 struct cls_fl_head *head = rtnl_dereference(tp->root); 1290 struct cls_fl_head *head = rtnl_dereference(tp->root);
1291 struct cls_fl_filter *fold = *arg; 1291 struct cls_fl_filter *fold = *arg;
1292 struct cls_fl_filter *fnew; 1292 struct cls_fl_filter *fnew;
1293 struct fl_flow_mask *mask;
1293 struct nlattr **tb; 1294 struct nlattr **tb;
1294 struct fl_flow_mask mask = {};
1295 int err; 1295 int err;
1296 1296
1297 if (!tca[TCA_OPTIONS]) 1297 if (!tca[TCA_OPTIONS])
1298 return -EINVAL; 1298 return -EINVAL;
1299 1299
1300 tb = kcalloc(TCA_FLOWER_MAX + 1, sizeof(struct nlattr *), GFP_KERNEL); 1300 mask = kzalloc(sizeof(struct fl_flow_mask), GFP_KERNEL);
1301 if (!tb) 1301 if (!mask)
1302 return -ENOBUFS; 1302 return -ENOBUFS;
1303 1303
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
1304 err = nla_parse_nested(tb, TCA_FLOWER_MAX, tca[TCA_OPTIONS], 1310 err = nla_parse_nested(tb, TCA_FLOWER_MAX, tca[TCA_OPTIONS],
1305 fl_policy, NULL); 1311 fl_policy, NULL);
1306 if (err < 0) 1312 if (err < 0)
@@ -1343,12 +1349,12 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
1343 } 1349 }
1344 } 1350 }
1345 1351
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,
1347 tp->chain->tmplt_priv, extack); 1353 tp->chain->tmplt_priv, extack);
1348 if (err) 1354 if (err)
1349 goto errout_idr; 1355 goto errout_idr;
1350 1356
1351 err = fl_check_assign_mask(head, fnew, fold, &mask); 1357 err = fl_check_assign_mask(head, fnew, fold, mask);
1352 if (err) 1358 if (err)
1353 goto errout_idr; 1359 goto errout_idr;
1354 1360
@@ -1392,6 +1398,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
1392 } 1398 }
1393 1399
1394 kfree(tb); 1400 kfree(tb);
1401 kfree(mask);
1395 return 0; 1402 return 0;
1396 1403
1397errout_mask: 1404errout_mask:
@@ -1405,6 +1412,8 @@ errout:
1405 kfree(fnew); 1412 kfree(fnew);
1406errout_tb: 1413errout_tb:
1407 kfree(tb); 1414 kfree(tb);
1415errout_mask_alloc:
1416 kfree(mask);
1408 return err; 1417 return err;
1409} 1418}
1410 1419
diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
index b910cd5c56f7..73940293700d 100644
--- a/net/sched/sch_cake.c
+++ b/net/sched/sch_cake.c
@@ -1667,7 +1667,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch,
1667 if (skb_is_gso(skb) && q->rate_flags & CAKE_FLAG_SPLIT_GSO) { 1667 if (skb_is_gso(skb) && q->rate_flags & CAKE_FLAG_SPLIT_GSO) {
1668 struct sk_buff *segs, *nskb; 1668 struct sk_buff *segs, *nskb;
1669 netdev_features_t features = netif_skb_features(skb); 1669 netdev_features_t features = netif_skb_features(skb);
1670 unsigned int slen = 0; 1670 unsigned int slen = 0, numsegs = 0;
1671 1671
1672 segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK); 1672 segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);
1673 if (IS_ERR_OR_NULL(segs)) 1673 if (IS_ERR_OR_NULL(segs))
@@ -1683,6 +1683,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch,
1683 flow_queue_add(flow, segs); 1683 flow_queue_add(flow, segs);
1684 1684
1685 sch->q.qlen++; 1685 sch->q.qlen++;
1686 numsegs++;
1686 slen += segs->len; 1687 slen += segs->len;
1687 q->buffer_used += segs->truesize; 1688 q->buffer_used += segs->truesize;
1688 b->packets++; 1689 b->packets++;
@@ -1696,7 +1697,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch,
1696 sch->qstats.backlog += slen; 1697 sch->qstats.backlog += slen;
1697 q->avg_window_bytes += slen; 1698 q->avg_window_bytes += slen;
1698 1699
1699 qdisc_tree_reduce_backlog(sch, 1, len); 1700 qdisc_tree_reduce_backlog(sch, 1-numsegs, len-slen);
1700 consume_skb(skb); 1701 consume_skb(skb);
1701 } else { 1702 } else {
1702 /* not splitting */ 1703 /* not splitting */
diff --git a/net/sched/sch_cbs.c b/net/sched/sch_cbs.c
index e689e11b6d0f..c6a502933fe7 100644
--- a/net/sched/sch_cbs.c
+++ b/net/sched/sch_cbs.c
@@ -88,13 +88,14 @@ static int cbs_child_enqueue(struct sk_buff *skb, struct Qdisc *sch,
88 struct Qdisc *child, 88 struct Qdisc *child,
89 struct sk_buff **to_free) 89 struct sk_buff **to_free)
90{ 90{
91 unsigned int len = qdisc_pkt_len(skb);
91 int err; 92 int err;
92 93
93 err = child->ops->enqueue(skb, child, to_free); 94 err = child->ops->enqueue(skb, child, to_free);
94 if (err != NET_XMIT_SUCCESS) 95 if (err != NET_XMIT_SUCCESS)
95 return err; 96 return err;
96 97
97 qdisc_qstats_backlog_inc(sch, skb); 98 sch->qstats.backlog += len;
98 sch->q.qlen++; 99 sch->q.qlen++;
99 100
100 return NET_XMIT_SUCCESS; 101 return NET_XMIT_SUCCESS;
diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c
index cdebaed0f8cf..09b800991065 100644
--- a/net/sched/sch_drr.c
+++ b/net/sched/sch_drr.c
@@ -350,9 +350,11 @@ static struct drr_class *drr_classify(struct sk_buff *skb, struct Qdisc *sch,
350static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch, 350static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch,
351 struct sk_buff **to_free) 351 struct sk_buff **to_free)
352{ 352{
353 unsigned int len = qdisc_pkt_len(skb);
353 struct drr_sched *q = qdisc_priv(sch); 354 struct drr_sched *q = qdisc_priv(sch);
354 struct drr_class *cl; 355 struct drr_class *cl;
355 int err = 0; 356 int err = 0;
357 bool first;
356 358
357 cl = drr_classify(skb, sch, &err); 359 cl = drr_classify(skb, sch, &err);
358 if (cl == NULL) { 360 if (cl == NULL) {
@@ -362,6 +364,7 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch,
362 return err; 364 return err;
363 } 365 }
364 366
367 first = !cl->qdisc->q.qlen;
365 err = qdisc_enqueue(skb, cl->qdisc, to_free); 368 err = qdisc_enqueue(skb, cl->qdisc, to_free);
366 if (unlikely(err != NET_XMIT_SUCCESS)) { 369 if (unlikely(err != NET_XMIT_SUCCESS)) {
367 if (net_xmit_drop_count(err)) { 370 if (net_xmit_drop_count(err)) {
@@ -371,12 +374,12 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch,
371 return err; 374 return err;
372 } 375 }
373 376
374 if (cl->qdisc->q.qlen == 1) { 377 if (first) {
375 list_add_tail(&cl->alist, &q->active); 378 list_add_tail(&cl->alist, &q->active);
376 cl->deficit = cl->quantum; 379 cl->deficit = cl->quantum;
377 } 380 }
378 381
379 qdisc_qstats_backlog_inc(sch, skb); 382 sch->qstats.backlog += len;
380 sch->q.qlen++; 383 sch->q.qlen++;
381 return err; 384 return err;
382} 385}
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c
index f6f480784bc6..42471464ded3 100644
--- a/net/sched/sch_dsmark.c
+++ b/net/sched/sch_dsmark.c
@@ -199,6 +199,7 @@ static struct tcf_block *dsmark_tcf_block(struct Qdisc *sch, unsigned long cl,
199static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch, 199static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch,
200 struct sk_buff **to_free) 200 struct sk_buff **to_free)
201{ 201{
202 unsigned int len = qdisc_pkt_len(skb);
202 struct dsmark_qdisc_data *p = qdisc_priv(sch); 203 struct dsmark_qdisc_data *p = qdisc_priv(sch);
203 int err; 204 int err;
204 205
@@ -271,7 +272,7 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch,
271 return err; 272 return err;
272 } 273 }
273 274
274 qdisc_qstats_backlog_inc(sch, skb); 275 sch->qstats.backlog += len;
275 sch->q.qlen++; 276 sch->q.qlen++;
276 277
277 return NET_XMIT_SUCCESS; 278 return NET_XMIT_SUCCESS;
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index b18ec1f6de60..24cc220a3218 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1539,8 +1539,10 @@ hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb)
1539static int 1539static int
1540hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) 1540hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)
1541{ 1541{
1542 unsigned int len = qdisc_pkt_len(skb);
1542 struct hfsc_class *cl; 1543 struct hfsc_class *cl;
1543 int uninitialized_var(err); 1544 int uninitialized_var(err);
1545 bool first;
1544 1546
1545 cl = hfsc_classify(skb, sch, &err); 1547 cl = hfsc_classify(skb, sch, &err);
1546 if (cl == NULL) { 1548 if (cl == NULL) {
@@ -1550,6 +1552,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)
1550 return err; 1552 return err;
1551 } 1553 }
1552 1554
1555 first = !cl->qdisc->q.qlen;
1553 err = qdisc_enqueue(skb, cl->qdisc, to_free); 1556 err = qdisc_enqueue(skb, cl->qdisc, to_free);
1554 if (unlikely(err != NET_XMIT_SUCCESS)) { 1557 if (unlikely(err != NET_XMIT_SUCCESS)) {
1555 if (net_xmit_drop_count(err)) { 1558 if (net_xmit_drop_count(err)) {
@@ -1559,9 +1562,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)
1559 return err; 1562 return err;
1560 } 1563 }
1561 1564
1562 if (cl->qdisc->q.qlen == 1) { 1565 if (first) {
1563 unsigned int len = qdisc_pkt_len(skb);
1564
1565 if (cl->cl_flags & HFSC_RSC) 1566 if (cl->cl_flags & HFSC_RSC)
1566 init_ed(cl, len); 1567 init_ed(cl, len);
1567 if (cl->cl_flags & HFSC_FSC) 1568 if (cl->cl_flags & HFSC_FSC)
@@ -1576,7 +1577,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)
1576 1577
1577 } 1578 }
1578 1579
1579 qdisc_qstats_backlog_inc(sch, skb); 1580 sch->qstats.backlog += len;
1580 sch->q.qlen++; 1581 sch->q.qlen++;
1581 1582
1582 return NET_XMIT_SUCCESS; 1583 return NET_XMIT_SUCCESS;
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 58b449490757..30f9da7e1076 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -581,6 +581,7 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch,
581 struct sk_buff **to_free) 581 struct sk_buff **to_free)
582{ 582{
583 int uninitialized_var(ret); 583 int uninitialized_var(ret);
584 unsigned int len = qdisc_pkt_len(skb);
584 struct htb_sched *q = qdisc_priv(sch); 585 struct htb_sched *q = qdisc_priv(sch);
585 struct htb_class *cl = htb_classify(skb, sch, &ret); 586 struct htb_class *cl = htb_classify(skb, sch, &ret);
586 587
@@ -610,7 +611,7 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch,
610 htb_activate(q, cl); 611 htb_activate(q, cl);
611 } 612 }
612 613
613 qdisc_qstats_backlog_inc(sch, skb); 614 sch->qstats.backlog += len;
614 sch->q.qlen++; 615 sch->q.qlen++;
615 return NET_XMIT_SUCCESS; 616 return NET_XMIT_SUCCESS;
616} 617}
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index cdf68706e40f..847141cd900f 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -72,6 +72,7 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
72static int 72static int
73prio_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) 73prio_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)
74{ 74{
75 unsigned int len = qdisc_pkt_len(skb);
75 struct Qdisc *qdisc; 76 struct Qdisc *qdisc;
76 int ret; 77 int ret;
77 78
@@ -88,7 +89,7 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)
88 89
89 ret = qdisc_enqueue(skb, qdisc, to_free); 90 ret = qdisc_enqueue(skb, qdisc, to_free);
90 if (ret == NET_XMIT_SUCCESS) { 91 if (ret == NET_XMIT_SUCCESS) {
91 qdisc_qstats_backlog_inc(sch, skb); 92 sch->qstats.backlog += len;
92 sch->q.qlen++; 93 sch->q.qlen++;
93 return NET_XMIT_SUCCESS; 94 return NET_XMIT_SUCCESS;
94 } 95 }
diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c
index dc37c4ead439..29f5c4a24688 100644
--- a/net/sched/sch_qfq.c
+++ b/net/sched/sch_qfq.c
@@ -1210,10 +1210,12 @@ static struct qfq_aggregate *qfq_choose_next_agg(struct qfq_sched *q)
1210static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch, 1210static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch,
1211 struct sk_buff **to_free) 1211 struct sk_buff **to_free)
1212{ 1212{
1213 unsigned int len = qdisc_pkt_len(skb), gso_segs;
1213 struct qfq_sched *q = qdisc_priv(sch); 1214 struct qfq_sched *q = qdisc_priv(sch);
1214 struct qfq_class *cl; 1215 struct qfq_class *cl;
1215 struct qfq_aggregate *agg; 1216 struct qfq_aggregate *agg;
1216 int err = 0; 1217 int err = 0;
1218 bool first;
1217 1219
1218 cl = qfq_classify(skb, sch, &err); 1220 cl = qfq_classify(skb, sch, &err);
1219 if (cl == NULL) { 1221 if (cl == NULL) {
@@ -1224,17 +1226,18 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch,
1224 } 1226 }
1225 pr_debug("qfq_enqueue: cl = %x\n", cl->common.classid); 1227 pr_debug("qfq_enqueue: cl = %x\n", cl->common.classid);
1226 1228
1227 if (unlikely(cl->agg->lmax < qdisc_pkt_len(skb))) { 1229 if (unlikely(cl->agg->lmax < len)) {
1228 pr_debug("qfq: increasing maxpkt from %u to %u for class %u", 1230 pr_debug("qfq: increasing maxpkt from %u to %u for class %u",
1229 cl->agg->lmax, qdisc_pkt_len(skb), cl->common.classid); 1231 cl->agg->lmax, len, cl->common.classid);
1230 err = qfq_change_agg(sch, cl, cl->agg->class_weight, 1232 err = qfq_change_agg(sch, cl, cl->agg->class_weight, len);
1231 qdisc_pkt_len(skb));
1232 if (err) { 1233 if (err) {
1233 cl->qstats.drops++; 1234 cl->qstats.drops++;
1234 return qdisc_drop(skb, sch, to_free); 1235 return qdisc_drop(skb, sch, to_free);
1235 } 1236 }
1236 } 1237 }
1237 1238
1239 gso_segs = skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1;
1240 first = !cl->qdisc->q.qlen;
1238 err = qdisc_enqueue(skb, cl->qdisc, to_free); 1241 err = qdisc_enqueue(skb, cl->qdisc, to_free);
1239 if (unlikely(err != NET_XMIT_SUCCESS)) { 1242 if (unlikely(err != NET_XMIT_SUCCESS)) {
1240 pr_debug("qfq_enqueue: enqueue failed %d\n", err); 1243 pr_debug("qfq_enqueue: enqueue failed %d\n", err);
@@ -1245,16 +1248,17 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch,
1245 return err; 1248 return err;
1246 } 1249 }
1247 1250
1248 bstats_update(&cl->bstats, skb); 1251 cl->bstats.bytes += len;
1249 qdisc_qstats_backlog_inc(sch, skb); 1252 cl->bstats.packets += gso_segs;
1253 sch->qstats.backlog += len;
1250 ++sch->q.qlen; 1254 ++sch->q.qlen;
1251 1255
1252 agg = cl->agg; 1256 agg = cl->agg;
1253 /* if the queue was not empty, then done here */ 1257 /* if the queue was not empty, then done here */
1254 if (cl->qdisc->q.qlen != 1) { 1258 if (!first) {
1255 if (unlikely(skb == cl->qdisc->ops->peek(cl->qdisc)) && 1259 if (unlikely(skb == cl->qdisc->ops->peek(cl->qdisc)) &&
1256 list_first_entry(&agg->active, struct qfq_class, alist) 1260 list_first_entry(&agg->active, struct qfq_class, alist)
1257 == cl && cl->deficit < qdisc_pkt_len(skb)) 1261 == cl && cl->deficit < len)
1258 list_move_tail(&cl->alist, &agg->active); 1262 list_move_tail(&cl->alist, &agg->active);
1259 1263
1260 return err; 1264 return err;
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index 942dcca09cf2..7f272a9070c5 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -185,6 +185,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc *sch,
185 struct sk_buff **to_free) 185 struct sk_buff **to_free)
186{ 186{
187 struct tbf_sched_data *q = qdisc_priv(sch); 187 struct tbf_sched_data *q = qdisc_priv(sch);
188 unsigned int len = qdisc_pkt_len(skb);
188 int ret; 189 int ret;
189 190
190 if (qdisc_pkt_len(skb) > q->max_size) { 191 if (qdisc_pkt_len(skb) > q->max_size) {
@@ -200,7 +201,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc *sch,
200 return ret; 201 return ret;
201 } 202 }
202 203
203 qdisc_qstats_backlog_inc(sch, skb); 204 sch->qstats.backlog += len;
204 sch->q.qlen++; 205 sch->q.qlen++;
205 return NET_XMIT_SUCCESS; 206 return NET_XMIT_SUCCESS;
206} 207}
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index b9ed271b7ef7..ed8e006dae85 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -97,11 +97,9 @@ static int sctp_inet6addr_event(struct notifier_block *this, unsigned long ev,
97 97
98 switch (ev) { 98 switch (ev) {
99 case NETDEV_UP: 99 case NETDEV_UP:
100 addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC); 100 addr = kzalloc(sizeof(*addr), GFP_ATOMIC);
101 if (addr) { 101 if (addr) {
102 addr->a.v6.sin6_family = AF_INET6; 102 addr->a.v6.sin6_family = AF_INET6;
103 addr->a.v6.sin6_port = 0;
104 addr->a.v6.sin6_flowinfo = 0;
105 addr->a.v6.sin6_addr = ifa->addr; 103 addr->a.v6.sin6_addr = ifa->addr;
106 addr->a.v6.sin6_scope_id = ifa->idev->dev->ifindex; 104 addr->a.v6.sin6_scope_id = ifa->idev->dev->ifindex;
107 addr->valid = 1; 105 addr->valid = 1;
@@ -434,7 +432,6 @@ static void sctp_v6_copy_addrlist(struct list_head *addrlist,
434 addr = kzalloc(sizeof(*addr), GFP_ATOMIC); 432 addr = kzalloc(sizeof(*addr), GFP_ATOMIC);
435 if (addr) { 433 if (addr) {
436 addr->a.v6.sin6_family = AF_INET6; 434 addr->a.v6.sin6_family = AF_INET6;
437 addr->a.v6.sin6_port = 0;
438 addr->a.v6.sin6_addr = ifp->addr; 435 addr->a.v6.sin6_addr = ifp->addr;
439 addr->a.v6.sin6_scope_id = dev->ifindex; 436 addr->a.v6.sin6_scope_id = dev->ifindex;
440 addr->valid = 1; 437 addr->valid = 1;
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index d5878ae55840..4e0eeb113ef5 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -101,7 +101,6 @@ static void sctp_v4_copy_addrlist(struct list_head *addrlist,
101 addr = kzalloc(sizeof(*addr), GFP_ATOMIC); 101 addr = kzalloc(sizeof(*addr), GFP_ATOMIC);
102 if (addr) { 102 if (addr) {
103 addr->a.v4.sin_family = AF_INET; 103 addr->a.v4.sin_family = AF_INET;
104 addr->a.v4.sin_port = 0;
105 addr->a.v4.sin_addr.s_addr = ifa->ifa_local; 104 addr->a.v4.sin_addr.s_addr = ifa->ifa_local;
106 addr->valid = 1; 105 addr->valid = 1;
107 INIT_LIST_HEAD(&addr->list); 106 INIT_LIST_HEAD(&addr->list);
@@ -776,10 +775,9 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev,
776 775
777 switch (ev) { 776 switch (ev) {
778 case NETDEV_UP: 777 case NETDEV_UP:
779 addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC); 778 addr = kzalloc(sizeof(*addr), GFP_ATOMIC);
780 if (addr) { 779 if (addr) {
781 addr->a.v4.sin_family = AF_INET; 780 addr->a.v4.sin_family = AF_INET;
782 addr->a.v4.sin_port = 0;
783 addr->a.v4.sin_addr.s_addr = ifa->ifa_local; 781 addr->a.v4.sin_addr.s_addr = ifa->ifa_local;
784 addr->valid = 1; 782 addr->valid = 1;
785 spin_lock_bh(&net->sctp.local_addr_lock); 783 spin_lock_bh(&net->sctp.local_addr_lock);
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index 77e4b2418f30..4ad3586da8f0 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -87,6 +87,11 @@ static int tipc_skb_tailroom(struct sk_buff *skb)
87 return limit; 87 return limit;
88} 88}
89 89
90static inline int TLV_GET_DATA_LEN(struct tlv_desc *tlv)
91{
92 return TLV_GET_LEN(tlv) - TLV_SPACE(0);
93}
94
90static int tipc_add_tlv(struct sk_buff *skb, u16 type, void *data, u16 len) 95static int tipc_add_tlv(struct sk_buff *skb, u16 type, void *data, u16 len)
91{ 96{
92 struct tlv_desc *tlv = (struct tlv_desc *)skb_tail_pointer(skb); 97 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)
166 return buf; 171 return buf;
167} 172}
168 173
174static inline bool string_is_valid(char *s, int len)
175{
176 return memchr(s, '\0', len) ? true : false;
177}
178
169static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd, 179static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
170 struct tipc_nl_compat_msg *msg, 180 struct tipc_nl_compat_msg *msg,
171 struct sk_buff *arg) 181 struct sk_buff *arg)
@@ -379,6 +389,7 @@ static int tipc_nl_compat_bearer_enable(struct tipc_nl_compat_cmd_doit *cmd,
379 struct nlattr *prop; 389 struct nlattr *prop;
380 struct nlattr *bearer; 390 struct nlattr *bearer;
381 struct tipc_bearer_config *b; 391 struct tipc_bearer_config *b;
392 int len;
382 393
383 b = (struct tipc_bearer_config *)TLV_DATA(msg->req); 394 b = (struct tipc_bearer_config *)TLV_DATA(msg->req);
384 395
@@ -386,6 +397,10 @@ static int tipc_nl_compat_bearer_enable(struct tipc_nl_compat_cmd_doit *cmd,
386 if (!bearer) 397 if (!bearer)
387 return -EMSGSIZE; 398 return -EMSGSIZE;
388 399
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
389 if (nla_put_string(skb, TIPC_NLA_BEARER_NAME, b->name)) 404 if (nla_put_string(skb, TIPC_NLA_BEARER_NAME, b->name))
390 return -EMSGSIZE; 405 return -EMSGSIZE;
391 406
@@ -411,6 +426,7 @@ static int tipc_nl_compat_bearer_disable(struct tipc_nl_compat_cmd_doit *cmd,
411{ 426{
412 char *name; 427 char *name;
413 struct nlattr *bearer; 428 struct nlattr *bearer;
429 int len;
414 430
415 name = (char *)TLV_DATA(msg->req); 431 name = (char *)TLV_DATA(msg->req);
416 432
@@ -418,6 +434,10 @@ static int tipc_nl_compat_bearer_disable(struct tipc_nl_compat_cmd_doit *cmd,
418 if (!bearer) 434 if (!bearer)
419 return -EMSGSIZE; 435 return -EMSGSIZE;
420 436
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
421 if (nla_put_string(skb, TIPC_NLA_BEARER_NAME, name)) 441 if (nla_put_string(skb, TIPC_NLA_BEARER_NAME, name))
422 return -EMSGSIZE; 442 return -EMSGSIZE;
423 443
@@ -478,6 +498,7 @@ static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg,
478 struct nlattr *prop[TIPC_NLA_PROP_MAX + 1]; 498 struct nlattr *prop[TIPC_NLA_PROP_MAX + 1];
479 struct nlattr *stats[TIPC_NLA_STATS_MAX + 1]; 499 struct nlattr *stats[TIPC_NLA_STATS_MAX + 1];
480 int err; 500 int err;
501 int len;
481 502
482 if (!attrs[TIPC_NLA_LINK]) 503 if (!attrs[TIPC_NLA_LINK])
483 return -EINVAL; 504 return -EINVAL;
@@ -504,6 +525,11 @@ static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg,
504 return err; 525 return err;
505 526
506 name = (char *)TLV_DATA(msg->req); 527 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
507 if (strcmp(name, nla_data(link[TIPC_NLA_LINK_NAME])) != 0) 533 if (strcmp(name, nla_data(link[TIPC_NLA_LINK_NAME])) != 0)
508 return 0; 534 return 0;
509 535
@@ -644,6 +670,7 @@ static int tipc_nl_compat_media_set(struct sk_buff *skb,
644 struct nlattr *prop; 670 struct nlattr *prop;
645 struct nlattr *media; 671 struct nlattr *media;
646 struct tipc_link_config *lc; 672 struct tipc_link_config *lc;
673 int len;
647 674
648 lc = (struct tipc_link_config *)TLV_DATA(msg->req); 675 lc = (struct tipc_link_config *)TLV_DATA(msg->req);
649 676
@@ -651,6 +678,10 @@ static int tipc_nl_compat_media_set(struct sk_buff *skb,
651 if (!media) 678 if (!media)
652 return -EMSGSIZE; 679 return -EMSGSIZE;
653 680
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
654 if (nla_put_string(skb, TIPC_NLA_MEDIA_NAME, lc->name)) 685 if (nla_put_string(skb, TIPC_NLA_MEDIA_NAME, lc->name))
655 return -EMSGSIZE; 686 return -EMSGSIZE;
656 687
@@ -671,6 +702,7 @@ static int tipc_nl_compat_bearer_set(struct sk_buff *skb,
671 struct nlattr *prop; 702 struct nlattr *prop;
672 struct nlattr *bearer; 703 struct nlattr *bearer;
673 struct tipc_link_config *lc; 704 struct tipc_link_config *lc;
705 int len;
674 706
675 lc = (struct tipc_link_config *)TLV_DATA(msg->req); 707 lc = (struct tipc_link_config *)TLV_DATA(msg->req);
676 708
@@ -678,6 +710,10 @@ static int tipc_nl_compat_bearer_set(struct sk_buff *skb,
678 if (!bearer) 710 if (!bearer)
679 return -EMSGSIZE; 711 return -EMSGSIZE;
680 712
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
681 if (nla_put_string(skb, TIPC_NLA_BEARER_NAME, lc->name)) 717 if (nla_put_string(skb, TIPC_NLA_BEARER_NAME, lc->name))
682 return -EMSGSIZE; 718 return -EMSGSIZE;
683 719
@@ -726,9 +762,14 @@ static int tipc_nl_compat_link_set(struct tipc_nl_compat_cmd_doit *cmd,
726 struct tipc_link_config *lc; 762 struct tipc_link_config *lc;
727 struct tipc_bearer *bearer; 763 struct tipc_bearer *bearer;
728 struct tipc_media *media; 764 struct tipc_media *media;
765 int len;
729 766
730 lc = (struct tipc_link_config *)TLV_DATA(msg->req); 767 lc = (struct tipc_link_config *)TLV_DATA(msg->req);
731 768
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
732 media = tipc_media_find(lc->name); 773 media = tipc_media_find(lc->name);
733 if (media) { 774 if (media) {
734 cmd->doit = &__tipc_nl_media_set; 775 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,
750{ 791{
751 char *name; 792 char *name;
752 struct nlattr *link; 793 struct nlattr *link;
794 int len;
753 795
754 name = (char *)TLV_DATA(msg->req); 796 name = (char *)TLV_DATA(msg->req);
755 797
@@ -757,6 +799,10 @@ static int tipc_nl_compat_link_reset_stats(struct tipc_nl_compat_cmd_doit *cmd,
757 if (!link) 799 if (!link)
758 return -EMSGSIZE; 800 return -EMSGSIZE;
759 801
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
760 if (nla_put_string(skb, TIPC_NLA_LINK_NAME, name)) 806 if (nla_put_string(skb, TIPC_NLA_LINK_NAME, name))
761 return -EMSGSIZE; 807 return -EMSGSIZE;
762 808
@@ -778,6 +824,8 @@ static int tipc_nl_compat_name_table_dump_header(struct tipc_nl_compat_msg *msg)
778 }; 824 };
779 825
780 ntq = (struct tipc_name_table_query *)TLV_DATA(msg->req); 826 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;
781 829
782 depth = ntohl(ntq->depth); 830 depth = ntohl(ntq->depth);
783 831
@@ -1208,7 +1256,7 @@ static int tipc_nl_compat_recv(struct sk_buff *skb, struct genl_info *info)
1208 } 1256 }
1209 1257
1210 len = nlmsg_attrlen(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN); 1258 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)) {
1212 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_SUPPORTED); 1260 msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_SUPPORTED);
1213 err = -EOPNOTSUPP; 1261 err = -EOPNOTSUPP;
1214 goto send; 1262 goto send;
diff --git a/net/tipc/topsrv.c b/net/tipc/topsrv.c
index efb16f69bd2c..a457c0fbbef1 100644
--- a/net/tipc/topsrv.c
+++ b/net/tipc/topsrv.c
@@ -398,7 +398,7 @@ static int tipc_conn_rcv_from_sock(struct tipc_conn *con)
398 ret = sock_recvmsg(con->sock, &msg, MSG_DONTWAIT); 398 ret = sock_recvmsg(con->sock, &msg, MSG_DONTWAIT);
399 if (ret == -EWOULDBLOCK) 399 if (ret == -EWOULDBLOCK)
400 return -EWOULDBLOCK; 400 return -EWOULDBLOCK;
401 if (ret > 0) { 401 if (ret == sizeof(s)) {
402 read_lock_bh(&sk->sk_callback_lock); 402 read_lock_bh(&sk->sk_callback_lock);
403 ret = tipc_conn_rcv_sub(srv, con, &s); 403 ret = tipc_conn_rcv_sub(srv, con, &s);
404 read_unlock_bh(&sk->sk_callback_lock); 404 read_unlock_bh(&sk->sk_callback_lock);
diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c
index a264cf2accd0..d4de871e7d4d 100644
--- a/net/xdp/xdp_umem.c
+++ b/net/xdp/xdp_umem.c
@@ -41,13 +41,20 @@ void xdp_del_sk_umem(struct xdp_umem *umem, struct xdp_sock *xs)
41 * not know if the device has more tx queues than rx, or the opposite. 41 * not know if the device has more tx queues than rx, or the opposite.
42 * This might also change during run time. 42 * This might also change during run time.
43 */ 43 */
44static void xdp_reg_umem_at_qid(struct net_device *dev, struct xdp_umem *umem, 44static int xdp_reg_umem_at_qid(struct net_device *dev, struct xdp_umem *umem,
45 u16 queue_id) 45 u16 queue_id)
46{ 46{
47 if (queue_id >= max_t(unsigned int,
48 dev->real_num_rx_queues,
49 dev->real_num_tx_queues))
50 return -EINVAL;
51
47 if (queue_id < dev->real_num_rx_queues) 52 if (queue_id < dev->real_num_rx_queues)
48 dev->_rx[queue_id].umem = umem; 53 dev->_rx[queue_id].umem = umem;
49 if (queue_id < dev->real_num_tx_queues) 54 if (queue_id < dev->real_num_tx_queues)
50 dev->_tx[queue_id].umem = umem; 55 dev->_tx[queue_id].umem = umem;
56
57 return 0;
51} 58}
52 59
53struct xdp_umem *xdp_get_umem_from_qid(struct net_device *dev, 60struct 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,
88 goto out_rtnl_unlock; 95 goto out_rtnl_unlock;
89 } 96 }
90 97
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
92 umem->dev = dev; 102 umem->dev = dev;
93 umem->queue_id = queue_id; 103 umem->queue_id = queue_id;
94 if (force_copy) 104 if (force_copy)
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 66ae15f27c70..db1a91dfa702 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -279,6 +279,7 @@ $(obj)/%.o: $(src)/%.c
279 -Wno-gnu-variable-sized-type-not-at-end \ 279 -Wno-gnu-variable-sized-type-not-at-end \
280 -Wno-address-of-packed-member -Wno-tautological-compare \ 280 -Wno-address-of-packed-member -Wno-tautological-compare \
281 -Wno-unknown-warning-option $(CLANG_ARCH_ARGS) \ 281 -Wno-unknown-warning-option $(CLANG_ARCH_ARGS) \
282 -I$(srctree)/samples/bpf/ -include asm_goto_workaround.h \
282 -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf $(LLC_FLAGS) -filetype=obj -o $@ 283 -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf $(LLC_FLAGS) -filetype=obj -o $@
283ifeq ($(DWARF2BTF),y) 284ifeq ($(DWARF2BTF),y)
284 $(BTF_PAHOLE) -J $@ 285 $(BTF_PAHOLE) -J $@
diff --git a/samples/bpf/asm_goto_workaround.h b/samples/bpf/asm_goto_workaround.h
new file mode 100644
index 000000000000..5cd7c1d1a5d5
--- /dev/null
+++ b/samples/bpf/asm_goto_workaround.h
@@ -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
diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index 492f0f24e2d3..4ad1f0894d53 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -93,9 +93,16 @@ BFD_SRCS = jit_disasm.c
93SRCS = $(filter-out $(BFD_SRCS),$(wildcard *.c)) 93SRCS = $(filter-out $(BFD_SRCS),$(wildcard *.c))
94 94
95ifeq ($(feature-libbfd),1) 95ifeq ($(feature-libbfd),1)
96 LIBS += -lbfd -ldl -lopcodes
97else ifeq ($(feature-libbfd-liberty),1)
98 LIBS += -lbfd -ldl -lopcodes -liberty
99else ifeq ($(feature-libbfd-liberty-z),1)
100 LIBS += -lbfd -ldl -lopcodes -liberty -lz
101endif
102
103ifneq ($(filter -lbfd,$(LIBS)),)
96CFLAGS += -DHAVE_LIBBFD_SUPPORT 104CFLAGS += -DHAVE_LIBBFD_SUPPORT
97SRCS += $(BFD_SRCS) 105SRCS += $(BFD_SRCS)
98LIBS += -lbfd -lopcodes
99endif 106endif
100 107
101OBJS = $(patsubst %.c,$(OUTPUT)%.o,$(SRCS)) $(OUTPUT)disasm.o 108OBJS = $(patsubst %.c,$(OUTPUT)%.o,$(SRCS)) $(OUTPUT)disasm.o
diff --git a/tools/bpf/bpftool/json_writer.c b/tools/bpf/bpftool/json_writer.c
index bff7ee026680..6046dcab51cc 100644
--- a/tools/bpf/bpftool/json_writer.c
+++ b/tools/bpf/bpftool/json_writer.c
@@ -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)
2/* 2/*
3 * Simple streaming JSON writer 3 * Simple streaming JSON writer
4 * 4 *
5 * This takes care of the annoying bits of JSON syntax like the commas 5 * This takes care of the annoying bits of JSON syntax like the commas
6 * after elements 6 * after elements
7 * 7 *
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 *
13 * Authors: Stephen Hemminger <stephen@networkplumber.org> 8 * Authors: Stephen Hemminger <stephen@networkplumber.org>
14 */ 9 */
15 10
diff --git a/tools/bpf/bpftool/json_writer.h b/tools/bpf/bpftool/json_writer.h
index c1ab51aed99c..cb9a1993681c 100644
--- a/tools/bpf/bpftool/json_writer.h
+++ b/tools/bpf/bpftool/json_writer.h
@@ -5,11 +5,6 @@
5 * This takes care of the annoying bits of JSON syntax like the commas 5 * This takes care of the annoying bits of JSON syntax like the commas
6 * after elements 6 * after elements
7 * 7 *
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 *
13 * Authors: Stephen Hemminger <stephen@networkplumber.org> 8 * Authors: Stephen Hemminger <stephen@networkplumber.org>
14 */ 9 */
15 10
diff --git a/tools/include/uapi/linux/pkt_sched.h b/tools/include/uapi/linux/pkt_sched.h
new file mode 100644
index 000000000000..0d18b1d1fbbc
--- /dev/null
+++ b/tools/include/uapi/linux/pkt_sched.h
@@ -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
33struct 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
45struct 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" */
83enum 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
90struct 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
101struct 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
112enum {
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
123struct 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
138struct 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
147struct 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
154struct 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
166struct 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
182struct tc_tbf_qopt {
183 struct tc_ratespec rate;
184 struct tc_ratespec peakrate;
185 __u32 limit;
186 __u32 buffer;
187 __u32 mtu;
188};
189
190enum {
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
212struct 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
220struct 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
229struct 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
247struct tc_sfq_xstats {
248 __s32 allot;
249};
250
251/* RED section */
252
253enum {
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
263struct 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
276struct 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
287enum {
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
300enum {
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
307enum {
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
326struct 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 */
346struct 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
356enum {
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
366struct 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
376struct 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
389struct 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};
398struct 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};
407enum {
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
422struct 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
432struct tc_hfsc_qopt {
433 __u16 defcls; /* default class */
434};
435
436struct 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
442struct 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
449enum {
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
466struct 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
485struct 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
494struct 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
506struct tc_cbq_police {
507 unsigned char police;
508 unsigned char __res1;
509 unsigned short __res2;
510};
511
512struct tc_cbq_fopt {
513 __u32 split;
514 __u32 defmap;
515 __u32 defchange;
516};
517
518struct tc_cbq_xstats {
519 __u32 borrows;
520 __u32 overactions;
521 __s32 avgidle;
522 __s32 undertime;
523};
524
525enum {
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
541enum {
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
555enum {
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
570enum {
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
590struct 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
599struct tc_netem_corr {
600 __u32 delay_corr; /* delay correlation */
601 __u32 loss_corr; /* packet loss correlation */
602 __u32 dup_corr; /* duplicate correlation */
603};
604
605struct tc_netem_reorder {
606 __u32 probability;
607 __u32 correlation;
608};
609
610struct tc_netem_corrupt {
611 __u32 probability;
612 __u32 correlation;
613};
614
615struct tc_netem_rate {
616 __u32 rate; /* byte/s */
617 __s32 packet_overhead;
618 __u32 cell_size;
619 __s32 cell_overhead;
620};
621
622struct 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
631enum {
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 */
640struct tc_netem_gimodel {
641 __u32 p13;
642 __u32 p31;
643 __u32 p32;
644 __u32 p14;
645 __u32 p23;
646};
647
648/* Gilbert-Elliot models */
649struct 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
661enum {
662 TCA_DRR_UNSPEC,
663 TCA_DRR_QUANTUM,
664 __TCA_DRR_MAX
665};
666
667#define TCA_DRR_MAX (__TCA_DRR_MAX - 1)
668
669struct tc_drr_stats {
670 __u32 deficit;
671};
672
673/* MQPRIO */
674#define TC_QOPT_BITMASK 15
675#define TC_QOPT_MAX_QUEUE 16
676
677enum {
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
685enum {
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
693enum {
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
701struct 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
714enum {
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
727enum {
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 */
738struct 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
750struct 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 */
765enum {
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
774struct tc_qfq_stats {
775 __u32 weight;
776 __u32 lmax;
777};
778
779/* CODEL */
780
781enum {
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
793struct 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
809enum {
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
825enum {
826 TCA_FQ_CODEL_XSTATS_QDISC,
827 TCA_FQ_CODEL_XSTATS_CLASS,
828};
829
830struct 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
848struct 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
859struct 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
869enum {
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
901struct 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
919enum {
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
933struct 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 */
943enum {
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
956struct 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 */
968struct tc_cbs_qopt {
969 __u8 offload;
970 __u8 _pad[3];
971 __s32 hicredit;
972 __s32 locredit;
973 __s32 idleslope;
974 __s32 sendslope;
975};
976
977enum {
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 */
987struct 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
995enum {
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 */
1005enum {
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
1028enum {
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
1050enum {
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
1082enum {
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
1094enum {
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
1103enum {
1104 CAKE_ACK_NONE = 0,
1105 CAKE_ACK_FILTER,
1106 CAKE_ACK_AGGRESSIVE,
1107 CAKE_ACK_MAX
1108};
1109
1110enum {
1111 CAKE_ATM_NONE = 0,
1112 CAKE_ATM_ATM,
1113 CAKE_ATM_PTM,
1114 CAKE_ATM_MAX
1115};
1116
1117
1118/* TAPRIO */
1119enum {
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
1125enum {
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 */
1142enum {
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
1150enum {
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
diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
index 3caaa3428774..88cbd110ae58 100644
--- a/tools/lib/bpf/bpf.c
+++ b/tools/lib/bpf/bpf.c
@@ -65,6 +65,17 @@ static inline int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr,
65 return syscall(__NR_bpf, cmd, attr, size); 65 return syscall(__NR_bpf, cmd, attr, size);
66} 66}
67 67
68static 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
68int bpf_create_map_xattr(const struct bpf_create_map_attr *create_attr) 79int bpf_create_map_xattr(const struct bpf_create_map_attr *create_attr)
69{ 80{
70 __u32 name_len = create_attr->name ? strlen(create_attr->name) : 0; 81 __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,
232 memcpy(attr.prog_name, load_attr->name, 243 memcpy(attr.prog_name, load_attr->name,
233 min(name_len, BPF_OBJ_NAME_LEN - 1)); 244 min(name_len, BPF_OBJ_NAME_LEN - 1));
234 245
235 fd = sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); 246 fd = sys_bpf_prog_load(&attr, sizeof(attr));
236 if (fd >= 0) 247 if (fd >= 0)
237 return fd; 248 return fd;
238 249
@@ -269,7 +280,7 @@ int bpf_load_program_xattr(const struct bpf_load_program_attr *load_attr,
269 break; 280 break;
270 } 281 }
271 282
272 fd = sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); 283 fd = sys_bpf_prog_load(&attr, sizeof(attr));
273 284
274 if (fd >= 0) 285 if (fd >= 0)
275 goto done; 286 goto done;
@@ -283,7 +294,7 @@ int bpf_load_program_xattr(const struct bpf_load_program_attr *load_attr,
283 attr.log_size = log_buf_sz; 294 attr.log_size = log_buf_sz;
284 attr.log_level = 1; 295 attr.log_level = 1;
285 log_buf[0] = 0; 296 log_buf[0] = 0;
286 fd = sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); 297 fd = sys_bpf_prog_load(&attr, sizeof(attr));
287done: 298done:
288 free(finfo); 299 free(finfo);
289 free(linfo); 300 free(linfo);
@@ -328,7 +339,7 @@ int bpf_verify_program(enum bpf_prog_type type, const struct bpf_insn *insns,
328 attr.kern_version = kern_version; 339 attr.kern_version = kern_version;
329 attr.prog_flags = prog_flags; 340 attr.prog_flags = prog_flags;
330 341
331 return sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); 342 return sys_bpf_prog_load(&attr, sizeof(attr));
332} 343}
333 344
334int bpf_map_update_elem(int fd, const void *key, const void *value, 345int bpf_map_update_elem(int fd, const void *key, const void *value,
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 70229de510f5..41ab7a3668b3 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -56,6 +56,7 @@ TEST_PROGS := test_kmod.sh \
56 test_xdp_vlan.sh 56 test_xdp_vlan.sh
57 57
58TEST_PROGS_EXTENDED := with_addr.sh \ 58TEST_PROGS_EXTENDED := with_addr.sh \
59 with_tunnels.sh \
59 tcp_client.py \ 60 tcp_client.py \
60 tcp_server.py 61 tcp_server.py
61 62
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index 126fc624290d..25f0083a9b2e 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -1188,7 +1188,9 @@ static void test_stacktrace_build_id(void)
1188 int i, j; 1188 int i, j;
1189 struct bpf_stack_build_id id_offs[PERF_MAX_STACK_DEPTH]; 1189 struct bpf_stack_build_id id_offs[PERF_MAX_STACK_DEPTH];
1190 int build_id_matches = 0; 1190 int build_id_matches = 0;
1191 int retry = 1;
1191 1192
1193retry:
1192 err = bpf_prog_load(file, BPF_PROG_TYPE_TRACEPOINT, &obj, &prog_fd); 1194 err = bpf_prog_load(file, BPF_PROG_TYPE_TRACEPOINT, &obj, &prog_fd);
1193 if (CHECK(err, "prog_load", "err %d errno %d\n", err, errno)) 1195 if (CHECK(err, "prog_load", "err %d errno %d\n", err, errno))
1194 goto out; 1196 goto out;
@@ -1301,6 +1303,19 @@ static void test_stacktrace_build_id(void)
1301 previous_key = key; 1303 previous_key = key;
1302 } while (bpf_map_get_next_key(stackmap_fd, &previous_key, &key) == 0); 1304 } while (bpf_map_get_next_key(stackmap_fd, &previous_key, &key) == 0);
1303 1305
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
1304 if (CHECK(build_id_matches < 1, "build id match", 1319 if (CHECK(build_id_matches < 1, "build id match",
1305 "Didn't find expected build ID from the map\n")) 1320 "Didn't find expected build ID from the map\n"))
1306 goto disable_pmu; 1321 goto disable_pmu;
@@ -1341,7 +1356,9 @@ static void test_stacktrace_build_id_nmi(void)
1341 int i, j; 1356 int i, j;
1342 struct bpf_stack_build_id id_offs[PERF_MAX_STACK_DEPTH]; 1357 struct bpf_stack_build_id id_offs[PERF_MAX_STACK_DEPTH];
1343 int build_id_matches = 0; 1358 int build_id_matches = 0;
1359 int retry = 1;
1344 1360
1361retry:
1345 err = bpf_prog_load(file, BPF_PROG_TYPE_PERF_EVENT, &obj, &prog_fd); 1362 err = bpf_prog_load(file, BPF_PROG_TYPE_PERF_EVENT, &obj, &prog_fd);
1346 if (CHECK(err, "prog_load", "err %d errno %d\n", err, errno)) 1363 if (CHECK(err, "prog_load", "err %d errno %d\n", err, errno))
1347 return; 1364 return;
@@ -1436,6 +1453,19 @@ static void test_stacktrace_build_id_nmi(void)
1436 previous_key = key; 1453 previous_key = key;
1437 } while (bpf_map_get_next_key(stackmap_fd, &previous_key, &key) == 0); 1454 } while (bpf_map_get_next_key(stackmap_fd, &previous_key, &key) == 0);
1438 1455
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
1439 if (CHECK(build_id_matches < 1, "build id match", 1469 if (CHECK(build_id_matches < 1, "build id match",
1440 "Didn't find expected build ID from the map\n")) 1470 "Didn't find expected build ID from the map\n"))
1441 goto disable_pmu; 1471 goto disable_pmu;
diff --git a/tools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh b/tools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh
index 94fdbf215c14..c4cf6e6d800e 100755
--- a/tools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh
@@ -25,6 +25,7 @@ ALL_TESTS="
25 lag_unlink_slaves_test 25 lag_unlink_slaves_test
26 lag_dev_deletion_test 26 lag_dev_deletion_test
27 vlan_interface_uppers_test 27 vlan_interface_uppers_test
28 bridge_extern_learn_test
28 devlink_reload_test 29 devlink_reload_test
29" 30"
30NUM_NETIFS=2 31NUM_NETIFS=2
@@ -541,6 +542,25 @@ vlan_interface_uppers_test()
541 ip link del dev br0 542 ip link del dev br0
542} 543}
543 544
545bridge_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
544devlink_reload_test() 564devlink_reload_test()
545{ 565{
546 # Test that after executing all the above configuration tests, a 566 # Test that after executing all the above configuration tests, a
diff --git a/tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh b/tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh
index 04c6431b2bd8..b90dff8d3a94 100755
--- a/tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh
+++ b/tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh
@@ -1,7 +1,7 @@
1#!/bin/bash 1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0 2# SPDX-License-Identifier: GPL-2.0
3 3
4ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding vlan_deletion" 4ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding vlan_deletion extern_learn"
5NUM_NETIFS=4 5NUM_NETIFS=4
6CHECK_TC="yes" 6CHECK_TC="yes"
7source lib.sh 7source lib.sh
@@ -109,6 +109,38 @@ vlan_deletion()
109 ping_ipv6 109 ping_ipv6
110} 110}
111 111
112extern_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
112trap cleanup EXIT 144trap cleanup EXIT
113 145
114setup_prepare 146setup_prepare
diff --git a/tools/testing/selftests/networking/timestamping/txtimestamp.c b/tools/testing/selftests/networking/timestamping/txtimestamp.c
index 2e563d17cf0c..d1bbafb16f47 100644
--- a/tools/testing/selftests/networking/timestamping/txtimestamp.c
+++ b/tools/testing/selftests/networking/timestamping/txtimestamp.c
@@ -240,7 +240,7 @@ static void __recv_errmsg_cmsg(struct msghdr *msg, int payload_len)
240 cm->cmsg_type == IP_RECVERR) || 240 cm->cmsg_type == IP_RECVERR) ||
241 (cm->cmsg_level == SOL_IPV6 && 241 (cm->cmsg_level == SOL_IPV6 &&
242 cm->cmsg_type == IPV6_RECVERR) || 242 cm->cmsg_type == IPV6_RECVERR) ||
243 (cm->cmsg_level = SOL_PACKET && 243 (cm->cmsg_level == SOL_PACKET &&
244 cm->cmsg_type == PACKET_TX_TIMESTAMP)) { 244 cm->cmsg_type == PACKET_TX_TIMESTAMP)) {
245 serr = (void *) CMSG_DATA(cm); 245 serr = (void *) CMSG_DATA(cm);
246 if (serr->ee_errno != ENOMSG || 246 if (serr->ee_errno != ENOMSG ||
diff --git a/tools/testing/selftests/tc-testing/tc-tests/actions/ife.json b/tools/testing/selftests/tc-testing/tc-tests/actions/ife.json
index 637ea0219617..0da3545cabdb 100644
--- a/tools/testing/selftests/tc-testing/tc-tests/actions/ife.json
+++ b/tools/testing/selftests/tc-testing/tc-tests/actions/ife.json
@@ -17,7 +17,7 @@
17 "cmdUnderTest": "$TC actions add action ife encode allow mark pass index 2", 17 "cmdUnderTest": "$TC actions add action ife encode allow mark pass index 2",
18 "expExitCode": "0", 18 "expExitCode": "0",
19 "verifyCmd": "$TC actions get action ife index 2", 19 "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",
21 "matchCount": "1", 21 "matchCount": "1",
22 "teardown": [ 22 "teardown": [
23 "$TC actions flush action ife" 23 "$TC actions flush action ife"
@@ -41,7 +41,7 @@
41 "cmdUnderTest": "$TC actions add action ife encode use mark 10 pipe index 2", 41 "cmdUnderTest": "$TC actions add action ife encode use mark 10 pipe index 2",
42 "expExitCode": "0", 42 "expExitCode": "0",
43 "verifyCmd": "$TC actions get action ife index 2", 43 "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",
45 "matchCount": "1", 45 "matchCount": "1",
46 "teardown": [ 46 "teardown": [
47 "$TC actions flush action ife" 47 "$TC actions flush action ife"
@@ -65,7 +65,7 @@
65 "cmdUnderTest": "$TC actions add action ife encode allow mark continue index 2", 65 "cmdUnderTest": "$TC actions add action ife encode allow mark continue index 2",
66 "expExitCode": "0", 66 "expExitCode": "0",
67 "verifyCmd": "$TC actions get action ife index 2", 67 "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",
69 "matchCount": "1", 69 "matchCount": "1",
70 "teardown": [ 70 "teardown": [
71 "$TC actions flush action ife" 71 "$TC actions flush action ife"
@@ -89,7 +89,7 @@
89 "cmdUnderTest": "$TC actions add action ife encode use mark 789 drop index 2", 89 "cmdUnderTest": "$TC actions add action ife encode use mark 789 drop index 2",
90 "expExitCode": "0", 90 "expExitCode": "0",
91 "verifyCmd": "$TC actions get action ife index 2", 91 "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",
93 "matchCount": "1", 93 "matchCount": "1",
94 "teardown": [ 94 "teardown": [
95 "$TC actions flush action ife" 95 "$TC actions flush action ife"
@@ -113,7 +113,7 @@
113 "cmdUnderTest": "$TC actions add action ife encode use mark 656768 reclassify index 2", 113 "cmdUnderTest": "$TC actions add action ife encode use mark 656768 reclassify index 2",
114 "expExitCode": "0", 114 "expExitCode": "0",
115 "verifyCmd": "$TC actions get action ife index 2", 115 "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",
117 "matchCount": "1", 117 "matchCount": "1",
118 "teardown": [ 118 "teardown": [
119 "$TC actions flush action ife" 119 "$TC actions flush action ife"
@@ -137,7 +137,7 @@
137 "cmdUnderTest": "$TC actions add action ife encode use mark 65 jump 1 index 2", 137 "cmdUnderTest": "$TC actions add action ife encode use mark 65 jump 1 index 2",
138 "expExitCode": "0", 138 "expExitCode": "0",
139 "verifyCmd": "$TC actions get action ife index 2", 139 "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",
141 "matchCount": "1", 141 "matchCount": "1",
142 "teardown": [ 142 "teardown": [
143 "$TC actions flush action ife" 143 "$TC actions flush action ife"
@@ -161,7 +161,7 @@
161 "cmdUnderTest": "$TC actions add action ife encode use mark 4294967295 reclassify index 90", 161 "cmdUnderTest": "$TC actions add action ife encode use mark 4294967295 reclassify index 90",
162 "expExitCode": "0", 162 "expExitCode": "0",
163 "verifyCmd": "$TC actions get action ife index 90", 163 "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",
165 "matchCount": "1", 165 "matchCount": "1",
166 "teardown": [ 166 "teardown": [
167 "$TC actions flush action ife" 167 "$TC actions flush action ife"
@@ -185,7 +185,7 @@
185 "cmdUnderTest": "$TC actions add action ife encode use mark 4294967295999 pipe index 90", 185 "cmdUnderTest": "$TC actions add action ife encode use mark 4294967295999 pipe index 90",
186 "expExitCode": "255", 186 "expExitCode": "255",
187 "verifyCmd": "$TC actions get action ife index 90", 187 "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",
189 "matchCount": "0", 189 "matchCount": "0",
190 "teardown": [] 190 "teardown": []
191 }, 191 },
@@ -207,7 +207,7 @@
207 "cmdUnderTest": "$TC actions add action ife encode allow prio pass index 9", 207 "cmdUnderTest": "$TC actions add action ife encode allow prio pass index 9",
208 "expExitCode": "0", 208 "expExitCode": "0",
209 "verifyCmd": "$TC actions get action ife index 9", 209 "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",
211 "matchCount": "1", 211 "matchCount": "1",
212 "teardown": [ 212 "teardown": [
213 "$TC actions flush action ife" 213 "$TC actions flush action ife"
@@ -231,7 +231,7 @@
231 "cmdUnderTest": "$TC actions add action ife encode use prio 7 pipe index 9", 231 "cmdUnderTest": "$TC actions add action ife encode use prio 7 pipe index 9",
232 "expExitCode": "0", 232 "expExitCode": "0",
233 "verifyCmd": "$TC actions get action ife index 9", 233 "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",
235 "matchCount": "1", 235 "matchCount": "1",
236 "teardown": [ 236 "teardown": [
237 "$TC actions flush action ife" 237 "$TC actions flush action ife"
@@ -255,7 +255,7 @@
255 "cmdUnderTest": "$TC actions add action ife encode use prio 3 continue index 9", 255 "cmdUnderTest": "$TC actions add action ife encode use prio 3 continue index 9",
256 "expExitCode": "0", 256 "expExitCode": "0",
257 "verifyCmd": "$TC actions get action ife index 9", 257 "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",
259 "matchCount": "1", 259 "matchCount": "1",
260 "teardown": [ 260 "teardown": [
261 "$TC actions flush action ife" 261 "$TC actions flush action ife"
@@ -279,7 +279,7 @@
279 "cmdUnderTest": "$TC actions add action ife encode allow prio drop index 9", 279 "cmdUnderTest": "$TC actions add action ife encode allow prio drop index 9",
280 "expExitCode": "0", 280 "expExitCode": "0",
281 "verifyCmd": "$TC actions get action ife index 9", 281 "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",
283 "matchCount": "1", 283 "matchCount": "1",
284 "teardown": [ 284 "teardown": [
285 "$TC actions flush action ife" 285 "$TC actions flush action ife"
@@ -303,7 +303,7 @@
303 "cmdUnderTest": "$TC actions add action ife encode use prio 998877 reclassify index 9", 303 "cmdUnderTest": "$TC actions add action ife encode use prio 998877 reclassify index 9",
304 "expExitCode": "0", 304 "expExitCode": "0",
305 "verifyCmd": "$TC actions get action ife index 9", 305 "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",
307 "matchCount": "1", 307 "matchCount": "1",
308 "teardown": [ 308 "teardown": [
309 "$TC actions flush action ife" 309 "$TC actions flush action ife"
@@ -327,7 +327,7 @@
327 "cmdUnderTest": "$TC actions add action ife encode use prio 998877 jump 10 index 9", 327 "cmdUnderTest": "$TC actions add action ife encode use prio 998877 jump 10 index 9",
328 "expExitCode": "0", 328 "expExitCode": "0",
329 "verifyCmd": "$TC actions get action ife index 9", 329 "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",
331 "matchCount": "1", 331 "matchCount": "1",
332 "teardown": [ 332 "teardown": [
333 "$TC actions flush action ife" 333 "$TC actions flush action ife"
@@ -351,7 +351,7 @@
351 "cmdUnderTest": "$TC actions add action ife encode use prio 4294967295 reclassify index 99", 351 "cmdUnderTest": "$TC actions add action ife encode use prio 4294967295 reclassify index 99",
352 "expExitCode": "0", 352 "expExitCode": "0",
353 "verifyCmd": "$TC actions get action ife index 99", 353 "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",
355 "matchCount": "1", 355 "matchCount": "1",
356 "teardown": [ 356 "teardown": [
357 "$TC actions flush action ife" 357 "$TC actions flush action ife"
@@ -375,7 +375,7 @@
375 "cmdUnderTest": "$TC actions add action ife encode use prio 4294967298 pipe index 99", 375 "cmdUnderTest": "$TC actions add action ife encode use prio 4294967298 pipe index 99",
376 "expExitCode": "255", 376 "expExitCode": "255",
377 "verifyCmd": "$TC actions get action ife index 99", 377 "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",
379 "matchCount": "0", 379 "matchCount": "0",
380 "teardown": [] 380 "teardown": []
381 }, 381 },
@@ -397,7 +397,7 @@
397 "cmdUnderTest": "$TC actions add action ife encode allow tcindex pass index 1", 397 "cmdUnderTest": "$TC actions add action ife encode allow tcindex pass index 1",
398 "expExitCode": "0", 398 "expExitCode": "0",
399 "verifyCmd": "$TC actions get action ife index 1", 399 "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",
401 "matchCount": "1", 401 "matchCount": "1",
402 "teardown": [ 402 "teardown": [
403 "$TC actions flush action ife" 403 "$TC actions flush action ife"
@@ -421,7 +421,7 @@
421 "cmdUnderTest": "$TC actions add action ife encode use tcindex 111 pipe index 1", 421 "cmdUnderTest": "$TC actions add action ife encode use tcindex 111 pipe index 1",
422 "expExitCode": "0", 422 "expExitCode": "0",
423 "verifyCmd": "$TC actions get action ife index 1", 423 "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",
425 "matchCount": "1", 425 "matchCount": "1",
426 "teardown": [ 426 "teardown": [
427 "$TC actions flush action ife" 427 "$TC actions flush action ife"
@@ -445,7 +445,7 @@
445 "cmdUnderTest": "$TC actions add action ife encode use tcindex 1 continue index 1", 445 "cmdUnderTest": "$TC actions add action ife encode use tcindex 1 continue index 1",
446 "expExitCode": "0", 446 "expExitCode": "0",
447 "verifyCmd": "$TC actions get action ife index 1", 447 "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",
449 "matchCount": "1", 449 "matchCount": "1",
450 "teardown": [ 450 "teardown": [
451 "$TC actions flush action ife" 451 "$TC actions flush action ife"
@@ -469,7 +469,7 @@
469 "cmdUnderTest": "$TC actions add action ife encode use tcindex 1 continue index 1", 469 "cmdUnderTest": "$TC actions add action ife encode use tcindex 1 continue index 1",
470 "expExitCode": "0", 470 "expExitCode": "0",
471 "verifyCmd": "$TC actions get action ife index 1", 471 "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",
473 "matchCount": "1", 473 "matchCount": "1",
474 "teardown": [ 474 "teardown": [
475 "$TC actions flush action ife" 475 "$TC actions flush action ife"
@@ -493,7 +493,7 @@
493 "cmdUnderTest": "$TC actions add action ife encode allow tcindex drop index 77", 493 "cmdUnderTest": "$TC actions add action ife encode allow tcindex drop index 77",
494 "expExitCode": "0", 494 "expExitCode": "0",
495 "verifyCmd": "$TC actions get action ife index 77", 495 "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",
497 "matchCount": "1", 497 "matchCount": "1",
498 "teardown": [ 498 "teardown": [
499 "$TC actions flush action ife" 499 "$TC actions flush action ife"
@@ -517,7 +517,7 @@
517 "cmdUnderTest": "$TC actions add action ife encode allow tcindex reclassify index 77", 517 "cmdUnderTest": "$TC actions add action ife encode allow tcindex reclassify index 77",
518 "expExitCode": "0", 518 "expExitCode": "0",
519 "verifyCmd": "$TC actions get action ife index 77", 519 "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",
521 "matchCount": "1", 521 "matchCount": "1",
522 "teardown": [ 522 "teardown": [
523 "$TC actions flush action ife" 523 "$TC actions flush action ife"
@@ -541,7 +541,7 @@
541 "cmdUnderTest": "$TC actions add action ife encode allow tcindex jump 999 index 77", 541 "cmdUnderTest": "$TC actions add action ife encode allow tcindex jump 999 index 77",
542 "expExitCode": "0", 542 "expExitCode": "0",
543 "verifyCmd": "$TC actions get action ife index 77", 543 "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",
545 "matchCount": "1", 545 "matchCount": "1",
546 "teardown": [ 546 "teardown": [
547 "$TC actions flush action ife" 547 "$TC actions flush action ife"
@@ -565,7 +565,7 @@
565 "cmdUnderTest": "$TC actions add action ife encode use tcindex 65535 pass index 1", 565 "cmdUnderTest": "$TC actions add action ife encode use tcindex 65535 pass index 1",
566 "expExitCode": "0", 566 "expExitCode": "0",
567 "verifyCmd": "$TC actions get action ife index 1", 567 "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",
569 "matchCount": "1", 569 "matchCount": "1",
570 "teardown": [ 570 "teardown": [
571 "$TC actions flush action ife" 571 "$TC actions flush action ife"
@@ -589,7 +589,7 @@
589 "cmdUnderTest": "$TC actions add action ife encode use tcindex 65539 pipe index 1", 589 "cmdUnderTest": "$TC actions add action ife encode use tcindex 65539 pipe index 1",
590 "expExitCode": "255", 590 "expExitCode": "255",
591 "verifyCmd": "$TC actions get action ife index 1", 591 "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",
593 "matchCount": "0", 593 "matchCount": "0",
594 "teardown": [] 594 "teardown": []
595 }, 595 },
@@ -611,7 +611,7 @@
611 "cmdUnderTest": "$TC actions add action ife encode allow mark src 00:11:22:33:44:55 pipe index 1", 611 "cmdUnderTest": "$TC actions add action ife encode allow mark src 00:11:22:33:44:55 pipe index 1",
612 "expExitCode": "0", 612 "expExitCode": "0",
613 "verifyCmd": "$TC actions get action ife index 1", 613 "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",
615 "matchCount": "1", 615 "matchCount": "1",
616 "teardown": [ 616 "teardown": [
617 "$TC actions flush action ife" 617 "$TC actions flush action ife"
@@ -635,7 +635,7 @@
635 "cmdUnderTest": "$TC actions add action ife encode use prio 9876 dst 00:11:22:33:44:55 reclassify index 1", 635 "cmdUnderTest": "$TC actions add action ife encode use prio 9876 dst 00:11:22:33:44:55 reclassify index 1",
636 "expExitCode": "0", 636 "expExitCode": "0",
637 "verifyCmd": "$TC actions get action ife index 1", 637 "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",
639 "matchCount": "1", 639 "matchCount": "1",
640 "teardown": [ 640 "teardown": [
641 "$TC actions flush action ife" 641 "$TC actions flush action ife"
@@ -659,7 +659,7 @@
659 "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", 659 "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",
660 "expExitCode": "0", 660 "expExitCode": "0",
661 "verifyCmd": "$TC actions get action ife index 11", 661 "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",
663 "matchCount": "1", 663 "matchCount": "1",
664 "teardown": [ 664 "teardown": [
665 "$TC actions flush action ife" 665 "$TC actions flush action ife"
@@ -683,7 +683,7 @@
683 "cmdUnderTest": "$TC actions add action ife encode use mark 7 type 0xfefe pass index 1", 683 "cmdUnderTest": "$TC actions add action ife encode use mark 7 type 0xfefe pass index 1",
684 "expExitCode": "0", 684 "expExitCode": "0",
685 "verifyCmd": "$TC actions get action ife index 1", 685 "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",
687 "matchCount": "1", 687 "matchCount": "1",
688 "teardown": [ 688 "teardown": [
689 "$TC actions flush action ife" 689 "$TC actions flush action ife"
@@ -707,7 +707,7 @@
707 "cmdUnderTest": "$TC actions add action ife encode use prio 444 type 0xabba pipe index 21", 707 "cmdUnderTest": "$TC actions add action ife encode use prio 444 type 0xabba pipe index 21",
708 "expExitCode": "0", 708 "expExitCode": "0",
709 "verifyCmd": "$TC actions get action ife index 21", 709 "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",
711 "matchCount": "1", 711 "matchCount": "1",
712 "teardown": [ 712 "teardown": [
713 "$TC actions flush action ife" 713 "$TC actions flush action ife"
@@ -731,7 +731,7 @@
731 "cmdUnderTest": "$TC actions add action ife encode use tcindex 5000 type 0xabcd reclassify index 21", 731 "cmdUnderTest": "$TC actions add action ife encode use tcindex 5000 type 0xabcd reclassify index 21",
732 "expExitCode": "0", 732 "expExitCode": "0",
733 "verifyCmd": "$TC actions get action ife index 21", 733 "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",
735 "matchCount": "1", 735 "matchCount": "1",
736 "teardown": [ 736 "teardown": [
737 "$TC actions flush action ife" 737 "$TC actions flush action ife"
@@ -739,7 +739,7 @@
739 }, 739 },
740 { 740 {
741 "id": "fac3", 741 "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",
743 "category": [ 743 "category": [
744 "actions", 744 "actions",
745 "ife" 745 "ife"
@@ -755,7 +755,7 @@
755 "cmdUnderTest": "$TC actions add action ife encode allow mark pass index 4294967295", 755 "cmdUnderTest": "$TC actions add action ife encode allow mark pass index 4294967295",
756 "expExitCode": "0", 756 "expExitCode": "0",
757 "verifyCmd": "$TC actions get action ife index 4294967295", 757 "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",
759 "matchCount": "1", 759 "matchCount": "1",
760 "teardown": [ 760 "teardown": [
761 "$TC actions flush action ife" 761 "$TC actions flush action ife"
@@ -779,7 +779,7 @@
779 "cmdUnderTest": "$TC actions add action ife decode pass index 1", 779 "cmdUnderTest": "$TC actions add action ife decode pass index 1",
780 "expExitCode": "0", 780 "expExitCode": "0",
781 "verifyCmd": "$TC actions get action ife index 1", 781 "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",
783 "matchCount": "1", 783 "matchCount": "1",
784 "teardown": [ 784 "teardown": [
785 "$TC actions flush action ife" 785 "$TC actions flush action ife"
@@ -803,7 +803,7 @@
803 "cmdUnderTest": "$TC actions add action ife decode pipe index 1", 803 "cmdUnderTest": "$TC actions add action ife decode pipe index 1",
804 "expExitCode": "0", 804 "expExitCode": "0",
805 "verifyCmd": "$TC actions get action ife index 1", 805 "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",
807 "matchCount": "1", 807 "matchCount": "1",
808 "teardown": [ 808 "teardown": [
809 "$TC actions flush action ife" 809 "$TC actions flush action ife"
@@ -827,7 +827,7 @@
827 "cmdUnderTest": "$TC actions add action ife decode continue index 1", 827 "cmdUnderTest": "$TC actions add action ife decode continue index 1",
828 "expExitCode": "0", 828 "expExitCode": "0",
829 "verifyCmd": "$TC actions get action ife index 1", 829 "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",
831 "matchCount": "1", 831 "matchCount": "1",
832 "teardown": [ 832 "teardown": [
833 "$TC actions flush action ife" 833 "$TC actions flush action ife"
@@ -851,7 +851,7 @@
851 "cmdUnderTest": "$TC actions add action ife decode drop index 1", 851 "cmdUnderTest": "$TC actions add action ife decode drop index 1",
852 "expExitCode": "0", 852 "expExitCode": "0",
853 "verifyCmd": "$TC actions get action ife index 1", 853 "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",
855 "matchCount": "1", 855 "matchCount": "1",
856 "teardown": [ 856 "teardown": [
857 "$TC actions flush action ife" 857 "$TC actions flush action ife"
@@ -875,7 +875,7 @@
875 "cmdUnderTest": "$TC actions add action ife decode reclassify index 1", 875 "cmdUnderTest": "$TC actions add action ife decode reclassify index 1",
876 "expExitCode": "0", 876 "expExitCode": "0",
877 "verifyCmd": "$TC actions get action ife index 1", 877 "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",
879 "matchCount": "1", 879 "matchCount": "1",
880 "teardown": [ 880 "teardown": [
881 "$TC actions flush action ife" 881 "$TC actions flush action ife"
@@ -899,7 +899,7 @@
899 "cmdUnderTest": "$TC actions add action ife decode jump 10 index 1", 899 "cmdUnderTest": "$TC actions add action ife decode jump 10 index 1",
900 "expExitCode": "0", 900 "expExitCode": "0",
901 "verifyCmd": "$TC actions get action ife index 1", 901 "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",
903 "matchCount": "1", 903 "matchCount": "1",
904 "teardown": [ 904 "teardown": [
905 "$TC actions flush action ife" 905 "$TC actions flush action ife"
@@ -923,7 +923,7 @@
923 "cmdUnderTest": "$TC actions add action ife encode allow mark pass index 4294967295999", 923 "cmdUnderTest": "$TC actions add action ife encode allow mark pass index 4294967295999",
924 "expExitCode": "255", 924 "expExitCode": "255",
925 "verifyCmd": "$TC actions get action ife index 4294967295999", 925 "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",
927 "matchCount": "0", 927 "matchCount": "0",
928 "teardown": [] 928 "teardown": []
929 }, 929 },
@@ -945,7 +945,7 @@
945 "cmdUnderTest": "$TC actions add action ife encode allow mark kuka index 4", 945 "cmdUnderTest": "$TC actions add action ife encode allow mark kuka index 4",
946 "expExitCode": "255", 946 "expExitCode": "255",
947 "verifyCmd": "$TC actions get action ife index 4", 947 "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",
949 "matchCount": "0", 949 "matchCount": "0",
950 "teardown": [] 950 "teardown": []
951 }, 951 },
@@ -967,7 +967,7 @@
967 "cmdUnderTest": "$TC actions add action ife encode allow prio pipe index 4 cookie aabbccddeeff112233445566778800a1", 967 "cmdUnderTest": "$TC actions add action ife encode allow prio pipe index 4 cookie aabbccddeeff112233445566778800a1",
968 "expExitCode": "0", 968 "expExitCode": "0",
969 "verifyCmd": "$TC actions get action ife index 4", 969 "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",
971 "matchCount": "1", 971 "matchCount": "1",
972 "teardown": [ 972 "teardown": [
973 "$TC actions flush action ife" 973 "$TC actions flush action ife"
@@ -991,7 +991,7 @@
991 "cmdUnderTest": "$TC actions add action ife encode allow foo pipe index 4", 991 "cmdUnderTest": "$TC actions add action ife encode allow foo pipe index 4",
992 "expExitCode": "255", 992 "expExitCode": "255",
993 "verifyCmd": "$TC actions get action ife index 4", 993 "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",
995 "matchCount": "0", 995 "matchCount": "0",
996 "teardown": [] 996 "teardown": []
997 }, 997 },
@@ -1013,7 +1013,7 @@
1013 "cmdUnderTest": "$TC actions add action ife encode allow prio type 70000 pipe index 4", 1013 "cmdUnderTest": "$TC actions add action ife encode allow prio type 70000 pipe index 4",
1014 "expExitCode": "255", 1014 "expExitCode": "255",
1015 "verifyCmd": "$TC actions get action ife index 4", 1015 "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",
1017 "matchCount": "0", 1017 "matchCount": "0",
1018 "teardown": [] 1018 "teardown": []
1019 }, 1019 },
diff --git a/tools/testing/selftests/tc-testing/tc-tests/actions/tunnel_key.json b/tools/testing/selftests/tc-testing/tc-tests/actions/tunnel_key.json
index 10b2d894e436..e7e15a7336b6 100644
--- a/tools/testing/selftests/tc-testing/tc-tests/actions/tunnel_key.json
+++ b/tools/testing/selftests/tc-testing/tc-tests/actions/tunnel_key.json
@@ -82,35 +82,6 @@
82 ] 82 ]
83 }, 83 },
84 { 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 },
113 {
114 "id": "a5e0", 85 "id": "a5e0",
115 "name": "Add tunnel_key set action with invalid src_ip parameter", 86 "name": "Add tunnel_key set action with invalid src_ip parameter",
116 "category": [ 87 "category": [
@@ -634,7 +605,7 @@
634 "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", 605 "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",
635 "expExitCode": "0", 606 "expExitCode": "0",
636 "verifyCmd": "$TC actions get action tunnel_key index 4", 607 "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",
638 "matchCount": "1", 609 "matchCount": "1",
639 "teardown": [ 610 "teardown": [
640 "$TC actions flush action tunnel_key" 611 "$TC actions flush action tunnel_key"