Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull networking fixes from David Miller:

1) Fix endless loop in nf_tables, from Phil Sutter.

2) Fix cross namespace ip6_gre tunnel hash list corruption, from
Olivier Matz.

3) Don't be too strict in phy_start_aneg() otherwise we might not allow
restarting auto negotiation. From Heiner Kallweit.

4) Fix various KMSAN uninitialized value cases in tipc, from Ying Xue.

5) Memory leak in act_tunnel_key, from Davide Caratti.

6) Handle chip errata of mv88e6390 PHY, from Andrew Lunn.

7) Remove linear SKB assumption in fou/fou6, from Eric Dumazet.

8) Missing udplite rehash callbacks, from Alexey Kodanev.

9) Log dirty pages properly in vhost, from Jason Wang.

10) Use consume_skb() in neigh_probe() as this is a normal free not a
drop, from Yang Wei. Likewise in macvlan_process_broadcast().

11) Missing device_del() in mdiobus_register() error paths, from Thomas
Petazzoni.

12) Fix checksum handling of short packets in mlx5, from Cong Wang.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (96 commits)
bpf: in __bpf_redirect_no_mac pull mac only if present
virtio_net: bulk free tx skbs
net: phy: phy driver features are mandatory
isdn: avm: Fix string plus integer warning from Clang
net/mlx5e: Fix cb_ident duplicate in indirect block register
net/mlx5e: Fix wrong (zero) TX drop counter indication for representor
net/mlx5e: Fix wrong error code return on FEC query failure
net/mlx5e: Force CHECKSUM_UNNECESSARY for short ethernet frames
tools: bpftool: Cleanup license mess
bpf: fix inner map masking to prevent oob under speculation
bpf: pull in pkt_sched.h header for tooling to fix bpftool build
selftests: forwarding: Add a test case for externally learned FDB entries
selftests: mlxsw: Test FDB offload indication
mlxsw: spectrum_switchdev: Do not treat static FDB entries as sticky
net: bridge: Mark FDB entries that were added by user as such
mlxsw: spectrum_fid: Update dummy FID index
mlxsw: pci: Return error on PCI reset timeout
mlxsw: pci: Increase PCI SW reset timeout
mlxsw: pci: Ring CQ's doorbell before RDQ's
MAINTAINERS: update email addresses of liquidio driver maintainers
...

