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

Pull networking fixes from Paolo Abeni:
"Including fixes from Bluetooth.

Current release - regressions:

- ipv4: fix regression in local-broadcast routes

- vsock: fix error-handling regression introduced in v6.17-rc1

Previous releases - regressions:

- bluetooth:
- mark connection as closed during suspend disconnect
- fix set_local_name race condition

- eth:
- ice: fix NULL pointer dereference on reset
- mlx5: fix memory leak in hws_pool_buddy_init error path
- bnxt_en: fix stats context reservation logic
- hv: fix loss of receive events from host during channel open

Previous releases - always broken:

- page_pool: fix incorrect mp_ops error handling

- sctp: initialize more fields in sctp_v6_from_sk()

- eth:
- octeontx2-vf: fix max packet length errors
- idpf: fix Tx flow scheduling to avoid Tx timeouts
- bnxt_en: fix memory corruption during ifdown
- ice: fix incorrect counter for buffer allocation failures
- mlx5: fix lockdep assertion on sync reset unload event
- fbnic: fixup rtnl_lock and devl_lock handling
- xgmac: do not enable RX FIFO overflow interrupts

- phy: mscc: fix when PTP clock is register and unregister

Misc:

- add Telit Cinterion LE910C4-WWX new compositions"

* tag 'net-6.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (60 commits)
net: ipv4: fix regression in local-broadcast routes
net: macb: Disable clocks once
fbnic: Move phylink resume out of service_task and into open/close
fbnic: Fixup rtnl_lock and devl_lock handling related to mailbox code
net: rose: fix a typo in rose_clear_routes()
l2tp: do not use sock_hold() in pppol2tp_session_get_sock()
sctp: initialize more fields in sctp_v6_from_sk()
MAINTAINERS: rmnet: Update email addresses
net: rose: include node references in rose_neigh refcount
net: rose: convert 'use' field to refcount_t
net: rose: split remove and free operations in rose_remove_neigh()
net: hv_netvsc: fix loss of early receive events from host during channel open.
net: stmmac: Set CIC bit only for TX queues with COE
net: stmmac: xgmac: Correct supported speed modes
net: stmmac: xgmac: Do not enable RX FIFO Overflow interrupts
net/mlx5e: Set local Xoff after FW update
net/mlx5e: Update and set Xon/Xoff upon port speed set
net/mlx5e: Update and set Xon/Xoff upon MTU set
net/mlx5: Prevent flow steering mode changes in switchdev mode
net/mlx5: Nack sync reset when SFs are present
...

