Pull networking fixes from David Miller: 1) Fix endless loop in nf_tables, from Phil Sutter. 2) Fix cross namespace ip6_gre tunnel hash list corruption, from Olivier Matz. 3) Don't be too strict in phy_start_aneg() otherwise we might not allow restarting auto negotiation. From Heiner Kallweit. 4) Fix various KMSAN uninitialized value cases in tipc, from Ying Xue. 5) Memory leak in act_tunnel_key, from Davide Caratti. 6) Handle chip errata of mv88e6390 PHY, from Andrew Lunn. 7) Remove linear SKB assumption in fou/fou6, from Eric Dumazet. 8) Missing udplite rehash callbacks, from Alexey Kodanev. 9) Log dirty pages properly in vhost, from Jason Wang. 10) Use consume_skb() in neigh_probe() as this is a normal free not a drop, from Yang Wei. Likewise in macvlan_process_broadcast(). 11) Missing device_del() in mdiobus_register() error paths, from Thomas Petazzoni. 12) Fix checksum handling of short packets in mlx5, from Cong Wang. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (96 commits) bpf: in __bpf_redirect_no_mac pull mac only if present virtio_net: bulk free tx skbs net: phy: phy driver features are mandatory isdn: avm: Fix string plus integer warning from Clang net/mlx5e: Fix cb_ident duplicate in indirect block register net/mlx5e: Fix wrong (zero) TX drop counter indication for representor net/mlx5e: Fix wrong error code return on FEC query failure net/mlx5e: Force CHECKSUM_UNNECESSARY for short ethernet frames tools: bpftool: Cleanup license mess bpf: fix inner map masking to prevent oob under speculation bpf: pull in pkt_sched.h header for tooling to fix bpftool build selftests: forwarding: Add a test case for externally learned FDB entries selftests: mlxsw: Test FDB offload indication mlxsw: spectrum_switchdev: Do not treat static FDB entries as sticky net: bridge: Mark FDB entries that were added by user as such mlxsw: spectrum_fid: Update dummy FID index mlxsw: pci: Return error on PCI reset timeout mlxsw: pci: Increase PCI SW reset timeout mlxsw: pci: Ring CQ's doorbell before RDQ's MAINTAINERS: update email addresses of liquidio driver maintainers ...
Unified · Split
| @@ -11,19 +11,19 @@ Contents: · 10 unmodified lines | ||
| 11 | 11 | batman-adv |
| 12 | 12 | can |
| 13 | 13 | can_ucan_protocol |
| 14 | − dpaa2/index | |
| 15 | − e100 | |
| 16 | − e1000 | |
| 17 | − e1000e | |
| 18 | − fm10k | |
| 19 | − igb | |
| 20 | − igbvf | |
| 21 | − ixgb | |
| 22 | − ixgbe | |
| 23 | − ixgbevf | |
| 24 | − i40e | |
| 25 | − iavf | |
| 26 | − ice | |
| 14 | + device_drivers/freescale/dpaa2/index | |
| 15 | + device_drivers/intel/e100 | |
| 16 | + device_drivers/intel/e1000 | |
| 17 | + device_drivers/intel/e1000e | |
| 18 | + device_drivers/intel/fm10k | |
| 19 | + device_drivers/intel/igb | |
| 20 | + device_drivers/intel/igbvf | |
| 21 | + device_drivers/intel/ixgb | |
| 22 | + device_drivers/intel/ixgbe | |
| 23 | + device_drivers/intel/ixgbevf | |
| 24 | + device_drivers/intel/i40e | |
| 25 | + device_drivers/intel/iavf | |
| 26 | + device_drivers/intel/ice | |
| 27 | 27 | kapi |
| 28 | 28 | z8530book |
| 29 | 29 | msg_zerocopy |
| @@ -1000,51 +1000,6 @@ The kernel interface functions are as follows: · 999 unmodified lines | ||
| 1000 | 1000 | size should be set when the call is begun. tx_total_len may not be less |
| 1001 | 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 | 1003 | (*) Get call RTT. |
| 1049 | 1004 | |
| 1050 | 1005 | u64 rxrpc_kernel_get_rtt(struct socket *sock, struct rxrpc_call *call); |
| @@ -336,7 +336,26 @@ time client replies ACK, this socket will get another chance to move · 335 unmodified lines | ||
| 336 | 336 | to the accept queue. |
| 337 | 337 | |
| 338 | 338 | |
| 339 | −TCP Fast Open | |
| 339 | +* TcpEstabResets | |
| 340 | +Defined in `RFC1213 tcpEstabResets`_. | |
| 341 | + | |
| 342 | +.. _RFC1213 tcpEstabResets: https://tools.ietf.org/html/rfc1213#page-48 | |
| 343 | + | |
| 344 | +* TcpAttemptFails | |
| 345 | +Defined in `RFC1213 tcpAttemptFails`_. | |
| 346 | + | |
| 347 | +.. _RFC1213 tcpAttemptFails: https://tools.ietf.org/html/rfc1213#page-48 | |
| 348 | + | |
| 349 | +* TcpOutRsts | |
| 350 | +Defined in `RFC1213 tcpOutRsts`_. The RFC says this counter indicates | |
| 351 | +the 'segments sent containing the RST flag', but in linux kernel, this | |
| 352 | +couner indicates the segments kerenl tried to send. The sending | |
| 353 | +process might be failed due to some errors (e.g. memory alloc failed). | |
| 354 | + | |
| 355 | +.. _RFC1213 tcpOutRsts: https://tools.ietf.org/html/rfc1213#page-52 | |
| 356 | + | |
| 357 | + | |
| 358 | +TCP Fast Path | |
| 340 | 359 | ============ |
| 341 | 360 | When kernel receives a TCP packet, it has two paths to handler the |
| 342 | 361 | packet, one is fast path, another is slow path. The comment in kernel |
| @@ -383,8 +402,6 @@ increase 1. · 40 unmodified lines | ||
| 383 | 402 | |
| 384 | 403 | TCP abort |
| 385 | 404 | ======== |
| 386 | − | |
| 387 | − | |
| 388 | 405 | * TcpExtTCPAbortOnData |
| 389 | 406 | It means TCP layer has data in flight, but need to close the |
| 390 | 407 | connection. So TCP layer sends a RST to the other side, indicate the |
| @@ -545,7 +562,6 @@ packet yet, the sender would know packet 4 is out of order. The TCP · 154 unmodified lines | ||
| 545 | 562 | stack of kernel will increase TcpExtTCPSACKReorder for both of the |
| 546 | 563 | above scenarios. |
| 547 | 564 | |
| 548 | − | |
| 549 | 565 | DSACK |
| 550 | 566 | ===== |
| 551 | 567 | The DSACK is defined in `RFC2883`_. The receiver uses DSACK to report |
| @@ -566,13 +582,63 @@ The TCP stack receives an out of order duplicate packet, so it sends a · 14 unmodified lines | ||
| 566 | 582 | DSACK to the sender. |
| 567 | 583 | |
| 568 | 584 | * TcpExtTCPDSACKRecv |
| 569 | −The TCP stack receives a DSACK, which indicate an acknowledged | |
| 585 | +The TCP stack receives a DSACK, which indicates an acknowledged | |
| 570 | 586 | duplicate packet is received. |
| 571 | 587 | |
| 572 | 588 | * TcpExtTCPDSACKOfoRecv |
| 573 | 589 | The TCP stack receives a DSACK, which indicate an out of order |
| 574 | 590 | duplicate packet is received. |
| 575 | 591 | |
| 592 | +invalid SACK and DSACK | |
| 593 | +==================== | |
| 594 | +When a SACK (or DSACK) block is invalid, a corresponding counter would | |
| 595 | +be updated. The validation method is base on the start/end sequence | |
| 596 | +number of the SACK block. For more details, please refer the comment | |
| 597 | +of the function tcp_is_sackblock_valid in the kernel source code. A | |
| 598 | +SACK option could have up to 4 blocks, they are checked | |
| 599 | +individually. E.g., if 3 blocks of a SACk is invalid, the | |
| 600 | +corresponding counter would be updated 3 times. The comment of the | |
| 601 | +`Add counters for discarded SACK blocks`_ patch has additional | |
| 602 | +explaination: | |
| 603 | + | |
| 604 | +.. _Add counters for discarded SACK blocks: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=18f02545a9a16c9a89778b91a162ad16d510bb32 | |
| 605 | + | |
| 606 | +* TcpExtTCPSACKDiscard | |
| 607 | +This counter indicates how many SACK blocks are invalid. If the invalid | |
| 608 | +SACK block is caused by ACK recording, the TCP stack will only ignore | |
| 609 | +it and won't update this counter. | |
| 610 | + | |
| 611 | +* TcpExtTCPDSACKIgnoredOld and TcpExtTCPDSACKIgnoredNoUndo | |
| 612 | +When a DSACK block is invalid, one of these two counters would be | |
| 613 | +updated. Which counter will be updated depends on the undo_marker flag | |
| 614 | +of the TCP socket. If the undo_marker is not set, the TCP stack isn't | |
| 615 | +likely to re-transmit any packets, and we still receive an invalid | |
| 616 | +DSACK block, the reason might be that the packet is duplicated in the | |
| 617 | +middle of the network. In such scenario, TcpExtTCPDSACKIgnoredNoUndo | |
| 618 | +will be updated. If the undo_marker is set, TcpExtTCPDSACKIgnoredOld | |
| 619 | +will be updated. As implied in its name, it might be an old packet. | |
| 620 | + | |
| 621 | +SACK shift | |
| 622 | +========= | |
| 623 | +The linux networking stack stores data in sk_buff struct (skb for | |
| 624 | +short). If a SACK block acrosses multiple skb, the TCP stack will try | |
| 625 | +to re-arrange data in these skb. E.g. if a SACK block acknowledges seq | |
| 626 | +10 to 15, skb1 has seq 10 to 13, skb2 has seq 14 to 20. The seq 14 and | |
| 627 | +15 in skb2 would be moved to skb1. This operation is 'shift'. If a | |
| 628 | +SACK block acknowledges seq 10 to 20, skb1 has seq 10 to 13, skb2 has | |
| 629 | +seq 14 to 20. All data in skb2 will be moved to skb1, and skb2 will be | |
| 630 | +discard, this operation is 'merge'. | |
| 631 | + | |
| 632 | +* TcpExtTCPSackShifted | |
| 633 | +A skb is shifted | |
| 634 | + | |
| 635 | +* TcpExtTCPSackMerged | |
| 636 | +A skb is merged | |
| 637 | + | |
| 638 | +* TcpExtTCPSackShiftFallback | |
| 639 | +A skb should be shifted or merged, but the TCP stack doesn't do it for | |
| 640 | +some reasons. | |
| 641 | + | |
| 576 | 642 | TCP out of order |
| 577 | 643 | =============== |
| 578 | 644 | * TcpExtTCPOFOQueue |
| @@ -662,6 +728,60 @@ unacknowledged number (more strict than `RFC 5961 section 5.2`_). · 83 unmodified lines | ||
| 662 | 728 | .. _RFC 5961 section 4.2: https://tools.ietf.org/html/rfc5961#page-9 |
| 663 | 729 | .. _RFC 5961 section 5.2: https://tools.ietf.org/html/rfc5961#page-11 |
| 664 | 730 | |
| 731 | +TCP receive window | |
| 732 | +================= | |
| 733 | +* TcpExtTCPWantZeroWindowAdv | |
| 734 | +Depending on current memory usage, the TCP stack tries to set receive | |
| 735 | +window to zero. But the receive window might still be a no-zero | |
| 736 | +value. For example, if the previous window size is 10, and the TCP | |
| 737 | +stack receives 3 bytes, the current window size would be 7 even if the | |
| 738 | +window size calculated by the memory usage is zero. | |
| 739 | + | |
| 740 | +* TcpExtTCPToZeroWindowAdv | |
| 741 | +The TCP receive window is set to zero from a no-zero value. | |
| 742 | + | |
| 743 | +* TcpExtTCPFromZeroWindowAdv | |
| 744 | +The TCP receive window is set to no-zero value from zero. | |
| 745 | + | |
| 746 | + | |
| 747 | +Delayed ACK | |
| 748 | +========== | |
| 749 | +The TCP Delayed ACK is a technique which is used for reducing the | |
| 750 | +packet count in the network. For more details, please refer the | |
| 751 | +`Delayed ACK wiki`_ | |
| 752 | + | |
| 753 | +.. _Delayed ACK wiki: https://en.wikipedia.org/wiki/TCP_delayed_acknowledgment | |
| 754 | + | |
| 755 | +* TcpExtDelayedACKs | |
| 756 | +A delayed ACK timer expires. The TCP stack will send a pure ACK packet | |
| 757 | +and exit the delayed ACK mode. | |
| 758 | + | |
| 759 | +* TcpExtDelayedACKLocked | |
| 760 | +A delayed ACK timer expires, but the TCP stack can't send an ACK | |
| 761 | +immediately due to the socket is locked by a userspace program. The | |
| 762 | +TCP stack will send a pure ACK later (after the userspace program | |
| 763 | +unlock the socket). When the TCP stack sends the pure ACK later, the | |
| 764 | +TCP stack will also update TcpExtDelayedACKs and exit the delayed ACK | |
| 765 | +mode. | |
| 766 | + | |
| 767 | +* TcpExtDelayedACKLost | |
| 768 | +It will be updated when the TCP stack receives a packet which has been | |
| 769 | +ACKed. A Delayed ACK loss might cause this issue, but it would also be | |
| 770 | +triggered by other reasons, such as a packet is duplicated in the | |
| 771 | +network. | |
| 772 | + | |
| 773 | +Tail Loss Probe (TLP) | |
| 774 | +=================== | |
| 775 | +TLP is an algorithm which is used to detect TCP packet loss. For more | |
| 776 | +details, please refer the `TLP paper`_. | |
| 777 | + | |
| 778 | +.. _TLP paper: https://tools.ietf.org/html/draft-dukkipati-tcpm-tcp-loss-probe-01 | |
| 779 | + | |
| 780 | +* TcpExtTCPLossProbes | |
| 781 | +A TLP probe packet is sent. | |
| 782 | + | |
| 783 | +* TcpExtTCPLossProbeRecovery | |
| 784 | +A packet loss is detected and recovered by TLP. | |
| 665 | 785 | |
| 666 | 786 | examples |
| 667 | 787 | ======= |
| @@ -417,7 +417,7 @@ is again deprecated and ts[2] holds a hardware timestamp if set. · 416 unmodified lines | ||
| 417 | 417 | |
| 418 | 418 | Hardware time stamping must also be initialized for each device driver |
| 419 | 419 | that is expected to do hardware time stamping. The parameter is defined in |
| 420 | −/include/linux/net_tstamp.h as: | |
| 420 | +include/uapi/linux/net_tstamp.h as: | |
| 421 | 421 | |
| 422 | 422 | struct hwtstamp_config { |
| 423 | 423 | int flags; /* no flags defined right now, must be zero */ |
| @@ -487,7 +487,7 @@ enum { · 63 unmodified lines | ||
| 487 | 487 | HWTSTAMP_FILTER_PTP_V1_L4_EVENT, |
| 488 | 488 | |
| 489 | 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 | |
| @@ -3471,10 +3471,9 @@ F: drivers/i2c/busses/i2c-octeon* · 3470 unmodified lines | ||
| 3471 | 3471 | F: drivers/i2c/busses/i2c-thunderx* |
| 3472 | 3472 | |
| 3473 | 3473 | CAVIUM LIQUIDIO NETWORK DRIVER |
| 3474 | −M: Derek Chickles <derek.chickles@caviumnetworks.com> | |
| 3475 | −M: Satanand Burla <satananda.burla@caviumnetworks.com> | |
| 3476 | −M: Felix Manlunas <felix.manlunas@caviumnetworks.com> | |
| 3477 | −M: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com> | |
| 3474 | +M: Derek Chickles <dchickles@marvell.com> | |
| 3475 | +M: Satanand Burla <sburla@marvell.com> | |
| 3476 | +M: Felix Manlunas <fmanlunas@marvell.com> | |
| 3478 | 3477 | L: netdev@vger.kernel.org |
| 3479 | 3478 | W: http://www.cavium.com |
| 3480 | 3479 | S: Supported |
| @@ -718,7 +718,7 @@ static int he_init_cs_block_rcm(struct he_dev *he_dev) · 717 unmodified lines | ||
| 718 | 718 | instead of '/ 512', use '>> 9' to prevent a call |
| 719 | 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 | 723 | if (rate_cps < 10) |
| 724 | 724 | rate_cps = 10; /* 2.2.1 minimum payload rate is 10 cps */ |
| @@ -423,7 +423,7 @@ void b1_parse_version(avmctrl_info *cinfo) · 422 unmodified lines | ||
| 423 | 423 | int i, j; |
| 424 | 424 | |
| 425 | 425 | for (j = 0; j < AVM_MAXVERSION; j++) |
| 426 | − cinfo->version[j] = "\0\0" + 1; | |
| 426 | + cinfo->version[j] = ""; | |
| 427 | 427 | for (i = 0, j = 0; |
| 428 | 428 | j < AVM_MAXVERSION && i < cinfo->versionlen; |
| 429 | 429 | j++, i += cinfo->versionbuf[i] + 1) |
| @@ -519,7 +519,7 @@ config NET_FAILOVER · 518 unmodified lines | ||
| 519 | 519 | and destroy a failover master netdev and manages a primary and |
| 520 | 520 | standby slave netdevs that get registered via the generic failover |
| 521 | 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 | 523 | a VM with direct attached VF by failing over to the paravirtual |
| 524 | 524 | datapath when the VF is unplugged. |
| 525 | 525 | |
| @@ -347,16 +347,17 @@ int realtek_smi_setup_mdio(struct realtek_smi *smi) · 346 unmodified lines | ||
| 347 | 347 | struct device_node *mdio_np; |
| 348 | 348 | int ret; |
| 349 | 349 | |
| 350 | − mdio_np = of_find_compatible_node(smi->dev->of_node, NULL, | |
| 351 | − "realtek,smi-mdio"); | |
| 350 | + mdio_np = of_get_compatible_child(smi->dev->of_node, "realtek,smi-mdio"); | |
| 352 | 351 | if (!mdio_np) { |
| 353 | 352 | dev_err(smi->dev, "no MDIO bus node\n"); |
| 354 | 353 | return -ENODEV; |
| 355 | 354 | } |
| 356 | 355 | |
| 357 | 356 | smi->slave_mii_bus = devm_mdiobus_alloc(smi->dev); |
| 358 | − if (!smi->slave_mii_bus) | |
| 359 | − return -ENOMEM; | |
| 357 | + if (!smi->slave_mii_bus) { | |
| 358 | + ret = -ENOMEM; | |
| 359 | + goto err_put_node; | |
| 360 | + } | |
| 360 | 361 | smi->slave_mii_bus->priv = smi; |
| 361 | 362 | smi->slave_mii_bus->name = "SMI slave MII"; |
| 362 | 363 | smi->slave_mii_bus->read = realtek_smi_mdio_read; |
| @@ -371,10 +372,15 @@ int realtek_smi_setup_mdio(struct realtek_smi *smi) · 8 unmodified lines | ||
| 371 | 372 | if (ret) { |
| 372 | 373 | dev_err(smi->dev, "unable to register MDIO bus %s\n", |
| 373 | 374 | smi->slave_mii_bus->id); |
| 374 | − of_node_put(mdio_np); | |
| 375 | + goto err_put_node; | |
| 375 | 376 | } |
| 376 | 377 | |
| 377 | 378 | return 0; |
| 379 | + | |
| 380 | +err_put_node: | |
| 381 | + of_node_put(mdio_np); | |
| 382 | + | |
| 383 | + return ret; | |
| 378 | 384 | } |
| 379 | 385 | |
| 380 | 386 | static int realtek_smi_probe(struct platform_device *pdev) |
| @@ -457,6 +463,8 @@ static int realtek_smi_remove(struct platform_device *pdev) · 76 unmodified lines | ||
| 457 | 463 | struct realtek_smi *smi = dev_get_drvdata(&pdev->dev); |
| 458 | 464 | |
| 459 | 465 | dsa_unregister_switch(smi->ds); |
| 466 | + if (smi->slave_mii_bus) | |
| 467 | + of_node_put(smi->slave_mii_bus->dev.of_node); | |
| 460 | 468 | gpiod_set_value(smi->reset, 1); |
| 461 | 469 | |
| 462 | 470 | return 0; |
| @@ -431,8 +431,6 @@ · 430 unmodified lines | ||
| 431 | 431 | #define MAC_MDIOSCAR_PA_WIDTH 5 |
| 432 | 432 | #define MAC_MDIOSCAR_RA_INDEX 0 |
| 433 | 433 | #define MAC_MDIOSCAR_RA_WIDTH 16 |
| 434 | −#define MAC_MDIOSCAR_REG_INDEX 0 | |
| 435 | −#define MAC_MDIOSCAR_REG_WIDTH 21 | |
| 436 | 434 | #define MAC_MDIOSCCDR_BUSY_INDEX 22 |
| 437 | 435 | #define MAC_MDIOSCCDR_BUSY_WIDTH 1 |
| 438 | 436 | #define MAC_MDIOSCCDR_CMD_INDEX 16 |
| @@ -1284,6 +1284,20 @@ static void xgbe_write_mmd_regs(struct xgbe_prv_data *pdata, int prtad, · 1283 unmodified lines | ||
| 1284 | 1284 | } |
| 1285 | 1285 | } |
| 1286 | 1286 | |
| 1287 | +static unsigned int xgbe_create_mdio_sca(int port, int reg) | |
| 1288 | +{ | |
| 1289 | + unsigned int mdio_sca, da; | |
| 1290 | + | |
| 1291 | + da = (reg & MII_ADDR_C45) ? reg >> 16 : 0; | |
| 1292 | + | |
| 1293 | + mdio_sca = 0; | |
| 1294 | + XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, RA, reg); | |
| 1295 | + XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, PA, port); | |
| 1296 | + XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, DA, da); | |
| 1297 | + | |
| 1298 | + return mdio_sca; | |
| 1299 | +} | |
| 1300 | + | |
| 1287 | 1301 | static int xgbe_write_ext_mii_regs(struct xgbe_prv_data *pdata, int addr, |
| 1288 | 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, · 1 unmodified line | ||
| 1291 | 1305 | |
| 1292 | 1306 | reinit_completion(&pdata->mdio_complete); |
| 1293 | 1307 | |
| 1294 | − mdio_sca = 0; | |
| 1295 | − XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, REG, reg); | |
| 1296 | − XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, DA, addr); | |
| 1308 | + mdio_sca = xgbe_create_mdio_sca(addr, reg); | |
| 1297 | 1309 | XGMAC_IOWRITE(pdata, MAC_MDIOSCAR, mdio_sca); |
| 1298 | 1310 | |
| 1299 | 1311 | mdio_sccd = 0; |
| @@ -1317,9 +1329,7 @@ static int xgbe_read_ext_mii_regs(struct xgbe_prv_data *pdata, int addr, · 17 unmodified lines | ||
| 1317 | 1329 | |
| 1318 | 1330 | reinit_completion(&pdata->mdio_complete); |
| 1319 | 1331 | |
| 1320 | − mdio_sca = 0; | |
| 1321 | − XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, REG, reg); | |
| 1322 | − XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, DA, addr); | |
| 1332 | + mdio_sca = xgbe_create_mdio_sca(addr, reg); | |
| 1323 | 1333 | XGMAC_IOWRITE(pdata, MAC_MDIOSCAR, mdio_sca); |
| 1324 | 1334 | |
| 1325 | 1335 | mdio_sccd = 0; |
| @@ -2051,6 +2051,7 @@ dpaa_start_xmit(struct sk_buff *skb, struct net_device *net_dev) · 2050 unmodified lines | ||
| 2051 | 2051 | bool nonlinear = skb_is_nonlinear(skb); |
| 2052 | 2052 | struct rtnl_link_stats64 *percpu_stats; |
| 2053 | 2053 | struct dpaa_percpu_priv *percpu_priv; |
| 2054 | + struct netdev_queue *txq; | |
| 2054 | 2055 | struct dpaa_priv *priv; |
| 2055 | 2056 | struct qm_fd fd; |
| 2056 | 2057 | int offset = 0; |
| @@ -2100,6 +2101,11 @@ dpaa_start_xmit(struct sk_buff *skb, struct net_device *net_dev) · 43 unmodified lines | ||
| 2100 | 2101 | if (unlikely(err < 0)) |
| 2101 | 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 | 2109 | if (priv->tx_tstamp && skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) { |
| 2104 | 2110 | fd.cmd |= cpu_to_be32(FM_FD_CMD_UPD); |
| 2105 | 2111 | skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; |
| @@ -515,7 +515,7 @@ struct igb_adapter { · 514 unmodified lines | ||
| 515 | 515 | /* OS defined structs */ |
| 516 | 516 | struct pci_dev *pdev; |
| 517 | 517 | |
| 518 | − struct mutex stats64_lock; | |
| 518 | + spinlock_t stats64_lock; | |
| 519 | 519 | struct rtnl_link_stats64 stats64; |
| 520 | 520 | |
| 521 | 521 | /* structs defined in e1000_hw.h */ |
| @@ -2295,7 +2295,7 @@ static void igb_get_ethtool_stats(struct net_device *netdev, · 2294 unmodified lines | ||
| 2295 | 2295 | int i, j; |
| 2296 | 2296 | char *p; |
| 2297 | 2297 | |
| 2298 | − mutex_lock(&adapter->stats64_lock); | |
| 2298 | + spin_lock(&adapter->stats64_lock); | |
| 2299 | 2299 | igb_update_stats(adapter); |
| 2300 | 2300 | |
| 2301 | 2301 | for (i = 0; i < IGB_GLOBAL_STATS_LEN; i++) { |
| @@ -2338,7 +2338,7 @@ static void igb_get_ethtool_stats(struct net_device *netdev, · 36 unmodified lines | ||
| 2338 | 2338 | } while (u64_stats_fetch_retry_irq(&ring->rx_syncp, start)); |
| 2339 | 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 | |
| 2344 | 2344 | static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data) |
| @@ -2203,9 +2203,9 @@ void igb_down(struct igb_adapter *adapter) · 2202 unmodified lines | ||
| 2203 | 2203 | del_timer_sync(&adapter->phy_info_timer); |
| 2204 | 2204 | |
| 2205 | 2205 | /* record the stats before reset*/ |
| 2206 | − mutex_lock(&adapter->stats64_lock); | |
| 2206 | + spin_lock(&adapter->stats64_lock); | |
| 2207 | 2207 | igb_update_stats(adapter); |
| 2208 | − mutex_unlock(&adapter->stats64_lock); | |
| 2208 | + spin_unlock(&adapter->stats64_lock); | |
| 2209 | 2209 | |
| 2210 | 2210 | adapter->link_speed = 0; |
| 2211 | 2211 | adapter->link_duplex = 0; |
| @@ -3840,7 +3840,7 @@ static int igb_sw_init(struct igb_adapter *adapter) · 1628 unmodified lines | ||
| 3840 | 3840 | adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; |
| 3841 | 3841 | |
| 3842 | 3842 | spin_lock_init(&adapter->nfc_lock); |
| 3843 | − mutex_init(&adapter->stats64_lock); | |
| 3843 | + spin_lock_init(&adapter->stats64_lock); | |
| 3844 | 3844 | #ifdef CONFIG_PCI_IOV |
| 3845 | 3845 | switch (hw->mac.type) { |
| 3846 | 3846 | case e1000_82576: |
| @@ -5406,9 +5406,9 @@ no_wait: · 1559 unmodified lines | ||
| 5406 | 5406 | } |
| 5407 | 5407 | } |
| 5408 | 5408 | |
| 5409 | − mutex_lock(&adapter->stats64_lock); | |
| 5409 | + spin_lock(&adapter->stats64_lock); | |
| 5410 | 5410 | igb_update_stats(adapter); |
| 5411 | − mutex_unlock(&adapter->stats64_lock); | |
| 5411 | + spin_unlock(&adapter->stats64_lock); | |
| 5412 | 5412 | |
| 5413 | 5413 | for (i = 0; i < adapter->num_tx_queues; i++) { |
| 5414 | 5414 | struct igb_ring *tx_ring = adapter->tx_ring[i]; |
| @@ -6235,10 +6235,10 @@ static void igb_get_stats64(struct net_device *netdev, · 820 unmodified lines | ||
| 6235 | 6235 | { |
| 6236 | 6236 | struct igb_adapter *adapter = netdev_priv(netdev); |
| 6237 | 6237 | |
| 6238 | − mutex_lock(&adapter->stats64_lock); | |
| 6238 | + spin_lock(&adapter->stats64_lock); | |
| 6239 | 6239 | igb_update_stats(adapter); |
| 6240 | 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 | /** |
| @@ -844,9 +844,12 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, · 843 unmodified lines | ||
| 844 | 844 | ethtool_link_ksettings_add_link_mode(link_ksettings, supported, |
| 845 | 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 | 849 | netdev_dbg(priv->netdev, "%s: FEC caps query failed: %d\n", |
| 849 | 850 | __func__, err); |
| 851 | + err = 0; /* don't fail caps query because of FEC error */ | |
| 852 | + } | |
| 850 | 853 | |
| 851 | 854 | if (!an_disable_admin) |
| 852 | 855 | ethtool_link_ksettings_add_link_mode(link_ksettings, |
| @@ -58,7 +58,8 @@ struct mlx5e_rep_indr_block_priv { · 57 unmodified lines | ||
| 58 | 58 | struct list_head list; |
| 59 | 59 | }; |
| 60 | 60 | |
| 61 | −static void mlx5e_rep_indr_unregister_block(struct net_device *netdev); | |
| 61 | +static void mlx5e_rep_indr_unregister_block(struct mlx5e_rep_priv *rpriv, | |
| 62 | + struct net_device *netdev); | |
| 62 | 63 | |
| 63 | 64 | static void mlx5e_rep_get_drvinfo(struct net_device *dev, |
| 64 | 65 | struct ethtool_drvinfo *drvinfo) |
| @@ -179,6 +180,7 @@ static void mlx5e_rep_update_sw_counters(struct mlx5e_priv *priv) · 114 unmodified lines | ||
| 179 | 180 | |
| 180 | 181 | s->tx_packets += sq_stats->packets; |
| 181 | 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) · 478 unmodified lines | ||
| 663 | 665 | struct list_head *head = &rpriv->uplink_priv.tc_indr_block_priv_list; |
| 664 | 666 | |
| 665 | 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 | 669 | kfree(cb_priv); |
| 668 | 670 | } |
| 669 | 671 | } |
| @@ -735,7 +737,7 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev, · 65 unmodified lines | ||
| 735 | 737 | |
| 736 | 738 | err = tcf_block_cb_register(f->block, |
| 737 | 739 | mlx5e_rep_indr_setup_block_cb, |
| 738 | − netdev, indr_priv, f->extack); | |
| 740 | + indr_priv, indr_priv, f->extack); | |
| 739 | 741 | if (err) { |
| 740 | 742 | list_del(&indr_priv->list); |
| 741 | 743 | kfree(indr_priv); |
| @@ -743,14 +745,15 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev, · 1 unmodified line | ||
| 743 | 745 | |
| 744 | 746 | return err; |
| 745 | 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 | 752 | tcf_block_cb_unregister(f->block, |
| 747 | 753 | mlx5e_rep_indr_setup_block_cb, |
| 748 | − netdev); | |
| 749 | − indr_priv = mlx5e_rep_indr_block_priv_lookup(rpriv, netdev); | |
| 750 | − if (indr_priv) { | |
| 751 | − list_del(&indr_priv->list); | |
| 752 | − kfree(indr_priv); | |
| 753 | − } | |
| 754 | + indr_priv); | |
| 755 | + list_del(&indr_priv->list); | |
| 756 | + kfree(indr_priv); | |
| 754 | 757 | |
| 755 | 758 | return 0; |
| 756 | 759 | default: |
| @@ -779,7 +782,7 @@ static int mlx5e_rep_indr_register_block(struct mlx5e_rep_priv *rpriv, · 22 unmodified lines | ||
| 779 | 782 | |
| 780 | 783 | err = __tc_indr_block_cb_register(netdev, rpriv, |
| 781 | 784 | mlx5e_rep_indr_setup_tc_cb, |
| 782 | − netdev); | |
| 785 | + rpriv); | |
| 783 | 786 | if (err) { |
| 784 | 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, · 3 unmodified lines | ||
| 789 | 792 | return err; |
| 790 | 793 | } |
| 791 | 794 | |
| 792 | −static void mlx5e_rep_indr_unregister_block(struct net_device *netdev) | |
| 795 | +static void mlx5e_rep_indr_unregister_block(struct mlx5e_rep_priv *rpriv, | |
| 796 | + struct net_device *netdev) | |
| 793 | 797 | { |
| 794 | 798 | __tc_indr_block_cb_unregister(netdev, mlx5e_rep_indr_setup_tc_cb, |
| 795 | − netdev); | |
| 799 | + rpriv); | |
| 796 | 800 | } |
| 797 | 801 | |
| 798 | 802 | static int mlx5e_nic_rep_netdevice_event(struct notifier_block *nb, |
| @@ -811,7 +815,7 @@ static int mlx5e_nic_rep_netdevice_event(struct notifier_block *nb, · 12 unmodified lines | ||
| 811 | 815 | mlx5e_rep_indr_register_block(rpriv, netdev); |
| 812 | 816 | break; |
| 813 | 817 | case NETDEV_UNREGISTER: |
| 814 | − mlx5e_rep_indr_unregister_block(netdev); | |
| 818 | + mlx5e_rep_indr_unregister_block(rpriv, netdev); | |
| 815 | 819 | break; |
| 816 | 820 | } |
| 817 | 821 | return NOTIFY_OK; |
| @@ -732,6 +732,8 @@ static u8 get_ip_proto(struct sk_buff *skb, int network_depth, __be16 proto) · 731 unmodified lines | ||
| 732 | 732 | ((struct ipv6hdr *)ip_p)->nexthdr; |
| 733 | 733 | } |
| 734 | 734 | |
| 735 | +#define short_frame(size) ((size) <= ETH_ZLEN + ETH_FCS_LEN) | |
| 736 | + | |
| 735 | 737 | static inline void mlx5e_handle_csum(struct net_device *netdev, |
| 736 | 738 | struct mlx5_cqe64 *cqe, |
| 737 | 739 | struct mlx5e_rq *rq, |
| @@ -754,6 +756,17 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, · 16 unmodified lines | ||
| 754 | 756 | if (unlikely(test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state))) |
| 755 | 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 | 770 | if (likely(is_last_ethertype_ip(skb, &network_depth, &proto))) { |
| 758 | 771 | if (unlikely(get_ip_proto(skb, network_depth, proto) == IPPROTO_SCTP)) |
| 759 | 772 | goto csum_unnecessary; |
| @@ -604,29 +604,31 @@ static void mlxsw_pci_cq_tasklet(unsigned long data) · 603 unmodified lines | ||
| 604 | 604 | u16 wqe_counter = mlxsw_pci_cqe_wqe_counter_get(cqe); |
| 605 | 605 | u8 sendq = mlxsw_pci_cqe_sr_get(q->u.cq.v, cqe); |
| 606 | 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 | 612 | if (sendq) { |
| 609 | 613 | struct mlxsw_pci_queue *sdq; |
| 610 | 614 | |
| 611 | 615 | sdq = mlxsw_pci_sdq_get(mlxsw_pci, dqn); |
| 612 | 616 | mlxsw_pci_cqe_sdq_handle(mlxsw_pci, sdq, |
| 613 | − wqe_counter, cqe); | |
| 617 | + wqe_counter, ncqe); | |
| 614 | 618 | q->u.cq.comp_sdq_count++; |
| 615 | 619 | } else { |
| 616 | 620 | struct mlxsw_pci_queue *rdq; |
| 617 | 621 | |
| 618 | 622 | rdq = mlxsw_pci_rdq_get(mlxsw_pci, dqn); |
| 619 | 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 | 625 | q->u.cq.comp_rdq_count++; |
| 622 | 626 | } |
| 623 | 627 | if (++items == credits) |
| 624 | 628 | break; |
| 625 | 629 | } |
| 626 | − if (items) { | |
| 627 | − mlxsw_pci_queue_doorbell_consumer_ring(mlxsw_pci, q); | |
| 630 | + if (items) | |
| 628 | 631 | mlxsw_pci_queue_doorbell_arm_consumer_ring(mlxsw_pci, q); |
| 629 | − } | |
| 630 | 632 | } |
| 631 | 633 | |
| 632 | 634 | static u16 mlxsw_pci_cq_elem_count(const struct mlxsw_pci_queue *q) |
| @@ -1365,10 +1367,10 @@ static int mlxsw_pci_sw_reset(struct mlxsw_pci *mlxsw_pci, · 732 unmodified lines | ||
| 1365 | 1367 | u32 val = mlxsw_pci_read32(mlxsw_pci, FW_READY); |
| 1366 | 1368 | |
| 1367 | 1369 | if ((val & MLXSW_PCI_FW_READY_MASK) == MLXSW_PCI_FW_READY_MAGIC) |
| 1368 | − break; | |
| 1370 | + return 0; | |
| 1369 | 1371 | cond_resched(); |
| 1370 | 1372 | } while (time_before(jiffies, end)); |
| 1371 | − return 0; | |
| 1373 | + return -EBUSY; | |
| 1372 | 1374 | } |
| 1373 | 1375 | |
| 1374 | 1376 | static int mlxsw_pci_alloc_irq_vectors(struct mlxsw_pci *mlxsw_pci) |
| @@ -27,7 +27,7 @@ · 26 unmodified lines | ||
| 27 | 27 | |
| 28 | 28 | #define MLXSW_PCI_SW_RESET 0xF0010 |
| 29 | 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 | 31 | #define MLXSW_PCI_SW_RESET_WAIT_MSECS 100 |
| 32 | 32 | #define MLXSW_PCI_FW_READY 0xA1844 |
| 33 | 33 | #define MLXSW_PCI_FW_READY_MASK 0xFFFF |
| @@ -53,6 +53,7 @@ · 19 unmodified lines | ||
| 53 | 53 | #define MLXSW_PCI_WQE_SIZE 32 /* 32 bytes per element */ |
| 54 | 54 | #define MLXSW_PCI_CQE01_SIZE 16 /* 16 bytes per element */ |
| 55 | 55 | #define MLXSW_PCI_CQE2_SIZE 32 /* 32 bytes per element */ |
| 56 | +#define MLXSW_PCI_CQE_SIZE_MAX MLXSW_PCI_CQE2_SIZE | |
| 56 | 57 | #define MLXSW_PCI_EQE_SIZE 16 /* 16 bytes per element */ |
| 57 | 58 | #define MLXSW_PCI_WQE_COUNT (MLXSW_PCI_AQ_SIZE / MLXSW_PCI_WQE_SIZE) |
| 58 | 59 | #define MLXSW_PCI_CQE01_COUNT (MLXSW_PCI_AQ_SIZE / MLXSW_PCI_CQE01_SIZE) |
| @@ -997,8 +997,8 @@ static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_dummy_ops = { · 996 unmodified lines | ||
| 997 | 997 | static const struct mlxsw_sp_fid_family mlxsw_sp_fid_dummy_family = { |
| 998 | 998 | .type = MLXSW_SP_FID_TYPE_DUMMY, |
| 999 | 999 | .fid_size = sizeof(struct mlxsw_sp_fid), |
| 1000 | − .start_index = MLXSW_SP_RFID_BASE - 1, | |
| 1001 | − .end_index = MLXSW_SP_RFID_BASE - 1, | |
| 1000 | + .start_index = VLAN_N_VID - 1, | |
| 1001 | + .end_index = VLAN_N_VID - 1, | |
| 1002 | 1002 | .ops = &mlxsw_sp_fid_dummy_ops, |
| 1003 | 1003 | }; |
| 1004 | 1004 | |
| @@ -1233,7 +1233,7 @@ mlxsw_sp_bridge_port_fdb_flush(struct mlxsw_sp *mlxsw_sp, · 1232 unmodified lines | ||
| 1233 | 1233 | static enum mlxsw_reg_sfd_rec_policy mlxsw_sp_sfd_rec_policy(bool dynamic) |
| 1234 | 1234 | { |
| 1235 | 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 | |
| 1239 | 1239 | static enum mlxsw_reg_sfd_op mlxsw_sp_sfd_op(bool adding) |
| @@ -1290,7 +1290,7 @@ out: · 50 unmodified lines | ||
| 1290 | 1290 | static int __mlxsw_sp_port_fdb_uc_op(struct mlxsw_sp *mlxsw_sp, u8 local_port, |
| 1291 | 1291 | const char *mac, u16 fid, bool adding, |
| 1292 | 1292 | enum mlxsw_reg_sfd_rec_action action, |
| 1293 | − bool dynamic) | |
| 1293 | + enum mlxsw_reg_sfd_rec_policy policy) | |
| 1294 | 1294 | { |
| 1295 | 1295 | char *sfd_pl; |
| 1296 | 1296 | u8 num_rec; |
| @@ -1301,8 +1301,7 @@ static int __mlxsw_sp_port_fdb_uc_op(struct mlxsw_sp *mlxsw_sp, u8 local_port, · 4 unmodified lines | ||
| 1301 | 1301 | return -ENOMEM; |
| 1302 | 1302 | |
| 1303 | 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), | |
| 1305 | − mac, fid, action, local_port); | |
| 1304 | + mlxsw_reg_sfd_uc_pack(sfd_pl, 0, policy, mac, fid, action, local_port); | |
| 1306 | 1305 | num_rec = mlxsw_reg_sfd_num_rec_get(sfd_pl); |
| 1307 | 1306 | err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfd), sfd_pl); |
| 1308 | 1307 | if (err) |
| @@ -1321,7 +1320,8 @@ static int mlxsw_sp_port_fdb_uc_op(struct mlxsw_sp *mlxsw_sp, u8 local_port, · 12 unmodified lines | ||
| 1321 | 1320 | bool dynamic) |
| 1322 | 1321 | { |
| 1323 | 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 | |
| 1327 | 1327 | int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid, |
| @@ -1329,7 +1329,7 @@ int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid, · 1 unmodified line | ||
| 1329 | 1329 | { |
| 1330 | 1330 | return __mlxsw_sp_port_fdb_uc_op(mlxsw_sp, 0, mac, fid, adding, |
| 1331 | 1331 | MLXSW_REG_SFD_REC_ACTION_FORWARD_IP_ROUTER, |
| 1332 | − false); | |
| 1332 | + MLXSW_REG_SFD_REC_POLICY_STATIC_ENTRY); | |
| 1333 | 1333 | } |
| 1334 | 1334 | |
| 1335 | 1335 | static int mlxsw_sp_port_fdb_uc_lag_op(struct mlxsw_sp *mlxsw_sp, u16 lag_id, |
| @@ -337,7 +337,7 @@ static void macvlan_process_broadcast(struct work_struct *w) · 336 unmodified lines | ||
| 337 | 337 | |
| 338 | 338 | if (src) |
| 339 | 339 | dev_put(src->dev); |
| 340 | − kfree_skb(skb); | |
| 340 | + consume_skb(skb); | |
| 341 | 341 | } |
| 342 | 342 | } |
| 343 | 343 | |
| @@ -197,6 +197,7 @@ static struct phy_driver bcm87xx_driver[] = { · 196 unmodified lines | ||
| 197 | 197 | .phy_id = PHY_ID_BCM8706, |
| 198 | 198 | .phy_id_mask = 0xffffffff, |
| 199 | 199 | .name = "Broadcom BCM8706", |
| 200 | + .features = PHY_10GBIT_FEC_FEATURES, | |
| 200 | 201 | .config_init = bcm87xx_config_init, |
| 201 | 202 | .config_aneg = bcm87xx_config_aneg, |
| 202 | 203 | .read_status = bcm87xx_read_status, |
| @@ -208,6 +209,7 @@ static struct phy_driver bcm87xx_driver[] = { · 5 unmodified lines | ||
| 208 | 209 | .phy_id = PHY_ID_BCM8727, |
| 209 | 210 | .phy_id_mask = 0xffffffff, |
| 210 | 211 | .name = "Broadcom BCM8727", |
| 212 | + .features = PHY_10GBIT_FEC_FEATURES, | |
| 211 | 213 | .config_init = bcm87xx_config_init, |
| 212 | 214 | .config_aneg = bcm87xx_config_aneg, |
| 213 | 215 | .read_status = bcm87xx_read_status, |
| @@ -88,6 +88,7 @@ static struct phy_driver cortina_driver[] = { · 87 unmodified lines | ||
| 88 | 88 | .phy_id = PHY_ID_CS4340, |
| 89 | 89 | .phy_id_mask = 0xffffffff, |
| 90 | 90 | .name = "Cortina CS4340", |
| 91 | + .features = PHY_10GBIT_FEATURES, | |
| 91 | 92 | .config_init = gen10g_config_init, |
| 92 | 93 | .config_aneg = gen10g_config_aneg, |
| 93 | 94 | .read_status = cortina_read_status, |
| @@ -1046,6 +1046,39 @@ static int m88e1145_config_init(struct phy_device *phydev) · 1045 unmodified lines | ||
| 1046 | 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 | + */ | |
| 1053 | +static int m88e6390_errata(struct phy_device *phydev) | |
| 1054 | +{ | |
| 1055 | + int err; | |
| 1056 | + | |
| 1057 | + err = phy_write(phydev, MII_BMCR, | |
| 1058 | + BMCR_ANENABLE | BMCR_SPEED1000 | BMCR_FULLDPLX); | |
| 1059 | + if (err) | |
| 1060 | + return err; | |
| 1061 | + | |
| 1062 | + usleep_range(300, 400); | |
| 1063 | + | |
| 1064 | + err = phy_write_paged(phydev, 0xf8, 0x08, 0x36); | |
| 1065 | + if (err) | |
| 1066 | + return err; | |
| 1067 | + | |
| 1068 | + return genphy_soft_reset(phydev); | |
| 1069 | +} | |
| 1070 | + | |
| 1071 | +static int m88e6390_config_aneg(struct phy_device *phydev) | |
| 1072 | +{ | |
| 1073 | + int err; | |
| 1074 | + | |
| 1075 | + err = m88e6390_errata(phydev); | |
| 1076 | + if (err) | |
| 1077 | + return err; | |
| 1078 | + | |
| 1079 | + return m88e1510_config_aneg(phydev); | |
| 1080 | +} | |
| 1081 | + | |
| 1049 | 1082 | /** |
| 1050 | 1083 | * fiber_lpa_mod_linkmode_lpa_t |
| 1051 | 1084 | * @advertising: the linkmode advertisement settings |
| @@ -1402,7 +1435,7 @@ static int m88e1318_set_wol(struct phy_device *phydev, · 350 unmodified lines | ||
| 1402 | 1435 | * before enabling it if !phy_interrupt_is_valid() |
| 1403 | 1436 | */ |
| 1404 | 1437 | if (!phy_interrupt_is_valid(phydev)) |
| 1405 | − phy_read(phydev, MII_M1011_IEVENT); | |
| 1438 | + __phy_read(phydev, MII_M1011_IEVENT); | |
| 1406 | 1439 | |
| 1407 | 1440 | /* Enable the WOL interrupt */ |
| 1408 | 1441 | err = __phy_modify(phydev, MII_88E1318S_PHY_CSIER, 0, |
| @@ -2283,7 +2316,7 @@ static struct phy_driver marvell_drivers[] = { · 874 unmodified lines | ||
| 2283 | 2316 | .features = PHY_GBIT_FEATURES, |
| 2284 | 2317 | .probe = m88e6390_probe, |
| 2285 | 2318 | .config_init = &marvell_config_init, |
| 2286 | − .config_aneg = &m88e1510_config_aneg, | |
| 2319 | + .config_aneg = &m88e6390_config_aneg, | |
| 2287 | 2320 | .read_status = &marvell_read_status, |
| 2288 | 2321 | .ack_interrupt = &marvell_ack_interrupt, |
| 2289 | 2322 | .config_intr = &marvell_config_intr, |
| @@ -390,6 +390,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) · 389 unmodified lines | ||
| 390 | 390 | if (IS_ERR(gpiod)) { |
| 391 | 391 | dev_err(&bus->dev, "mii_bus %s couldn't get reset GPIO\n", |
| 392 | 392 | bus->id); |
| 393 | + device_del(&bus->dev); | |
| 393 | 394 | return PTR_ERR(gpiod); |
| 394 | 395 | } else if (gpiod) { |
| 395 | 396 | bus->reset_gpiod = gpiod; |
| @@ -233,6 +233,7 @@ static struct phy_driver meson_gxl_phy[] = { · 232 unmodified lines | ||
| 233 | 233 | .name = "Meson GXL Internal PHY", |
| 234 | 234 | .features = PHY_BASIC_FEATURES, |
| 235 | 235 | .flags = PHY_IS_INTERNAL, |
| 236 | + .soft_reset = genphy_soft_reset, | |
| 236 | 237 | .config_init = meson_gxl_config_init, |
| 237 | 238 | .aneg_done = genphy_aneg_done, |
| 238 | 239 | .read_status = meson_gxl_read_status, |
| @@ -1070,6 +1070,7 @@ static struct phy_driver ksphy_driver[] = { · 1069 unmodified lines | ||
| 1070 | 1070 | .driver_data = &ksz9021_type, |
| 1071 | 1071 | .probe = kszphy_probe, |
| 1072 | 1072 | .config_init = ksz9031_config_init, |
| 1073 | + .soft_reset = genphy_soft_reset, | |
| 1073 | 1074 | .read_status = ksz9031_read_status, |
| 1074 | 1075 | .ack_interrupt = kszphy_ack_interrupt, |
| 1075 | 1076 | .config_intr = kszphy_config_intr, |
| @@ -1098,6 +1099,7 @@ static struct phy_driver ksphy_driver[] = { · 22 unmodified lines | ||
| 1098 | 1099 | .phy_id = PHY_ID_KSZ8873MLL, |
| 1099 | 1100 | .phy_id_mask = MICREL_PHY_ID_MASK, |
| 1100 | 1101 | .name = "Micrel KSZ8873MLL Switch", |
| 1102 | + .features = PHY_BASIC_FEATURES, | |
| 1101 | 1103 | .config_init = kszphy_config_init, |
| 1102 | 1104 | .config_aneg = ksz8873mll_config_aneg, |
| 1103 | 1105 | .read_status = ksz8873mll_read_status, |
| @@ -543,13 +543,6 @@ int phy_start_aneg(struct phy_device *phydev) · 542 unmodified lines | ||
| 543 | 543 | |
| 544 | 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 | 546 | if (AUTONEG_DISABLE == phydev->autoneg) |
| 554 | 547 | phy_sanitize_settings(phydev); |
| 555 | 548 | |
| @@ -560,11 +553,13 @@ int phy_start_aneg(struct phy_device *phydev) · 4 unmodified lines | ||
| 560 | 553 | if (err < 0) |
| 561 | 554 | goto out_unlock; |
| 562 | 555 | |
| 563 | − if (phydev->autoneg == AUTONEG_ENABLE) { | |
| 564 | − err = phy_check_link_status(phydev); | |
| 565 | − } else { | |
| 566 | − phydev->state = PHY_FORCING; | |
| 567 | − phydev->link_timeout = PHY_FORCE_TIMEOUT; | |
| 556 | + if (__phy_is_started(phydev)) { | |
| 557 | + if (phydev->autoneg == AUTONEG_ENABLE) { | |
| 558 | + err = phy_check_link_status(phydev); | |
| 559 | + } else { | |
| 560 | + phydev->state = PHY_FORCING; | |
| 561 | + phydev->link_timeout = PHY_FORCE_TIMEOUT; | |
| 562 | + } | |
| 568 | 563 | } |
| 569 | 564 | |
| 570 | 565 | out_unlock: |
| @@ -61,6 +61,9 @@ EXPORT_SYMBOL_GPL(phy_gbit_all_ports_features); · 60 unmodified lines | ||
| 61 | 61 | __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_features) __ro_after_init; |
| 62 | 62 | EXPORT_SYMBOL_GPL(phy_10gbit_features); |
| 63 | 63 | |
| 64 | +__ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_fec_features) __ro_after_init; | |
| 65 | +EXPORT_SYMBOL_GPL(phy_10gbit_fec_features); | |
| 66 | + | |
| 64 | 67 | static const int phy_basic_ports_array[] = { |
| 65 | 68 | ETHTOOL_LINK_MODE_Autoneg_BIT, |
| 66 | 69 | ETHTOOL_LINK_MODE_TP_BIT, |
| @@ -109,6 +112,11 @@ const int phy_10gbit_features_array[1] = { · 42 unmodified lines | ||
| 109 | 112 | }; |
| 110 | 113 | EXPORT_SYMBOL_GPL(phy_10gbit_features_array); |
| 111 | 114 | |
| 115 | +const int phy_10gbit_fec_features_array[1] = { | |
| 116 | + ETHTOOL_LINK_MODE_10000baseR_FEC_BIT, | |
| 117 | +}; | |
| 118 | +EXPORT_SYMBOL_GPL(phy_10gbit_fec_features_array); | |
| 119 | + | |
| 112 | 120 | __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_full_features) __ro_after_init; |
| 113 | 121 | EXPORT_SYMBOL_GPL(phy_10gbit_full_features); |
| 114 | 122 | |
| @@ -191,6 +199,10 @@ static void features_init(void) · 76 unmodified lines | ||
| 191 | 199 | linkmode_set_bit_array(phy_10gbit_full_features_array, |
| 192 | 200 | ARRAY_SIZE(phy_10gbit_full_features_array), |
| 193 | 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 | |
| 196 | 208 | void phy_device_free(struct phy_device *phydev) |
| @@ -2243,6 +2255,11 @@ int phy_driver_register(struct phy_driver *new_driver, struct module *owner) · 2046 unmodified lines | ||
| 2243 | 2255 | { |
| 2244 | 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 | 2263 | new_driver->mdiodrv.flags |= MDIO_DEVICE_IS_PHY; |
| 2247 | 2264 | new_driver->mdiodrv.driver.name = new_driver->name; |
| 2248 | 2265 | new_driver->mdiodrv.driver.bus = &mdio_bus_type; |
| @@ -80,6 +80,7 @@ static struct phy_driver teranetics_driver[] = { · 79 unmodified lines | ||
| 80 | 80 | .phy_id = PHY_ID_TN2020, |
| 81 | 81 | .phy_id_mask = 0xffffffff, |
| 82 | 82 | .name = "Teranetics TN2020", |
| 83 | + .features = PHY_10GBIT_FEATURES, | |
| 83 | 84 | .soft_reset = gen10g_no_soft_reset, |
| 84 | 85 | .aneg_done = teranetics_aneg_done, |
| 85 | 86 | .config_init = gen10g_config_init, |
| @@ -445,6 +445,7 @@ static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev, · 444 unmodified lines | ||
| 445 | 445 | if (pskb_trim_rcsum(skb, len)) |
| 446 | 446 | goto drop; |
| 447 | 447 | |
| 448 | + ph = pppoe_hdr(skb); | |
| 448 | 449 | pn = pppoe_pernet(dev_net(dev)); |
| 449 | 450 | |
| 450 | 451 | /* Note that get_item does a sock_hold(), so sk_pppox(po) |
| @@ -1287,6 +1287,20 @@ static const struct driver_info asix112_info = { · 1286 unmodified lines | ||
| 1287 | 1287 | |
| 1288 | 1288 | #undef ASIX112_DESC |
| 1289 | 1289 | |
| 1290 | +static const struct driver_info trendnet_info = { | |
| 1291 | + .description = "USB-C 3.1 to 5GBASE-T Ethernet Adapter", | |
| 1292 | + .bind = aqc111_bind, | |
| 1293 | + .unbind = aqc111_unbind, | |
| 1294 | + .status = aqc111_status, | |
| 1295 | + .link_reset = aqc111_link_reset, | |
| 1296 | + .reset = aqc111_reset, | |
| 1297 | + .stop = aqc111_stop, | |
| 1298 | + .flags = FLAG_ETHER | FLAG_FRAMING_AX | | |
| 1299 | + FLAG_AVOID_UNLINK_URBS | FLAG_MULTI_PACKET, | |
| 1300 | + .rx_fixup = aqc111_rx_fixup, | |
| 1301 | + .tx_fixup = aqc111_tx_fixup, | |
| 1302 | +}; | |
| 1303 | + | |
| 1290 | 1304 | static int aqc111_suspend(struct usb_interface *intf, pm_message_t message) |
| 1291 | 1305 | { |
| 1292 | 1306 | struct usbnet *dev = usb_get_intfdata(intf); |
| @@ -1440,6 +1454,7 @@ static const struct usb_device_id products[] = { · 147 unmodified lines | ||
| 1440 | 1454 | {AQC111_USB_ETH_DEV(0x2eca, 0xc101, aqc111_info)}, |
| 1441 | 1455 | {AQC111_USB_ETH_DEV(0x0b95, 0x2790, asix111_info)}, |
| 1442 | 1456 | {AQC111_USB_ETH_DEV(0x0b95, 0x2791, asix112_info)}, |
| 1457 | + {AQC111_USB_ETH_DEV(0x20f4, 0xe05a, trendnet_info)}, | |
| 1443 | 1458 | { },/* END */ |
| 1444 | 1459 | }; |
| 1445 | 1460 | MODULE_DEVICE_TABLE(usb, products); |
| @@ -843,6 +843,14 @@ static const struct usb_device_id products[] = { · 842 unmodified lines | ||
| 843 | 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 | 854 | /* WHITELIST!!! |
| 847 | 855 | * |
| 848 | 856 | * CDC Ether uses two interfaces, not necessarily consecutive. |
| @@ -1330,7 +1330,7 @@ static int virtnet_receive(struct receive_queue *rq, int budget, · 1329 unmodified lines | ||
| 1330 | 1330 | return stats.packets; |
| 1331 | 1331 | } |
| 1332 | 1332 | |
| 1333 | −static void free_old_xmit_skbs(struct send_queue *sq) | |
| 1333 | +static void free_old_xmit_skbs(struct send_queue *sq, bool in_napi) | |
| 1334 | 1334 | { |
| 1335 | 1335 | struct sk_buff *skb; |
| 1336 | 1336 | unsigned int len; |
| @@ -1343,7 +1343,7 @@ static void free_old_xmit_skbs(struct send_queue *sq) · 6 unmodified lines | ||
| 1343 | 1343 | bytes += skb->len; |
| 1344 | 1344 | packets++; |
| 1345 | 1345 | |
| 1346 | − dev_consume_skb_any(skb); | |
| 1346 | + napi_consume_skb(skb, in_napi); | |
| 1347 | 1347 | } |
| 1348 | 1348 | |
| 1349 | 1349 | /* Avoid overhead when no packets have been processed |
| @@ -1369,7 +1369,7 @@ static void virtnet_poll_cleantx(struct receive_queue *rq) · 19 unmodified lines | ||
| 1369 | 1369 | return; |
| 1370 | 1370 | |
| 1371 | 1371 | if (__netif_tx_trylock(txq)) { |
| 1372 | − free_old_xmit_skbs(sq); | |
| 1372 | + free_old_xmit_skbs(sq, true); | |
| 1373 | 1373 | __netif_tx_unlock(txq); |
| 1374 | 1374 | } |
| 1375 | 1375 | |
| @@ -1445,7 +1445,7 @@ static int virtnet_poll_tx(struct napi_struct *napi, int budget) · 69 unmodified lines | ||
| 1445 | 1445 | struct netdev_queue *txq = netdev_get_tx_queue(vi->dev, vq2txq(sq->vq)); |
| 1446 | 1446 | |
| 1447 | 1447 | __netif_tx_lock(txq, raw_smp_processor_id()); |
| 1448 | − free_old_xmit_skbs(sq); | |
| 1448 | + free_old_xmit_skbs(sq, true); | |
| 1449 | 1449 | __netif_tx_unlock(txq); |
| 1450 | 1450 | |
| 1451 | 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) · 62 unmodified lines | ||
| 1514 | 1514 | bool use_napi = sq->napi.weight; |
| 1515 | 1515 | |
| 1516 | 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 | 1519 | if (use_napi && kick) |
| 1520 | 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) · 36 unmodified lines | ||
| 1557 | 1557 | if (!use_napi && |
| 1558 | 1558 | unlikely(!virtqueue_enable_cb_delayed(sq->vq))) { |
| 1559 | 1559 | /* More just got used, free them then recheck. */ |
| 1560 | − free_old_xmit_skbs(sq); | |
| 1560 | + free_old_xmit_skbs(sq, false); | |
| 1561 | 1561 | if (sq->vq->num_free >= 2+MAX_SKB_FRAGS) { |
| 1562 | 1562 | netif_start_subqueue(dev, qnum); |
| 1563 | 1563 | virtqueue_disable_cb(sq->vq); |
| @@ -1236,7 +1236,8 @@ static void handle_rx(struct vhost_net *net) · 1235 unmodified lines | ||
| 1236 | 1236 | if (nvq->done_idx > VHOST_NET_BATCH) |
| 1237 | 1237 | vhost_net_signal_used(nvq); |
| 1238 | 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 | 1241 | total_len += vhost_len; |
| 1241 | 1242 | if (unlikely(vhost_exceeds_weight(++recv_pkts, total_len))) { |
| 1242 | 1243 | vhost_poll_queue(&vq->poll); |
| @@ -1737,13 +1737,87 @@ static int log_write(void __user *log_base, · 1736 unmodified lines | ||
| 1737 | 1737 | return r; |
| 1738 | 1738 | } |
| 1739 | 1739 | |
| 1740 | +static int log_write_hva(struct vhost_virtqueue *vq, u64 hva, u64 len) | |
| 1741 | +{ | |
| 1742 | + struct vhost_umem *umem = vq->umem; | |
| 1743 | + struct vhost_umem_node *u; | |
| 1744 | + u64 start, end, l, min; | |
| 1745 | + int r; | |
| 1746 | + bool hit = false; | |
| 1747 | + | |
| 1748 | + while (len) { | |
| 1749 | + min = len; | |
| 1750 | + /* More than one GPAs can be mapped into a single HVA. So | |
| 1751 | + * iterate all possible umems here to be safe. | |
| 1752 | + */ | |
| 1753 | + list_for_each_entry(u, &umem->umem_list, link) { | |
| 1754 | + if (u->userspace_addr > hva - 1 + len || | |
| 1755 | + u->userspace_addr - 1 + u->size < hva) | |
| 1756 | + continue; | |
| 1757 | + start = max(u->userspace_addr, hva); | |
| 1758 | + end = min(u->userspace_addr - 1 + u->size, | |
| 1759 | + hva - 1 + len); | |
| 1760 | + l = end - start + 1; | |
| 1761 | + r = log_write(vq->log_base, | |
| 1762 | + u->start + start - u->userspace_addr, | |
| 1763 | + l); | |
| 1764 | + if (r < 0) | |
| 1765 | + return r; | |
| 1766 | + hit = true; | |
| 1767 | + min = min(l, min); | |
| 1768 | + } | |
| 1769 | + | |
| 1770 | + if (!hit) | |
| 1771 | + return -EFAULT; | |
| 1772 | + | |
| 1773 | + len -= min; | |
| 1774 | + hva += min; | |
| 1775 | + } | |
| 1776 | + | |
| 1777 | + return 0; | |
| 1778 | +} | |
| 1779 | + | |
| 1780 | +static int log_used(struct vhost_virtqueue *vq, u64 used_offset, u64 len) | |
| 1781 | +{ | |
| 1782 | + struct iovec iov[64]; | |
| 1783 | + int i, ret; | |
| 1784 | + | |
| 1785 | + if (!vq->iotlb) | |
| 1786 | + return log_write(vq->log_base, vq->log_addr + used_offset, len); | |
| 1787 | + | |
| 1788 | + ret = translate_desc(vq, (uintptr_t)vq->used + used_offset, | |
| 1789 | + len, iov, 64, VHOST_ACCESS_WO); | |
| 1790 | + if (ret) | |
| 1791 | + return ret; | |
| 1792 | + | |
| 1793 | + for (i = 0; i < ret; i++) { | |
| 1794 | + ret = log_write_hva(vq, (uintptr_t)iov[i].iov_base, | |
| 1795 | + iov[i].iov_len); | |
| 1796 | + if (ret) | |
| 1797 | + return ret; | |
| 1798 | + } | |
| 1799 | + | |
| 1800 | + return 0; | |
| 1801 | +} | |
| 1802 | + | |
| 1740 | 1803 | int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log, |
| 1741 | − unsigned int log_num, u64 len) | |
| 1804 | + unsigned int log_num, u64 len, struct iovec *iov, int count) | |
| 1742 | 1805 | { |
| 1743 | 1806 | int i, r; |
| 1744 | 1807 | |
| 1745 | 1808 | /* Make sure data written is seen before log. */ |
| 1746 | 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 | 1821 | for (i = 0; i < log_num; ++i) { |
| 1748 | 1822 | u64 l = min(log[i].len, len); |
| 1749 | 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) · 23 unmodified lines | ||
| 1773 | 1847 | smp_wmb(); |
| 1774 | 1848 | /* Log used flag write. */ |
| 1775 | 1849 | used = &vq->used->flags; |
| 1776 | − log_write(vq->log_base, vq->log_addr + | |
| 1777 | − (used - (void __user *)vq->used), | |
| 1778 | − sizeof vq->used->flags); | |
| 1850 | + log_used(vq, (used - (void __user *)vq->used), | |
| 1851 | + sizeof vq->used->flags); | |
| 1779 | 1852 | if (vq->log_ctx) |
| 1780 | 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) · 11 unmodified lines | ||
| 1793 | 1866 | smp_wmb(); |
| 1794 | 1867 | /* Log avail event write */ |
| 1795 | 1868 | used = vhost_avail_event(vq); |
| 1796 | − log_write(vq->log_base, vq->log_addr + | |
| 1797 | − (used - (void __user *)vq->used), | |
| 1798 | − sizeof *vhost_avail_event(vq)); | |
| 1869 | + log_used(vq, (used - (void __user *)vq->used), | |
| 1870 | + sizeof *vhost_avail_event(vq)); | |
| 1799 | 1871 | if (vq->log_ctx) |
| 1800 | 1872 | eventfd_signal(vq->log_ctx, 1); |
| 1801 | 1873 | } |
| @@ -2195,10 +2267,8 @@ static int __vhost_add_used_n(struct vhost_virtqueue *vq, · 393 unmodified lines | ||
| 2195 | 2267 | /* Make sure data is seen before log. */ |
| 2196 | 2268 | smp_wmb(); |
| 2197 | 2269 | /* Log used ring entry write. */ |
| 2198 | − log_write(vq->log_base, | |
| 2199 | − vq->log_addr + | |
| 2200 | − ((void __user *)used - (void __user *)vq->used), | |
| 2201 | − count * sizeof *used); | |
| 2270 | + log_used(vq, ((void __user *)used - (void __user *)vq->used), | |
| 2271 | + count * sizeof *used); | |
| 2202 | 2272 | } |
| 2203 | 2273 | old = vq->last_used_idx; |
| 2204 | 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, · 35 unmodified lines | ||
| 2240 | 2310 | /* Make sure used idx is seen before log. */ |
| 2241 | 2311 | smp_wmb(); |
| 2242 | 2312 | /* Log used index update. */ |
| 2243 | − log_write(vq->log_base, | |
| 2244 | − vq->log_addr + offsetof(struct vring_used, idx), | |
| 2245 | − sizeof vq->used->idx); | |
| 2313 | + log_used(vq, offsetof(struct vring_used, idx), | |
| 2314 | + sizeof vq->used->idx); | |
| 2246 | 2315 | if (vq->log_ctx) |
| 2247 | 2316 | eventfd_signal(vq->log_ctx, 1); |
| 2248 | 2317 | } |
| @@ -205,7 +205,8 @@ bool vhost_vq_avail_empty(struct vhost_dev *, struct vhost_virtqueue *); · 204 unmodified lines | ||
| 205 | 205 | bool vhost_enable_notify(struct vhost_dev *, struct vhost_virtqueue *); |
| 206 | 206 | |
| 207 | 207 | int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log, |
| 208 | − unsigned int log_num, u64 len); | |
| 208 | + unsigned int log_num, u64 len, | |
| 209 | + struct iovec *iov, int count); | |
| 209 | 210 | int vq_iotlb_prefetch(struct vhost_virtqueue *vq); |
| 210 | 211 | |
| 211 | 212 | struct vhost_msg_node *vhost_new_msg(struct vhost_virtqueue *vq, int type); |
| @@ -48,6 +48,7 @@ extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_features) __ro_after_init; · 47 unmodified lines | ||
| 48 | 48 | extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_fibre_features) __ro_after_init; |
| 49 | 49 | extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_all_ports_features) __ro_after_init; |
| 50 | 50 | extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_features) __ro_after_init; |
| 51 | +extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_fec_features) __ro_after_init; | |
| 51 | 52 | extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_full_features) __ro_after_init; |
| 52 | 53 | |
| 53 | 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 · 2 unmodified lines | ||
| 56 | 57 | #define PHY_GBIT_FIBRE_FEATURES ((unsigned long *)&phy_gbit_fibre_features) |
| 57 | 58 | #define PHY_GBIT_ALL_PORTS_FEATURES ((unsigned long *)&phy_gbit_all_ports_features) |
| 58 | 59 | #define PHY_10GBIT_FEATURES ((unsigned long *)&phy_10gbit_features) |
| 60 | +#define PHY_10GBIT_FEC_FEATURES ((unsigned long *)&phy_10gbit_fec_features) | |
| 59 | 61 | #define PHY_10GBIT_FULL_FEATURES ((unsigned long *)&phy_10gbit_full_features) |
| 60 | 62 | |
| 61 | 63 | extern const int phy_10_100_features_array[4]; |
| @@ -467,8 +469,8 @@ struct phy_device { · 405 unmodified lines | ||
| 467 | 469 | * only works for PHYs with IDs which match this field |
| 468 | 470 | * name: The friendly name of this PHY type |
| 469 | 471 | * phy_id_mask: Defines the important bits of the phy_id |
| 470 | − * features: A list of features (speed, duplex, etc) supported | |
| 471 | − * by this PHY | |
| 472 | + * features: A mandatory list of features (speed, duplex, etc) | |
| 473 | + * supported by this PHY | |
| 472 | 474 | * flags: A bitfield defining certain other features this PHY |
| 473 | 475 | * supports (like interrupts) |
| 474 | 476 | * |
| @@ -3218,6 +3218,7 @@ int pskb_trim_rcsum_slow(struct sk_buff *skb, unsigned int len); · 3217 unmodified lines | ||
| 3218 | 3218 | * |
| 3219 | 3219 | * This is exactly the same as pskb_trim except that it ensures the |
| 3220 | 3220 | * checksum of received packets are still valid after the operation. |
| 3221 | + * It can change skb pointers. | |
| 3221 | 3222 | */ |
| 3222 | 3223 | |
| 3223 | 3224 | static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) |
| @@ -20,18 +20,6 @@ struct sock; · 19 unmodified lines | ||
| 20 | 20 | struct socket; |
| 21 | 21 | struct rxrpc_call; |
| 22 | 22 | |
| 23 | −/* | |
| 24 | − * Call completion condition (state == RXRPC_CALL_COMPLETE). | |
| 25 | − */ | |
| 26 | −enum rxrpc_call_completion { | |
| 27 | − RXRPC_CALL_SUCCEEDED, /* - Normal termination */ | |
| 28 | − RXRPC_CALL_REMOTELY_ABORTED, /* - call aborted by peer */ | |
| 29 | − RXRPC_CALL_LOCALLY_ABORTED, /* - call aborted locally on error or close */ | |
| 30 | − RXRPC_CALL_LOCAL_ERROR, /* - call failed due to local error */ | |
| 31 | − RXRPC_CALL_NETWORK_ERROR, /* - call terminated by network error */ | |
| 32 | − NR__RXRPC_CALL_COMPLETIONS | |
| 33 | −}; | |
| 34 | − | |
| 35 | 23 | /* |
| 36 | 24 | * Debug ID counter for tracing. |
| 37 | 25 | */ |
| @@ -73,10 +61,6 @@ int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t, · 35 unmodified lines | ||
| 73 | 61 | rxrpc_user_attach_call_t, unsigned long, gfp_t, |
| 74 | 62 | unsigned int); |
| 75 | 63 | void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64); |
| 76 | −int rxrpc_kernel_retry_call(struct socket *, struct rxrpc_call *, | |
| 77 | − struct sockaddr_rxrpc *, struct key *); | |
| 78 | −int rxrpc_kernel_check_call(struct socket *, struct rxrpc_call *, | |
| 79 | − enum rxrpc_call_completion *, u32 *); | |
| 80 | 64 | u32 rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *); |
| 81 | 65 | void rxrpc_kernel_probe_life(struct socket *, struct rxrpc_call *); |
| 82 | 66 | u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *); |
| @@ -241,7 +241,7 @@ int fib_table_delete(struct net *, struct fib_table *, struct fib_config *, · 240 unmodified lines | ||
| 241 | 241 | struct netlink_ext_ack *extack); |
| 242 | 242 | int fib_table_dump(struct fib_table *table, struct sk_buff *skb, |
| 243 | 243 | struct netlink_callback *cb, struct fib_dump_filter *filter); |
| 244 | −int fib_table_flush(struct net *net, struct fib_table *table); | |
| 244 | +int fib_table_flush(struct net *net, struct fib_table *table, bool flush_all); | |
| 245 | 245 | struct fib_table *fib_trie_unmerge(struct fib_table *main_tb); |
| 246 | 246 | void fib_table_flush_external(struct fib_table *table); |
| 247 | 247 | void fib_free_table(struct fib_table *tb); |
| @@ -84,7 +84,6 @@ struct flow_offload { · 83 unmodified lines | ||
| 84 | 84 | struct nf_flow_route { |
| 85 | 85 | struct { |
| 86 | 86 | struct dst_entry *dst; |
| 87 | − int ifindex; | |
| 88 | 87 | } tuple[FLOW_OFFLOAD_DIR_MAX]; |
| 89 | 88 | }; |
| 90 | 89 | |
| @@ -268,7 +268,7 @@ struct sockaddr_in { · 267 unmodified lines | ||
| 268 | 268 | #define IN_MULTICAST(a) IN_CLASSD(a) |
| 269 | 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 | 272 | #define IN_EXPERIMENTAL(a) IN_BADCLASS((a)) |
| 273 | 273 | |
| 274 | 274 | #define IN_CLASSE(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) |
| @@ -467,7 +467,7 @@ static const struct btf_kind_operations *btf_type_ops(const struct btf_type *t) · 466 unmodified lines | ||
| 467 | 467 | return kind_ops[BTF_INFO_KIND(t->info)]; |
| 468 | 468 | } |
| 469 | 469 | |
| 470 | −bool btf_name_offset_valid(const struct btf *btf, u32 offset) | |
| 470 | +static bool btf_name_offset_valid(const struct btf *btf, u32 offset) | |
| 471 | 471 | { |
| 472 | 472 | return BTF_STR_OFFSET_VALID(offset) && |
| 473 | 473 | offset < btf->hdr.str_len; |
| @@ -718,6 +718,7 @@ cgroup_dev_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) · 717 unmodified lines | ||
| 718 | 718 | case BPF_FUNC_trace_printk: |
| 719 | 719 | if (capable(CAP_SYS_ADMIN)) |
| 720 | 720 | return bpf_get_trace_printk_proto(); |
| 721 | + /* fall through */ | |
| 721 | 722 | default: |
| 722 | 723 | return NULL; |
| 723 | 724 | } |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | struct bpf_map *bpf_map_meta_alloc(int inner_map_ufd) |
| 13 | 13 | { |
| 14 | 14 | struct bpf_map *inner_map, *inner_map_meta; |
| 15 | + u32 inner_map_meta_size; | |
| 15 | 16 | struct fd f; |
| 16 | 17 | |
| 17 | 18 | f = fdget(inner_map_ufd); |
| @@ -36,7 +37,12 @@ struct bpf_map *bpf_map_meta_alloc(int inner_map_ufd) · 18 unmodified lines | ||
| 36 | 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 | 46 | if (!inner_map_meta) { |
| 41 | 47 | fdput(f); |
| 42 | 48 | return ERR_PTR(-ENOMEM); |
| @@ -46,9 +52,16 @@ struct bpf_map *bpf_map_meta_alloc(int inner_map_ufd) · 3 unmodified lines | ||
| 46 | 52 | inner_map_meta->key_size = inner_map->key_size; |
| 47 | 53 | inner_map_meta->value_size = inner_map->value_size; |
| 48 | 54 | inner_map_meta->map_flags = inner_map->map_flags; |
| 49 | − inner_map_meta->ops = inner_map->ops; | |
| 50 | 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 | 65 | fdput(f); |
| 53 | 66 | return inner_map_meta; |
| 54 | 67 | } |
| @@ -180,11 +180,14 @@ static inline int stack_map_parse_build_id(void *page_addr, · 179 unmodified lines | ||
| 180 | 180 | |
| 181 | 181 | if (nhdr->n_type == BPF_BUILD_ID && |
| 182 | 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 | 185 | memcpy(build_id, |
| 185 | 186 | note_start + note_offs + |
| 186 | 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 | 191 | return 0; |
| 189 | 192 | } |
| 190 | 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, · 120 unmodified lines | ||
| 311 | 314 | for (i = 0; i < trace_nr; i++) { |
| 312 | 315 | id_offs[i].status = BPF_STACK_BUILD_ID_IP; |
| 313 | 316 | id_offs[i].ip = ips[i]; |
| 317 | + memset(id_offs[i].build_id, 0, BPF_BUILD_ID_SIZE); | |
| 314 | 318 | } |
| 315 | 319 | return; |
| 316 | 320 | } |
| @@ -321,6 +325,7 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs, · 4 unmodified lines | ||
| 321 | 325 | /* per entry fall back to ips */ |
| 322 | 326 | id_offs[i].status = BPF_STACK_BUILD_ID_IP; |
| 323 | 327 | id_offs[i].ip = ips[i]; |
| 328 | + memset(id_offs[i].build_id, 0, BPF_BUILD_ID_SIZE); | |
| 324 | 329 | continue; |
| 325 | 330 | } |
| 326 | 331 | id_offs[i].offset = (vma->vm_pgoff << PAGE_SHIFT) + ips[i] |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | − .section .bpfilter_umh, "a" | |
| 2 | + .section .rodata, "a" | |
| 3 | 3 | .global bpfilter_umh_start |
| 4 | 4 | bpfilter_umh_start: |
| 5 | 5 | .incbin "net/bpfilter/bpfilter_umh" |
| @@ -1128,6 +1128,8 @@ int br_fdb_external_learn_add(struct net_bridge *br, struct net_bridge_port *p, · 1127 unmodified lines | ||
| 1128 | 1128 | err = -ENOMEM; |
| 1129 | 1129 | goto err_unlock; |
| 1130 | 1130 | } |
| 1131 | + if (swdev_notify) | |
| 1132 | + fdb->added_by_user = 1; | |
| 1131 | 1133 | fdb->added_by_external_learn = 1; |
| 1132 | 1134 | fdb_notify(br, fdb, RTM_NEWNEIGH, swdev_notify); |
| 1133 | 1135 | } else { |
| @@ -1147,6 +1149,9 @@ int br_fdb_external_learn_add(struct net_bridge *br, struct net_bridge_port *p, · 13 unmodified lines | ||
| 1147 | 1149 | modified = true; |
| 1148 | 1150 | } |
| 1149 | 1151 | |
| 1152 | + if (swdev_notify) | |
| 1153 | + fdb->added_by_user = 1; | |
| 1154 | + | |
| 1150 | 1155 | if (modified) |
| 1151 | 1156 | fdb_notify(br, fdb, RTM_NEWNEIGH, swdev_notify); |
| 1152 | 1157 | } |
| @@ -36,10 +36,10 @@ static inline int should_deliver(const struct net_bridge_port *p, · 35 unmodified lines | ||
| 36 | 36 | |
| 37 | 37 | int br_dev_queue_push_xmit(struct net *net, struct sock *sk, struct sk_buff *skb) |
| 38 | 38 | { |
| 39 | + skb_push(skb, ETH_HLEN); | |
| 39 | 40 | if (!is_skb_forwardable(skb->dev, skb)) |
| 40 | 41 | goto drop; |
| 41 | 42 | |
| 42 | − skb_push(skb, ETH_HLEN); | |
| 43 | 43 | br_drop_fake_rtable(skb); |
| 44 | 44 | |
| 45 | 45 | if (skb->ip_summed == CHECKSUM_PARTIAL && |
| @@ -98,12 +98,11 @@ static void __br_forward(const struct net_bridge_port *to, · 52 unmodified lines | ||
| 98 | 98 | net = dev_net(indev); |
| 99 | 99 | } else { |
| 100 | 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 | 103 | kfree_skb(skb); |
| 103 | − } else { | |
| 104 | − skb_push(skb, ETH_HLEN); | |
| 104 | + else | |
| 105 | 105 | br_netpoll_send_skb(to, skb); |
| 106 | − } | |
| 107 | 106 | return; |
| 108 | 107 | } |
| 109 | 108 | br_hook = NF_BR_LOCAL_OUT; |
| @@ -131,6 +131,7 @@ int br_validate_ipv6(struct net *net, struct sk_buff *skb) · 130 unmodified lines | ||
| 131 | 131 | IPSTATS_MIB_INDISCARDS); |
| 132 | 132 | goto drop; |
| 133 | 133 | } |
| 134 | + hdr = ipv6_hdr(skb); | |
| 134 | 135 | } |
| 135 | 136 | if (hdr->nexthdr == NEXTHDR_HOP && br_nf_check_hbh_len(skb)) |
| 136 | 137 | goto drop; |
| @@ -1137,14 +1137,16 @@ static int do_replace(struct net *net, const void __user *user, · 1136 unmodified lines | ||
| 1137 | 1137 | tmp.name[sizeof(tmp.name) - 1] = 0; |
| 1138 | 1138 | |
| 1139 | 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 | 1142 | if (!newinfo) |
| 1142 | 1143 | return -ENOMEM; |
| 1143 | 1144 | |
| 1144 | 1145 | if (countersize) |
| 1145 | 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 | 1150 | if (!newinfo->entries) { |
| 1149 | 1151 | ret = -ENOMEM; |
| 1150 | 1152 | goto free_newinfo; |
| @@ -229,6 +229,7 @@ static bool reject6_br_csum_ok(struct sk_buff *skb, int hook) · 228 unmodified lines | ||
| 229 | 229 | pskb_trim_rcsum(skb, ntohs(ip6h->payload_len) + sizeof(*ip6h))) |
| 230 | 230 | return false; |
| 231 | 231 | |
| 232 | + ip6h = ipv6_hdr(skb); | |
| 232 | 233 | thoff = ipv6_skip_exthdr(skb, ((u8*)(ip6h+1) - skb->data), &proto, &fo); |
| 233 | 234 | if (thoff < 0 || thoff >= skb->len || (fo & htons(~0x7)) != 0) |
| 234 | 235 | return false; |
| @@ -2020,18 +2020,19 @@ static inline int __bpf_tx_skb(struct net_device *dev, struct sk_buff *skb) · 2019 unmodified lines | ||
| 2020 | 2020 | static int __bpf_redirect_no_mac(struct sk_buff *skb, struct net_device *dev, |
| 2021 | 2021 | u32 flags) |
| 2022 | 2022 | { |
| 2023 | − /* skb->mac_len is not set on normal egress */ | |
| 2024 | − unsigned int mlen = skb->network_header - skb->mac_header; | |
| 2023 | + unsigned int mlen = skb_network_offset(skb); | |
| 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. | |
| 2029 | − * At egress, skb_pospull_rcsum has to be done in case that | |
| 2030 | − * the skb is originated from ingress (i.e. a forwarded skb) | |
| 2031 | − * to ensure that rcsum starts at net header. | |
| 2032 | − */ | |
| 2033 | − if (!skb_at_tc_ingress(skb)) | |
| 2034 | − skb_postpull_rcsum(skb, skb_mac_header(skb), mlen); | |
| 2028 | + /* At ingress, the mac header has already been pulled once. | |
| 2029 | + * At egress, skb_pospull_rcsum has to be done in case that | |
| 2030 | + * the skb is originated from ingress (i.e. a forwarded skb) | |
| 2031 | + * to ensure that rcsum starts at net header. | |
| 2032 | + */ | |
| 2033 | + if (!skb_at_tc_ingress(skb)) | |
| 2034 | + skb_postpull_rcsum(skb, skb_mac_header(skb), mlen); | |
| 2035 | + } | |
| 2035 | 2036 | skb_pop_mac_header(skb); |
| 2036 | 2037 | skb_reset_mac_len(skb); |
| 2037 | 2038 | return flags & BPF_F_INGRESS ? |
| @@ -4119,6 +4120,10 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock, · 2081 unmodified lines | ||
| 4119 | 4120 | sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF); |
| 4120 | 4121 | break; |
| 4121 | 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 | 4127 | sk->sk_max_pacing_rate = (val == ~0U) ? ~0UL : val; |
| 4123 | 4128 | sk->sk_pacing_rate = min(sk->sk_pacing_rate, |
| 4124 | 4129 | sk->sk_max_pacing_rate); |
| @@ -4132,7 +4137,10 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock, · 7 unmodified lines | ||
| 4132 | 4137 | sk->sk_rcvlowat = val ? : 1; |
| 4133 | 4138 | break; |
| 4134 | 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 | 4144 | break; |
| 4137 | 4145 | default: |
| 4138 | 4146 | ret = -EINVAL; |
| @@ -5309,7 +5317,7 @@ bpf_base_func_proto(enum bpf_func_id func_id) · 1170 unmodified lines | ||
| 5309 | 5317 | case BPF_FUNC_trace_printk: |
| 5310 | 5318 | if (capable(CAP_SYS_ADMIN)) |
| 5311 | 5319 | return bpf_get_trace_printk_proto(); |
| 5312 | − /* else: fall through */ | |
| 5320 | + /* else, fall through */ | |
| 5313 | 5321 | default: |
| 5314 | 5322 | return NULL; |
| 5315 | 5323 | } |
| @@ -63,6 +63,7 @@ static int run_lwt_bpf(struct sk_buff *skb, struct bpf_lwt_prog *lwt, · 62 unmodified lines | ||
| 63 | 63 | lwt->name ? : "<unknown>"); |
| 64 | 64 | ret = BPF_OK; |
| 65 | 65 | } else { |
| 66 | + skb_reset_mac_header(skb); | |
| 66 | 67 | ret = skb_do_redirect(skb); |
| 67 | 68 | if (ret == 0) |
| 68 | 69 | ret = BPF_REDIRECT; |
| @@ -450,7 +450,7 @@ static struct neigh_hash_table *neigh_hash_alloc(unsigned int shift) · 449 unmodified lines | ||
| 450 | 450 | buckets = (struct neighbour __rcu **) |
| 451 | 451 | __get_free_pages(GFP_ATOMIC | __GFP_ZERO, |
| 452 | 452 | get_order(size)); |
| 453 | − kmemleak_alloc(buckets, size, 0, GFP_ATOMIC); | |
| 453 | + kmemleak_alloc(buckets, size, 1, GFP_ATOMIC); | |
| 454 | 454 | } |
| 455 | 455 | if (!buckets) { |
| 456 | 456 | kfree(ret); |
| @@ -1007,7 +1007,7 @@ static void neigh_probe(struct neighbour *neigh) · 550 unmodified lines | ||
| 1007 | 1007 | if (neigh->ops->solicit) |
| 1008 | 1008 | neigh->ops->solicit(neigh, skb); |
| 1009 | 1009 | atomic_inc(&neigh->probes); |
| 1010 | − kfree_skb(skb); | |
| 1010 | + consume_skb(skb); | |
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | 1013 | /* Called when a timer expires for a neighbour entry. */ |
| @@ -203,7 +203,7 @@ static void fib_flush(struct net *net) · 202 unmodified lines | ||
| 203 | 203 | struct fib_table *tb; |
| 204 | 204 | |
| 205 | 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 | 209 | if (flushed) |
| @@ -1463,7 +1463,7 @@ static void ip_fib_net_exit(struct net *net) · 1253 unmodified lines | ||
| 1463 | 1463 | |
| 1464 | 1464 | hlist_for_each_entry_safe(tb, tmp, head, tb_hlist) { |
| 1465 | 1465 | hlist_del(&tb->tb_hlist); |
| 1466 | − fib_table_flush(net, tb); | |
| 1466 | + fib_table_flush(net, tb, true); | |
| 1467 | 1467 | fib_free_table(tb); |
| 1468 | 1468 | } |
| 1469 | 1469 | } |
| @@ -1856,7 +1856,7 @@ void fib_table_flush_external(struct fib_table *tb) · 1855 unmodified lines | ||
| 1856 | 1856 | } |
| 1857 | 1857 | |
| 1858 | 1858 | /* Caller must hold RTNL. */ |
| 1859 | −int fib_table_flush(struct net *net, struct fib_table *tb) | |
| 1859 | +int fib_table_flush(struct net *net, struct fib_table *tb, bool flush_all) | |
| 1860 | 1860 | { |
| 1861 | 1861 | struct trie *t = (struct trie *)tb->tb_data; |
| 1862 | 1862 | struct key_vector *pn = t->kv; |
| @@ -1904,8 +1904,17 @@ int fib_table_flush(struct net *net, struct fib_table *tb) · 41 unmodified lines | ||
| 1904 | 1904 | hlist_for_each_entry_safe(fa, tmp, &n->leaf, fa_list) { |
| 1905 | 1905 | struct fib_info *fi = fa->fa_info; |
| 1906 | 1906 | |
| 1907 | − if (!fi || !(fi->fib_flags & RTNH_F_DEAD) || | |
| 1908 | − tb->tb_id != fa->tb_id) { | |
| 1907 | + if (!fi || tb->tb_id != fa->tb_id || | |
| 1908 | + (!(fi->fib_flags & RTNH_F_DEAD) && | |
| 1909 | + !fib_props[fa->fa_type].error)) { | |
| 1910 | + slen = fa->fa_slen; | |
| 1911 | + continue; | |
| 1912 | + } | |
| 1913 | + | |
| 1914 | + /* Do not flush error routes if network namespace is | |
| 1915 | + * not being dismantled | |
| 1916 | + */ | |
| 1917 | + if (!flush_all && fib_props[fa->fa_type].error) { | |
| 1909 | 1918 | slen = fa->fa_slen; |
| 1910 | 1919 | continue; |
| 1911 | 1920 | } |
| @@ -1020,10 +1020,11 @@ static int gue_err(struct sk_buff *skb, u32 info) · 1019 unmodified lines | ||
| 1020 | 1020 | { |
| 1021 | 1021 | int transport_offset = skb_transport_offset(skb); |
| 1022 | 1022 | struct guehdr *guehdr; |
| 1023 | − size_t optlen; | |
| 1023 | + size_t len, optlen; | |
| 1024 | 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 | 1028 | return -EINVAL; |
| 1028 | 1029 | |
| 1029 | 1030 | guehdr = (struct guehdr *)&udp_hdr(skb)[1]; |
| @@ -1058,6 +1059,10 @@ static int gue_err(struct sk_buff *skb, u32 info) · 28 unmodified lines | ||
| 1058 | 1059 | |
| 1059 | 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 | 1066 | if (validate_gue_flags(guehdr, optlen)) |
| 1062 | 1067 | return -EINVAL; |
| 1063 | 1068 | |
| @@ -569,8 +569,7 @@ err_free_skb: · 568 unmodified lines | ||
| 569 | 569 | dev->stats.tx_dropped++; |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | −static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev, | |
| 573 | − __be16 proto) | |
| 572 | +static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev) | |
| 574 | 573 | { |
| 575 | 574 | struct ip_tunnel *tunnel = netdev_priv(dev); |
| 576 | 575 | struct ip_tunnel_info *tun_info; |
| @@ -578,10 +577,10 @@ static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev, · 1 unmodified line | ||
| 578 | 577 | struct erspan_metadata *md; |
| 579 | 578 | struct rtable *rt = NULL; |
| 580 | 579 | bool truncate = false; |
| 580 | + __be16 df, proto; | |
| 581 | 581 | struct flowi4 fl; |
| 582 | 582 | int tunnel_hlen; |
| 583 | 583 | int version; |
| 584 | − __be16 df; | |
| 585 | 584 | int nhoff; |
| 586 | 585 | int thoff; |
| 587 | 586 | |
| @@ -626,18 +625,20 @@ static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev, · 38 unmodified lines | ||
| 626 | 625 | if (version == 1) { |
| 627 | 626 | erspan_build_header(skb, ntohl(tunnel_id_to_key32(key->tun_id)), |
| 628 | 627 | ntohl(md->u.index), truncate, true); |
| 628 | + proto = htons(ETH_P_ERSPAN); | |
| 629 | 629 | } else if (version == 2) { |
| 630 | 630 | erspan_build_header_v2(skb, |
| 631 | 631 | ntohl(tunnel_id_to_key32(key->tun_id)), |
| 632 | 632 | md->u.md2.dir, |
| 633 | 633 | get_hwid(&md->u.md2), |
| 634 | 634 | truncate, true); |
| 635 | + proto = htons(ETH_P_ERSPAN2); | |
| 635 | 636 | } else { |
| 636 | 637 | goto err_free_rt; |
| 637 | 638 | } |
| 638 | 639 | |
| 639 | 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 | 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, · 77 unmodified lines | ||
| 721 | 722 | { |
| 722 | 723 | struct ip_tunnel *tunnel = netdev_priv(dev); |
| 723 | 724 | bool truncate = false; |
| 725 | + __be16 proto; | |
| 724 | 726 | |
| 725 | 727 | if (!pskb_inet_may_pull(skb)) |
| 726 | 728 | goto free_skb; |
| 727 | 729 | |
| 728 | 730 | if (tunnel->collect_md) { |
| 729 | − erspan_fb_xmit(skb, dev, skb->protocol); | |
| 731 | + erspan_fb_xmit(skb, dev); | |
| 730 | 732 | return NETDEV_TX_OK; |
| 731 | 733 | } |
| 732 | 734 | |
| @@ -742,19 +744,22 @@ static netdev_tx_t erspan_xmit(struct sk_buff *skb, · 9 unmodified lines | ||
| 742 | 744 | } |
| 743 | 745 | |
| 744 | 746 | /* Push ERSPAN header */ |
| 745 | − if (tunnel->erspan_ver == 1) | |
| 747 | + if (tunnel->erspan_ver == 1) { | |
| 746 | 748 | erspan_build_header(skb, ntohl(tunnel->parms.o_key), |
| 747 | 749 | tunnel->index, |
| 748 | 750 | truncate, true); |
| 749 | − else if (tunnel->erspan_ver == 2) | |
| 751 | + proto = htons(ETH_P_ERSPAN); | |
| 752 | + } else if (tunnel->erspan_ver == 2) { | |
| 750 | 753 | erspan_build_header_v2(skb, ntohl(tunnel->parms.o_key), |
| 751 | 754 | tunnel->dir, tunnel->hwid, |
| 752 | 755 | truncate, true); |
| 753 | − else | |
| 756 | + proto = htons(ETH_P_ERSPAN2); | |
| 757 | + } else { | |
| 754 | 758 | goto free_skb; |
| 759 | + } | |
| 755 | 760 | |
| 756 | 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 | 763 | return NETDEV_TX_OK; |
| 759 | 764 | |
| 760 | 765 | free_skb: |
| @@ -488,6 +488,7 @@ static struct sk_buff *ip_rcv_core(struct sk_buff *skb, struct net *net) · 487 unmodified lines | ||
| 488 | 488 | goto drop; |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | + iph = ip_hdr(skb); | |
| 491 | 492 | skb->transport_header = skb->network_header + iph->ihl*4; |
| 492 | 493 | |
| 493 | 494 | /* Remove any debris in the socket control block */ |
| @@ -1186,7 +1186,7 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size) · 1185 unmodified lines | ||
| 1186 | 1186 | flags = msg->msg_flags; |
| 1187 | 1187 | |
| 1188 | 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 | 1190 | err = -EINVAL; |
| 1191 | 1191 | goto out_err; |
| 1192 | 1192 | } |
| @@ -847,15 +847,23 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4, · 846 unmodified lines | ||
| 847 | 847 | const int hlen = skb_network_header_len(skb) + |
| 848 | 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 | 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 | 856 | return -EINVAL; |
| 854 | − if (sk->sk_no_check_tx) | |
| 857 | + } | |
| 858 | + if (sk->sk_no_check_tx) { | |
| 859 | + kfree_skb(skb); | |
| 855 | 860 | return -EINVAL; |
| 861 | + } | |
| 856 | 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 | 865 | return -EIO; |
| 866 | + } | |
| 859 | 867 | |
| 860 | 868 | skb_shinfo(skb)->gso_size = cork->gso_size; |
| 861 | 869 | skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4; |
| @@ -1918,7 +1926,7 @@ void udp_lib_rehash(struct sock *sk, u16 newhash) · 1056 unmodified lines | ||
| 1918 | 1926 | } |
| 1919 | 1927 | EXPORT_SYMBOL(udp_lib_rehash); |
| 1920 | 1928 | |
| 1921 | −static void udp_v4_rehash(struct sock *sk) | |
| 1929 | +void udp_v4_rehash(struct sock *sk) | |
| 1922 | 1930 | { |
| 1923 | 1931 | u16 new_hash = ipv4_portaddr_hash(sock_net(sk), |
| 1924 | 1932 | inet_sk(sk)->inet_rcv_saddr, |
| @@ -10,6 +10,7 @@ int __udp4_lib_rcv(struct sk_buff *, struct udp_table *, int); · 9 unmodified lines | ||
| 10 | 10 | int __udp4_lib_err(struct sk_buff *, u32, struct udp_table *); |
| 11 | 11 | |
| 12 | 12 | int udp_v4_get_port(struct sock *sk, unsigned short snum); |
| 13 | +void udp_v4_rehash(struct sock *sk); | |
| 13 | 14 | |
| 14 | 15 | int udp_setsockopt(struct sock *sk, int level, int optname, |
| 15 | 16 | char __user *optval, unsigned int optlen); |
| @@ -53,6 +53,7 @@ struct proto udplite_prot = { · 52 unmodified lines | ||
| 53 | 53 | .sendpage = udp_sendpage, |
| 54 | 54 | .hash = udp_lib_hash, |
| 55 | 55 | .unhash = udp_lib_unhash, |
| 56 | + .rehash = udp_v4_rehash, | |
| 56 | 57 | .get_port = udp_v4_get_port, |
| 57 | 58 | .memory_allocated = &udp_memory_allocated, |
| 58 | 59 | .sysctl_mem = sysctl_udp_mem, |
| @@ -90,10 +90,11 @@ static int gue6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, · 89 unmodified lines | ||
| 90 | 90 | { |
| 91 | 91 | int transport_offset = skb_transport_offset(skb); |
| 92 | 92 | struct guehdr *guehdr; |
| 93 | − size_t optlen; | |
| 93 | + size_t len, optlen; | |
| 94 | 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 | 98 | return -EINVAL; |
| 98 | 99 | |
| 99 | 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, · 28 unmodified lines | ||
| 128 | 129 | |
| 129 | 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 | 136 | if (validate_gue_flags(guehdr, optlen)) |
| 132 | 137 | return -EINVAL; |
| 133 | 138 | |
| @@ -922,6 +922,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb, · 921 unmodified lines | ||
| 922 | 922 | __u8 dsfield = false; |
| 923 | 923 | struct flowi6 fl6; |
| 924 | 924 | int err = -EINVAL; |
| 925 | + __be16 proto; | |
| 925 | 926 | __u32 mtu; |
| 926 | 927 | int nhoff; |
| 927 | 928 | int thoff; |
| @@ -1035,8 +1036,9 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb, · 107 unmodified lines | ||
| 1035 | 1036 | } |
| 1036 | 1037 | |
| 1037 | 1038 | /* Push GRE header. */ |
| 1038 | − gre_build_header(skb, 8, TUNNEL_SEQ, | |
| 1039 | − htons(ETH_P_ERSPAN), 0, htonl(t->o_seqno++)); | |
| 1039 | + proto = (t->parms.erspan_ver == 1) ? htons(ETH_P_ERSPAN) | |
| 1040 | + : htons(ETH_P_ERSPAN2); | |
| 1041 | + gre_build_header(skb, 8, TUNNEL_SEQ, proto, 0, htonl(t->o_seqno++)); | |
| 1040 | 1042 | |
| 1041 | 1043 | /* TooBig packet may have updated dst->dev's mtu */ |
| 1042 | 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, · 126 unmodified lines | ||
| 1169 | 1171 | t->parms.i_flags = p->i_flags; |
| 1170 | 1172 | t->parms.o_flags = p->o_flags; |
| 1171 | 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 | 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[], · 850 unmodified lines | ||
| 2025 | 2031 | struct nlattr *data[], |
| 2026 | 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 | 2036 | struct __ip6_tnl_parm p; |
| 2030 | − struct ip6_tnl *t; | |
| 2031 | 2037 | |
| 2032 | 2038 | t = ip6gre_changelink_common(dev, tb, data, &p, extack); |
| 2033 | 2039 | if (IS_ERR(t)) |
| @@ -4251,17 +4251,6 @@ struct rt6_nh { · 4250 unmodified lines | ||
| 4251 | 4251 | struct list_head next; |
| 4252 | 4252 | }; |
| 4253 | 4253 | |
| 4254 | −static void ip6_print_replace_route_err(struct list_head *rt6_nh_list) | |
| 4255 | −{ | |
| 4256 | − struct rt6_nh *nh; | |
| 4257 | − | |
| 4258 | − list_for_each_entry(nh, rt6_nh_list, next) { | |
| 4259 | − pr_warn("IPV6: multipath route replace failed (check consistency of installed routes): %pI6c nexthop %pI6c ifi %d\n", | |
| 4260 | − &nh->r_cfg.fc_dst, &nh->r_cfg.fc_gateway, | |
| 4261 | − nh->r_cfg.fc_ifindex); | |
| 4262 | − } | |
| 4263 | −} | |
| 4264 | − | |
| 4265 | 4254 | static int ip6_route_info_append(struct net *net, |
| 4266 | 4255 | struct list_head *rt6_nh_list, |
| 4267 | 4256 | struct fib6_info *rt, |
| @@ -4407,7 +4396,8 @@ static int ip6_route_multipath_add(struct fib6_config *cfg, · 139 unmodified lines | ||
| 4407 | 4396 | nh->fib6_info = NULL; |
| 4408 | 4397 | if (err) { |
| 4409 | 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 | 4401 | err_nh = nh; |
| 4412 | 4402 | goto add_errout; |
| 4413 | 4403 | } |
| @@ -102,7 +102,7 @@ int udp_v6_get_port(struct sock *sk, unsigned short snum) · 101 unmodified lines | ||
| 102 | 102 | return udp_lib_get_port(sk, snum, hash2_nulladdr); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | −static void udp_v6_rehash(struct sock *sk) | |
| 105 | +void udp_v6_rehash(struct sock *sk) | |
| 106 | 106 | { |
| 107 | 107 | u16 new_hash = ipv6_portaddr_hash(sock_net(sk), |
| 108 | 108 | &sk->sk_v6_rcv_saddr, |
| @@ -1132,15 +1132,23 @@ static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6, · 1023 unmodified lines | ||
| 1132 | 1132 | const int hlen = skb_network_header_len(skb) + |
| 1133 | 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 | 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 | 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 | 1145 | return -EINVAL; |
| 1146 | + } | |
| 1141 | 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 | 1150 | return -EIO; |
| 1151 | + } | |
| 1144 | 1152 | |
| 1145 | 1153 | skb_shinfo(skb)->gso_size = cork->gso_size; |
| 1146 | 1154 | skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4; |
| @@ -13,6 +13,7 @@ int __udp6_lib_err(struct sk_buff *, struct inet6_skb_parm *, u8, u8, int, · 12 unmodified lines | ||
| 13 | 13 | __be32, struct udp_table *); |
| 14 | 14 | |
| 15 | 15 | int udp_v6_get_port(struct sock *sk, unsigned short snum); |
| 16 | +void udp_v6_rehash(struct sock *sk); | |
| 16 | 17 | |
| 17 | 18 | int udpv6_getsockopt(struct sock *sk, int level, int optname, |
| 18 | 19 | char __user *optval, int __user *optlen); |
| @@ -49,6 +49,7 @@ struct proto udplitev6_prot = { · 48 unmodified lines | ||
| 49 | 49 | .recvmsg = udpv6_recvmsg, |
| 50 | 50 | .hash = udp_lib_hash, |
| 51 | 51 | .unhash = udp_lib_unhash, |
| 52 | + .rehash = udp_v6_rehash, | |
| 52 | 53 | .get_port = udp_v6_get_port, |
| 53 | 54 | .memory_allocated = &udp_memory_allocated, |
| 54 | 55 | .sysctl_mem = sysctl_udp_mem, |
| @@ -28,6 +28,7 @@ flow_offload_fill_dir(struct flow_offload *flow, struct nf_conn *ct, · 27 unmodified lines | ||
| 28 | 28 | { |
| 29 | 29 | struct flow_offload_tuple *ft = &flow->tuplehash[dir].tuple; |
| 30 | 30 | struct nf_conntrack_tuple *ctt = &ct->tuplehash[dir].tuple; |
| 31 | + struct dst_entry *other_dst = route->tuple[!dir].dst; | |
| 31 | 32 | struct dst_entry *dst = route->tuple[dir].dst; |
| 32 | 33 | |
| 33 | 34 | ft->dir = dir; |
| @@ -50,8 +51,8 @@ flow_offload_fill_dir(struct flow_offload *flow, struct nf_conn *ct, · 16 unmodified lines | ||
| 50 | 51 | ft->src_port = ctt->src.u.tcp.port; |
| 51 | 52 | ft->dst_port = ctt->dst.u.tcp.port; |
| 52 | 53 | |
| 53 | − ft->iifidx = route->tuple[dir].ifindex; | |
| 54 | − ft->oifidx = route->tuple[!dir].ifindex; | |
| 54 | + ft->iifidx = other_dst->dev->ifindex; | |
| 55 | + ft->oifidx = dst->dev->ifindex; | |
| 55 | 56 | ft->dst_cache = dst; |
| 56 | 57 | } |
| 57 | 58 | |
| @@ -2304,7 +2304,6 @@ static int __nf_tables_dump_rules(struct sk_buff *skb, · 2303 unmodified lines | ||
| 2304 | 2304 | struct net *net = sock_net(skb->sk); |
| 2305 | 2305 | unsigned int s_idx = cb->args[0]; |
| 2306 | 2306 | const struct nft_rule *rule; |
| 2307 | − int rc = 1; | |
| 2308 | 2307 | |
| 2309 | 2308 | list_for_each_entry_rcu(rule, &chain->rules, list) { |
| 2310 | 2309 | if (!nft_is_active(net, rule)) |
| @@ -2321,16 +2320,13 @@ static int __nf_tables_dump_rules(struct sk_buff *skb, · 10 unmodified lines | ||
| 2321 | 2320 | NLM_F_MULTI | NLM_F_APPEND, |
| 2322 | 2321 | table->family, |
| 2323 | 2322 | table, chain, rule) < 0) |
| 2324 | − goto out_unfinished; | |
| 2323 | + return 1; | |
| 2325 | 2324 | |
| 2326 | 2325 | nl_dump_check_consistent(cb, nlmsg_hdr(skb)); |
| 2327 | 2326 | cont: |
| 2328 | 2327 | (*idx)++; |
| 2329 | 2328 | } |
| 2330 | − rc = 0; | |
| 2331 | −out_unfinished: | |
| 2332 | − cb->args[0] = *idx; | |
| 2333 | − return rc; | |
| 2329 | + return 0; | |
| 2334 | 2330 | } |
| 2335 | 2331 | |
| 2336 | 2332 | static int nf_tables_dump_rules(struct sk_buff *skb, |
| @@ -2354,7 +2350,7 @@ static int nf_tables_dump_rules(struct sk_buff *skb, · 17 unmodified lines | ||
| 2354 | 2350 | if (ctx && ctx->table && strcmp(ctx->table, table->name) != 0) |
| 2355 | 2351 | continue; |
| 2356 | 2352 | |
| 2357 | − if (ctx && ctx->chain) { | |
| 2353 | + if (ctx && ctx->table && ctx->chain) { | |
| 2358 | 2354 | struct rhlist_head *list, *tmp; |
| 2359 | 2355 | |
| 2360 | 2356 | list = rhltable_lookup(&table->chains_ht, ctx->chain, |
| @@ -2382,6 +2378,8 @@ static int nf_tables_dump_rules(struct sk_buff *skb, · 21 unmodified lines | ||
| 2382 | 2378 | } |
| 2383 | 2379 | done: |
| 2384 | 2380 | rcu_read_unlock(); |
| 2381 | + | |
| 2382 | + cb->args[0] = idx; | |
| 2385 | 2383 | return skb->len; |
| 2386 | 2384 | } |
| 2387 | 2385 | |
| @@ -4508,6 +4506,8 @@ err6: · 2120 unmodified lines | ||
| 4508 | 4506 | err5: |
| 4509 | 4507 | kfree(trans); |
| 4510 | 4508 | err4: |
| 4509 | + if (obj) | |
| 4510 | + obj->use--; | |
| 4511 | 4511 | kfree(elem.priv); |
| 4512 | 4512 | err3: |
| 4513 | 4513 | if (nla[NFTA_SET_ELEM_DATA] != NULL) |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <net/netfilter/nf_conntrack_core.h> |
| 13 | 13 | #include <linux/netfilter/nf_conntrack_common.h> |
| 14 | 14 | #include <net/netfilter/nf_flow_table.h> |
| 15 | +#include <net/netfilter/nf_conntrack_helper.h> | |
| 15 | 16 | |
| 16 | 17 | struct nft_flow_offload { |
| 17 | 18 | struct nft_flowtable *flowtable; |
| @@ -29,10 +30,12 @@ static int nft_flow_route(const struct nft_pktinfo *pkt, · 11 unmodified lines | ||
| 29 | 30 | memset(&fl, 0, sizeof(fl)); |
| 30 | 31 | switch (nft_pf(pkt)) { |
| 31 | 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 | 35 | break; |
| 34 | 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 | 39 | break; |
| 37 | 40 | } |
| 38 | 41 | |
| @@ -41,9 +44,7 @@ static int nft_flow_route(const struct nft_pktinfo *pkt, · 2 unmodified lines | ||
| 41 | 44 | return -ENOENT; |
| 42 | 45 | |
| 43 | 46 | route->tuple[dir].dst = this_dst; |
| 44 | − route->tuple[dir].ifindex = nft_in(pkt)->ifindex; | |
| 45 | 47 | route->tuple[!dir].dst = other_dst; |
| 46 | − route->tuple[!dir].ifindex = nft_out(pkt)->ifindex; | |
| 47 | 48 | |
| 48 | 49 | return 0; |
| 49 | 50 | } |
| @@ -66,6 +67,7 @@ static void nft_flow_offload_eval(const struct nft_expr *expr, · 16 unmodified lines | ||
| 66 | 67 | { |
| 67 | 68 | struct nft_flow_offload *priv = nft_expr_priv(expr); |
| 68 | 69 | struct nf_flowtable *flowtable = &priv->flowtable->data; |
| 70 | + const struct nf_conn_help *help; | |
| 69 | 71 | enum ip_conntrack_info ctinfo; |
| 70 | 72 | struct nf_flow_route route; |
| 71 | 73 | struct flow_offload *flow; |
| @@ -88,7 +90,8 @@ static void nft_flow_offload_eval(const struct nft_expr *expr, · 16 unmodified lines | ||
| 88 | 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 | 95 | goto out; |
| 93 | 96 | |
| 94 | 97 | if (ctinfo == IP_CT_NEW || |
| @@ -500,7 +500,7 @@ static int __parse_flow_nlattrs(const struct nlattr *attr, · 499 unmodified lines | ||
| 500 | 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 | 504 | attrs |= 1 << type; |
| 505 | 505 | a[type] = nla; |
| 506 | 506 | } |
| @@ -2887,7 +2887,8 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) · 2886 unmodified lines | ||
| 2887 | 2887 | goto out_free; |
| 2888 | 2888 | } else if (reserve) { |
| 2889 | 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 | 2892 | skb_reset_network_header(skb); |
| 2892 | 2893 | } |
| 2893 | 2894 | |
| @@ -418,76 +418,6 @@ u32 rxrpc_kernel_get_epoch(struct socket *sock, struct rxrpc_call *call) · 417 unmodified lines | ||
| 418 | 418 | } |
| 419 | 419 | EXPORT_SYMBOL(rxrpc_kernel_get_epoch); |
| 420 | 420 | |
| 421 | −/** | |
| 422 | − * rxrpc_kernel_check_call - Check a call's state | |
| 423 | − * @sock: The socket the call is on | |
| 424 | − * @call: The call to check | |
| 425 | − * @_compl: Where to store the completion state | |
| 426 | − * @_abort_code: Where to store any abort code | |
| 427 | − * | |
| 428 | − * Allow a kernel service to query the state of a call and find out the manner | |
| 429 | − * of its termination if it has completed. Returns -EINPROGRESS if the call is | |
| 430 | − * still going, 0 if the call finished successfully, -ECONNABORTED if the call | |
| 431 | − * was aborted and an appropriate error if the call failed in some other way. | |
| 432 | − */ | |
| 433 | −int rxrpc_kernel_check_call(struct socket *sock, struct rxrpc_call *call, | |
| 434 | − enum rxrpc_call_completion *_compl, u32 *_abort_code) | |
| 435 | −{ | |
| 436 | − if (call->state != RXRPC_CALL_COMPLETE) | |
| 437 | − return -EINPROGRESS; | |
| 438 | − smp_rmb(); | |
| 439 | − *_compl = call->completion; | |
| 440 | − *_abort_code = call->abort_code; | |
| 441 | − return call->error; | |
| 442 | −} | |
| 443 | −EXPORT_SYMBOL(rxrpc_kernel_check_call); | |
| 444 | − | |
| 445 | −/** | |
| 446 | − * rxrpc_kernel_retry_call - Allow a kernel service to retry a call | |
| 447 | − * @sock: The socket the call is on | |
| 448 | − * @call: The call to retry | |
| 449 | − * @srx: The address of the peer to contact | |
| 450 | − * @key: The security context to use (defaults to socket setting) | |
| 451 | − * | |
| 452 | − * Allow a kernel service to try resending a client call that failed due to a | |
| 453 | − * network error to a new address. The Tx queue is maintained intact, thereby | |
| 454 | − * relieving the need to re-encrypt any request data that has already been | |
| 455 | − * buffered. | |
| 456 | − */ | |
| 457 | −int rxrpc_kernel_retry_call(struct socket *sock, struct rxrpc_call *call, | |
| 458 | − struct sockaddr_rxrpc *srx, struct key *key) | |
| 459 | −{ | |
| 460 | − struct rxrpc_conn_parameters cp; | |
| 461 | − struct rxrpc_sock *rx = rxrpc_sk(sock->sk); | |
| 462 | − int ret; | |
| 463 | − | |
| 464 | − _enter("%d{%d}", call->debug_id, atomic_read(&call->usage)); | |
| 465 | − | |
| 466 | − if (!key) | |
| 467 | − key = rx->key; | |
| 468 | − if (key && !key->payload.data[0]) | |
| 469 | − key = NULL; /* a no-security key */ | |
| 470 | − | |
| 471 | − memset(&cp, 0, sizeof(cp)); | |
| 472 | − cp.local = rx->local; | |
| 473 | − cp.key = key; | |
| 474 | − cp.security_level = 0; | |
| 475 | − cp.exclusive = false; | |
| 476 | − cp.service_id = srx->srx_service; | |
| 477 | − | |
| 478 | − mutex_lock(&call->user_mutex); | |
| 479 | − | |
| 480 | − ret = rxrpc_prepare_call_for_retry(rx, call); | |
| 481 | − if (ret == 0) | |
| 482 | − ret = rxrpc_retry_client_call(rx, call, &cp, srx, GFP_KERNEL); | |
| 483 | − | |
| 484 | − mutex_unlock(&call->user_mutex); | |
| 485 | − rxrpc_put_peer(cp.peer); | |
| 486 | − _leave(" = %d", ret); | |
| 487 | − return ret; | |
| 488 | −} | |
| 489 | −EXPORT_SYMBOL(rxrpc_kernel_retry_call); | |
| 490 | − | |
| 491 | 421 | /** |
| 492 | 422 | * rxrpc_kernel_new_call_notification - Get notifications of new calls |
| 493 | 423 | * @sock: The socket to intercept received messages on |
| @@ -476,7 +476,6 @@ enum rxrpc_call_flag { · 475 unmodified lines | ||
| 476 | 476 | RXRPC_CALL_EXPOSED, /* The call was exposed to the world */ |
| 477 | 477 | RXRPC_CALL_RX_LAST, /* Received the last packet (at rxtx_top) */ |
| 478 | 478 | RXRPC_CALL_TX_LAST, /* Last packet in Tx buffer (at rxtx_top) */ |
| 479 | − RXRPC_CALL_TX_LASTQ, /* Last packet has been queued */ | |
| 480 | 479 | RXRPC_CALL_SEND_PING, /* A ping will need to be sent */ |
| 481 | 480 | RXRPC_CALL_PINGING, /* Ping in process */ |
| 482 | 481 | RXRPC_CALL_RETRANS_TIMEOUT, /* Retransmission due to timeout occurred */ |
| @@ -517,6 +516,18 @@ enum rxrpc_call_state { · 34 unmodified lines | ||
| 517 | 516 | NR__RXRPC_CALL_STATES |
| 518 | 517 | }; |
| 519 | 518 | |
| 519 | +/* | |
| 520 | + * Call completion condition (state == RXRPC_CALL_COMPLETE). | |
| 521 | + */ | |
| 522 | +enum rxrpc_call_completion { | |
| 523 | + RXRPC_CALL_SUCCEEDED, /* - Normal termination */ | |
| 524 | + RXRPC_CALL_REMOTELY_ABORTED, /* - call aborted by peer */ | |
| 525 | + RXRPC_CALL_LOCALLY_ABORTED, /* - call aborted locally on error or close */ | |
| 526 | + RXRPC_CALL_LOCAL_ERROR, /* - call failed due to local error */ | |
| 527 | + RXRPC_CALL_NETWORK_ERROR, /* - call terminated by network error */ | |
| 528 | + NR__RXRPC_CALL_COMPLETIONS | |
| 529 | +}; | |
| 530 | + | |
| 520 | 531 | /* |
| 521 | 532 | * Call Tx congestion management modes. |
| 522 | 533 | */ |
| @@ -761,15 +772,9 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *, · 238 unmodified lines | ||
| 761 | 772 | struct sockaddr_rxrpc *, |
| 762 | 773 | struct rxrpc_call_params *, gfp_t, |
| 763 | 774 | unsigned int); |
| 764 | −int rxrpc_retry_client_call(struct rxrpc_sock *, | |
| 765 | − struct rxrpc_call *, | |
| 766 | − struct rxrpc_conn_parameters *, | |
| 767 | − struct sockaddr_rxrpc *, | |
| 768 | − gfp_t); | |
| 769 | 775 | void rxrpc_incoming_call(struct rxrpc_sock *, struct rxrpc_call *, |
| 770 | 776 | struct sk_buff *); |
| 771 | 777 | void rxrpc_release_call(struct rxrpc_sock *, struct rxrpc_call *); |
| 772 | −int rxrpc_prepare_call_for_retry(struct rxrpc_sock *, struct rxrpc_call *); | |
| 773 | 778 | void rxrpc_release_calls_on_socket(struct rxrpc_sock *); |
| 774 | 779 | bool __rxrpc_queue_call(struct rxrpc_call *); |
| 775 | 780 | bool rxrpc_queue_call(struct rxrpc_call *); |
| @@ -324,48 +324,6 @@ error: · 323 unmodified lines | ||
| 324 | 324 | return ERR_PTR(ret); |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | −/* | |
| 328 | − * Retry a call to a new address. It is expected that the Tx queue of the call | |
| 329 | − * will contain data previously packaged for an old call. | |
| 330 | − */ | |
| 331 | −int rxrpc_retry_client_call(struct rxrpc_sock *rx, | |
| 332 | − struct rxrpc_call *call, | |
| 333 | − struct rxrpc_conn_parameters *cp, | |
| 334 | − struct sockaddr_rxrpc *srx, | |
| 335 | − gfp_t gfp) | |
| 336 | −{ | |
| 337 | − const void *here = __builtin_return_address(0); | |
| 338 | − int ret; | |
| 339 | − | |
| 340 | − /* Set up or get a connection record and set the protocol parameters, | |
| 341 | − * including channel number and call ID. | |
| 342 | − */ | |
| 343 | − ret = rxrpc_connect_call(rx, call, cp, srx, gfp); | |
| 344 | − if (ret < 0) | |
| 345 | − goto error; | |
| 346 | − | |
| 347 | − trace_rxrpc_call(call, rxrpc_call_connected, atomic_read(&call->usage), | |
| 348 | − here, NULL); | |
| 349 | − | |
| 350 | − rxrpc_start_call_timer(call); | |
| 351 | − | |
| 352 | − _net("CALL new %d on CONN %d", call->debug_id, call->conn->debug_id); | |
| 353 | − | |
| 354 | − if (!test_and_set_bit(RXRPC_CALL_EV_RESEND, &call->events)) | |
| 355 | − rxrpc_queue_call(call); | |
| 356 | − | |
| 357 | − _leave(" = 0"); | |
| 358 | − return 0; | |
| 359 | − | |
| 360 | −error: | |
| 361 | − rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR, | |
| 362 | − RX_CALL_DEAD, ret); | |
| 363 | − trace_rxrpc_call(call, rxrpc_call_error, atomic_read(&call->usage), | |
| 364 | − here, ERR_PTR(ret)); | |
| 365 | − _leave(" = %d", ret); | |
| 366 | − return ret; | |
| 367 | −} | |
| 368 | − | |
| 369 | 327 | /* |
| 370 | 328 | * Set up an incoming call. call->conn points to the connection. |
| 371 | 329 | * This is called in BH context and isn't allowed to fail. |
| @@ -533,61 +491,6 @@ void rxrpc_release_call(struct rxrpc_sock *rx, struct rxrpc_call *call) · 161 unmodified lines | ||
| 533 | 491 | _leave(""); |
| 534 | 492 | } |
| 535 | 493 | |
| 536 | −/* | |
| 537 | − * Prepare a kernel service call for retry. | |
| 538 | − */ | |
| 539 | −int rxrpc_prepare_call_for_retry(struct rxrpc_sock *rx, struct rxrpc_call *call) | |
| 540 | −{ | |
| 541 | − const void *here = __builtin_return_address(0); | |
| 542 | − int i; | |
| 543 | − u8 last = 0; | |
| 544 | − | |
| 545 | − _enter("{%d,%d}", call->debug_id, atomic_read(&call->usage)); | |
| 546 | − | |
| 547 | − trace_rxrpc_call(call, rxrpc_call_release, atomic_read(&call->usage), | |
| 548 | − here, (const void *)call->flags); | |
| 549 | − | |
| 550 | − ASSERTCMP(call->state, ==, RXRPC_CALL_COMPLETE); | |
| 551 | − ASSERTCMP(call->completion, !=, RXRPC_CALL_REMOTELY_ABORTED); | |
| 552 | − ASSERTCMP(call->completion, !=, RXRPC_CALL_LOCALLY_ABORTED); | |
| 553 | − ASSERT(list_empty(&call->recvmsg_link)); | |
| 554 | − | |
| 555 | − del_timer_sync(&call->timer); | |
| 556 | − | |
| 557 | − _debug("RELEASE CALL %p (%d CONN %p)", call, call->debug_id, call->conn); | |
| 558 | − | |
| 559 | − if (call->conn) | |
| 560 | − rxrpc_disconnect_call(call); | |
| 561 | − | |
| 562 | − if (rxrpc_is_service_call(call) || | |
| 563 | − !call->tx_phase || | |
| 564 | − call->tx_hard_ack != 0 || | |
| 565 | − call->rx_hard_ack != 0 || | |
| 566 | − call->rx_top != 0) | |
| 567 | − return -EINVAL; | |
| 568 | − | |
| 569 | − call->state = RXRPC_CALL_UNINITIALISED; | |
| 570 | − call->completion = RXRPC_CALL_SUCCEEDED; | |
| 571 | − call->call_id = 0; | |
| 572 | − call->cid = 0; | |
| 573 | − call->cong_cwnd = 0; | |
| 574 | − call->cong_extra = 0; | |
| 575 | − call->cong_ssthresh = 0; | |
| 576 | − call->cong_mode = 0; | |
| 577 | − call->cong_dup_acks = 0; | |
| 578 | − call->cong_cumul_acks = 0; | |
| 579 | − call->acks_lowest_nak = 0; | |
| 580 | − | |
| 581 | − for (i = 0; i < RXRPC_RXTX_BUFF_SIZE; i++) { | |
| 582 | − last |= call->rxtx_annotations[i]; | |
| 583 | − call->rxtx_annotations[i] &= RXRPC_TX_ANNO_LAST; | |
| 584 | − call->rxtx_annotations[i] |= RXRPC_TX_ANNO_RETRANS; | |
| 585 | − } | |
| 586 | − | |
| 587 | − _leave(" = 0"); | |
| 588 | − return 0; | |
| 589 | −} | |
| 590 | − | |
| 591 | 494 | /* |
| 592 | 495 | * release all the calls associated with a socket |
| 593 | 496 | */ |
| @@ -562,10 +562,7 @@ static void rxrpc_activate_one_channel(struct rxrpc_connection *conn, · 561 unmodified lines | ||
| 562 | 562 | clear_bit(RXRPC_CONN_FINAL_ACK_0 + channel, &conn->flags); |
| 563 | 563 | |
| 564 | 564 | write_lock_bh(&call->state_lock); |
| 565 | − if (!test_bit(RXRPC_CALL_TX_LASTQ, &call->flags)) | |
| 566 | − call->state = RXRPC_CALL_CLIENT_SEND_REQUEST; | |
| 567 | − else | |
| 568 | − call->state = RXRPC_CALL_CLIENT_AWAIT_REPLY; | |
| 565 | + call->state = RXRPC_CALL_CLIENT_SEND_REQUEST; | |
| 569 | 566 | write_unlock_bh(&call->state_lock); |
| 570 | 567 | |
| 571 | 568 | rxrpc_see_call(call); |
| @@ -169,10 +169,8 @@ static void rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call, · 168 unmodified lines | ||
| 169 | 169 | |
| 170 | 170 | ASSERTCMP(seq, ==, call->tx_top + 1); |
| 171 | 171 | |
| 172 | − if (last) { | |
| 172 | + if (last) | |
| 173 | 173 | annotation |= RXRPC_TX_ANNO_LAST; |
| 174 | − set_bit(RXRPC_CALL_TX_LASTQ, &call->flags); | |
| 175 | − } | |
| 176 | 174 | |
| 177 | 175 | /* We have to set the timestamp before queueing as the retransmit |
| 178 | 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, · 207 unmodified lines | ||
| 386 | 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 | 392 | /* add the packet to the send queue if it's now full */ |
| 390 | 393 | if (sp->remain <= 0 || |
| 391 | 394 | (msg_data_left(msg) == 0 && !more)) { |
| @@ -425,16 +428,6 @@ static int rxrpc_send_data(struct rxrpc_sock *rx, · 33 unmodified lines | ||
| 425 | 428 | notify_end_tx); |
| 426 | 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 | 431 | } while (msg_data_left(msg) > 0); |
| 439 | 432 | |
| 440 | 433 | success: |
| @@ -444,6 +437,11 @@ out: · 3 unmodified lines | ||
| 444 | 437 | _leave(" = %d", ret); |
| 445 | 438 | return ret; |
| 446 | 439 | |
| 440 | +call_terminated: | |
| 441 | + rxrpc_free_skb(skb, rxrpc_skb_tx_freed); | |
| 442 | + _leave(" = %d", call->error); | |
| 443 | + return call->error; | |
| 444 | + | |
| 447 | 445 | maybe_error: |
| 448 | 446 | if (copied) |
| 449 | 447 | goto success; |
| @@ -197,6 +197,15 @@ static const struct nla_policy tunnel_key_policy[TCA_TUNNEL_KEY_MAX + 1] = { · 196 unmodified lines | ||
| 197 | 197 | [TCA_TUNNEL_KEY_ENC_TTL] = { .type = NLA_U8 }, |
| 198 | 198 | }; |
| 199 | 199 | |
| 200 | +static void tunnel_key_release_params(struct tcf_tunnel_key_params *p) | |
| 201 | +{ | |
| 202 | + if (!p) | |
| 203 | + return; | |
| 204 | + if (p->tcft_action == TCA_TUNNEL_KEY_ACT_SET) | |
| 205 | + dst_release(&p->tcft_enc_metadata->dst); | |
| 206 | + kfree_rcu(p, rcu); | |
| 207 | +} | |
| 208 | + | |
| 200 | 209 | static int tunnel_key_init(struct net *net, struct nlattr *nla, |
| 201 | 210 | struct nlattr *est, struct tc_action **a, |
| 202 | 211 | int ovr, int bind, bool rtnl_held, |
| @@ -360,8 +369,7 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla, · 157 unmodified lines | ||
| 360 | 369 | rcu_swap_protected(t->params, params_new, |
| 361 | 370 | lockdep_is_held(&t->tcf_lock)); |
| 362 | 371 | spin_unlock_bh(&t->tcf_lock); |
| 363 | − if (params_new) | |
| 364 | − kfree_rcu(params_new, rcu); | |
| 372 | + tunnel_key_release_params(params_new); | |
| 365 | 373 | |
| 366 | 374 | if (ret == ACT_P_CREATED) |
| 367 | 375 | tcf_idr_insert(tn, *a); |
| @@ -385,12 +393,7 @@ static void tunnel_key_release(struct tc_action *a) · 17 unmodified lines | ||
| 385 | 393 | struct tcf_tunnel_key_params *params; |
| 386 | 394 | |
| 387 | 395 | params = rcu_dereference_protected(t->params, 1); |
| 388 | − if (params) { | |
| 389 | − if (params->tcft_action == TCA_TUNNEL_KEY_ACT_SET) | |
| 390 | − dst_release(¶ms->tcft_enc_metadata->dst); | |
| 391 | − | |
| 392 | − kfree_rcu(params, rcu); | |
| 393 | − } | |
| 396 | + tunnel_key_release_params(params); | |
| 394 | 397 | } |
| 395 | 398 | |
| 396 | 399 | static int tunnel_key_geneve_opts_dump(struct sk_buff *skb, |
| @@ -1277,7 +1277,6 @@ EXPORT_SYMBOL(tcf_block_cb_unregister); · 1276 unmodified lines | ||
| 1277 | 1277 | int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp, |
| 1278 | 1278 | struct tcf_result *res, bool compat_mode) |
| 1279 | 1279 | { |
| 1280 | − __be16 protocol = tc_skb_protocol(skb); | |
| 1281 | 1280 | #ifdef CONFIG_NET_CLS_ACT |
| 1282 | 1281 | const int max_reclassify_loop = 4; |
| 1283 | 1282 | const struct tcf_proto *orig_tp = tp; |
| @@ -1287,6 +1286,7 @@ int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp, · 3 unmodified lines | ||
| 1287 | 1286 | reclassify: |
| 1288 | 1287 | #endif |
| 1289 | 1288 | for (; tp; tp = rcu_dereference_bh(tp->next)) { |
| 1289 | + __be16 protocol = tc_skb_protocol(skb); | |
| 1290 | 1290 | int err; |
| 1291 | 1291 | |
| 1292 | 1292 | if (tp->protocol != protocol && |
| @@ -1319,7 +1319,6 @@ reset: · 26 unmodified lines | ||
| 1319 | 1319 | } |
| 1320 | 1320 | |
| 1321 | 1321 | tp = first_tp; |
| 1322 | − protocol = tc_skb_protocol(skb); | |
| 1323 | 1322 | goto reclassify; |
| 1324 | 1323 | #endif |
| 1325 | 1324 | } |
| @@ -1290,17 +1290,23 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, · 1289 unmodified lines | ||
| 1290 | 1290 | struct cls_fl_head *head = rtnl_dereference(tp->root); |
| 1291 | 1291 | struct cls_fl_filter *fold = *arg; |
| 1292 | 1292 | struct cls_fl_filter *fnew; |
| 1293 | + struct fl_flow_mask *mask; | |
| 1293 | 1294 | struct nlattr **tb; |
| 1294 | − struct fl_flow_mask mask = {}; | |
| 1295 | 1295 | int err; |
| 1296 | 1296 | |
| 1297 | 1297 | if (!tca[TCA_OPTIONS]) |
| 1298 | 1298 | return -EINVAL; |
| 1299 | 1299 | |
| 1300 | − tb = kcalloc(TCA_FLOWER_MAX + 1, sizeof(struct nlattr *), GFP_KERNEL); | |
| 1301 | − if (!tb) | |
| 1300 | + mask = kzalloc(sizeof(struct fl_flow_mask), GFP_KERNEL); | |
| 1301 | + if (!mask) | |
| 1302 | 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 | 1310 | err = nla_parse_nested(tb, TCA_FLOWER_MAX, tca[TCA_OPTIONS], |
| 1305 | 1311 | fl_policy, NULL); |
| 1306 | 1312 | if (err < 0) |
| @@ -1343,12 +1349,12 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, · 36 unmodified lines | ||
| 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 | 1353 | tp->chain->tmplt_priv, extack); |
| 1348 | 1354 | if (err) |
| 1349 | 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 | 1358 | if (err) |
| 1353 | 1359 | goto errout_idr; |
| 1354 | 1360 | |
| @@ -1392,6 +1398,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, · 37 unmodified lines | ||
| 1392 | 1398 | } |
| 1393 | 1399 | |
| 1394 | 1400 | kfree(tb); |
| 1401 | + kfree(mask); | |
| 1395 | 1402 | return 0; |
| 1396 | 1403 | |
| 1397 | 1404 | errout_mask: |
| @@ -1405,6 +1412,8 @@ errout: · 7 unmodified lines | ||
| 1405 | 1412 | kfree(fnew); |
| 1406 | 1413 | errout_tb: |
| 1407 | 1414 | kfree(tb); |
| 1415 | +errout_mask_alloc: | |
| 1416 | + kfree(mask); | |
| 1408 | 1417 | return err; |
| 1409 | 1418 | } |
| 1410 | 1419 | |
| @@ -1667,7 +1667,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 1666 unmodified lines | ||
| 1667 | 1667 | if (skb_is_gso(skb) && q->rate_flags & CAKE_FLAG_SPLIT_GSO) { |
| 1668 | 1668 | struct sk_buff *segs, *nskb; |
| 1669 | 1669 | netdev_features_t features = netif_skb_features(skb); |
| 1670 | − unsigned int slen = 0; | |
| 1670 | + unsigned int slen = 0, numsegs = 0; | |
| 1671 | 1671 | |
| 1672 | 1672 | segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK); |
| 1673 | 1673 | if (IS_ERR_OR_NULL(segs)) |
| @@ -1683,6 +1683,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 9 unmodified lines | ||
| 1683 | 1683 | flow_queue_add(flow, segs); |
| 1684 | 1684 | |
| 1685 | 1685 | sch->q.qlen++; |
| 1686 | + numsegs++; | |
| 1686 | 1687 | slen += segs->len; |
| 1687 | 1688 | q->buffer_used += segs->truesize; |
| 1688 | 1689 | b->packets++; |
| @@ -1696,7 +1697,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 7 unmodified lines | ||
| 1696 | 1697 | sch->qstats.backlog += slen; |
| 1697 | 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 | 1701 | consume_skb(skb); |
| 1701 | 1702 | } else { |
| 1702 | 1703 | /* not splitting */ |
| @@ -88,13 +88,14 @@ static int cbs_child_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 87 unmodified lines | ||
| 88 | 88 | struct Qdisc *child, |
| 89 | 89 | struct sk_buff **to_free) |
| 90 | 90 | { |
| 91 | + unsigned int len = qdisc_pkt_len(skb); | |
| 91 | 92 | int err; |
| 92 | 93 | |
| 93 | 94 | err = child->ops->enqueue(skb, child, to_free); |
| 94 | 95 | if (err != NET_XMIT_SUCCESS) |
| 95 | 96 | return err; |
| 96 | 97 | |
| 97 | − qdisc_qstats_backlog_inc(sch, skb); | |
| 98 | + sch->qstats.backlog += len; | |
| 98 | 99 | sch->q.qlen++; |
| 99 | 100 | |
| 100 | 101 | return NET_XMIT_SUCCESS; |
| @@ -350,9 +350,11 @@ static struct drr_class *drr_classify(struct sk_buff *skb, struct Qdisc *sch, · 349 unmodified lines | ||
| 350 | 350 | static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
| 351 | 351 | struct sk_buff **to_free) |
| 352 | 352 | { |
| 353 | + unsigned int len = qdisc_pkt_len(skb); | |
| 353 | 354 | struct drr_sched *q = qdisc_priv(sch); |
| 354 | 355 | struct drr_class *cl; |
| 355 | 356 | int err = 0; |
| 357 | + bool first; | |
| 356 | 358 | |
| 357 | 359 | cl = drr_classify(skb, sch, &err); |
| 358 | 360 | if (cl == NULL) { |
| @@ -362,6 +364,7 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 3 unmodified lines | ||
| 362 | 364 | return err; |
| 363 | 365 | } |
| 364 | 366 | |
| 367 | + first = !cl->qdisc->q.qlen; | |
| 365 | 368 | err = qdisc_enqueue(skb, cl->qdisc, to_free); |
| 366 | 369 | if (unlikely(err != NET_XMIT_SUCCESS)) { |
| 367 | 370 | if (net_xmit_drop_count(err)) { |
| @@ -371,12 +374,12 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 3 unmodified lines | ||
| 371 | 374 | return err; |
| 372 | 375 | } |
| 373 | 376 | |
| 374 | − if (cl->qdisc->q.qlen == 1) { | |
| 377 | + if (first) { | |
| 375 | 378 | list_add_tail(&cl->alist, &q->active); |
| 376 | 379 | cl->deficit = cl->quantum; |
| 377 | 380 | } |
| 378 | 381 | |
| 379 | − qdisc_qstats_backlog_inc(sch, skb); | |
| 382 | + sch->qstats.backlog += len; | |
| 380 | 383 | sch->q.qlen++; |
| 381 | 384 | return err; |
| 382 | 385 | } |
| @@ -199,6 +199,7 @@ static struct tcf_block *dsmark_tcf_block(struct Qdisc *sch, unsigned long cl, · 198 unmodified lines | ||
| 199 | 199 | static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
| 200 | 200 | struct sk_buff **to_free) |
| 201 | 201 | { |
| 202 | + unsigned int len = qdisc_pkt_len(skb); | |
| 202 | 203 | struct dsmark_qdisc_data *p = qdisc_priv(sch); |
| 203 | 204 | int err; |
| 204 | 205 | |
| @@ -271,7 +272,7 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 66 unmodified lines | ||
| 271 | 272 | return err; |
| 272 | 273 | } |
| 273 | 274 | |
| 274 | − qdisc_qstats_backlog_inc(sch, skb); | |
| 275 | + sch->qstats.backlog += len; | |
| 275 | 276 | sch->q.qlen++; |
| 276 | 277 | |
| 277 | 278 | return NET_XMIT_SUCCESS; |
| @@ -1539,8 +1539,10 @@ hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb) · 1538 unmodified lines | ||
| 1539 | 1539 | static int |
| 1540 | 1540 | hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) |
| 1541 | 1541 | { |
| 1542 | + unsigned int len = qdisc_pkt_len(skb); | |
| 1542 | 1543 | struct hfsc_class *cl; |
| 1543 | 1544 | int uninitialized_var(err); |
| 1545 | + bool first; | |
| 1544 | 1546 | |
| 1545 | 1547 | cl = hfsc_classify(skb, sch, &err); |
| 1546 | 1548 | if (cl == NULL) { |
| @@ -1550,6 +1552,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) · 3 unmodified lines | ||
| 1550 | 1552 | return err; |
| 1551 | 1553 | } |
| 1552 | 1554 | |
| 1555 | + first = !cl->qdisc->q.qlen; | |
| 1553 | 1556 | err = qdisc_enqueue(skb, cl->qdisc, to_free); |
| 1554 | 1557 | if (unlikely(err != NET_XMIT_SUCCESS)) { |
| 1555 | 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) · 3 unmodified lines | ||
| 1559 | 1562 | return err; |
| 1560 | 1563 | } |
| 1561 | 1564 | |
| 1562 | − if (cl->qdisc->q.qlen == 1) { | |
| 1563 | − unsigned int len = qdisc_pkt_len(skb); | |
| 1564 | − | |
| 1565 | + if (first) { | |
| 1565 | 1566 | if (cl->cl_flags & HFSC_RSC) |
| 1566 | 1567 | init_ed(cl, len); |
| 1567 | 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) · 8 unmodified lines | ||
| 1576 | 1577 | |
| 1577 | 1578 | } |
| 1578 | 1579 | |
| 1579 | − qdisc_qstats_backlog_inc(sch, skb); | |
| 1580 | + sch->qstats.backlog += len; | |
| 1580 | 1581 | sch->q.qlen++; |
| 1581 | 1582 | |
| 1582 | 1583 | return NET_XMIT_SUCCESS; |
| @@ -581,6 +581,7 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 580 unmodified lines | ||
| 581 | 581 | struct sk_buff **to_free) |
| 582 | 582 | { |
| 583 | 583 | int uninitialized_var(ret); |
| 584 | + unsigned int len = qdisc_pkt_len(skb); | |
| 584 | 585 | struct htb_sched *q = qdisc_priv(sch); |
| 585 | 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, · 23 unmodified lines | ||
| 610 | 611 | htb_activate(q, cl); |
| 611 | 612 | } |
| 612 | 613 | |
| 613 | − qdisc_qstats_backlog_inc(sch, skb); | |
| 614 | + sch->qstats.backlog += len; | |
| 614 | 615 | sch->q.qlen++; |
| 615 | 616 | return NET_XMIT_SUCCESS; |
| 616 | 617 | } |
| @@ -72,6 +72,7 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) · 71 unmodified lines | ||
| 72 | 72 | static int |
| 73 | 73 | prio_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) |
| 74 | 74 | { |
| 75 | + unsigned int len = qdisc_pkt_len(skb); | |
| 75 | 76 | struct Qdisc *qdisc; |
| 76 | 77 | int ret; |
| 77 | 78 | |
| @@ -88,7 +89,7 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) · 10 unmodified lines | ||
| 88 | 89 | |
| 89 | 90 | ret = qdisc_enqueue(skb, qdisc, to_free); |
| 90 | 91 | if (ret == NET_XMIT_SUCCESS) { |
| 91 | − qdisc_qstats_backlog_inc(sch, skb); | |
| 92 | + sch->qstats.backlog += len; | |
| 92 | 93 | sch->q.qlen++; |
| 93 | 94 | return NET_XMIT_SUCCESS; |
| 94 | 95 | } |
| @@ -1210,10 +1210,12 @@ static struct qfq_aggregate *qfq_choose_next_agg(struct qfq_sched *q) · 1209 unmodified lines | ||
| 1210 | 1210 | static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
| 1211 | 1211 | struct sk_buff **to_free) |
| 1212 | 1212 | { |
| 1213 | + unsigned int len = qdisc_pkt_len(skb), gso_segs; | |
| 1213 | 1214 | struct qfq_sched *q = qdisc_priv(sch); |
| 1214 | 1215 | struct qfq_class *cl; |
| 1215 | 1216 | struct qfq_aggregate *agg; |
| 1216 | 1217 | int err = 0; |
| 1218 | + bool first; | |
| 1217 | 1219 | |
| 1218 | 1220 | cl = qfq_classify(skb, sch, &err); |
| 1219 | 1221 | if (cl == NULL) { |
| @@ -1224,17 +1226,18 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 4 unmodified lines | ||
| 1224 | 1226 | } |
| 1225 | 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 | 1230 | pr_debug("qfq: increasing maxpkt from %u to %u for class %u", |
| 1229 | − cl->agg->lmax, qdisc_pkt_len(skb), cl->common.classid); | |
| 1230 | − err = qfq_change_agg(sch, cl, cl->agg->class_weight, | |
| 1231 | − qdisc_pkt_len(skb)); | |
| 1231 | + cl->agg->lmax, len, cl->common.classid); | |
| 1232 | + err = qfq_change_agg(sch, cl, cl->agg->class_weight, len); | |
| 1232 | 1233 | if (err) { |
| 1233 | 1234 | cl->qstats.drops++; |
| 1234 | 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 | 1241 | err = qdisc_enqueue(skb, cl->qdisc, to_free); |
| 1239 | 1242 | if (unlikely(err != NET_XMIT_SUCCESS)) { |
| 1240 | 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, · 4 unmodified lines | ||
| 1245 | 1248 | return err; |
| 1246 | 1249 | } |
| 1247 | 1250 | |
| 1248 | − bstats_update(&cl->bstats, skb); | |
| 1249 | − qdisc_qstats_backlog_inc(sch, skb); | |
| 1251 | + cl->bstats.bytes += len; | |
| 1252 | + cl->bstats.packets += gso_segs; | |
| 1253 | + sch->qstats.backlog += len; | |
| 1250 | 1254 | ++sch->q.qlen; |
| 1251 | 1255 | |
| 1252 | 1256 | agg = cl->agg; |
| 1253 | 1257 | /* if the queue was not empty, then done here */ |
| 1254 | − if (cl->qdisc->q.qlen != 1) { | |
| 1258 | + if (!first) { | |
| 1255 | 1259 | if (unlikely(skb == cl->qdisc->ops->peek(cl->qdisc)) && |
| 1256 | 1260 | list_first_entry(&agg->active, struct qfq_class, alist) |
| 1257 | − == cl && cl->deficit < qdisc_pkt_len(skb)) | |
| 1261 | + == cl && cl->deficit < len) | |
| 1258 | 1262 | list_move_tail(&cl->alist, &agg->active); |
| 1259 | 1263 | |
| 1260 | 1264 | return err; |
| @@ -185,6 +185,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 184 unmodified lines | ||
| 185 | 185 | struct sk_buff **to_free) |
| 186 | 186 | { |
| 187 | 187 | struct tbf_sched_data *q = qdisc_priv(sch); |
| 188 | + unsigned int len = qdisc_pkt_len(skb); | |
| 188 | 189 | int ret; |
| 189 | 190 | |
| 190 | 191 | if (qdisc_pkt_len(skb) > q->max_size) { |
| @@ -200,7 +201,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 9 unmodified lines | ||
| 200 | 201 | return ret; |
| 201 | 202 | } |
| 202 | 203 | |
| 203 | − qdisc_qstats_backlog_inc(sch, skb); | |
| 204 | + sch->qstats.backlog += len; | |
| 204 | 205 | sch->q.qlen++; |
| 205 | 206 | return NET_XMIT_SUCCESS; |
| 206 | 207 | } |
| @@ -97,11 +97,9 @@ static int sctp_inet6addr_event(struct notifier_block *this, unsigned long ev, · 96 unmodified lines | ||
| 97 | 97 | |
| 98 | 98 | switch (ev) { |
| 99 | 99 | case NETDEV_UP: |
| 100 | − addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC); | |
| 100 | + addr = kzalloc(sizeof(*addr), GFP_ATOMIC); | |
| 101 | 101 | if (addr) { |
| 102 | 102 | addr->a.v6.sin6_family = AF_INET6; |
| 103 | − addr->a.v6.sin6_port = 0; | |
| 104 | − addr->a.v6.sin6_flowinfo = 0; | |
| 105 | 103 | addr->a.v6.sin6_addr = ifa->addr; |
| 106 | 104 | addr->a.v6.sin6_scope_id = ifa->idev->dev->ifindex; |
| 107 | 105 | addr->valid = 1; |
| @@ -434,7 +432,6 @@ static void sctp_v6_copy_addrlist(struct list_head *addrlist, · 326 unmodified lines | ||
| 434 | 432 | addr = kzalloc(sizeof(*addr), GFP_ATOMIC); |
| 435 | 433 | if (addr) { |
| 436 | 434 | addr->a.v6.sin6_family = AF_INET6; |
| 437 | − addr->a.v6.sin6_port = 0; | |
| 438 | 435 | addr->a.v6.sin6_addr = ifp->addr; |
| 439 | 436 | addr->a.v6.sin6_scope_id = dev->ifindex; |
| 440 | 437 | addr->valid = 1; |
| @@ -101,7 +101,6 @@ static void sctp_v4_copy_addrlist(struct list_head *addrlist, · 100 unmodified lines | ||
| 101 | 101 | addr = kzalloc(sizeof(*addr), GFP_ATOMIC); |
| 102 | 102 | if (addr) { |
| 103 | 103 | addr->a.v4.sin_family = AF_INET; |
| 104 | − addr->a.v4.sin_port = 0; | |
| 105 | 104 | addr->a.v4.sin_addr.s_addr = ifa->ifa_local; |
| 106 | 105 | addr->valid = 1; |
| 107 | 106 | INIT_LIST_HEAD(&addr->list); |
| @@ -776,10 +775,9 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev, · 668 unmodified lines | ||
| 776 | 775 | |
| 777 | 776 | switch (ev) { |
| 778 | 777 | case NETDEV_UP: |
| 779 | − addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC); | |
| 778 | + addr = kzalloc(sizeof(*addr), GFP_ATOMIC); | |
| 780 | 779 | if (addr) { |
| 781 | 780 | addr->a.v4.sin_family = AF_INET; |
| 782 | − addr->a.v4.sin_port = 0; | |
| 783 | 781 | addr->a.v4.sin_addr.s_addr = ifa->ifa_local; |
| 784 | 782 | addr->valid = 1; |
| 785 | 783 | spin_lock_bh(&net->sctp.local_addr_lock); |
| @@ -87,6 +87,11 @@ static int tipc_skb_tailroom(struct sk_buff *skb) · 86 unmodified lines | ||
| 87 | 87 | return limit; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | +static inline int TLV_GET_DATA_LEN(struct tlv_desc *tlv) | |
| 91 | +{ | |
| 92 | + return TLV_GET_LEN(tlv) - TLV_SPACE(0); | |
| 93 | +} | |
| 94 | + | |
| 90 | 95 | static int tipc_add_tlv(struct sk_buff *skb, u16 type, void *data, u16 len) |
| 91 | 96 | { |
| 92 | 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) · 73 unmodified lines | ||
| 166 | 171 | return buf; |
| 167 | 172 | } |
| 168 | 173 | |
| 174 | +static inline bool string_is_valid(char *s, int len) | |
| 175 | +{ | |
| 176 | + return memchr(s, '\0', len) ? true : false; | |
| 177 | +} | |
| 178 | + | |
| 169 | 179 | static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd, |
| 170 | 180 | struct tipc_nl_compat_msg *msg, |
| 171 | 181 | struct sk_buff *arg) |
| @@ -379,6 +389,7 @@ static int tipc_nl_compat_bearer_enable(struct tipc_nl_compat_cmd_doit *cmd, · 207 unmodified lines | ||
| 379 | 389 | struct nlattr *prop; |
| 380 | 390 | struct nlattr *bearer; |
| 381 | 391 | struct tipc_bearer_config *b; |
| 392 | + int len; | |
| 382 | 393 | |
| 383 | 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, · 1 unmodified line | ||
| 386 | 397 | if (!bearer) |
| 387 | 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 | 404 | if (nla_put_string(skb, TIPC_NLA_BEARER_NAME, b->name)) |
| 390 | 405 | return -EMSGSIZE; |
| 391 | 406 | |
| @@ -411,6 +426,7 @@ static int tipc_nl_compat_bearer_disable(struct tipc_nl_compat_cmd_doit *cmd, · 19 unmodified lines | ||
| 411 | 426 | { |
| 412 | 427 | char *name; |
| 413 | 428 | struct nlattr *bearer; |
| 429 | + int len; | |
| 414 | 430 | |
| 415 | 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, · 1 unmodified line | ||
| 418 | 434 | if (!bearer) |
| 419 | 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 | 441 | if (nla_put_string(skb, TIPC_NLA_BEARER_NAME, name)) |
| 422 | 442 | return -EMSGSIZE; |
| 423 | 443 | |
| @@ -478,6 +498,7 @@ static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg, · 54 unmodified lines | ||
| 478 | 498 | struct nlattr *prop[TIPC_NLA_PROP_MAX + 1]; |
| 479 | 499 | struct nlattr *stats[TIPC_NLA_STATS_MAX + 1]; |
| 480 | 500 | int err; |
| 501 | + int len; | |
| 481 | 502 | |
| 482 | 503 | if (!attrs[TIPC_NLA_LINK]) |
| 483 | 504 | return -EINVAL; |
| @@ -504,6 +525,11 @@ static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg, · 20 unmodified lines | ||
| 504 | 525 | return err; |
| 505 | 526 | |
| 506 | 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 | 533 | if (strcmp(name, nla_data(link[TIPC_NLA_LINK_NAME])) != 0) |
| 508 | 534 | return 0; |
| 509 | 535 | |
| @@ -644,6 +670,7 @@ static int tipc_nl_compat_media_set(struct sk_buff *skb, · 134 unmodified lines | ||
| 644 | 670 | struct nlattr *prop; |
| 645 | 671 | struct nlattr *media; |
| 646 | 672 | struct tipc_link_config *lc; |
| 673 | + int len; | |
| 647 | 674 | |
| 648 | 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, · 1 unmodified line | ||
| 651 | 678 | if (!media) |
| 652 | 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 | 685 | if (nla_put_string(skb, TIPC_NLA_MEDIA_NAME, lc->name)) |
| 655 | 686 | return -EMSGSIZE; |
| 656 | 687 | |
| @@ -671,6 +702,7 @@ static int tipc_nl_compat_bearer_set(struct sk_buff *skb, · 14 unmodified lines | ||
| 671 | 702 | struct nlattr *prop; |
| 672 | 703 | struct nlattr *bearer; |
| 673 | 704 | struct tipc_link_config *lc; |
| 705 | + int len; | |
| 674 | 706 | |
| 675 | 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, · 1 unmodified line | ||
| 678 | 710 | if (!bearer) |
| 679 | 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 | 717 | if (nla_put_string(skb, TIPC_NLA_BEARER_NAME, lc->name)) |
| 682 | 718 | return -EMSGSIZE; |
| 683 | 719 | |
| @@ -726,9 +762,14 @@ static int tipc_nl_compat_link_set(struct tipc_nl_compat_cmd_doit *cmd, · 42 unmodified lines | ||
| 726 | 762 | struct tipc_link_config *lc; |
| 727 | 763 | struct tipc_bearer *bearer; |
| 728 | 764 | struct tipc_media *media; |
| 765 | + int len; | |
| 729 | 766 | |
| 730 | 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 | 773 | media = tipc_media_find(lc->name); |
| 733 | 774 | if (media) { |
| 734 | 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, · 15 unmodified lines | ||
| 750 | 791 | { |
| 751 | 792 | char *name; |
| 752 | 793 | struct nlattr *link; |
| 794 | + int len; | |
| 753 | 795 | |
| 754 | 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, · 1 unmodified line | ||
| 757 | 799 | if (!link) |
| 758 | 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 | 806 | if (nla_put_string(skb, TIPC_NLA_LINK_NAME, name)) |
| 761 | 807 | return -EMSGSIZE; |
| 762 | 808 | |
| @@ -778,6 +824,8 @@ static int tipc_nl_compat_name_table_dump_header(struct tipc_nl_compat_msg *msg) · 15 unmodified lines | ||
| 778 | 824 | }; |
| 779 | 825 | |
| 780 | 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 | 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) · 424 unmodified lines | ||
| 1208 | 1256 | } |
| 1209 | 1257 | |
| 1210 | 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 | 1260 | msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_SUPPORTED); |
| 1213 | 1261 | err = -EOPNOTSUPP; |
| 1214 | 1262 | goto send; |
| @@ -398,7 +398,7 @@ static int tipc_conn_rcv_from_sock(struct tipc_conn *con) · 397 unmodified lines | ||
| 398 | 398 | ret = sock_recvmsg(con->sock, &msg, MSG_DONTWAIT); |
| 399 | 399 | if (ret == -EWOULDBLOCK) |
| 400 | 400 | return -EWOULDBLOCK; |
| 401 | − if (ret > 0) { | |
| 401 | + if (ret == sizeof(s)) { | |
| 402 | 402 | read_lock_bh(&sk->sk_callback_lock); |
| 403 | 403 | ret = tipc_conn_rcv_sub(srv, con, &s); |
| 404 | 404 | read_unlock_bh(&sk->sk_callback_lock); |
| @@ -41,13 +41,20 @@ void xdp_del_sk_umem(struct xdp_umem *umem, struct xdp_sock *xs) · 40 unmodified lines | ||
| 41 | 41 | * not know if the device has more tx queues than rx, or the opposite. |
| 42 | 42 | * This might also change during run time. |
| 43 | 43 | */ |
| 44 | −static void xdp_reg_umem_at_qid(struct net_device *dev, struct xdp_umem *umem, | |
| 45 | − u16 queue_id) | |
| 44 | +static int xdp_reg_umem_at_qid(struct net_device *dev, struct xdp_umem *umem, | |
| 45 | + u16 queue_id) | |
| 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 | 52 | if (queue_id < dev->real_num_rx_queues) |
| 48 | 53 | dev->_rx[queue_id].umem = umem; |
| 49 | 54 | if (queue_id < dev->real_num_tx_queues) |
| 50 | 55 | dev->_tx[queue_id].umem = umem; |
| 56 | + | |
| 57 | + return 0; | |
| 51 | 58 | } |
| 52 | 59 | |
| 53 | 60 | struct xdp_umem *xdp_get_umem_from_qid(struct net_device *dev, |
| @@ -88,7 +95,10 @@ int xdp_umem_assign_dev(struct xdp_umem *umem, struct net_device *dev, · 34 unmodified lines | ||
| 88 | 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 | 102 | umem->dev = dev; |
| 93 | 103 | umem->queue_id = queue_id; |
| 94 | 104 | if (force_copy) |
| @@ -279,6 +279,7 @@ $(obj)/%.o: $(src)/%.c · 278 unmodified lines | ||
| 279 | 279 | -Wno-gnu-variable-sized-type-not-at-end \ |
| 280 | 280 | -Wno-address-of-packed-member -Wno-tautological-compare \ |
| 281 | 281 | -Wno-unknown-warning-option $(CLANG_ARCH_ARGS) \ |
| 282 | + -I$(srctree)/samples/bpf/ -include asm_goto_workaround.h \ | |
| 282 | 283 | -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf $(LLC_FLAGS) -filetype=obj -o $@ |
| 283 | 284 | ifeq ($(DWARF2BTF),y) |
| 284 | 285 | $(BTF_PAHOLE) -J $@ |
| @@ -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 | |
| @@ -93,9 +93,16 @@ BFD_SRCS = jit_disasm.c · 92 unmodified lines | ||
| 93 | 93 | SRCS = $(filter-out $(BFD_SRCS),$(wildcard *.c)) |
| 94 | 94 | |
| 95 | 95 | ifeq ($(feature-libbfd),1) |
| 96 | + LIBS += -lbfd -ldl -lopcodes | |
| 97 | +else ifeq ($(feature-libbfd-liberty),1) | |
| 98 | + LIBS += -lbfd -ldl -lopcodes -liberty | |
| 99 | +else ifeq ($(feature-libbfd-liberty-z),1) | |
| 100 | + LIBS += -lbfd -ldl -lopcodes -liberty -lz | |
| 101 | +endif | |
| 102 | + | |
| 103 | +ifneq ($(filter -lbfd,$(LIBS)),) | |
| 96 | 104 | CFLAGS += -DHAVE_LIBBFD_SUPPORT |
| 97 | 105 | SRCS += $(BFD_SRCS) |
| 98 | −LIBS += -lbfd -lopcodes | |
| 99 | 106 | endif |
| 100 | 107 | |
| 101 | 108 | OBJS = $(patsubst %.c,$(OUTPUT)%.o,$(SRCS)) $(OUTPUT)disasm.o |
| @@ -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 | 3 | * Simple streaming JSON writer |
| 4 | 4 | * |
| 5 | 5 | * This takes care of the annoying bits of JSON syntax like the commas |
| 6 | 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 | 8 | * Authors: Stephen Hemminger <stephen@networkplumber.org> |
| 14 | 9 | */ |
| 15 | 10 | |
| @@ -5,11 +5,6 @@ · 4 unmodified lines | ||
| 5 | 5 | * This takes care of the annoying bits of JSON syntax like the commas |
| 6 | 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 | 8 | * Authors: Stephen Hemminger <stephen@networkplumber.org> |
| 14 | 9 | */ |
| 15 | 10 | |
| @@ -0,0 +1,1163 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | |
| 2 | +#ifndef __LINUX_PKT_SCHED_H | |
| 3 | +#define __LINUX_PKT_SCHED_H | |
| 4 | + | |
| 5 | +#include <linux/types.h> | |
| 6 | + | |
| 7 | +/* Logical priority bands not depending on specific packet scheduler. | |
| 8 | + Every scheduler will map them to real traffic classes, if it has | |
| 9 | + no more precise mechanism to classify packets. | |
| 10 | + | |
| 11 | + These numbers have no special meaning, though their coincidence | |
| 12 | + with obsolete IPv6 values is not occasional :-). New IPv6 drafts | |
| 13 | + preferred full anarchy inspired by diffserv group. | |
| 14 | + | |
| 15 | + Note: TC_PRIO_BESTEFFORT does not mean that it is the most unhappy | |
| 16 | + class, actually, as rule it will be handled with more care than | |
| 17 | + filler or even bulk. | |
| 18 | + */ | |
| 19 | + | |
| 20 | +#define TC_PRIO_BESTEFFORT 0 | |
| 21 | +#define TC_PRIO_FILLER 1 | |
| 22 | +#define TC_PRIO_BULK 2 | |
| 23 | +#define TC_PRIO_INTERACTIVE_BULK 4 | |
| 24 | +#define TC_PRIO_INTERACTIVE 6 | |
| 25 | +#define TC_PRIO_CONTROL 7 | |
| 26 | + | |
| 27 | +#define TC_PRIO_MAX 15 | |
| 28 | + | |
| 29 | +/* Generic queue statistics, available for all the elements. | |
| 30 | + Particular schedulers may have also their private records. | |
| 31 | + */ | |
| 32 | + | |
| 33 | +struct tc_stats { | |
| 34 | + __u64 bytes; /* Number of enqueued bytes */ | |
| 35 | + __u32 packets; /* Number of enqueued packets */ | |
| 36 | + __u32 drops; /* Packets dropped because of lack of resources */ | |
| 37 | + __u32 overlimits; /* Number of throttle events when this | |
| 38 | + * flow goes out of allocated bandwidth */ | |
| 39 | + __u32 bps; /* Current flow byte rate */ | |
| 40 | + __u32 pps; /* Current flow packet rate */ | |
| 41 | + __u32 qlen; | |
| 42 | + __u32 backlog; | |
| 43 | +}; | |
| 44 | + | |
| 45 | +struct tc_estimator { | |
| 46 | + signed char interval; | |
| 47 | + unsigned char ewma_log; | |
| 48 | +}; | |
| 49 | + | |
| 50 | +/* "Handles" | |
| 51 | + --------- | |
| 52 | + | |
| 53 | + All the traffic control objects have 32bit identifiers, or "handles". | |
| 54 | + | |
| 55 | + They can be considered as opaque numbers from user API viewpoint, | |
| 56 | + but actually they always consist of two fields: major and | |
| 57 | + minor numbers, which are interpreted by kernel specially, | |
| 58 | + that may be used by applications, though not recommended. | |
| 59 | + | |
| 60 | + F.e. qdisc handles always have minor number equal to zero, | |
| 61 | + classes (or flows) have major equal to parent qdisc major, and | |
| 62 | + minor uniquely identifying class inside qdisc. | |
| 63 | + | |
| 64 | + Macros to manipulate handles: | |
| 65 | + */ | |
| 66 | + | |
| 67 | +#define TC_H_MAJ_MASK (0xFFFF0000U) | |
| 68 | +#define TC_H_MIN_MASK (0x0000FFFFU) | |
| 69 | +#define TC_H_MAJ(h) ((h)&TC_H_MAJ_MASK) | |
| 70 | +#define TC_H_MIN(h) ((h)&TC_H_MIN_MASK) | |
| 71 | +#define TC_H_MAKE(maj,min) (((maj)&TC_H_MAJ_MASK)|((min)&TC_H_MIN_MASK)) | |
| 72 | + | |
| 73 | +#define TC_H_UNSPEC (0U) | |
| 74 | +#define TC_H_ROOT (0xFFFFFFFFU) | |
| 75 | +#define TC_H_INGRESS (0xFFFFFFF1U) | |
| 76 | +#define TC_H_CLSACT TC_H_INGRESS | |
| 77 | + | |
| 78 | +#define TC_H_MIN_PRIORITY 0xFFE0U | |
| 79 | +#define TC_H_MIN_INGRESS 0xFFF2U | |
| 80 | +#define TC_H_MIN_EGRESS 0xFFF3U | |
| 81 | + | |
| 82 | +/* Need to corrospond to iproute2 tc/tc_core.h "enum link_layer" */ | |
| 83 | +enum tc_link_layer { | |
| 84 | + TC_LINKLAYER_UNAWARE, /* Indicate unaware old iproute2 util */ | |
| 85 | + TC_LINKLAYER_ETHERNET, | |
| 86 | + TC_LINKLAYER_ATM, | |
| 87 | +}; | |
| 88 | +#define TC_LINKLAYER_MASK 0x0F /* limit use to lower 4 bits */ | |
| 89 | + | |
| 90 | +struct tc_ratespec { | |
| 91 | + unsigned char cell_log; | |
| 92 | + __u8 linklayer; /* lower 4 bits */ | |
| 93 | + unsigned short overhead; | |
| 94 | + short cell_align; | |
| 95 | + unsigned short mpu; | |
| 96 | + __u32 rate; | |
| 97 | +}; | |
| 98 | + | |
| 99 | +#define TC_RTAB_SIZE 1024 | |
| 100 | + | |
| 101 | +struct tc_sizespec { | |
| 102 | + unsigned char cell_log; | |
| 103 | + unsigned char size_log; | |
| 104 | + short cell_align; | |
| 105 | + int overhead; | |
| 106 | + unsigned int linklayer; | |
| 107 | + unsigned int mpu; | |
| 108 | + unsigned int mtu; | |
| 109 | + unsigned int tsize; | |
| 110 | +}; | |
| 111 | + | |
| 112 | +enum { | |
| 113 | + TCA_STAB_UNSPEC, | |
| 114 | + TCA_STAB_BASE, | |
| 115 | + TCA_STAB_DATA, | |
| 116 | + __TCA_STAB_MAX | |
| 117 | +}; | |
| 118 | + | |
| 119 | +#define TCA_STAB_MAX (__TCA_STAB_MAX - 1) | |
| 120 | + | |
| 121 | +/* FIFO section */ | |
| 122 | + | |
| 123 | +struct tc_fifo_qopt { | |
| 124 | + __u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */ | |
| 125 | +}; | |
| 126 | + | |
| 127 | +/* SKBPRIO section */ | |
| 128 | + | |
| 129 | +/* | |
| 130 | + * Priorities go from zero to (SKBPRIO_MAX_PRIORITY - 1). | |
| 131 | + * SKBPRIO_MAX_PRIORITY should be at least 64 in order for skbprio to be able | |
| 132 | + * to map one to one the DS field of IPV4 and IPV6 headers. | |
| 133 | + * Memory allocation grows linearly with SKBPRIO_MAX_PRIORITY. | |
| 134 | + */ | |
| 135 | + | |
| 136 | +#define SKBPRIO_MAX_PRIORITY 64 | |
| 137 | + | |
| 138 | +struct tc_skbprio_qopt { | |
| 139 | + __u32 limit; /* Queue length in packets. */ | |
| 140 | +}; | |
| 141 | + | |
| 142 | +/* PRIO section */ | |
| 143 | + | |
| 144 | +#define TCQ_PRIO_BANDS 16 | |
| 145 | +#define TCQ_MIN_PRIO_BANDS 2 | |
| 146 | + | |
| 147 | +struct tc_prio_qopt { | |
| 148 | + int bands; /* Number of bands */ | |
| 149 | + __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ | |
| 150 | +}; | |
| 151 | + | |
| 152 | +/* MULTIQ section */ | |
| 153 | + | |
| 154 | +struct tc_multiq_qopt { | |
| 155 | + __u16 bands; /* Number of bands */ | |
| 156 | + __u16 max_bands; /* Maximum number of queues */ | |
| 157 | +}; | |
| 158 | + | |
| 159 | +/* PLUG section */ | |
| 160 | + | |
| 161 | +#define TCQ_PLUG_BUFFER 0 | |
| 162 | +#define TCQ_PLUG_RELEASE_ONE 1 | |
| 163 | +#define TCQ_PLUG_RELEASE_INDEFINITE 2 | |
| 164 | +#define TCQ_PLUG_LIMIT 3 | |
| 165 | + | |
| 166 | +struct tc_plug_qopt { | |
| 167 | + /* TCQ_PLUG_BUFFER: Inset a plug into the queue and | |
| 168 | + * buffer any incoming packets | |
| 169 | + * TCQ_PLUG_RELEASE_ONE: Dequeue packets from queue head | |
| 170 | + * to beginning of the next plug. | |
| 171 | + * TCQ_PLUG_RELEASE_INDEFINITE: Dequeue all packets from queue. | |
| 172 | + * Stop buffering packets until the next TCQ_PLUG_BUFFER | |
| 173 | + * command is received (just act as a pass-thru queue). | |
| 174 | + * TCQ_PLUG_LIMIT: Increase/decrease queue size | |
| 175 | + */ | |
| 176 | + int action; | |
| 177 | + __u32 limit; | |
| 178 | +}; | |
| 179 | + | |
| 180 | +/* TBF section */ | |
| 181 | + | |
| 182 | +struct tc_tbf_qopt { | |
| 183 | + struct tc_ratespec rate; | |
| 184 | + struct tc_ratespec peakrate; | |
| 185 | + __u32 limit; | |
| 186 | + __u32 buffer; | |
| 187 | + __u32 mtu; | |
| 188 | +}; | |
| 189 | + | |
| 190 | +enum { | |
| 191 | + TCA_TBF_UNSPEC, | |
| 192 | + TCA_TBF_PARMS, | |
| 193 | + TCA_TBF_RTAB, | |
| 194 | + TCA_TBF_PTAB, | |
| 195 | + TCA_TBF_RATE64, | |
| 196 | + TCA_TBF_PRATE64, | |
| 197 | + TCA_TBF_BURST, | |
| 198 | + TCA_TBF_PBURST, | |
| 199 | + TCA_TBF_PAD, | |
| 200 | + __TCA_TBF_MAX, | |
| 201 | +}; | |
| 202 | + | |
| 203 | +#define TCA_TBF_MAX (__TCA_TBF_MAX - 1) | |
| 204 | + | |
| 205 | + | |
| 206 | +/* TEQL section */ | |
| 207 | + | |
| 208 | +/* TEQL does not require any parameters */ | |
| 209 | + | |
| 210 | +/* SFQ section */ | |
| 211 | + | |
| 212 | +struct tc_sfq_qopt { | |
| 213 | + unsigned quantum; /* Bytes per round allocated to flow */ | |
| 214 | + int perturb_period; /* Period of hash perturbation */ | |
| 215 | + __u32 limit; /* Maximal packets in queue */ | |
| 216 | + unsigned divisor; /* Hash divisor */ | |
| 217 | + unsigned flows; /* Maximal number of flows */ | |
| 218 | +}; | |
| 219 | + | |
| 220 | +struct tc_sfqred_stats { | |
| 221 | + __u32 prob_drop; /* Early drops, below max threshold */ | |
| 222 | + __u32 forced_drop; /* Early drops, after max threshold */ | |
| 223 | + __u32 prob_mark; /* Marked packets, below max threshold */ | |
| 224 | + __u32 forced_mark; /* Marked packets, after max threshold */ | |
| 225 | + __u32 prob_mark_head; /* Marked packets, below max threshold */ | |
| 226 | + __u32 forced_mark_head;/* Marked packets, after max threshold */ | |
| 227 | +}; | |
| 228 | + | |
| 229 | +struct tc_sfq_qopt_v1 { | |
| 230 | + struct tc_sfq_qopt v0; | |
| 231 | + unsigned int depth; /* max number of packets per flow */ | |
| 232 | + unsigned int headdrop; | |
| 233 | +/* SFQRED parameters */ | |
| 234 | + __u32 limit; /* HARD maximal flow queue length (bytes) */ | |
| 235 | + __u32 qth_min; /* Min average length threshold (bytes) */ | |
| 236 | + __u32 qth_max; /* Max average length threshold (bytes) */ | |
| 237 | + unsigned char Wlog; /* log(W) */ | |
| 238 | + unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ | |
| 239 | + unsigned char Scell_log; /* cell size for idle damping */ | |
| 240 | + unsigned char flags; | |
| 241 | + __u32 max_P; /* probability, high resolution */ | |
| 242 | +/* SFQRED stats */ | |
| 243 | + struct tc_sfqred_stats stats; | |
| 244 | +}; | |
| 245 | + | |
| 246 | + | |
| 247 | +struct tc_sfq_xstats { | |
| 248 | + __s32 allot; | |
| 249 | +}; | |
| 250 | + | |
| 251 | +/* RED section */ | |
| 252 | + | |
| 253 | +enum { | |
| 254 | + TCA_RED_UNSPEC, | |
| 255 | + TCA_RED_PARMS, | |
| 256 | + TCA_RED_STAB, | |
| 257 | + TCA_RED_MAX_P, | |
| 258 | + __TCA_RED_MAX, | |
| 259 | +}; | |
| 260 | + | |
| 261 | +#define TCA_RED_MAX (__TCA_RED_MAX - 1) | |
| 262 | + | |
| 263 | +struct tc_red_qopt { | |
| 264 | + __u32 limit; /* HARD maximal queue length (bytes) */ | |
| 265 | + __u32 qth_min; /* Min average length threshold (bytes) */ | |
| 266 | + __u32 qth_max; /* Max average length threshold (bytes) */ | |
| 267 | + unsigned char Wlog; /* log(W) */ | |
| 268 | + unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ | |
| 269 | + unsigned char Scell_log; /* cell size for idle damping */ | |
| 270 | + unsigned char flags; | |
| 271 | +#define TC_RED_ECN 1 | |
| 272 | +#define TC_RED_HARDDROP 2 | |
| 273 | +#define TC_RED_ADAPTATIVE 4 | |
| 274 | +}; | |
| 275 | + | |
| 276 | +struct tc_red_xstats { | |
| 277 | + __u32 early; /* Early drops */ | |
| 278 | + __u32 pdrop; /* Drops due to queue limits */ | |
| 279 | + __u32 other; /* Drops due to drop() calls */ | |
| 280 | + __u32 marked; /* Marked packets */ | |
| 281 | +}; | |
| 282 | + | |
| 283 | +/* GRED section */ | |
| 284 | + | |
| 285 | +#define MAX_DPs 16 | |
| 286 | + | |
| 287 | +enum { | |
| 288 | + TCA_GRED_UNSPEC, | |
| 289 | + TCA_GRED_PARMS, | |
| 290 | + TCA_GRED_STAB, | |
| 291 | + TCA_GRED_DPS, | |
| 292 | + TCA_GRED_MAX_P, | |
| 293 | + TCA_GRED_LIMIT, | |
| 294 | + TCA_GRED_VQ_LIST, /* nested TCA_GRED_VQ_ENTRY */ | |
| 295 | + __TCA_GRED_MAX, | |
| 296 | +}; | |
| 297 | + | |
| 298 | +#define TCA_GRED_MAX (__TCA_GRED_MAX - 1) | |
| 299 | + | |
| 300 | +enum { | |
| 301 | + TCA_GRED_VQ_ENTRY_UNSPEC, | |
| 302 | + TCA_GRED_VQ_ENTRY, /* nested TCA_GRED_VQ_* */ | |
| 303 | + __TCA_GRED_VQ_ENTRY_MAX, | |
| 304 | +}; | |
| 305 | +#define TCA_GRED_VQ_ENTRY_MAX (__TCA_GRED_VQ_ENTRY_MAX - 1) | |
| 306 | + | |
| 307 | +enum { | |
| 308 | + TCA_GRED_VQ_UNSPEC, | |
| 309 | + TCA_GRED_VQ_PAD, | |
| 310 | + TCA_GRED_VQ_DP, /* u32 */ | |
| 311 | + TCA_GRED_VQ_STAT_BYTES, /* u64 */ | |
| 312 | + TCA_GRED_VQ_STAT_PACKETS, /* u32 */ | |
| 313 | + TCA_GRED_VQ_STAT_BACKLOG, /* u32 */ | |
| 314 | + TCA_GRED_VQ_STAT_PROB_DROP, /* u32 */ | |
| 315 | + TCA_GRED_VQ_STAT_PROB_MARK, /* u32 */ | |
| 316 | + TCA_GRED_VQ_STAT_FORCED_DROP, /* u32 */ | |
| 317 | + TCA_GRED_VQ_STAT_FORCED_MARK, /* u32 */ | |
| 318 | + TCA_GRED_VQ_STAT_PDROP, /* u32 */ | |
| 319 | + TCA_GRED_VQ_STAT_OTHER, /* u32 */ | |
| 320 | + TCA_GRED_VQ_FLAGS, /* u32 */ | |
| 321 | + __TCA_GRED_VQ_MAX | |
| 322 | +}; | |
| 323 | + | |
| 324 | +#define TCA_GRED_VQ_MAX (__TCA_GRED_VQ_MAX - 1) | |
| 325 | + | |
| 326 | +struct tc_gred_qopt { | |
| 327 | + __u32 limit; /* HARD maximal queue length (bytes) */ | |
| 328 | + __u32 qth_min; /* Min average length threshold (bytes) */ | |
| 329 | + __u32 qth_max; /* Max average length threshold (bytes) */ | |
| 330 | + __u32 DP; /* up to 2^32 DPs */ | |
| 331 | + __u32 backlog; | |
| 332 | + __u32 qave; | |
| 333 | + __u32 forced; | |
| 334 | + __u32 early; | |
| 335 | + __u32 other; | |
| 336 | + __u32 pdrop; | |
| 337 | + __u8 Wlog; /* log(W) */ | |
| 338 | + __u8 Plog; /* log(P_max/(qth_max-qth_min)) */ | |
| 339 | + __u8 Scell_log; /* cell size for idle damping */ | |
| 340 | + __u8 prio; /* prio of this VQ */ | |
| 341 | + __u32 packets; | |
| 342 | + __u32 bytesin; | |
| 343 | +}; | |
| 344 | + | |
| 345 | +/* gred setup */ | |
| 346 | +struct tc_gred_sopt { | |
| 347 | + __u32 DPs; | |
| 348 | + __u32 def_DP; | |
| 349 | + __u8 grio; | |
| 350 | + __u8 flags; | |
| 351 | + __u16 pad1; | |
| 352 | +}; | |
| 353 | + | |
| 354 | +/* CHOKe section */ | |
| 355 | + | |
| 356 | +enum { | |
| 357 | + TCA_CHOKE_UNSPEC, | |
| 358 | + TCA_CHOKE_PARMS, | |
| 359 | + TCA_CHOKE_STAB, | |
| 360 | + TCA_CHOKE_MAX_P, | |
| 361 | + __TCA_CHOKE_MAX, | |
| 362 | +}; | |
| 363 | + | |
| 364 | +#define TCA_CHOKE_MAX (__TCA_CHOKE_MAX - 1) | |
| 365 | + | |
| 366 | +struct tc_choke_qopt { | |
| 367 | + __u32 limit; /* Hard queue length (packets) */ | |
| 368 | + __u32 qth_min; /* Min average threshold (packets) */ | |
| 369 | + __u32 qth_max; /* Max average threshold (packets) */ | |
| 370 | + unsigned char Wlog; /* log(W) */ | |
| 371 | + unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ | |
| 372 | + unsigned char Scell_log; /* cell size for idle damping */ | |
| 373 | + unsigned char flags; /* see RED flags */ | |
| 374 | +}; | |
| 375 | + | |
| 376 | +struct tc_choke_xstats { | |
| 377 | + __u32 early; /* Early drops */ | |
| 378 | + __u32 pdrop; /* Drops due to queue limits */ | |
| 379 | + __u32 other; /* Drops due to drop() calls */ | |
| 380 | + __u32 marked; /* Marked packets */ | |
| 381 | + __u32 matched; /* Drops due to flow match */ | |
| 382 | +}; | |
| 383 | + | |
| 384 | +/* HTB section */ | |
| 385 | +#define TC_HTB_NUMPRIO 8 | |
| 386 | +#define TC_HTB_MAXDEPTH 8 | |
| 387 | +#define TC_HTB_PROTOVER 3 /* the same as HTB and TC's major */ | |
| 388 | + | |
| 389 | +struct tc_htb_opt { | |
| 390 | + struct tc_ratespec rate; | |
| 391 | + struct tc_ratespec ceil; | |
| 392 | + __u32 buffer; | |
| 393 | + __u32 cbuffer; | |
| 394 | + __u32 quantum; | |
| 395 | + __u32 level; /* out only */ | |
| 396 | + __u32 prio; | |
| 397 | +}; | |
| 398 | +struct tc_htb_glob { | |
| 399 | + __u32 version; /* to match HTB/TC */ | |
| 400 | + __u32 rate2quantum; /* bps->quantum divisor */ | |
| 401 | + __u32 defcls; /* default class number */ | |
| 402 | + __u32 debug; /* debug flags */ | |
| 403 | + | |
| 404 | + /* stats */ | |
| 405 | + __u32 direct_pkts; /* count of non shaped packets */ | |
| 406 | +}; | |
| 407 | +enum { | |
| 408 | + TCA_HTB_UNSPEC, | |
| 409 | + TCA_HTB_PARMS, | |
| 410 | + TCA_HTB_INIT, | |
| 411 | + TCA_HTB_CTAB, | |
| 412 | + TCA_HTB_RTAB, | |
| 413 | + TCA_HTB_DIRECT_QLEN, | |
| 414 | + TCA_HTB_RATE64, | |
| 415 | + TCA_HTB_CEIL64, | |
| 416 | + TCA_HTB_PAD, | |
| 417 | + __TCA_HTB_MAX, | |
| 418 | +}; | |
| 419 | + | |
| 420 | +#define TCA_HTB_MAX (__TCA_HTB_MAX - 1) | |
| 421 | + | |
| 422 | +struct tc_htb_xstats { | |
| 423 | + __u32 lends; | |
| 424 | + __u32 borrows; | |
| 425 | + __u32 giants; /* unused since 'Make HTB scheduler work with TSO.' */ | |
| 426 | + __s32 tokens; | |
| 427 | + __s32 ctokens; | |
| 428 | +}; | |
| 429 | + | |
| 430 | +/* HFSC section */ | |
| 431 | + | |
| 432 | +struct tc_hfsc_qopt { | |
| 433 | + __u16 defcls; /* default class */ | |
| 434 | +}; | |
| 435 | + | |
| 436 | +struct tc_service_curve { | |
| 437 | + __u32 m1; /* slope of the first segment in bps */ | |
| 438 | + __u32 d; /* x-projection of the first segment in us */ | |
| 439 | + __u32 m2; /* slope of the second segment in bps */ | |
| 440 | +}; | |
| 441 | + | |
| 442 | +struct tc_hfsc_stats { | |
| 443 | + __u64 work; /* total work done */ | |
| 444 | + __u64 rtwork; /* work done by real-time criteria */ | |
| 445 | + __u32 period; /* current period */ | |
| 446 | + __u32 level; /* class level in hierarchy */ | |
| 447 | +}; | |
| 448 | + | |
| 449 | +enum { | |
| 450 | + TCA_HFSC_UNSPEC, | |
| 451 | + TCA_HFSC_RSC, | |
| 452 | + TCA_HFSC_FSC, | |
| 453 | + TCA_HFSC_USC, | |
| 454 | + __TCA_HFSC_MAX, | |
| 455 | +}; | |
| 456 | + | |
| 457 | +#define TCA_HFSC_MAX (__TCA_HFSC_MAX - 1) | |
| 458 | + | |
| 459 | + | |
| 460 | +/* CBQ section */ | |
| 461 | + | |
| 462 | +#define TC_CBQ_MAXPRIO 8 | |
| 463 | +#define TC_CBQ_MAXLEVEL 8 | |
| 464 | +#define TC_CBQ_DEF_EWMA 5 | |
| 465 | + | |
| 466 | +struct tc_cbq_lssopt { | |
| 467 | + unsigned char change; | |
| 468 | + unsigned char flags; | |
| 469 | +#define TCF_CBQ_LSS_BOUNDED 1 | |
| 470 | +#define TCF_CBQ_LSS_ISOLATED 2 | |
| 471 | + unsigned char ewma_log; | |
| 472 | + unsigned char level; | |
| 473 | +#define TCF_CBQ_LSS_FLAGS 1 | |
| 474 | +#define TCF_CBQ_LSS_EWMA 2 | |
| 475 | +#define TCF_CBQ_LSS_MAXIDLE 4 | |
| 476 | +#define TCF_CBQ_LSS_MINIDLE 8 | |
| 477 | +#define TCF_CBQ_LSS_OFFTIME 0x10 | |
| 478 | +#define TCF_CBQ_LSS_AVPKT 0x20 | |
| 479 | + __u32 maxidle; | |
| 480 | + __u32 minidle; | |
| 481 | + __u32 offtime; | |
| 482 | + __u32 avpkt; | |
| 483 | +}; | |
| 484 | + | |
| 485 | +struct tc_cbq_wrropt { | |
| 486 | + unsigned char flags; | |
| 487 | + unsigned char priority; | |
| 488 | + unsigned char cpriority; | |
| 489 | + unsigned char __reserved; | |
| 490 | + __u32 allot; | |
| 491 | + __u32 weight; | |
| 492 | +}; | |
| 493 | + | |
| 494 | +struct tc_cbq_ovl { | |
| 495 | + unsigned char strategy; | |
| 496 | +#define TC_CBQ_OVL_CLASSIC 0 | |
| 497 | +#define TC_CBQ_OVL_DELAY 1 | |
| 498 | +#define TC_CBQ_OVL_LOWPRIO 2 | |
| 499 | +#define TC_CBQ_OVL_DROP 3 | |
| 500 | +#define TC_CBQ_OVL_RCLASSIC 4 | |
| 501 | + unsigned char priority2; | |
| 502 | + __u16 pad; | |
| 503 | + __u32 penalty; | |
| 504 | +}; | |
| 505 | + | |
| 506 | +struct tc_cbq_police { | |
| 507 | + unsigned char police; | |
| 508 | + unsigned char __res1; | |
| 509 | + unsigned short __res2; | |
| 510 | +}; | |
| 511 | + | |
| 512 | +struct tc_cbq_fopt { | |
| 513 | + __u32 split; | |
| 514 | + __u32 defmap; | |
| 515 | + __u32 defchange; | |
| 516 | +}; | |
| 517 | + | |
| 518 | +struct tc_cbq_xstats { | |
| 519 | + __u32 borrows; | |
| 520 | + __u32 overactions; | |
| 521 | + __s32 avgidle; | |
| 522 | + __s32 undertime; | |
| 523 | +}; | |
| 524 | + | |
| 525 | +enum { | |
| 526 | + TCA_CBQ_UNSPEC, | |
| 527 | + TCA_CBQ_LSSOPT, | |
| 528 | + TCA_CBQ_WRROPT, | |
| 529 | + TCA_CBQ_FOPT, | |
| 530 | + TCA_CBQ_OVL_STRATEGY, | |
| 531 | + TCA_CBQ_RATE, | |
| 532 | + TCA_CBQ_RTAB, | |
| 533 | + TCA_CBQ_POLICE, | |
| 534 | + __TCA_CBQ_MAX, | |
| 535 | +}; | |
| 536 | + | |
| 537 | +#define TCA_CBQ_MAX (__TCA_CBQ_MAX - 1) | |
| 538 | + | |
| 539 | +/* dsmark section */ | |
| 540 | + | |
| 541 | +enum { | |
| 542 | + TCA_DSMARK_UNSPEC, | |
| 543 | + TCA_DSMARK_INDICES, | |
| 544 | + TCA_DSMARK_DEFAULT_INDEX, | |
| 545 | + TCA_DSMARK_SET_TC_INDEX, | |
| 546 | + TCA_DSMARK_MASK, | |
| 547 | + TCA_DSMARK_VALUE, | |
| 548 | + __TCA_DSMARK_MAX, | |
| 549 | +}; | |
| 550 | + | |
| 551 | +#define TCA_DSMARK_MAX (__TCA_DSMARK_MAX - 1) | |
| 552 | + | |
| 553 | +/* ATM section */ | |
| 554 | + | |
| 555 | +enum { | |
| 556 | + TCA_ATM_UNSPEC, | |
| 557 | + TCA_ATM_FD, /* file/socket descriptor */ | |
| 558 | + TCA_ATM_PTR, /* pointer to descriptor - later */ | |
| 559 | + TCA_ATM_HDR, /* LL header */ | |
| 560 | + TCA_ATM_EXCESS, /* excess traffic class (0 for CLP) */ | |
| 561 | + TCA_ATM_ADDR, /* PVC address (for output only) */ | |
| 562 | + TCA_ATM_STATE, /* VC state (ATM_VS_*; for output only) */ | |
| 563 | + __TCA_ATM_MAX, | |
| 564 | +}; | |
| 565 | + | |
| 566 | +#define TCA_ATM_MAX (__TCA_ATM_MAX - 1) | |
| 567 | + | |
| 568 | +/* Network emulator */ | |
| 569 | + | |
| 570 | +enum { | |
| 571 | + TCA_NETEM_UNSPEC, | |
| 572 | + TCA_NETEM_CORR, | |
| 573 | + TCA_NETEM_DELAY_DIST, | |
| 574 | + TCA_NETEM_REORDER, | |
| 575 | + TCA_NETEM_CORRUPT, | |
| 576 | + TCA_NETEM_LOSS, | |
| 577 | + TCA_NETEM_RATE, | |
| 578 | + TCA_NETEM_ECN, | |
| 579 | + TCA_NETEM_RATE64, | |
| 580 | + TCA_NETEM_PAD, | |
| 581 | + TCA_NETEM_LATENCY64, | |
| 582 | + TCA_NETEM_JITTER64, | |
| 583 | + TCA_NETEM_SLOT, | |
| 584 | + TCA_NETEM_SLOT_DIST, | |
| 585 | + __TCA_NETEM_MAX, | |
| 586 | +}; | |
| 587 | + | |
| 588 | +#define TCA_NETEM_MAX (__TCA_NETEM_MAX - 1) | |
| 589 | + | |
| 590 | +struct tc_netem_qopt { | |
| 591 | + __u32 latency; /* added delay (us) */ | |
| 592 | + __u32 limit; /* fifo limit (packets) */ | |
| 593 | + __u32 loss; /* random packet loss (0=none ~0=100%) */ | |
| 594 | + __u32 gap; /* re-ordering gap (0 for none) */ | |
| 595 | + __u32 duplicate; /* random packet dup (0=none ~0=100%) */ | |
| 596 | + __u32 jitter; /* random jitter in latency (us) */ | |
| 597 | +}; | |
| 598 | + | |
| 599 | +struct tc_netem_corr { | |
| 600 | + __u32 delay_corr; /* delay correlation */ | |
| 601 | + __u32 loss_corr; /* packet loss correlation */ | |
| 602 | + __u32 dup_corr; /* duplicate correlation */ | |
| 603 | +}; | |
| 604 | + | |
| 605 | +struct tc_netem_reorder { | |
| 606 | + __u32 probability; | |
| 607 | + __u32 correlation; | |
| 608 | +}; | |
| 609 | + | |
| 610 | +struct tc_netem_corrupt { | |
| 611 | + __u32 probability; | |
| 612 | + __u32 correlation; | |
| 613 | +}; | |
| 614 | + | |
| 615 | +struct tc_netem_rate { | |
| 616 | + __u32 rate; /* byte/s */ | |
| 617 | + __s32 packet_overhead; | |
| 618 | + __u32 cell_size; | |
| 619 | + __s32 cell_overhead; | |
| 620 | +}; | |
| 621 | + | |
| 622 | +struct tc_netem_slot { | |
| 623 | + __s64 min_delay; /* nsec */ | |
| 624 | + __s64 max_delay; | |
| 625 | + __s32 max_packets; | |
| 626 | + __s32 max_bytes; | |
| 627 | + __s64 dist_delay; /* nsec */ | |
| 628 | + __s64 dist_jitter; /* nsec */ | |
| 629 | +}; | |
| 630 | + | |
| 631 | +enum { | |
| 632 | + NETEM_LOSS_UNSPEC, | |
| 633 | + NETEM_LOSS_GI, /* General Intuitive - 4 state model */ | |
| 634 | + NETEM_LOSS_GE, /* Gilbert Elliot models */ | |
| 635 | + __NETEM_LOSS_MAX | |
| 636 | +}; | |
| 637 | +#define NETEM_LOSS_MAX (__NETEM_LOSS_MAX - 1) | |
| 638 | + | |
| 639 | +/* State transition probabilities for 4 state model */ | |
| 640 | +struct tc_netem_gimodel { | |
| 641 | + __u32 p13; | |
| 642 | + __u32 p31; | |
| 643 | + __u32 p32; | |
| 644 | + __u32 p14; | |
| 645 | + __u32 p23; | |
| 646 | +}; | |
| 647 | + | |
| 648 | +/* Gilbert-Elliot models */ | |
| 649 | +struct tc_netem_gemodel { | |
| 650 | + __u32 p; | |
| 651 | + __u32 r; | |
| 652 | + __u32 h; | |
| 653 | + __u32 k1; | |
| 654 | +}; | |
| 655 | + | |
| 656 | +#define NETEM_DIST_SCALE 8192 | |
| 657 | +#define NETEM_DIST_MAX 16384 | |
| 658 | + | |
| 659 | +/* DRR */ | |
| 660 | + | |
| 661 | +enum { | |
| 662 | + TCA_DRR_UNSPEC, | |
| 663 | + TCA_DRR_QUANTUM, | |
| 664 | + __TCA_DRR_MAX | |
| 665 | +}; | |
| 666 | + | |
| 667 | +#define TCA_DRR_MAX (__TCA_DRR_MAX - 1) | |
| 668 | + | |
| 669 | +struct tc_drr_stats { | |
| 670 | + __u32 deficit; | |
| 671 | +}; | |
| 672 | + | |
| 673 | +/* MQPRIO */ | |
| 674 | +#define TC_QOPT_BITMASK 15 | |
| 675 | +#define TC_QOPT_MAX_QUEUE 16 | |
| 676 | + | |
| 677 | +enum { | |
| 678 | + TC_MQPRIO_HW_OFFLOAD_NONE, /* no offload requested */ | |
| 679 | + TC_MQPRIO_HW_OFFLOAD_TCS, /* offload TCs, no queue counts */ | |
| 680 | + __TC_MQPRIO_HW_OFFLOAD_MAX | |
| 681 | +}; | |
| 682 | + | |
| 683 | +#define TC_MQPRIO_HW_OFFLOAD_MAX (__TC_MQPRIO_HW_OFFLOAD_MAX - 1) | |
| 684 | + | |
| 685 | +enum { | |
| 686 | + TC_MQPRIO_MODE_DCB, | |
| 687 | + TC_MQPRIO_MODE_CHANNEL, | |
| 688 | + __TC_MQPRIO_MODE_MAX | |
| 689 | +}; | |
| 690 | + | |
| 691 | +#define __TC_MQPRIO_MODE_MAX (__TC_MQPRIO_MODE_MAX - 1) | |
| 692 | + | |
| 693 | +enum { | |
| 694 | + TC_MQPRIO_SHAPER_DCB, | |
| 695 | + TC_MQPRIO_SHAPER_BW_RATE, /* Add new shapers below */ | |
| 696 | + __TC_MQPRIO_SHAPER_MAX | |
| 697 | +}; | |
| 698 | + | |
| 699 | +#define __TC_MQPRIO_SHAPER_MAX (__TC_MQPRIO_SHAPER_MAX - 1) | |
| 700 | + | |
| 701 | +struct tc_mqprio_qopt { | |
| 702 | + __u8 num_tc; | |
| 703 | + __u8 prio_tc_map[TC_QOPT_BITMASK + 1]; | |
| 704 | + __u8 hw; | |
| 705 | + __u16 count[TC_QOPT_MAX_QUEUE]; | |
| 706 | + __u16 offset[TC_QOPT_MAX_QUEUE]; | |
| 707 | +}; | |
| 708 | + | |
| 709 | +#define TC_MQPRIO_F_MODE 0x1 | |
| 710 | +#define TC_MQPRIO_F_SHAPER 0x2 | |
| 711 | +#define TC_MQPRIO_F_MIN_RATE 0x4 | |
| 712 | +#define TC_MQPRIO_F_MAX_RATE 0x8 | |
| 713 | + | |
| 714 | +enum { | |
| 715 | + TCA_MQPRIO_UNSPEC, | |
| 716 | + TCA_MQPRIO_MODE, | |
| 717 | + TCA_MQPRIO_SHAPER, | |
| 718 | + TCA_MQPRIO_MIN_RATE64, | |
| 719 | + TCA_MQPRIO_MAX_RATE64, | |
| 720 | + __TCA_MQPRIO_MAX, | |
| 721 | +}; | |
| 722 | + | |
| 723 | +#define TCA_MQPRIO_MAX (__TCA_MQPRIO_MAX - 1) | |
| 724 | + | |
| 725 | +/* SFB */ | |
| 726 | + | |
| 727 | +enum { | |
| 728 | + TCA_SFB_UNSPEC, | |
| 729 | + TCA_SFB_PARMS, | |
| 730 | + __TCA_SFB_MAX, | |
| 731 | +}; | |
| 732 | + | |
| 733 | +#define TCA_SFB_MAX (__TCA_SFB_MAX - 1) | |
| 734 | + | |
| 735 | +/* | |
| 736 | + * Note: increment, decrement are Q0.16 fixed-point values. | |
| 737 | + */ | |
| 738 | +struct tc_sfb_qopt { | |
| 739 | + __u32 rehash_interval; /* delay between hash move, in ms */ | |
| 740 | + __u32 warmup_time; /* double buffering warmup time in ms (warmup_time < rehash_interval) */ | |
| 741 | + __u32 max; /* max len of qlen_min */ | |
| 742 | + __u32 bin_size; /* maximum queue length per bin */ | |
| 743 | + __u32 increment; /* probability increment, (d1 in Blue) */ | |
| 744 | + __u32 decrement; /* probability decrement, (d2 in Blue) */ | |
| 745 | + __u32 limit; /* max SFB queue length */ | |
| 746 | + __u32 penalty_rate; /* inelastic flows are rate limited to 'rate' pps */ | |
| 747 | + __u32 penalty_burst; | |
| 748 | +}; | |
| 749 | + | |
| 750 | +struct tc_sfb_xstats { | |
| 751 | + __u32 earlydrop; | |
| 752 | + __u32 penaltydrop; | |
| 753 | + __u32 bucketdrop; | |
| 754 | + __u32 queuedrop; | |
| 755 | + __u32 childdrop; /* drops in child qdisc */ | |
| 756 | + __u32 marked; | |
| 757 | + __u32 maxqlen; | |
| 758 | + __u32 maxprob; | |
| 759 | + __u32 avgprob; | |
| 760 | +}; | |
| 761 | + | |
| 762 | +#define SFB_MAX_PROB 0xFFFF | |
| 763 | + | |
| 764 | +/* QFQ */ | |
| 765 | +enum { | |
| 766 | + TCA_QFQ_UNSPEC, | |
| 767 | + TCA_QFQ_WEIGHT, | |
| 768 | + TCA_QFQ_LMAX, | |
| 769 | + __TCA_QFQ_MAX | |
| 770 | +}; | |
| 771 | + | |
| 772 | +#define TCA_QFQ_MAX (__TCA_QFQ_MAX - 1) | |
| 773 | + | |
| 774 | +struct tc_qfq_stats { | |
| 775 | + __u32 weight; | |
| 776 | + __u32 lmax; | |
| 777 | +}; | |
| 778 | + | |
| 779 | +/* CODEL */ | |
| 780 | + | |
| 781 | +enum { | |
| 782 | + TCA_CODEL_UNSPEC, | |
| 783 | + TCA_CODEL_TARGET, | |
| 784 | + TCA_CODEL_LIMIT, | |
| 785 | + TCA_CODEL_INTERVAL, | |
| 786 | + TCA_CODEL_ECN, | |
| 787 | + TCA_CODEL_CE_THRESHOLD, | |
| 788 | + __TCA_CODEL_MAX | |
| 789 | +}; | |
| 790 | + | |
| 791 | +#define TCA_CODEL_MAX (__TCA_CODEL_MAX - 1) | |
| 792 | + | |
| 793 | +struct tc_codel_xstats { | |
| 794 | + __u32 maxpacket; /* largest packet we've seen so far */ | |
| 795 | + __u32 count; /* how many drops we've done since the last time we | |
| 796 | + * entered dropping state | |
| 797 | + */ | |
| 798 | + __u32 lastcount; /* count at entry to dropping state */ | |
| 799 | + __u32 ldelay; /* in-queue delay seen by most recently dequeued packet */ | |
| 800 | + __s32 drop_next; /* time to drop next packet */ | |
| 801 | + __u32 drop_overlimit; /* number of time max qdisc packet limit was hit */ | |
| 802 | + __u32 ecn_mark; /* number of packets we ECN marked instead of dropped */ | |
| 803 | + __u32 dropping; /* are we in dropping state ? */ | |
| 804 | + __u32 ce_mark; /* number of CE marked packets because of ce_threshold */ | |
| 805 | +}; | |
| 806 | + | |
| 807 | +/* FQ_CODEL */ | |
| 808 | + | |
| 809 | +enum { | |
| 810 | + TCA_FQ_CODEL_UNSPEC, | |
| 811 | + TCA_FQ_CODEL_TARGET, | |
| 812 | + TCA_FQ_CODEL_LIMIT, | |
| 813 | + TCA_FQ_CODEL_INTERVAL, | |
| 814 | + TCA_FQ_CODEL_ECN, | |
| 815 | + TCA_FQ_CODEL_FLOWS, | |
| 816 | + TCA_FQ_CODEL_QUANTUM, | |
| 817 | + TCA_FQ_CODEL_CE_THRESHOLD, | |
| 818 | + TCA_FQ_CODEL_DROP_BATCH_SIZE, | |
| 819 | + TCA_FQ_CODEL_MEMORY_LIMIT, | |
| 820 | + __TCA_FQ_CODEL_MAX | |
| 821 | +}; | |
| 822 | + | |
| 823 | +#define TCA_FQ_CODEL_MAX (__TCA_FQ_CODEL_MAX - 1) | |
| 824 | + | |
| 825 | +enum { | |
| 826 | + TCA_FQ_CODEL_XSTATS_QDISC, | |
| 827 | + TCA_FQ_CODEL_XSTATS_CLASS, | |
| 828 | +}; | |
| 829 | + | |
| 830 | +struct tc_fq_codel_qd_stats { | |
| 831 | + __u32 maxpacket; /* largest packet we've seen so far */ | |
| 832 | + __u32 drop_overlimit; /* number of time max qdisc | |
| 833 | + * packet limit was hit | |
| 834 | + */ | |
| 835 | + __u32 ecn_mark; /* number of packets we ECN marked | |
| 836 | + * instead of being dropped | |
| 837 | + */ | |
| 838 | + __u32 new_flow_count; /* number of time packets | |
| 839 | + * created a 'new flow' | |
| 840 | + */ | |
| 841 | + __u32 new_flows_len; /* count of flows in new list */ | |
| 842 | + __u32 old_flows_len; /* count of flows in old list */ | |
| 843 | + __u32 ce_mark; /* packets above ce_threshold */ | |
| 844 | + __u32 memory_usage; /* in bytes */ | |
| 845 | + __u32 drop_overmemory; | |
| 846 | +}; | |
| 847 | + | |
| 848 | +struct tc_fq_codel_cl_stats { | |
| 849 | + __s32 deficit; | |
| 850 | + __u32 ldelay; /* in-queue delay seen by most recently | |
| 851 | + * dequeued packet | |
| 852 | + */ | |
| 853 | + __u32 count; | |
| 854 | + __u32 lastcount; | |
| 855 | + __u32 dropping; | |
| 856 | + __s32 drop_next; | |
| 857 | +}; | |
| 858 | + | |
| 859 | +struct tc_fq_codel_xstats { | |
| 860 | + __u32 type; | |
| 861 | + union { | |
| 862 | + struct tc_fq_codel_qd_stats qdisc_stats; | |
| 863 | + struct tc_fq_codel_cl_stats class_stats; | |
| 864 | + }; | |
| 865 | +}; | |
| 866 | + | |
| 867 | +/* FQ */ | |
| 868 | + | |
| 869 | +enum { | |
| 870 | + TCA_FQ_UNSPEC, | |
| 871 | + | |
| 872 | + TCA_FQ_PLIMIT, /* limit of total number of packets in queue */ | |
| 873 | + | |
| 874 | + TCA_FQ_FLOW_PLIMIT, /* limit of packets per flow */ | |
| 875 | + | |
| 876 | + TCA_FQ_QUANTUM, /* RR quantum */ | |
| 877 | + | |
| 878 | + TCA_FQ_INITIAL_QUANTUM, /* RR quantum for new flow */ | |
| 879 | + | |
| 880 | + TCA_FQ_RATE_ENABLE, /* enable/disable rate limiting */ | |
| 881 | + | |
| 882 | + TCA_FQ_FLOW_DEFAULT_RATE,/* obsolete, do not use */ | |
| 883 | + | |
| 884 | + TCA_FQ_FLOW_MAX_RATE, /* per flow max rate */ | |
| 885 | + | |
| 886 | + TCA_FQ_BUCKETS_LOG, /* log2(number of buckets) */ | |
| 887 | + | |
| 888 | + TCA_FQ_FLOW_REFILL_DELAY, /* flow credit refill delay in usec */ | |
| 889 | + | |
| 890 | + TCA_FQ_ORPHAN_MASK, /* mask applied to orphaned skb hashes */ | |
| 891 | + | |
| 892 | + TCA_FQ_LOW_RATE_THRESHOLD, /* per packet delay under this rate */ | |
| 893 | + | |
| 894 | + TCA_FQ_CE_THRESHOLD, /* DCTCP-like CE-marking threshold */ | |
| 895 | + | |
| 896 | + __TCA_FQ_MAX | |
| 897 | +}; | |
| 898 | + | |
| 899 | +#define TCA_FQ_MAX (__TCA_FQ_MAX - 1) | |
| 900 | + | |
| 901 | +struct tc_fq_qd_stats { | |
| 902 | + __u64 gc_flows; | |
| 903 | + __u64 highprio_packets; | |
| 904 | + __u64 tcp_retrans; | |
| 905 | + __u64 throttled; | |
| 906 | + __u64 flows_plimit; | |
| 907 | + __u64 pkts_too_long; | |
| 908 | + __u64 allocation_errors; | |
| 909 | + __s64 time_next_delayed_flow; | |
| 910 | + __u32 flows; | |
| 911 | + __u32 inactive_flows; | |
| 912 | + __u32 throttled_flows; | |
| 913 | + __u32 unthrottle_latency_ns; | |
| 914 | + __u64 ce_mark; /* packets above ce_threshold */ | |
| 915 | +}; | |
| 916 | + | |
| 917 | +/* Heavy-Hitter Filter */ | |
| 918 | + | |
| 919 | +enum { | |
| 920 | + TCA_HHF_UNSPEC, | |
| 921 | + TCA_HHF_BACKLOG_LIMIT, | |
| 922 | + TCA_HHF_QUANTUM, | |
| 923 | + TCA_HHF_HH_FLOWS_LIMIT, | |
| 924 | + TCA_HHF_RESET_TIMEOUT, | |
| 925 | + TCA_HHF_ADMIT_BYTES, | |
| 926 | + TCA_HHF_EVICT_TIMEOUT, | |
| 927 | + TCA_HHF_NON_HH_WEIGHT, | |
| 928 | + __TCA_HHF_MAX | |
| 929 | +}; | |
| 930 | + | |
| 931 | +#define TCA_HHF_MAX (__TCA_HHF_MAX - 1) | |
| 932 | + | |
| 933 | +struct tc_hhf_xstats { | |
| 934 | + __u32 drop_overlimit; /* number of times max qdisc packet limit | |
| 935 | + * was hit | |
| 936 | + */ | |
| 937 | + __u32 hh_overlimit; /* number of times max heavy-hitters was hit */ | |
| 938 | + __u32 hh_tot_count; /* number of captured heavy-hitters so far */ | |
| 939 | + __u32 hh_cur_count; /* number of current heavy-hitters */ | |
| 940 | +}; | |
| 941 | + | |
| 942 | +/* PIE */ | |
| 943 | +enum { | |
| 944 | + TCA_PIE_UNSPEC, | |
| 945 | + TCA_PIE_TARGET, | |
| 946 | + TCA_PIE_LIMIT, | |
| 947 | + TCA_PIE_TUPDATE, | |
| 948 | + TCA_PIE_ALPHA, | |
| 949 | + TCA_PIE_BETA, | |
| 950 | + TCA_PIE_ECN, | |
| 951 | + TCA_PIE_BYTEMODE, | |
| 952 | + __TCA_PIE_MAX | |
| 953 | +}; | |
| 954 | +#define TCA_PIE_MAX (__TCA_PIE_MAX - 1) | |
| 955 | + | |
| 956 | +struct tc_pie_xstats { | |
| 957 | + __u32 prob; /* current probability */ | |
| 958 | + __u32 delay; /* current delay in ms */ | |
| 959 | + __u32 avg_dq_rate; /* current average dq_rate in bits/pie_time */ | |
| 960 | + __u32 packets_in; /* total number of packets enqueued */ | |
| 961 | + __u32 dropped; /* packets dropped due to pie_action */ | |
| 962 | + __u32 overlimit; /* dropped due to lack of space in queue */ | |
| 963 | + __u32 maxq; /* maximum queue size */ | |
| 964 | + __u32 ecn_mark; /* packets marked with ecn*/ | |
| 965 | +}; | |
| 966 | + | |
| 967 | +/* CBS */ | |
| 968 | +struct tc_cbs_qopt { | |
| 969 | + __u8 offload; | |
| 970 | + __u8 _pad[3]; | |
| 971 | + __s32 hicredit; | |
| 972 | + __s32 locredit; | |
| 973 | + __s32 idleslope; | |
| 974 | + __s32 sendslope; | |
| 975 | +}; | |
| 976 | + | |
| 977 | +enum { | |
| 978 | + TCA_CBS_UNSPEC, | |
| 979 | + TCA_CBS_PARMS, | |
| 980 | + __TCA_CBS_MAX, | |
| 981 | +}; | |
| 982 | + | |
| 983 | +#define TCA_CBS_MAX (__TCA_CBS_MAX - 1) | |
| 984 | + | |
| 985 | + | |
| 986 | +/* ETF */ | |
| 987 | +struct tc_etf_qopt { | |
| 988 | + __s32 delta; | |
| 989 | + __s32 clockid; | |
| 990 | + __u32 flags; | |
| 991 | +#define TC_ETF_DEADLINE_MODE_ON BIT(0) | |
| 992 | +#define TC_ETF_OFFLOAD_ON BIT(1) | |
| 993 | +}; | |
| 994 | + | |
| 995 | +enum { | |
| 996 | + TCA_ETF_UNSPEC, | |
| 997 | + TCA_ETF_PARMS, | |
| 998 | + __TCA_ETF_MAX, | |
| 999 | +}; | |
| 1000 | + | |
| 1001 | +#define TCA_ETF_MAX (__TCA_ETF_MAX - 1) | |
| 1002 | + | |
| 1003 | + | |
| 1004 | +/* CAKE */ | |
| 1005 | +enum { | |
| 1006 | + TCA_CAKE_UNSPEC, | |
| 1007 | + TCA_CAKE_PAD, | |
| 1008 | + TCA_CAKE_BASE_RATE64, | |
| 1009 | + TCA_CAKE_DIFFSERV_MODE, | |
| 1010 | + TCA_CAKE_ATM, | |
| 1011 | + TCA_CAKE_FLOW_MODE, | |
| 1012 | + TCA_CAKE_OVERHEAD, | |
| 1013 | + TCA_CAKE_RTT, | |
| 1014 | + TCA_CAKE_TARGET, | |
| 1015 | + TCA_CAKE_AUTORATE, | |
| 1016 | + TCA_CAKE_MEMORY, | |
| 1017 | + TCA_CAKE_NAT, | |
| 1018 | + TCA_CAKE_RAW, | |
| 1019 | + TCA_CAKE_WASH, | |
| 1020 | + TCA_CAKE_MPU, | |
| 1021 | + TCA_CAKE_INGRESS, | |
| 1022 | + TCA_CAKE_ACK_FILTER, | |
| 1023 | + TCA_CAKE_SPLIT_GSO, | |
| 1024 | + __TCA_CAKE_MAX | |
| 1025 | +}; | |
| 1026 | +#define TCA_CAKE_MAX (__TCA_CAKE_MAX - 1) | |
| 1027 | + | |
| 1028 | +enum { | |
| 1029 | + __TCA_CAKE_STATS_INVALID, | |
| 1030 | + TCA_CAKE_STATS_PAD, | |
| 1031 | + TCA_CAKE_STATS_CAPACITY_ESTIMATE64, | |
| 1032 | + TCA_CAKE_STATS_MEMORY_LIMIT, | |
| 1033 | + TCA_CAKE_STATS_MEMORY_USED, | |
| 1034 | + TCA_CAKE_STATS_AVG_NETOFF, | |
| 1035 | + TCA_CAKE_STATS_MIN_NETLEN, | |
| 1036 | + TCA_CAKE_STATS_MAX_NETLEN, | |
| 1037 | + TCA_CAKE_STATS_MIN_ADJLEN, | |
| 1038 | + TCA_CAKE_STATS_MAX_ADJLEN, | |
| 1039 | + TCA_CAKE_STATS_TIN_STATS, | |
| 1040 | + TCA_CAKE_STATS_DEFICIT, | |
| 1041 | + TCA_CAKE_STATS_COBALT_COUNT, | |
| 1042 | + TCA_CAKE_STATS_DROPPING, | |
| 1043 | + TCA_CAKE_STATS_DROP_NEXT_US, | |
| 1044 | + TCA_CAKE_STATS_P_DROP, | |
| 1045 | + TCA_CAKE_STATS_BLUE_TIMER_US, | |
| 1046 | + __TCA_CAKE_STATS_MAX | |
| 1047 | +}; | |
| 1048 | +#define TCA_CAKE_STATS_MAX (__TCA_CAKE_STATS_MAX - 1) | |
| 1049 | + | |
| 1050 | +enum { | |
| 1051 | + __TCA_CAKE_TIN_STATS_INVALID, | |
| 1052 | + TCA_CAKE_TIN_STATS_PAD, | |
| 1053 | + TCA_CAKE_TIN_STATS_SENT_PACKETS, | |
| 1054 | + TCA_CAKE_TIN_STATS_SENT_BYTES64, | |
| 1055 | + TCA_CAKE_TIN_STATS_DROPPED_PACKETS, | |
| 1056 | + TCA_CAKE_TIN_STATS_DROPPED_BYTES64, | |
| 1057 | + TCA_CAKE_TIN_STATS_ACKS_DROPPED_PACKETS, | |
| 1058 | + TCA_CAKE_TIN_STATS_ACKS_DROPPED_BYTES64, | |
| 1059 | + TCA_CAKE_TIN_STATS_ECN_MARKED_PACKETS, | |
| 1060 | + TCA_CAKE_TIN_STATS_ECN_MARKED_BYTES64, | |
| 1061 | + TCA_CAKE_TIN_STATS_BACKLOG_PACKETS, | |
| 1062 | + TCA_CAKE_TIN_STATS_BACKLOG_BYTES, | |
| 1063 | + TCA_CAKE_TIN_STATS_THRESHOLD_RATE64, | |
| 1064 | + TCA_CAKE_TIN_STATS_TARGET_US, | |
| 1065 | + TCA_CAKE_TIN_STATS_INTERVAL_US, | |
| 1066 | + TCA_CAKE_TIN_STATS_WAY_INDIRECT_HITS, | |
| 1067 | + TCA_CAKE_TIN_STATS_WAY_MISSES, | |
| 1068 | + TCA_CAKE_TIN_STATS_WAY_COLLISIONS, | |
| 1069 | + TCA_CAKE_TIN_STATS_PEAK_DELAY_US, | |
| 1070 | + TCA_CAKE_TIN_STATS_AVG_DELAY_US, | |
| 1071 | + TCA_CAKE_TIN_STATS_BASE_DELAY_US, | |
| 1072 | + TCA_CAKE_TIN_STATS_SPARSE_FLOWS, | |
| 1073 | + TCA_CAKE_TIN_STATS_BULK_FLOWS, | |
| 1074 | + TCA_CAKE_TIN_STATS_UNRESPONSIVE_FLOWS, | |
| 1075 | + TCA_CAKE_TIN_STATS_MAX_SKBLEN, | |
| 1076 | + TCA_CAKE_TIN_STATS_FLOW_QUANTUM, | |
| 1077 | + __TCA_CAKE_TIN_STATS_MAX | |
| 1078 | +}; | |
| 1079 | +#define TCA_CAKE_TIN_STATS_MAX (__TCA_CAKE_TIN_STATS_MAX - 1) | |
| 1080 | +#define TC_CAKE_MAX_TINS (8) | |
| 1081 | + | |
| 1082 | +enum { | |
| 1083 | + CAKE_FLOW_NONE = 0, | |
| 1084 | + CAKE_FLOW_SRC_IP, | |
| 1085 | + CAKE_FLOW_DST_IP, | |
| 1086 | + CAKE_FLOW_HOSTS, /* = CAKE_FLOW_SRC_IP | CAKE_FLOW_DST_IP */ | |
| 1087 | + CAKE_FLOW_FLOWS, | |
| 1088 | + CAKE_FLOW_DUAL_SRC, /* = CAKE_FLOW_SRC_IP | CAKE_FLOW_FLOWS */ | |
| 1089 | + CAKE_FLOW_DUAL_DST, /* = CAKE_FLOW_DST_IP | CAKE_FLOW_FLOWS */ | |
| 1090 | + CAKE_FLOW_TRIPLE, /* = CAKE_FLOW_HOSTS | CAKE_FLOW_FLOWS */ | |
| 1091 | + CAKE_FLOW_MAX, | |
| 1092 | +}; | |
| 1093 | + | |
| 1094 | +enum { | |
| 1095 | + CAKE_DIFFSERV_DIFFSERV3 = 0, | |
| 1096 | + CAKE_DIFFSERV_DIFFSERV4, | |
| 1097 | + CAKE_DIFFSERV_DIFFSERV8, | |
| 1098 | + CAKE_DIFFSERV_BESTEFFORT, | |
| 1099 | + CAKE_DIFFSERV_PRECEDENCE, | |
| 1100 | + CAKE_DIFFSERV_MAX | |
| 1101 | +}; | |
| 1102 | + | |
| 1103 | +enum { | |
| 1104 | + CAKE_ACK_NONE = 0, | |
| 1105 | + CAKE_ACK_FILTER, | |
| 1106 | + CAKE_ACK_AGGRESSIVE, | |
| 1107 | + CAKE_ACK_MAX | |
| 1108 | +}; | |
| 1109 | + | |
| 1110 | +enum { | |
| 1111 | + CAKE_ATM_NONE = 0, | |
| 1112 | + CAKE_ATM_ATM, | |
| 1113 | + CAKE_ATM_PTM, | |
| 1114 | + CAKE_ATM_MAX | |
| 1115 | +}; | |
| 1116 | + | |
| 1117 | + | |
| 1118 | +/* TAPRIO */ | |
| 1119 | +enum { | |
| 1120 | + TC_TAPRIO_CMD_SET_GATES = 0x00, | |
| 1121 | + TC_TAPRIO_CMD_SET_AND_HOLD = 0x01, | |
| 1122 | + TC_TAPRIO_CMD_SET_AND_RELEASE = 0x02, | |
| 1123 | +}; | |
| 1124 | + | |
| 1125 | +enum { | |
| 1126 | + TCA_TAPRIO_SCHED_ENTRY_UNSPEC, | |
| 1127 | + TCA_TAPRIO_SCHED_ENTRY_INDEX, /* u32 */ | |
| 1128 | + TCA_TAPRIO_SCHED_ENTRY_CMD, /* u8 */ | |
| 1129 | + TCA_TAPRIO_SCHED_ENTRY_GATE_MASK, /* u32 */ | |
| 1130 | + TCA_TAPRIO_SCHED_ENTRY_INTERVAL, /* u32 */ | |
| 1131 | + __TCA_TAPRIO_SCHED_ENTRY_MAX, | |
| 1132 | +}; | |
| 1133 | +#define TCA_TAPRIO_SCHED_ENTRY_MAX (__TCA_TAPRIO_SCHED_ENTRY_MAX - 1) | |
| 1134 | + | |
| 1135 | +/* The format for schedule entry list is: | |
| 1136 | + * [TCA_TAPRIO_SCHED_ENTRY_LIST] | |
| 1137 | + * [TCA_TAPRIO_SCHED_ENTRY] | |
| 1138 | + * [TCA_TAPRIO_SCHED_ENTRY_CMD] | |
| 1139 | + * [TCA_TAPRIO_SCHED_ENTRY_GATES] | |
| 1140 | + * [TCA_TAPRIO_SCHED_ENTRY_INTERVAL] | |
| 1141 | + */ | |
| 1142 | +enum { | |
| 1143 | + TCA_TAPRIO_SCHED_UNSPEC, | |
| 1144 | + TCA_TAPRIO_SCHED_ENTRY, | |
| 1145 | + __TCA_TAPRIO_SCHED_MAX, | |
| 1146 | +}; | |
| 1147 | + | |
| 1148 | +#define TCA_TAPRIO_SCHED_MAX (__TCA_TAPRIO_SCHED_MAX - 1) | |
| 1149 | + | |
| 1150 | +enum { | |
| 1151 | + TCA_TAPRIO_ATTR_UNSPEC, | |
| 1152 | + TCA_TAPRIO_ATTR_PRIOMAP, /* struct tc_mqprio_qopt */ | |
| 1153 | + TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST, /* nested of entry */ | |
| 1154 | + TCA_TAPRIO_ATTR_SCHED_BASE_TIME, /* s64 */ | |
| 1155 | + TCA_TAPRIO_ATTR_SCHED_SINGLE_ENTRY, /* single entry */ | |
| 1156 | + TCA_TAPRIO_ATTR_SCHED_CLOCKID, /* s32 */ | |
| 1157 | + TCA_TAPRIO_PAD, | |
| 1158 | + __TCA_TAPRIO_ATTR_MAX, | |
| 1159 | +}; | |
| 1160 | + | |
| 1161 | +#define TCA_TAPRIO_ATTR_MAX (__TCA_TAPRIO_ATTR_MAX - 1) | |
| 1162 | + | |
| 1163 | +#endif | |
| @@ -65,6 +65,17 @@ static inline int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr, · 64 unmodified lines | ||
| 65 | 65 | return syscall(__NR_bpf, cmd, attr, size); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | +static inline int sys_bpf_prog_load(union bpf_attr *attr, unsigned int size) | |
| 69 | +{ | |
| 70 | + int fd; | |
| 71 | + | |
| 72 | + do { | |
| 73 | + fd = sys_bpf(BPF_PROG_LOAD, attr, size); | |
| 74 | + } while (fd < 0 && errno == EAGAIN); | |
| 75 | + | |
| 76 | + return fd; | |
| 77 | +} | |
| 78 | + | |
| 68 | 79 | int bpf_create_map_xattr(const struct bpf_create_map_attr *create_attr) |
| 69 | 80 | { |
| 70 | 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, · 161 unmodified lines | ||
| 232 | 243 | memcpy(attr.prog_name, load_attr->name, |
| 233 | 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 | 247 | if (fd >= 0) |
| 237 | 248 | return fd; |
| 238 | 249 | |
| @@ -269,7 +280,7 @@ int bpf_load_program_xattr(const struct bpf_load_program_attr *load_attr, · 30 unmodified lines | ||
| 269 | 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 | 285 | if (fd >= 0) |
| 275 | 286 | goto done; |
| @@ -283,7 +294,7 @@ int bpf_load_program_xattr(const struct bpf_load_program_attr *load_attr, · 7 unmodified lines | ||
| 283 | 294 | attr.log_size = log_buf_sz; |
| 284 | 295 | attr.log_level = 1; |
| 285 | 296 | log_buf[0] = 0; |
| 286 | − fd = sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); | |
| 297 | + fd = sys_bpf_prog_load(&attr, sizeof(attr)); | |
| 287 | 298 | done: |
| 288 | 299 | free(finfo); |
| 289 | 300 | free(linfo); |
| @@ -328,7 +339,7 @@ int bpf_verify_program(enum bpf_prog_type type, const struct bpf_insn *insns, · 38 unmodified lines | ||
| 328 | 339 | attr.kern_version = kern_version; |
| 329 | 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 | |
| 334 | 345 | int bpf_map_update_elem(int fd, const void *key, const void *value, |
| @@ -56,6 +56,7 @@ TEST_PROGS := test_kmod.sh \ · 55 unmodified lines | ||
| 56 | 56 | test_xdp_vlan.sh |
| 57 | 57 | |
| 58 | 58 | TEST_PROGS_EXTENDED := with_addr.sh \ |
| 59 | + with_tunnels.sh \ | |
| 59 | 60 | tcp_client.py \ |
| 60 | 61 | tcp_server.py |
| 61 | 62 | |
| @@ -1188,7 +1188,9 @@ static void test_stacktrace_build_id(void) · 1187 unmodified lines | ||
| 1188 | 1188 | int i, j; |
| 1189 | 1189 | struct bpf_stack_build_id id_offs[PERF_MAX_STACK_DEPTH]; |
| 1190 | 1190 | int build_id_matches = 0; |
| 1191 | + int retry = 1; | |
| 1191 | 1192 | |
| 1193 | +retry: | |
| 1192 | 1194 | err = bpf_prog_load(file, BPF_PROG_TYPE_TRACEPOINT, &obj, &prog_fd); |
| 1193 | 1195 | if (CHECK(err, "prog_load", "err %d errno %d\n", err, errno)) |
| 1194 | 1196 | goto out; |
| @@ -1301,6 +1303,19 @@ static void test_stacktrace_build_id(void) · 106 unmodified lines | ||
| 1301 | 1303 | previous_key = key; |
| 1302 | 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 | 1319 | if (CHECK(build_id_matches < 1, "build id match", |
| 1305 | 1320 | "Didn't find expected build ID from the map\n")) |
| 1306 | 1321 | goto disable_pmu; |
| @@ -1341,7 +1356,9 @@ static void test_stacktrace_build_id_nmi(void) · 34 unmodified lines | ||
| 1341 | 1356 | int i, j; |
| 1342 | 1357 | struct bpf_stack_build_id id_offs[PERF_MAX_STACK_DEPTH]; |
| 1343 | 1358 | int build_id_matches = 0; |
| 1359 | + int retry = 1; | |
| 1344 | 1360 | |
| 1361 | +retry: | |
| 1345 | 1362 | err = bpf_prog_load(file, BPF_PROG_TYPE_PERF_EVENT, &obj, &prog_fd); |
| 1346 | 1363 | if (CHECK(err, "prog_load", "err %d errno %d\n", err, errno)) |
| 1347 | 1364 | return; |
| @@ -1436,6 +1453,19 @@ static void test_stacktrace_build_id_nmi(void) · 88 unmodified lines | ||
| 1436 | 1453 | previous_key = key; |
| 1437 | 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 | 1469 | if (CHECK(build_id_matches < 1, "build id match", |
| 1440 | 1470 | "Didn't find expected build ID from the map\n")) |
| 1441 | 1471 | goto disable_pmu; |
| @@ -25,6 +25,7 @@ ALL_TESTS=" · 24 unmodified lines | ||
| 25 | 25 | lag_unlink_slaves_test |
| 26 | 26 | lag_dev_deletion_test |
| 27 | 27 | vlan_interface_uppers_test |
| 28 | + bridge_extern_learn_test | |
| 28 | 29 | devlink_reload_test |
| 29 | 30 | " |
| 30 | 31 | NUM_NETIFS=2 |
| @@ -541,6 +542,25 @@ vlan_interface_uppers_test() · 510 unmodified lines | ||
| 541 | 542 | ip link del dev br0 |
| 542 | 543 | } |
| 543 | 544 | |
| 545 | +bridge_extern_learn_test() | |
| 546 | +{ | |
| 547 | + # Test that externally learned entries added from user space are | |
| 548 | + # marked as offloaded | |
| 549 | + RET=0 | |
| 550 | + | |
| 551 | + ip link add name br0 type bridge | |
| 552 | + ip link set dev $swp1 master br0 | |
| 553 | + | |
| 554 | + bridge fdb add de:ad:be:ef:13:37 dev $swp1 master extern_learn | |
| 555 | + | |
| 556 | + bridge fdb show brport $swp1 | grep de:ad:be:ef:13:37 | grep -q offload | |
| 557 | + check_err $? "fdb entry not marked as offloaded when should" | |
| 558 | + | |
| 559 | + log_test "externally learned fdb entry" | |
| 560 | + | |
| 561 | + ip link del dev br0 | |
| 562 | +} | |
| 563 | + | |
| 544 | 564 | devlink_reload_test() |
| 545 | 565 | { |
| 546 | 566 | # Test that after executing all the above configuration tests, a |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | #!/bin/bash |
| 2 | 2 | # SPDX-License-Identifier: GPL-2.0 |
| 3 | 3 | |
| 4 | −ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding vlan_deletion" | |
| 4 | +ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding vlan_deletion extern_learn" | |
| 5 | 5 | NUM_NETIFS=4 |
| 6 | 6 | CHECK_TC="yes" |
| 7 | 7 | source lib.sh |
| @@ -109,6 +109,38 @@ vlan_deletion() · 101 unmodified lines | ||
| 109 | 109 | ping_ipv6 |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | +extern_learn() | |
| 113 | +{ | |
| 114 | + local mac=de:ad:be:ef:13:37 | |
| 115 | + local ageing_time | |
| 116 | + | |
| 117 | + # Test that externally learned FDB entries can roam, but not age out | |
| 118 | + RET=0 | |
| 119 | + | |
| 120 | + bridge fdb add de:ad:be:ef:13:37 dev $swp1 master extern_learn vlan 1 | |
| 121 | + | |
| 122 | + bridge fdb show brport $swp1 | grep -q de:ad:be:ef:13:37 | |
| 123 | + check_err $? "Did not find FDB entry when should" | |
| 124 | + | |
| 125 | + # Wait for 10 seconds after the ageing time to make sure the FDB entry | |
| 126 | + # was not aged out | |
| 127 | + ageing_time=$(bridge_ageing_time_get br0) | |
| 128 | + sleep $((ageing_time + 10)) | |
| 129 | + | |
| 130 | + bridge fdb show brport $swp1 | grep -q de:ad:be:ef:13:37 | |
| 131 | + check_err $? "FDB entry was aged out when should not" | |
| 132 | + | |
| 133 | + $MZ $h2 -c 1 -p 64 -a $mac -t ip -q | |
| 134 | + | |
| 135 | + bridge fdb show brport $swp2 | grep -q de:ad:be:ef:13:37 | |
| 136 | + check_err $? "FDB entry did not roam when should" | |
| 137 | + | |
| 138 | + log_test "Externally learned FDB entry - ageing & roaming" | |
| 139 | + | |
| 140 | + bridge fdb del de:ad:be:ef:13:37 dev $swp2 master vlan 1 &> /dev/null | |
| 141 | + bridge fdb del de:ad:be:ef:13:37 dev $swp1 master vlan 1 &> /dev/null | |
| 142 | +} | |
| 143 | + | |
| 112 | 144 | trap cleanup EXIT |
| 113 | 145 | |
| 114 | 146 | setup_prepare |
| @@ -240,7 +240,7 @@ static void __recv_errmsg_cmsg(struct msghdr *msg, int payload_len) · 239 unmodified lines | ||
| 240 | 240 | cm->cmsg_type == IP_RECVERR) || |
| 241 | 241 | (cm->cmsg_level == SOL_IPV6 && |
| 242 | 242 | cm->cmsg_type == IPV6_RECVERR) || |
| 243 | − (cm->cmsg_level = SOL_PACKET && | |
| 243 | + (cm->cmsg_level == SOL_PACKET && | |
| 244 | 244 | cm->cmsg_type == PACKET_TX_TIMESTAMP)) { |
| 245 | 245 | serr = (void *) CMSG_DATA(cm); |
| 246 | 246 | if (serr->ee_errno != ENOMSG || |
| @@ -17,7 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | "cmdUnderTest": "$TC actions add action ife encode allow mark pass index 2", |
| 18 | 18 | "expExitCode": "0", |
| 19 | 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 | 21 | "matchCount": "1", |
| 22 | 22 | "teardown": [ |
| 23 | 23 | "$TC actions flush action ife" |
| @@ -41,7 +41,7 @@ · 17 unmodified lines | ||
| 41 | 41 | "cmdUnderTest": "$TC actions add action ife encode use mark 10 pipe index 2", |
| 42 | 42 | "expExitCode": "0", |
| 43 | 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 | 45 | "matchCount": "1", |
| 46 | 46 | "teardown": [ |
| 47 | 47 | "$TC actions flush action ife" |
| @@ -65,7 +65,7 @@ · 17 unmodified lines | ||
| 65 | 65 | "cmdUnderTest": "$TC actions add action ife encode allow mark continue index 2", |
| 66 | 66 | "expExitCode": "0", |
| 67 | 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 | 69 | "matchCount": "1", |
| 70 | 70 | "teardown": [ |
| 71 | 71 | "$TC actions flush action ife" |
| @@ -89,7 +89,7 @@ · 17 unmodified lines | ||
| 89 | 89 | "cmdUnderTest": "$TC actions add action ife encode use mark 789 drop index 2", |
| 90 | 90 | "expExitCode": "0", |
| 91 | 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 | 93 | "matchCount": "1", |
| 94 | 94 | "teardown": [ |
| 95 | 95 | "$TC actions flush action ife" |
| @@ -113,7 +113,7 @@ · 17 unmodified lines | ||
| 113 | 113 | "cmdUnderTest": "$TC actions add action ife encode use mark 656768 reclassify index 2", |
| 114 | 114 | "expExitCode": "0", |
| 115 | 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 | 117 | "matchCount": "1", |
| 118 | 118 | "teardown": [ |
| 119 | 119 | "$TC actions flush action ife" |
| @@ -137,7 +137,7 @@ · 17 unmodified lines | ||
| 137 | 137 | "cmdUnderTest": "$TC actions add action ife encode use mark 65 jump 1 index 2", |
| 138 | 138 | "expExitCode": "0", |
| 139 | 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 | 141 | "matchCount": "1", |
| 142 | 142 | "teardown": [ |
| 143 | 143 | "$TC actions flush action ife" |
| @@ -161,7 +161,7 @@ · 17 unmodified lines | ||
| 161 | 161 | "cmdUnderTest": "$TC actions add action ife encode use mark 4294967295 reclassify index 90", |
| 162 | 162 | "expExitCode": "0", |
| 163 | 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 | 165 | "matchCount": "1", |
| 166 | 166 | "teardown": [ |
| 167 | 167 | "$TC actions flush action ife" |
| @@ -185,7 +185,7 @@ · 17 unmodified lines | ||
| 185 | 185 | "cmdUnderTest": "$TC actions add action ife encode use mark 4294967295999 pipe index 90", |
| 186 | 186 | "expExitCode": "255", |
| 187 | 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 | 189 | "matchCount": "0", |
| 190 | 190 | "teardown": [] |
| 191 | 191 | }, |
| @@ -207,7 +207,7 @@ · 15 unmodified lines | ||
| 207 | 207 | "cmdUnderTest": "$TC actions add action ife encode allow prio pass index 9", |
| 208 | 208 | "expExitCode": "0", |
| 209 | 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 | 211 | "matchCount": "1", |
| 212 | 212 | "teardown": [ |
| 213 | 213 | "$TC actions flush action ife" |
| @@ -231,7 +231,7 @@ · 17 unmodified lines | ||
| 231 | 231 | "cmdUnderTest": "$TC actions add action ife encode use prio 7 pipe index 9", |
| 232 | 232 | "expExitCode": "0", |
| 233 | 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 | 235 | "matchCount": "1", |
| 236 | 236 | "teardown": [ |
| 237 | 237 | "$TC actions flush action ife" |
| @@ -255,7 +255,7 @@ · 17 unmodified lines | ||
| 255 | 255 | "cmdUnderTest": "$TC actions add action ife encode use prio 3 continue index 9", |
| 256 | 256 | "expExitCode": "0", |
| 257 | 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 | 259 | "matchCount": "1", |
| 260 | 260 | "teardown": [ |
| 261 | 261 | "$TC actions flush action ife" |
| @@ -279,7 +279,7 @@ · 17 unmodified lines | ||
| 279 | 279 | "cmdUnderTest": "$TC actions add action ife encode allow prio drop index 9", |
| 280 | 280 | "expExitCode": "0", |
| 281 | 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 | 283 | "matchCount": "1", |
| 284 | 284 | "teardown": [ |
| 285 | 285 | "$TC actions flush action ife" |
| @@ -303,7 +303,7 @@ · 17 unmodified lines | ||
| 303 | 303 | "cmdUnderTest": "$TC actions add action ife encode use prio 998877 reclassify index 9", |
| 304 | 304 | "expExitCode": "0", |
| 305 | 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 | 307 | "matchCount": "1", |
| 308 | 308 | "teardown": [ |
| 309 | 309 | "$TC actions flush action ife" |
| @@ -327,7 +327,7 @@ · 17 unmodified lines | ||
| 327 | 327 | "cmdUnderTest": "$TC actions add action ife encode use prio 998877 jump 10 index 9", |
| 328 | 328 | "expExitCode": "0", |
| 329 | 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 | 331 | "matchCount": "1", |
| 332 | 332 | "teardown": [ |
| 333 | 333 | "$TC actions flush action ife" |
| @@ -351,7 +351,7 @@ · 17 unmodified lines | ||
| 351 | 351 | "cmdUnderTest": "$TC actions add action ife encode use prio 4294967295 reclassify index 99", |
| 352 | 352 | "expExitCode": "0", |
| 353 | 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 | 355 | "matchCount": "1", |
| 356 | 356 | "teardown": [ |
| 357 | 357 | "$TC actions flush action ife" |
| @@ -375,7 +375,7 @@ · 17 unmodified lines | ||
| 375 | 375 | "cmdUnderTest": "$TC actions add action ife encode use prio 4294967298 pipe index 99", |
| 376 | 376 | "expExitCode": "255", |
| 377 | 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 | 379 | "matchCount": "0", |
| 380 | 380 | "teardown": [] |
| 381 | 381 | }, |
| @@ -397,7 +397,7 @@ · 15 unmodified lines | ||
| 397 | 397 | "cmdUnderTest": "$TC actions add action ife encode allow tcindex pass index 1", |
| 398 | 398 | "expExitCode": "0", |
| 399 | 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 | 401 | "matchCount": "1", |
| 402 | 402 | "teardown": [ |
| 403 | 403 | "$TC actions flush action ife" |
| @@ -421,7 +421,7 @@ · 17 unmodified lines | ||
| 421 | 421 | "cmdUnderTest": "$TC actions add action ife encode use tcindex 111 pipe index 1", |
| 422 | 422 | "expExitCode": "0", |
| 423 | 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 | 425 | "matchCount": "1", |
| 426 | 426 | "teardown": [ |
| 427 | 427 | "$TC actions flush action ife" |
| @@ -445,7 +445,7 @@ · 17 unmodified lines | ||
| 445 | 445 | "cmdUnderTest": "$TC actions add action ife encode use tcindex 1 continue index 1", |
| 446 | 446 | "expExitCode": "0", |
| 447 | 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 | 449 | "matchCount": "1", |
| 450 | 450 | "teardown": [ |
| 451 | 451 | "$TC actions flush action ife" |
| @@ -469,7 +469,7 @@ · 17 unmodified lines | ||
| 469 | 469 | "cmdUnderTest": "$TC actions add action ife encode use tcindex 1 continue index 1", |
| 470 | 470 | "expExitCode": "0", |
| 471 | 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 | 473 | "matchCount": "1", |
| 474 | 474 | "teardown": [ |
| 475 | 475 | "$TC actions flush action ife" |
| @@ -493,7 +493,7 @@ · 17 unmodified lines | ||
| 493 | 493 | "cmdUnderTest": "$TC actions add action ife encode allow tcindex drop index 77", |
| 494 | 494 | "expExitCode": "0", |
| 495 | 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 | 497 | "matchCount": "1", |
| 498 | 498 | "teardown": [ |
| 499 | 499 | "$TC actions flush action ife" |
| @@ -517,7 +517,7 @@ · 17 unmodified lines | ||
| 517 | 517 | "cmdUnderTest": "$TC actions add action ife encode allow tcindex reclassify index 77", |
| 518 | 518 | "expExitCode": "0", |
| 519 | 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 | 521 | "matchCount": "1", |
| 522 | 522 | "teardown": [ |
| 523 | 523 | "$TC actions flush action ife" |
| @@ -541,7 +541,7 @@ · 17 unmodified lines | ||
| 541 | 541 | "cmdUnderTest": "$TC actions add action ife encode allow tcindex jump 999 index 77", |
| 542 | 542 | "expExitCode": "0", |
| 543 | 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 | 545 | "matchCount": "1", |
| 546 | 546 | "teardown": [ |
| 547 | 547 | "$TC actions flush action ife" |
| @@ -565,7 +565,7 @@ · 17 unmodified lines | ||
| 565 | 565 | "cmdUnderTest": "$TC actions add action ife encode use tcindex 65535 pass index 1", |
| 566 | 566 | "expExitCode": "0", |
| 567 | 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 | 569 | "matchCount": "1", |
| 570 | 570 | "teardown": [ |
| 571 | 571 | "$TC actions flush action ife" |
| @@ -589,7 +589,7 @@ · 17 unmodified lines | ||
| 589 | 589 | "cmdUnderTest": "$TC actions add action ife encode use tcindex 65539 pipe index 1", |
| 590 | 590 | "expExitCode": "255", |
| 591 | 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 | 593 | "matchCount": "0", |
| 594 | 594 | "teardown": [] |
| 595 | 595 | }, |
| @@ -611,7 +611,7 @@ · 15 unmodified lines | ||
| 611 | 611 | "cmdUnderTest": "$TC actions add action ife encode allow mark src 00:11:22:33:44:55 pipe index 1", |
| 612 | 612 | "expExitCode": "0", |
| 613 | 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 | 615 | "matchCount": "1", |
| 616 | 616 | "teardown": [ |
| 617 | 617 | "$TC actions flush action ife" |
| @@ -635,7 +635,7 @@ · 17 unmodified lines | ||
| 635 | 635 | "cmdUnderTest": "$TC actions add action ife encode use prio 9876 dst 00:11:22:33:44:55 reclassify index 1", |
| 636 | 636 | "expExitCode": "0", |
| 637 | 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 | 639 | "matchCount": "1", |
| 640 | 640 | "teardown": [ |
| 641 | 641 | "$TC actions flush action ife" |
| @@ -659,7 +659,7 @@ · 17 unmodified lines | ||
| 659 | 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 | 660 | "expExitCode": "0", |
| 661 | 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 | 663 | "matchCount": "1", |
| 664 | 664 | "teardown": [ |
| 665 | 665 | "$TC actions flush action ife" |
| @@ -683,7 +683,7 @@ · 17 unmodified lines | ||
| 683 | 683 | "cmdUnderTest": "$TC actions add action ife encode use mark 7 type 0xfefe pass index 1", |
| 684 | 684 | "expExitCode": "0", |
| 685 | 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 | 687 | "matchCount": "1", |
| 688 | 688 | "teardown": [ |
| 689 | 689 | "$TC actions flush action ife" |
| @@ -707,7 +707,7 @@ · 17 unmodified lines | ||
| 707 | 707 | "cmdUnderTest": "$TC actions add action ife encode use prio 444 type 0xabba pipe index 21", |
| 708 | 708 | "expExitCode": "0", |
| 709 | 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 | 711 | "matchCount": "1", |
| 712 | 712 | "teardown": [ |
| 713 | 713 | "$TC actions flush action ife" |
| @@ -731,7 +731,7 @@ · 17 unmodified lines | ||
| 731 | 731 | "cmdUnderTest": "$TC actions add action ife encode use tcindex 5000 type 0xabcd reclassify index 21", |
| 732 | 732 | "expExitCode": "0", |
| 733 | 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 | 735 | "matchCount": "1", |
| 736 | 736 | "teardown": [ |
| 737 | 737 | "$TC actions flush action ife" |
| @@ -739,7 +739,7 @@ · 1 unmodified line | ||
| 739 | 739 | }, |
| 740 | 740 | { |
| 741 | 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 | 743 | "category": [ |
| 744 | 744 | "actions", |
| 745 | 745 | "ife" |
| @@ -755,7 +755,7 @@ · 9 unmodified lines | ||
| 755 | 755 | "cmdUnderTest": "$TC actions add action ife encode allow mark pass index 4294967295", |
| 756 | 756 | "expExitCode": "0", |
| 757 | 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 | 759 | "matchCount": "1", |
| 760 | 760 | "teardown": [ |
| 761 | 761 | "$TC actions flush action ife" |
| @@ -779,7 +779,7 @@ · 17 unmodified lines | ||
| 779 | 779 | "cmdUnderTest": "$TC actions add action ife decode pass index 1", |
| 780 | 780 | "expExitCode": "0", |
| 781 | 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 | 783 | "matchCount": "1", |
| 784 | 784 | "teardown": [ |
| 785 | 785 | "$TC actions flush action ife" |
| @@ -803,7 +803,7 @@ · 17 unmodified lines | ||
| 803 | 803 | "cmdUnderTest": "$TC actions add action ife decode pipe index 1", |
| 804 | 804 | "expExitCode": "0", |
| 805 | 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 | 807 | "matchCount": "1", |
| 808 | 808 | "teardown": [ |
| 809 | 809 | "$TC actions flush action ife" |
| @@ -827,7 +827,7 @@ · 17 unmodified lines | ||
| 827 | 827 | "cmdUnderTest": "$TC actions add action ife decode continue index 1", |
| 828 | 828 | "expExitCode": "0", |
| 829 | 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 | 831 | "matchCount": "1", |
| 832 | 832 | "teardown": [ |
| 833 | 833 | "$TC actions flush action ife" |
| @@ -851,7 +851,7 @@ · 17 unmodified lines | ||
| 851 | 851 | "cmdUnderTest": "$TC actions add action ife decode drop index 1", |
| 852 | 852 | "expExitCode": "0", |
| 853 | 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 | 855 | "matchCount": "1", |
| 856 | 856 | "teardown": [ |
| 857 | 857 | "$TC actions flush action ife" |
| @@ -875,7 +875,7 @@ · 17 unmodified lines | ||
| 875 | 875 | "cmdUnderTest": "$TC actions add action ife decode reclassify index 1", |
| 876 | 876 | "expExitCode": "0", |
| 877 | 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 | 879 | "matchCount": "1", |
| 880 | 880 | "teardown": [ |
| 881 | 881 | "$TC actions flush action ife" |
| @@ -899,7 +899,7 @@ · 17 unmodified lines | ||
| 899 | 899 | "cmdUnderTest": "$TC actions add action ife decode jump 10 index 1", |
| 900 | 900 | "expExitCode": "0", |
| 901 | 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 | 903 | "matchCount": "1", |
| 904 | 904 | "teardown": [ |
| 905 | 905 | "$TC actions flush action ife" |
| @@ -923,7 +923,7 @@ · 17 unmodified lines | ||
| 923 | 923 | "cmdUnderTest": "$TC actions add action ife encode allow mark pass index 4294967295999", |
| 924 | 924 | "expExitCode": "255", |
| 925 | 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 | 927 | "matchCount": "0", |
| 928 | 928 | "teardown": [] |
| 929 | 929 | }, |
| @@ -945,7 +945,7 @@ · 15 unmodified lines | ||
| 945 | 945 | "cmdUnderTest": "$TC actions add action ife encode allow mark kuka index 4", |
| 946 | 946 | "expExitCode": "255", |
| 947 | 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 | 949 | "matchCount": "0", |
| 950 | 950 | "teardown": [] |
| 951 | 951 | }, |
| @@ -967,7 +967,7 @@ · 15 unmodified lines | ||
| 967 | 967 | "cmdUnderTest": "$TC actions add action ife encode allow prio pipe index 4 cookie aabbccddeeff112233445566778800a1", |
| 968 | 968 | "expExitCode": "0", |
| 969 | 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 | 971 | "matchCount": "1", |
| 972 | 972 | "teardown": [ |
| 973 | 973 | "$TC actions flush action ife" |
| @@ -991,7 +991,7 @@ · 17 unmodified lines | ||
| 991 | 991 | "cmdUnderTest": "$TC actions add action ife encode allow foo pipe index 4", |
| 992 | 992 | "expExitCode": "255", |
| 993 | 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 | 995 | "matchCount": "0", |
| 996 | 996 | "teardown": [] |
| 997 | 997 | }, |
| @@ -1013,7 +1013,7 @@ · 15 unmodified lines | ||
| 1013 | 1013 | "cmdUnderTest": "$TC actions add action ife encode allow prio type 70000 pipe index 4", |
| 1014 | 1014 | "expExitCode": "255", |
| 1015 | 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 | 1017 | "matchCount": "0", |
| 1018 | 1018 | "teardown": [] |
| 1019 | 1019 | }, |
| @@ -81,35 +81,6 @@ · 80 unmodified lines | ||
| 81 | 81 | ] |
| 82 | 82 | ] |
| 83 | 83 | }, |
| 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 | 84 | { |
| 114 | 85 | "id": "a5e0", |
| 115 | 86 | "name": "Add tunnel_key set action with invalid src_ip parameter", |
| @@ -634,7 +605,7 @@ · 518 unmodified lines | ||
| 634 | 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 | 606 | "expExitCode": "0", |
| 636 | 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 | 609 | "matchCount": "1", |
| 639 | 610 | "teardown": [ |
| 640 | 611 | "$TC actions flush action tunnel_key" |