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 tag 'net-6.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from Jakub Kicinski:
"Including fixes from wireles and netfilter.

Nothing major here. Over the last two weeks we gathered only around
two-thirds of our normal weekly fix count, but delaying sending these
until -rc7 seemed like a really bad idea.

AFAIK we have no bugs under investigation. One or two reverts for
stuff for which we haven't gotten a proper fix will likely come in the
next PR.

Current release - fix to a fix:

- netfilter: nft_set_hash: unaligned atomic read on struct
nft_set_ext

- eth: gve: trigger RX NAPI instead of TX NAPI in gve_xsk_wakeup

Previous releases - regressions:

- net: reenable NETIF_F_IPV6_CSUM offload for BIG TCP packets

- mptcp:
- fix sleeping rcvmsg sleeping forever after bad recvbuffer adjust
- fix TCP options overflow
- prevent excessive coalescing on receive, fix throughput

- net: fix memory leak in tcp_conn_request() if map insertion fails

- wifi: cw1200: fix potential NULL dereference after conversion to
GPIO descriptors

- phy: micrel: dynamically control external clock of KSZ PHY, fix
suspend behavior

Previous releases - always broken:

- af_packet: fix VLAN handling with MSG_PEEK

- net: restrict SO_REUSEPORT to inet sockets

- netdev-genl: avoid empty messages in NAPI get

- dsa: microchip: fix set_ageing_time function on KSZ9477 and LAN937X

- eth:
- gve: XDP fixes around transmit, queue wakeup etc.
- ti: icssg-prueth: fix firmware load sequence to prevent time
jump which breaks timesync related operations

Misc:

- netlink: specs: mptcp: add missing attr and improve documentation"

* tag 'net-6.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (50 commits)
net: ti: icssg-prueth: Fix clearing of IEP_CMP_CFG registers during iep_init
net: ti: icssg-prueth: Fix firmware load sequence.
mptcp: prevent excessive coalescing on receive
mptcp: don't always assume copied data in mptcp_cleanup_rbuf()
mptcp: fix recvbuffer adjust on sleeping rcvmsg
ila: serialize calls to nf_register_net_hooks()
af_packet: fix vlan_get_protocol_dgram() vs MSG_PEEK
af_packet: fix vlan_get_tci() vs MSG_PEEK
net: wwan: iosm: Properly check for valid exec stage in ipc_mmio_init()
net: restrict SO_REUSEPORT to inet sockets
net: reenable NETIF_F_IPV6_CSUM offload for BIG TCP packets
net: sfc: Correct key_len for efx_tc_ct_zone_ht_params
net: wwan: t7xx: Fix FSM command timeout issue
sky2: Add device ID 11ab:4373 for Marvell 88E8075
mptcp: fix TCP options overflow.
net: mv643xx_eth: fix an OF node reference leak
gve: trigger RX NAPI instead of TX NAPI in gve_xsk_wakeup
eth: bcmsysport: fix call balance of priv->clk handling routines
net: llc: reset skb->transport_header
netlink: specs: mptcp: fix missing doc
...