+2090 -602
+13 -13
Documentation/networking/index.rst
··· 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
-45
Documentation/networking/rxrpc.txt
··· 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);
+125 -5
Documentation/networking/snmp_counter.rst
··· 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 ··· 402 383 403 384 TCP abort 404 385 ======== 405 - 406 - 407 386 * TcpExtTCPAbortOnData 408 387 It means TCP layer has data in flight, but need to close the 409 388 connection. So TCP layer sends a RST to the other side, indicate the ··· 562 545 stack of kernel will increase TcpExtTCPSACKReorder for both of the 563 546 above scenarios. 564 547 565 - 566 548 DSACK 567 549 ===== 568 550 The DSACK is defined in `RFC2883`_. The receiver uses DSACK to report ··· 582 566 DSACK to the sender. 583 567 584 568 * TcpExtTCPDSACKRecv 585 - The TCP stack receives a DSACK, which indicate an acknowledged 569 + The TCP stack receives a DSACK, which indicates an acknowledged 586 570 duplicate packet is received. 587 571 588 572 * TcpExtTCPDSACKOfoRecv 589 573 The TCP stack receives a DSACK, which indicate an out of order 590 574 duplicate packet is received. 575 + 576 + invalid SACK and DSACK 577 + ==================== 578 + When a SACK (or DSACK) block is invalid, a corresponding counter would 579 + be updated. The validation method is base on the start/end sequence 580 + number of the SACK block. For more details, please refer the comment 581 + of the function tcp_is_sackblock_valid in the kernel source code. A 582 + SACK option could have up to 4 blocks, they are checked 583 + individually. E.g., if 3 blocks of a SACk is invalid, the 584 + corresponding counter would be updated 3 times. The comment of the 585 + `Add counters for discarded SACK blocks`_ patch has additional 586 + explaination: 587 + 588 + .. _Add counters for discarded SACK blocks: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=18f02545a9a16c9a89778b91a162ad16d510bb32 589 + 590 + * TcpExtTCPSACKDiscard 591 + This counter indicates how many SACK blocks are invalid. If the invalid 592 + SACK block is caused by ACK recording, the TCP stack will only ignore 593 + it and won't update this counter. 594 + 595 + * TcpExtTCPDSACKIgnoredOld and TcpExtTCPDSACKIgnoredNoUndo 596 + When a DSACK block is invalid, one of these two counters would be 597 + updated. Which counter will be updated depends on the undo_marker flag 598 + of the TCP socket. If the undo_marker is not set, the TCP stack isn't 599 + likely to re-transmit any packets, and we still receive an invalid 600 + DSACK block, the reason might be that the packet is duplicated in the 601 + middle of the network. In such scenario, TcpExtTCPDSACKIgnoredNoUndo 602 + will be updated. If the undo_marker is set, TcpExtTCPDSACKIgnoredOld 603 + will be updated. As implied in its name, it might be an old packet. 604 + 605 + SACK shift 606 + ========= 607 + The linux networking stack stores data in sk_buff struct (skb for 608 + short). If a SACK block acrosses multiple skb, the TCP stack will try 609 + to re-arrange data in these skb. E.g. if a SACK block acknowledges seq 610 + 10 to 15, skb1 has seq 10 to 13, skb2 has seq 14 to 20. The seq 14 and 611 + 15 in skb2 would be moved to skb1. This operation is 'shift'. If a 612 + SACK block acknowledges seq 10 to 20, skb1 has seq 10 to 13, skb2 has 613 + seq 14 to 20. All data in skb2 will be moved to skb1, and skb2 will be 614 + discard, this operation is 'merge'. 615 + 616 + * TcpExtTCPSackShifted 617 + A skb is shifted 618 + 619 + * TcpExtTCPSackMerged 620 + A skb is merged 621 + 622 + * TcpExtTCPSackShiftFallback 623 + A skb should be shifted or merged, but the TCP stack doesn't do it for 624 + some reasons. 591 625 592 626 TCP out of order 593 627 =============== ··· 728 662 .. _RFC 5961 section 4.2: https://tools.ietf.org/html/rfc5961#page-9 729 663 .. _RFC 5961 section 5.2: https://tools.ietf.org/html/rfc5961#page-11 730 664 665 + TCP receive window 666 + ================= 667 + * TcpExtTCPWantZeroWindowAdv 668 + Depending on current memory usage, the TCP stack tries to set receive 669 + window to zero. But the receive window might still be a no-zero 670 + value. For example, if the previous window size is 10, and the TCP 671 + stack receives 3 bytes, the current window size would be 7 even if the 672 + window size calculated by the memory usage is zero. 673 + 674 + * TcpExtTCPToZeroWindowAdv 675 + The TCP receive window is set to zero from a no-zero value. 676 + 677 + * TcpExtTCPFromZeroWindowAdv 678 + The TCP receive window is set to no-zero value from zero. 679 + 680 + 681 + Delayed ACK 682 + ========== 683 + The TCP Delayed ACK is a technique which is used for reducing the 684 + packet count in the network. For more details, please refer the 685 + `Delayed ACK wiki`_ 686 + 687 + .. _Delayed ACK wiki: https://en.wikipedia.org/wiki/TCP_delayed_acknowledgment 688 + 689 + * TcpExtDelayedACKs 690 + A delayed ACK timer expires. The TCP stack will send a pure ACK packet 691 + and exit the delayed ACK mode. 692 + 693 + * TcpExtDelayedACKLocked 694 + A delayed ACK timer expires, but the TCP stack can't send an ACK 695 + immediately due to the socket is locked by a userspace program. The 696 + TCP stack will send a pure ACK later (after the userspace program 697 + unlock the socket). When the TCP stack sends the pure ACK later, the 698 + TCP stack will also update TcpExtDelayedACKs and exit the delayed ACK 699 + mode. 700 + 701 + * TcpExtDelayedACKLost 702 + It will be updated when the TCP stack receives a packet which has been 703 + ACKed. A Delayed ACK loss might cause this issue, but it would also be 704 + triggered by other reasons, such as a packet is duplicated in the 705 + network. 706 + 707 + Tail Loss Probe (TLP) 708 + =================== 709 + TLP is an algorithm which is used to detect TCP packet loss. For more 710 + details, please refer the `TLP paper`_. 711 + 712 + .. _TLP paper: https://tools.ietf.org/html/draft-dukkipati-tcpm-tcp-loss-probe-01 713 + 714 + * TcpExtTCPLossProbes 715 + A TLP probe packet is sent. 716 + 717 + * TcpExtTCPLossProbeRecovery 718 + A packet loss is detected and recovered by TLP. 731 719 732 720 examples 733 721 =======
+2 -2
Documentation/networking/timestamping.txt
··· 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 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
+3 -4
MAINTAINERS
··· 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
+1 -1
drivers/atm/he.c
··· 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 */
+1 -1
drivers/isdn/hardware/avm/b1.c
··· 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)
+1 -1
drivers/net/Kconfig
··· 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
+13 -5
drivers/net/dsa/realtek-smi.c
··· 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; ··· 372 371 if (ret) { 373 372 dev_err(smi->dev, "unable to register MDIO bus %s\n", 374 373 smi->slave_mii_bus->id); 375 - of_node_put(mdio_np); 374 + goto err_put_node; 376 375 } 377 376 378 377 return 0; 378 + 379 + err_put_node: 380 + of_node_put(mdio_np); 381 + 382 + return ret; 379 383 } 380 384 381 385 static int realtek_smi_probe(struct platform_device *pdev) ··· 463 457 struct realtek_smi *smi = dev_get_drvdata(&pdev->dev); 464 458 465 459 dsa_unregister_switch(smi->ds); 460 + if (smi->slave_mii_bus) 461 + of_node_put(smi->slave_mii_bus->dev.of_node); 466 462 gpiod_set_value(smi->reset, 1); 467 463 468 464 return 0;
-2
drivers/net/ethernet/amd/xgbe/xgbe-common.h
··· 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
+16 -6
drivers/net/ethernet/amd/xgbe/xgbe-dev.c
··· 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 { ··· 1305 1291 1306 1292 reinit_completion(&pdata->mdio_complete); 1307 1293 1308 - mdio_sca = 0; 1309 - XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, REG, reg); 1310 - XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, DA, addr); 1294 + mdio_sca = xgbe_create_mdio_sca(addr, reg); 1311 1295 XGMAC_IOWRITE(pdata, MAC_MDIOSCAR, mdio_sca); 1312 1296 1313 1297 mdio_sccd = 0; ··· 1329 1317 1330 1318 reinit_completion(&pdata->mdio_complete); 1331 1319 1332 - mdio_sca = 0; 1333 - XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, REG, reg); 1334 - XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, DA, addr); 1320 + mdio_sca = xgbe_create_mdio_sca(addr, reg); 1335 1321 XGMAC_IOWRITE(pdata, MAC_MDIOSCAR, mdio_sca); 1336 1322 1337 1323 mdio_sccd = 0;
+6
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
··· 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 2099 } 2101 2100 if (unlikely(err < 0)) 2102 2101 goto skb_to_fd_failed; 2102 + 2103 + txq = netdev_get_tx_queue(net_dev, queue_mapping); 2104 + 2105 + /* LLTX requires to do our own update of trans_start */ 2106 + txq->trans_start = jiffies; 2103 2107 2104 2108 if (priv->tx_tstamp && skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) { 2105 2109 fd.cmd |= cpu_to_be32(FM_FD_CMD_UPD);
+1 -1
drivers/net/ethernet/intel/igb/igb.h
··· 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 */
+2 -2
drivers/net/ethernet/intel/igb/igb_ethtool.c
··· 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 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)
+7 -7
drivers/net/ethernet/intel/igb/igb_main.c
··· 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 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 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 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 /**
+4 -1
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
··· 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,
+17 -13
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
··· 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) ··· 180 179 181 180 s->tx_packets += sq_stats->packets; 182 181 s->tx_bytes += sq_stats->bytes; 182 + s->tx_queue_dropped += sq_stats->dropped; 183 183 } 184 184 } 185 185 } ··· 665 663 struct list_head *head = &rpriv->uplink_priv.tc_indr_block_priv_list; 666 664 667 665 list_for_each_entry_safe(cb_priv, temp, head, list) { 668 - mlx5e_rep_indr_unregister_block(cb_priv->netdev); 666 + mlx5e_rep_indr_unregister_block(rpriv, cb_priv->netdev); 669 667 kfree(cb_priv); 670 668 } 671 669 } ··· 737 735 738 736 err = tcf_block_cb_register(f->block, 739 737 mlx5e_rep_indr_setup_block_cb, 740 - netdev, indr_priv, f->extack); 738 + indr_priv, indr_priv, f->extack); 741 739 if (err) { 742 740 list_del(&indr_priv->list); 743 741 kfree(indr_priv); ··· 745 743 746 744 return err; 747 745 case TC_BLOCK_UNBIND: 746 + indr_priv = mlx5e_rep_indr_block_priv_lookup(rpriv, netdev); 747 + if (!indr_priv) 748 + return -ENOENT; 749 + 748 750 tcf_block_cb_unregister(f->block, 749 751 mlx5e_rep_indr_setup_block_cb, 750 - netdev); 751 - indr_priv = mlx5e_rep_indr_block_priv_lookup(rpriv, netdev); 752 - if (indr_priv) { 753 - list_del(&indr_priv->list); 754 - kfree(indr_priv); 755 - } 752 + indr_priv); 753 + list_del(&indr_priv->list); 754 + kfree(indr_priv); 756 755 757 756 return 0; 758 757 default: ··· 782 779 783 780 err = __tc_indr_block_cb_register(netdev, rpriv, 784 781 mlx5e_rep_indr_setup_tc_cb, 785 - netdev); 782 + rpriv); 786 783 if (err) { 787 784 struct mlx5e_priv *priv = netdev_priv(rpriv->netdev); 788 785 ··· 792 789 return err; 793 790 } 794 791 795 - static void mlx5e_rep_indr_unregister_block(struct net_device *netdev) 792 + static void mlx5e_rep_indr_unregister_block(struct mlx5e_rep_priv *rpriv, 793 + struct net_device *netdev) 796 794 { 797 795 __tc_indr_block_cb_unregister(netdev, mlx5e_rep_indr_setup_tc_cb, 798 - netdev); 796 + rpriv); 799 797 } 800 798 801 799 static int mlx5e_nic_rep_netdevice_event(struct notifier_block *nb, ··· 815 811 mlx5e_rep_indr_register_block(rpriv, netdev); 816 812 break; 817 813 case NETDEV_UNREGISTER: 818 - mlx5e_rep_indr_unregister_block(netdev); 814 + mlx5e_rep_indr_unregister_block(rpriv, netdev); 819 815 break; 820 816 } 821 817 return NOTIFY_OK;
+13
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
··· 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 752 } 755 753 756 754 if (unlikely(test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state))) 755 + goto csum_unnecessary; 756 + 757 + /* CQE csum doesn't cover padding octets in short ethernet 758 + * frames. And the pad field is appended prior to calculating 759 + * and appending the FCS field. 760 + * 761 + * Detecting these padded frames requires to verify and parse 762 + * IP headers, so we simply force all those small frames to be 763 + * CHECKSUM_UNNECESSARY even if they are not padded. 764 + */ 765 + if (short_frame(skb->len)) 757 766 goto csum_unnecessary; 758 767 759 768 if (likely(is_last_ethertype_ip(skb, &network_depth, &proto))) {
+9 -7
drivers/net/ethernet/mellanox/mlxsw/pci.c
··· 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) ··· 1367 1365 u32 val = mlxsw_pci_read32(mlxsw_pci, FW_READY); 1368 1366 1369 1367 if ((val & MLXSW_PCI_FW_READY_MASK) == MLXSW_PCI_FW_READY_MAGIC) 1370 - break; 1368 + return 0; 1371 1369 cond_resched(); 1372 1370 } while (time_before(jiffies, end)); 1373 - return 0; 1371 + return -EBUSY; 1374 1372 } 1375 1373 1376 1374 static int mlxsw_pci_alloc_irq_vectors(struct mlxsw_pci *mlxsw_pci)
+2 -1
drivers/net/ethernet/mellanox/mlxsw/pci_hw.h
··· 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 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)
+2 -2
drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c
··· 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
+6 -6
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
··· 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 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 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) ··· 1320 1321 bool dynamic) 1321 1322 { 1322 1323 return __mlxsw_sp_port_fdb_uc_op(mlxsw_sp, local_port, mac, fid, adding, 1323 - MLXSW_REG_SFD_REC_ACTION_NOP, dynamic); 1324 + MLXSW_REG_SFD_REC_ACTION_NOP, 1325 + mlxsw_sp_sfd_rec_policy(dynamic)); 1324 1326 } 1325 1327 1326 1328 int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid, ··· 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,
+1 -1
drivers/net/macvlan.c
··· 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
+2
drivers/net/phy/bcm87xx.c
··· 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, ··· 209 208 .phy_id = PHY_ID_BCM8727, 210 209 .phy_id_mask = 0xffffffff, 211 210 .name = "Broadcom BCM8727", 211 + .features = PHY_10GBIT_FEC_FEATURES, 212 212 .config_init = bcm87xx_config_init, 213 213 .config_aneg = bcm87xx_config_aneg, 214 214 .read_status = bcm87xx_read_status,
+1
drivers/net/phy/cortina.c
··· 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,
+35 -2
drivers/net/phy/marvell.c
··· 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 ··· 1435 1402 * before enabling it if !phy_interrupt_is_valid() 1436 1403 */ 1437 1404 if (!phy_interrupt_is_valid(phydev)) 1438 - phy_read(phydev, MII_M1011_IEVENT); 1405 + __phy_read(phydev, MII_M1011_IEVENT); 1439 1406 1440 1407 /* Enable the WOL interrupt */ 1441 1408 err = __phy_modify(phydev, MII_88E1318S_PHY_CSIER, 0, ··· 2316 2283 .features = PHY_GBIT_FEATURES, 2317 2284 .probe = m88e6390_probe, 2318 2285 .config_init = &marvell_config_init, 2319 - .config_aneg = &m88e1510_config_aneg, 2286 + .config_aneg = &m88e6390_config_aneg, 2320 2287 .read_status = &marvell_read_status, 2321 2288 .ack_interrupt = &marvell_ack_interrupt, 2322 2289 .config_intr = &marvell_config_intr,
+1
drivers/net/phy/mdio_bus.c
··· 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;
+1
drivers/net/phy/meson-gxl.c
··· 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,
+2
drivers/net/phy/micrel.c
··· 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, ··· 1099 1098 .phy_id = PHY_ID_KSZ8873MLL, 1100 1099 .phy_id_mask = MICREL_PHY_ID_MASK, 1101 1100 .name = "Micrel KSZ8873MLL Switch", 1101 + .features = PHY_BASIC_FEATURES, 1102 1102 .config_init = kszphy_config_init, 1103 1103 .config_aneg = ksz8873mll_config_aneg, 1104 1104 .read_status = ksz8873mll_read_status,
+7 -12
drivers/net/phy/phy.c
··· 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 ··· 553 560 if (err < 0) 554 561 goto out_unlock; 555 562 556 - if (phydev->autoneg == AUTONEG_ENABLE) { 557 - err = phy_check_link_status(phydev); 558 - } else { 559 - phydev->state = PHY_FORCING; 560 - phydev->link_timeout = PHY_FORCE_TIMEOUT; 563 + if (__phy_is_started(phydev)) { 564 + if (phydev->autoneg == AUTONEG_ENABLE) { 565 + err = phy_check_link_status(phydev); 566 + } else { 567 + phydev->state = PHY_FORCING; 568 + phydev->link_timeout = PHY_FORCE_TIMEOUT; 569 + } 561 570 } 562 571 563 572 out_unlock:
+17
drivers/net/phy/phy_device.c
··· 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, ··· 111 108 ETHTOOL_LINK_MODE_10000baseT_Full_BIT, 112 109 }; 113 110 EXPORT_SYMBOL_GPL(phy_10gbit_features_array); 111 + 112 + const int phy_10gbit_fec_features_array[1] = { 113 + ETHTOOL_LINK_MODE_10000baseR_FEC_BIT, 114 + }; 115 + EXPORT_SYMBOL_GPL(phy_10gbit_fec_features_array); 114 116 115 117 __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_full_features) __ro_after_init; 116 118 EXPORT_SYMBOL_GPL(phy_10gbit_full_features); ··· 199 191 linkmode_set_bit_array(phy_10gbit_full_features_array, 200 192 ARRAY_SIZE(phy_10gbit_full_features_array), 201 193 phy_10gbit_full_features); 194 + /* 10G FEC only */ 195 + linkmode_set_bit_array(phy_10gbit_fec_features_array, 196 + ARRAY_SIZE(phy_10gbit_fec_features_array), 197 + phy_10gbit_fec_features); 202 198 } 203 199 204 200 void phy_device_free(struct phy_device *phydev) ··· 2254 2242 int phy_driver_register(struct phy_driver *new_driver, struct module *owner) 2255 2243 { 2256 2244 int retval; 2245 + 2246 + if (WARN_ON(!new_driver->features)) { 2247 + pr_err("%s: Driver features are missing\n", new_driver->name); 2248 + return -EINVAL; 2249 + } 2257 2250 2258 2251 new_driver->mdiodrv.flags |= MDIO_DEVICE_IS_PHY; 2259 2252 new_driver->mdiodrv.driver.name = new_driver->name;
+1
drivers/net/phy/teranetics.c
··· 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,
+1
drivers/net/ppp/pppoe.c
··· 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)
+15
drivers/net/usb/aqc111.c
··· 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); ··· 1454 1440 {AQC111_USB_ETH_DEV(0x2eca, 0xc101, aqc111_info)}, 1455 1441 {AQC111_USB_ETH_DEV(0x0b95, 0x2790, asix111_info)}, 1456 1442 {AQC111_USB_ETH_DEV(0x0b95, 0x2791, asix112_info)}, 1443 + {AQC111_USB_ETH_DEV(0x20f4, 0xe05a, trendnet_info)}, 1457 1444 { },/* END */ 1458 1445 }; 1459 1446 MODULE_DEVICE_TABLE(usb, products);
+8
drivers/net/usb/cdc_ether.c
··· 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.
+6 -6
drivers/net/virtio_net.c
··· 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 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 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 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 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 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);
+2 -1
drivers/vhost/net.c
··· 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);
+83 -14
drivers/vhost/vhost.c
··· 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); ··· 1847 1773 smp_wmb(); 1848 1774 /* Log used flag write. */ 1849 1775 used = &vq->used->flags; 1850 - log_write(vq->log_base, vq->log_addr + 1851 - (used - (void __user *)vq->used), 1852 - sizeof vq->used->flags); 1776 + log_used(vq, (used - (void __user *)vq->used), 1777 + sizeof vq->used->flags); 1853 1778 if (vq->log_ctx) 1854 1779 eventfd_signal(vq->log_ctx, 1); 1855 1780 } ··· 1866 1793 smp_wmb(); 1867 1794 /* Log avail event write */ 1868 1795 used = vhost_avail_event(vq); 1869 - log_write(vq->log_base, vq->log_addr + 1870 - (used - (void __user *)vq->used), 1871 - sizeof *vhost_avail_event(vq)); 1796 + log_used(vq, (used - (void __user *)vq->used), 1797 + sizeof *vhost_avail_event(vq)); 1872 1798 if (vq->log_ctx) 1873 1799 eventfd_signal(vq->log_ctx, 1); 1874 1800 } ··· 2267 2195 /* Make sure data is seen before log. */ 2268 2196 smp_wmb(); 2269 2197 /* Log used ring entry write. */ 2270 - log_write(vq->log_base, 2271 - vq->log_addr + 2272 - ((void __user *)used - (void __user *)vq->used), 2273 - count * sizeof *used); 2198 + log_used(vq, ((void __user *)used - (void __user *)vq->used), 2199 + count * sizeof *used); 2274 2200 } 2275 2201 old = vq->last_used_idx; 2276 2202 new = (vq->last_used_idx += count); ··· 2310 2240 /* Make sure used idx is seen before log. */ 2311 2241 smp_wmb(); 2312 2242 /* Log used index update. */ 2313 - log_write(vq->log_base, 2314 - vq->log_addr + offsetof(struct vring_used, idx), 2315 - sizeof vq->used->idx); 2243 + log_used(vq, offsetof(struct vring_used, idx), 2244 + sizeof vq->used->idx); 2316 2245 if (vq->log_ctx) 2317 2246 eventfd_signal(vq->log_ctx, 1); 2318 2247 }
+2 -1
drivers/vhost/vhost.h
··· 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);
+4 -2
include/linux/phy.h
··· 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) ··· 57 56 #define PHY_GBIT_FIBRE_FEATURES ((unsigned long *)&phy_gbit_fibre_features) 58 57 #define PHY_GBIT_ALL_PORTS_FEATURES ((unsigned long *)&phy_gbit_all_ports_features) 59 58 #define PHY_10GBIT_FEATURES ((unsigned long *)&phy_10gbit_features) 59 + #define PHY_10GBIT_FEC_FEATURES ((unsigned long *)&phy_10gbit_fec_features) 60 60 #define PHY_10GBIT_FULL_FEATURES ((unsigned long *)&phy_10gbit_full_features) 61 61 62 62 extern const int phy_10_100_features_array[4]; ··· 469 467 * only works for PHYs with IDs which match this field 470 468 * name: The friendly name of this PHY type 471 469 * phy_id_mask: Defines the important bits of the phy_id 472 - * features: A list of features (speed, duplex, etc) supported 473 - * by this PHY 470 + * features: A mandatory list of features (speed, duplex, etc) 471 + * supported by this PHY 474 472 * flags: A bitfield defining certain other features this PHY 475 473 * supports (like interrupts) 476 474 *
+1
include/linux/skbuff.h
··· 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)
-16
include/net/af_rxrpc.h
··· 21 21 struct rxrpc_call; 22 22 23 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 - /* 36 24 * Debug ID counter for tracing. 37 25 */ 38 26 extern atomic_t rxrpc_debug_id; ··· 61 73 rxrpc_user_attach_call_t, unsigned long, gfp_t, 62 74 unsigned int); 63 75 void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64); 64 - int rxrpc_kernel_retry_call(struct socket *, struct rxrpc_call *, 65 - struct sockaddr_rxrpc *, struct key *); 66 - int rxrpc_kernel_check_call(struct socket *, struct rxrpc_call *, 67 - enum rxrpc_call_completion *, u32 *); 68 76 u32 rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *); 69 77 void rxrpc_kernel_probe_life(struct socket *, struct rxrpc_call *); 70 78 u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *);
+1 -1
include/net/ip_fib.h
··· 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);
-1
include/net/netfilter/nf_flow_table.h
··· 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
+1 -1
include/uapi/linux/in.h
··· 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)
+1 -1
kernel/bpf/btf.c
··· 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;
+1
kernel/bpf/cgroup.c
··· 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 }
+15 -2
kernel/bpf/map_in_map.c
··· 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); ··· 37 36 return ERR_PTR(-EINVAL); 38 37 } 39 38 40 - inner_map_meta = kzalloc(sizeof(*inner_map_meta), GFP_USER); 39 + inner_map_meta_size = sizeof(*inner_map_meta); 40 + /* In some cases verifier needs to access beyond just base map. */ 41 + if (inner_map->ops == &array_map_ops) 42 + inner_map_meta_size = sizeof(struct bpf_array); 43 + 44 + inner_map_meta = kzalloc(inner_map_meta_size, GFP_USER); 41 45 if (!inner_map_meta) { 42 46 fdput(f); 43 47 return ERR_PTR(-ENOMEM); ··· 52 46 inner_map_meta->key_size = inner_map->key_size; 53 47 inner_map_meta->value_size = inner_map->value_size; 54 48 inner_map_meta->map_flags = inner_map->map_flags; 55 - inner_map_meta->ops = inner_map->ops; 56 49 inner_map_meta->max_entries = inner_map->max_entries; 50 + 51 + /* Misc members not needed in bpf_map_meta_equal() check. */ 52 + inner_map_meta->ops = inner_map->ops; 53 + if (inner_map->ops == &array_map_ops) { 54 + inner_map_meta->unpriv_array = inner_map->unpriv_array; 55 + container_of(inner_map_meta, struct bpf_array, map)->index_mask = 56 + container_of(inner_map, struct bpf_array, map)->index_mask; 57 + } 57 58 58 59 fdput(f); 59 60 return inner_map_meta;
+7 -2
kernel/bpf/stackmap.c
··· 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) + ··· 314 311 for (i = 0; i < trace_nr; i++) { 315 312 id_offs[i].status = BPF_STACK_BUILD_ID_IP; 316 313 id_offs[i].ip = ips[i]; 314 + memset(id_offs[i].build_id, 0, BPF_BUILD_ID_SIZE); 317 315 } 318 316 return; 319 317 } ··· 325 321 /* per entry fall back to ips */ 326 322 id_offs[i].status = BPF_STACK_BUILD_ID_IP; 327 323 id_offs[i].ip = ips[i]; 324 + memset(id_offs[i].build_id, 0, BPF_BUILD_ID_SIZE); 328 325 continue; 329 326 } 330 327 id_offs[i].offset = (vma->vm_pgoff << PAGE_SHIFT) + ips[i]
+1 -1
net/bpfilter/bpfilter_umh_blob.S
··· 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"
+5
net/bridge/br_fdb.c
··· 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 { ··· 1148 1146 fdb->added_by_external_learn = 1; 1149 1147 modified = true; 1150 1148 } 1149 + 1150 + if (swdev_notify) 1151 + fdb->added_by_user = 1; 1151 1152 1152 1153 if (modified) 1153 1154 fdb_notify(br, fdb, RTM_NEWNEIGH, swdev_notify);
+4 -5
net/bridge/br_forward.c
··· 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 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;
+1
net/bridge/br_netfilter_ipv6.c
··· 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;
+4 -2
net/bridge/netfilter/ebtables.c
··· 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;
+1
net/bridge/netfilter/nft_reject_bridge.c
··· 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;
+20 -12
net/core/filter.c
··· 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 ? ··· 4120 4119 sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF); 4121 4120 break; 4122 4121 case SO_MAX_PACING_RATE: /* 32bit version */ 4122 + if (val != ~0U) 4123 + cmpxchg(&sk->sk_pacing_status, 4124 + SK_PACING_NONE, 4125 + SK_PACING_NEEDED); 4123 4126 sk->sk_max_pacing_rate = (val == ~0U) ? ~0UL : val; 4124 4127 sk->sk_pacing_rate = min(sk->sk_pacing_rate, 4125 4128 sk->sk_max_pacing_rate); ··· 4137 4132 sk->sk_rcvlowat = val ? : 1; 4138 4133 break; 4139 4134 case SO_MARK: 4140 - sk->sk_mark = val; 4135 + if (sk->sk_mark != val) { 4136 + sk->sk_mark = val; 4137 + sk_dst_reset(sk); 4138 + } 4141 4139 break; 4142 4140 default: 4143 4141 ret = -EINVAL; ··· 5317 5309 case BPF_FUNC_trace_printk: 5318 5310 if (capable(CAP_SYS_ADMIN)) 5319 5311 return bpf_get_trace_printk_proto(); 5320 - /* else: fall through */ 5312 + /* else, fall through */ 5321 5313 default: 5322 5314 return NULL; 5323 5315 }
+1
net/core/lwt_bpf.c
··· 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;
+2 -2
net/core/neighbour.c
··· 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 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. */
+2 -2
net/ipv4/fib_frontend.c
··· 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 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 }
+12 -3
net/ipv4/fib_trie.c
··· 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 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 }
+7 -2
net/ipv4/fou.c
··· 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]; ··· 1059 1058 1060 1059 optlen = guehdr->hlen << 2; 1061 1060 1061 + if (!pskb_may_pull(skb, len + optlen)) 1062 + return -EINVAL; 1063 + 1064 + guehdr = (struct guehdr *)&udp_hdr(skb)[1]; 1062 1065 if (validate_gue_flags(guehdr, optlen)) 1063 1066 return -EINVAL; 1064 1067
+14 -9
net/ipv4/ip_gre.c
··· 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; ··· 577 578 struct erspan_metadata *md; 578 579 struct rtable *rt = NULL; 579 580 bool truncate = false; 581 + __be16 df, proto; 580 582 struct flowi4 fl; 581 583 int tunnel_hlen; 582 584 int version; 583 - __be16 df; 584 585 int nhoff; 585 586 int thoff; 586 587 ··· 625 626 if (version == 1) { 626 627 erspan_build_header(skb, ntohl(tunnel_id_to_key32(key->tun_id)), 627 628 ntohl(md->u.index), truncate, true); 629 + proto = htons(ETH_P_ERSPAN); 628 630 } else if (version == 2) { 629 631 erspan_build_header_v2(skb, 630 632 ntohl(tunnel_id_to_key32(key->tun_id)), 631 633 md->u.md2.dir, 632 634 get_hwid(&md->u.md2), 633 635 truncate, true); 636 + proto = htons(ETH_P_ERSPAN2); 634 637 } else { 635 638 goto err_free_rt; 636 639 } 637 640 638 641 gre_build_header(skb, 8, TUNNEL_SEQ, 639 - htons(ETH_P_ERSPAN), 0, htonl(tunnel->o_seqno++)); 642 + proto, 0, htonl(tunnel->o_seqno++)); 640 643 641 644 df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0; 642 645 ··· 722 721 { 723 722 struct ip_tunnel *tunnel = netdev_priv(dev); 724 723 bool truncate = false; 724 + __be16 proto; 725 725 726 726 if (!pskb_inet_may_pull(skb)) 727 727 goto free_skb; 728 728 729 729 if (tunnel->collect_md) { 730 - erspan_fb_xmit(skb, dev, skb->protocol); 730 + erspan_fb_xmit(skb, dev); 731 731 return NETDEV_TX_OK; 732 732 } 733 733 ··· 744 742 } 745 743 746 744 /* Push ERSPAN header */ 747 - if (tunnel->erspan_ver == 1) 745 + if (tunnel->erspan_ver == 1) { 748 746 erspan_build_header(skb, ntohl(tunnel->parms.o_key), 749 747 tunnel->index, 750 748 truncate, true); 751 - else if (tunnel->erspan_ver == 2) 749 + proto = htons(ETH_P_ERSPAN); 750 + } else if (tunnel->erspan_ver == 2) { 752 751 erspan_build_header_v2(skb, ntohl(tunnel->parms.o_key), 753 752 tunnel->dir, tunnel->hwid, 754 753 truncate, true); 755 - else 754 + proto = htons(ETH_P_ERSPAN2); 755 + } else { 756 756 goto free_skb; 757 + } 757 758 758 759 tunnel->parms.o_flags &= ~TUNNEL_KEY; 759 - __gre_xmit(skb, dev, &tunnel->parms.iph, htons(ETH_P_ERSPAN)); 760 + __gre_xmit(skb, dev, &tunnel->parms.iph, proto); 760 761 return NETDEV_TX_OK; 761 762 762 763 free_skb:
+1
net/ipv4/ip_input.c
··· 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 */
+1 -1
net/ipv4/tcp.c
··· 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 }
+13 -5
net/ipv4/udp.c
··· 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; ··· 1926 1918 } 1927 1919 EXPORT_SYMBOL(udp_lib_rehash); 1928 1920 1929 - static void udp_v4_rehash(struct sock *sk) 1921 + void udp_v4_rehash(struct sock *sk) 1930 1922 { 1931 1923 u16 new_hash = ipv4_portaddr_hash(sock_net(sk), 1932 1924 inet_sk(sk)->inet_rcv_saddr,
+1
net/ipv4/udp_impl.h
··· 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);
+1
net/ipv4/udplite.c
··· 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,
+7 -2
net/ipv6/fou6.c
··· 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]; ··· 129 128 130 129 optlen = guehdr->hlen << 2; 131 130 131 + if (!pskb_may_pull(skb, len + optlen)) 132 + return -EINVAL; 133 + 134 + guehdr = (struct guehdr *)&udp_hdr(skb)[1]; 132 135 if (validate_gue_flags(guehdr, optlen)) 133 136 return -EINVAL; 134 137
+10 -4
net/ipv6/ip6_gre.c
··· 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; ··· 1036 1035 } 1037 1036 1038 1037 /* Push GRE header. */ 1039 - gre_build_header(skb, 8, TUNNEL_SEQ, 1040 - htons(ETH_P_ERSPAN), 0, htonl(t->o_seqno++)); 1038 + proto = (t->parms.erspan_ver == 1) ? htons(ETH_P_ERSPAN) 1039 + : htons(ETH_P_ERSPAN2); 1040 + gre_build_header(skb, 8, TUNNEL_SEQ, proto, 0, htonl(t->o_seqno++)); 1041 1041 1042 1042 /* TooBig packet may have updated dst->dev's mtu */ 1043 1043 if (!t->parms.collect_md && dst && dst_mtu(dst) > dst->dev->mtu) ··· 1171 1169 t->parms.i_flags = p->i_flags; 1172 1170 t->parms.o_flags = p->o_flags; 1173 1171 t->parms.fwmark = p->fwmark; 1172 + t->parms.erspan_ver = p->erspan_ver; 1173 + t->parms.index = p->index; 1174 + t->parms.dir = p->dir; 1175 + t->parms.hwid = p->hwid; 1174 1176 dst_cache_reset(&t->dst_cache); 1175 1177 } 1176 1178 ··· 2031 2025 struct nlattr *data[], 2032 2026 struct netlink_ext_ack *extack) 2033 2027 { 2034 - struct ip6gre_net *ign = net_generic(dev_net(dev), ip6gre_net_id); 2028 + struct ip6_tnl *t = netdev_priv(dev); 2029 + struct ip6gre_net *ign = net_generic(t->net, ip6gre_net_id); 2035 2030 struct __ip6_tnl_parm p; 2036 - struct ip6_tnl *t; 2037 2031 2038 2032 t = ip6gre_changelink_common(dev, tb, data, &p, extack); 2039 2033 if (IS_ERR(t))
+2 -12
net/ipv6/route.c
··· 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, ··· 4396 4407 nh->fib6_info = NULL; 4397 4408 if (err) { 4398 4409 if (replace && nhn) 4399 - ip6_print_replace_route_err(&rt6_nh_list); 4410 + NL_SET_ERR_MSG_MOD(extack, 4411 + "multipath route replace failed (check consistency of installed routes)"); 4400 4412 err_nh = nh; 4401 4413 goto add_errout; 4402 4414 }
+13 -5
net/ipv6/udp.c
··· 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 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;
+1
net/ipv6/udp_impl.h
··· 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);
+1
net/ipv6/udplite.c
··· 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,
+3 -2
net/netfilter/nf_flow_table_core.c
··· 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; ··· 51 50 ft->src_port = ctt->src.u.tcp.port; 52 51 ft->dst_port = ctt->dst.u.tcp.port; 53 52 54 - ft->iifidx = route->tuple[dir].ifindex; 55 - ft->oifidx = route->tuple[!dir].ifindex; 53 + ft->iifidx = other_dst->dev->ifindex; 54 + ft->oifidx = dst->dev->ifindex; 56 55 ft->dst_cache = dst; 57 56 } 58 57
+7 -7
net/netfilter/nf_tables_api.c
··· 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)) ··· 2320 2321 NLM_F_MULTI | NLM_F_APPEND, 2321 2322 table->family, 2322 2323 table, chain, rule) < 0) 2323 - goto out_unfinished; 2324 + return 1; 2324 2325 2325 2326 nl_dump_check_consistent(cb, nlmsg_hdr(skb)); 2326 2327 cont: 2327 2328 (*idx)++; 2328 2329 } 2329 - rc = 0; 2330 - out_unfinished: 2331 - cb->args[0] = *idx; 2332 - return rc; 2330 + return 0; 2333 2331 } 2334 2332 2335 2333 static int nf_tables_dump_rules(struct sk_buff *skb, ··· 2350 2354 if (ctx && ctx->table && strcmp(ctx->table, table->name) != 0) 2351 2355 continue; 2352 2356 2353 - if (ctx && ctx->chain) { 2357 + if (ctx && ctx->table && ctx->chain) { 2354 2358 struct rhlist_head *list, *tmp; 2355 2359 2356 2360 list = rhltable_lookup(&table->chains_ht, ctx->chain, ··· 2378 2382 } 2379 2383 done: 2380 2384 rcu_read_unlock(); 2385 + 2386 + cb->args[0] = idx; 2381 2387 return skb->len; 2382 2388 } 2383 2389 ··· 4506 4508 err5: 4507 4509 kfree(trans); 4508 4510 err4: 4511 + if (obj) 4512 + obj->use--; 4509 4513 kfree(elem.priv); 4510 4514 err3: 4511 4515 if (nla[NFTA_SET_ELEM_DATA] != NULL)
+8 -5
net/netfilter/nft_flow_offload.c
··· 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; ··· 30 29 memset(&fl, 0, sizeof(fl)); 31 30 switch (nft_pf(pkt)) { 32 31 case NFPROTO_IPV4: 33 - fl.u.ip4.daddr = ct->tuplehash[!dir].tuple.dst.u3.ip; 32 + fl.u.ip4.daddr = ct->tuplehash[dir].tuple.src.u3.ip; 33 + fl.u.ip4.flowi4_oif = nft_in(pkt)->ifindex; 34 34 break; 35 35 case NFPROTO_IPV6: 36 - fl.u.ip6.daddr = ct->tuplehash[!dir].tuple.dst.u3.in6; 36 + fl.u.ip6.daddr = ct->tuplehash[dir].tuple.src.u3.in6; 37 + fl.u.ip6.flowi6_oif = nft_in(pkt)->ifindex; 37 38 break; 38 39 } 39 40 ··· 44 41 return -ENOENT; 45 42 46 43 route->tuple[dir].dst = this_dst; 47 - route->tuple[dir].ifindex = nft_in(pkt)->ifindex; 48 44 route->tuple[!dir].dst = other_dst; 49 - route->tuple[!dir].ifindex = nft_out(pkt)->ifindex; 50 45 51 46 return 0; 52 47 } ··· 67 66 { 68 67 struct nft_flow_offload *priv = nft_expr_priv(expr); 69 68 struct nf_flowtable *flowtable = &priv->flowtable->data; 69 + const struct nf_conn_help *help; 70 70 enum ip_conntrack_info ctinfo; 71 71 struct nf_flow_route route; 72 72 struct flow_offload *flow; ··· 90 88 goto out; 91 89 } 92 90 93 - if (test_bit(IPS_HELPER_BIT, &ct->status)) 91 + help = nfct_help(ct); 92 + if (help) 94 93 goto out; 95 94 96 95 if (ctinfo == IP_CT_NEW ||
+1 -1
net/openvswitch/flow_netlink.c
··· 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 }
+2 -1
net/packet/af_packet.c
··· 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
-70
net/rxrpc/af_rxrpc.c
··· 419 419 EXPORT_SYMBOL(rxrpc_kernel_get_epoch); 420 420 421 421 /** 422 - * rxrpc_kernel_check_call - Check a call's state 423 - * @sock: The socket the call is on 424 - * @call: The call to check 425 - * @_compl: Where to store the completion state 426 - * @_abort_code: Where to store any abort code 427 - * 428 - * Allow a kernel service to query the state of a call and find out the manner 429 - * of its termination if it has completed. Returns -EINPROGRESS if the call is 430 - * still going, 0 if the call finished successfully, -ECONNABORTED if the call 431 - * was aborted and an appropriate error if the call failed in some other way. 432 - */ 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 - /** 492 422 * rxrpc_kernel_new_call_notification - Get notifications of new calls 493 423 * @sock: The socket to intercept received messages on 494 424 * @notify_new_call: Function to be called when new calls appear
+12 -7
net/rxrpc/ar-internal.h
··· 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 */ ··· 514 515 RXRPC_CALL_SERVER_AWAIT_ACK, /* - server awaiting final ACK */ 515 516 RXRPC_CALL_COMPLETE, /* - call complete */ 516 517 NR__RXRPC_CALL_STATES 518 + }; 519 + 520 + /* 521 + * Call completion condition (state == RXRPC_CALL_COMPLETE). 522 + */ 523 + enum rxrpc_call_completion { 524 + RXRPC_CALL_SUCCEEDED, /* - Normal termination */ 525 + RXRPC_CALL_REMOTELY_ABORTED, /* - call aborted by peer */ 526 + RXRPC_CALL_LOCALLY_ABORTED, /* - call aborted locally on error or close */ 527 + RXRPC_CALL_LOCAL_ERROR, /* - call failed due to local error */ 528 + RXRPC_CALL_NETWORK_ERROR, /* - call terminated by network error */ 529 + NR__RXRPC_CALL_COMPLETIONS 517 530 }; 518 531 519 532 /* ··· 772 761 struct sockaddr_rxrpc *, 773 762 struct rxrpc_call_params *, gfp_t, 774 763 unsigned int); 775 - int rxrpc_retry_client_call(struct rxrpc_sock *, 776 - struct rxrpc_call *, 777 - struct rxrpc_conn_parameters *, 778 - struct sockaddr_rxrpc *, 779 - gfp_t); 780 764 void rxrpc_incoming_call(struct rxrpc_sock *, struct rxrpc_call *, 781 765 struct sk_buff *); 782 766 void rxrpc_release_call(struct rxrpc_sock *, struct rxrpc_call *); 783 - int rxrpc_prepare_call_for_retry(struct rxrpc_sock *, struct rxrpc_call *); 784 767 void rxrpc_release_calls_on_socket(struct rxrpc_sock *); 785 768 bool __rxrpc_queue_call(struct rxrpc_call *); 786 769 bool rxrpc_queue_call(struct rxrpc_call *);
-97
net/rxrpc/call_object.c
··· 325 325 } 326 326 327 327 /* 328 - * Retry a call to a new address. It is expected that the Tx queue of the call 329 - * will contain data previously packaged for an old call. 330 - */ 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 - /* 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. 372 330 */ ··· 489 531 } 490 532 491 533 _leave(""); 492 - } 493 - 494 - /* 495 - * Prepare a kernel service call for retry. 496 - */ 497 - int rxrpc_prepare_call_for_retry(struct rxrpc_sock *rx, struct rxrpc_call *call) 498 - { 499 - const void *here = __builtin_return_address(0); 500 - int i; 501 - u8 last = 0; 502 - 503 - _enter("{%d,%d}", call->debug_id, atomic_read(&call->usage)); 504 - 505 - trace_rxrpc_call(call, rxrpc_call_release, atomic_read(&call->usage), 506 - here, (const void *)call->flags); 507 - 508 - ASSERTCMP(call->state, ==, RXRPC_CALL_COMPLETE); 509 - ASSERTCMP(call->completion, !=, RXRPC_CALL_REMOTELY_ABORTED); 510 - ASSERTCMP(call->completion, !=, RXRPC_CALL_LOCALLY_ABORTED); 511 - ASSERT(list_empty(&call->recvmsg_link)); 512 - 513 - del_timer_sync(&call->timer); 514 - 515 - _debug("RELEASE CALL %p (%d CONN %p)", call, call->debug_id, call->conn); 516 - 517 - if (call->conn) 518 - rxrpc_disconnect_call(call); 519 - 520 - if (rxrpc_is_service_call(call) || 521 - !call->tx_phase || 522 - call->tx_hard_ack != 0 || 523 - call->rx_hard_ack != 0 || 524 - call->rx_top != 0) 525 - return -EINVAL; 526 - 527 - call->state = RXRPC_CALL_UNINITIALISED; 528 - call->completion = RXRPC_CALL_SUCCEEDED; 529 - call->call_id = 0; 530 - call->cid = 0; 531 - call->cong_cwnd = 0; 532 - call->cong_extra = 0; 533 - call->cong_ssthresh = 0; 534 - call->cong_mode = 0; 535 - call->cong_dup_acks = 0; 536 - call->cong_cumul_acks = 0; 537 - call->acks_lowest_nak = 0; 538 - 539 - for (i = 0; i < RXRPC_RXTX_BUFF_SIZE; i++) { 540 - last |= call->rxtx_annotations[i]; 541 - call->rxtx_annotations[i] &= RXRPC_TX_ANNO_LAST; 542 - call->rxtx_annotations[i] |= RXRPC_TX_ANNO_RETRANS; 543 - } 544 - 545 - _leave(" = 0"); 546 - return 0; 547 534 } 548 535 549 536 /*
+1 -4
net/rxrpc/conn_client.c
··· 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);
+11 -13
net/rxrpc/sendmsg.c
··· 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. ··· 384 386 call->tx_total_len -= copy; 385 387 } 386 388 389 + /* check for the far side aborting the call or a network error 390 + * occurring */ 391 + if (call->state == RXRPC_CALL_COMPLETE) 392 + goto call_terminated; 393 + 387 394 /* add the packet to the send queue if it's now full */ 388 395 if (sp->remain <= 0 || 389 396 (msg_data_left(msg) == 0 && !more)) { ··· 428 425 notify_end_tx); 429 426 skb = NULL; 430 427 } 431 - 432 - /* Check for the far side aborting the call or a network error 433 - * occurring. If this happens, save any packet that was under 434 - * construction so that in the case of a network error, the 435 - * call can be retried or redirected. 436 - */ 437 - if (call->state == RXRPC_CALL_COMPLETE) { 438 - ret = call->error; 439 - goto out; 440 - } 441 428 } while (msg_data_left(msg) > 0); 442 429 443 430 success: ··· 436 443 call->tx_pending = skb; 437 444 _leave(" = %d", ret); 438 445 return ret; 446 + 447 + call_terminated: 448 + rxrpc_free_skb(skb, rxrpc_skb_tx_freed); 449 + _leave(" = %d", call->error); 450 + return call->error; 439 451 440 452 maybe_error: 441 453 if (copied)
+11 -8
net/sched/act_tunnel_key.c
··· 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, ··· 369 360 rcu_swap_protected(t->params, params_new, 370 361 lockdep_is_held(&t->tcf_lock)); 371 362 spin_unlock_bh(&t->tcf_lock); 372 - if (params_new) 373 - kfree_rcu(params_new, rcu); 363 + tunnel_key_release_params(params_new); 374 364 375 365 if (ret == ACT_P_CREATED) 376 366 tcf_idr_insert(tn, *a); ··· 393 385 struct tcf_tunnel_key_params *params; 394 386 395 387 params = rcu_dereference_protected(t->params, 1); 396 - if (params) { 397 - if (params->tcft_action == TCA_TUNNEL_KEY_ACT_SET) 398 - dst_release(&params->tcft_enc_metadata->dst); 399 - 400 - kfree_rcu(params, rcu); 401 - } 388 + tunnel_key_release_params(params); 402 389 } 403 390 404 391 static int tunnel_key_geneve_opts_dump(struct sk_buff *skb,
+1 -2
net/sched/cls_api.c
··· 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; ··· 1286 1287 reclassify: 1287 1288 #endif 1288 1289 for (; tp; tp = rcu_dereference_bh(tp->next)) { 1290 + __be16 protocol = tc_skb_protocol(skb); 1289 1291 int err; 1290 1292 1291 1293 if (tp->protocol != protocol && ··· 1319 1319 } 1320 1320 1321 1321 tp = first_tp; 1322 - protocol = tc_skb_protocol(skb); 1323 1322 goto reclassify; 1324 1323 #endif 1325 1324 }
+14 -5
net/sched/cls_flower.c
··· 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 + 1304 + tb = kcalloc(TCA_FLOWER_MAX + 1, sizeof(struct nlattr *), GFP_KERNEL); 1305 + if (!tb) { 1306 + err = -ENOBUFS; 1307 + goto errout_mask_alloc; 1308 + } 1303 1309 1304 1310 err = nla_parse_nested(tb, TCA_FLOWER_MAX, tca[TCA_OPTIONS], 1305 1311 fl_policy, NULL); ··· 1349 1343 } 1350 1344 } 1351 1345 1352 - err = fl_set_parms(net, tp, fnew, &mask, base, tb, tca[TCA_RATE], ovr, 1346 + err = fl_set_parms(net, tp, fnew, mask, base, tb, tca[TCA_RATE], ovr, 1353 1347 tp->chain->tmplt_priv, extack); 1354 1348 if (err) 1355 1349 goto errout_idr; 1356 1350 1357 - err = fl_check_assign_mask(head, fnew, fold, &mask); 1351 + err = fl_check_assign_mask(head, fnew, fold, mask); 1358 1352 if (err) 1359 1353 goto errout_idr; 1360 1354 ··· 1398 1392 } 1399 1393 1400 1394 kfree(tb); 1395 + kfree(mask); 1401 1396 return 0; 1402 1397 1403 1398 errout_mask: ··· 1412 1405 kfree(fnew); 1413 1406 errout_tb: 1414 1407 kfree(tb); 1408 + errout_mask_alloc: 1409 + kfree(mask); 1415 1410 return err; 1416 1411 } 1417 1412
+3 -2
net/sched/sch_cake.c
··· 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 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++; ··· 1697 1696 sch->qstats.backlog += slen; 1698 1697 q->avg_window_bytes += slen; 1699 1698 1700 - qdisc_tree_reduce_backlog(sch, 1, len); 1699 + qdisc_tree_reduce_backlog(sch, 1-numsegs, len-slen); 1701 1700 consume_skb(skb); 1702 1701 } else { 1703 1702 /* not splitting */
+2 -1
net/sched/sch_cbs.c
··· 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;
+5 -2
net/sched/sch_drr.c
··· 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) { ··· 364 362 return err; 365 363 } 366 364 365 + first = !cl->qdisc->q.qlen; 367 366 err = qdisc_enqueue(skb, cl->qdisc, to_free); 368 367 if (unlikely(err != NET_XMIT_SUCCESS)) { 369 368 if (net_xmit_drop_count(err)) { ··· 374 371 return err; 375 372 } 376 373 377 - if (cl->qdisc->q.qlen == 1) { 374 + if (first) { 378 375 list_add_tail(&cl->alist, &q->active); 379 376 cl->deficit = cl->quantum; 380 377 } 381 378 382 - qdisc_qstats_backlog_inc(sch, skb); 379 + sch->qstats.backlog += len; 383 380 sch->q.qlen++; 384 381 return err; 385 382 }
+2 -1
net/sched/sch_dsmark.c
··· 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 ··· 272 271 return err; 273 272 } 274 273 275 - qdisc_qstats_backlog_inc(sch, skb); 274 + sch->qstats.backlog += len; 276 275 sch->q.qlen++; 277 276 278 277 return NET_XMIT_SUCCESS;
+5 -4
net/sched/sch_hfsc.c
··· 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) { ··· 1552 1550 return err; 1553 1551 } 1554 1552 1553 + first = !cl->qdisc->q.qlen; 1555 1554 err = qdisc_enqueue(skb, cl->qdisc, to_free); 1556 1555 if (unlikely(err != NET_XMIT_SUCCESS)) { 1557 1556 if (net_xmit_drop_count(err)) { ··· 1562 1559 return err; 1563 1560 } 1564 1561 1565 - if (cl->qdisc->q.qlen == 1) { 1566 - unsigned int len = qdisc_pkt_len(skb); 1567 - 1562 + if (first) { 1568 1563 if (cl->cl_flags & HFSC_RSC) 1569 1564 init_ed(cl, len); 1570 1565 if (cl->cl_flags & HFSC_FSC) ··· 1577 1576 1578 1577 } 1579 1578 1580 - qdisc_qstats_backlog_inc(sch, skb); 1579 + sch->qstats.backlog += len; 1581 1580 sch->q.qlen++; 1582 1581 1583 1582 return NET_XMIT_SUCCESS;
+2 -1
net/sched/sch_htb.c
··· 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 ··· 611 610 htb_activate(q, cl); 612 611 } 613 612 614 - qdisc_qstats_backlog_inc(sch, skb); 613 + sch->qstats.backlog += len; 615 614 sch->q.qlen++; 616 615 return NET_XMIT_SUCCESS; 617 616 }
+2 -1
net/sched/sch_prio.c
··· 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 ··· 89 88 90 89 ret = qdisc_enqueue(skb, qdisc, to_free); 91 90 if (ret == NET_XMIT_SUCCESS) { 92 - qdisc_qstats_backlog_inc(sch, skb); 91 + sch->qstats.backlog += len; 93 92 sch->q.qlen++; 94 93 return NET_XMIT_SUCCESS; 95 94 }
+12 -8
net/sched/sch_qfq.c
··· 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) { ··· 1226 1224 } 1227 1225 pr_debug("qfq_enqueue: cl = %x\n", cl->common.classid); 1228 1226 1229 - if (unlikely(cl->agg->lmax < qdisc_pkt_len(skb))) { 1227 + if (unlikely(cl->agg->lmax < len)) { 1230 1228 pr_debug("qfq: increasing maxpkt from %u to %u for class %u", 1231 - cl->agg->lmax, qdisc_pkt_len(skb), cl->common.classid); 1232 - err = qfq_change_agg(sch, cl, cl->agg->class_weight, 1233 - qdisc_pkt_len(skb)); 1229 + cl->agg->lmax, len, cl->common.classid); 1230 + err = qfq_change_agg(sch, cl, cl->agg->class_weight, len); 1234 1231 if (err) { 1235 1232 cl->qstats.drops++; 1236 1233 return qdisc_drop(skb, sch, to_free); 1237 1234 } 1238 1235 } 1239 1236 1237 + gso_segs = skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1; 1238 + first = !cl->qdisc->q.qlen; 1240 1239 err = qdisc_enqueue(skb, cl->qdisc, to_free); 1241 1240 if (unlikely(err != NET_XMIT_SUCCESS)) { 1242 1241 pr_debug("qfq_enqueue: enqueue failed %d\n", err); ··· 1248 1245 return err; 1249 1246 } 1250 1247 1251 - bstats_update(&cl->bstats, skb); 1252 - qdisc_qstats_backlog_inc(sch, skb); 1248 + cl->bstats.bytes += len; 1249 + cl->bstats.packets += gso_segs; 1250 + sch->qstats.backlog += len; 1253 1251 ++sch->q.qlen; 1254 1252 1255 1253 agg = cl->agg; 1256 1254 /* if the queue was not empty, then done here */ 1257 - if (cl->qdisc->q.qlen != 1) { 1255 + if (!first) { 1258 1256 if (unlikely(skb == cl->qdisc->ops->peek(cl->qdisc)) && 1259 1257 list_first_entry(&agg->active, struct qfq_class, alist) 1260 - == cl && cl->deficit < qdisc_pkt_len(skb)) 1258 + == cl && cl->deficit < len) 1261 1259 list_move_tail(&cl->alist, &agg->active); 1262 1260 1263 1261 return err;
+2 -1
net/sched/sch_tbf.c
··· 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) { ··· 201 200 return ret; 202 201 } 203 202 204 - qdisc_qstats_backlog_inc(sch, skb); 203 + sch->qstats.backlog += len; 205 204 sch->q.qlen++; 206 205 return NET_XMIT_SUCCESS; 207 206 }
+1 -4
net/sctp/ipv6.c
··· 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; ··· 432 434 addr = kzalloc(sizeof(*addr), GFP_ATOMIC); 433 435 if (addr) { 434 436 addr->a.v6.sin6_family = AF_INET6; 435 - addr->a.v6.sin6_port = 0; 436 437 addr->a.v6.sin6_addr = ifp->addr; 437 438 addr->a.v6.sin6_scope_id = dev->ifindex; 438 439 addr->valid = 1;
+1 -3
net/sctp/protocol.c
··· 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); ··· 775 776 776 777 switch (ev) { 777 778 case NETDEV_UP: 778 - addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC); 779 + addr = kzalloc(sizeof(*addr), GFP_ATOMIC); 779 780 if (addr) { 780 781 addr->a.v4.sin_family = AF_INET; 781 - addr->a.v4.sin_port = 0; 782 782 addr->a.v4.sin_addr.s_addr = ifa->ifa_local; 783 783 addr->valid = 1; 784 784 spin_lock_bh(&net->sctp.local_addr_lock);
+1 -1
net/tipc/topsrv.c
··· 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);
+13 -3
net/xdp/xdp_umem.c
··· 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, ··· 95 88 goto out_rtnl_unlock; 96 89 } 97 90 98 - xdp_reg_umem_at_qid(dev, umem, queue_id); 91 + err = xdp_reg_umem_at_qid(dev, umem, queue_id); 92 + if (err) 93 + goto out_rtnl_unlock; 94 + 99 95 umem->dev = dev; 100 96 umem->queue_id = queue_id; 101 97 if (force_copy)
+1
samples/bpf/Makefile
··· 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 $@
+16
samples/bpf/asm_goto_workaround.h
··· 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
+8 -1
tools/bpf/bpftool/Makefile
··· 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 -6
tools/bpf/bpftool/json_writer.c
··· 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 - * 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 7 * 13 8 * Authors: Stephen Hemminger <stephen@networkplumber.org> 14 9 */
-5
tools/bpf/bpftool/json_writer.h
··· 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
+1163
tools/include/uapi/linux/pkt_sched.h
··· 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
+15 -4
tools/lib/bpf/bpf.c
··· 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; ··· 243 232 memcpy(attr.prog_name, load_attr->name, 244 233 min(name_len, BPF_OBJ_NAME_LEN - 1)); 245 234 246 - fd = sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); 235 + fd = sys_bpf_prog_load(&attr, sizeof(attr)); 247 236 if (fd >= 0) 248 237 return fd; 249 238 ··· 280 269 break; 281 270 } 282 271 283 - fd = sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); 272 + fd = sys_bpf_prog_load(&attr, sizeof(attr)); 284 273 285 274 if (fd >= 0) 286 275 goto done; ··· 294 283 attr.log_size = log_buf_sz; 295 284 attr.log_level = 1; 296 285 log_buf[0] = 0; 297 - fd = sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); 286 + fd = sys_bpf_prog_load(&attr, sizeof(attr)); 298 287 done: 299 288 free(finfo); 300 289 free(linfo); ··· 339 328 attr.kern_version = kern_version; 340 329 attr.prog_flags = prog_flags; 341 330 342 - return sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); 331 + return sys_bpf_prog_load(&attr, sizeof(attr)); 343 332 } 344 333 345 334 int bpf_map_update_elem(int fd, const void *key, const void *value,
+1
tools/testing/selftests/bpf/Makefile
··· 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
+30
tools/testing/selftests/bpf/test_progs.c
··· 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; ··· 1303 1301 previous_key = key; 1304 1302 } while (bpf_map_get_next_key(stackmap_fd, &previous_key, &key) == 0); 1305 1303 1304 + /* stack_map_get_build_id_offset() is racy and sometimes can return 1305 + * BPF_STACK_BUILD_ID_IP instead of BPF_STACK_BUILD_ID_VALID; 1306 + * try it one more time. 1307 + */ 1308 + if (build_id_matches < 1 && retry--) { 1309 + ioctl(pmu_fd, PERF_EVENT_IOC_DISABLE); 1310 + close(pmu_fd); 1311 + bpf_object__close(obj); 1312 + printf("%s:WARN:Didn't find expected build ID from the map, retrying\n", 1313 + __func__); 1314 + goto retry; 1315 + } 1316 + 1306 1317 if (CHECK(build_id_matches < 1, "build id match", 1307 1318 "Didn't find expected build ID from the map\n")) 1308 1319 goto disable_pmu; ··· 1356 1341 int i, j; 1357 1342 struct bpf_stack_build_id id_offs[PERF_MAX_STACK_DEPTH]; 1358 1343 int build_id_matches = 0; 1344 + int retry = 1; 1359 1345 1346 + retry: 1360 1347 err = bpf_prog_load(file, BPF_PROG_TYPE_PERF_EVENT, &obj, &prog_fd); 1361 1348 if (CHECK(err, "prog_load", "err %d errno %d\n", err, errno)) 1362 1349 return; ··· 1452 1435 } 1453 1436 previous_key = key; 1454 1437 } while (bpf_map_get_next_key(stackmap_fd, &previous_key, &key) == 0); 1438 + 1439 + /* stack_map_get_build_id_offset() is racy and sometimes can return 1440 + * BPF_STACK_BUILD_ID_IP instead of BPF_STACK_BUILD_ID_VALID; 1441 + * try it one more time. 1442 + */ 1443 + if (build_id_matches < 1 && retry--) { 1444 + ioctl(pmu_fd, PERF_EVENT_IOC_DISABLE); 1445 + close(pmu_fd); 1446 + bpf_object__close(obj); 1447 + printf("%s:WARN:Didn't find expected build ID from the map, retrying\n", 1448 + __func__); 1449 + goto retry; 1450 + } 1455 1451 1456 1452 if (CHECK(build_id_matches < 1, "build id match", 1457 1453 "Didn't find expected build ID from the map\n"))
+20
tools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh
··· 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 ··· 538 537 ip link del dev br-test 539 538 540 539 log_test "vlan interface uppers" 540 + 541 + ip link del dev br0 542 + } 543 + 544 + bridge_extern_learn_test() 545 + { 546 + # Test that externally learned entries added from user space are 547 + # marked as offloaded 548 + RET=0 549 + 550 + ip link add name br0 type bridge 551 + ip link set dev $swp1 master br0 552 + 553 + bridge fdb add de:ad:be:ef:13:37 dev $swp1 master extern_learn 554 + 555 + bridge fdb show brport $swp1 | grep de:ad:be:ef:13:37 | grep -q offload 556 + check_err $? "fdb entry not marked as offloaded when should" 557 + 558 + log_test "externally learned fdb entry" 541 559 542 560 ip link del dev br0 543 561 }
+33 -1
tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh
··· 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 ··· 107 107 108 108 ping_ipv4 109 109 ping_ipv6 110 + } 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 110 142 } 111 143 112 144 trap cleanup EXIT
+1 -1
tools/testing/selftests/networking/timestamping/txtimestamp.c
··· 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 ||
+44 -44
tools/testing/selftests/tc-testing/tc-tests/actions/ife.json
··· 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 },
+1 -30
tools/testing/selftests/tc-testing/tc-tests/actions/tunnel_key.json
··· 82 82 ] 83 83 }, 84 84 { 85 - "id": "ba4e", 86 - "name": "Add tunnel_key set action with missing mandatory id parameter", 87 - "category": [ 88 - "actions", 89 - "tunnel_key" 90 - ], 91 - "setup": [ 92 - [ 93 - "$TC actions flush action tunnel_key", 94 - 0, 95 - 1, 96 - 255 97 - ] 98 - ], 99 - "cmdUnderTest": "$TC actions add action tunnel_key set src_ip 10.10.10.1 dst_ip 20.20.20.2", 100 - "expExitCode": "255", 101 - "verifyCmd": "$TC actions list action tunnel_key", 102 - "matchPattern": "action order [0-9]+: tunnel_key set.*src_ip 10.10.10.1.*dst_ip 20.20.20.2", 103 - "matchCount": "0", 104 - "teardown": [ 105 - [ 106 - "$TC actions flush action tunnel_key", 107 - 0, 108 - 1, 109 - 255 110 - ] 111 - ] 112 - }, 113 - { 114 85 "id": "a5e0", 115 86 "name": "Add tunnel_key set action with invalid src_ip parameter", 116 87 "category": [ ··· 605 634 "cmdUnderTest": "$TC actions add action tunnel_key set src_ip 10.10.10.1 dst_ip 10.10.10.2 id 7 index 4 cookie aa11bb22cc33dd44ee55ff66aa11b1b2", 606 635 "expExitCode": "0", 607 636 "verifyCmd": "$TC actions get action tunnel_key index 4", 608 - "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", 637 + "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", 609 638 "matchCount": "1", 610 639 "teardown": [ 611 640 "$TC actions flush action tunnel_key"