+1000 -807
+7
CREDITS
··· 3222 3222 D: Starter of Linux1394 effort 3223 3223 S: ask per mail for current address 3224 3224 3225 + N: Boris Pismenny 3226 + E: borisp@mellanox.com 3227 + D: Kernel TLS implementation and offload support. 3228 + 3225 3229 N: Nicolas Pitre 3226 3230 E: nico@fluxnic.net 3227 3231 D: StrongARM SA1100 support integrator & hacker ··· 4171 4167 S: 1513 Brewster Dr. 4172 4168 S: Carrollton, TX 75010 4173 4169 S: USA 4170 + 4171 + N: Dave Watson 4172 + D: Kernel TLS implementation. 4174 4173 4175 4174 N: Tim Waugh 4176 4175 E: tim@cyberelk.net
+3 -4
MAINTAINERS
··· 937 937 F: drivers/gpio/gpio-altera.c 938 938 939 939 ALTERA TRIPLE SPEED ETHERNET DRIVER 940 - M: Joyce Ooi <joyce.ooi@intel.com> 940 + M: Boon Khai Ng <boon.khai.ng@altera.com> 941 941 L: netdev@vger.kernel.org 942 942 S: Maintained 943 943 F: drivers/net/ethernet/altera/ ··· 17848 17848 F: net/ipv6/tcp*.c 17849 17849 17850 17850 NETWORKING [TLS] 17851 - M: Boris Pismenny <borisp@nvidia.com> 17852 17851 M: John Fastabend <john.fastabend@gmail.com> 17853 17852 M: Jakub Kicinski <kuba@kernel.org> 17854 17853 L: netdev@vger.kernel.org ··· 20877 20878 F: drivers/firmware/qcom/qcom_qseecom_uefisecapp.c 20878 20879 20879 20880 QUALCOMM RMNET DRIVER 20880 - M: Subash Abhinov Kasiviswanathan <quic_subashab@quicinc.com> 20881 - M: Sean Tranchetti <quic_stranche@quicinc.com> 20881 + M: Subash Abhinov Kasiviswanathan <subash.a.kasiviswanathan@oss.qualcomm.com> 20882 + M: Sean Tranchetti <sean.tranchetti@oss.qualcomm.com> 20882 20883 L: netdev@vger.kernel.org 20883 20884 S: Maintained 20884 20885 F: Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst
+14 -3
drivers/atm/atmtcp.c
··· 279 279 return NULL; 280 280 } 281 281 282 + static int atmtcp_c_pre_send(struct atm_vcc *vcc, struct sk_buff *skb) 283 + { 284 + struct atmtcp_hdr *hdr; 285 + 286 + if (skb->len < sizeof(struct atmtcp_hdr)) 287 + return -EINVAL; 288 + 289 + hdr = (struct atmtcp_hdr *)skb->data; 290 + if (hdr->length == ATMTCP_HDR_MAGIC) 291 + return -EINVAL; 292 + 293 + return 0; 294 + } 282 295 283 296 static int atmtcp_c_send(struct atm_vcc *vcc,struct sk_buff *skb) 284 297 { ··· 300 287 struct atm_vcc *out_vcc; 301 288 struct sk_buff *new_skb; 302 289 int result = 0; 303 - 304 - if (skb->len < sizeof(struct atmtcp_hdr)) 305 - goto done; 306 290 307 291 dev = vcc->dev_data; 308 292 hdr = (struct atmtcp_hdr *) skb->data; ··· 357 347 358 348 static const struct atmdev_ops atmtcp_c_dev_ops = { 359 349 .close = atmtcp_c_close, 350 + .pre_send = atmtcp_c_pre_send, 360 351 .send = atmtcp_c_send 361 352 }; 362 353
+5 -7
drivers/isdn/hardware/mISDN/hfcpci.c
··· 39 39 40 40 #include "hfc_pci.h" 41 41 42 + static void hfcpci_softirq(struct timer_list *unused); 42 43 static const char *hfcpci_revision = "2.0"; 43 44 44 45 static int HFC_cnt; 45 46 static uint debug; 46 47 static uint poll, tics; 47 - static struct timer_list hfc_tl; 48 + static DEFINE_TIMER(hfc_tl, hfcpci_softirq); 48 49 static unsigned long hfc_jiffies; 49 50 50 51 MODULE_AUTHOR("Karsten Keil"); ··· 2306 2305 hfc_jiffies = jiffies + 1; 2307 2306 else 2308 2307 hfc_jiffies += tics; 2309 - hfc_tl.expires = hfc_jiffies; 2310 - add_timer(&hfc_tl); 2308 + mod_timer(&hfc_tl, hfc_jiffies); 2311 2309 } 2312 2310 2313 2311 static int __init ··· 2332 2332 if (poll != HFCPCI_BTRANS_THRESHOLD) { 2333 2333 printk(KERN_INFO "%s: Using alternative poll value of %d\n", 2334 2334 __func__, poll); 2335 - timer_setup(&hfc_tl, hfcpci_softirq, 0); 2336 - hfc_tl.expires = jiffies + tics; 2337 - hfc_jiffies = hfc_tl.expires; 2338 - add_timer(&hfc_tl); 2335 + hfc_jiffies = jiffies + tics; 2336 + mod_timer(&hfc_tl, hfc_jiffies); 2339 2337 } else 2340 2338 tics = 0; /* indicate the use of controller's timer */ 2341 2339
+30 -6
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 8016 8016 } 8017 8017 rx_rings = min_t(int, rx_rings, hwr.grp); 8018 8018 hwr.cp = min_t(int, hwr.cp, bp->cp_nr_rings); 8019 - if (hwr.stat > bnxt_get_ulp_stat_ctxs(bp)) 8019 + if (bnxt_ulp_registered(bp->edev) && 8020 + hwr.stat > bnxt_get_ulp_stat_ctxs(bp)) 8020 8021 hwr.stat -= bnxt_get_ulp_stat_ctxs(bp); 8021 8022 hwr.cp = min_t(int, hwr.cp, hwr.stat); 8022 8023 rc = bnxt_trim_rings(bp, &rx_rings, &hwr.tx, hwr.cp, sh); ··· 8025 8024 hwr.rx = rx_rings << 1; 8026 8025 tx_cp = bnxt_num_tx_to_cp(bp, hwr.tx); 8027 8026 hwr.cp = sh ? max_t(int, tx_cp, rx_rings) : tx_cp + rx_rings; 8027 + if (hwr.tx != bp->tx_nr_rings) { 8028 + netdev_warn(bp->dev, 8029 + "Able to reserve only %d out of %d requested TX rings\n", 8030 + hwr.tx, bp->tx_nr_rings); 8031 + } 8028 8032 bp->tx_nr_rings = hwr.tx; 8029 8033 8030 8034 /* If we cannot reserve all the RX rings, reset the RSS map only ··· 12857 12851 return rc; 12858 12852 } 12859 12853 12854 + static int bnxt_tx_nr_rings(struct bnxt *bp) 12855 + { 12856 + return bp->num_tc ? bp->tx_nr_rings_per_tc * bp->num_tc : 12857 + bp->tx_nr_rings_per_tc; 12858 + } 12859 + 12860 + static int bnxt_tx_nr_rings_per_tc(struct bnxt *bp) 12861 + { 12862 + return bp->num_tc ? bp->tx_nr_rings / bp->num_tc : bp->tx_nr_rings; 12863 + } 12864 + 12860 12865 static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) 12861 12866 { 12862 12867 int rc = 0; ··· 12885 12868 if (rc) 12886 12869 return rc; 12887 12870 12871 + /* Make adjustments if reserved TX rings are less than requested */ 12872 + bp->tx_nr_rings -= bp->tx_nr_rings_xdp; 12873 + bp->tx_nr_rings_per_tc = bnxt_tx_nr_rings_per_tc(bp); 12874 + if (bp->tx_nr_rings_xdp) { 12875 + bp->tx_nr_rings_xdp = bp->tx_nr_rings_per_tc; 12876 + bp->tx_nr_rings += bp->tx_nr_rings_xdp; 12877 + } 12888 12878 rc = bnxt_alloc_mem(bp, irq_re_init); 12889 12879 if (rc) { 12890 12880 netdev_err(bp->dev, "bnxt_alloc_mem err: %x\n", rc); ··· 16349 16325 bp->cp_nr_rings = min_t(int, bp->tx_nr_rings_per_tc, bp->rx_nr_rings); 16350 16326 bp->rx_nr_rings = bp->cp_nr_rings; 16351 16327 bp->tx_nr_rings_per_tc = bp->cp_nr_rings; 16352 - bp->tx_nr_rings = bp->tx_nr_rings_per_tc; 16328 + bp->tx_nr_rings = bnxt_tx_nr_rings(bp); 16353 16329 } 16354 16330 16355 16331 static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh) ··· 16381 16357 bnxt_trim_dflt_sh_rings(bp); 16382 16358 else 16383 16359 bp->cp_nr_rings = bp->tx_nr_rings_per_tc + bp->rx_nr_rings; 16384 - bp->tx_nr_rings = bp->tx_nr_rings_per_tc; 16360 + bp->tx_nr_rings = bnxt_tx_nr_rings(bp); 16385 16361 16386 16362 avail_msix = bnxt_get_max_func_irqs(bp) - bp->cp_nr_rings; 16387 16363 if (avail_msix >= BNXT_MIN_ROCE_CP_RINGS) { ··· 16394 16370 rc = __bnxt_reserve_rings(bp); 16395 16371 if (rc && rc != -ENODEV) 16396 16372 netdev_warn(bp->dev, "Unable to reserve tx rings\n"); 16397 - bp->tx_nr_rings_per_tc = bp->tx_nr_rings; 16373 + bp->tx_nr_rings_per_tc = bnxt_tx_nr_rings_per_tc(bp); 16398 16374 if (sh) 16399 16375 bnxt_trim_dflt_sh_rings(bp); 16400 16376 ··· 16403 16379 rc = __bnxt_reserve_rings(bp); 16404 16380 if (rc && rc != -ENODEV) 16405 16381 netdev_warn(bp->dev, "2nd rings reservation failed.\n"); 16406 - bp->tx_nr_rings_per_tc = bp->tx_nr_rings; 16382 + bp->tx_nr_rings_per_tc = bnxt_tx_nr_rings_per_tc(bp); 16407 16383 } 16408 16384 if (BNXT_CHIP_TYPE_NITRO_A0(bp)) { 16409 16385 bp->rx_nr_rings++; ··· 16437 16413 if (rc) 16438 16414 goto init_dflt_ring_err; 16439 16415 16440 - bp->tx_nr_rings_per_tc = bp->tx_nr_rings; 16416 + bp->tx_nr_rings_per_tc = bnxt_tx_nr_rings_per_tc(bp); 16441 16417 16442 16418 bnxt_set_dflt_rfs(bp); 16443 16419
+4 -7
drivers/net/ethernet/cadence/macb_main.c
··· 3090 3090 /* Add GEM_OCTTXH, GEM_OCTRXH */ 3091 3091 val = bp->macb_reg_readl(bp, offset + 4); 3092 3092 bp->ethtool_stats[i] += ((u64)val) << 32; 3093 - *(p++) += ((u64)val) << 32; 3093 + *p += ((u64)val) << 32; 3094 3094 } 3095 3095 } 3096 3096 ··· 5399 5399 5400 5400 if (dev) { 5401 5401 bp = netdev_priv(dev); 5402 + unregister_netdev(dev); 5402 5403 phy_exit(bp->sgmii_phy); 5403 5404 mdiobus_unregister(bp->mii_bus); 5404 5405 mdiobus_free(bp->mii_bus); 5405 5406 5406 - unregister_netdev(dev); 5407 + device_set_wakeup_enable(&bp->pdev->dev, 0); 5407 5408 cancel_work_sync(&bp->hresp_err_bh_work); 5408 5409 pm_runtime_disable(&pdev->dev); 5409 5410 pm_runtime_dont_use_autosuspend(&pdev->dev); 5410 - if (!pm_runtime_suspended(&pdev->dev)) { 5411 - macb_clks_disable(bp->pclk, bp->hclk, bp->tx_clk, 5412 - bp->rx_clk, bp->tsu_clk); 5413 - pm_runtime_set_suspended(&pdev->dev); 5414 - } 5411 + pm_runtime_set_suspended(&pdev->dev); 5415 5412 phylink_destroy(bp->phylink); 5416 5413 free_netdev(dev); 5417 5414 }
+1 -1
drivers/net/ethernet/dlink/dl2k.c
··· 1099 1099 dev->stats.rx_bytes += dr32(OctetRcvOk); 1100 1100 dev->stats.tx_bytes += dr32(OctetXmtOk); 1101 1101 1102 - dev->stats.multicast = dr32(McstFramesRcvdOk); 1102 + dev->stats.multicast += dr32(McstFramesRcvdOk); 1103 1103 dev->stats.collisions += dr32(SingleColFrames) 1104 1104 + dr32(MultiColFrames); 1105 1105
+1
drivers/net/ethernet/intel/ice/ice.h
··· 510 510 ICE_FLAG_LINK_LENIENT_MODE_ENA, 511 511 ICE_FLAG_PLUG_AUX_DEV, 512 512 ICE_FLAG_UNPLUG_AUX_DEV, 513 + ICE_FLAG_AUX_DEV_CREATED, 513 514 ICE_FLAG_MTU_CHANGED, 514 515 ICE_FLAG_GNSS, /* GNSS successfully initialized */ 515 516 ICE_FLAG_DPLL, /* SyncE/PTP dplls initialized */
+38 -11
drivers/net/ethernet/intel/ice/ice_adapter.c
··· 13 13 static DEFINE_XARRAY(ice_adapters); 14 14 static DEFINE_MUTEX(ice_adapters_mutex); 15 15 16 - static unsigned long ice_adapter_index(u64 dsn) 16 + #define ICE_ADAPTER_FIXED_INDEX BIT_ULL(63) 17 + 18 + #define ICE_ADAPTER_INDEX_E825C \ 19 + (ICE_DEV_ID_E825C_BACKPLANE | ICE_ADAPTER_FIXED_INDEX) 20 + 21 + static u64 ice_adapter_index(struct pci_dev *pdev) 17 22 { 23 + switch (pdev->device) { 24 + case ICE_DEV_ID_E825C_BACKPLANE: 25 + case ICE_DEV_ID_E825C_QSFP: 26 + case ICE_DEV_ID_E825C_SFP: 27 + case ICE_DEV_ID_E825C_SGMII: 28 + /* E825C devices have multiple NACs which are connected to the 29 + * same clock source, and which must share the same 30 + * ice_adapter structure. We can't use the serial number since 31 + * each NAC has its own NVM generated with its own unique 32 + * Device Serial Number. Instead, rely on the embedded nature 33 + * of the E825C devices, and use a fixed index. This relies on 34 + * the fact that all E825C physical functions in a given 35 + * system are part of the same overall device. 36 + */ 37 + return ICE_ADAPTER_INDEX_E825C; 38 + default: 39 + return pci_get_dsn(pdev) & ~ICE_ADAPTER_FIXED_INDEX; 40 + } 41 + } 42 + 43 + static unsigned long ice_adapter_xa_index(struct pci_dev *pdev) 44 + { 45 + u64 index = ice_adapter_index(pdev); 46 + 18 47 #if BITS_PER_LONG == 64 19 - return dsn; 48 + return index; 20 49 #else 21 - return (u32)dsn ^ (u32)(dsn >> 32); 50 + return (u32)index ^ (u32)(index >> 32); 22 51 #endif 23 52 } 24 53 25 - static struct ice_adapter *ice_adapter_new(u64 dsn) 54 + static struct ice_adapter *ice_adapter_new(struct pci_dev *pdev) 26 55 { 27 56 struct ice_adapter *adapter; 28 57 ··· 59 30 if (!adapter) 60 31 return NULL; 61 32 62 - adapter->device_serial_number = dsn; 33 + adapter->index = ice_adapter_index(pdev); 63 34 spin_lock_init(&adapter->ptp_gltsyn_time_lock); 64 35 spin_lock_init(&adapter->txq_ctx_lock); 65 36 refcount_set(&adapter->refcount, 1); ··· 93 64 */ 94 65 struct ice_adapter *ice_adapter_get(struct pci_dev *pdev) 95 66 { 96 - u64 dsn = pci_get_dsn(pdev); 97 67 struct ice_adapter *adapter; 98 68 unsigned long index; 99 69 int err; 100 70 101 - index = ice_adapter_index(dsn); 71 + index = ice_adapter_xa_index(pdev); 102 72 scoped_guard(mutex, &ice_adapters_mutex) { 103 73 err = xa_insert(&ice_adapters, index, NULL, GFP_KERNEL); 104 74 if (err == -EBUSY) { 105 75 adapter = xa_load(&ice_adapters, index); 106 76 refcount_inc(&adapter->refcount); 107 - WARN_ON_ONCE(adapter->device_serial_number != dsn); 77 + WARN_ON_ONCE(adapter->index != ice_adapter_index(pdev)); 108 78 return adapter; 109 79 } 110 80 if (err) 111 81 return ERR_PTR(err); 112 82 113 - adapter = ice_adapter_new(dsn); 83 + adapter = ice_adapter_new(pdev); 114 84 if (!adapter) 115 85 return ERR_PTR(-ENOMEM); 116 86 xa_store(&ice_adapters, index, adapter, GFP_KERNEL); ··· 128 100 */ 129 101 void ice_adapter_put(struct pci_dev *pdev) 130 102 { 131 - u64 dsn = pci_get_dsn(pdev); 132 103 struct ice_adapter *adapter; 133 104 unsigned long index; 134 105 135 - index = ice_adapter_index(dsn); 106 + index = ice_adapter_xa_index(pdev); 136 107 scoped_guard(mutex, &ice_adapters_mutex) { 137 108 adapter = xa_load(&ice_adapters, index); 138 109 if (WARN_ON(!adapter))
+2 -2
drivers/net/ethernet/intel/ice/ice_adapter.h
··· 33 33 * @txq_ctx_lock: Spinlock protecting access to the GLCOMM_QTX_CNTX_CTL register 34 34 * @ctrl_pf: Control PF of the adapter 35 35 * @ports: Ports list 36 - * @device_serial_number: DSN cached for collision detection on 32bit systems 36 + * @index: 64-bit index cached for collision detection on 32bit systems 37 37 */ 38 38 struct ice_adapter { 39 39 refcount_t refcount; ··· 44 44 45 45 struct ice_pf *ctrl_pf; 46 46 struct ice_port_list ports; 47 - u64 device_serial_number; 47 + u64 index; 48 48 }; 49 49 50 50 struct ice_adapter *ice_adapter_get(struct pci_dev *pdev);
+32 -12
drivers/net/ethernet/intel/ice/ice_ddp.c
··· 2377 2377 * The function will apply the new Tx topology from the package buffer 2378 2378 * if available. 2379 2379 * 2380 - * Return: zero when update was successful, negative values otherwise. 2380 + * Return: 2381 + * * 0 - Successfully applied topology configuration. 2382 + * * -EBUSY - Failed to acquire global configuration lock. 2383 + * * -EEXIST - Topology configuration has already been applied. 2384 + * * -EIO - Unable to apply topology configuration. 2385 + * * -ENODEV - Failed to re-initialize device after applying configuration. 2386 + * * Other negative error codes indicate unexpected failures. 2381 2387 */ 2382 2388 int ice_cfg_tx_topo(struct ice_hw *hw, const void *buf, u32 len) 2383 2389 { ··· 2416 2410 2417 2411 if (status) { 2418 2412 ice_debug(hw, ICE_DBG_INIT, "Get current topology is failed\n"); 2419 - return status; 2413 + return -EIO; 2420 2414 } 2421 2415 2422 2416 /* Is default topology already applied ? */ ··· 2503 2497 ICE_GLOBAL_CFG_LOCK_TIMEOUT); 2504 2498 if (status) { 2505 2499 ice_debug(hw, ICE_DBG_INIT, "Failed to acquire global lock\n"); 2506 - return status; 2500 + return -EBUSY; 2507 2501 } 2508 2502 2509 2503 /* Check if reset was triggered already. */ 2510 2504 reg = rd32(hw, GLGEN_RSTAT); 2511 2505 if (reg & GLGEN_RSTAT_DEVSTATE_M) { 2512 - /* Reset is in progress, re-init the HW again */ 2513 2506 ice_debug(hw, ICE_DBG_INIT, "Reset is in progress. Layer topology might be applied already\n"); 2514 2507 ice_check_reset(hw); 2515 - return 0; 2508 + /* Reset is in progress, re-init the HW again */ 2509 + goto reinit_hw; 2516 2510 } 2517 2511 2518 2512 /* Set new topology */ 2519 2513 status = ice_get_set_tx_topo(hw, new_topo, size, NULL, NULL, true); 2520 2514 if (status) { 2521 - ice_debug(hw, ICE_DBG_INIT, "Failed setting Tx topology\n"); 2522 - return status; 2515 + ice_debug(hw, ICE_DBG_INIT, "Failed to set Tx topology, status %pe\n", 2516 + ERR_PTR(status)); 2517 + /* only report -EIO here as the caller checks the error value 2518 + * and reports an informational error message informing that 2519 + * the driver failed to program Tx topology. 2520 + */ 2521 + status = -EIO; 2523 2522 } 2524 2523 2525 - /* New topology is updated, delay 1 second before issuing the CORER */ 2524 + /* Even if Tx topology config failed, we need to CORE reset here to 2525 + * clear the global configuration lock. Delay 1 second to allow 2526 + * hardware to settle then issue a CORER 2527 + */ 2526 2528 msleep(1000); 2527 2529 ice_reset(hw, ICE_RESET_CORER); 2528 - /* CORER will clear the global lock, so no explicit call 2529 - * required for release. 2530 - */ 2530 + ice_check_reset(hw); 2531 2531 2532 - return 0; 2532 + reinit_hw: 2533 + /* Since we triggered a CORER, re-initialize hardware */ 2534 + ice_deinit_hw(hw); 2535 + if (ice_init_hw(hw)) { 2536 + ice_debug(hw, ICE_DBG_INIT, "Failed to re-init hardware after setting Tx topology\n"); 2537 + return -ENODEV; 2538 + } 2539 + 2540 + return status; 2533 2541 }
+6 -4
drivers/net/ethernet/intel/ice/ice_idc.c
··· 336 336 mutex_lock(&pf->adev_mutex); 337 337 cdev->adev = adev; 338 338 mutex_unlock(&pf->adev_mutex); 339 + set_bit(ICE_FLAG_AUX_DEV_CREATED, pf->flags); 339 340 340 341 return 0; 341 342 } ··· 348 347 { 349 348 struct auxiliary_device *adev; 350 349 350 + if (!test_and_clear_bit(ICE_FLAG_AUX_DEV_CREATED, pf->flags)) 351 + return; 352 + 351 353 mutex_lock(&pf->adev_mutex); 352 354 adev = pf->cdev_info->adev; 353 355 pf->cdev_info->adev = NULL; 354 356 mutex_unlock(&pf->adev_mutex); 355 357 356 - if (adev) { 357 - auxiliary_device_delete(adev); 358 - auxiliary_device_uninit(adev); 359 - } 358 + auxiliary_device_delete(adev); 359 + auxiliary_device_uninit(adev); 360 360 } 361 361 362 362 /**
+11 -5
drivers/net/ethernet/intel/ice/ice_main.c
··· 4536 4536 dev_info(dev, "Tx scheduling layers switching feature disabled\n"); 4537 4537 else 4538 4538 dev_info(dev, "Tx scheduling layers switching feature enabled\n"); 4539 - /* if there was a change in topology ice_cfg_tx_topo triggered 4540 - * a CORER and we need to re-init hw 4539 + return 0; 4540 + } else if (err == -ENODEV) { 4541 + /* If we failed to re-initialize the device, we can no longer 4542 + * continue loading. 4541 4543 */ 4542 - ice_deinit_hw(hw); 4543 - err = ice_init_hw(hw); 4544 - 4544 + dev_warn(dev, "Failed to initialize hardware after applying Tx scheduling configuration.\n"); 4545 4545 return err; 4546 4546 } else if (err == -EIO) { 4547 4547 dev_info(dev, "DDP package does not support Tx scheduling layers switching feature - please update to the latest DDP package and try again\n"); 4548 + return 0; 4549 + } else if (err == -EEXIST) { 4550 + return 0; 4548 4551 } 4549 4552 4553 + /* Do not treat this as a fatal error. */ 4554 + dev_info(dev, "Failed to apply Tx scheduling configuration, err %pe\n", 4555 + ERR_PTR(err)); 4550 4556 return 0; 4551 4557 } 4552 4558
+1 -1
drivers/net/ethernet/intel/ice/ice_txrx.c
··· 1352 1352 skb = ice_construct_skb(rx_ring, xdp); 1353 1353 /* exit if we failed to retrieve a buffer */ 1354 1354 if (!skb) { 1355 - rx_ring->ring_stats->rx_stats.alloc_page_failed++; 1355 + rx_ring->ring_stats->rx_stats.alloc_buf_failed++; 1356 1356 xdp_verdict = ICE_XDP_CONSUMED; 1357 1357 } 1358 1358 ice_put_rx_mbuf(rx_ring, xdp, &xdp_xmit, ntc, xdp_verdict);
+57 -4
drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c
··· 180 180 } 181 181 182 182 /** 183 + * idpf_tx_singleq_dma_map_error - handle TX DMA map errors 184 + * @txq: queue to send buffer on 185 + * @skb: send buffer 186 + * @first: original first buffer info buffer for packet 187 + * @idx: starting point on ring to unwind 188 + */ 189 + static void idpf_tx_singleq_dma_map_error(struct idpf_tx_queue *txq, 190 + struct sk_buff *skb, 191 + struct idpf_tx_buf *first, u16 idx) 192 + { 193 + struct libeth_sq_napi_stats ss = { }; 194 + struct libeth_cq_pp cp = { 195 + .dev = txq->dev, 196 + .ss = &ss, 197 + }; 198 + 199 + u64_stats_update_begin(&txq->stats_sync); 200 + u64_stats_inc(&txq->q_stats.dma_map_errs); 201 + u64_stats_update_end(&txq->stats_sync); 202 + 203 + /* clear dma mappings for failed tx_buf map */ 204 + for (;;) { 205 + struct idpf_tx_buf *tx_buf; 206 + 207 + tx_buf = &txq->tx_buf[idx]; 208 + libeth_tx_complete(tx_buf, &cp); 209 + if (tx_buf == first) 210 + break; 211 + if (idx == 0) 212 + idx = txq->desc_count; 213 + idx--; 214 + } 215 + 216 + if (skb_is_gso(skb)) { 217 + union idpf_tx_flex_desc *tx_desc; 218 + 219 + /* If we failed a DMA mapping for a TSO packet, we will have 220 + * used one additional descriptor for a context 221 + * descriptor. Reset that here. 222 + */ 223 + tx_desc = &txq->flex_tx[idx]; 224 + memset(tx_desc, 0, sizeof(*tx_desc)); 225 + if (idx == 0) 226 + idx = txq->desc_count; 227 + idx--; 228 + } 229 + 230 + /* Update tail in case netdev_xmit_more was previously true */ 231 + idpf_tx_buf_hw_update(txq, idx, false); 232 + } 233 + 234 + /** 183 235 * idpf_tx_singleq_map - Build the Tx base descriptor 184 236 * @tx_q: queue to send buffer on 185 237 * @first: first buffer info buffer to use ··· 271 219 for (frag = &skb_shinfo(skb)->frags[0];; frag++) { 272 220 unsigned int max_data = IDPF_TX_MAX_DESC_DATA_ALIGNED; 273 221 274 - if (dma_mapping_error(tx_q->dev, dma)) 275 - return idpf_tx_dma_map_error(tx_q, skb, first, i); 222 + if (unlikely(dma_mapping_error(tx_q->dev, dma))) 223 + return idpf_tx_singleq_dma_map_error(tx_q, skb, 224 + first, i); 276 225 277 226 /* record length, and DMA address */ 278 227 dma_unmap_len_set(tx_buf, len, size); ··· 415 362 { 416 363 struct idpf_tx_offload_params offload = { }; 417 364 struct idpf_tx_buf *first; 365 + u32 count, buf_count = 1; 418 366 int csum, tso, needed; 419 - unsigned int count; 420 367 __be16 protocol; 421 368 422 - count = idpf_tx_desc_count_required(tx_q, skb); 369 + count = idpf_tx_res_count_required(tx_q, skb, &buf_count); 423 370 if (unlikely(!count)) 424 371 return idpf_tx_drop_skb(tx_q, skb); 425 372
+281 -472
drivers/net/ethernet/intel/idpf/idpf_txrx.c
··· 8 8 #include "idpf_ptp.h" 9 9 #include "idpf_virtchnl.h" 10 10 11 - struct idpf_tx_stash { 12 - struct hlist_node hlist; 13 - struct libeth_sqe buf; 14 - }; 15 - 16 - #define idpf_tx_buf_compl_tag(buf) (*(u32 *)&(buf)->priv) 11 + #define idpf_tx_buf_next(buf) (*(u32 *)&(buf)->priv) 17 12 LIBETH_SQE_CHECK_PRIV(u32); 18 13 19 14 static bool idpf_chk_linearize(struct sk_buff *skb, unsigned int max_bufs, 20 15 unsigned int count); 21 - 22 - /** 23 - * idpf_buf_lifo_push - push a buffer pointer onto stack 24 - * @stack: pointer to stack struct 25 - * @buf: pointer to buf to push 26 - * 27 - * Returns 0 on success, negative on failure 28 - **/ 29 - static int idpf_buf_lifo_push(struct idpf_buf_lifo *stack, 30 - struct idpf_tx_stash *buf) 31 - { 32 - if (unlikely(stack->top == stack->size)) 33 - return -ENOSPC; 34 - 35 - stack->bufs[stack->top++] = buf; 36 - 37 - return 0; 38 - } 39 - 40 - /** 41 - * idpf_buf_lifo_pop - pop a buffer pointer from stack 42 - * @stack: pointer to stack struct 43 - **/ 44 - static struct idpf_tx_stash *idpf_buf_lifo_pop(struct idpf_buf_lifo *stack) 45 - { 46 - if (unlikely(!stack->top)) 47 - return NULL; 48 - 49 - return stack->bufs[--stack->top]; 50 - } 51 16 52 17 /** 53 18 * idpf_tx_timeout - Respond to a Tx Hang ··· 42 77 static void idpf_tx_buf_rel_all(struct idpf_tx_queue *txq) 43 78 { 44 79 struct libeth_sq_napi_stats ss = { }; 45 - struct idpf_buf_lifo *buf_stack; 46 - struct idpf_tx_stash *stash; 47 80 struct libeth_cq_pp cp = { 48 81 .dev = txq->dev, 49 82 .ss = &ss, 50 83 }; 51 - struct hlist_node *tmp; 52 - u32 i, tag; 84 + u32 i; 53 85 54 86 /* Buffers already cleared, nothing to do */ 55 87 if (!txq->tx_buf) 56 88 return; 57 89 58 90 /* Free all the Tx buffer sk_buffs */ 59 - for (i = 0; i < txq->desc_count; i++) 91 + for (i = 0; i < txq->buf_pool_size; i++) 60 92 libeth_tx_complete(&txq->tx_buf[i], &cp); 61 93 62 94 kfree(txq->tx_buf); 63 95 txq->tx_buf = NULL; 64 - 65 - if (!idpf_queue_has(FLOW_SCH_EN, txq)) 66 - return; 67 - 68 - buf_stack = &txq->stash->buf_stack; 69 - if (!buf_stack->bufs) 70 - return; 71 - 72 - /* 73 - * If a Tx timeout occurred, there are potentially still bufs in the 74 - * hash table, free them here. 75 - */ 76 - hash_for_each_safe(txq->stash->sched_buf_hash, tag, tmp, stash, 77 - hlist) { 78 - if (!stash) 79 - continue; 80 - 81 - libeth_tx_complete(&stash->buf, &cp); 82 - hash_del(&stash->hlist); 83 - idpf_buf_lifo_push(buf_stack, stash); 84 - } 85 - 86 - for (i = 0; i < buf_stack->size; i++) 87 - kfree(buf_stack->bufs[i]); 88 - 89 - kfree(buf_stack->bufs); 90 - buf_stack->bufs = NULL; 91 96 } 92 97 93 98 /** ··· 73 138 74 139 if (!txq->desc_ring) 75 140 return; 141 + 142 + if (txq->refillq) 143 + kfree(txq->refillq->ring); 76 144 77 145 dmam_free_coherent(txq->dev, txq->size, txq->desc_ring, txq->dma); 78 146 txq->desc_ring = NULL; ··· 133 195 */ 134 196 static int idpf_tx_buf_alloc_all(struct idpf_tx_queue *tx_q) 135 197 { 136 - struct idpf_buf_lifo *buf_stack; 137 - int buf_size; 138 - int i; 139 - 140 198 /* Allocate book keeping buffers only. Buffers to be supplied to HW 141 199 * are allocated by kernel network stack and received as part of skb 142 200 */ 143 - buf_size = sizeof(struct idpf_tx_buf) * tx_q->desc_count; 144 - tx_q->tx_buf = kzalloc(buf_size, GFP_KERNEL); 201 + if (idpf_queue_has(FLOW_SCH_EN, tx_q)) 202 + tx_q->buf_pool_size = U16_MAX; 203 + else 204 + tx_q->buf_pool_size = tx_q->desc_count; 205 + tx_q->tx_buf = kcalloc(tx_q->buf_pool_size, sizeof(*tx_q->tx_buf), 206 + GFP_KERNEL); 145 207 if (!tx_q->tx_buf) 146 208 return -ENOMEM; 147 - 148 - if (!idpf_queue_has(FLOW_SCH_EN, tx_q)) 149 - return 0; 150 - 151 - buf_stack = &tx_q->stash->buf_stack; 152 - 153 - /* Initialize tx buf stack for out-of-order completions if 154 - * flow scheduling offload is enabled 155 - */ 156 - buf_stack->bufs = kcalloc(tx_q->desc_count, sizeof(*buf_stack->bufs), 157 - GFP_KERNEL); 158 - if (!buf_stack->bufs) 159 - return -ENOMEM; 160 - 161 - buf_stack->size = tx_q->desc_count; 162 - buf_stack->top = tx_q->desc_count; 163 - 164 - for (i = 0; i < tx_q->desc_count; i++) { 165 - buf_stack->bufs[i] = kzalloc(sizeof(*buf_stack->bufs[i]), 166 - GFP_KERNEL); 167 - if (!buf_stack->bufs[i]) 168 - return -ENOMEM; 169 - } 170 209 171 210 return 0; 172 211 } ··· 159 244 struct idpf_tx_queue *tx_q) 160 245 { 161 246 struct device *dev = tx_q->dev; 247 + struct idpf_sw_queue *refillq; 162 248 int err; 163 249 164 250 err = idpf_tx_buf_alloc_all(tx_q); ··· 182 266 tx_q->next_to_use = 0; 183 267 tx_q->next_to_clean = 0; 184 268 idpf_queue_set(GEN_CHK, tx_q); 269 + 270 + if (!idpf_queue_has(FLOW_SCH_EN, tx_q)) 271 + return 0; 272 + 273 + refillq = tx_q->refillq; 274 + refillq->desc_count = tx_q->buf_pool_size; 275 + refillq->ring = kcalloc(refillq->desc_count, sizeof(u32), 276 + GFP_KERNEL); 277 + if (!refillq->ring) { 278 + err = -ENOMEM; 279 + goto err_alloc; 280 + } 281 + 282 + for (unsigned int i = 0; i < refillq->desc_count; i++) 283 + refillq->ring[i] = 284 + FIELD_PREP(IDPF_RFL_BI_BUFID_M, i) | 285 + FIELD_PREP(IDPF_RFL_BI_GEN_M, 286 + idpf_queue_has(GEN_CHK, refillq)); 287 + 288 + /* Go ahead and flip the GEN bit since this counts as filling 289 + * up the ring, i.e. we already ring wrapped. 290 + */ 291 + idpf_queue_change(GEN_CHK, refillq); 292 + 293 + tx_q->last_re = tx_q->desc_count - IDPF_TX_SPLITQ_RE_MIN_GAP; 185 294 186 295 return 0; 187 296 ··· 258 317 for (i = 0; i < vport->num_txq_grp; i++) { 259 318 for (j = 0; j < vport->txq_grps[i].num_txq; j++) { 260 319 struct idpf_tx_queue *txq = vport->txq_grps[i].txqs[j]; 261 - u8 gen_bits = 0; 262 - u16 bufidx_mask; 263 320 264 321 err = idpf_tx_desc_alloc(vport, txq); 265 322 if (err) { ··· 266 327 i); 267 328 goto err_out; 268 329 } 269 - 270 - if (!idpf_is_queue_model_split(vport->txq_model)) 271 - continue; 272 - 273 - txq->compl_tag_cur_gen = 0; 274 - 275 - /* Determine the number of bits in the bufid 276 - * mask and add one to get the start of the 277 - * generation bits 278 - */ 279 - bufidx_mask = txq->desc_count - 1; 280 - while (bufidx_mask >> 1) { 281 - txq->compl_tag_gen_s++; 282 - bufidx_mask = bufidx_mask >> 1; 283 - } 284 - txq->compl_tag_gen_s++; 285 - 286 - gen_bits = IDPF_TX_SPLITQ_COMPL_TAG_WIDTH - 287 - txq->compl_tag_gen_s; 288 - txq->compl_tag_gen_max = GETMAXVAL(gen_bits); 289 - 290 - /* Set bufid mask based on location of first 291 - * gen bit; it cannot simply be the descriptor 292 - * ring size-1 since we can have size values 293 - * where not all of those bits are set. 294 - */ 295 - txq->compl_tag_bufid_m = 296 - GETMAXVAL(txq->compl_tag_gen_s); 297 330 } 298 331 299 332 if (!idpf_is_queue_model_split(vport->txq_model)) ··· 514 603 } 515 604 516 605 /** 517 - * idpf_rx_post_buf_refill - Post buffer id to refill queue 606 + * idpf_post_buf_refill - Post buffer id to refill queue 518 607 * @refillq: refill queue to post to 519 608 * @buf_id: buffer id to post 520 609 */ 521 - static void idpf_rx_post_buf_refill(struct idpf_sw_queue *refillq, u16 buf_id) 610 + static void idpf_post_buf_refill(struct idpf_sw_queue *refillq, u16 buf_id) 522 611 { 523 612 u32 nta = refillq->next_to_use; 524 613 525 614 /* store the buffer ID and the SW maintained GEN bit to the refillq */ 526 615 refillq->ring[nta] = 527 - FIELD_PREP(IDPF_RX_BI_BUFID_M, buf_id) | 528 - FIELD_PREP(IDPF_RX_BI_GEN_M, 616 + FIELD_PREP(IDPF_RFL_BI_BUFID_M, buf_id) | 617 + FIELD_PREP(IDPF_RFL_BI_GEN_M, 529 618 idpf_queue_has(GEN_CHK, refillq)); 530 619 531 620 if (unlikely(++nta == refillq->desc_count)) { ··· 906 995 struct idpf_txq_group *txq_grp = &vport->txq_grps[i]; 907 996 908 997 for (j = 0; j < txq_grp->num_txq; j++) { 998 + if (flow_sch_en) { 999 + kfree(txq_grp->txqs[j]->refillq); 1000 + txq_grp->txqs[j]->refillq = NULL; 1001 + } 1002 + 909 1003 kfree(txq_grp->txqs[j]); 910 1004 txq_grp->txqs[j] = NULL; 911 1005 } ··· 920 1004 921 1005 kfree(txq_grp->complq); 922 1006 txq_grp->complq = NULL; 923 - 924 - if (flow_sch_en) 925 - kfree(txq_grp->stashes); 926 1007 } 927 1008 kfree(vport->txq_grps); 928 1009 vport->txq_grps = NULL; ··· 1280 1367 for (i = 0; i < vport->num_txq_grp; i++) { 1281 1368 struct idpf_txq_group *tx_qgrp = &vport->txq_grps[i]; 1282 1369 struct idpf_adapter *adapter = vport->adapter; 1283 - struct idpf_txq_stash *stashes; 1284 1370 int j; 1285 1371 1286 1372 tx_qgrp->vport = vport; ··· 1290 1378 GFP_KERNEL); 1291 1379 if (!tx_qgrp->txqs[j]) 1292 1380 goto err_alloc; 1293 - } 1294 - 1295 - if (split && flow_sch_en) { 1296 - stashes = kcalloc(num_txq, sizeof(*stashes), 1297 - GFP_KERNEL); 1298 - if (!stashes) 1299 - goto err_alloc; 1300 - 1301 - tx_qgrp->stashes = stashes; 1302 1381 } 1303 1382 1304 1383 for (j = 0; j < tx_qgrp->num_txq; j++) { ··· 1311 1408 if (!flow_sch_en) 1312 1409 continue; 1313 1410 1314 - if (split) { 1315 - q->stash = &stashes[j]; 1316 - hash_init(q->stash->sched_buf_hash); 1317 - } 1318 - 1319 1411 idpf_queue_set(FLOW_SCH_EN, q); 1412 + 1413 + q->refillq = kzalloc(sizeof(*q->refillq), GFP_KERNEL); 1414 + if (!q->refillq) 1415 + goto err_alloc; 1416 + 1417 + idpf_queue_set(GEN_CHK, q->refillq); 1418 + idpf_queue_set(RFL_GEN_CHK, q->refillq); 1320 1419 } 1321 1420 1322 1421 if (!split) ··· 1602 1697 spin_unlock_bh(&tx_tstamp_caps->status_lock); 1603 1698 } 1604 1699 1605 - /** 1606 - * idpf_tx_clean_stashed_bufs - clean bufs that were stored for 1607 - * out of order completions 1608 - * @txq: queue to clean 1609 - * @compl_tag: completion tag of packet to clean (from completion descriptor) 1610 - * @cleaned: pointer to stats struct to track cleaned packets/bytes 1611 - * @budget: Used to determine if we are in netpoll 1612 - */ 1613 - static void idpf_tx_clean_stashed_bufs(struct idpf_tx_queue *txq, 1614 - u16 compl_tag, 1615 - struct libeth_sq_napi_stats *cleaned, 1616 - int budget) 1617 - { 1618 - struct idpf_tx_stash *stash; 1619 - struct hlist_node *tmp_buf; 1620 - struct libeth_cq_pp cp = { 1621 - .dev = txq->dev, 1622 - .ss = cleaned, 1623 - .napi = budget, 1624 - }; 1625 - 1626 - /* Buffer completion */ 1627 - hash_for_each_possible_safe(txq->stash->sched_buf_hash, stash, tmp_buf, 1628 - hlist, compl_tag) { 1629 - if (unlikely(idpf_tx_buf_compl_tag(&stash->buf) != compl_tag)) 1630 - continue; 1631 - 1632 - hash_del(&stash->hlist); 1633 - 1634 - if (stash->buf.type == LIBETH_SQE_SKB && 1635 - (skb_shinfo(stash->buf.skb)->tx_flags & SKBTX_IN_PROGRESS)) 1636 - idpf_tx_read_tstamp(txq, stash->buf.skb); 1637 - 1638 - libeth_tx_complete(&stash->buf, &cp); 1639 - 1640 - /* Push shadow buf back onto stack */ 1641 - idpf_buf_lifo_push(&txq->stash->buf_stack, stash); 1642 - } 1643 - } 1644 - 1645 - /** 1646 - * idpf_stash_flow_sch_buffers - store buffer parameters info to be freed at a 1647 - * later time (only relevant for flow scheduling mode) 1648 - * @txq: Tx queue to clean 1649 - * @tx_buf: buffer to store 1650 - */ 1651 - static int idpf_stash_flow_sch_buffers(struct idpf_tx_queue *txq, 1652 - struct idpf_tx_buf *tx_buf) 1653 - { 1654 - struct idpf_tx_stash *stash; 1655 - 1656 - if (unlikely(tx_buf->type <= LIBETH_SQE_CTX)) 1657 - return 0; 1658 - 1659 - stash = idpf_buf_lifo_pop(&txq->stash->buf_stack); 1660 - if (unlikely(!stash)) { 1661 - net_err_ratelimited("%s: No out-of-order TX buffers left!\n", 1662 - netdev_name(txq->netdev)); 1663 - 1664 - return -ENOMEM; 1665 - } 1666 - 1667 - /* Store buffer params in shadow buffer */ 1668 - stash->buf.skb = tx_buf->skb; 1669 - stash->buf.bytes = tx_buf->bytes; 1670 - stash->buf.packets = tx_buf->packets; 1671 - stash->buf.type = tx_buf->type; 1672 - stash->buf.nr_frags = tx_buf->nr_frags; 1673 - dma_unmap_addr_set(&stash->buf, dma, dma_unmap_addr(tx_buf, dma)); 1674 - dma_unmap_len_set(&stash->buf, len, dma_unmap_len(tx_buf, len)); 1675 - idpf_tx_buf_compl_tag(&stash->buf) = idpf_tx_buf_compl_tag(tx_buf); 1676 - 1677 - /* Add buffer to buf_hash table to be freed later */ 1678 - hash_add(txq->stash->sched_buf_hash, &stash->hlist, 1679 - idpf_tx_buf_compl_tag(&stash->buf)); 1680 - 1681 - tx_buf->type = LIBETH_SQE_EMPTY; 1682 - 1683 - return 0; 1684 - } 1685 - 1686 1700 #define idpf_tx_splitq_clean_bump_ntc(txq, ntc, desc, buf) \ 1687 1701 do { \ 1688 1702 if (unlikely(++(ntc) == (txq)->desc_count)) { \ ··· 1629 1805 * Separate packet completion events will be reported on the completion queue, 1630 1806 * and the buffers will be cleaned separately. The stats are not updated from 1631 1807 * this function when using flow-based scheduling. 1632 - * 1633 - * Furthermore, in flow scheduling mode, check to make sure there are enough 1634 - * reserve buffers to stash the packet. If there are not, return early, which 1635 - * will leave next_to_clean pointing to the packet that failed to be stashed. 1636 - * 1637 - * Return: false in the scenario above, true otherwise. 1638 1808 */ 1639 - static bool idpf_tx_splitq_clean(struct idpf_tx_queue *tx_q, u16 end, 1809 + static void idpf_tx_splitq_clean(struct idpf_tx_queue *tx_q, u16 end, 1640 1810 int napi_budget, 1641 1811 struct libeth_sq_napi_stats *cleaned, 1642 1812 bool descs_only) ··· 1644 1826 .napi = napi_budget, 1645 1827 }; 1646 1828 struct idpf_tx_buf *tx_buf; 1647 - bool clean_complete = true; 1829 + 1830 + if (descs_only) { 1831 + /* Bump ring index to mark as cleaned. */ 1832 + tx_q->next_to_clean = end; 1833 + return; 1834 + } 1648 1835 1649 1836 tx_desc = &tx_q->flex_tx[ntc]; 1650 1837 next_pending_desc = &tx_q->flex_tx[end]; ··· 1669 1846 break; 1670 1847 1671 1848 eop_idx = tx_buf->rs_idx; 1849 + libeth_tx_complete(tx_buf, &cp); 1672 1850 1673 - if (descs_only) { 1674 - if (IDPF_TX_BUF_RSV_UNUSED(tx_q) < tx_buf->nr_frags) { 1675 - clean_complete = false; 1676 - goto tx_splitq_clean_out; 1677 - } 1851 + /* unmap remaining buffers */ 1852 + while (ntc != eop_idx) { 1853 + idpf_tx_splitq_clean_bump_ntc(tx_q, ntc, 1854 + tx_desc, tx_buf); 1678 1855 1679 - idpf_stash_flow_sch_buffers(tx_q, tx_buf); 1680 - 1681 - while (ntc != eop_idx) { 1682 - idpf_tx_splitq_clean_bump_ntc(tx_q, ntc, 1683 - tx_desc, tx_buf); 1684 - idpf_stash_flow_sch_buffers(tx_q, tx_buf); 1685 - } 1686 - } else { 1856 + /* unmap any remaining paged data */ 1687 1857 libeth_tx_complete(tx_buf, &cp); 1688 - 1689 - /* unmap remaining buffers */ 1690 - while (ntc != eop_idx) { 1691 - idpf_tx_splitq_clean_bump_ntc(tx_q, ntc, 1692 - tx_desc, tx_buf); 1693 - 1694 - /* unmap any remaining paged data */ 1695 - libeth_tx_complete(tx_buf, &cp); 1696 - } 1697 1858 } 1698 1859 1699 1860 fetch_next_txq_desc: 1700 1861 idpf_tx_splitq_clean_bump_ntc(tx_q, ntc, tx_desc, tx_buf); 1701 1862 } 1702 1863 1703 - tx_splitq_clean_out: 1704 1864 tx_q->next_to_clean = ntc; 1705 - 1706 - return clean_complete; 1707 1865 } 1708 1866 1709 - #define idpf_tx_clean_buf_ring_bump_ntc(txq, ntc, buf) \ 1710 - do { \ 1711 - (buf)++; \ 1712 - (ntc)++; \ 1713 - if (unlikely((ntc) == (txq)->desc_count)) { \ 1714 - buf = (txq)->tx_buf; \ 1715 - ntc = 0; \ 1716 - } \ 1717 - } while (0) 1718 - 1719 1867 /** 1720 - * idpf_tx_clean_buf_ring - clean flow scheduling TX queue buffers 1868 + * idpf_tx_clean_bufs - clean flow scheduling TX queue buffers 1721 1869 * @txq: queue to clean 1722 - * @compl_tag: completion tag of packet to clean (from completion descriptor) 1870 + * @buf_id: packet's starting buffer ID, from completion descriptor 1723 1871 * @cleaned: pointer to stats struct to track cleaned packets/bytes 1724 1872 * @budget: Used to determine if we are in netpoll 1725 1873 * 1726 - * Cleans all buffers associated with the input completion tag either from the 1727 - * TX buffer ring or from the hash table if the buffers were previously 1728 - * stashed. Returns the byte/segment count for the cleaned packet associated 1729 - * this completion tag. 1874 + * Clean all buffers associated with the packet starting at buf_id. Returns the 1875 + * byte/segment count for the cleaned packet. 1730 1876 */ 1731 - static bool idpf_tx_clean_buf_ring(struct idpf_tx_queue *txq, u16 compl_tag, 1732 - struct libeth_sq_napi_stats *cleaned, 1733 - int budget) 1877 + static void idpf_tx_clean_bufs(struct idpf_tx_queue *txq, u32 buf_id, 1878 + struct libeth_sq_napi_stats *cleaned, 1879 + int budget) 1734 1880 { 1735 - u16 idx = compl_tag & txq->compl_tag_bufid_m; 1736 1881 struct idpf_tx_buf *tx_buf = NULL; 1737 1882 struct libeth_cq_pp cp = { 1738 1883 .dev = txq->dev, 1739 1884 .ss = cleaned, 1740 1885 .napi = budget, 1741 1886 }; 1742 - u16 ntc, orig_idx = idx; 1743 1887 1744 - tx_buf = &txq->tx_buf[idx]; 1745 - 1746 - if (unlikely(tx_buf->type <= LIBETH_SQE_CTX || 1747 - idpf_tx_buf_compl_tag(tx_buf) != compl_tag)) 1748 - return false; 1749 - 1888 + tx_buf = &txq->tx_buf[buf_id]; 1750 1889 if (tx_buf->type == LIBETH_SQE_SKB) { 1751 1890 if (skb_shinfo(tx_buf->skb)->tx_flags & SKBTX_IN_PROGRESS) 1752 1891 idpf_tx_read_tstamp(txq, tx_buf->skb); 1753 1892 1754 1893 libeth_tx_complete(tx_buf, &cp); 1894 + idpf_post_buf_refill(txq->refillq, buf_id); 1755 1895 } 1756 1896 1757 - idpf_tx_clean_buf_ring_bump_ntc(txq, idx, tx_buf); 1897 + while (idpf_tx_buf_next(tx_buf) != IDPF_TXBUF_NULL) { 1898 + buf_id = idpf_tx_buf_next(tx_buf); 1758 1899 1759 - while (idpf_tx_buf_compl_tag(tx_buf) == compl_tag) { 1900 + tx_buf = &txq->tx_buf[buf_id]; 1760 1901 libeth_tx_complete(tx_buf, &cp); 1761 - idpf_tx_clean_buf_ring_bump_ntc(txq, idx, tx_buf); 1902 + idpf_post_buf_refill(txq->refillq, buf_id); 1762 1903 } 1763 - 1764 - /* 1765 - * It's possible the packet we just cleaned was an out of order 1766 - * completion, which means we can stash the buffers starting from 1767 - * the original next_to_clean and reuse the descriptors. We need 1768 - * to compare the descriptor ring next_to_clean packet's "first" buffer 1769 - * to the "first" buffer of the packet we just cleaned to determine if 1770 - * this is the case. Howevever, next_to_clean can point to either a 1771 - * reserved buffer that corresponds to a context descriptor used for the 1772 - * next_to_clean packet (TSO packet) or the "first" buffer (single 1773 - * packet). The orig_idx from the packet we just cleaned will always 1774 - * point to the "first" buffer. If next_to_clean points to a reserved 1775 - * buffer, let's bump ntc once and start the comparison from there. 1776 - */ 1777 - ntc = txq->next_to_clean; 1778 - tx_buf = &txq->tx_buf[ntc]; 1779 - 1780 - if (tx_buf->type == LIBETH_SQE_CTX) 1781 - idpf_tx_clean_buf_ring_bump_ntc(txq, ntc, tx_buf); 1782 - 1783 - /* 1784 - * If ntc still points to a different "first" buffer, clean the 1785 - * descriptor ring and stash all of the buffers for later cleaning. If 1786 - * we cannot stash all of the buffers, next_to_clean will point to the 1787 - * "first" buffer of the packet that could not be stashed and cleaning 1788 - * will start there next time. 1789 - */ 1790 - if (unlikely(tx_buf != &txq->tx_buf[orig_idx] && 1791 - !idpf_tx_splitq_clean(txq, orig_idx, budget, cleaned, 1792 - true))) 1793 - return true; 1794 - 1795 - /* 1796 - * Otherwise, update next_to_clean to reflect the cleaning that was 1797 - * done above. 1798 - */ 1799 - txq->next_to_clean = idx; 1800 - 1801 - return true; 1802 1904 } 1803 1905 1804 1906 /** ··· 1742 1994 struct libeth_sq_napi_stats *cleaned, 1743 1995 int budget) 1744 1996 { 1745 - u16 compl_tag; 1997 + /* RS completion contains queue head for queue based scheduling or 1998 + * completion tag for flow based scheduling. 1999 + */ 2000 + u16 rs_compl_val = le16_to_cpu(desc->q_head_compl_tag.q_head); 1746 2001 1747 2002 if (!idpf_queue_has(FLOW_SCH_EN, txq)) { 1748 - u16 head = le16_to_cpu(desc->q_head_compl_tag.q_head); 1749 - 1750 - idpf_tx_splitq_clean(txq, head, budget, cleaned, false); 2003 + idpf_tx_splitq_clean(txq, rs_compl_val, budget, cleaned, false); 1751 2004 return; 1752 2005 } 1753 2006 1754 - compl_tag = le16_to_cpu(desc->q_head_compl_tag.compl_tag); 1755 - 1756 - /* If we didn't clean anything on the ring, this packet must be 1757 - * in the hash table. Go clean it there. 1758 - */ 1759 - if (!idpf_tx_clean_buf_ring(txq, compl_tag, cleaned, budget)) 1760 - idpf_tx_clean_stashed_bufs(txq, compl_tag, cleaned, budget); 2007 + idpf_tx_clean_bufs(txq, rs_compl_val, cleaned, budget); 1761 2008 } 1762 2009 1763 2010 /** ··· 1869 2126 /* Update BQL */ 1870 2127 nq = netdev_get_tx_queue(tx_q->netdev, tx_q->idx); 1871 2128 1872 - dont_wake = !complq_ok || IDPF_TX_BUF_RSV_LOW(tx_q) || 1873 - np->state != __IDPF_VPORT_UP || 2129 + dont_wake = !complq_ok || np->state != __IDPF_VPORT_UP || 1874 2130 !netif_carrier_ok(tx_q->netdev); 1875 2131 /* Check if the TXQ needs to and can be restarted */ 1876 2132 __netif_txq_completed_wake(nq, tx_q->cleaned_pkts, tx_q->cleaned_bytes, ··· 1926 2184 desc->flow.qw1.compl_tag = cpu_to_le16(params->compl_tag); 1927 2185 } 1928 2186 1929 - /* Global conditions to tell whether the txq (and related resources) 1930 - * has room to allow the use of "size" descriptors. 2187 + /** 2188 + * idpf_tx_splitq_has_room - check if enough Tx splitq resources are available 2189 + * @tx_q: the queue to be checked 2190 + * @descs_needed: number of descriptors required for this packet 2191 + * @bufs_needed: number of Tx buffers required for this packet 2192 + * 2193 + * Return: 0 if no room available, 1 otherwise 1931 2194 */ 1932 - static int idpf_txq_has_room(struct idpf_tx_queue *tx_q, u32 size) 2195 + static int idpf_txq_has_room(struct idpf_tx_queue *tx_q, u32 descs_needed, 2196 + u32 bufs_needed) 1933 2197 { 1934 - if (IDPF_DESC_UNUSED(tx_q) < size || 2198 + if (IDPF_DESC_UNUSED(tx_q) < descs_needed || 1935 2199 IDPF_TX_COMPLQ_PENDING(tx_q->txq_grp) > 1936 2200 IDPF_TX_COMPLQ_OVERFLOW_THRESH(tx_q->txq_grp->complq) || 1937 - IDPF_TX_BUF_RSV_LOW(tx_q)) 2201 + idpf_tx_splitq_get_free_bufs(tx_q->refillq) < bufs_needed) 1938 2202 return 0; 1939 2203 return 1; 1940 2204 } ··· 1949 2201 * idpf_tx_maybe_stop_splitq - 1st level check for Tx splitq stop conditions 1950 2202 * @tx_q: the queue to be checked 1951 2203 * @descs_needed: number of descriptors required for this packet 2204 + * @bufs_needed: number of buffers needed for this packet 1952 2205 * 1953 - * Returns 0 if stop is not needed 2206 + * Return: 0 if stop is not needed 1954 2207 */ 1955 2208 static int idpf_tx_maybe_stop_splitq(struct idpf_tx_queue *tx_q, 1956 - unsigned int descs_needed) 2209 + u32 descs_needed, 2210 + u32 bufs_needed) 1957 2211 { 2212 + /* Since we have multiple resources to check for splitq, our 2213 + * start,stop_thrs becomes a boolean check instead of a count 2214 + * threshold. 2215 + */ 1958 2216 if (netif_subqueue_maybe_stop(tx_q->netdev, tx_q->idx, 1959 - idpf_txq_has_room(tx_q, descs_needed), 2217 + idpf_txq_has_room(tx_q, descs_needed, 2218 + bufs_needed), 1960 2219 1, 1)) 1961 2220 return 0; 1962 2221 ··· 2005 2250 } 2006 2251 2007 2252 /** 2008 - * idpf_tx_desc_count_required - calculate number of Tx descriptors needed 2253 + * idpf_tx_res_count_required - get number of Tx resources needed for this pkt 2009 2254 * @txq: queue to send buffer on 2010 2255 * @skb: send buffer 2256 + * @bufs_needed: (output) number of buffers needed for this skb. 2011 2257 * 2012 - * Returns number of data descriptors needed for this skb. 2258 + * Return: number of data descriptors and buffers needed for this skb. 2013 2259 */ 2014 - unsigned int idpf_tx_desc_count_required(struct idpf_tx_queue *txq, 2015 - struct sk_buff *skb) 2260 + unsigned int idpf_tx_res_count_required(struct idpf_tx_queue *txq, 2261 + struct sk_buff *skb, 2262 + u32 *bufs_needed) 2016 2263 { 2017 2264 const struct skb_shared_info *shinfo; 2018 2265 unsigned int count = 0, i; ··· 2025 2268 return count; 2026 2269 2027 2270 shinfo = skb_shinfo(skb); 2271 + *bufs_needed += shinfo->nr_frags; 2028 2272 for (i = 0; i < shinfo->nr_frags; i++) { 2029 2273 unsigned int size; 2030 2274 ··· 2055 2297 } 2056 2298 2057 2299 /** 2058 - * idpf_tx_dma_map_error - handle TX DMA map errors 2059 - * @txq: queue to send buffer on 2060 - * @skb: send buffer 2061 - * @first: original first buffer info buffer for packet 2062 - * @idx: starting point on ring to unwind 2063 - */ 2064 - void idpf_tx_dma_map_error(struct idpf_tx_queue *txq, struct sk_buff *skb, 2065 - struct idpf_tx_buf *first, u16 idx) 2066 - { 2067 - struct libeth_sq_napi_stats ss = { }; 2068 - struct libeth_cq_pp cp = { 2069 - .dev = txq->dev, 2070 - .ss = &ss, 2071 - }; 2072 - 2073 - u64_stats_update_begin(&txq->stats_sync); 2074 - u64_stats_inc(&txq->q_stats.dma_map_errs); 2075 - u64_stats_update_end(&txq->stats_sync); 2076 - 2077 - /* clear dma mappings for failed tx_buf map */ 2078 - for (;;) { 2079 - struct idpf_tx_buf *tx_buf; 2080 - 2081 - tx_buf = &txq->tx_buf[idx]; 2082 - libeth_tx_complete(tx_buf, &cp); 2083 - if (tx_buf == first) 2084 - break; 2085 - if (idx == 0) 2086 - idx = txq->desc_count; 2087 - idx--; 2088 - } 2089 - 2090 - if (skb_is_gso(skb)) { 2091 - union idpf_tx_flex_desc *tx_desc; 2092 - 2093 - /* If we failed a DMA mapping for a TSO packet, we will have 2094 - * used one additional descriptor for a context 2095 - * descriptor. Reset that here. 2096 - */ 2097 - tx_desc = &txq->flex_tx[idx]; 2098 - memset(tx_desc, 0, sizeof(*tx_desc)); 2099 - if (idx == 0) 2100 - idx = txq->desc_count; 2101 - idx--; 2102 - } 2103 - 2104 - /* Update tail in case netdev_xmit_more was previously true */ 2105 - idpf_tx_buf_hw_update(txq, idx, false); 2106 - } 2107 - 2108 - /** 2109 2300 * idpf_tx_splitq_bump_ntu - adjust NTU and generation 2110 2301 * @txq: the tx ring to wrap 2111 2302 * @ntu: ring index to bump ··· 2063 2356 { 2064 2357 ntu++; 2065 2358 2066 - if (ntu == txq->desc_count) { 2359 + if (ntu == txq->desc_count) 2067 2360 ntu = 0; 2068 - txq->compl_tag_cur_gen = IDPF_TX_ADJ_COMPL_TAG_GEN(txq); 2069 - } 2070 2361 2071 2362 return ntu; 2363 + } 2364 + 2365 + /** 2366 + * idpf_tx_get_free_buf_id - get a free buffer ID from the refill queue 2367 + * @refillq: refill queue to get buffer ID from 2368 + * @buf_id: return buffer ID 2369 + * 2370 + * Return: true if a buffer ID was found, false if not 2371 + */ 2372 + static bool idpf_tx_get_free_buf_id(struct idpf_sw_queue *refillq, 2373 + u32 *buf_id) 2374 + { 2375 + u32 ntc = refillq->next_to_clean; 2376 + u32 refill_desc; 2377 + 2378 + refill_desc = refillq->ring[ntc]; 2379 + 2380 + if (unlikely(idpf_queue_has(RFL_GEN_CHK, refillq) != 2381 + !!(refill_desc & IDPF_RFL_BI_GEN_M))) 2382 + return false; 2383 + 2384 + *buf_id = FIELD_GET(IDPF_RFL_BI_BUFID_M, refill_desc); 2385 + 2386 + if (unlikely(++ntc == refillq->desc_count)) { 2387 + idpf_queue_change(RFL_GEN_CHK, refillq); 2388 + ntc = 0; 2389 + } 2390 + 2391 + refillq->next_to_clean = ntc; 2392 + 2393 + return true; 2394 + } 2395 + 2396 + /** 2397 + * idpf_tx_splitq_pkt_err_unmap - Unmap buffers and bump tail in case of error 2398 + * @txq: Tx queue to unwind 2399 + * @params: pointer to splitq params struct 2400 + * @first: starting buffer for packet to unmap 2401 + */ 2402 + static void idpf_tx_splitq_pkt_err_unmap(struct idpf_tx_queue *txq, 2403 + struct idpf_tx_splitq_params *params, 2404 + struct idpf_tx_buf *first) 2405 + { 2406 + struct idpf_sw_queue *refillq = txq->refillq; 2407 + struct libeth_sq_napi_stats ss = { }; 2408 + struct idpf_tx_buf *tx_buf = first; 2409 + struct libeth_cq_pp cp = { 2410 + .dev = txq->dev, 2411 + .ss = &ss, 2412 + }; 2413 + 2414 + u64_stats_update_begin(&txq->stats_sync); 2415 + u64_stats_inc(&txq->q_stats.dma_map_errs); 2416 + u64_stats_update_end(&txq->stats_sync); 2417 + 2418 + libeth_tx_complete(tx_buf, &cp); 2419 + while (idpf_tx_buf_next(tx_buf) != IDPF_TXBUF_NULL) { 2420 + tx_buf = &txq->tx_buf[idpf_tx_buf_next(tx_buf)]; 2421 + libeth_tx_complete(tx_buf, &cp); 2422 + } 2423 + 2424 + /* Update tail in case netdev_xmit_more was previously true. */ 2425 + idpf_tx_buf_hw_update(txq, params->prev_ntu, false); 2426 + 2427 + if (!refillq) 2428 + return; 2429 + 2430 + /* Restore refillq state to avoid leaking tags. */ 2431 + if (params->prev_refill_gen != idpf_queue_has(RFL_GEN_CHK, refillq)) 2432 + idpf_queue_change(RFL_GEN_CHK, refillq); 2433 + refillq->next_to_clean = params->prev_refill_ntc; 2072 2434 } 2073 2435 2074 2436 /** ··· 2161 2385 struct netdev_queue *nq; 2162 2386 struct sk_buff *skb; 2163 2387 skb_frag_t *frag; 2388 + u32 next_buf_id; 2164 2389 u16 td_cmd = 0; 2165 2390 dma_addr_t dma; 2166 2391 ··· 2179 2402 tx_buf = first; 2180 2403 first->nr_frags = 0; 2181 2404 2182 - params->compl_tag = 2183 - (tx_q->compl_tag_cur_gen << tx_q->compl_tag_gen_s) | i; 2184 - 2185 2405 for (frag = &skb_shinfo(skb)->frags[0];; frag++) { 2186 2406 unsigned int max_data = IDPF_TX_MAX_DESC_DATA_ALIGNED; 2187 2407 2188 - if (dma_mapping_error(tx_q->dev, dma)) 2189 - return idpf_tx_dma_map_error(tx_q, skb, first, i); 2408 + if (unlikely(dma_mapping_error(tx_q->dev, dma))) { 2409 + idpf_tx_buf_next(tx_buf) = IDPF_TXBUF_NULL; 2410 + return idpf_tx_splitq_pkt_err_unmap(tx_q, params, 2411 + first); 2412 + } 2190 2413 2191 2414 first->nr_frags++; 2192 - idpf_tx_buf_compl_tag(tx_buf) = params->compl_tag; 2193 2415 tx_buf->type = LIBETH_SQE_FRAG; 2194 2416 2195 2417 /* record length, and DMA address */ ··· 2244 2468 max_data); 2245 2469 2246 2470 if (unlikely(++i == tx_q->desc_count)) { 2247 - tx_buf = tx_q->tx_buf; 2248 2471 tx_desc = &tx_q->flex_tx[0]; 2249 2472 i = 0; 2250 - tx_q->compl_tag_cur_gen = 2251 - IDPF_TX_ADJ_COMPL_TAG_GEN(tx_q); 2252 2473 } else { 2253 - tx_buf++; 2254 2474 tx_desc++; 2255 2475 } 2256 - 2257 - /* Since this packet has a buffer that is going to span 2258 - * multiple descriptors, it's going to leave holes in 2259 - * to the TX buffer ring. To ensure these holes do not 2260 - * cause issues in the cleaning routines, we will clear 2261 - * them of any stale data and assign them the same 2262 - * completion tag as the current packet. Then when the 2263 - * packet is being cleaned, the cleaning routines will 2264 - * simply pass over these holes and finish cleaning the 2265 - * rest of the packet. 2266 - */ 2267 - tx_buf->type = LIBETH_SQE_EMPTY; 2268 - idpf_tx_buf_compl_tag(tx_buf) = params->compl_tag; 2269 2476 2270 2477 /* Adjust the DMA offset and the remaining size of the 2271 2478 * fragment. On the first iteration of this loop, ··· 2274 2515 idpf_tx_splitq_build_desc(tx_desc, params, td_cmd, size); 2275 2516 2276 2517 if (unlikely(++i == tx_q->desc_count)) { 2277 - tx_buf = tx_q->tx_buf; 2278 2518 tx_desc = &tx_q->flex_tx[0]; 2279 2519 i = 0; 2280 - tx_q->compl_tag_cur_gen = IDPF_TX_ADJ_COMPL_TAG_GEN(tx_q); 2281 2520 } else { 2282 - tx_buf++; 2283 2521 tx_desc++; 2284 2522 } 2523 + 2524 + if (idpf_queue_has(FLOW_SCH_EN, tx_q)) { 2525 + if (unlikely(!idpf_tx_get_free_buf_id(tx_q->refillq, 2526 + &next_buf_id))) { 2527 + idpf_tx_buf_next(tx_buf) = IDPF_TXBUF_NULL; 2528 + return idpf_tx_splitq_pkt_err_unmap(tx_q, params, 2529 + first); 2530 + } 2531 + } else { 2532 + next_buf_id = i; 2533 + } 2534 + idpf_tx_buf_next(tx_buf) = next_buf_id; 2535 + tx_buf = &tx_q->tx_buf[next_buf_id]; 2285 2536 2286 2537 size = skb_frag_size(frag); 2287 2538 data_len -= size; ··· 2307 2538 2308 2539 /* write last descriptor with RS and EOP bits */ 2309 2540 first->rs_idx = i; 2541 + idpf_tx_buf_next(tx_buf) = IDPF_TXBUF_NULL; 2310 2542 td_cmd |= params->eop_cmd; 2311 2543 idpf_tx_splitq_build_desc(tx_desc, params, td_cmd, size); 2312 2544 i = idpf_tx_splitq_bump_ntu(tx_q, i); ··· 2516 2746 union idpf_flex_tx_ctx_desc *desc; 2517 2747 int i = txq->next_to_use; 2518 2748 2519 - txq->tx_buf[i].type = LIBETH_SQE_CTX; 2520 - 2521 2749 /* grab the next descriptor */ 2522 2750 desc = &txq->flex_ctx[i]; 2523 2751 txq->next_to_use = idpf_tx_splitq_bump_ntu(txq, i); ··· 2609 2841 #endif /* CONFIG_PTP_1588_CLOCK */ 2610 2842 2611 2843 /** 2844 + * idpf_tx_splitq_need_re - check whether RE bit needs to be set 2845 + * @tx_q: pointer to Tx queue 2846 + * 2847 + * Return: true if RE bit needs to be set, false otherwise 2848 + */ 2849 + static bool idpf_tx_splitq_need_re(struct idpf_tx_queue *tx_q) 2850 + { 2851 + int gap = tx_q->next_to_use - tx_q->last_re; 2852 + 2853 + gap += (gap < 0) ? tx_q->desc_count : 0; 2854 + 2855 + return gap >= IDPF_TX_SPLITQ_RE_MIN_GAP; 2856 + } 2857 + 2858 + /** 2612 2859 * idpf_tx_splitq_frame - Sends buffer on Tx ring using flex descriptors 2613 2860 * @skb: send buffer 2614 2861 * @tx_q: queue to send buffer on ··· 2633 2850 static netdev_tx_t idpf_tx_splitq_frame(struct sk_buff *skb, 2634 2851 struct idpf_tx_queue *tx_q) 2635 2852 { 2636 - struct idpf_tx_splitq_params tx_params = { }; 2853 + struct idpf_tx_splitq_params tx_params = { 2854 + .prev_ntu = tx_q->next_to_use, 2855 + }; 2637 2856 union idpf_flex_tx_ctx_desc *ctx_desc; 2638 2857 struct idpf_tx_buf *first; 2639 - unsigned int count; 2858 + u32 count, buf_count = 1; 2640 2859 int tso, idx; 2860 + u32 buf_id; 2641 2861 2642 - count = idpf_tx_desc_count_required(tx_q, skb); 2862 + count = idpf_tx_res_count_required(tx_q, skb, &buf_count); 2643 2863 if (unlikely(!count)) 2644 2864 return idpf_tx_drop_skb(tx_q, skb); 2645 2865 ··· 2652 2866 2653 2867 /* Check for splitq specific TX resources */ 2654 2868 count += (IDPF_TX_DESCS_PER_CACHE_LINE + tso); 2655 - if (idpf_tx_maybe_stop_splitq(tx_q, count)) { 2869 + if (idpf_tx_maybe_stop_splitq(tx_q, count, buf_count)) { 2656 2870 idpf_tx_buf_hw_update(tx_q, tx_q->next_to_use, false); 2657 2871 2658 2872 return NETDEV_TX_BUSY; ··· 2684 2898 idpf_tx_set_tstamp_desc(ctx_desc, idx); 2685 2899 } 2686 2900 2687 - /* record the location of the first descriptor for this packet */ 2688 - first = &tx_q->tx_buf[tx_q->next_to_use]; 2901 + if (idpf_queue_has(FLOW_SCH_EN, tx_q)) { 2902 + struct idpf_sw_queue *refillq = tx_q->refillq; 2903 + 2904 + /* Save refillq state in case of a packet rollback. Otherwise, 2905 + * the tags will be leaked since they will be popped from the 2906 + * refillq but never reposted during cleaning. 2907 + */ 2908 + tx_params.prev_refill_gen = 2909 + idpf_queue_has(RFL_GEN_CHK, refillq); 2910 + tx_params.prev_refill_ntc = refillq->next_to_clean; 2911 + 2912 + if (unlikely(!idpf_tx_get_free_buf_id(tx_q->refillq, 2913 + &buf_id))) { 2914 + if (tx_params.prev_refill_gen != 2915 + idpf_queue_has(RFL_GEN_CHK, refillq)) 2916 + idpf_queue_change(RFL_GEN_CHK, refillq); 2917 + refillq->next_to_clean = tx_params.prev_refill_ntc; 2918 + 2919 + tx_q->next_to_use = tx_params.prev_ntu; 2920 + return idpf_tx_drop_skb(tx_q, skb); 2921 + } 2922 + tx_params.compl_tag = buf_id; 2923 + 2924 + tx_params.dtype = IDPF_TX_DESC_DTYPE_FLEX_FLOW_SCHE; 2925 + tx_params.eop_cmd = IDPF_TXD_FLEX_FLOW_CMD_EOP; 2926 + /* Set the RE bit to periodically "clean" the descriptor ring. 2927 + * MIN_GAP is set to MIN_RING size to ensure it will be set at 2928 + * least once each time around the ring. 2929 + */ 2930 + if (idpf_tx_splitq_need_re(tx_q)) { 2931 + tx_params.eop_cmd |= IDPF_TXD_FLEX_FLOW_CMD_RE; 2932 + tx_q->txq_grp->num_completions_pending++; 2933 + tx_q->last_re = tx_q->next_to_use; 2934 + } 2935 + 2936 + if (skb->ip_summed == CHECKSUM_PARTIAL) 2937 + tx_params.offload.td_cmd |= IDPF_TXD_FLEX_FLOW_CMD_CS_EN; 2938 + 2939 + } else { 2940 + buf_id = tx_q->next_to_use; 2941 + 2942 + tx_params.dtype = IDPF_TX_DESC_DTYPE_FLEX_L2TAG1_L2TAG2; 2943 + tx_params.eop_cmd = IDPF_TXD_LAST_DESC_CMD; 2944 + 2945 + if (skb->ip_summed == CHECKSUM_PARTIAL) 2946 + tx_params.offload.td_cmd |= IDPF_TX_FLEX_DESC_CMD_CS_EN; 2947 + } 2948 + 2949 + first = &tx_q->tx_buf[buf_id]; 2689 2950 first->skb = skb; 2690 2951 2691 2952 if (tso) { ··· 2742 2909 } else { 2743 2910 first->packets = 1; 2744 2911 first->bytes = max_t(unsigned int, skb->len, ETH_ZLEN); 2745 - } 2746 - 2747 - if (idpf_queue_has(FLOW_SCH_EN, tx_q)) { 2748 - tx_params.dtype = IDPF_TX_DESC_DTYPE_FLEX_FLOW_SCHE; 2749 - tx_params.eop_cmd = IDPF_TXD_FLEX_FLOW_CMD_EOP; 2750 - /* Set the RE bit to catch any packets that may have not been 2751 - * stashed during RS completion cleaning. MIN_GAP is set to 2752 - * MIN_RING size to ensure it will be set at least once each 2753 - * time around the ring. 2754 - */ 2755 - if (!(tx_q->next_to_use % IDPF_TX_SPLITQ_RE_MIN_GAP)) { 2756 - tx_params.eop_cmd |= IDPF_TXD_FLEX_FLOW_CMD_RE; 2757 - tx_q->txq_grp->num_completions_pending++; 2758 - } 2759 - 2760 - if (skb->ip_summed == CHECKSUM_PARTIAL) 2761 - tx_params.offload.td_cmd |= IDPF_TXD_FLEX_FLOW_CMD_CS_EN; 2762 - 2763 - } else { 2764 - tx_params.dtype = IDPF_TX_DESC_DTYPE_FLEX_L2TAG1_L2TAG2; 2765 - tx_params.eop_cmd = IDPF_TXD_LAST_DESC_CMD; 2766 - 2767 - if (skb->ip_summed == CHECKSUM_PARTIAL) 2768 - tx_params.offload.td_cmd |= IDPF_TX_FLEX_DESC_CMD_CS_EN; 2769 2912 } 2770 2913 2771 2914 idpf_tx_splitq_map(tx_q, &tx_params, first); ··· 3281 3472 skip_data: 3282 3473 rx_buf->netmem = 0; 3283 3474 3284 - idpf_rx_post_buf_refill(refillq, buf_id); 3475 + idpf_post_buf_refill(refillq, buf_id); 3285 3476 IDPF_RX_BUMP_NTC(rxq, ntc); 3286 3477 3287 3478 /* skip if it is non EOP desc */ ··· 3389 3580 bool failure; 3390 3581 3391 3582 if (idpf_queue_has(RFL_GEN_CHK, refillq) != 3392 - !!(refill_desc & IDPF_RX_BI_GEN_M)) 3583 + !!(refill_desc & IDPF_RFL_BI_GEN_M)) 3393 3584 break; 3394 3585 3395 - buf_id = FIELD_GET(IDPF_RX_BI_BUFID_M, refill_desc); 3586 + buf_id = FIELD_GET(IDPF_RFL_BI_BUFID_M, refill_desc); 3396 3587 failure = idpf_rx_update_bufq_desc(bufq, buf_id, buf_desc); 3397 3588 if (failure) 3398 3589 break;
+33 -54
drivers/net/ethernet/intel/idpf/idpf_txrx.h
··· 108 108 */ 109 109 #define IDPF_TX_SPLITQ_RE_MIN_GAP 64 110 110 111 - #define IDPF_RX_BI_GEN_M BIT(16) 112 - #define IDPF_RX_BI_BUFID_M GENMASK(15, 0) 111 + #define IDPF_RFL_BI_GEN_M BIT(16) 112 + #define IDPF_RFL_BI_BUFID_M GENMASK(15, 0) 113 113 114 114 #define IDPF_RXD_EOF_SPLITQ VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS0_EOF_M 115 115 #define IDPF_RXD_EOF_SINGLEQ VIRTCHNL2_RX_BASE_DESC_STATUS_EOF_M ··· 117 117 #define IDPF_DESC_UNUSED(txq) \ 118 118 ((((txq)->next_to_clean > (txq)->next_to_use) ? 0 : (txq)->desc_count) + \ 119 119 (txq)->next_to_clean - (txq)->next_to_use - 1) 120 - 121 - #define IDPF_TX_BUF_RSV_UNUSED(txq) ((txq)->stash->buf_stack.top) 122 - #define IDPF_TX_BUF_RSV_LOW(txq) (IDPF_TX_BUF_RSV_UNUSED(txq) < \ 123 - (txq)->desc_count >> 2) 124 120 125 121 #define IDPF_TX_COMPLQ_OVERFLOW_THRESH(txcq) ((txcq)->desc_count >> 1) 126 122 /* Determine the absolute number of completions pending, i.e. the number of ··· 127 131 0 : U32_MAX) + \ 128 132 (txq)->num_completions_pending - (txq)->complq->num_completions) 129 133 130 - #define IDPF_TX_SPLITQ_COMPL_TAG_WIDTH 16 131 - /* Adjust the generation for the completion tag and wrap if necessary */ 132 - #define IDPF_TX_ADJ_COMPL_TAG_GEN(txq) \ 133 - ((++(txq)->compl_tag_cur_gen) >= (txq)->compl_tag_gen_max ? \ 134 - 0 : (txq)->compl_tag_cur_gen) 134 + #define IDPF_TXBUF_NULL U32_MAX 135 135 136 136 #define IDPF_TXD_LAST_DESC_CMD (IDPF_TX_DESC_CMD_EOP | IDPF_TX_DESC_CMD_RS) 137 137 ··· 143 151 }; 144 152 145 153 #define idpf_tx_buf libeth_sqe 146 - 147 - /** 148 - * struct idpf_buf_lifo - LIFO for managing OOO completions 149 - * @top: Used to know how many buffers are left 150 - * @size: Total size of LIFO 151 - * @bufs: Backing array 152 - */ 153 - struct idpf_buf_lifo { 154 - u16 top; 155 - u16 size; 156 - struct idpf_tx_stash **bufs; 157 - }; 158 154 159 155 /** 160 156 * struct idpf_tx_offload_params - Offload parameters for a given packet ··· 176 196 * @compl_tag: Associated tag for completion 177 197 * @td_tag: Descriptor tunneling tag 178 198 * @offload: Offload parameters 199 + * @prev_ntu: stored TxQ next_to_use in case of rollback 200 + * @prev_refill_ntc: stored refillq next_to_clean in case of packet rollback 201 + * @prev_refill_gen: stored refillq generation bit in case of packet rollback 179 202 */ 180 203 struct idpf_tx_splitq_params { 181 204 enum idpf_tx_desc_dtype_value dtype; ··· 189 206 }; 190 207 191 208 struct idpf_tx_offload_params offload; 209 + 210 + u16 prev_ntu; 211 + u16 prev_refill_ntc; 212 + bool prev_refill_gen; 192 213 }; 193 214 194 215 enum idpf_tx_ctx_desc_eipt_offload { ··· 455 468 #define IDPF_DIM_DEFAULT_PROFILE_IX 1 456 469 457 470 /** 458 - * struct idpf_txq_stash - Tx buffer stash for Flow-based scheduling mode 459 - * @buf_stack: Stack of empty buffers to store buffer info for out of order 460 - * buffer completions. See struct idpf_buf_lifo 461 - * @sched_buf_hash: Hash table to store buffers 462 - */ 463 - struct idpf_txq_stash { 464 - struct idpf_buf_lifo buf_stack; 465 - DECLARE_HASHTABLE(sched_buf_hash, 12); 466 - } ____cacheline_aligned; 467 - 468 - /** 469 471 * struct idpf_rx_queue - software structure representing a receive queue 470 472 * @rx: universal receive descriptor array 471 473 * @single_buf: buffer descriptor array in singleq ··· 586 610 * @netdev: &net_device corresponding to this queue 587 611 * @next_to_use: Next descriptor to use 588 612 * @next_to_clean: Next descriptor to clean 613 + * @last_re: last descriptor index that RE bit was set 614 + * @tx_max_bufs: Max buffers that can be transmitted with scatter-gather 589 615 * @cleaned_bytes: Splitq only, TXQ only: When a TX completion is received on 590 616 * the TX completion queue, it can be for any TXQ associated 591 617 * with that completion queue. This means we can clean up to ··· 598 620 * only once at the end of the cleaning routine. 599 621 * @clean_budget: singleq only, queue cleaning budget 600 622 * @cleaned_pkts: Number of packets cleaned for the above said case 601 - * @tx_max_bufs: Max buffers that can be transmitted with scatter-gather 602 - * @stash: Tx buffer stash for Flow-based scheduling mode 603 - * @compl_tag_bufid_m: Completion tag buffer id mask 604 - * @compl_tag_cur_gen: Used to keep track of current completion tag generation 605 - * @compl_tag_gen_max: To determine when compl_tag_cur_gen should be reset 623 + * @refillq: Pointer to refill queue 606 624 * @cached_tstamp_caps: Tx timestamp capabilities negotiated with the CP 607 625 * @tstamp_task: Work that handles Tx timestamp read 608 626 * @stats_sync: See struct u64_stats_sync ··· 607 633 * @size: Length of descriptor ring in bytes 608 634 * @dma: Physical address of ring 609 635 * @q_vector: Backreference to associated vector 636 + * @buf_pool_size: Total number of idpf_tx_buf 610 637 */ 611 638 struct idpf_tx_queue { 612 639 __cacheline_group_begin_aligned(read_mostly); ··· 629 654 u16 desc_count; 630 655 631 656 u16 tx_min_pkt_len; 632 - u16 compl_tag_gen_s; 633 657 634 658 struct net_device *netdev; 635 659 __cacheline_group_end_aligned(read_mostly); ··· 636 662 __cacheline_group_begin_aligned(read_write); 637 663 u16 next_to_use; 638 664 u16 next_to_clean; 665 + u16 last_re; 666 + u16 tx_max_bufs; 639 667 640 668 union { 641 669 u32 cleaned_bytes; ··· 645 669 }; 646 670 u16 cleaned_pkts; 647 671 648 - u16 tx_max_bufs; 649 - struct idpf_txq_stash *stash; 650 - 651 - u16 compl_tag_bufid_m; 652 - u16 compl_tag_cur_gen; 653 - u16 compl_tag_gen_max; 672 + struct idpf_sw_queue *refillq; 654 673 655 674 struct idpf_ptp_vport_tx_tstamp_caps *cached_tstamp_caps; 656 675 struct work_struct *tstamp_task; ··· 660 689 dma_addr_t dma; 661 690 662 691 struct idpf_q_vector *q_vector; 692 + u32 buf_pool_size; 663 693 __cacheline_group_end_aligned(cold); 664 694 }; 665 695 libeth_cacheline_set_assert(struct idpf_tx_queue, 64, 666 - 112 + sizeof(struct u64_stats_sync), 667 - 24); 696 + 104 + sizeof(struct u64_stats_sync), 697 + 32); 668 698 669 699 /** 670 700 * struct idpf_buf_queue - software structure representing a buffer queue ··· 875 903 * @vport: Vport back pointer 876 904 * @num_txq: Number of TX queues associated 877 905 * @txqs: Array of TX queue pointers 878 - * @stashes: array of OOO stashes for the queues 879 906 * @complq: Associated completion queue pointer, split queue only 880 907 * @num_completions_pending: Total number of completions pending for the 881 908 * completion queue, acculumated for all TX queues ··· 889 918 890 919 u16 num_txq; 891 920 struct idpf_tx_queue *txqs[IDPF_LARGE_MAX_Q]; 892 - struct idpf_txq_stash *stashes; 893 921 894 922 struct idpf_compl_queue *complq; 895 923 ··· 981 1011 reg->dyn_ctl); 982 1012 } 983 1013 1014 + /** 1015 + * idpf_tx_splitq_get_free_bufs - get number of free buf_ids in refillq 1016 + * @refillq: pointer to refillq containing buf_ids 1017 + */ 1018 + static inline u32 idpf_tx_splitq_get_free_bufs(struct idpf_sw_queue *refillq) 1019 + { 1020 + return (refillq->next_to_use > refillq->next_to_clean ? 1021 + 0 : refillq->desc_count) + 1022 + refillq->next_to_use - refillq->next_to_clean - 1; 1023 + } 1024 + 984 1025 int idpf_vport_singleq_napi_poll(struct napi_struct *napi, int budget); 985 1026 void idpf_vport_init_num_qs(struct idpf_vport *vport, 986 1027 struct virtchnl2_create_vport *vport_msg); ··· 1019 1038 bool xmit_more); 1020 1039 unsigned int idpf_size_to_txd_count(unsigned int size); 1021 1040 netdev_tx_t idpf_tx_drop_skb(struct idpf_tx_queue *tx_q, struct sk_buff *skb); 1022 - void idpf_tx_dma_map_error(struct idpf_tx_queue *txq, struct sk_buff *skb, 1023 - struct idpf_tx_buf *first, u16 ring_idx); 1024 - unsigned int idpf_tx_desc_count_required(struct idpf_tx_queue *txq, 1025 - struct sk_buff *skb); 1041 + unsigned int idpf_tx_res_count_required(struct idpf_tx_queue *txq, 1042 + struct sk_buff *skb, u32 *buf_count); 1026 1043 void idpf_tx_timeout(struct net_device *netdev, unsigned int txqueue); 1027 1044 netdev_tx_t idpf_tx_singleq_frame(struct sk_buff *skb, 1028 1045 struct idpf_tx_queue *tx_q);
+1 -1
drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
··· 3125 3125 if (err) 3126 3126 return err; 3127 3127 3128 - combo_ver = le32_to_cpu(civd.combo_ver); 3128 + combo_ver = get_unaligned_le32(&civd.combo_ver); 3129 3129 3130 3130 orom->major = (u8)FIELD_GET(IXGBE_OROM_VER_MASK, combo_ver); 3131 3131 orom->patch = (u8)FIELD_GET(IXGBE_OROM_VER_PATCH_MASK, combo_ver);
+1 -1
drivers/net/ethernet/intel/ixgbe/ixgbe_type_e610.h
··· 932 932 __le32 combo_ver; /* Combo Image Version number */ 933 933 u8 combo_name_len; /* Length of the unicode combo image version string, max of 32 */ 934 934 __le16 combo_name[32]; /* Unicode string representing the Combo Image version */ 935 - }; 935 + } __packed; 936 936 937 937 /* Function specific capabilities */ 938 938 struct ixgbe_hw_func_caps {
+7
drivers/net/ethernet/marvell/octeontx2/af/cgx.c
··· 1978 1978 goto err_release_regions; 1979 1979 } 1980 1980 1981 + if (!is_cn20k(pdev) && 1982 + !is_cgx_mapped_to_nix(pdev->subsystem_device, cgx->cgx_id)) { 1983 + dev_notice(dev, "CGX %d not mapped to NIX, skipping probe\n", 1984 + cgx->cgx_id); 1985 + goto err_release_regions; 1986 + } 1987 + 1981 1988 cgx->lmac_count = cgx->mac_ops->get_nr_lmacs(cgx); 1982 1989 if (!cgx->lmac_count) { 1983 1990 dev_notice(dev, "CGX %d LMAC count is zero, skipping probe\n", cgx->cgx_id);
+14
drivers/net/ethernet/marvell/octeontx2/af/rvu.h
··· 783 783 return false; 784 784 } 785 785 786 + static inline bool is_cgx_mapped_to_nix(unsigned short id, u8 cgx_id) 787 + { 788 + /* On CNF10KA and CNF10KB silicons only two CGX blocks are connected 789 + * to NIX. 790 + */ 791 + if (id == PCI_SUBSYS_DEVID_CNF10K_A || id == PCI_SUBSYS_DEVID_CNF10K_B) 792 + return cgx_id <= 1; 793 + 794 + return !(cgx_id && !(id == PCI_SUBSYS_DEVID_96XX || 795 + id == PCI_SUBSYS_DEVID_98XX || 796 + id == PCI_SUBSYS_DEVID_CN10K_A || 797 + id == PCI_SUBSYS_DEVID_CN10K_B)); 798 + } 799 + 786 800 static inline bool is_rvu_npc_hash_extract_en(struct rvu *rvu) 787 801 { 788 802 u64 npc_const3;
+3 -1
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
··· 124 124 dev_stats->rx_ucast_frames; 125 125 126 126 dev_stats->tx_bytes = OTX2_GET_TX_STATS(TX_OCTS); 127 - dev_stats->tx_drops = OTX2_GET_TX_STATS(TX_DROP); 127 + dev_stats->tx_drops = OTX2_GET_TX_STATS(TX_DROP) + 128 + (unsigned long)atomic_long_read(&dev_stats->tx_discards); 129 + 128 130 dev_stats->tx_bcast_frames = OTX2_GET_TX_STATS(TX_BCAST); 129 131 dev_stats->tx_mcast_frames = OTX2_GET_TX_STATS(TX_MCAST); 130 132 dev_stats->tx_ucast_frames = OTX2_GET_TX_STATS(TX_UCAST);
+1
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
··· 153 153 u64 tx_bcast_frames; 154 154 u64 tx_mcast_frames; 155 155 u64 tx_drops; 156 + atomic_long_t tx_discards; 156 157 }; 157 158 158 159 /* Driver counted stats */
+3
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
··· 2220 2220 { 2221 2221 struct otx2_nic *pf = netdev_priv(netdev); 2222 2222 int qidx = skb_get_queue_mapping(skb); 2223 + struct otx2_dev_stats *dev_stats; 2223 2224 struct otx2_snd_queue *sq; 2224 2225 struct netdev_queue *txq; 2225 2226 int sq_idx; ··· 2233 2232 /* Check for minimum and maximum packet length */ 2234 2233 if (skb->len <= ETH_HLEN || 2235 2234 (!skb_shinfo(skb)->gso_size && skb->len > pf->tx_max_pktlen)) { 2235 + dev_stats = &pf->hw.dev_stats; 2236 + atomic_long_inc(&dev_stats->tx_discards); 2236 2237 dev_kfree_skb(skb); 2237 2238 return NETDEV_TX_OK; 2238 2239 }
+10
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
··· 417 417 { 418 418 struct otx2_nic *vf = netdev_priv(netdev); 419 419 int qidx = skb_get_queue_mapping(skb); 420 + struct otx2_dev_stats *dev_stats; 420 421 struct otx2_snd_queue *sq; 421 422 struct netdev_queue *txq; 423 + 424 + /* Check for minimum and maximum packet length */ 425 + if (skb->len <= ETH_HLEN || 426 + (!skb_shinfo(skb)->gso_size && skb->len > vf->tx_max_pktlen)) { 427 + dev_stats = &vf->hw.dev_stats; 428 + atomic_long_inc(&dev_stats->tx_discards); 429 + dev_kfree_skb(skb); 430 + return NETDEV_TX_OK; 431 + } 422 432 423 433 sq = &vf->qset.sq[qidx]; 424 434 txq = netdev_get_tx_queue(netdev, qidx);
+12 -1
drivers/net/ethernet/marvell/octeontx2/nic/rep.c
··· 371 371 stats->rx_mcast_frames = rsp->rx.mcast; 372 372 stats->tx_bytes = rsp->tx.octs; 373 373 stats->tx_frames = rsp->tx.ucast + rsp->tx.bcast + rsp->tx.mcast; 374 - stats->tx_drops = rsp->tx.drop; 374 + stats->tx_drops = rsp->tx.drop + 375 + (unsigned long)atomic_long_read(&stats->tx_discards); 375 376 exit: 376 377 mutex_unlock(&priv->mbox.lock); 377 378 } ··· 419 418 struct otx2_nic *pf = rep->mdev; 420 419 struct otx2_snd_queue *sq; 421 420 struct netdev_queue *txq; 421 + struct rep_stats *stats; 422 + 423 + /* Check for minimum and maximum packet length */ 424 + if (skb->len <= ETH_HLEN || 425 + (!skb_shinfo(skb)->gso_size && skb->len > pf->tx_max_pktlen)) { 426 + stats = &rep->stats; 427 + atomic_long_inc(&stats->tx_discards); 428 + dev_kfree_skb(skb); 429 + return NETDEV_TX_OK; 430 + } 422 431 423 432 sq = &pf->qset.sq[rep->rep_id]; 424 433 txq = netdev_get_tx_queue(dev, 0);
+1
drivers/net/ethernet/marvell/octeontx2/nic/rep.h
··· 27 27 u64 tx_bytes; 28 28 u64 tx_frames; 29 29 u64 tx_drops; 30 + atomic_long_t tx_discards; 30 31 }; 31 32 32 33 struct rep_dev {
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/devlink.c
··· 160 160 if (err) 161 161 return err; 162 162 163 - mlx5_unload_one_devl_locked(dev, true); 163 + mlx5_sync_reset_unload_flow(dev, true); 164 164 err = mlx5_health_wait_pci_up(dev); 165 165 if (err) 166 166 NL_SET_ERR_MSG_MOD(extack, "FW activate aborted, PCI reads fail after reset");
+2 -1
drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c
··· 575 575 if (err) 576 576 return err; 577 577 } 578 - priv->dcbx.xoff = xoff; 579 578 580 579 /* Apply the settings */ 581 580 if (update_buffer) { ··· 582 583 if (err) 583 584 return err; 584 585 } 586 + 587 + priv->dcbx.xoff = xoff; 585 588 586 589 if (update_prio2buffer) 587 590 err = mlx5e_port_set_priority2buffer(priv->mdev, prio2buffer);
+12
drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.h
··· 66 66 struct mlx5e_bufferx_reg buffer[MLX5E_MAX_NETWORK_BUFFER]; 67 67 }; 68 68 69 + #ifdef CONFIG_MLX5_CORE_EN_DCB 69 70 int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, 70 71 u32 change, unsigned int mtu, 71 72 struct ieee_pfc *pfc, 72 73 u32 *buffer_size, 73 74 u8 *prio2buffer); 75 + #else 76 + static inline int 77 + mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, 78 + u32 change, unsigned int mtu, 79 + void *pfc, 80 + u32 *buffer_size, 81 + u8 *prio2buffer) 82 + { 83 + return 0; 84 + } 85 + #endif 74 86 75 87 int mlx5e_port_query_buffer(struct mlx5e_priv *priv, 76 88 struct mlx5e_port_buffer *port_buffer);
+18 -1
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 49 49 #include "en.h" 50 50 #include "en/dim.h" 51 51 #include "en/txrx.h" 52 + #include "en/port_buffer.h" 52 53 #include "en_tc.h" 53 54 #include "en_rep.h" 54 55 #include "en_accel/ipsec.h" ··· 139 138 if (up) { 140 139 netdev_info(priv->netdev, "Link up\n"); 141 140 netif_carrier_on(priv->netdev); 141 + mlx5e_port_manual_buffer_config(priv, 0, priv->netdev->mtu, 142 + NULL, NULL, NULL); 142 143 } else { 143 144 netdev_info(priv->netdev, "Link down\n"); 144 145 netif_carrier_off(priv->netdev); ··· 3043 3040 struct mlx5e_params *params = &priv->channels.params; 3044 3041 struct net_device *netdev = priv->netdev; 3045 3042 struct mlx5_core_dev *mdev = priv->mdev; 3046 - u16 mtu; 3043 + u16 mtu, prev_mtu; 3047 3044 int err; 3045 + 3046 + mlx5e_query_mtu(mdev, params, &prev_mtu); 3048 3047 3049 3048 err = mlx5e_set_mtu(mdev, params, params->sw_mtu); 3050 3049 if (err) ··· 3056 3051 if (mtu != params->sw_mtu) 3057 3052 netdev_warn(netdev, "%s: VPort MTU %d is different than netdev mtu %d\n", 3058 3053 __func__, mtu, params->sw_mtu); 3054 + 3055 + if (mtu != prev_mtu && MLX5_BUFFER_SUPPORTED(mdev)) { 3056 + err = mlx5e_port_manual_buffer_config(priv, 0, mtu, 3057 + NULL, NULL, NULL); 3058 + if (err) { 3059 + netdev_warn(netdev, "%s: Failed to set Xon/Xoff values with MTU %d (err %d), setting back to previous MTU %d\n", 3060 + __func__, mtu, err, prev_mtu); 3061 + 3062 + mlx5e_set_mtu(mdev, params, prev_mtu); 3063 + return err; 3064 + } 3065 + } 3059 3066 3060 3067 params->sw_mtu = mtu; 3061 3068 return 0;
+7 -8
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
··· 3734 3734 char *value = val.vstr; 3735 3735 u8 eswitch_mode; 3736 3736 3737 + eswitch_mode = mlx5_eswitch_mode(dev); 3738 + if (eswitch_mode == MLX5_ESWITCH_OFFLOADS) { 3739 + NL_SET_ERR_MSG_FMT_MOD(extack, 3740 + "Changing fs mode is not supported when eswitch offloads enabled."); 3741 + return -EOPNOTSUPP; 3742 + } 3743 + 3737 3744 if (!strcmp(value, "dmfs")) 3738 3745 return 0; 3739 3746 ··· 3764 3757 NL_SET_ERR_MSG_MOD(extack, 3765 3758 "Bad parameter: supported values are [\"dmfs\", \"smfs\", \"hmfs\"]"); 3766 3759 return -EINVAL; 3767 - } 3768 - 3769 - eswitch_mode = mlx5_eswitch_mode(dev); 3770 - if (eswitch_mode == MLX5_ESWITCH_OFFLOADS) { 3771 - NL_SET_ERR_MSG_FMT_MOD(extack, 3772 - "Moving to %s is not supported when eswitch offloads enabled.", 3773 - value); 3774 - return -EOPNOTSUPP; 3775 3760 } 3776 3761 3777 3762 return 0;
+76 -56
drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c
··· 6 6 #include "fw_reset.h" 7 7 #include "diag/fw_tracer.h" 8 8 #include "lib/tout.h" 9 + #include "sf/sf.h" 9 10 10 11 enum { 11 12 MLX5_FW_RESET_FLAGS_RESET_REQUESTED, 12 13 MLX5_FW_RESET_FLAGS_NACK_RESET_REQUEST, 13 14 MLX5_FW_RESET_FLAGS_PENDING_COMP, 14 15 MLX5_FW_RESET_FLAGS_DROP_NEW_REQUESTS, 15 - MLX5_FW_RESET_FLAGS_RELOAD_REQUIRED 16 + MLX5_FW_RESET_FLAGS_RELOAD_REQUIRED, 17 + MLX5_FW_RESET_FLAGS_UNLOAD_EVENT, 16 18 }; 17 19 18 20 struct mlx5_fw_reset { ··· 221 219 return mlx5_reg_mfrl_set(dev, MLX5_MFRL_REG_RESET_LEVEL0, 0, 0, false); 222 220 } 223 221 224 - static void mlx5_fw_reset_complete_reload(struct mlx5_core_dev *dev, bool unloaded) 222 + static void mlx5_fw_reset_complete_reload(struct mlx5_core_dev *dev) 225 223 { 226 224 struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset; 227 225 struct devlink *devlink = priv_to_devlink(dev); ··· 230 228 if (test_bit(MLX5_FW_RESET_FLAGS_PENDING_COMP, &fw_reset->reset_flags)) { 231 229 complete(&fw_reset->done); 232 230 } else { 233 - if (!unloaded) 234 - mlx5_unload_one(dev, false); 231 + mlx5_sync_reset_unload_flow(dev, false); 235 232 if (mlx5_health_wait_pci_up(dev)) 236 233 mlx5_core_err(dev, "reset reload flow aborted, PCI reads still not working\n"); 237 234 else ··· 273 272 274 273 mlx5_sync_reset_clear_reset_requested(dev, false); 275 274 mlx5_enter_error_state(dev, true); 276 - mlx5_fw_reset_complete_reload(dev, false); 275 + mlx5_fw_reset_complete_reload(dev); 277 276 } 278 277 279 278 #define MLX5_RESET_POLL_INTERVAL (HZ / 10) ··· 426 425 427 426 if (!MLX5_CAP_GEN(dev, fast_teardown)) { 428 427 mlx5_core_warn(dev, "fast teardown is not supported by firmware\n"); 428 + return false; 429 + } 430 + 431 + if (!mlx5_core_is_ecpf(dev) && !mlx5_sf_table_empty(dev)) { 432 + mlx5_core_warn(dev, "SFs should be removed before reset\n"); 429 433 return false; 430 434 } 431 435 ··· 592 586 return err; 593 587 } 594 588 595 - static void mlx5_sync_reset_now_event(struct work_struct *work) 589 + void mlx5_sync_reset_unload_flow(struct mlx5_core_dev *dev, bool locked) 596 590 { 597 - struct mlx5_fw_reset *fw_reset = container_of(work, struct mlx5_fw_reset, 598 - reset_now_work); 599 - struct mlx5_core_dev *dev = fw_reset->dev; 600 - int err; 601 - 602 - if (mlx5_sync_reset_clear_reset_requested(dev, false)) 603 - return; 604 - 605 - mlx5_core_warn(dev, "Sync Reset now. Device is going to reset.\n"); 606 - 607 - err = mlx5_cmd_fast_teardown_hca(dev); 608 - if (err) { 609 - mlx5_core_warn(dev, "Fast teardown failed, no reset done, err %d\n", err); 610 - goto done; 611 - } 612 - 613 - err = mlx5_sync_pci_reset(dev, fw_reset->reset_method); 614 - if (err) { 615 - mlx5_core_warn(dev, "mlx5_sync_pci_reset failed, no reset done, err %d\n", err); 616 - set_bit(MLX5_FW_RESET_FLAGS_RELOAD_REQUIRED, &fw_reset->reset_flags); 617 - } 618 - 619 - mlx5_enter_error_state(dev, true); 620 - done: 621 - fw_reset->ret = err; 622 - mlx5_fw_reset_complete_reload(dev, false); 623 - } 624 - 625 - static void mlx5_sync_reset_unload_event(struct work_struct *work) 626 - { 627 - struct mlx5_fw_reset *fw_reset; 628 - struct mlx5_core_dev *dev; 591 + struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset; 629 592 unsigned long timeout; 630 593 int poll_freq = 20; 631 594 bool reset_action; 632 595 u8 rst_state; 633 596 int err; 634 597 635 - fw_reset = container_of(work, struct mlx5_fw_reset, reset_unload_work); 636 - dev = fw_reset->dev; 637 - 638 - if (mlx5_sync_reset_clear_reset_requested(dev, false)) 639 - return; 640 - 641 - mlx5_core_warn(dev, "Sync Reset Unload. Function is forced down.\n"); 642 - 643 - err = mlx5_cmd_fast_teardown_hca(dev); 644 - if (err) 645 - mlx5_core_warn(dev, "Fast teardown failed, unloading, err %d\n", err); 646 - else 647 - mlx5_enter_error_state(dev, true); 648 - 649 - if (test_bit(MLX5_FW_RESET_FLAGS_PENDING_COMP, &fw_reset->reset_flags)) 598 + if (locked) 650 599 mlx5_unload_one_devl_locked(dev, false); 651 600 else 652 601 mlx5_unload_one(dev, false); 602 + 603 + if (!test_bit(MLX5_FW_RESET_FLAGS_UNLOAD_EVENT, &fw_reset->reset_flags)) 604 + return; 653 605 654 606 mlx5_set_fw_rst_ack(dev); 655 607 mlx5_core_warn(dev, "Sync Reset Unload done, device reset expected\n"); ··· 636 672 goto done; 637 673 } 638 674 639 - mlx5_core_warn(dev, "Sync Reset, got reset action. rst_state = %u\n", rst_state); 675 + mlx5_core_warn(dev, "Sync Reset, got reset action. rst_state = %u\n", 676 + rst_state); 640 677 if (rst_state == MLX5_FW_RST_STATE_TOGGLE_REQ) { 641 678 err = mlx5_sync_pci_reset(dev, fw_reset->reset_method); 642 679 if (err) { 643 - mlx5_core_warn(dev, "mlx5_sync_pci_reset failed, err %d\n", err); 680 + mlx5_core_warn(dev, "mlx5_sync_pci_reset failed, err %d\n", 681 + err); 644 682 fw_reset->ret = err; 645 683 } 646 684 } 647 685 648 686 done: 649 - mlx5_fw_reset_complete_reload(dev, true); 687 + clear_bit(MLX5_FW_RESET_FLAGS_UNLOAD_EVENT, &fw_reset->reset_flags); 688 + } 689 + 690 + static void mlx5_sync_reset_now_event(struct work_struct *work) 691 + { 692 + struct mlx5_fw_reset *fw_reset = container_of(work, struct mlx5_fw_reset, 693 + reset_now_work); 694 + struct mlx5_core_dev *dev = fw_reset->dev; 695 + int err; 696 + 697 + if (mlx5_sync_reset_clear_reset_requested(dev, false)) 698 + return; 699 + 700 + mlx5_core_warn(dev, "Sync Reset now. Device is going to reset.\n"); 701 + 702 + err = mlx5_cmd_fast_teardown_hca(dev); 703 + if (err) { 704 + mlx5_core_warn(dev, "Fast teardown failed, no reset done, err %d\n", err); 705 + goto done; 706 + } 707 + 708 + err = mlx5_sync_pci_reset(dev, fw_reset->reset_method); 709 + if (err) { 710 + mlx5_core_warn(dev, "mlx5_sync_pci_reset failed, no reset done, err %d\n", err); 711 + set_bit(MLX5_FW_RESET_FLAGS_RELOAD_REQUIRED, &fw_reset->reset_flags); 712 + } 713 + 714 + mlx5_enter_error_state(dev, true); 715 + done: 716 + fw_reset->ret = err; 717 + mlx5_fw_reset_complete_reload(dev); 718 + } 719 + 720 + static void mlx5_sync_reset_unload_event(struct work_struct *work) 721 + { 722 + struct mlx5_fw_reset *fw_reset; 723 + struct mlx5_core_dev *dev; 724 + int err; 725 + 726 + fw_reset = container_of(work, struct mlx5_fw_reset, reset_unload_work); 727 + dev = fw_reset->dev; 728 + 729 + if (mlx5_sync_reset_clear_reset_requested(dev, false)) 730 + return; 731 + 732 + set_bit(MLX5_FW_RESET_FLAGS_UNLOAD_EVENT, &fw_reset->reset_flags); 733 + mlx5_core_warn(dev, "Sync Reset Unload. Function is forced down.\n"); 734 + 735 + err = mlx5_cmd_fast_teardown_hca(dev); 736 + if (err) 737 + mlx5_core_warn(dev, "Fast teardown failed, unloading, err %d\n", err); 738 + else 739 + mlx5_enter_error_state(dev, true); 740 + 741 + mlx5_fw_reset_complete_reload(dev); 650 742 } 651 743 652 744 static void mlx5_sync_reset_abort_event(struct work_struct *work)
+1
drivers/net/ethernet/mellanox/mlx5/core/fw_reset.h
··· 12 12 int mlx5_fw_reset_set_live_patch(struct mlx5_core_dev *dev); 13 13 14 14 int mlx5_fw_reset_wait_reset_done(struct mlx5_core_dev *dev); 15 + void mlx5_sync_reset_unload_flow(struct mlx5_core_dev *dev, bool locked); 15 16 int mlx5_fw_reset_verify_fw_complete(struct mlx5_core_dev *dev, 16 17 struct netlink_ext_ack *extack); 17 18 void mlx5_fw_reset_events_start(struct mlx5_core_dev *dev);
+10
drivers/net/ethernet/mellanox/mlx5/core/sf/devlink.c
··· 518 518 WARN_ON(!xa_empty(&table->function_ids)); 519 519 kfree(table); 520 520 } 521 + 522 + bool mlx5_sf_table_empty(const struct mlx5_core_dev *dev) 523 + { 524 + struct mlx5_sf_table *table = dev->priv.sf_table; 525 + 526 + if (!table) 527 + return true; 528 + 529 + return xa_empty(&table->function_ids); 530 + }
+6
drivers/net/ethernet/mellanox/mlx5/core/sf/sf.h
··· 17 17 18 18 int mlx5_sf_table_init(struct mlx5_core_dev *dev); 19 19 void mlx5_sf_table_cleanup(struct mlx5_core_dev *dev); 20 + bool mlx5_sf_table_empty(const struct mlx5_core_dev *dev); 20 21 21 22 int mlx5_devlink_sf_port_new(struct devlink *devlink, 22 23 const struct devlink_port_new_attrs *add_attr, ··· 60 59 61 60 static inline void mlx5_sf_table_cleanup(struct mlx5_core_dev *dev) 62 61 { 62 + } 63 + 64 + static inline bool mlx5_sf_table_empty(const struct mlx5_core_dev *dev) 65 + { 66 + return true; 63 67 } 64 68 65 69 #endif
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/action.c
··· 117 117 mlx5hws_err(ctx, "No such stc_type: %d\n", stc_type); 118 118 pr_warn("HWS: Invalid stc_type: %d\n", stc_type); 119 119 ret = -EINVAL; 120 - goto unlock_and_out; 120 + goto free_shared_stc; 121 121 } 122 122 123 123 ret = mlx5hws_action_alloc_single_stc(ctx, &stc_attr, tbl_type,
+4 -2
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.c
··· 279 279 return ret; 280 280 281 281 clean_pattern: 282 - mlx5hws_cmd_header_modify_pattern_destroy(ctx->mdev, *pattern_id); 282 + mlx5hws_cmd_header_modify_pattern_destroy(ctx->mdev, ptrn_id); 283 283 out_unlock: 284 284 mutex_unlock(&ctx->pattern_cache->lock); 285 285 return ret; ··· 527 527 u32 *nop_locations, __be64 *new_pat) 528 528 { 529 529 u16 prev_src_field = INVALID_FIELD, prev_dst_field = INVALID_FIELD; 530 - u16 src_field, dst_field; 531 530 u8 action_type; 532 531 bool dependent; 533 532 size_t i, j; ··· 538 539 return 0; 539 540 540 541 for (i = 0, j = 0; i < num_actions; i++, j++) { 542 + u16 src_field = INVALID_FIELD; 543 + u16 dst_field = INVALID_FIELD; 544 + 541 545 if (j >= max_actions) 542 546 return -EINVAL; 543 547
+1
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pool.c
··· 124 124 mlx5hws_err(pool->ctx, "Failed to create resource type: %d size %zu\n", 125 125 pool->type, pool->alloc_log_sz); 126 126 mlx5hws_buddy_cleanup(buddy); 127 + kfree(buddy); 127 128 return -ENOMEM; 128 129 } 129 130
+4
drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
··· 52 52 fbnic_bmc_rpc_init(fbd); 53 53 fbnic_rss_reinit(fbd, fbn); 54 54 55 + phylink_resume(fbn->phylink); 56 + 55 57 return 0; 56 58 time_stop: 57 59 fbnic_time_stop(fbn); ··· 85 83 static int fbnic_stop(struct net_device *netdev) 86 84 { 87 85 struct fbnic_net *fbn = netdev_priv(netdev); 86 + 87 + phylink_suspend(fbn->phylink, fbnic_bmc_present(fbn->fbd)); 88 88 89 89 fbnic_down(fbn); 90 90 fbnic_pcs_free_irq(fbn->fbd);
+6 -9
drivers/net/ethernet/meta/fbnic/fbnic_pci.c
··· 118 118 struct fbnic_dev *fbd = fbn->fbd; 119 119 120 120 schedule_delayed_work(&fbd->service_task, HZ); 121 - phylink_resume(fbn->phylink); 122 121 } 123 122 124 123 static void fbnic_service_task_stop(struct fbnic_net *fbn) 125 124 { 126 125 struct fbnic_dev *fbd = fbn->fbd; 127 126 128 - phylink_suspend(fbn->phylink, fbnic_bmc_present(fbd)); 129 127 cancel_delayed_work(&fbd->service_task); 130 128 } 131 129 ··· 441 443 442 444 /* Re-enable mailbox */ 443 445 err = fbnic_fw_request_mbx(fbd); 446 + devl_unlock(priv_to_devlink(fbd)); 444 447 if (err) 445 448 goto err_free_irqs; 446 - 447 - devl_unlock(priv_to_devlink(fbd)); 448 449 449 450 /* Only send log history if log buffer is empty to prevent duplicate 450 451 * log entries. ··· 461 464 462 465 rtnl_lock(); 463 466 464 - if (netif_running(netdev)) { 467 + if (netif_running(netdev)) 465 468 err = __fbnic_open(fbn); 466 - if (err) 467 - goto err_free_mbx; 468 - } 469 469 470 470 rtnl_unlock(); 471 + if (err) 472 + goto err_free_mbx; 471 473 472 474 return 0; 473 475 err_free_mbx: 474 476 fbnic_fw_log_disable(fbd); 475 477 476 - rtnl_unlock(); 478 + devl_lock(priv_to_devlink(fbd)); 477 479 fbnic_fw_free_mbx(fbd); 480 + devl_unlock(priv_to_devlink(fbd)); 478 481 err_free_irqs: 479 482 fbnic_free_irqs(fbd); 480 483 err_invalidate_uc_addr:
+11 -2
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
··· 49 49 writel(XGMAC_INT_DEFAULT_EN, ioaddr + XGMAC_INT_EN); 50 50 } 51 51 52 + static void dwxgmac2_update_caps(struct stmmac_priv *priv) 53 + { 54 + if (!priv->dma_cap.mbps_10_100) 55 + priv->hw->link.caps &= ~(MAC_10 | MAC_100); 56 + else if (!priv->dma_cap.half_duplex) 57 + priv->hw->link.caps &= ~(MAC_10HD | MAC_100HD); 58 + } 59 + 52 60 static void dwxgmac2_set_mac(void __iomem *ioaddr, bool enable) 53 61 { 54 62 u32 tx = readl(ioaddr + XGMAC_TX_CONFIG); ··· 1432 1424 1433 1425 const struct stmmac_ops dwxgmac210_ops = { 1434 1426 .core_init = dwxgmac2_core_init, 1427 + .update_caps = dwxgmac2_update_caps, 1435 1428 .set_mac = dwxgmac2_set_mac, 1436 1429 .rx_ipc = dwxgmac2_rx_ipc, 1437 1430 .rx_queue_enable = dwxgmac2_rx_queue_enable, ··· 1541 1532 mac->mcast_bits_log2 = ilog2(mac->multicast_filter_bins); 1542 1533 1543 1534 mac->link.caps = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | 1544 - MAC_1000FD | MAC_2500FD | MAC_5000FD | 1545 - MAC_10000FD; 1535 + MAC_10 | MAC_100 | MAC_1000FD | 1536 + MAC_2500FD | MAC_5000FD | MAC_10000FD; 1546 1537 mac->link.duplex = 0; 1547 1538 mac->link.speed10 = XGMAC_CONFIG_SS_10_MII; 1548 1539 mac->link.speed100 = XGMAC_CONFIG_SS_100_MII;
+5 -4
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
··· 203 203 } 204 204 205 205 writel(value, ioaddr + XGMAC_MTL_RXQ_OPMODE(channel)); 206 - 207 - /* Enable MTL RX overflow */ 208 - value = readl(ioaddr + XGMAC_MTL_QINTEN(channel)); 209 - writel(value | XGMAC_RXOIE, ioaddr + XGMAC_MTL_QINTEN(channel)); 210 206 } 211 207 212 208 static void dwxgmac2_dma_tx_mode(struct stmmac_priv *priv, void __iomem *ioaddr, ··· 382 386 static int dwxgmac2_get_hw_feature(void __iomem *ioaddr, 383 387 struct dma_features *dma_cap) 384 388 { 389 + struct stmmac_priv *priv; 385 390 u32 hw_cap; 391 + 392 + priv = container_of(dma_cap, struct stmmac_priv, dma_cap); 386 393 387 394 /* MAC HW feature 0 */ 388 395 hw_cap = readl(ioaddr + XGMAC_HW_FEATURE0); ··· 409 410 dma_cap->vlhash = (hw_cap & XGMAC_HWFEAT_VLHASH) >> 4; 410 411 dma_cap->half_duplex = (hw_cap & XGMAC_HWFEAT_HDSEL) >> 3; 411 412 dma_cap->mbps_1000 = (hw_cap & XGMAC_HWFEAT_GMIISEL) >> 1; 413 + if (dma_cap->mbps_1000 && priv->synopsys_id >= DWXGMAC_CORE_2_20) 414 + dma_cap->mbps_10_100 = 1; 412 415 413 416 /* MAC HW feature 1 */ 414 417 hw_cap = readl(ioaddr + XGMAC_HW_FEATURE1);
+4 -2
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 2584 2584 struct netdev_queue *nq = netdev_get_tx_queue(priv->dev, queue); 2585 2585 struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue]; 2586 2586 struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[queue]; 2587 + bool csum = !priv->plat->tx_queues_cfg[queue].coe_unsupported; 2587 2588 struct xsk_buff_pool *pool = tx_q->xsk_pool; 2588 2589 unsigned int entry = tx_q->cur_tx; 2589 2590 struct dma_desc *tx_desc = NULL; ··· 2672 2671 } 2673 2672 2674 2673 stmmac_prepare_tx_desc(priv, tx_desc, 1, xdp_desc.len, 2675 - true, priv->mode, true, true, 2674 + csum, priv->mode, true, true, 2676 2675 xdp_desc.len); 2677 2676 2678 2677 stmmac_enable_dma_transmission(priv, priv->ioaddr, queue); ··· 4984 4983 { 4985 4984 struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[queue]; 4986 4985 struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue]; 4986 + bool csum = !priv->plat->tx_queues_cfg[queue].coe_unsupported; 4987 4987 unsigned int entry = tx_q->cur_tx; 4988 4988 struct dma_desc *tx_desc; 4989 4989 dma_addr_t dma_addr; ··· 5036 5034 stmmac_set_desc_addr(priv, tx_desc, dma_addr); 5037 5035 5038 5036 stmmac_prepare_tx_desc(priv, tx_desc, 1, xdpf->len, 5039 - true, priv->mode, true, true, 5037 + csum, priv->mode, true, true, 5040 5038 xdpf->len); 5041 5039 5042 5040 tx_q->tx_count_frames++;
+8 -9
drivers/net/hyperv/netvsc.c
··· 1812 1812 1813 1813 /* Enable NAPI handler before init callbacks */ 1814 1814 netif_napi_add(ndev, &net_device->chan_table[0].napi, netvsc_poll); 1815 + napi_enable(&net_device->chan_table[0].napi); 1816 + netif_queue_set_napi(ndev, 0, NETDEV_QUEUE_TYPE_RX, 1817 + &net_device->chan_table[0].napi); 1818 + netif_queue_set_napi(ndev, 0, NETDEV_QUEUE_TYPE_TX, 1819 + &net_device->chan_table[0].napi); 1815 1820 1816 1821 /* Open the channel */ 1817 1822 device->channel->next_request_id_callback = vmbus_next_request_id; ··· 1836 1831 /* Channel is opened */ 1837 1832 netdev_dbg(ndev, "hv_netvsc channel opened successfully\n"); 1838 1833 1839 - napi_enable(&net_device->chan_table[0].napi); 1840 - netif_queue_set_napi(ndev, 0, NETDEV_QUEUE_TYPE_RX, 1841 - &net_device->chan_table[0].napi); 1842 - netif_queue_set_napi(ndev, 0, NETDEV_QUEUE_TYPE_TX, 1843 - &net_device->chan_table[0].napi); 1844 - 1845 1834 /* Connect with the NetVsp */ 1846 1835 ret = netvsc_connect_vsp(device, net_device, device_info); 1847 1836 if (ret != 0) { ··· 1853 1854 1854 1855 close: 1855 1856 RCU_INIT_POINTER(net_device_ctx->nvdev, NULL); 1856 - netif_queue_set_napi(ndev, 0, NETDEV_QUEUE_TYPE_TX, NULL); 1857 - netif_queue_set_napi(ndev, 0, NETDEV_QUEUE_TYPE_RX, NULL); 1858 - napi_disable(&net_device->chan_table[0].napi); 1859 1857 1860 1858 /* Now, we can close the channel safely */ 1861 1859 vmbus_close(device->channel); 1862 1860 1863 1861 cleanup: 1862 + netif_queue_set_napi(ndev, 0, NETDEV_QUEUE_TYPE_TX, NULL); 1863 + netif_queue_set_napi(ndev, 0, NETDEV_QUEUE_TYPE_RX, NULL); 1864 + napi_disable(&net_device->chan_table[0].napi); 1864 1865 netif_napi_del(&net_device->chan_table[0].napi); 1865 1866 1866 1867 cleanup2:
+16 -7
drivers/net/hyperv/rndis_filter.c
··· 1252 1252 new_sc->rqstor_size = netvsc_rqstor_size(netvsc_ring_bytes); 1253 1253 new_sc->max_pkt_size = NETVSC_MAX_PKT_SIZE; 1254 1254 1255 + /* Enable napi before opening the vmbus channel to avoid races 1256 + * as the host placing data on the host->guest ring may be left 1257 + * out if napi was not enabled. 1258 + */ 1259 + napi_enable(&nvchan->napi); 1260 + netif_queue_set_napi(ndev, chn_index, NETDEV_QUEUE_TYPE_RX, 1261 + &nvchan->napi); 1262 + netif_queue_set_napi(ndev, chn_index, NETDEV_QUEUE_TYPE_TX, 1263 + &nvchan->napi); 1264 + 1255 1265 ret = vmbus_open(new_sc, netvsc_ring_bytes, 1256 1266 netvsc_ring_bytes, NULL, 0, 1257 1267 netvsc_channel_cb, nvchan); 1258 - if (ret == 0) { 1259 - napi_enable(&nvchan->napi); 1260 - netif_queue_set_napi(ndev, chn_index, NETDEV_QUEUE_TYPE_RX, 1261 - &nvchan->napi); 1262 - netif_queue_set_napi(ndev, chn_index, NETDEV_QUEUE_TYPE_TX, 1263 - &nvchan->napi); 1264 - } else { 1268 + if (ret != 0) { 1265 1269 netdev_notice(ndev, "sub channel open failed: %d\n", ret); 1270 + netif_queue_set_napi(ndev, chn_index, NETDEV_QUEUE_TYPE_TX, 1271 + NULL); 1272 + netif_queue_set_napi(ndev, chn_index, NETDEV_QUEUE_TYPE_RX, 1273 + NULL); 1274 + napi_disable(&nvchan->napi); 1266 1275 } 1267 1276 1268 1277 if (atomic_inc_return(&nvscdev->open_chn) == nvscdev->num_chn)
+4
drivers/net/phy/mscc/mscc.h
··· 481 481 void vsc85xx_link_change_notify(struct phy_device *phydev); 482 482 void vsc8584_config_ts_intr(struct phy_device *phydev); 483 483 int vsc8584_ptp_init(struct phy_device *phydev); 484 + void vsc8584_ptp_deinit(struct phy_device *phydev); 484 485 int vsc8584_ptp_probe_once(struct phy_device *phydev); 485 486 int vsc8584_ptp_probe(struct phy_device *phydev); 486 487 irqreturn_t vsc8584_handle_ts_interrupt(struct phy_device *phydev); ··· 495 494 static inline int vsc8584_ptp_init(struct phy_device *phydev) 496 495 { 497 496 return 0; 497 + } 498 + static inline void vsc8584_ptp_deinit(struct phy_device *phydev) 499 + { 498 500 } 499 501 static inline int vsc8584_ptp_probe_once(struct phy_device *phydev) 500 502 {
+1 -3
drivers/net/phy/mscc/mscc_main.c
··· 2337 2337 2338 2338 static void vsc85xx_remove(struct phy_device *phydev) 2339 2339 { 2340 - struct vsc8531_private *priv = phydev->priv; 2341 - 2342 - skb_queue_purge(&priv->rx_skbs_list); 2340 + vsc8584_ptp_deinit(phydev); 2343 2341 } 2344 2342 2345 2343 /* Microsemi VSC85xx PHYs */
+21 -13
drivers/net/phy/mscc/mscc_ptp.c
··· 1298 1298 1299 1299 static int __vsc8584_init_ptp(struct phy_device *phydev) 1300 1300 { 1301 - struct vsc8531_private *vsc8531 = phydev->priv; 1302 1301 static const u32 ltc_seq_e[] = { 0, 400000, 0, 0, 0 }; 1303 1302 static const u8 ltc_seq_a[] = { 8, 6, 5, 4, 2 }; 1304 1303 u32 val; ··· 1514 1515 1515 1516 vsc85xx_ts_eth_cmp1_sig(phydev); 1516 1517 1517 - vsc8531->mii_ts.rxtstamp = vsc85xx_rxtstamp; 1518 - vsc8531->mii_ts.txtstamp = vsc85xx_txtstamp; 1519 - vsc8531->mii_ts.hwtstamp = vsc85xx_hwtstamp; 1520 - vsc8531->mii_ts.ts_info = vsc85xx_ts_info; 1521 - phydev->mii_ts = &vsc8531->mii_ts; 1522 - 1523 - memcpy(&vsc8531->ptp->caps, &vsc85xx_clk_caps, sizeof(vsc85xx_clk_caps)); 1524 - 1525 - vsc8531->ptp->ptp_clock = ptp_clock_register(&vsc8531->ptp->caps, 1526 - &phydev->mdio.dev); 1527 - return PTR_ERR_OR_ZERO(vsc8531->ptp->ptp_clock); 1518 + return 0; 1528 1519 } 1529 1520 1530 1521 void vsc8584_config_ts_intr(struct phy_device *phydev) ··· 1539 1550 } 1540 1551 1541 1552 return 0; 1553 + } 1554 + 1555 + void vsc8584_ptp_deinit(struct phy_device *phydev) 1556 + { 1557 + struct vsc8531_private *vsc8531 = phydev->priv; 1558 + 1559 + if (vsc8531->ptp->ptp_clock) { 1560 + ptp_clock_unregister(vsc8531->ptp->ptp_clock); 1561 + skb_queue_purge(&vsc8531->rx_skbs_list); 1562 + } 1542 1563 } 1543 1564 1544 1565 irqreturn_t vsc8584_handle_ts_interrupt(struct phy_device *phydev) ··· 1611 1612 1612 1613 vsc8531->ptp->phydev = phydev; 1613 1614 1614 - return 0; 1615 + vsc8531->mii_ts.rxtstamp = vsc85xx_rxtstamp; 1616 + vsc8531->mii_ts.txtstamp = vsc85xx_txtstamp; 1617 + vsc8531->mii_ts.hwtstamp = vsc85xx_hwtstamp; 1618 + vsc8531->mii_ts.ts_info = vsc85xx_ts_info; 1619 + phydev->mii_ts = &vsc8531->mii_ts; 1620 + 1621 + memcpy(&vsc8531->ptp->caps, &vsc85xx_clk_caps, sizeof(vsc85xx_clk_caps)); 1622 + vsc8531->ptp->ptp_clock = ptp_clock_register(&vsc8531->ptp->caps, 1623 + &phydev->mdio.dev); 1624 + return PTR_ERR_OR_ZERO(vsc8531->ptp->ptp_clock); 1615 1625 } 1616 1626 1617 1627 int vsc8584_ptp_probe_once(struct phy_device *phydev)
+3
drivers/net/usb/qmi_wwan.c
··· 1355 1355 {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ 1356 1356 {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ 1357 1357 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1031, 3)}, /* Telit LE910C1-EUX */ 1358 + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1034, 2)}, /* Telit LE910C4-WWX */ 1359 + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1037, 4)}, /* Telit LE910C4-WWX */ 1360 + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1038, 3)}, /* Telit LE910C4-WWX */ 1358 1361 {QMI_QUIRK_SET_DTR(0x1bc7, 0x103a, 0)}, /* Telit LE910C4-WWX */ 1359 1362 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */ 1360 1363 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1050, 2)}, /* Telit FN980 */
+1
include/linux/atmdev.h
··· 185 185 int (*compat_ioctl)(struct atm_dev *dev,unsigned int cmd, 186 186 void __user *arg); 187 187 #endif 188 + int (*pre_send)(struct atm_vcc *vcc, struct sk_buff *skb); 188 189 int (*send)(struct atm_vcc *vcc,struct sk_buff *skb); 189 190 int (*send_bh)(struct atm_vcc *vcc, struct sk_buff *skb); 190 191 int (*send_oam)(struct atm_vcc *vcc,void *cell,int flags);
+2
include/linux/skbuff.h
··· 4172 4172 struct iov_iter *to, int len, u32 *crcp); 4173 4173 int skb_copy_datagram_from_iter(struct sk_buff *skb, int offset, 4174 4174 struct iov_iter *from, int len); 4175 + int skb_copy_datagram_from_iter_full(struct sk_buff *skb, int offset, 4176 + struct iov_iter *from, int len); 4175 4177 int zerocopy_sg_from_iter(struct sk_buff *skb, struct iov_iter *frm); 4176 4178 void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 4177 4179 int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags);
+1 -1
include/net/bluetooth/hci_sync.h
··· 93 93 94 94 int hci_update_eir_sync(struct hci_dev *hdev); 95 95 int hci_update_class_sync(struct hci_dev *hdev); 96 - int hci_update_name_sync(struct hci_dev *hdev); 96 + int hci_update_name_sync(struct hci_dev *hdev, const u8 *name); 97 97 int hci_write_ssp_mode_sync(struct hci_dev *hdev, u8 mode); 98 98 99 99 int hci_get_random_address(struct hci_dev *hdev, bool require_privacy,
+17 -1
include/net/rose.h
··· 8 8 #ifndef _ROSE_H 9 9 #define _ROSE_H 10 10 11 + #include <linux/refcount.h> 11 12 #include <linux/rose.h> 12 13 #include <net/ax25.h> 13 14 #include <net/sock.h> ··· 97 96 ax25_cb *ax25; 98 97 struct net_device *dev; 99 98 unsigned short count; 100 - unsigned short use; 99 + refcount_t use; 101 100 unsigned int number; 102 101 char restarted; 103 102 char dce_mode; ··· 151 150 }; 152 151 153 152 #define rose_sk(sk) ((struct rose_sock *)(sk)) 153 + 154 + static inline void rose_neigh_hold(struct rose_neigh *rose_neigh) 155 + { 156 + refcount_inc(&rose_neigh->use); 157 + } 158 + 159 + static inline void rose_neigh_put(struct rose_neigh *rose_neigh) 160 + { 161 + if (refcount_dec_and_test(&rose_neigh->use)) { 162 + if (rose_neigh->ax25) 163 + ax25_cb_put(rose_neigh->ax25); 164 + kfree(rose_neigh->digipeat); 165 + kfree(rose_neigh); 166 + } 167 + } 154 168 155 169 /* af_rose.c */ 156 170 extern ax25_address rose_callsign;
+12 -3
net/atm/common.c
··· 635 635 636 636 skb->dev = NULL; /* for paths shared with net_device interfaces */ 637 637 if (!copy_from_iter_full(skb_put(skb, size), size, &m->msg_iter)) { 638 - atm_return_tx(vcc, skb); 639 - kfree_skb(skb); 640 638 error = -EFAULT; 641 - goto out; 639 + goto free_skb; 642 640 } 643 641 if (eff != size) 644 642 memset(skb->data + size, 0, eff-size); 643 + 644 + if (vcc->dev->ops->pre_send) { 645 + error = vcc->dev->ops->pre_send(vcc, skb); 646 + if (error) 647 + goto free_skb; 648 + } 649 + 645 650 error = vcc->dev->ops->send(vcc, skb); 646 651 error = error ? error : size; 647 652 out: 648 653 release_sock(sk); 649 654 return error; 655 + free_skb: 656 + atm_return_tx(vcc, skb); 657 + kfree_skb(skb); 658 + goto out; 650 659 } 651 660 652 661 __poll_t vcc_poll(struct file *file, struct socket *sock, poll_table *wait)
+41 -17
net/bluetooth/hci_conn.c
··· 149 149 150 150 hci_chan_list_flush(conn); 151 151 152 - hci_conn_hash_del(hdev, conn); 153 - 154 152 if (HCI_CONN_HANDLE_UNSET(conn->handle)) 155 153 ida_free(&hdev->unset_handle_ida, conn->handle); 156 154 ··· 1150 1152 disable_delayed_work_sync(&conn->auto_accept_work); 1151 1153 disable_delayed_work_sync(&conn->idle_work); 1152 1154 1153 - if (conn->type == ACL_LINK) { 1154 - /* Unacked frames */ 1155 - hdev->acl_cnt += conn->sent; 1156 - } else if (conn->type == LE_LINK) { 1157 - cancel_delayed_work(&conn->le_conn_timeout); 1155 + /* Remove the connection from the list so unacked logic can detect when 1156 + * a certain pool is not being utilized. 1157 + */ 1158 + hci_conn_hash_del(hdev, conn); 1158 1159 1159 - if (hdev->le_pkts) 1160 - hdev->le_cnt += conn->sent; 1160 + /* Handle unacked frames: 1161 + * 1162 + * - In case there are no connection, or if restoring the buffers 1163 + * considered in transist would overflow, restore all buffers to the 1164 + * pool. 1165 + * - Otherwise restore just the buffers considered in transit for the 1166 + * hci_conn 1167 + */ 1168 + switch (conn->type) { 1169 + case ACL_LINK: 1170 + if (!hci_conn_num(hdev, ACL_LINK) || 1171 + hdev->acl_cnt + conn->sent > hdev->acl_pkts) 1172 + hdev->acl_cnt = hdev->acl_pkts; 1161 1173 else 1162 1174 hdev->acl_cnt += conn->sent; 1163 - } else { 1164 - /* Unacked ISO frames */ 1165 - if (conn->type == CIS_LINK || 1166 - conn->type == BIS_LINK || 1167 - conn->type == PA_LINK) { 1168 - if (hdev->iso_pkts) 1169 - hdev->iso_cnt += conn->sent; 1170 - else if (hdev->le_pkts) 1175 + break; 1176 + case LE_LINK: 1177 + cancel_delayed_work(&conn->le_conn_timeout); 1178 + 1179 + if (hdev->le_pkts) { 1180 + if (!hci_conn_num(hdev, LE_LINK) || 1181 + hdev->le_cnt + conn->sent > hdev->le_pkts) 1182 + hdev->le_cnt = hdev->le_pkts; 1183 + else 1171 1184 hdev->le_cnt += conn->sent; 1185 + } else { 1186 + if ((!hci_conn_num(hdev, LE_LINK) && 1187 + !hci_conn_num(hdev, ACL_LINK)) || 1188 + hdev->acl_cnt + conn->sent > hdev->acl_pkts) 1189 + hdev->acl_cnt = hdev->acl_pkts; 1172 1190 else 1173 1191 hdev->acl_cnt += conn->sent; 1174 1192 } 1193 + break; 1194 + case CIS_LINK: 1195 + case BIS_LINK: 1196 + case PA_LINK: 1197 + if (!hci_iso_count(hdev) || 1198 + hdev->iso_cnt + conn->sent > hdev->iso_pkts) 1199 + hdev->iso_cnt = hdev->iso_pkts; 1200 + else 1201 + hdev->iso_cnt += conn->sent; 1202 + break; 1175 1203 } 1176 1204 1177 1205 skb_queue_purge(&conn->data_q);
+23 -2
net/bluetooth/hci_event.c
··· 2703 2703 if (!conn) 2704 2704 goto unlock; 2705 2705 2706 - if (status) { 2706 + if (status && status != HCI_ERROR_UNKNOWN_CONN_ID) { 2707 2707 mgmt_disconnect_failed(hdev, &conn->dst, conn->type, 2708 2708 conn->dst_type, status); 2709 2709 ··· 2717 2717 2718 2718 goto done; 2719 2719 } 2720 + 2721 + /* During suspend, mark connection as closed immediately 2722 + * since we might not receive HCI_EV_DISCONN_COMPLETE 2723 + */ 2724 + if (hdev->suspended) 2725 + conn->state = BT_CLOSED; 2720 2726 2721 2727 mgmt_conn = test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags); 2722 2728 ··· 4404 4398 if (!conn) 4405 4399 continue; 4406 4400 4407 - conn->sent -= count; 4401 + /* Check if there is really enough packets outstanding before 4402 + * attempting to decrease the sent counter otherwise it could 4403 + * underflow.. 4404 + */ 4405 + if (conn->sent >= count) { 4406 + conn->sent -= count; 4407 + } else { 4408 + bt_dev_warn(hdev, "hcon %p sent %u < count %u", 4409 + conn, conn->sent, count); 4410 + conn->sent = 0; 4411 + } 4408 4412 4409 4413 for (i = 0; i < count; ++i) 4410 4414 hci_conn_tx_dequeue(conn); ··· 7024 7008 { 7025 7009 struct hci_evt_le_big_sync_lost *ev = data; 7026 7010 struct hci_conn *bis, *conn; 7011 + bool mgmt_conn; 7027 7012 7028 7013 bt_dev_dbg(hdev, "big handle 0x%2.2x", ev->handle); 7029 7014 ··· 7043 7026 while ((bis = hci_conn_hash_lookup_big_state(hdev, ev->handle, 7044 7027 BT_CONNECTED, 7045 7028 HCI_ROLE_SLAVE))) { 7029 + mgmt_conn = test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &bis->flags); 7030 + mgmt_device_disconnected(hdev, &bis->dst, bis->type, bis->dst_type, 7031 + ev->reason, mgmt_conn); 7032 + 7046 7033 clear_bit(HCI_CONN_BIG_SYNC, &bis->flags); 7047 7034 hci_disconn_cfm(bis, ev->reason); 7048 7035 hci_conn_del(bis);
+3 -3
net/bluetooth/hci_sync.c
··· 3481 3481 return hci_write_scan_enable_sync(hdev, scan); 3482 3482 } 3483 3483 3484 - int hci_update_name_sync(struct hci_dev *hdev) 3484 + int hci_update_name_sync(struct hci_dev *hdev, const u8 *name) 3485 3485 { 3486 3486 struct hci_cp_write_local_name cp; 3487 3487 3488 3488 memset(&cp, 0, sizeof(cp)); 3489 3489 3490 - memcpy(cp.name, hdev->dev_name, sizeof(cp.name)); 3490 + memcpy(cp.name, name, sizeof(cp.name)); 3491 3491 3492 3492 return __hci_cmd_sync_status(hdev, HCI_OP_WRITE_LOCAL_NAME, 3493 3493 sizeof(cp), &cp, ··· 3540 3540 hci_write_fast_connectable_sync(hdev, false); 3541 3541 hci_update_scan_sync(hdev); 3542 3542 hci_update_class_sync(hdev); 3543 - hci_update_name_sync(hdev); 3543 + hci_update_name_sync(hdev, hdev->dev_name); 3544 3544 hci_update_eir_sync(hdev); 3545 3545 } 3546 3546
+7 -2
net/bluetooth/mgmt.c
··· 3892 3892 3893 3893 static int set_name_sync(struct hci_dev *hdev, void *data) 3894 3894 { 3895 + struct mgmt_pending_cmd *cmd = data; 3896 + struct mgmt_cp_set_local_name *cp = cmd->param; 3897 + 3895 3898 if (lmp_bredr_capable(hdev)) { 3896 - hci_update_name_sync(hdev); 3899 + hci_update_name_sync(hdev, cp->name); 3897 3900 hci_update_eir_sync(hdev); 3898 3901 } 3899 3902 ··· 9708 9705 if (!mgmt_connected) 9709 9706 return; 9710 9707 9711 - if (link_type != ACL_LINK && link_type != LE_LINK) 9708 + if (link_type != ACL_LINK && 9709 + link_type != LE_LINK && 9710 + link_type != BIS_LINK) 9712 9711 return; 9713 9712 9714 9713 bacpy(&ev.addr.bdaddr, bdaddr);
+14
net/core/datagram.c
··· 618 618 } 619 619 EXPORT_SYMBOL(skb_copy_datagram_from_iter); 620 620 621 + int skb_copy_datagram_from_iter_full(struct sk_buff *skb, int offset, 622 + struct iov_iter *from, int len) 623 + { 624 + struct iov_iter_state state; 625 + int ret; 626 + 627 + iov_iter_save_state(from, &state); 628 + ret = skb_copy_datagram_from_iter(skb, offset, from, len); 629 + if (ret) 630 + iov_iter_restore(from, &state); 631 + return ret; 632 + } 633 + EXPORT_SYMBOL(skb_copy_datagram_from_iter_full); 634 + 621 635 int zerocopy_fill_skb_from_iter(struct sk_buff *skb, 622 636 struct iov_iter *from, size_t length) 623 637 {
+4 -2
net/core/page_pool.c
··· 287 287 } 288 288 289 289 if (pool->mp_ops) { 290 - if (!pool->dma_map || !pool->dma_sync) 291 - return -EOPNOTSUPP; 290 + if (!pool->dma_map || !pool->dma_sync) { 291 + err = -EOPNOTSUPP; 292 + goto free_ptr_ring; 293 + } 292 294 293 295 if (WARN_ON(!is_kernel_rodata((unsigned long)pool->mp_ops))) { 294 296 err = -EFAULT;
+7 -3
net/ipv4/route.c
··· 2575 2575 !netif_is_l3_master(dev_out)) 2576 2576 return ERR_PTR(-EINVAL); 2577 2577 2578 - if (ipv4_is_lbcast(fl4->daddr)) 2578 + if (ipv4_is_lbcast(fl4->daddr)) { 2579 2579 type = RTN_BROADCAST; 2580 - else if (ipv4_is_multicast(fl4->daddr)) 2580 + 2581 + /* reset fi to prevent gateway resolution */ 2582 + fi = NULL; 2583 + } else if (ipv4_is_multicast(fl4->daddr)) { 2581 2584 type = RTN_MULTICAST; 2582 - else if (ipv4_is_zeronet(fl4->daddr)) 2585 + } else if (ipv4_is_zeronet(fl4->daddr)) { 2583 2586 return ERR_PTR(-EINVAL); 2587 + } 2584 2588 2585 2589 if (dev_out->flags & IFF_LOOPBACK) 2586 2590 flags |= RTCF_LOCAL;
+8 -17
net/l2tp/l2tp_ppp.c
··· 129 129 130 130 static const struct proto_ops pppol2tp_ops; 131 131 132 - /* Retrieves the pppol2tp socket associated to a session. 133 - * A reference is held on the returned socket, so this function must be paired 134 - * with sock_put(). 135 - */ 132 + /* Retrieves the pppol2tp socket associated to a session. */ 136 133 static struct sock *pppol2tp_session_get_sock(struct l2tp_session *session) 137 134 { 138 135 struct pppol2tp_session *ps = l2tp_session_priv(session); 139 - struct sock *sk; 140 136 141 - rcu_read_lock(); 142 - sk = rcu_dereference(ps->sk); 143 - if (sk) 144 - sock_hold(sk); 145 - rcu_read_unlock(); 146 - 147 - return sk; 137 + return rcu_dereference(ps->sk); 148 138 } 149 139 150 140 /* Helpers to obtain tunnel/session contexts from sockets. ··· 196 206 197 207 static void pppol2tp_recv(struct l2tp_session *session, struct sk_buff *skb, int data_len) 198 208 { 199 - struct pppol2tp_session *ps = l2tp_session_priv(session); 200 - struct sock *sk = NULL; 209 + struct sock *sk; 201 210 202 211 /* If the socket is bound, send it in to PPP's input queue. Otherwise 203 212 * queue it on the session socket. 204 213 */ 205 214 rcu_read_lock(); 206 - sk = rcu_dereference(ps->sk); 215 + sk = pppol2tp_session_get_sock(session); 207 216 if (!sk) 208 217 goto no_sock; 209 218 ··· 499 510 struct l2tp_session *session = arg; 500 511 struct sock *sk; 501 512 513 + rcu_read_lock(); 502 514 sk = pppol2tp_session_get_sock(session); 503 515 if (sk) { 504 516 struct pppox_sock *po = pppox_sk(sk); 505 517 506 518 seq_printf(m, " interface %s\n", ppp_dev_name(&po->chan)); 507 - sock_put(sk); 508 519 } 520 + rcu_read_unlock(); 509 521 } 510 522 511 523 static void pppol2tp_session_init(struct l2tp_session *session) ··· 1520 1530 port = ntohs(inet->inet_sport); 1521 1531 } 1522 1532 1533 + rcu_read_lock(); 1523 1534 sk = pppol2tp_session_get_sock(session); 1524 1535 if (sk) { 1525 1536 state = sk->sk_state; ··· 1556 1565 struct pppox_sock *po = pppox_sk(sk); 1557 1566 1558 1567 seq_printf(m, " interface %s\n", ppp_dev_name(&po->chan)); 1559 - sock_put(sk); 1560 1568 } 1569 + rcu_read_unlock(); 1561 1570 } 1562 1571 1563 1572 static int pppol2tp_seq_show(struct seq_file *m, void *v)
+7 -6
net/rose/af_rose.c
··· 170 170 171 171 if (rose->neighbour == neigh) { 172 172 rose_disconnect(s, ENETUNREACH, ROSE_OUT_OF_ORDER, 0); 173 - rose->neighbour->use--; 173 + rose_neigh_put(rose->neighbour); 174 174 rose->neighbour = NULL; 175 175 } 176 176 } ··· 212 212 if (rose->device == dev) { 213 213 rose_disconnect(sk, ENETUNREACH, ROSE_OUT_OF_ORDER, 0); 214 214 if (rose->neighbour) 215 - rose->neighbour->use--; 215 + rose_neigh_put(rose->neighbour); 216 216 netdev_put(rose->device, &rose->dev_tracker); 217 217 rose->device = NULL; 218 218 } ··· 655 655 break; 656 656 657 657 case ROSE_STATE_2: 658 - rose->neighbour->use--; 658 + rose_neigh_put(rose->neighbour); 659 659 release_sock(sk); 660 660 rose_disconnect(sk, 0, -1, -1); 661 661 lock_sock(sk); ··· 823 823 rose->lci = rose_new_lci(rose->neighbour); 824 824 if (!rose->lci) { 825 825 err = -ENETUNREACH; 826 + rose_neigh_put(rose->neighbour); 826 827 goto out_release; 827 828 } 828 829 ··· 835 834 dev = rose_dev_first(); 836 835 if (!dev) { 837 836 err = -ENETUNREACH; 837 + rose_neigh_put(rose->neighbour); 838 838 goto out_release; 839 839 } 840 840 841 841 user = ax25_findbyuid(current_euid()); 842 842 if (!user) { 843 843 err = -EINVAL; 844 + rose_neigh_put(rose->neighbour); 844 845 dev_put(dev); 845 846 goto out_release; 846 847 } ··· 876 873 sk->sk_state = TCP_SYN_SENT; 877 874 878 875 rose->state = ROSE_STATE_1; 879 - 880 - rose->neighbour->use++; 881 876 882 877 rose_write_internal(sk, ROSE_CALL_REQUEST); 883 878 rose_start_heartbeat(sk); ··· 1078 1077 GFP_ATOMIC); 1079 1078 make_rose->facilities = facilities; 1080 1079 1081 - make_rose->neighbour->use++; 1080 + rose_neigh_hold(make_rose->neighbour); 1082 1081 1083 1082 if (rose_sk(sk)->defer) { 1084 1083 make_rose->state = ROSE_STATE_5;
+6 -6
net/rose/rose_in.c
··· 56 56 case ROSE_CLEAR_REQUEST: 57 57 rose_write_internal(sk, ROSE_CLEAR_CONFIRMATION); 58 58 rose_disconnect(sk, ECONNREFUSED, skb->data[3], skb->data[4]); 59 - rose->neighbour->use--; 59 + rose_neigh_put(rose->neighbour); 60 60 break; 61 61 62 62 default: ··· 79 79 case ROSE_CLEAR_REQUEST: 80 80 rose_write_internal(sk, ROSE_CLEAR_CONFIRMATION); 81 81 rose_disconnect(sk, 0, skb->data[3], skb->data[4]); 82 - rose->neighbour->use--; 82 + rose_neigh_put(rose->neighbour); 83 83 break; 84 84 85 85 case ROSE_CLEAR_CONFIRMATION: 86 86 rose_disconnect(sk, 0, -1, -1); 87 - rose->neighbour->use--; 87 + rose_neigh_put(rose->neighbour); 88 88 break; 89 89 90 90 default: ··· 121 121 case ROSE_CLEAR_REQUEST: 122 122 rose_write_internal(sk, ROSE_CLEAR_CONFIRMATION); 123 123 rose_disconnect(sk, 0, skb->data[3], skb->data[4]); 124 - rose->neighbour->use--; 124 + rose_neigh_put(rose->neighbour); 125 125 break; 126 126 127 127 case ROSE_RR: ··· 234 234 case ROSE_CLEAR_REQUEST: 235 235 rose_write_internal(sk, ROSE_CLEAR_CONFIRMATION); 236 236 rose_disconnect(sk, 0, skb->data[3], skb->data[4]); 237 - rose->neighbour->use--; 237 + rose_neigh_put(rose->neighbour); 238 238 break; 239 239 240 240 default: ··· 254 254 if (frametype == ROSE_CLEAR_REQUEST) { 255 255 rose_write_internal(sk, ROSE_CLEAR_CONFIRMATION); 256 256 rose_disconnect(sk, 0, skb->data[3], skb->data[4]); 257 - rose_sk(sk)->neighbour->use--; 257 + rose_neigh_put(rose_sk(sk)->neighbour); 258 258 } 259 259 260 260 return 0;
+38 -24
net/rose/rose_route.c
··· 93 93 rose_neigh->ax25 = NULL; 94 94 rose_neigh->dev = dev; 95 95 rose_neigh->count = 0; 96 - rose_neigh->use = 0; 97 96 rose_neigh->dce_mode = 0; 98 97 rose_neigh->loopback = 0; 99 98 rose_neigh->number = rose_neigh_no++; 100 99 rose_neigh->restarted = 0; 100 + refcount_set(&rose_neigh->use, 1); 101 101 102 102 skb_queue_head_init(&rose_neigh->queue); 103 103 ··· 178 178 } 179 179 } 180 180 rose_neigh->count++; 181 + rose_neigh_hold(rose_neigh); 181 182 182 183 goto out; 183 184 } ··· 188 187 rose_node->neighbour[rose_node->count] = rose_neigh; 189 188 rose_node->count++; 190 189 rose_neigh->count++; 190 + rose_neigh_hold(rose_neigh); 191 191 } 192 192 193 193 out: ··· 236 234 237 235 if ((s = rose_neigh_list) == rose_neigh) { 238 236 rose_neigh_list = rose_neigh->next; 239 - if (rose_neigh->ax25) 240 - ax25_cb_put(rose_neigh->ax25); 241 - kfree(rose_neigh->digipeat); 242 - kfree(rose_neigh); 243 237 return; 244 238 } 245 239 246 240 while (s != NULL && s->next != NULL) { 247 241 if (s->next == rose_neigh) { 248 242 s->next = rose_neigh->next; 249 - if (rose_neigh->ax25) 250 - ax25_cb_put(rose_neigh->ax25); 251 - kfree(rose_neigh->digipeat); 252 - kfree(rose_neigh); 253 243 return; 254 244 } 255 245 ··· 257 263 struct rose_route *s; 258 264 259 265 if (rose_route->neigh1 != NULL) 260 - rose_route->neigh1->use--; 266 + rose_neigh_put(rose_route->neigh1); 261 267 262 268 if (rose_route->neigh2 != NULL) 263 - rose_route->neigh2->use--; 269 + rose_neigh_put(rose_route->neigh2); 264 270 265 271 if ((s = rose_route_list) == rose_route) { 266 272 rose_route_list = rose_route->next; ··· 324 330 for (i = 0; i < rose_node->count; i++) { 325 331 if (rose_node->neighbour[i] == rose_neigh) { 326 332 rose_neigh->count--; 333 + rose_neigh_put(rose_neigh); 327 334 328 - if (rose_neigh->count == 0 && rose_neigh->use == 0) 335 + if (rose_neigh->count == 0) { 329 336 rose_remove_neigh(rose_neigh); 337 + rose_neigh_put(rose_neigh); 338 + } 330 339 331 340 rose_node->count--; 332 341 ··· 378 381 sn->ax25 = NULL; 379 382 sn->dev = NULL; 380 383 sn->count = 0; 381 - sn->use = 0; 382 384 sn->dce_mode = 1; 383 385 sn->loopback = 1; 384 386 sn->number = rose_neigh_no++; 385 387 sn->restarted = 1; 388 + refcount_set(&sn->use, 1); 386 389 387 390 skb_queue_head_init(&sn->queue); 388 391 ··· 433 436 rose_node_list = rose_node; 434 437 435 438 rose_loopback_neigh->count++; 439 + rose_neigh_hold(rose_loopback_neigh); 436 440 437 441 out: 438 442 spin_unlock_bh(&rose_node_list_lock); ··· 465 467 rose_remove_node(rose_node); 466 468 467 469 rose_loopback_neigh->count--; 470 + rose_neigh_put(rose_loopback_neigh); 468 471 469 472 out: 470 473 spin_unlock_bh(&rose_node_list_lock); ··· 505 506 memmove(&t->neighbour[i], &t->neighbour[i + 1], 506 507 sizeof(t->neighbour[0]) * 507 508 (t->count - i)); 509 + rose_neigh_put(s); 508 510 } 509 511 510 512 if (t->count <= 0) ··· 513 513 } 514 514 515 515 rose_remove_neigh(s); 516 + rose_neigh_put(s); 516 517 } 517 518 spin_unlock_bh(&rose_neigh_list_lock); 518 519 spin_unlock_bh(&rose_node_list_lock); ··· 549 548 { 550 549 struct rose_neigh *s, *rose_neigh; 551 550 struct rose_node *t, *rose_node; 551 + int i; 552 552 553 553 spin_lock_bh(&rose_node_list_lock); 554 554 spin_lock_bh(&rose_neigh_list_lock); ··· 560 558 while (rose_node != NULL) { 561 559 t = rose_node; 562 560 rose_node = rose_node->next; 563 - if (!t->loopback) 561 + 562 + if (!t->loopback) { 563 + for (i = 0; i < t->count; i++) 564 + rose_neigh_put(t->neighbour[i]); 564 565 rose_remove_node(t); 566 + } 565 567 } 566 568 567 569 while (rose_neigh != NULL) { 568 570 s = rose_neigh; 569 571 rose_neigh = rose_neigh->next; 570 572 571 - if (s->use == 0 && !s->loopback) { 572 - s->count = 0; 573 + if (!s->loopback) { 573 574 rose_remove_neigh(s); 575 + rose_neigh_put(s); 574 576 } 575 577 } 576 578 ··· 690 684 for (i = 0; i < node->count; i++) { 691 685 if (node->neighbour[i]->restarted) { 692 686 res = node->neighbour[i]; 687 + rose_neigh_hold(node->neighbour[i]); 693 688 goto out; 694 689 } 695 690 } ··· 702 695 for (i = 0; i < node->count; i++) { 703 696 if (!rose_ftimer_running(node->neighbour[i])) { 704 697 res = node->neighbour[i]; 698 + rose_neigh_hold(node->neighbour[i]); 705 699 goto out; 706 700 } 707 701 failed = 1; ··· 792 784 } 793 785 794 786 if (rose_route->neigh1 == rose_neigh) { 795 - rose_route->neigh1->use--; 787 + rose_neigh_put(rose_route->neigh1); 796 788 rose_route->neigh1 = NULL; 797 789 rose_transmit_clear_request(rose_route->neigh2, rose_route->lci2, ROSE_OUT_OF_ORDER, 0); 798 790 } 799 791 800 792 if (rose_route->neigh2 == rose_neigh) { 801 - rose_route->neigh2->use--; 793 + rose_neigh_put(rose_route->neigh2); 802 794 rose_route->neigh2 = NULL; 803 795 rose_transmit_clear_request(rose_route->neigh1, rose_route->lci1, ROSE_OUT_OF_ORDER, 0); 804 796 } ··· 927 919 rose_clear_queues(sk); 928 920 rose->cause = ROSE_NETWORK_CONGESTION; 929 921 rose->diagnostic = 0; 930 - rose->neighbour->use--; 922 + rose_neigh_put(rose->neighbour); 931 923 rose->neighbour = NULL; 932 924 rose->lci = 0; 933 925 rose->state = ROSE_STATE_0; ··· 1052 1044 1053 1045 if ((new_lci = rose_new_lci(new_neigh)) == 0) { 1054 1046 rose_transmit_clear_request(rose_neigh, lci, ROSE_NETWORK_CONGESTION, 71); 1055 - goto out; 1047 + goto put_neigh; 1056 1048 } 1057 1049 1058 1050 if ((rose_route = kmalloc(sizeof(*rose_route), GFP_ATOMIC)) == NULL) { 1059 1051 rose_transmit_clear_request(rose_neigh, lci, ROSE_NETWORK_CONGESTION, 120); 1060 - goto out; 1052 + goto put_neigh; 1061 1053 } 1062 1054 1063 1055 rose_route->lci1 = lci; ··· 1070 1062 rose_route->lci2 = new_lci; 1071 1063 rose_route->neigh2 = new_neigh; 1072 1064 1073 - rose_route->neigh1->use++; 1074 - rose_route->neigh2->use++; 1065 + rose_neigh_hold(rose_route->neigh1); 1066 + rose_neigh_hold(rose_route->neigh2); 1075 1067 1076 1068 rose_route->next = rose_route_list; 1077 1069 rose_route_list = rose_route; ··· 1083 1075 rose_transmit_link(skb, rose_route->neigh2); 1084 1076 res = 1; 1085 1077 1078 + put_neigh: 1079 + rose_neigh_put(new_neigh); 1086 1080 out: 1087 1081 spin_unlock_bh(&rose_route_list_lock); 1088 1082 spin_unlock_bh(&rose_neigh_list_lock); ··· 1200 1190 (rose_neigh->loopback) ? "RSLOOP-0" : ax2asc(buf, &rose_neigh->callsign), 1201 1191 rose_neigh->dev ? rose_neigh->dev->name : "???", 1202 1192 rose_neigh->count, 1203 - rose_neigh->use, 1193 + refcount_read(&rose_neigh->use) - rose_neigh->count - 1, 1204 1194 (rose_neigh->dce_mode) ? "DCE" : "DTE", 1205 1195 (rose_neigh->restarted) ? "yes" : "no", 1206 1196 ax25_display_timer(&rose_neigh->t0timer) / HZ, ··· 1305 1295 struct rose_neigh *s, *rose_neigh = rose_neigh_list; 1306 1296 struct rose_node *t, *rose_node = rose_node_list; 1307 1297 struct rose_route *u, *rose_route = rose_route_list; 1298 + int i; 1308 1299 1309 1300 while (rose_neigh != NULL) { 1310 1301 s = rose_neigh; 1311 1302 rose_neigh = rose_neigh->next; 1312 1303 1313 1304 rose_remove_neigh(s); 1305 + rose_neigh_put(s); 1314 1306 } 1315 1307 1316 1308 while (rose_node != NULL) { 1317 1309 t = rose_node; 1318 1310 rose_node = rose_node->next; 1319 1311 1312 + for (i = 0; i < t->count; i++) 1313 + rose_neigh_put(t->neighbour[i]); 1320 1314 rose_remove_node(t); 1321 1315 } 1322 1316
+1 -1
net/rose/rose_timer.c
··· 180 180 break; 181 181 182 182 case ROSE_STATE_2: /* T3 */ 183 - rose->neighbour->use--; 183 + rose_neigh_put(rose->neighbour); 184 184 rose_disconnect(sk, ETIMEDOUT, -1, -1); 185 185 break; 186 186
+2
net/sctp/ipv6.c
··· 547 547 { 548 548 addr->v6.sin6_family = AF_INET6; 549 549 addr->v6.sin6_port = 0; 550 + addr->v6.sin6_flowinfo = 0; 550 551 addr->v6.sin6_addr = sk->sk_v6_rcv_saddr; 552 + addr->v6.sin6_scope_id = 0; 551 553 } 552 554 553 555 /* Initialize sk->sk_rcv_saddr from sctp_addr. */
+5 -3
net/vmw_vsock/virtio_transport_common.c
··· 105 105 size_t len, 106 106 bool zcopy) 107 107 { 108 + struct msghdr *msg = info->msg; 109 + 108 110 if (zcopy) 109 - return __zerocopy_sg_from_iter(info->msg, NULL, skb, 110 - &info->msg->msg_iter, len, NULL); 111 + return __zerocopy_sg_from_iter(msg, NULL, skb, 112 + &msg->msg_iter, len, NULL); 111 113 112 114 virtio_vsock_skb_put(skb, len); 113 - return skb_copy_datagram_from_iter(skb, 0, &info->msg->msg_iter, len); 115 + return skb_copy_datagram_from_iter_full(skb, 0, &msg->msg_iter, len); 114 116 } 115 117 116 118 static void virtio_transport_init_hdr(struct sk_buff *skb,