+861 -393
+31 -29
Documentation/netlink/specs/mptcp_pm.yaml
··· 22 22 doc: unused event 23 23 - 24 24 name: created 25 - doc: 26 - token, family, saddr4 | saddr6, daddr4 | daddr6, sport, dport 25 + doc: >- 27 26 A new MPTCP connection has been created. It is the good time to 28 27 allocate memory and send ADD_ADDR if needed. Depending on the 29 28 traffic-patterns it can take a long time until the 30 29 MPTCP_EVENT_ESTABLISHED is sent. 30 + Attributes: token, family, saddr4 | saddr6, daddr4 | daddr6, sport, 31 + dport, server-side. 31 32 - 32 33 name: established 33 - doc: 34 - token, family, saddr4 | saddr6, daddr4 | daddr6, sport, dport 34 + doc: >- 35 35 A MPTCP connection is established (can start new subflows). 36 + Attributes: token, family, saddr4 | saddr6, daddr4 | daddr6, sport, 37 + dport, server-side. 36 38 - 37 39 name: closed 38 - doc: 39 - token 40 + doc: >- 40 41 A MPTCP connection has stopped. 42 + Attribute: token. 41 43 - 42 44 name: announced 43 45 value: 6 44 - doc: 45 - token, rem_id, family, daddr4 | daddr6 [, dport] 46 + doc: >- 46 47 A new address has been announced by the peer. 48 + Attributes: token, rem_id, family, daddr4 | daddr6 [, dport]. 47 49 - 48 50 name: removed 49 - doc: 50 - token, rem_id 51 + doc: >- 51 52 An address has been lost by the peer. 53 + Attributes: token, rem_id. 52 54 - 53 55 name: sub-established 54 56 value: 10 55 - doc: 56 - token, family, loc_id, rem_id, saddr4 | saddr6, daddr4 | daddr6, sport, 57 - dport, backup, if_idx [, error] 57 + doc: >- 58 58 A new subflow has been established. 'error' should not be set. 59 + Attributes: token, family, loc_id, rem_id, saddr4 | saddr6, daddr4 | 60 + daddr6, sport, dport, backup, if_idx [, error]. 59 61 - 60 62 name: sub-closed 61 - doc: 62 - token, family, loc_id, rem_id, saddr4 | saddr6, daddr4 | daddr6, sport, 63 - dport, backup, if_idx [, error] 63 + doc: >- 64 64 A subflow has been closed. An error (copy of sk_err) could be set if an 65 65 error has been detected for this subflow. 66 + Attributes: token, family, loc_id, rem_id, saddr4 | saddr6, daddr4 | 67 + daddr6, sport, dport, backup, if_idx [, error]. 66 68 - 67 69 name: sub-priority 68 70 value: 13 69 - doc: 70 - token, family, loc_id, rem_id, saddr4 | saddr6, daddr4 | daddr6, sport, 71 - dport, backup, if_idx [, error] 71 + doc: >- 72 72 The priority of a subflow has changed. 'error' should not be set. 73 + Attributes: token, family, loc_id, rem_id, saddr4 | saddr6, daddr4 | 74 + daddr6, sport, dport, backup, if_idx [, error]. 73 75 - 74 76 name: listener-created 75 77 value: 15 76 - doc: 77 - family, sport, saddr4 | saddr6 78 + doc: >- 78 79 A new PM listener is created. 80 + Attributes: family, sport, saddr4 | saddr6. 79 81 - 80 82 name: listener-closed 81 - doc: 82 - family, sport, saddr4 | saddr6 83 + doc: >- 83 84 A PM listener is closed. 85 + Attributes: family, sport, saddr4 | saddr6. 84 86 85 87 attribute-sets: 86 88 - ··· 308 306 attributes: 309 307 - addr 310 308 - 311 - name: flush-addrs 312 - doc: flush addresses 309 + name: flush-addrs 310 + doc: Flush addresses 313 311 attribute-set: endpoint 314 312 dont-validate: [ strict ] 315 313 flags: [ uns-admin-perm ] ··· 353 351 - addr-remote 354 352 - 355 353 name: announce 356 - doc: announce new sf 354 + doc: Announce new address 357 355 attribute-set: attr 358 356 dont-validate: [ strict ] 359 357 flags: [ uns-admin-perm ] ··· 364 362 - token 365 363 - 366 364 name: remove 367 - doc: announce removal 365 + doc: Announce removal 368 366 attribute-set: attr 369 367 dont-validate: [ strict ] 370 368 flags: [ uns-admin-perm ] ··· 375 373 - loc-id 376 374 - 377 375 name: subflow-create 378 - doc: todo 376 + doc: Create subflow 379 377 attribute-set: attr 380 378 dont-validate: [ strict ] 381 379 flags: [ uns-admin-perm ] ··· 387 385 - addr-remote 388 386 - 389 387 name: subflow-destroy 390 - doc: todo 388 + doc: Destroy subflow 391 389 attribute-set: attr 392 390 dont-validate: [ strict ] 393 391 flags: [ uns-admin-perm ]
+1
MAINTAINERS
··· 3607 3607 3608 3608 ATHEROS ATH GENERIC UTILITIES 3609 3609 M: Kalle Valo <kvalo@kernel.org> 3610 + M: Jeff Johnson <jjohnson@kernel.org> 3610 3611 L: linux-wireless@vger.kernel.org 3611 3612 S: Supported 3612 3613 F: drivers/net/wireless/ath/*
+36 -11
drivers/net/dsa/microchip/ksz9477.c
··· 2 2 /* 3 3 * Microchip KSZ9477 switch driver main logic 4 4 * 5 - * Copyright (C) 2017-2019 Microchip Technology Inc. 5 + * Copyright (C) 2017-2024 Microchip Technology Inc. 6 6 */ 7 7 8 8 #include <linux/kernel.h> ··· 983 983 int ksz9477_set_ageing_time(struct ksz_device *dev, unsigned int msecs) 984 984 { 985 985 u32 secs = msecs / 1000; 986 - u8 value; 987 - u8 data; 986 + u8 data, mult, value; 987 + u32 max_val; 988 988 int ret; 989 989 990 - value = FIELD_GET(SW_AGE_PERIOD_7_0_M, secs); 990 + #define MAX_TIMER_VAL ((1 << 8) - 1) 991 991 992 - ret = ksz_write8(dev, REG_SW_LUE_CTRL_3, value); 993 - if (ret < 0) 994 - return ret; 992 + /* The aging timer comprises a 3-bit multiplier and an 8-bit second 993 + * value. Either of them cannot be zero. The maximum timer is then 994 + * 7 * 255 = 1785 seconds. 995 + */ 996 + if (!secs) 997 + secs = 1; 995 998 996 - data = FIELD_GET(SW_AGE_PERIOD_10_8_M, secs); 999 + /* Return error if too large. */ 1000 + else if (secs > 7 * MAX_TIMER_VAL) 1001 + return -EINVAL; 997 1002 998 1003 ret = ksz_read8(dev, REG_SW_LUE_CTRL_0, &value); 999 1004 if (ret < 0) 1000 1005 return ret; 1001 1006 1002 - value &= ~SW_AGE_CNT_M; 1003 - value |= FIELD_PREP(SW_AGE_CNT_M, data); 1007 + /* Check whether there is need to update the multiplier. */ 1008 + mult = FIELD_GET(SW_AGE_CNT_M, value); 1009 + max_val = MAX_TIMER_VAL; 1010 + if (mult > 0) { 1011 + /* Try to use the same multiplier already in the register as 1012 + * the hardware default uses multiplier 4 and 75 seconds for 1013 + * 300 seconds. 1014 + */ 1015 + max_val = DIV_ROUND_UP(secs, mult); 1016 + if (max_val > MAX_TIMER_VAL || max_val * mult != secs) 1017 + max_val = MAX_TIMER_VAL; 1018 + } 1004 1019 1005 - return ksz_write8(dev, REG_SW_LUE_CTRL_0, value); 1020 + data = DIV_ROUND_UP(secs, max_val); 1021 + if (mult != data) { 1022 + value &= ~SW_AGE_CNT_M; 1023 + value |= FIELD_PREP(SW_AGE_CNT_M, data); 1024 + ret = ksz_write8(dev, REG_SW_LUE_CTRL_0, value); 1025 + if (ret < 0) 1026 + return ret; 1027 + } 1028 + 1029 + value = DIV_ROUND_UP(secs, data); 1030 + return ksz_write8(dev, REG_SW_LUE_CTRL_3, value); 1006 1031 } 1007 1032 1008 1033 void ksz9477_port_queue_split(struct ksz_device *dev, int port)
+1 -3
drivers/net/dsa/microchip/ksz9477_reg.h
··· 2 2 /* 3 3 * Microchip KSZ9477 register definitions 4 4 * 5 - * Copyright (C) 2017-2018 Microchip Technology Inc. 5 + * Copyright (C) 2017-2024 Microchip Technology Inc. 6 6 */ 7 7 8 8 #ifndef __KSZ9477_REGS_H ··· 165 165 #define SW_VLAN_ENABLE BIT(7) 166 166 #define SW_DROP_INVALID_VID BIT(6) 167 167 #define SW_AGE_CNT_M GENMASK(5, 3) 168 - #define SW_AGE_CNT_S 3 169 - #define SW_AGE_PERIOD_10_8_M GENMASK(10, 8) 170 168 #define SW_RESV_MCAST_ENABLE BIT(2) 171 169 #define SW_HASH_OPTION_M 0x03 172 170 #define SW_HASH_OPTION_CRC 1
+59 -3
drivers/net/dsa/microchip/lan937x_main.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* Microchip LAN937X switch driver main logic 3 - * Copyright (C) 2019-2022 Microchip Technology Inc. 3 + * Copyright (C) 2019-2024 Microchip Technology Inc. 4 4 */ 5 5 #include <linux/kernel.h> 6 6 #include <linux/module.h> ··· 461 461 462 462 int lan937x_set_ageing_time(struct ksz_device *dev, unsigned int msecs) 463 463 { 464 - u32 secs = msecs / 1000; 465 - u32 value; 464 + u8 data, mult, value8; 465 + bool in_msec = false; 466 + u32 max_val, value; 467 + u32 secs = msecs; 466 468 int ret; 469 + 470 + #define MAX_TIMER_VAL ((1 << 20) - 1) 471 + 472 + /* The aging timer comprises a 3-bit multiplier and a 20-bit second 473 + * value. Either of them cannot be zero. The maximum timer is then 474 + * 7 * 1048575 = 7340025 seconds. As this value is too large for 475 + * practical use it can be interpreted as microseconds, making the 476 + * maximum timer 7340 seconds with finer control. This allows for 477 + * maximum 122 minutes compared to 29 minutes in KSZ9477 switch. 478 + */ 479 + if (msecs % 1000) 480 + in_msec = true; 481 + else 482 + secs /= 1000; 483 + if (!secs) 484 + secs = 1; 485 + 486 + /* Return error if too large. */ 487 + else if (secs > 7 * MAX_TIMER_VAL) 488 + return -EINVAL; 489 + 490 + /* Configure how to interpret the number value. */ 491 + ret = ksz_rmw8(dev, REG_SW_LUE_CTRL_2, SW_AGE_CNT_IN_MICROSEC, 492 + in_msec ? SW_AGE_CNT_IN_MICROSEC : 0); 493 + if (ret < 0) 494 + return ret; 495 + 496 + ret = ksz_read8(dev, REG_SW_LUE_CTRL_0, &value8); 497 + if (ret < 0) 498 + return ret; 499 + 500 + /* Check whether there is need to update the multiplier. */ 501 + mult = FIELD_GET(SW_AGE_CNT_M, value8); 502 + max_val = MAX_TIMER_VAL; 503 + if (mult > 0) { 504 + /* Try to use the same multiplier already in the register as 505 + * the hardware default uses multiplier 4 and 75 seconds for 506 + * 300 seconds. 507 + */ 508 + max_val = DIV_ROUND_UP(secs, mult); 509 + if (max_val > MAX_TIMER_VAL || max_val * mult != secs) 510 + max_val = MAX_TIMER_VAL; 511 + } 512 + 513 + data = DIV_ROUND_UP(secs, max_val); 514 + if (mult != data) { 515 + value8 &= ~SW_AGE_CNT_M; 516 + value8 |= FIELD_PREP(SW_AGE_CNT_M, data); 517 + ret = ksz_write8(dev, REG_SW_LUE_CTRL_0, value8); 518 + if (ret < 0) 519 + return ret; 520 + } 521 + 522 + secs = DIV_ROUND_UP(secs, data); 467 523 468 524 value = FIELD_GET(SW_AGE_PERIOD_7_0_M, secs); 469 525
+6 -3
drivers/net/dsa/microchip/lan937x_reg.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 2 /* Microchip LAN937X switch register definitions 3 - * Copyright (C) 2019-2021 Microchip Technology Inc. 3 + * Copyright (C) 2019-2024 Microchip Technology Inc. 4 4 */ 5 5 #ifndef __LAN937X_REG_H 6 6 #define __LAN937X_REG_H ··· 56 56 57 57 #define SW_VLAN_ENABLE BIT(7) 58 58 #define SW_DROP_INVALID_VID BIT(6) 59 - #define SW_AGE_CNT_M 0x7 60 - #define SW_AGE_CNT_S 3 59 + #define SW_AGE_CNT_M GENMASK(5, 3) 61 60 #define SW_RESV_MCAST_ENABLE BIT(2) 62 61 63 62 #define REG_SW_LUE_CTRL_1 0x0311 ··· 68 69 #define SW_AGING_ENABLE BIT(2) 69 70 #define SW_FAST_AGING BIT(1) 70 71 #define SW_LINK_AUTO_AGING BIT(0) 72 + 73 + #define REG_SW_LUE_CTRL_2 0x0312 74 + 75 + #define SW_AGE_CNT_IN_MICROSEC BIT(7) 71 76 72 77 #define REG_SW_AGE_PERIOD__1 0x0313 73 78 #define SW_AGE_PERIOD_7_0_M GENMASK(7, 0)
+18 -3
drivers/net/ethernet/broadcom/bcmsysport.c
··· 1933 1933 unsigned int i; 1934 1934 int ret; 1935 1935 1936 - clk_prepare_enable(priv->clk); 1936 + ret = clk_prepare_enable(priv->clk); 1937 + if (ret) { 1938 + netdev_err(dev, "could not enable priv clock\n"); 1939 + return ret; 1940 + } 1937 1941 1938 1942 /* Reset UniMAC */ 1939 1943 umac_reset(priv); ··· 2595 2591 goto err_deregister_notifier; 2596 2592 } 2597 2593 2598 - clk_prepare_enable(priv->clk); 2594 + ret = clk_prepare_enable(priv->clk); 2595 + if (ret) { 2596 + dev_err(&pdev->dev, "could not enable priv clock\n"); 2597 + goto err_deregister_netdev; 2598 + } 2599 2599 2600 2600 priv->rev = topctrl_readl(priv, REV_CNTL) & REV_MASK; 2601 2601 dev_info(&pdev->dev, ··· 2613 2605 2614 2606 return 0; 2615 2607 2608 + err_deregister_netdev: 2609 + unregister_netdev(dev); 2616 2610 err_deregister_notifier: 2617 2611 unregister_netdevice_notifier(&priv->netdev_notifier); 2618 2612 err_deregister_fixed_link: ··· 2784 2774 if (!netif_running(dev)) 2785 2775 return 0; 2786 2776 2787 - clk_prepare_enable(priv->clk); 2777 + ret = clk_prepare_enable(priv->clk); 2778 + if (ret) { 2779 + netdev_err(dev, "could not enable priv clock\n"); 2780 + return ret; 2781 + } 2782 + 2788 2783 if (priv->wolopts) 2789 2784 clk_disable_unprepare(priv->wol_clk); 2790 2785
+1
drivers/net/ethernet/google/gve/gve.h
··· 1140 1140 void gve_xdp_tx_flush(struct gve_priv *priv, u32 xdp_qid); 1141 1141 bool gve_tx_poll(struct gve_notify_block *block, int budget); 1142 1142 bool gve_xdp_poll(struct gve_notify_block *block, int budget); 1143 + int gve_xsk_tx_poll(struct gve_notify_block *block, int budget); 1143 1144 int gve_tx_alloc_rings_gqi(struct gve_priv *priv, 1144 1145 struct gve_tx_alloc_rings_cfg *cfg); 1145 1146 void gve_tx_free_rings_gqi(struct gve_priv *priv,
+36 -27
drivers/net/ethernet/google/gve/gve_main.c
··· 333 333 334 334 if (block->rx) { 335 335 work_done = gve_rx_poll(block, budget); 336 + 337 + /* Poll XSK TX as part of RX NAPI. Setup re-poll based on max of 338 + * TX and RX work done. 339 + */ 340 + if (priv->xdp_prog) 341 + work_done = max_t(int, work_done, 342 + gve_xsk_tx_poll(block, budget)); 343 + 336 344 reschedule |= work_done == budget; 337 345 } 338 346 ··· 930 922 static void gve_tx_get_curr_alloc_cfg(struct gve_priv *priv, 931 923 struct gve_tx_alloc_rings_cfg *cfg) 932 924 { 925 + int num_xdp_queues = priv->xdp_prog ? priv->rx_cfg.num_queues : 0; 926 + 933 927 cfg->qcfg = &priv->tx_cfg; 934 928 cfg->raw_addressing = !gve_is_qpl(priv); 935 929 cfg->ring_size = priv->tx_desc_cnt; 936 930 cfg->start_idx = 0; 937 - cfg->num_rings = gve_num_tx_queues(priv); 931 + cfg->num_rings = priv->tx_cfg.num_queues + num_xdp_queues; 938 932 cfg->tx = priv->tx; 939 933 } 940 934 ··· 1633 1623 if (err) 1634 1624 return err; 1635 1625 1636 - /* If XDP prog is not installed, return */ 1637 - if (!priv->xdp_prog) 1626 + /* If XDP prog is not installed or interface is down, return. */ 1627 + if (!priv->xdp_prog || !netif_running(dev)) 1638 1628 return 0; 1639 1629 1640 1630 rx = &priv->rx[qid]; ··· 1679 1669 if (qid >= priv->rx_cfg.num_queues) 1680 1670 return -EINVAL; 1681 1671 1682 - /* If XDP prog is not installed, unmap DMA and return */ 1683 - if (!priv->xdp_prog) 1672 + /* If XDP prog is not installed or interface is down, unmap DMA and 1673 + * return. 1674 + */ 1675 + if (!priv->xdp_prog || !netif_running(dev)) 1684 1676 goto done; 1685 - 1686 - tx_qid = gve_xdp_tx_queue_id(priv, qid); 1687 - if (!netif_running(dev)) { 1688 - priv->rx[qid].xsk_pool = NULL; 1689 - xdp_rxq_info_unreg(&priv->rx[qid].xsk_rxq); 1690 - priv->tx[tx_qid].xsk_pool = NULL; 1691 - goto done; 1692 - } 1693 1677 1694 1678 napi_rx = &priv->ntfy_blocks[priv->rx[qid].ntfy_id].napi; 1695 1679 napi_disable(napi_rx); /* make sure current rx poll is done */ 1696 1680 1681 + tx_qid = gve_xdp_tx_queue_id(priv, qid); 1697 1682 napi_tx = &priv->ntfy_blocks[priv->tx[tx_qid].ntfy_id].napi; 1698 1683 napi_disable(napi_tx); /* make sure current tx poll is done */ 1699 1684 ··· 1714 1709 static int gve_xsk_wakeup(struct net_device *dev, u32 queue_id, u32 flags) 1715 1710 { 1716 1711 struct gve_priv *priv = netdev_priv(dev); 1717 - int tx_queue_id = gve_xdp_tx_queue_id(priv, queue_id); 1712 + struct napi_struct *napi; 1713 + 1714 + if (!gve_get_napi_enabled(priv)) 1715 + return -ENETDOWN; 1718 1716 1719 1717 if (queue_id >= priv->rx_cfg.num_queues || !priv->xdp_prog) 1720 1718 return -EINVAL; 1721 1719 1722 - if (flags & XDP_WAKEUP_TX) { 1723 - struct gve_tx_ring *tx = &priv->tx[tx_queue_id]; 1724 - struct napi_struct *napi = 1725 - &priv->ntfy_blocks[tx->ntfy_id].napi; 1726 - 1727 - if (!napi_if_scheduled_mark_missed(napi)) { 1728 - /* Call local_bh_enable to trigger SoftIRQ processing */ 1729 - local_bh_disable(); 1730 - napi_schedule(napi); 1731 - local_bh_enable(); 1732 - } 1733 - 1734 - tx->xdp_xsk_wakeup++; 1720 + napi = &priv->ntfy_blocks[gve_rx_idx_to_ntfy(priv, queue_id)].napi; 1721 + if (!napi_if_scheduled_mark_missed(napi)) { 1722 + /* Call local_bh_enable to trigger SoftIRQ processing */ 1723 + local_bh_disable(); 1724 + napi_schedule(napi); 1725 + local_bh_enable(); 1735 1726 } 1736 1727 1737 1728 return 0; ··· 1838 1837 { 1839 1838 struct gve_tx_alloc_rings_cfg tx_alloc_cfg = {0}; 1840 1839 struct gve_rx_alloc_rings_cfg rx_alloc_cfg = {0}; 1840 + int num_xdp_queues; 1841 1841 int err; 1842 1842 1843 1843 gve_get_curr_alloc_cfgs(priv, &tx_alloc_cfg, &rx_alloc_cfg); ··· 1848 1846 rx_alloc_cfg.qcfg_tx = &new_tx_config; 1849 1847 rx_alloc_cfg.qcfg = &new_rx_config; 1850 1848 tx_alloc_cfg.num_rings = new_tx_config.num_queues; 1849 + 1850 + /* Add dedicated XDP TX queues if enabled. */ 1851 + num_xdp_queues = priv->xdp_prog ? new_rx_config.num_queues : 0; 1852 + tx_alloc_cfg.num_rings += num_xdp_queues; 1851 1853 1852 1854 if (netif_running(priv->dev)) { 1853 1855 err = gve_adjust_config(priv, &tx_alloc_cfg, &rx_alloc_cfg); ··· 1905 1899 1906 1900 gve_clear_napi_enabled(priv); 1907 1901 gve_clear_report_stats(priv); 1902 + 1903 + /* Make sure that all traffic is finished processing. */ 1904 + synchronize_net(); 1908 1905 } 1909 1906 1910 1907 static void gve_turnup(struct gve_priv *priv)
+30 -16
drivers/net/ethernet/google/gve/gve_tx.c
··· 206 206 return; 207 207 208 208 gve_remove_napi(priv, ntfy_idx); 209 - gve_clean_tx_done(priv, tx, priv->tx_desc_cnt, false); 209 + if (tx->q_num < priv->tx_cfg.num_queues) 210 + gve_clean_tx_done(priv, tx, priv->tx_desc_cnt, false); 211 + else 212 + gve_clean_xdp_done(priv, tx, priv->tx_desc_cnt); 210 213 netdev_tx_reset_queue(tx->netdev_txq); 211 214 gve_tx_remove_from_block(priv, idx); 212 215 } ··· 837 834 struct gve_tx_ring *tx; 838 835 int i, err = 0, qid; 839 836 840 - if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK)) 837 + if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK) || !priv->xdp_prog) 841 838 return -EINVAL; 839 + 840 + if (!gve_get_napi_enabled(priv)) 841 + return -ENETDOWN; 842 842 843 843 qid = gve_xdp_tx_queue_id(priv, 844 844 smp_processor_id() % priv->num_xdp_queues); ··· 981 975 return sent; 982 976 } 983 977 978 + int gve_xsk_tx_poll(struct gve_notify_block *rx_block, int budget) 979 + { 980 + struct gve_rx_ring *rx = rx_block->rx; 981 + struct gve_priv *priv = rx->gve; 982 + struct gve_tx_ring *tx; 983 + int sent = 0; 984 + 985 + tx = &priv->tx[gve_xdp_tx_queue_id(priv, rx->q_num)]; 986 + if (tx->xsk_pool) { 987 + sent = gve_xsk_tx(priv, tx, budget); 988 + 989 + u64_stats_update_begin(&tx->statss); 990 + tx->xdp_xsk_sent += sent; 991 + u64_stats_update_end(&tx->statss); 992 + if (xsk_uses_need_wakeup(tx->xsk_pool)) 993 + xsk_set_tx_need_wakeup(tx->xsk_pool); 994 + } 995 + 996 + return sent; 997 + } 998 + 984 999 bool gve_xdp_poll(struct gve_notify_block *block, int budget) 985 1000 { 986 1001 struct gve_priv *priv = block->priv; 987 1002 struct gve_tx_ring *tx = block->tx; 988 1003 u32 nic_done; 989 - bool repoll; 990 1004 u32 to_do; 991 1005 992 1006 /* Find out how much work there is to be done */ 993 1007 nic_done = gve_tx_load_event_counter(priv, tx); 994 1008 to_do = min_t(u32, (nic_done - tx->done), budget); 995 1009 gve_clean_xdp_done(priv, tx, to_do); 996 - repoll = nic_done != tx->done; 997 - 998 - if (tx->xsk_pool) { 999 - int sent = gve_xsk_tx(priv, tx, budget); 1000 - 1001 - u64_stats_update_begin(&tx->statss); 1002 - tx->xdp_xsk_sent += sent; 1003 - u64_stats_update_end(&tx->statss); 1004 - repoll |= (sent == budget); 1005 - if (xsk_uses_need_wakeup(tx->xsk_pool)) 1006 - xsk_set_tx_need_wakeup(tx->xsk_pool); 1007 - } 1008 1010 1009 1011 /* If we still have work we want to repoll */ 1010 - return repoll; 1012 + return nic_done != tx->done; 1011 1013 } 1012 1014 1013 1015 bool gve_tx_poll(struct gve_notify_block *block, int budget)
+12 -2
drivers/net/ethernet/marvell/mv643xx_eth.c
··· 2704 2704 2705 2705 static void mv643xx_eth_shared_of_remove(void) 2706 2706 { 2707 + struct mv643xx_eth_platform_data *pd; 2707 2708 int n; 2708 2709 2709 2710 for (n = 0; n < 3; n++) { 2711 + if (!port_platdev[n]) 2712 + continue; 2713 + pd = dev_get_platdata(&port_platdev[n]->dev); 2714 + if (pd) 2715 + of_node_put(pd->phy_node); 2710 2716 platform_device_del(port_platdev[n]); 2711 2717 port_platdev[n] = NULL; 2712 2718 } ··· 2775 2769 } 2776 2770 2777 2771 ppdev = platform_device_alloc(MV643XX_ETH_NAME, dev_num); 2778 - if (!ppdev) 2779 - return -ENOMEM; 2772 + if (!ppdev) { 2773 + ret = -ENOMEM; 2774 + goto put_err; 2775 + } 2780 2776 ppdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 2781 2777 ppdev->dev.of_node = pnp; 2782 2778 ··· 2800 2792 2801 2793 port_err: 2802 2794 platform_device_put(ppdev); 2795 + put_err: 2796 + of_node_put(ppd.phy_node); 2803 2797 return ret; 2804 2798 } 2805 2799
+1
drivers/net/ethernet/marvell/sky2.c
··· 130 130 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x436C) }, /* 88E8072 */ 131 131 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x436D) }, /* 88E8055 */ 132 132 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4370) }, /* 88E8075 */ 133 + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4373) }, /* 88E8075 */ 133 134 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4380) }, /* 88E8057 */ 134 135 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4381) }, /* 88E8059 */ 135 136 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4382) }, /* 88E8079 */
+4
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
··· 339 339 { 340 340 struct mlx5e_priv *priv = macsec_netdev_priv(ctx->netdev); 341 341 struct mlx5_macsec_fs *macsec_fs = priv->mdev->macsec_fs; 342 + const struct macsec_tx_sc *tx_sc = &ctx->secy->tx_sc; 342 343 struct mlx5_macsec_rule_attrs rule_attrs; 343 344 union mlx5_macsec_rule *macsec_rule; 345 + 346 + if (is_tx && tx_sc->encoding_sa != sa->assoc_num) 347 + return 0; 344 348 345 349 rule_attrs.macsec_obj_id = sa->macsec_obj_id; 346 350 rule_attrs.sci = sa->sci;
+17 -2
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 6542 6542 6543 6543 mlx5_core_uplink_netdev_set(mdev, NULL); 6544 6544 mlx5e_dcbnl_delete_app(priv); 6545 - unregister_netdev(priv->netdev); 6546 - _mlx5e_suspend(adev, false); 6545 + /* When unload driver, the netdev is in registered state 6546 + * if it's from legacy mode. If from switchdev mode, it 6547 + * is already unregistered before changing to NIC profile. 6548 + */ 6549 + if (priv->netdev->reg_state == NETREG_REGISTERED) { 6550 + unregister_netdev(priv->netdev); 6551 + _mlx5e_suspend(adev, false); 6552 + } else { 6553 + struct mlx5_core_dev *pos; 6554 + int i; 6555 + 6556 + if (test_bit(MLX5E_STATE_DESTROYING, &priv->state)) 6557 + mlx5_sd_for_each_dev(i, mdev, pos) 6558 + mlx5e_destroy_mdev_resources(pos); 6559 + else 6560 + _mlx5e_suspend(adev, true); 6561 + } 6547 6562 /* Avoid cleanup if profile rollback failed. */ 6548 6563 if (priv->profile) 6549 6564 priv->profile->cleanup(priv);
+15
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
··· 1509 1509 1510 1510 priv = netdev_priv(netdev); 1511 1511 1512 + /* This bit is set when using devlink to change eswitch mode from 1513 + * switchdev to legacy. As need to keep uplink netdev ifindex, we 1514 + * detach uplink representor profile and attach NIC profile only. 1515 + * The netdev will be unregistered later when unload NIC auxiliary 1516 + * driver for this case. 1517 + * We explicitly block devlink eswitch mode change if any IPSec rules 1518 + * offloaded, but can't block other cases, such as driver unload 1519 + * and devlink reload. We have to unregister netdev before profile 1520 + * change for those cases. This is to avoid resource leak because 1521 + * the offloaded rules don't have the chance to be unoffloaded before 1522 + * cleanup which is triggered by detach uplink representor profile. 1523 + */ 1524 + if (!(priv->mdev->priv.flags & MLX5_PRIV_FLAGS_SWITCH_LEGACY)) 1525 + unregister_netdev(netdev); 1526 + 1512 1527 mlx5e_netdev_attach_nic_profile(priv); 1513 1528 } 1514 1529
+3 -3
drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c
··· 150 150 unsigned long i; 151 151 int err; 152 152 153 - xa_for_each(&esw->offloads.vport_reps, i, rep) { 154 - rpriv = rep->rep_data[REP_ETH].priv; 155 - if (!rpriv || !rpriv->netdev) 153 + mlx5_esw_for_each_rep(esw, i, rep) { 154 + if (atomic_read(&rep->rep_data[REP_ETH].state) != REP_LOADED) 156 155 continue; 157 156 157 + rpriv = rep->rep_data[REP_ETH].priv; 158 158 rhashtable_walk_enter(&rpriv->tc_ht, &iter); 159 159 rhashtable_walk_start(&iter); 160 160 while ((flow = rhashtable_walk_next(&iter)) != NULL) {
+3
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
··· 714 714 MLX5_CAP_GEN_2((esw->dev), ec_vf_vport_base) +\ 715 715 (last) - 1) 716 716 717 + #define mlx5_esw_for_each_rep(esw, i, rep) \ 718 + xa_for_each(&((esw)->offloads.vport_reps), i, rep) 719 + 717 720 struct mlx5_eswitch *__must_check 718 721 mlx5_devlink_eswitch_get(struct devlink *devlink); 719 722
+2 -3
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
··· 53 53 #include "lag/lag.h" 54 54 #include "en/tc/post_meter.h" 55 55 56 - #define mlx5_esw_for_each_rep(esw, i, rep) \ 57 - xa_for_each(&((esw)->offloads.vport_reps), i, rep) 58 - 59 56 /* There are two match-all miss flows, one for unicast dst mac and 60 57 * one for multicast. 61 58 */ ··· 3777 3780 esw->eswitch_operation_in_progress = true; 3778 3781 up_write(&esw->mode_lock); 3779 3782 3783 + if (mode == DEVLINK_ESWITCH_MODE_LEGACY) 3784 + esw->dev->priv.flags |= MLX5_PRIV_FLAGS_SWITCH_LEGACY; 3780 3785 mlx5_eswitch_disable_locked(esw); 3781 3786 if (mode == DEVLINK_ESWITCH_MODE_SWITCHDEV) { 3782 3787 if (mlx5_devlink_trap_get_num_active(esw->dev)) {
+1 -3
drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_send.c
··· 1067 1067 int inlen, err, eqn; 1068 1068 void *cqc, *in; 1069 1069 __be64 *pas; 1070 - int vector; 1071 1070 u32 i; 1072 1071 1073 1072 cq = kzalloc(sizeof(*cq), GFP_KERNEL); ··· 1095 1096 if (!in) 1096 1097 goto err_cqwq; 1097 1098 1098 - vector = raw_smp_processor_id() % mlx5_comp_vectors_max(mdev); 1099 - err = mlx5_comp_eqn_get(mdev, vector, &eqn); 1099 + err = mlx5_comp_eqn_get(mdev, 0, &eqn); 1100 1100 if (err) { 1101 1101 kvfree(in); 1102 1102 goto err_cqwq;
+1 -2
drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c
··· 423 423 424 424 parms = mlxsw_sp_ipip_netdev_parms4(to_dev); 425 425 ip_tunnel_init_flow(&fl4, parms.iph.protocol, *daddrp, *saddrp, 426 - 0, 0, dev_net(to_dev), parms.link, tun->fwmark, 0, 427 - 0); 426 + 0, 0, tun->net, parms.link, tun->fwmark, 0, 0); 428 427 429 428 rt = ip_route_output_key(tun->net, &fl4); 430 429 if (IS_ERR(rt))
+1 -1
drivers/net/ethernet/meta/fbnic/fbnic_csr.c
··· 64 64 u32 i, j; 65 65 66 66 *(data++) = start; 67 - *(data++) = end - 1; 67 + *(data++) = end; 68 68 69 69 /* FBNIC_RPC_TCAM_ACT */ 70 70 for (i = 0; i < FBNIC_RPC_TCAM_ACT_NUM_ENTRIES; i++) {
+1 -1
drivers/net/ethernet/sfc/tc_conntrack.c
··· 16 16 void *cb_priv); 17 17 18 18 static const struct rhashtable_params efx_tc_ct_zone_ht_params = { 19 - .key_len = offsetof(struct efx_tc_ct_zone, linkage), 19 + .key_len = sizeof_field(struct efx_tc_ct_zone, zone), 20 20 .key_offset = 0, 21 21 .head_offset = offsetof(struct efx_tc_ct_zone, linkage), 22 22 };
+17 -26
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
··· 406 406 } 407 407 408 408 /** 409 - * stmmac_remove_config_dt - undo the effects of stmmac_probe_config_dt() 410 - * @pdev: platform_device structure 411 - * @plat: driver data platform structure 412 - * 413 - * Release resources claimed by stmmac_probe_config_dt(). 414 - */ 415 - static void stmmac_remove_config_dt(struct platform_device *pdev, 416 - struct plat_stmmacenet_data *plat) 417 - { 418 - clk_disable_unprepare(plat->stmmac_clk); 419 - clk_disable_unprepare(plat->pclk); 420 - of_node_put(plat->phy_node); 421 - of_node_put(plat->mdio_node); 422 - } 423 - 424 - /** 425 409 * stmmac_probe_config_dt - parse device-tree driver parameters 426 410 * @pdev: platform_device structure 427 411 * @mac: MAC address to use ··· 474 490 dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n"); 475 491 476 492 rc = stmmac_mdio_setup(plat, np, &pdev->dev); 477 - if (rc) 478 - return ERR_PTR(rc); 493 + if (rc) { 494 + ret = ERR_PTR(rc); 495 + goto error_put_phy; 496 + } 479 497 480 498 of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size); 481 499 ··· 567 581 dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg), 568 582 GFP_KERNEL); 569 583 if (!dma_cfg) { 570 - stmmac_remove_config_dt(pdev, plat); 571 - return ERR_PTR(-ENOMEM); 584 + ret = ERR_PTR(-ENOMEM); 585 + goto error_put_mdio; 572 586 } 573 587 plat->dma_cfg = dma_cfg; 574 588 ··· 596 610 597 611 rc = stmmac_mtl_setup(pdev, plat); 598 612 if (rc) { 599 - stmmac_remove_config_dt(pdev, plat); 600 - return ERR_PTR(rc); 613 + ret = ERR_PTR(rc); 614 + goto error_put_mdio; 601 615 } 602 616 603 617 /* clock setup */ ··· 649 663 clk_disable_unprepare(plat->pclk); 650 664 error_pclk_get: 651 665 clk_disable_unprepare(plat->stmmac_clk); 666 + error_put_mdio: 667 + of_node_put(plat->mdio_node); 668 + error_put_phy: 669 + of_node_put(plat->phy_node); 652 670 653 671 return ret; 654 672 } ··· 661 671 { 662 672 struct plat_stmmacenet_data *plat = data; 663 673 664 - /* Platform data argument is unused */ 665 - stmmac_remove_config_dt(NULL, plat); 674 + clk_disable_unprepare(plat->stmmac_clk); 675 + clk_disable_unprepare(plat->pclk); 676 + of_node_put(plat->mdio_node); 677 + of_node_put(plat->phy_node); 666 678 } 667 679 668 680 /** 669 681 * devm_stmmac_probe_config_dt 670 682 * @pdev: platform_device structure 671 683 * @mac: MAC address to use 672 - * Description: Devres variant of stmmac_probe_config_dt(). Does not require 673 - * the user to call stmmac_remove_config_dt() at driver detach. 684 + * Description: Devres variant of stmmac_probe_config_dt(). 674 685 */ 675 686 struct plat_stmmacenet_data * 676 687 devm_stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
+1 -1
drivers/net/ethernet/ti/am65-cpsw-nuss.c
··· 3551 3551 init_completion(&common->tdown_complete); 3552 3552 common->tx_ch_num = AM65_CPSW_DEFAULT_TX_CHNS; 3553 3553 common->rx_ch_num_flows = AM65_CPSW_DEFAULT_RX_CHN_FLOWS; 3554 - common->pf_p0_rx_ptype_rrobin = false; 3554 + common->pf_p0_rx_ptype_rrobin = true; 3555 3555 common->default_vlan = 1; 3556 3556 3557 3557 common->ports = devm_kcalloc(dev, common->port_num,
+8
drivers/net/ethernet/ti/icssg/icss_iep.c
··· 215 215 for (cmp = IEP_MIN_CMP; cmp < IEP_MAX_CMP; cmp++) { 216 216 regmap_update_bits(iep->map, ICSS_IEP_CMP_STAT_REG, 217 217 IEP_CMP_STATUS(cmp), IEP_CMP_STATUS(cmp)); 218 + 219 + regmap_update_bits(iep->map, ICSS_IEP_CMP_CFG_REG, 220 + IEP_CMP_CFG_CMP_EN(cmp), 0); 218 221 } 219 222 220 223 /* enable reset counter on CMP0 event */ ··· 782 779 iep->ptp_clock = NULL; 783 780 } 784 781 icss_iep_disable(iep); 782 + 783 + if (iep->pps_enabled) 784 + icss_iep_pps_enable(iep, false); 785 + else if (iep->perout_enabled) 786 + icss_iep_perout_enable(iep, NULL, false); 785 787 786 788 return 0; 787 789 }
-25
drivers/net/ethernet/ti/icssg/icssg_common.c
··· 855 855 } 856 856 EXPORT_SYMBOL_GPL(prueth_rx_irq); 857 857 858 - void prueth_emac_stop(struct prueth_emac *emac) 859 - { 860 - struct prueth *prueth = emac->prueth; 861 - int slice; 862 - 863 - switch (emac->port_id) { 864 - case PRUETH_PORT_MII0: 865 - slice = ICSS_SLICE0; 866 - break; 867 - case PRUETH_PORT_MII1: 868 - slice = ICSS_SLICE1; 869 - break; 870 - default: 871 - netdev_err(emac->ndev, "invalid port\n"); 872 - return; 873 - } 874 - 875 - emac->fw_running = 0; 876 - if (!emac->is_sr1) 877 - rproc_shutdown(prueth->txpru[slice]); 878 - rproc_shutdown(prueth->rtu[slice]); 879 - rproc_shutdown(prueth->pru[slice]); 880 - } 881 - EXPORT_SYMBOL_GPL(prueth_emac_stop); 882 - 883 858 void prueth_cleanup_tx_ts(struct prueth_emac *emac) 884 859 { 885 860 int i;
+28 -13
drivers/net/ethernet/ti/icssg/icssg_config.c
··· 397 397 return 0; 398 398 } 399 399 400 - static void icssg_init_emac_mode(struct prueth *prueth) 400 + void icssg_init_emac_mode(struct prueth *prueth) 401 401 { 402 402 /* When the device is configured as a bridge and it is being brought 403 403 * back to the emac mode, the host mac address has to be set as 0. ··· 405 405 u32 addr = prueth->shram.pa + EMAC_ICSSG_SWITCH_DEFAULT_VLAN_TABLE_OFFSET; 406 406 int i; 407 407 u8 mac[ETH_ALEN] = { 0 }; 408 - 409 - if (prueth->emacs_initialized) 410 - return; 411 408 412 409 /* Set VLAN TABLE address base */ 413 410 regmap_update_bits(prueth->miig_rt, FDB_GEN_CFG1, SMEM_VLAN_OFFSET_MASK, ··· 420 423 /* Clear host MAC address */ 421 424 icssg_class_set_host_mac_addr(prueth->miig_rt, mac); 422 425 } 426 + EXPORT_SYMBOL_GPL(icssg_init_emac_mode); 423 427 424 - static void icssg_init_fw_offload_mode(struct prueth *prueth) 428 + void icssg_init_fw_offload_mode(struct prueth *prueth) 425 429 { 426 430 u32 addr = prueth->shram.pa + EMAC_ICSSG_SWITCH_DEFAULT_VLAN_TABLE_OFFSET; 427 431 int i; 428 - 429 - if (prueth->emacs_initialized) 430 - return; 431 432 432 433 /* Set VLAN TABLE address base */ 433 434 regmap_update_bits(prueth->miig_rt, FDB_GEN_CFG1, SMEM_VLAN_OFFSET_MASK, ··· 443 448 icssg_class_set_host_mac_addr(prueth->miig_rt, prueth->hw_bridge_dev->dev_addr); 444 449 icssg_set_pvid(prueth, prueth->default_vlan, PRUETH_PORT_HOST); 445 450 } 451 + EXPORT_SYMBOL_GPL(icssg_init_fw_offload_mode); 446 452 447 453 int icssg_config(struct prueth *prueth, struct prueth_emac *emac, int slice) 448 454 { 449 455 void __iomem *config = emac->dram.va + ICSSG_CONFIG_OFFSET; 450 456 struct icssg_flow_cfg __iomem *flow_cfg; 451 457 int ret; 452 - 453 - if (prueth->is_switch_mode || prueth->is_hsr_offload_mode) 454 - icssg_init_fw_offload_mode(prueth); 455 - else 456 - icssg_init_emac_mode(prueth); 457 458 458 459 memset_io(config, 0, TAS_GATE_MASK_LIST0); 459 460 icssg_miig_queues_init(prueth, slice); ··· 777 786 writel(pvid, prueth->shram.va + EMAC_ICSSG_SWITCH_PORT0_DEFAULT_VLAN_OFFSET); 778 787 } 779 788 EXPORT_SYMBOL_GPL(icssg_set_pvid); 789 + 790 + int emac_fdb_flow_id_updated(struct prueth_emac *emac) 791 + { 792 + struct mgmt_cmd_rsp fdb_cmd_rsp = { 0 }; 793 + int slice = prueth_emac_slice(emac); 794 + struct mgmt_cmd fdb_cmd = { 0 }; 795 + int ret; 796 + 797 + fdb_cmd.header = ICSSG_FW_MGMT_CMD_HEADER; 798 + fdb_cmd.type = ICSSG_FW_MGMT_FDB_CMD_TYPE_RX_FLOW; 799 + fdb_cmd.seqnum = ++(emac->prueth->icssg_hwcmdseq); 800 + fdb_cmd.param = 0; 801 + 802 + fdb_cmd.param |= (slice << 4); 803 + fdb_cmd.cmd_args[0] = 0; 804 + 805 + ret = icssg_send_fdb_msg(emac, &fdb_cmd, &fdb_cmd_rsp); 806 + if (ret) 807 + return ret; 808 + 809 + WARN_ON(fdb_cmd.seqnum != fdb_cmd_rsp.seqnum); 810 + return fdb_cmd_rsp.status == 1 ? 0 : -EINVAL; 811 + } 812 + EXPORT_SYMBOL_GPL(emac_fdb_flow_id_updated);
+1
drivers/net/ethernet/ti/icssg/icssg_config.h
··· 55 55 #define ICSSG_FW_MGMT_FDB_CMD_TYPE 0x03 56 56 #define ICSSG_FW_MGMT_CMD_TYPE 0x04 57 57 #define ICSSG_FW_MGMT_PKT 0x80000000 58 + #define ICSSG_FW_MGMT_FDB_CMD_TYPE_RX_FLOW 0x05 58 59 59 60 struct icssg_r30_cmd { 60 61 u32 cmd[4];
+191 -90
drivers/net/ethernet/ti/icssg/icssg_prueth.c
··· 164 164 } 165 165 }; 166 166 167 - static int prueth_emac_start(struct prueth *prueth, struct prueth_emac *emac) 167 + static int prueth_start(struct rproc *rproc, const char *fw_name) 168 + { 169 + int ret; 170 + 171 + ret = rproc_set_firmware(rproc, fw_name); 172 + if (ret) 173 + return ret; 174 + return rproc_boot(rproc); 175 + } 176 + 177 + static void prueth_shutdown(struct rproc *rproc) 178 + { 179 + rproc_shutdown(rproc); 180 + } 181 + 182 + static int prueth_emac_start(struct prueth *prueth) 168 183 { 169 184 struct icssg_firmwares *firmwares; 170 185 struct device *dev = prueth->dev; 171 - int slice, ret; 186 + int ret, slice; 172 187 173 188 if (prueth->is_switch_mode) 174 189 firmwares = icssg_switch_firmwares; ··· 192 177 else 193 178 firmwares = icssg_emac_firmwares; 194 179 195 - slice = prueth_emac_slice(emac); 196 - if (slice < 0) { 197 - netdev_err(emac->ndev, "invalid port\n"); 198 - return -EINVAL; 180 + for (slice = 0; slice < PRUETH_NUM_MACS; slice++) { 181 + ret = prueth_start(prueth->pru[slice], firmwares[slice].pru); 182 + if (ret) { 183 + dev_err(dev, "failed to boot PRU%d: %d\n", slice, ret); 184 + goto unwind_slices; 185 + } 186 + 187 + ret = prueth_start(prueth->rtu[slice], firmwares[slice].rtu); 188 + if (ret) { 189 + dev_err(dev, "failed to boot RTU%d: %d\n", slice, ret); 190 + rproc_shutdown(prueth->pru[slice]); 191 + goto unwind_slices; 192 + } 193 + 194 + ret = prueth_start(prueth->txpru[slice], firmwares[slice].txpru); 195 + if (ret) { 196 + dev_err(dev, "failed to boot TX_PRU%d: %d\n", slice, ret); 197 + rproc_shutdown(prueth->rtu[slice]); 198 + rproc_shutdown(prueth->pru[slice]); 199 + goto unwind_slices; 200 + } 199 201 } 200 202 201 - ret = icssg_config(prueth, emac, slice); 202 - if (ret) 203 - return ret; 204 - 205 - ret = rproc_set_firmware(prueth->pru[slice], firmwares[slice].pru); 206 - ret = rproc_boot(prueth->pru[slice]); 207 - if (ret) { 208 - dev_err(dev, "failed to boot PRU%d: %d\n", slice, ret); 209 - return -EINVAL; 210 - } 211 - 212 - ret = rproc_set_firmware(prueth->rtu[slice], firmwares[slice].rtu); 213 - ret = rproc_boot(prueth->rtu[slice]); 214 - if (ret) { 215 - dev_err(dev, "failed to boot RTU%d: %d\n", slice, ret); 216 - goto halt_pru; 217 - } 218 - 219 - ret = rproc_set_firmware(prueth->txpru[slice], firmwares[slice].txpru); 220 - ret = rproc_boot(prueth->txpru[slice]); 221 - if (ret) { 222 - dev_err(dev, "failed to boot TX_PRU%d: %d\n", slice, ret); 223 - goto halt_rtu; 224 - } 225 - 226 - emac->fw_running = 1; 227 203 return 0; 228 204 229 - halt_rtu: 230 - rproc_shutdown(prueth->rtu[slice]); 231 - 232 - halt_pru: 233 - rproc_shutdown(prueth->pru[slice]); 205 + unwind_slices: 206 + while (--slice >= 0) { 207 + prueth_shutdown(prueth->txpru[slice]); 208 + prueth_shutdown(prueth->rtu[slice]); 209 + prueth_shutdown(prueth->pru[slice]); 210 + } 234 211 235 212 return ret; 213 + } 214 + 215 + static void prueth_emac_stop(struct prueth *prueth) 216 + { 217 + int slice; 218 + 219 + for (slice = 0; slice < PRUETH_NUM_MACS; slice++) { 220 + prueth_shutdown(prueth->txpru[slice]); 221 + prueth_shutdown(prueth->rtu[slice]); 222 + prueth_shutdown(prueth->pru[slice]); 223 + } 224 + } 225 + 226 + static int prueth_emac_common_start(struct prueth *prueth) 227 + { 228 + struct prueth_emac *emac; 229 + int ret = 0; 230 + int slice; 231 + 232 + if (!prueth->emac[ICSS_SLICE0] && !prueth->emac[ICSS_SLICE1]) 233 + return -EINVAL; 234 + 235 + /* clear SMEM and MSMC settings for all slices */ 236 + memset_io(prueth->msmcram.va, 0, prueth->msmcram.size); 237 + memset_io(prueth->shram.va, 0, ICSSG_CONFIG_OFFSET_SLICE1 * PRUETH_NUM_MACS); 238 + 239 + icssg_class_default(prueth->miig_rt, ICSS_SLICE0, 0, false); 240 + icssg_class_default(prueth->miig_rt, ICSS_SLICE1, 0, false); 241 + 242 + if (prueth->is_switch_mode || prueth->is_hsr_offload_mode) 243 + icssg_init_fw_offload_mode(prueth); 244 + else 245 + icssg_init_emac_mode(prueth); 246 + 247 + for (slice = 0; slice < PRUETH_NUM_MACS; slice++) { 248 + emac = prueth->emac[slice]; 249 + if (!emac) 250 + continue; 251 + ret = icssg_config(prueth, emac, slice); 252 + if (ret) 253 + goto disable_class; 254 + } 255 + 256 + ret = prueth_emac_start(prueth); 257 + if (ret) 258 + goto disable_class; 259 + 260 + emac = prueth->emac[ICSS_SLICE0] ? prueth->emac[ICSS_SLICE0] : 261 + prueth->emac[ICSS_SLICE1]; 262 + ret = icss_iep_init(emac->iep, &prueth_iep_clockops, 263 + emac, IEP_DEFAULT_CYCLE_TIME_NS); 264 + if (ret) { 265 + dev_err(prueth->dev, "Failed to initialize IEP module\n"); 266 + goto stop_pruss; 267 + } 268 + 269 + return 0; 270 + 271 + stop_pruss: 272 + prueth_emac_stop(prueth); 273 + 274 + disable_class: 275 + icssg_class_disable(prueth->miig_rt, ICSS_SLICE0); 276 + icssg_class_disable(prueth->miig_rt, ICSS_SLICE1); 277 + 278 + return ret; 279 + } 280 + 281 + static int prueth_emac_common_stop(struct prueth *prueth) 282 + { 283 + struct prueth_emac *emac; 284 + 285 + if (!prueth->emac[ICSS_SLICE0] && !prueth->emac[ICSS_SLICE1]) 286 + return -EINVAL; 287 + 288 + icssg_class_disable(prueth->miig_rt, ICSS_SLICE0); 289 + icssg_class_disable(prueth->miig_rt, ICSS_SLICE1); 290 + 291 + prueth_emac_stop(prueth); 292 + 293 + emac = prueth->emac[ICSS_SLICE0] ? prueth->emac[ICSS_SLICE0] : 294 + prueth->emac[ICSS_SLICE1]; 295 + icss_iep_exit(emac->iep); 296 + 297 + return 0; 236 298 } 237 299 238 300 /* called back by PHY layer if there is change in link state of hw port*/ ··· 465 373 u64 cyclecount; 466 374 u32 cycletime; 467 375 int timeout; 468 - 469 - if (!emac->fw_running) 470 - return; 471 376 472 377 sc_descp = emac->prueth->shram.va + TIMESYNC_FW_WC_SETCLOCK_DESC_OFFSET; 473 378 ··· 632 543 { 633 544 struct prueth_emac *emac = netdev_priv(ndev); 634 545 int ret, i, num_data_chn = emac->tx_ch_num; 546 + struct icssg_flow_cfg __iomem *flow_cfg; 635 547 struct prueth *prueth = emac->prueth; 636 548 int slice = prueth_emac_slice(emac); 637 549 struct device *dev = prueth->dev; 638 550 int max_rx_flows; 639 551 int rx_flow; 640 552 641 - /* clear SMEM and MSMC settings for all slices */ 642 - if (!prueth->emacs_initialized) { 643 - memset_io(prueth->msmcram.va, 0, prueth->msmcram.size); 644 - memset_io(prueth->shram.va, 0, ICSSG_CONFIG_OFFSET_SLICE1 * PRUETH_NUM_MACS); 645 - } 646 - 647 553 /* set h/w MAC as user might have re-configured */ 648 554 ether_addr_copy(emac->mac_addr, ndev->dev_addr); 649 555 650 556 icssg_class_set_mac_addr(prueth->miig_rt, slice, emac->mac_addr); 651 - icssg_class_default(prueth->miig_rt, slice, 0, false); 652 557 icssg_ft1_set_mac_addr(prueth->miig_rt, slice, emac->mac_addr); 653 558 654 559 /* Notify the stack of the actual queue counts. */ ··· 680 597 goto cleanup_napi; 681 598 } 682 599 683 - /* reset and start PRU firmware */ 684 - ret = prueth_emac_start(prueth, emac); 685 - if (ret) 686 - goto free_rx_irq; 600 + if (!prueth->emacs_initialized) { 601 + ret = prueth_emac_common_start(prueth); 602 + if (ret) 603 + goto free_rx_irq; 604 + } 605 + 606 + flow_cfg = emac->dram.va + ICSSG_CONFIG_OFFSET + PSI_L_REGULAR_FLOW_ID_BASE_OFFSET; 607 + writew(emac->rx_flow_id_base, &flow_cfg->rx_base_flow); 608 + ret = emac_fdb_flow_id_updated(emac); 609 + 610 + if (ret) { 611 + netdev_err(ndev, "Failed to update Rx Flow ID %d", ret); 612 + goto stop; 613 + } 687 614 688 615 icssg_mii_update_mtu(prueth->mii_rt, slice, ndev->max_mtu); 689 - 690 - if (!prueth->emacs_initialized) { 691 - ret = icss_iep_init(emac->iep, &prueth_iep_clockops, 692 - emac, IEP_DEFAULT_CYCLE_TIME_NS); 693 - } 694 616 695 617 ret = request_threaded_irq(emac->tx_ts_irq, NULL, prueth_tx_ts_irq, 696 618 IRQF_ONESHOT, dev_name(dev), emac); ··· 741 653 free_tx_ts_irq: 742 654 free_irq(emac->tx_ts_irq, emac); 743 655 stop: 744 - prueth_emac_stop(emac); 656 + if (!prueth->emacs_initialized) 657 + prueth_emac_common_stop(prueth); 745 658 free_rx_irq: 746 659 free_irq(emac->rx_chns.irq[rx_flow], emac); 747 660 cleanup_napi: ··· 777 688 /* block packets from wire */ 778 689 if (ndev->phydev) 779 690 phy_stop(ndev->phydev); 780 - 781 - icssg_class_disable(prueth->miig_rt, prueth_emac_slice(emac)); 782 691 783 692 if (emac->prueth->is_hsr_offload_mode) 784 693 __dev_mc_unsync(ndev, icssg_prueth_hsr_del_mcast); ··· 815 728 /* Destroying the queued work in ndo_stop() */ 816 729 cancel_delayed_work_sync(&emac->stats_work); 817 730 818 - if (prueth->emacs_initialized == 1) 819 - icss_iep_exit(emac->iep); 820 - 821 731 /* stop PRUs */ 822 - prueth_emac_stop(emac); 732 + if (prueth->emacs_initialized == 1) 733 + prueth_emac_common_stop(prueth); 823 734 824 735 free_irq(emac->tx_ts_irq, emac); 825 736 ··· 1138 1053 } 1139 1054 } 1140 1055 1141 - static void prueth_emac_restart(struct prueth *prueth) 1056 + static int prueth_emac_restart(struct prueth *prueth) 1142 1057 { 1143 1058 struct prueth_emac *emac0 = prueth->emac[PRUETH_MAC0]; 1144 1059 struct prueth_emac *emac1 = prueth->emac[PRUETH_MAC1]; 1060 + int ret; 1145 1061 1146 1062 /* Detach the net_device for both PRUeth ports*/ 1147 1063 if (netif_running(emac0->ndev)) ··· 1151 1065 netif_device_detach(emac1->ndev); 1152 1066 1153 1067 /* Disable both PRUeth ports */ 1154 - icssg_set_port_state(emac0, ICSSG_EMAC_PORT_DISABLE); 1155 - icssg_set_port_state(emac1, ICSSG_EMAC_PORT_DISABLE); 1068 + ret = icssg_set_port_state(emac0, ICSSG_EMAC_PORT_DISABLE); 1069 + ret |= icssg_set_port_state(emac1, ICSSG_EMAC_PORT_DISABLE); 1070 + if (ret) 1071 + return ret; 1156 1072 1157 1073 /* Stop both pru cores for both PRUeth ports*/ 1158 - prueth_emac_stop(emac0); 1159 - prueth->emacs_initialized--; 1160 - prueth_emac_stop(emac1); 1161 - prueth->emacs_initialized--; 1074 + ret = prueth_emac_common_stop(prueth); 1075 + if (ret) { 1076 + dev_err(prueth->dev, "Failed to stop the firmwares"); 1077 + return ret; 1078 + } 1162 1079 1163 1080 /* Start both pru cores for both PRUeth ports */ 1164 - prueth_emac_start(prueth, emac0); 1165 - prueth->emacs_initialized++; 1166 - prueth_emac_start(prueth, emac1); 1167 - prueth->emacs_initialized++; 1081 + ret = prueth_emac_common_start(prueth); 1082 + if (ret) { 1083 + dev_err(prueth->dev, "Failed to start the firmwares"); 1084 + return ret; 1085 + } 1168 1086 1169 1087 /* Enable forwarding for both PRUeth ports */ 1170 - icssg_set_port_state(emac0, ICSSG_EMAC_PORT_FORWARD); 1171 - icssg_set_port_state(emac1, ICSSG_EMAC_PORT_FORWARD); 1088 + ret = icssg_set_port_state(emac0, ICSSG_EMAC_PORT_FORWARD); 1089 + ret |= icssg_set_port_state(emac1, ICSSG_EMAC_PORT_FORWARD); 1172 1090 1173 1091 /* Attache net_device for both PRUeth ports */ 1174 1092 netif_device_attach(emac0->ndev); 1175 1093 netif_device_attach(emac1->ndev); 1094 + 1095 + return ret; 1176 1096 } 1177 1097 1178 1098 static void icssg_change_mode(struct prueth *prueth) 1179 1099 { 1180 1100 struct prueth_emac *emac; 1181 - int mac; 1101 + int mac, ret; 1182 1102 1183 - prueth_emac_restart(prueth); 1103 + ret = prueth_emac_restart(prueth); 1104 + if (ret) { 1105 + dev_err(prueth->dev, "Failed to restart the firmwares, aborting the process"); 1106 + return; 1107 + } 1184 1108 1185 1109 for (mac = PRUETH_MAC0; mac < PRUETH_NUM_MACS; mac++) { 1186 1110 emac = prueth->emac[mac]; ··· 1269 1173 { 1270 1174 struct prueth_emac *emac = netdev_priv(ndev); 1271 1175 struct prueth *prueth = emac->prueth; 1176 + int ret; 1272 1177 1273 1178 prueth->br_members &= ~BIT(emac->port_id); 1274 1179 1275 1180 if (prueth->is_switch_mode) { 1276 1181 prueth->is_switch_mode = false; 1277 1182 emac->port_vlan = 0; 1278 - prueth_emac_restart(prueth); 1183 + ret = prueth_emac_restart(prueth); 1184 + if (ret) { 1185 + dev_err(prueth->dev, "Failed to restart the firmwares, aborting the process"); 1186 + return; 1187 + } 1279 1188 } 1280 1189 1281 1190 prueth_offload_fwd_mark_update(prueth); ··· 1329 1228 struct prueth *prueth = emac->prueth; 1330 1229 struct prueth_emac *emac0; 1331 1230 struct prueth_emac *emac1; 1231 + int ret; 1332 1232 1333 1233 emac0 = prueth->emac[PRUETH_MAC0]; 1334 1234 emac1 = prueth->emac[PRUETH_MAC1]; ··· 1340 1238 emac0->port_vlan = 0; 1341 1239 emac1->port_vlan = 0; 1342 1240 prueth->hsr_dev = NULL; 1343 - prueth_emac_restart(prueth); 1241 + ret = prueth_emac_restart(prueth); 1242 + if (ret) { 1243 + dev_err(prueth->dev, "Failed to restart the firmwares, aborting the process"); 1244 + return; 1245 + } 1344 1246 netdev_dbg(ndev, "Disabling HSR Offload mode\n"); 1345 1247 } 1346 1248 } ··· 1519 1413 prueth->pa_stats = NULL; 1520 1414 } 1521 1415 1522 - if (eth0_node) { 1416 + if (eth0_node || eth1_node) { 1523 1417 ret = prueth_get_cores(prueth, ICSS_SLICE0, false); 1524 1418 if (ret) 1525 1419 goto put_cores; 1526 - } 1527 - 1528 - if (eth1_node) { 1529 1420 ret = prueth_get_cores(prueth, ICSS_SLICE1, false); 1530 1421 if (ret) 1531 1422 goto put_cores; ··· 1721 1618 pruss_put(prueth->pruss); 1722 1619 1723 1620 put_cores: 1724 - if (eth1_node) { 1725 - prueth_put_cores(prueth, ICSS_SLICE1); 1726 - of_node_put(eth1_node); 1727 - } 1728 - 1729 - if (eth0_node) { 1621 + if (eth0_node || eth1_node) { 1730 1622 prueth_put_cores(prueth, ICSS_SLICE0); 1731 1623 of_node_put(eth0_node); 1624 + 1625 + prueth_put_cores(prueth, ICSS_SLICE1); 1626 + of_node_put(eth1_node); 1732 1627 } 1733 1628 1734 1629 return ret;
+3 -2
drivers/net/ethernet/ti/icssg/icssg_prueth.h
··· 140 140 /* data for each emac port */ 141 141 struct prueth_emac { 142 142 bool is_sr1; 143 - bool fw_running; 144 143 struct prueth *prueth; 145 144 struct net_device *ndev; 146 145 u8 mac_addr[6]; ··· 360 361 enum icssg_port_state_cmd state); 361 362 void icssg_config_set_speed(struct prueth_emac *emac); 362 363 void icssg_config_half_duplex(struct prueth_emac *emac); 364 + void icssg_init_emac_mode(struct prueth *prueth); 365 + void icssg_init_fw_offload_mode(struct prueth *prueth); 363 366 364 367 /* Buffer queue helpers */ 365 368 int icssg_queue_pop(struct prueth *prueth, u8 queue); ··· 378 377 u8 untag_mask, bool add); 379 378 u16 icssg_get_pvid(struct prueth_emac *emac); 380 379 void icssg_set_pvid(struct prueth *prueth, u8 vid, u8 port); 380 + int emac_fdb_flow_id_updated(struct prueth_emac *emac); 381 381 #define prueth_napi_to_tx_chn(pnapi) \ 382 382 container_of(pnapi, struct prueth_tx_chn, napi_tx) 383 383 ··· 409 407 struct sk_buff *skb, u32 *psdata); 410 408 enum netdev_tx icssg_ndo_start_xmit(struct sk_buff *skb, struct net_device *ndev); 411 409 irqreturn_t prueth_rx_irq(int irq, void *dev_id); 412 - void prueth_emac_stop(struct prueth_emac *emac); 413 410 void prueth_cleanup_tx_ts(struct prueth_emac *emac); 414 411 int icssg_napi_rx_poll(struct napi_struct *napi_rx, int budget); 415 412 int prueth_prepare_rx_chan(struct prueth_emac *emac,
+23 -1
drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c
··· 440 440 goto halt_pru; 441 441 } 442 442 443 - emac->fw_running = 1; 444 443 return 0; 445 444 446 445 halt_pru: 447 446 rproc_shutdown(prueth->pru[slice]); 448 447 449 448 return ret; 449 + } 450 + 451 + static void prueth_emac_stop(struct prueth_emac *emac) 452 + { 453 + struct prueth *prueth = emac->prueth; 454 + int slice; 455 + 456 + switch (emac->port_id) { 457 + case PRUETH_PORT_MII0: 458 + slice = ICSS_SLICE0; 459 + break; 460 + case PRUETH_PORT_MII1: 461 + slice = ICSS_SLICE1; 462 + break; 463 + default: 464 + netdev_err(emac->ndev, "invalid port\n"); 465 + return; 466 + } 467 + 468 + if (!emac->is_sr1) 469 + rproc_shutdown(prueth->txpru[slice]); 470 + rproc_shutdown(prueth->rtu[slice]); 471 + rproc_shutdown(prueth->pru[slice]); 450 472 } 451 473 452 474 /**
+101 -13
drivers/net/phy/micrel.c
··· 432 432 struct kszphy_priv { 433 433 struct kszphy_ptp_priv ptp_priv; 434 434 const struct kszphy_type *type; 435 + struct clk *clk; 435 436 int led_mode; 436 437 u16 vct_ctrl1000; 437 438 bool rmii_ref_clk_sel; 438 439 bool rmii_ref_clk_sel_val; 440 + bool clk_enable; 439 441 u64 stats[ARRAY_SIZE(kszphy_hw_stats)]; 440 442 }; 441 443 ··· 2052 2050 data[i] = kszphy_get_stat(phydev, i); 2053 2051 } 2054 2052 2053 + static void kszphy_enable_clk(struct phy_device *phydev) 2054 + { 2055 + struct kszphy_priv *priv = phydev->priv; 2056 + 2057 + if (!priv->clk_enable && priv->clk) { 2058 + clk_prepare_enable(priv->clk); 2059 + priv->clk_enable = true; 2060 + } 2061 + } 2062 + 2063 + static void kszphy_disable_clk(struct phy_device *phydev) 2064 + { 2065 + struct kszphy_priv *priv = phydev->priv; 2066 + 2067 + if (priv->clk_enable && priv->clk) { 2068 + clk_disable_unprepare(priv->clk); 2069 + priv->clk_enable = false; 2070 + } 2071 + } 2072 + 2073 + static int kszphy_generic_resume(struct phy_device *phydev) 2074 + { 2075 + kszphy_enable_clk(phydev); 2076 + 2077 + return genphy_resume(phydev); 2078 + } 2079 + 2080 + static int kszphy_generic_suspend(struct phy_device *phydev) 2081 + { 2082 + int ret; 2083 + 2084 + ret = genphy_suspend(phydev); 2085 + if (ret) 2086 + return ret; 2087 + 2088 + kszphy_disable_clk(phydev); 2089 + 2090 + return 0; 2091 + } 2092 + 2055 2093 static int kszphy_suspend(struct phy_device *phydev) 2056 2094 { 2057 2095 /* Disable PHY Interrupts */ ··· 2101 2059 phydev->drv->config_intr(phydev); 2102 2060 } 2103 2061 2104 - return genphy_suspend(phydev); 2062 + return kszphy_generic_suspend(phydev); 2105 2063 } 2106 2064 2107 2065 static void kszphy_parse_led_mode(struct phy_device *phydev) ··· 2132 2090 { 2133 2091 int ret; 2134 2092 2135 - genphy_resume(phydev); 2093 + ret = kszphy_generic_resume(phydev); 2094 + if (ret) 2095 + return ret; 2136 2096 2137 2097 /* After switching from power-down to normal mode, an internal global 2138 2098 * reset is automatically generated. Wait a minimum of 1 ms before ··· 2152 2108 if (phydev->drv->config_intr) 2153 2109 phydev->drv->config_intr(phydev); 2154 2110 } 2111 + 2112 + return 0; 2113 + } 2114 + 2115 + /* Because of errata DS80000700A, receiver error following software 2116 + * power down. Suspend and resume callbacks only disable and enable 2117 + * external rmii reference clock. 2118 + */ 2119 + static int ksz8041_resume(struct phy_device *phydev) 2120 + { 2121 + kszphy_enable_clk(phydev); 2122 + 2123 + return 0; 2124 + } 2125 + 2126 + static int ksz8041_suspend(struct phy_device *phydev) 2127 + { 2128 + kszphy_disable_clk(phydev); 2155 2129 2156 2130 return 0; 2157 2131 } ··· 2221 2159 if (!(ret & BMCR_PDOWN)) 2222 2160 return 0; 2223 2161 2224 - genphy_resume(phydev); 2162 + ret = kszphy_generic_resume(phydev); 2163 + if (ret) 2164 + return ret; 2165 + 2225 2166 usleep_range(1000, 2000); 2226 2167 2227 2168 /* Re-program the value after chip is reset. */ ··· 2240 2175 } 2241 2176 2242 2177 return 0; 2178 + } 2179 + 2180 + static int ksz8061_suspend(struct phy_device *phydev) 2181 + { 2182 + return kszphy_suspend(phydev); 2243 2183 } 2244 2184 2245 2185 static int kszphy_probe(struct phy_device *phydev) ··· 2287 2217 } else if (!clk) { 2288 2218 /* unnamed clock from the generic ethernet-phy binding */ 2289 2219 clk = devm_clk_get_optional_enabled(&phydev->mdio.dev, NULL); 2290 - if (IS_ERR(clk)) 2291 - return PTR_ERR(clk); 2292 2220 } 2221 + 2222 + if (IS_ERR(clk)) 2223 + return PTR_ERR(clk); 2224 + 2225 + clk_disable_unprepare(clk); 2226 + priv->clk = clk; 2293 2227 2294 2228 if (ksz8041_fiber_mode(phydev)) 2295 2229 phydev->port = PORT_FIBRE; ··· 5364 5290 return 0; 5365 5291 } 5366 5292 5293 + static int lan8804_resume(struct phy_device *phydev) 5294 + { 5295 + return kszphy_resume(phydev); 5296 + } 5297 + 5298 + static int lan8804_suspend(struct phy_device *phydev) 5299 + { 5300 + return kszphy_generic_suspend(phydev); 5301 + } 5302 + 5303 + static int lan8841_resume(struct phy_device *phydev) 5304 + { 5305 + return kszphy_generic_resume(phydev); 5306 + } 5307 + 5367 5308 static int lan8841_suspend(struct phy_device *phydev) 5368 5309 { 5369 5310 struct kszphy_priv *priv = phydev->priv; ··· 5387 5298 if (ptp_priv->ptp_clock) 5388 5299 ptp_cancel_worker_sync(ptp_priv->ptp_clock); 5389 5300 5390 - return genphy_suspend(phydev); 5301 + return kszphy_generic_suspend(phydev); 5391 5302 } 5392 5303 5393 5304 static struct phy_driver ksphy_driver[] = { ··· 5447 5358 .get_sset_count = kszphy_get_sset_count, 5448 5359 .get_strings = kszphy_get_strings, 5449 5360 .get_stats = kszphy_get_stats, 5450 - /* No suspend/resume callbacks because of errata DS80000700A, 5451 - * receiver error following software power down. 5452 - */ 5361 + .suspend = ksz8041_suspend, 5362 + .resume = ksz8041_resume, 5453 5363 }, { 5454 5364 .phy_id = PHY_ID_KSZ8041RNLI, 5455 5365 .phy_id_mask = MICREL_PHY_ID_MASK, ··· 5524 5436 .soft_reset = genphy_soft_reset, 5525 5437 .config_intr = kszphy_config_intr, 5526 5438 .handle_interrupt = kszphy_handle_interrupt, 5527 - .suspend = kszphy_suspend, 5439 + .suspend = ksz8061_suspend, 5528 5440 .resume = ksz8061_resume, 5529 5441 }, { 5530 5442 .phy_id = PHY_ID_KSZ9021, ··· 5595 5507 .get_sset_count = kszphy_get_sset_count, 5596 5508 .get_strings = kszphy_get_strings, 5597 5509 .get_stats = kszphy_get_stats, 5598 - .suspend = genphy_suspend, 5599 - .resume = kszphy_resume, 5510 + .suspend = lan8804_suspend, 5511 + .resume = lan8804_resume, 5600 5512 .config_intr = lan8804_config_intr, 5601 5513 .handle_interrupt = lan8804_handle_interrupt, 5602 5514 }, { ··· 5614 5526 .get_strings = kszphy_get_strings, 5615 5527 .get_stats = kszphy_get_stats, 5616 5528 .suspend = lan8841_suspend, 5617 - .resume = genphy_resume, 5529 + .resume = lan8841_resume, 5618 5530 .cable_test_start = lan8814_cable_test_start, 5619 5531 .cable_test_get_status = ksz886x_cable_test_get_status, 5620 5532 }, {
+4 -12
drivers/net/pse-pd/tps23881.c
··· 64 64 if (id >= TPS23881_MAX_CHANS) 65 65 return -ERANGE; 66 66 67 - ret = i2c_smbus_read_word_data(client, TPS23881_REG_PW_STATUS); 68 - if (ret < 0) 69 - return ret; 70 - 71 67 chan = priv->port[id].chan[0]; 72 68 if (chan < 4) 73 - val = (u16)(ret | BIT(chan)); 69 + val = BIT(chan); 74 70 else 75 - val = (u16)(ret | BIT(chan + 4)); 71 + val = BIT(chan + 4); 76 72 77 73 if (priv->port[id].is_4p) { 78 74 chan = priv->port[id].chan[1]; ··· 96 100 if (id >= TPS23881_MAX_CHANS) 97 101 return -ERANGE; 98 102 99 - ret = i2c_smbus_read_word_data(client, TPS23881_REG_PW_STATUS); 100 - if (ret < 0) 101 - return ret; 102 - 103 103 chan = priv->port[id].chan[0]; 104 104 if (chan < 4) 105 - val = (u16)(ret | BIT(chan + 4)); 105 + val = BIT(chan + 4); 106 106 else 107 - val = (u16)(ret | BIT(chan + 8)); 107 + val = BIT(chan + 8); 108 108 109 109 if (priv->port[id].is_4p) { 110 110 chan = priv->port[id].chan[1];
+1
drivers/net/wireless/intel/iwlwifi/cfg/bz.c
··· 161 161 162 162 const char iwl_bz_name[] = "Intel(R) TBD Bz device"; 163 163 const char iwl_fm_name[] = "Intel(R) Wi-Fi 7 BE201 320MHz"; 164 + const char iwl_wh_name[] = "Intel(R) Wi-Fi 7 BE211 320MHz"; 164 165 const char iwl_gl_name[] = "Intel(R) Wi-Fi 7 BE200 320MHz"; 165 166 const char iwl_mtp_name[] = "Intel(R) Wi-Fi 7 BE202 160MHz"; 166 167
+1
drivers/net/wireless/intel/iwlwifi/iwl-config.h
··· 545 545 extern const char iwl_ax411_name[]; 546 546 extern const char iwl_bz_name[]; 547 547 extern const char iwl_fm_name[]; 548 + extern const char iwl_wh_name[]; 548 549 extern const char iwl_gl_name[]; 549 550 extern const char iwl_mtp_name[]; 550 551 extern const char iwl_sc_name[];
+11 -3
drivers/net/wireless/intel/iwlwifi/mvm/d3.c
··· 2954 2954 int idx) 2955 2955 { 2956 2956 int i; 2957 + int n_channels = 0; 2957 2958 2958 2959 if (fw_has_api(&mvm->fw->ucode_capa, 2959 2960 IWL_UCODE_TLV_API_SCAN_OFFLOAD_CHANS)) { ··· 2963 2962 2964 2963 for (i = 0; i < SCAN_OFFLOAD_MATCHING_CHANNELS_LEN * 8; i++) 2965 2964 if (matches[idx].matching_channels[i / 8] & (BIT(i % 8))) 2966 - match->channels[match->n_channels++] = 2965 + match->channels[n_channels++] = 2967 2966 mvm->nd_channels[i]->center_freq; 2968 2967 } else { 2969 2968 struct iwl_scan_offload_profile_match_v1 *matches = ··· 2971 2970 2972 2971 for (i = 0; i < SCAN_OFFLOAD_MATCHING_CHANNELS_LEN_V1 * 8; i++) 2973 2972 if (matches[idx].matching_channels[i / 8] & (BIT(i % 8))) 2974 - match->channels[match->n_channels++] = 2973 + match->channels[n_channels++] = 2975 2974 mvm->nd_channels[i]->center_freq; 2976 2975 } 2976 + /* We may have ended up with fewer channels than we allocated. */ 2977 + match->n_channels = n_channels; 2977 2978 } 2978 2979 2979 2980 /** ··· 3056 3053 GFP_KERNEL); 3057 3054 if (!net_detect || !n_matches) 3058 3055 goto out_report_nd; 3056 + net_detect->n_matches = n_matches; 3057 + n_matches = 0; 3059 3058 3060 3059 for_each_set_bit(i, &matched_profiles, mvm->n_nd_match_sets) { 3061 3060 struct cfg80211_wowlan_nd_match *match; ··· 3071 3066 GFP_KERNEL); 3072 3067 if (!match) 3073 3068 goto out_report_nd; 3069 + match->n_channels = n_channels; 3074 3070 3075 - net_detect->matches[net_detect->n_matches++] = match; 3071 + net_detect->matches[n_matches++] = match; 3076 3072 3077 3073 /* We inverted the order of the SSIDs in the scan 3078 3074 * request, so invert the index here. ··· 3088 3082 3089 3083 iwl_mvm_query_set_freqs(mvm, d3_data->nd_results, match, i); 3090 3084 } 3085 + /* We may have fewer matches than we allocated. */ 3086 + net_detect->n_matches = n_matches; 3091 3087 3092 3088 out_report_nd: 3093 3089 wakeup.net_detect = net_detect;
+38 -3
drivers/net/wireless/intel/iwlwifi/pcie/drv.c
··· 1106 1106 iwlax210_2ax_cfg_so_jf_b0, iwl9462_name), 1107 1107 1108 1108 /* Bz */ 1109 - /* FIXME: need to change the naming according to the actual CRF */ 1110 1109 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1111 1110 IWL_CFG_MAC_TYPE_BZ, IWL_CFG_ANY, 1111 + IWL_CFG_RF_TYPE_HR2, IWL_CFG_ANY, IWL_CFG_ANY, 1112 1112 IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1113 + iwl_cfg_bz, iwl_ax201_name), 1114 + 1115 + _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1116 + IWL_CFG_MAC_TYPE_BZ, IWL_CFG_ANY, 1117 + IWL_CFG_RF_TYPE_GF, IWL_CFG_ANY, IWL_CFG_ANY, 1118 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1119 + iwl_cfg_bz, iwl_ax211_name), 1120 + 1121 + _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1122 + IWL_CFG_MAC_TYPE_BZ, IWL_CFG_ANY, 1123 + IWL_CFG_RF_TYPE_FM, IWL_CFG_ANY, IWL_CFG_ANY, 1124 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1125 + iwl_cfg_bz, iwl_fm_name), 1126 + 1127 + _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1128 + IWL_CFG_MAC_TYPE_BZ, IWL_CFG_ANY, 1129 + IWL_CFG_RF_TYPE_WH, IWL_CFG_ANY, IWL_CFG_ANY, 1130 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1131 + iwl_cfg_bz, iwl_wh_name), 1132 + 1133 + _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1134 + IWL_CFG_MAC_TYPE_BZ_W, IWL_CFG_ANY, 1135 + IWL_CFG_RF_TYPE_HR2, IWL_CFG_ANY, IWL_CFG_ANY, 1136 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1137 + iwl_cfg_bz, iwl_ax201_name), 1138 + 1139 + _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1140 + IWL_CFG_MAC_TYPE_BZ_W, IWL_CFG_ANY, 1141 + IWL_CFG_RF_TYPE_GF, IWL_CFG_ANY, IWL_CFG_ANY, 1142 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1143 + iwl_cfg_bz, iwl_ax211_name), 1144 + 1145 + _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1146 + IWL_CFG_MAC_TYPE_BZ_W, IWL_CFG_ANY, 1147 + IWL_CFG_RF_TYPE_FM, IWL_CFG_ANY, IWL_CFG_ANY, 1113 1148 IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1114 1149 iwl_cfg_bz, iwl_fm_name), 1115 1150 1116 1151 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1117 1152 IWL_CFG_MAC_TYPE_BZ_W, IWL_CFG_ANY, 1153 + IWL_CFG_RF_TYPE_WH, IWL_CFG_ANY, IWL_CFG_ANY, 1118 1154 IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1119 - IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1120 - iwl_cfg_bz, iwl_fm_name), 1155 + iwl_cfg_bz, iwl_wh_name), 1121 1156 1122 1157 /* Ga (Gl) */ 1123 1158 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY,
+1 -1
drivers/net/wireless/st/cw1200/cw1200_spi.c
··· 442 442 cw1200_core_release(self->core); 443 443 self->core = NULL; 444 444 } 445 + cw1200_spi_off(self, dev_get_platdata(&func->dev)); 445 446 } 446 - cw1200_spi_off(self, dev_get_platdata(&func->dev)); 447 447 } 448 448 449 449 static int __maybe_unused cw1200_spi_suspend(struct device *dev)
+1 -1
drivers/net/wwan/iosm/iosm_ipc_mmio.c
··· 104 104 break; 105 105 106 106 msleep(20); 107 - } while (retries-- > 0); 107 + } while (--retries > 0); 108 108 109 109 if (!retries) { 110 110 dev_err(ipc_mmio->dev, "invalid exec stage %X", stage);
+17 -9
drivers/net/wwan/t7xx/t7xx_state_monitor.c
··· 104 104 fsm_state_notify(ctl->md, state); 105 105 } 106 106 107 + static void fsm_release_command(struct kref *ref) 108 + { 109 + struct t7xx_fsm_command *cmd = container_of(ref, typeof(*cmd), refcnt); 110 + 111 + kfree(cmd); 112 + } 113 + 107 114 static void fsm_finish_command(struct t7xx_fsm_ctl *ctl, struct t7xx_fsm_command *cmd, int result) 108 115 { 109 116 if (cmd->flag & FSM_CMD_FLAG_WAIT_FOR_COMPLETION) { 110 - *cmd->ret = result; 111 - complete_all(cmd->done); 117 + cmd->result = result; 118 + complete_all(&cmd->done); 112 119 } 113 120 114 - kfree(cmd); 121 + kref_put(&cmd->refcnt, fsm_release_command); 115 122 } 116 123 117 124 static void fsm_del_kf_event(struct t7xx_fsm_event *event) ··· 482 475 483 476 int t7xx_fsm_append_cmd(struct t7xx_fsm_ctl *ctl, enum t7xx_fsm_cmd_state cmd_id, unsigned int flag) 484 477 { 485 - DECLARE_COMPLETION_ONSTACK(done); 486 478 struct t7xx_fsm_command *cmd; 487 479 unsigned long flags; 488 480 int ret; ··· 493 487 INIT_LIST_HEAD(&cmd->entry); 494 488 cmd->cmd_id = cmd_id; 495 489 cmd->flag = flag; 490 + kref_init(&cmd->refcnt); 496 491 if (flag & FSM_CMD_FLAG_WAIT_FOR_COMPLETION) { 497 - cmd->done = &done; 498 - cmd->ret = &ret; 492 + init_completion(&cmd->done); 493 + kref_get(&cmd->refcnt); 499 494 } 500 495 496 + kref_get(&cmd->refcnt); 501 497 spin_lock_irqsave(&ctl->command_lock, flags); 502 498 list_add_tail(&cmd->entry, &ctl->command_queue); 503 499 spin_unlock_irqrestore(&ctl->command_lock, flags); ··· 509 501 if (flag & FSM_CMD_FLAG_WAIT_FOR_COMPLETION) { 510 502 unsigned long wait_ret; 511 503 512 - wait_ret = wait_for_completion_timeout(&done, 504 + wait_ret = wait_for_completion_timeout(&cmd->done, 513 505 msecs_to_jiffies(FSM_CMD_TIMEOUT_MS)); 514 - if (!wait_ret) 515 - return -ETIMEDOUT; 516 506 507 + ret = wait_ret ? cmd->result : -ETIMEDOUT; 508 + kref_put(&cmd->refcnt, fsm_release_command); 517 509 return ret; 518 510 } 519 511
+3 -2
drivers/net/wwan/t7xx/t7xx_state_monitor.h
··· 110 110 struct list_head entry; 111 111 enum t7xx_fsm_cmd_state cmd_id; 112 112 unsigned int flag; 113 - struct completion *done; 114 - int *ret; 113 + struct completion done; 114 + int result; 115 + struct kref refcnt; 115 116 }; 116 117 117 118 struct t7xx_fsm_notifier {
+13 -3
include/linux/if_vlan.h
··· 585 585 * vlan_get_protocol - get protocol EtherType. 586 586 * @skb: skbuff to query 587 587 * @type: first vlan protocol 588 + * @mac_offset: MAC offset 588 589 * @depth: buffer to store length of eth and vlan tags in bytes 589 590 * 590 591 * Returns the EtherType of the packet, regardless of whether it is 591 592 * vlan encapsulated (normal or hardware accelerated) or not. 592 593 */ 593 - static inline __be16 __vlan_get_protocol(const struct sk_buff *skb, __be16 type, 594 - int *depth) 594 + static inline __be16 __vlan_get_protocol_offset(const struct sk_buff *skb, 595 + __be16 type, 596 + int mac_offset, 597 + int *depth) 595 598 { 596 599 unsigned int vlan_depth = skb->mac_len, parse_depth = VLAN_MAX_DEPTH; 597 600 ··· 613 610 do { 614 611 struct vlan_hdr vhdr, *vh; 615 612 616 - vh = skb_header_pointer(skb, vlan_depth, sizeof(vhdr), &vhdr); 613 + vh = skb_header_pointer(skb, mac_offset + vlan_depth, 614 + sizeof(vhdr), &vhdr); 617 615 if (unlikely(!vh || !--parse_depth)) 618 616 return 0; 619 617 ··· 627 623 *depth = vlan_depth; 628 624 629 625 return type; 626 + } 627 + 628 + static inline __be16 __vlan_get_protocol(const struct sk_buff *skb, __be16 type, 629 + int *depth) 630 + { 631 + return __vlan_get_protocol_offset(skb, type, 0, depth); 630 632 } 631 633 632 634 /**
+1
include/linux/mlx5/driver.h
··· 524 524 * creation/deletion on drivers rescan. Unset during device attach. 525 525 */ 526 526 MLX5_PRIV_FLAGS_DETACH = 1 << 2, 527 + MLX5_PRIV_FLAGS_SWITCH_LEGACY = 1 << 3, 527 528 }; 528 529 529 530 struct mlx5_adev {
+5 -2
include/net/netfilter/nf_tables.h
··· 733 733 /** 734 734 * struct nft_set_ext - set extensions 735 735 * 736 - * @genmask: generation mask 736 + * @genmask: generation mask, but also flags (see NFT_SET_ELEM_DEAD_BIT) 737 737 * @offset: offsets of individual extension types 738 738 * @data: beginning of extension data 739 + * 740 + * This structure must be aligned to word size, otherwise atomic bitops 741 + * on genmask field can cause alignment failure on some archs. 739 742 */ 740 743 struct nft_set_ext { 741 744 u8 genmask; 742 745 u8 offset[NFT_SET_EXT_NUM]; 743 746 char data[]; 744 - }; 747 + } __aligned(BITS_PER_LONG / 8); 745 748 746 749 static inline void nft_set_ext_prepare(struct nft_set_ext_tmpl *tmpl) 747 750 {
+26 -24
include/uapi/linux/mptcp_pm.h
··· 12 12 /** 13 13 * enum mptcp_event_type 14 14 * @MPTCP_EVENT_UNSPEC: unused event 15 - * @MPTCP_EVENT_CREATED: token, family, saddr4 | saddr6, daddr4 | daddr6, 16 - * sport, dport A new MPTCP connection has been created. It is the good time 17 - * to allocate memory and send ADD_ADDR if needed. Depending on the 15 + * @MPTCP_EVENT_CREATED: A new MPTCP connection has been created. It is the 16 + * good time to allocate memory and send ADD_ADDR if needed. Depending on the 18 17 * traffic-patterns it can take a long time until the MPTCP_EVENT_ESTABLISHED 19 - * is sent. 20 - * @MPTCP_EVENT_ESTABLISHED: token, family, saddr4 | saddr6, daddr4 | daddr6, 21 - * sport, dport A MPTCP connection is established (can start new subflows). 22 - * @MPTCP_EVENT_CLOSED: token A MPTCP connection has stopped. 23 - * @MPTCP_EVENT_ANNOUNCED: token, rem_id, family, daddr4 | daddr6 [, dport] A 24 - * new address has been announced by the peer. 25 - * @MPTCP_EVENT_REMOVED: token, rem_id An address has been lost by the peer. 26 - * @MPTCP_EVENT_SUB_ESTABLISHED: token, family, loc_id, rem_id, saddr4 | 27 - * saddr6, daddr4 | daddr6, sport, dport, backup, if_idx [, error] A new 28 - * subflow has been established. 'error' should not be set. 29 - * @MPTCP_EVENT_SUB_CLOSED: token, family, loc_id, rem_id, saddr4 | saddr6, 30 - * daddr4 | daddr6, sport, dport, backup, if_idx [, error] A subflow has been 31 - * closed. An error (copy of sk_err) could be set if an error has been 32 - * detected for this subflow. 33 - * @MPTCP_EVENT_SUB_PRIORITY: token, family, loc_id, rem_id, saddr4 | saddr6, 34 - * daddr4 | daddr6, sport, dport, backup, if_idx [, error] The priority of a 35 - * subflow has changed. 'error' should not be set. 36 - * @MPTCP_EVENT_LISTENER_CREATED: family, sport, saddr4 | saddr6 A new PM 37 - * listener is created. 38 - * @MPTCP_EVENT_LISTENER_CLOSED: family, sport, saddr4 | saddr6 A PM listener 39 - * is closed. 18 + * is sent. Attributes: token, family, saddr4 | saddr6, daddr4 | daddr6, 19 + * sport, dport, server-side. 20 + * @MPTCP_EVENT_ESTABLISHED: A MPTCP connection is established (can start new 21 + * subflows). Attributes: token, family, saddr4 | saddr6, daddr4 | daddr6, 22 + * sport, dport, server-side. 23 + * @MPTCP_EVENT_CLOSED: A MPTCP connection has stopped. Attribute: token. 24 + * @MPTCP_EVENT_ANNOUNCED: A new address has been announced by the peer. 25 + * Attributes: token, rem_id, family, daddr4 | daddr6 [, dport]. 26 + * @MPTCP_EVENT_REMOVED: An address has been lost by the peer. Attributes: 27 + * token, rem_id. 28 + * @MPTCP_EVENT_SUB_ESTABLISHED: A new subflow has been established. 'error' 29 + * should not be set. Attributes: token, family, loc_id, rem_id, saddr4 | 30 + * saddr6, daddr4 | daddr6, sport, dport, backup, if_idx [, error]. 31 + * @MPTCP_EVENT_SUB_CLOSED: A subflow has been closed. An error (copy of 32 + * sk_err) could be set if an error has been detected for this subflow. 33 + * Attributes: token, family, loc_id, rem_id, saddr4 | saddr6, daddr4 | 34 + * daddr6, sport, dport, backup, if_idx [, error]. 35 + * @MPTCP_EVENT_SUB_PRIORITY: The priority of a subflow has changed. 'error' 36 + * should not be set. Attributes: token, family, loc_id, rem_id, saddr4 | 37 + * saddr6, daddr4 | daddr6, sport, dport, backup, if_idx [, error]. 38 + * @MPTCP_EVENT_LISTENER_CREATED: A new PM listener is created. Attributes: 39 + * family, sport, saddr4 | saddr6. 40 + * @MPTCP_EVENT_LISTENER_CLOSED: A PM listener is closed. Attributes: family, 41 + * sport, saddr4 | saddr6. 40 42 */ 41 43 enum mptcp_event_type { 42 44 MPTCP_EVENT_UNSPEC,
+3 -1
net/core/dev.c
··· 3642 3642 3643 3643 if (features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) { 3644 3644 if (vlan_get_protocol(skb) == htons(ETH_P_IPV6) && 3645 - skb_network_header_len(skb) != sizeof(struct ipv6hdr)) 3645 + skb_network_header_len(skb) != sizeof(struct ipv6hdr) && 3646 + !ipv6_has_hopopt_jumbo(skb)) 3646 3647 goto sw_checksum; 3648 + 3647 3649 switch (skb->csum_offset) { 3648 3650 case offsetof(struct tcphdr, check): 3649 3651 case offsetof(struct udphdr, check):
+5 -1
net/core/netdev-genl.c
··· 246 246 rcu_read_unlock(); 247 247 rtnl_unlock(); 248 248 249 - if (err) 249 + if (err) { 250 250 goto err_free_msg; 251 + } else if (!rsp->len) { 252 + err = -ENOENT; 253 + goto err_free_msg; 254 + } 251 255 252 256 return genlmsg_reply(rsp, info); 253 257
+4 -1
net/core/sock.c
··· 1295 1295 sk->sk_reuse = (valbool ? SK_CAN_REUSE : SK_NO_REUSE); 1296 1296 break; 1297 1297 case SO_REUSEPORT: 1298 - sk->sk_reuseport = valbool; 1298 + if (valbool && !sk_is_inet(sk)) 1299 + ret = -EOPNOTSUPP; 1300 + else 1301 + sk->sk_reuseport = valbool; 1299 1302 break; 1300 1303 case SO_DONTROUTE: 1301 1304 sock_valbool_flag(sk, SOCK_LOCALROUTE, valbool);
+3 -3
net/ipv4/ip_tunnel.c
··· 294 294 295 295 ip_tunnel_init_flow(&fl4, iph->protocol, iph->daddr, 296 296 iph->saddr, tunnel->parms.o_key, 297 - iph->tos & INET_DSCP_MASK, dev_net(dev), 297 + iph->tos & INET_DSCP_MASK, tunnel->net, 298 298 tunnel->parms.link, tunnel->fwmark, 0, 0); 299 299 rt = ip_route_output_key(tunnel->net, &fl4); 300 300 ··· 611 611 } 612 612 ip_tunnel_init_flow(&fl4, proto, key->u.ipv4.dst, key->u.ipv4.src, 613 613 tunnel_id_to_key32(key->tun_id), 614 - tos & INET_DSCP_MASK, dev_net(dev), 0, skb->mark, 614 + tos & INET_DSCP_MASK, tunnel->net, 0, skb->mark, 615 615 skb_get_hash(skb), key->flow_flags); 616 616 617 617 if (!tunnel_hlen) ··· 774 774 775 775 ip_tunnel_init_flow(&fl4, protocol, dst, tnl_params->saddr, 776 776 tunnel->parms.o_key, tos & INET_DSCP_MASK, 777 - dev_net(dev), READ_ONCE(tunnel->parms.link), 777 + tunnel->net, READ_ONCE(tunnel->parms.link), 778 778 tunnel->fwmark, skb_get_hash(skb), 0); 779 779 780 780 if (ip_tunnel_encap(skb, &tunnel->encap, &protocol, &fl4) < 0)
+1
net/ipv4/tcp_input.c
··· 7328 7328 if (unlikely(!inet_csk_reqsk_queue_hash_add(sk, req, 7329 7329 req->timeout))) { 7330 7330 reqsk_free(req); 7331 + dst_release(dst); 7331 7332 return 0; 7332 7333 } 7333 7334
+11 -5
net/ipv6/ila/ila_xlat.c
··· 195 195 }, 196 196 }; 197 197 198 + static DEFINE_MUTEX(ila_mutex); 199 + 198 200 static int ila_add_mapping(struct net *net, struct ila_xlat_params *xp) 199 201 { 200 202 struct ila_net *ilan = net_generic(net, ila_net_id); ··· 204 202 spinlock_t *lock = ila_get_lock(ilan, xp->ip.locator_match); 205 203 int err = 0, order; 206 204 207 - if (!ilan->xlat.hooks_registered) { 205 + if (!READ_ONCE(ilan->xlat.hooks_registered)) { 208 206 /* We defer registering net hooks in the namespace until the 209 207 * first mapping is added. 210 208 */ 211 - err = nf_register_net_hooks(net, ila_nf_hook_ops, 212 - ARRAY_SIZE(ila_nf_hook_ops)); 209 + mutex_lock(&ila_mutex); 210 + if (!ilan->xlat.hooks_registered) { 211 + err = nf_register_net_hooks(net, ila_nf_hook_ops, 212 + ARRAY_SIZE(ila_nf_hook_ops)); 213 + if (!err) 214 + WRITE_ONCE(ilan->xlat.hooks_registered, true); 215 + } 216 + mutex_unlock(&ila_mutex); 213 217 if (err) 214 218 return err; 215 - 216 - ilan->xlat.hooks_registered = true; 217 219 } 218 220 219 221 ila = kzalloc(sizeof(*ila), GFP_KERNEL);
+1 -1
net/llc/llc_input.c
··· 124 124 if (unlikely(!pskb_may_pull(skb, llc_len))) 125 125 return 0; 126 126 127 - skb->transport_header += llc_len; 128 127 skb_pull(skb, llc_len); 128 + skb_reset_transport_header(skb); 129 129 if (skb->protocol == htons(ETH_P_802_2)) { 130 130 __be16 pdulen; 131 131 s32 data_size;
+7
net/mptcp/options.c
··· 667 667 &echo, &drop_other_suboptions)) 668 668 return false; 669 669 670 + /* 671 + * Later on, mptcp_write_options() will enforce mutually exclusion with 672 + * DSS, bail out if such option is set and we can't drop it. 673 + */ 670 674 if (drop_other_suboptions) 671 675 remaining += opt_size; 676 + else if (opts->suboptions & OPTION_MPTCP_DSS) 677 + return false; 678 + 672 679 len = mptcp_add_addr_len(opts->addr.family, echo, !!opts->addr.port); 673 680 if (remaining < len) 674 681 return false;
+12 -11
net/mptcp/protocol.c
··· 136 136 int delta; 137 137 138 138 if (MPTCP_SKB_CB(from)->offset || 139 + ((to->len + from->len) > (sk->sk_rcvbuf >> 3)) || 139 140 !skb_try_coalesce(to, from, &fragstolen, &delta)) 140 141 return false; 141 142 ··· 529 528 mptcp_subflow_send_ack(mptcp_subflow_tcp_sock(subflow)); 530 529 } 531 530 532 - static void mptcp_subflow_cleanup_rbuf(struct sock *ssk) 531 + static void mptcp_subflow_cleanup_rbuf(struct sock *ssk, int copied) 533 532 { 534 533 bool slow; 535 534 536 535 slow = lock_sock_fast(ssk); 537 536 if (tcp_can_send_ack(ssk)) 538 - tcp_cleanup_rbuf(ssk, 1); 537 + tcp_cleanup_rbuf(ssk, copied); 539 538 unlock_sock_fast(ssk, slow); 540 539 } 541 540 ··· 552 551 (ICSK_ACK_PUSHED2 | ICSK_ACK_PUSHED))); 553 552 } 554 553 555 - static void mptcp_cleanup_rbuf(struct mptcp_sock *msk) 554 + static void mptcp_cleanup_rbuf(struct mptcp_sock *msk, int copied) 556 555 { 557 556 int old_space = READ_ONCE(msk->old_wspace); 558 557 struct mptcp_subflow_context *subflow; ··· 560 559 int space = __mptcp_space(sk); 561 560 bool cleanup, rx_empty; 562 561 563 - cleanup = (space > 0) && (space >= (old_space << 1)); 564 - rx_empty = !__mptcp_rmem(sk); 562 + cleanup = (space > 0) && (space >= (old_space << 1)) && copied; 563 + rx_empty = !__mptcp_rmem(sk) && copied; 565 564 566 565 mptcp_for_each_subflow(msk, subflow) { 567 566 struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 568 567 569 568 if (cleanup || mptcp_subflow_could_cleanup(ssk, rx_empty)) 570 - mptcp_subflow_cleanup_rbuf(ssk); 569 + mptcp_subflow_cleanup_rbuf(ssk, copied); 571 570 } 572 571 } 573 572 ··· 1940 1939 goto out; 1941 1940 } 1942 1941 1942 + static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied); 1943 + 1943 1944 static int __mptcp_recvmsg_mskq(struct mptcp_sock *msk, 1944 1945 struct msghdr *msg, 1945 1946 size_t len, int flags, ··· 1995 1992 break; 1996 1993 } 1997 1994 1995 + mptcp_rcv_space_adjust(msk, copied); 1998 1996 return copied; 1999 1997 } 2000 1998 ··· 2221 2217 2222 2218 copied += bytes_read; 2223 2219 2224 - /* be sure to advertise window change */ 2225 - mptcp_cleanup_rbuf(msk); 2226 - 2227 2220 if (skb_queue_empty(&msk->receive_queue) && __mptcp_move_skbs(msk)) 2228 2221 continue; 2229 2222 ··· 2269 2268 } 2270 2269 2271 2270 pr_debug("block timeout %ld\n", timeo); 2272 - mptcp_rcv_space_adjust(msk, copied); 2271 + mptcp_cleanup_rbuf(msk, copied); 2273 2272 err = sk_wait_data(sk, &timeo, NULL); 2274 2273 if (err < 0) { 2275 2274 err = copied ? : err; ··· 2277 2276 } 2278 2277 } 2279 2278 2280 - mptcp_rcv_space_adjust(msk, copied); 2279 + mptcp_cleanup_rbuf(msk, copied); 2281 2280 2282 2281 out_err: 2283 2282 if (cmsg_flags && copied >= 0) {
+6
net/netrom/nr_route.c
··· 754 754 int ret; 755 755 struct sk_buff *skbn; 756 756 757 + /* 758 + * Reject malformed packets early. Check that it contains at least 2 759 + * addresses and 1 byte more for Time-To-Live 760 + */ 761 + if (skb->len < 2 * sizeof(ax25_address) + 1) 762 + return 0; 757 763 758 764 nr_src = (ax25_address *)(skb->data + 0); 759 765 nr_dest = (ax25_address *)(skb->data + 7);
+7 -21
net/packet/af_packet.c
··· 538 538 return packet_lookup_frame(po, rb, rb->head, status); 539 539 } 540 540 541 - static u16 vlan_get_tci(struct sk_buff *skb, struct net_device *dev) 541 + static u16 vlan_get_tci(const struct sk_buff *skb, struct net_device *dev) 542 542 { 543 - u8 *skb_orig_data = skb->data; 544 - int skb_orig_len = skb->len; 545 543 struct vlan_hdr vhdr, *vh; 546 544 unsigned int header_len; 547 545 ··· 560 562 else 561 563 return 0; 562 564 563 - skb_push(skb, skb->data - skb_mac_header(skb)); 564 - vh = skb_header_pointer(skb, header_len, sizeof(vhdr), &vhdr); 565 - if (skb_orig_data != skb->data) { 566 - skb->data = skb_orig_data; 567 - skb->len = skb_orig_len; 568 - } 565 + vh = skb_header_pointer(skb, skb_mac_offset(skb) + header_len, 566 + sizeof(vhdr), &vhdr); 569 567 if (unlikely(!vh)) 570 568 return 0; 571 569 572 570 return ntohs(vh->h_vlan_TCI); 573 571 } 574 572 575 - static __be16 vlan_get_protocol_dgram(struct sk_buff *skb) 573 + static __be16 vlan_get_protocol_dgram(const struct sk_buff *skb) 576 574 { 577 575 __be16 proto = skb->protocol; 578 576 579 - if (unlikely(eth_type_vlan(proto))) { 580 - u8 *skb_orig_data = skb->data; 581 - int skb_orig_len = skb->len; 582 - 583 - skb_push(skb, skb->data - skb_mac_header(skb)); 584 - proto = __vlan_get_protocol(skb, proto, NULL); 585 - if (skb_orig_data != skb->data) { 586 - skb->data = skb_orig_data; 587 - skb->len = skb_orig_len; 588 - } 589 - } 577 + if (unlikely(eth_type_vlan(proto))) 578 + proto = __vlan_get_protocol_offset(skb, proto, 579 + skb_mac_offset(skb), NULL); 590 580 591 581 return proto; 592 582 }
+2 -1
net/sctp/associola.c
··· 137 137 = 5 * asoc->rto_max; 138 138 139 139 asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = asoc->sackdelay; 140 - asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = sp->autoclose * HZ; 140 + asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = 141 + (unsigned long)sp->autoclose * HZ; 141 142 142 143 /* Initializes the timers */ 143 144 for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i)
+24 -4
tools/testing/selftests/drivers/net/queues.py
··· 1 1 #!/usr/bin/env python3 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 4 - from lib.py import ksft_run, ksft_exit, ksft_eq, KsftSkipEx 5 - from lib.py import EthtoolFamily, NetdevFamily 4 + from lib.py import ksft_disruptive, ksft_exit, ksft_run 5 + from lib.py import ksft_eq, ksft_raises, KsftSkipEx 6 + from lib.py import EthtoolFamily, NetdevFamily, NlError 6 7 from lib.py import NetDrvEnv 7 - from lib.py import cmd 8 + from lib.py import cmd, defer, ip 9 + import errno 8 10 import glob 9 11 10 12 ··· 61 59 ksft_eq(queues, expected) 62 60 63 61 62 + @ksft_disruptive 63 + def check_down(cfg, nl) -> None: 64 + # Check the NAPI IDs before interface goes down and hides them 65 + napis = nl.napi_get({'ifindex': cfg.ifindex}, dump=True) 66 + 67 + ip(f"link set dev {cfg.dev['ifname']} down") 68 + defer(ip, f"link set dev {cfg.dev['ifname']} up") 69 + 70 + with ksft_raises(NlError) as cm: 71 + nl.queue_get({'ifindex': cfg.ifindex, 'id': 0, 'type': 'rx'}) 72 + ksft_eq(cm.exception.nl_msg.error, -errno.ENOENT) 73 + 74 + if napis: 75 + with ksft_raises(NlError) as cm: 76 + nl.napi_get({'id': napis[0]['id']}) 77 + ksft_eq(cm.exception.nl_msg.error, -errno.ENOENT) 78 + 79 + 64 80 def main() -> None: 65 81 with NetDrvEnv(__file__, queue_count=100) as cfg: 66 - ksft_run([get_queues, addremove_queues], args=(cfg, NetdevFamily())) 82 + ksft_run([get_queues, addremove_queues, check_down], args=(cfg, NetdevFamily())) 67 83 ksft_exit() 68 84 69 85
-1
tools/testing/selftests/net/forwarding/local_termination.sh
··· 7 7 NUM_NETIFS=2 8 8 PING_COUNT=1 9 9 REQUIRE_MTOOLS=yes 10 - REQUIRE_MZ=no 11 10 12 11 source lib.sh 13 12