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

Configure Feed

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

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

Pull networking fixes from David Miller:

1) Need to take mutex in ath9k_add_interface(), from Dan Carpenter.

2) Fix mt76 build without CONFIG_LEDS_CLASS, from Arnd Bergmann.

3) Fix socket wmem accounting in SCTP, from Xin Long.

4) Fix failed resume crash in ena driver, from Arthur Kiyanovski.

5) qed driver passes bytes instead of bits into second arg of
bitmap_weight(). From Denis Bolotin.

6) Fix reset deadlock in ibmvnic, from Juliet Kim.

7) skb_scrube_packet() needs to scrub the fwd marks too, from Petr
Machata.

8) Make sure older TCP stacks see enough dup ACKs, and avoid doing SACK
compression during this period, from Eric Dumazet.

9) Add atomicity to SMC protocol cursor handling, from Ursula Braun.

10) Don't leave dangling error pointer if bpf_prog_add() fails in
thunderx driver, from Lorenzo Bianconi. Also, when we unmap TSO
headers, set sq->tso_hdrs to NULL.

11) Fix race condition over state variables in act_police, from Davide
Caratti.

12) Disable guest csum in the presence of XDP in virtio_net, from Jason
Wang.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (64 commits)
net: gemini: Fix copy/paste error
net: phy: mscc: fix deadlock in vsc85xx_default_config
dt-bindings: dsa: Fix typo in "probed"
net: thunderx: set tso_hdrs pointer to NULL in nicvf_free_snd_queue
net: amd: add missing of_node_put()
team: no need to do team_notify_peers or team_mcast_rejoin when disabling port
virtio-net: fail XDP set if guest csum is negotiated
virtio-net: disable guest csum during XDP set
net/sched: act_police: add missing spinlock initialization
net: don't keep lonely packets forever in the gro hash
net/ipv6: re-do dad when interface has IFF_NOARP flag change
packet: copy user buffers before orphan or clone
ibmvnic: Update driver queues after change in ring size support
ibmvnic: Fix RX queue buffer cleanup
net: thunderx: set xdp_prog to NULL if bpf_prog_add fails
net/dim: Update DIM start sample after each DIM iteration
net: faraday: ftmac100: remove netif_running(netdev) check before disabling interrupts
net/smc: use after free fix in smc_wr_tx_put_slot()
net/smc: atomic SMCD cursor handling
net/smc: add SMC-D shutdown signal
...

+537 -335
+1 -1
Documentation/devicetree/bindings/net/dsa/dsa.txt
··· 7 7 Current Binding 8 8 --------------- 9 9 10 - Switches are true Linux devices and can be probes by any means. Once 10 + Switches are true Linux devices and can be probed by any means. Once 11 11 probed, they register to the DSA framework, passing a node 12 12 pointer. This node is expected to fulfil the following binding, and 13 13 may contain additional properties as required by the device it is
+2
MAINTAINERS
··· 180 180 181 181 8169 10/100/1000 GIGABIT ETHERNET DRIVER 182 182 M: Realtek linux nic maintainers <nic_swsd@realtek.com> 183 + M: Heiner Kallweit <hkallweit1@gmail.com> 183 184 L: netdev@vger.kernel.org 184 185 S: Maintained 185 186 F: drivers/net/ethernet/realtek/r8169.c ··· 5535 5534 ETHERNET PHY LIBRARY 5536 5535 M: Andrew Lunn <andrew@lunn.ch> 5537 5536 M: Florian Fainelli <f.fainelli@gmail.com> 5537 + M: Heiner Kallweit <hkallweit1@gmail.com> 5538 5538 L: netdev@vger.kernel.org 5539 5539 S: Maintained 5540 5540 F: Documentation/ABI/testing/sysfs-bus-mdio
+11 -12
drivers/net/ethernet/amazon/ena/ena_netdev.c
··· 1848 1848 rc = ena_com_dev_reset(adapter->ena_dev, adapter->reset_reason); 1849 1849 if (rc) 1850 1850 dev_err(&adapter->pdev->dev, "Device reset failed\n"); 1851 + /* stop submitting admin commands on a device that was reset */ 1852 + ena_com_set_admin_running_state(adapter->ena_dev, false); 1851 1853 } 1852 1854 1853 1855 ena_destroy_all_io_queues(adapter); ··· 1915 1913 struct ena_adapter *adapter = netdev_priv(netdev); 1916 1914 1917 1915 netif_dbg(adapter, ifdown, netdev, "%s\n", __func__); 1916 + 1917 + if (!test_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags)) 1918 + return 0; 1918 1919 1919 1920 if (test_bit(ENA_FLAG_DEV_UP, &adapter->flags)) 1920 1921 ena_down(adapter); ··· 2618 2613 ena_down(adapter); 2619 2614 2620 2615 /* Stop the device from sending AENQ events (in case reset flag is set 2621 - * and device is up, ena_close already reset the device 2622 - * In case the reset flag is set and the device is up, ena_down() 2623 - * already perform the reset, so it can be skipped. 2616 + * and device is up, ena_down() already reset the device. 2624 2617 */ 2625 2618 if (!(test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags) && dev_up)) 2626 2619 ena_com_dev_reset(adapter->ena_dev, adapter->reset_reason); ··· 2697 2694 ena_com_abort_admin_commands(ena_dev); 2698 2695 ena_com_wait_for_abort_completion(ena_dev); 2699 2696 ena_com_admin_destroy(ena_dev); 2700 - ena_com_mmio_reg_read_request_destroy(ena_dev); 2701 2697 ena_com_dev_reset(ena_dev, ENA_REGS_RESET_DRIVER_INVALID_STATE); 2698 + ena_com_mmio_reg_read_request_destroy(ena_dev); 2702 2699 err: 2703 2700 clear_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags); 2704 2701 clear_bit(ENA_FLAG_ONGOING_RESET, &adapter->flags); ··· 3455 3452 ena_com_rss_destroy(ena_dev); 3456 3453 err_free_msix: 3457 3454 ena_com_dev_reset(ena_dev, ENA_REGS_RESET_INIT_ERR); 3455 + /* stop submitting admin commands on a device that was reset */ 3456 + ena_com_set_admin_running_state(ena_dev, false); 3458 3457 ena_free_mgmnt_irq(adapter); 3459 3458 ena_disable_msix(adapter); 3460 3459 err_worker_destroy: ··· 3503 3498 3504 3499 cancel_work_sync(&adapter->reset_task); 3505 3500 3506 - unregister_netdev(netdev); 3507 - 3508 - /* If the device is running then we want to make sure the device will be 3509 - * reset to make sure no more events will be issued by the device. 3510 - */ 3511 - if (test_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags)) 3512 - set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags); 3513 - 3514 3501 rtnl_lock(); 3515 3502 ena_destroy_device(adapter, true); 3516 3503 rtnl_unlock(); 3504 + 3505 + unregister_netdev(netdev); 3517 3506 3518 3507 free_netdev(netdev); 3519 3508
+1 -1
drivers/net/ethernet/amazon/ena/ena_netdev.h
··· 45 45 46 46 #define DRV_MODULE_VER_MAJOR 2 47 47 #define DRV_MODULE_VER_MINOR 0 48 - #define DRV_MODULE_VER_SUBMINOR 1 48 + #define DRV_MODULE_VER_SUBMINOR 2 49 49 50 50 #define DRV_MODULE_NAME "ena" 51 51 #ifndef DRV_MODULE_VERSION
+3 -1
drivers/net/ethernet/amd/sunlance.c
··· 1419 1419 1420 1420 prop = of_get_property(nd, "tpe-link-test?", NULL); 1421 1421 if (!prop) 1422 - goto no_link_test; 1422 + goto node_put; 1423 1423 1424 1424 if (strcmp(prop, "true")) { 1425 1425 printk(KERN_NOTICE "SunLance: warning: overriding option " ··· 1428 1428 "to ecd@skynet.be\n"); 1429 1429 auxio_set_lte(AUXIO_LTE_ON); 1430 1430 } 1431 + node_put: 1432 + of_node_put(nd); 1431 1433 no_link_test: 1432 1434 lp->auto_select = 1; 1433 1435 lp->tpe = 0;
+16 -2
drivers/net/ethernet/broadcom/tg3.c
··· 12422 12422 { 12423 12423 struct tg3 *tp = netdev_priv(dev); 12424 12424 int i, irq_sync = 0, err = 0; 12425 + bool reset_phy = false; 12425 12426 12426 12427 if ((ering->rx_pending > tp->rx_std_ring_mask) || 12427 12428 (ering->rx_jumbo_pending > tp->rx_jmb_ring_mask) || ··· 12454 12453 12455 12454 if (netif_running(dev)) { 12456 12455 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 12457 - err = tg3_restart_hw(tp, false); 12456 + /* Reset PHY to avoid PHY lock up */ 12457 + if (tg3_asic_rev(tp) == ASIC_REV_5717 || 12458 + tg3_asic_rev(tp) == ASIC_REV_5719 || 12459 + tg3_asic_rev(tp) == ASIC_REV_5720) 12460 + reset_phy = true; 12461 + 12462 + err = tg3_restart_hw(tp, reset_phy); 12458 12463 if (!err) 12459 12464 tg3_netif_start(tp); 12460 12465 } ··· 12494 12487 { 12495 12488 struct tg3 *tp = netdev_priv(dev); 12496 12489 int err = 0; 12490 + bool reset_phy = false; 12497 12491 12498 12492 if (tp->link_config.autoneg == AUTONEG_ENABLE) 12499 12493 tg3_warn_mgmt_link_flap(tp); ··· 12564 12556 12565 12557 if (netif_running(dev)) { 12566 12558 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 12567 - err = tg3_restart_hw(tp, false); 12559 + /* Reset PHY to avoid PHY lock up */ 12560 + if (tg3_asic_rev(tp) == ASIC_REV_5717 || 12561 + tg3_asic_rev(tp) == ASIC_REV_5719 || 12562 + tg3_asic_rev(tp) == ASIC_REV_5720) 12563 + reset_phy = true; 12564 + 12565 + err = tg3_restart_hw(tp, reset_phy); 12568 12566 if (!err) 12569 12567 tg3_netif_start(tp); 12570 12568 }
+7 -2
drivers/net/ethernet/cavium/thunder/nicvf_main.c
··· 1784 1784 bool if_up = netif_running(nic->netdev); 1785 1785 struct bpf_prog *old_prog; 1786 1786 bool bpf_attached = false; 1787 + int ret = 0; 1787 1788 1788 1789 /* For now just support only the usual MTU sized frames */ 1789 1790 if (prog && (dev->mtu > 1500)) { ··· 1818 1817 if (nic->xdp_prog) { 1819 1818 /* Attach BPF program */ 1820 1819 nic->xdp_prog = bpf_prog_add(nic->xdp_prog, nic->rx_queues - 1); 1821 - if (!IS_ERR(nic->xdp_prog)) 1820 + if (!IS_ERR(nic->xdp_prog)) { 1822 1821 bpf_attached = true; 1822 + } else { 1823 + ret = PTR_ERR(nic->xdp_prog); 1824 + nic->xdp_prog = NULL; 1825 + } 1823 1826 } 1824 1827 1825 1828 /* Calculate Tx queues needed for XDP and network stack */ ··· 1835 1830 netif_trans_update(nic->netdev); 1836 1831 } 1837 1832 1838 - return 0; 1833 + return ret; 1839 1834 } 1840 1835 1841 1836 static int nicvf_xdp(struct net_device *netdev, struct netdev_bpf *xdp)
+3 -1
drivers/net/ethernet/cavium/thunder/nicvf_queues.c
··· 585 585 if (!sq->dmem.base) 586 586 return; 587 587 588 - if (sq->tso_hdrs) 588 + if (sq->tso_hdrs) { 589 589 dma_free_coherent(&nic->pdev->dev, 590 590 sq->dmem.q_len * TSO_HEADER_SIZE, 591 591 sq->tso_hdrs, sq->tso_hdrs_phys); 592 + sq->tso_hdrs = NULL; 593 + } 592 594 593 595 /* Free pending skbs in the queue */ 594 596 smp_rmb();
+1 -1
drivers/net/ethernet/cortina/gemini.c
··· 660 660 661 661 u64_stats_update_begin(&port->tx_stats_syncp); 662 662 port->tx_frag_stats[nfrags]++; 663 - u64_stats_update_end(&port->ir_stats_syncp); 663 + u64_stats_update_end(&port->tx_stats_syncp); 664 664 } 665 665 } 666 666
+3 -4
drivers/net/ethernet/faraday/ftmac100.c
··· 872 872 struct net_device *netdev = dev_id; 873 873 struct ftmac100 *priv = netdev_priv(netdev); 874 874 875 - if (likely(netif_running(netdev))) { 876 - /* Disable interrupts for polling */ 877 - ftmac100_disable_all_int(priv); 875 + /* Disable interrupts for polling */ 876 + ftmac100_disable_all_int(priv); 877 + if (likely(netif_running(netdev))) 878 878 napi_schedule(&priv->napi); 879 - } 880 879 881 880 return IRQ_HANDLED; 882 881 }
+31 -41
drivers/net/ethernet/ibm/ibmvnic.c
··· 485 485 486 486 for (j = 0; j < rx_pool->size; j++) { 487 487 if (rx_pool->rx_buff[j].skb) { 488 - dev_kfree_skb_any(rx_pool->rx_buff[i].skb); 489 - rx_pool->rx_buff[i].skb = NULL; 488 + dev_kfree_skb_any(rx_pool->rx_buff[j].skb); 489 + rx_pool->rx_buff[j].skb = NULL; 490 490 } 491 491 } 492 492 ··· 1103 1103 return 0; 1104 1104 } 1105 1105 1106 - mutex_lock(&adapter->reset_lock); 1107 - 1108 1106 if (adapter->state != VNIC_CLOSED) { 1109 1107 rc = ibmvnic_login(netdev); 1110 - if (rc) { 1111 - mutex_unlock(&adapter->reset_lock); 1108 + if (rc) 1112 1109 return rc; 1113 - } 1114 1110 1115 1111 rc = init_resources(adapter); 1116 1112 if (rc) { 1117 1113 netdev_err(netdev, "failed to initialize resources\n"); 1118 1114 release_resources(adapter); 1119 - mutex_unlock(&adapter->reset_lock); 1120 1115 return rc; 1121 1116 } 1122 1117 } 1123 1118 1124 1119 rc = __ibmvnic_open(netdev); 1125 1120 netif_carrier_on(netdev); 1126 - 1127 - mutex_unlock(&adapter->reset_lock); 1128 1121 1129 1122 return rc; 1130 1123 } ··· 1262 1269 return 0; 1263 1270 } 1264 1271 1265 - mutex_lock(&adapter->reset_lock); 1266 1272 rc = __ibmvnic_close(netdev); 1267 1273 ibmvnic_cleanup(netdev); 1268 - mutex_unlock(&adapter->reset_lock); 1269 1274 1270 1275 return rc; 1271 1276 } ··· 1737 1746 struct ibmvnic_rwi *rwi, u32 reset_state) 1738 1747 { 1739 1748 u64 old_num_rx_queues, old_num_tx_queues; 1749 + u64 old_num_rx_slots, old_num_tx_slots; 1740 1750 struct net_device *netdev = adapter->netdev; 1741 1751 int i, rc; 1742 1752 ··· 1749 1757 1750 1758 old_num_rx_queues = adapter->req_rx_queues; 1751 1759 old_num_tx_queues = adapter->req_tx_queues; 1760 + old_num_rx_slots = adapter->req_rx_add_entries_per_subcrq; 1761 + old_num_tx_slots = adapter->req_tx_entries_per_subcrq; 1752 1762 1753 1763 ibmvnic_cleanup(netdev); 1754 1764 ··· 1813 1819 if (rc) 1814 1820 return rc; 1815 1821 } else if (adapter->req_rx_queues != old_num_rx_queues || 1816 - adapter->req_tx_queues != old_num_tx_queues) { 1817 - adapter->map_id = 1; 1822 + adapter->req_tx_queues != old_num_tx_queues || 1823 + adapter->req_rx_add_entries_per_subcrq != 1824 + old_num_rx_slots || 1825 + adapter->req_tx_entries_per_subcrq != 1826 + old_num_tx_slots) { 1818 1827 release_rx_pools(adapter); 1819 1828 release_tx_pools(adapter); 1820 - rc = init_rx_pools(netdev); 1821 - if (rc) 1822 - return rc; 1823 - rc = init_tx_pools(netdev); 1829 + release_napi(adapter); 1830 + release_vpd_data(adapter); 1831 + 1832 + rc = init_resources(adapter); 1824 1833 if (rc) 1825 1834 return rc; 1826 1835 1827 - release_napi(adapter); 1828 - rc = init_napi(adapter); 1829 - if (rc) 1830 - return rc; 1831 1836 } else { 1832 1837 rc = reset_tx_pools(adapter); 1833 1838 if (rc) ··· 1910 1917 adapter->state = VNIC_PROBED; 1911 1918 return 0; 1912 1919 } 1913 - /* netif_set_real_num_xx_queues needs to take rtnl lock here 1914 - * unless wait_for_reset is set, in which case the rtnl lock 1915 - * has already been taken before initializing the reset 1916 - */ 1917 - if (!adapter->wait_for_reset) { 1918 - rtnl_lock(); 1919 - rc = init_resources(adapter); 1920 - rtnl_unlock(); 1921 - } else { 1922 - rc = init_resources(adapter); 1923 - } 1920 + 1921 + rc = init_resources(adapter); 1924 1922 if (rc) 1925 1923 return rc; 1926 1924 ··· 1970 1986 struct ibmvnic_rwi *rwi; 1971 1987 struct ibmvnic_adapter *adapter; 1972 1988 struct net_device *netdev; 1989 + bool we_lock_rtnl = false; 1973 1990 u32 reset_state; 1974 1991 int rc = 0; 1975 1992 1976 1993 adapter = container_of(work, struct ibmvnic_adapter, ibmvnic_reset); 1977 1994 netdev = adapter->netdev; 1978 1995 1979 - mutex_lock(&adapter->reset_lock); 1996 + /* netif_set_real_num_xx_queues needs to take rtnl lock here 1997 + * unless wait_for_reset is set, in which case the rtnl lock 1998 + * has already been taken before initializing the reset 1999 + */ 2000 + if (!adapter->wait_for_reset) { 2001 + rtnl_lock(); 2002 + we_lock_rtnl = true; 2003 + } 1980 2004 reset_state = adapter->state; 1981 2005 1982 2006 rwi = get_next_rwi(adapter); ··· 2012 2020 if (rc) { 2013 2021 netdev_dbg(adapter->netdev, "Reset failed\n"); 2014 2022 free_all_rwi(adapter); 2015 - mutex_unlock(&adapter->reset_lock); 2016 - return; 2017 2023 } 2018 2024 2019 2025 adapter->resetting = false; 2020 - mutex_unlock(&adapter->reset_lock); 2026 + if (we_lock_rtnl) 2027 + rtnl_unlock(); 2021 2028 } 2022 2029 2023 2030 static int ibmvnic_reset(struct ibmvnic_adapter *adapter, ··· 4759 4768 4760 4769 INIT_WORK(&adapter->ibmvnic_reset, __ibmvnic_reset); 4761 4770 INIT_LIST_HEAD(&adapter->rwi_list); 4762 - mutex_init(&adapter->reset_lock); 4763 4771 mutex_init(&adapter->rwi_lock); 4764 4772 adapter->resetting = false; 4765 4773 ··· 4830 4840 struct ibmvnic_adapter *adapter = netdev_priv(netdev); 4831 4841 4832 4842 adapter->state = VNIC_REMOVING; 4833 - unregister_netdev(netdev); 4834 - mutex_lock(&adapter->reset_lock); 4843 + rtnl_lock(); 4844 + unregister_netdevice(netdev); 4835 4845 4836 4846 release_resources(adapter); 4837 4847 release_sub_crqs(adapter, 1); ··· 4842 4852 4843 4853 adapter->state = VNIC_REMOVED; 4844 4854 4845 - mutex_unlock(&adapter->reset_lock); 4855 + rtnl_unlock(); 4846 4856 device_remove_file(&dev->dev, &dev_attr_failover); 4847 4857 free_netdev(netdev); 4848 4858 dev_set_drvdata(&dev->dev, NULL);
+1 -1
drivers/net/ethernet/ibm/ibmvnic.h
··· 1075 1075 struct tasklet_struct tasklet; 1076 1076 enum vnic_state state; 1077 1077 enum ibmvnic_reset_reason reset_reason; 1078 - struct mutex reset_lock, rwi_lock; 1078 + struct mutex rwi_lock; 1079 1079 struct list_head rwi_list; 1080 1080 struct work_struct ibmvnic_reset; 1081 1081 bool resetting;
+1
drivers/net/ethernet/mellanox/mlx5/core/en.h
··· 569 569 570 570 unsigned long state; 571 571 int ix; 572 + unsigned int hw_mtu; 572 573 573 574 struct net_dim dim; /* Dynamic Interrupt Moderation */ 574 575
+15 -21
drivers/net/ethernet/mellanox/mlx5/core/en/port.c
··· 88 88 89 89 eth_proto_oper = MLX5_GET(ptys_reg, out, eth_proto_oper); 90 90 *speed = mlx5e_port_ptys2speed(eth_proto_oper); 91 - if (!(*speed)) { 92 - mlx5_core_warn(mdev, "cannot get port speed\n"); 91 + if (!(*speed)) 93 92 err = -EINVAL; 94 - } 95 93 96 94 return err; 97 95 } ··· 256 258 case 40000: 257 259 if (!write) 258 260 *fec_policy = MLX5_GET(pplm_reg, pplm, 259 - fec_override_cap_10g_40g); 261 + fec_override_admin_10g_40g); 260 262 else 261 263 MLX5_SET(pplm_reg, pplm, 262 264 fec_override_admin_10g_40g, *fec_policy); ··· 308 310 case 10000: 309 311 case 40000: 310 312 *fec_cap = MLX5_GET(pplm_reg, pplm, 311 - fec_override_admin_10g_40g); 313 + fec_override_cap_10g_40g); 312 314 break; 313 315 case 25000: 314 316 *fec_cap = MLX5_GET(pplm_reg, pplm, ··· 392 394 393 395 int mlx5e_set_fec_mode(struct mlx5_core_dev *dev, u8 fec_policy) 394 396 { 397 + u8 fec_policy_nofec = BIT(MLX5E_FEC_NOFEC); 395 398 bool fec_mode_not_supp_in_speed = false; 396 - u8 no_fec_policy = BIT(MLX5E_FEC_NOFEC); 397 399 u32 out[MLX5_ST_SZ_DW(pplm_reg)] = {}; 398 400 u32 in[MLX5_ST_SZ_DW(pplm_reg)] = {}; 399 401 int sz = MLX5_ST_SZ_BYTES(pplm_reg); 400 - u32 current_fec_speed; 402 + u8 fec_policy_auto = 0; 401 403 u8 fec_caps = 0; 402 404 int err; 403 405 int i; ··· 413 415 if (err) 414 416 return err; 415 417 416 - err = mlx5e_port_linkspeed(dev, &current_fec_speed); 417 - if (err) 418 - return err; 418 + MLX5_SET(pplm_reg, out, local_port, 1); 419 419 420 - memset(in, 0, sz); 421 - MLX5_SET(pplm_reg, in, local_port, 1); 422 - for (i = 0; i < MLX5E_FEC_SUPPORTED_SPEEDS && !!fec_policy; i++) { 420 + for (i = 0; i < MLX5E_FEC_SUPPORTED_SPEEDS; i++) { 423 421 mlx5e_get_fec_cap_field(out, &fec_caps, fec_supported_speeds[i]); 424 - /* policy supported for link speed */ 425 - if (!!(fec_caps & fec_policy)) { 426 - mlx5e_fec_admin_field(in, &fec_policy, 1, 422 + /* policy supported for link speed, or policy is auto */ 423 + if (fec_caps & fec_policy || fec_policy == fec_policy_auto) { 424 + mlx5e_fec_admin_field(out, &fec_policy, 1, 427 425 fec_supported_speeds[i]); 428 426 } else { 429 - if (fec_supported_speeds[i] == current_fec_speed) 430 - return -EOPNOTSUPP; 431 - mlx5e_fec_admin_field(in, &no_fec_policy, 1, 432 - fec_supported_speeds[i]); 427 + /* turn off FEC if supported. Else, leave it the same */ 428 + if (fec_caps & fec_policy_nofec) 429 + mlx5e_fec_admin_field(out, &fec_policy_nofec, 1, 430 + fec_supported_speeds[i]); 433 431 fec_mode_not_supp_in_speed = true; 434 432 } 435 433 } ··· 435 441 "FEC policy 0x%x is not supported for some speeds", 436 442 fec_policy); 437 443 438 - return mlx5_core_access_reg(dev, in, sz, out, sz, MLX5_REG_PPLM, 0, 1); 444 + return mlx5_core_access_reg(dev, out, sz, out, sz, MLX5_REG_PPLM, 0, 1); 439 445 }
+3 -1
drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c
··· 130 130 int err; 131 131 132 132 err = mlx5e_port_linkspeed(priv->mdev, &speed); 133 - if (err) 133 + if (err) { 134 + mlx5_core_warn(priv->mdev, "cannot get port speed\n"); 134 135 return 0; 136 + } 135 137 136 138 xoff = (301 + 216 * priv->dcbx.cable_len / 100) * speed / 1000 + 272 * mtu / 100; 137 139
+1 -2
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
··· 843 843 ethtool_link_ksettings_add_link_mode(link_ksettings, supported, 844 844 Autoneg); 845 845 846 - err = get_fec_supported_advertised(mdev, link_ksettings); 847 - if (err) 846 + if (get_fec_supported_advertised(mdev, link_ksettings)) 848 847 netdev_dbg(netdev, "%s: FEC caps query failed: %d\n", 849 848 __func__, err); 850 849
+31 -6
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 502 502 rq->channel = c; 503 503 rq->ix = c->ix; 504 504 rq->mdev = mdev; 505 + rq->hw_mtu = MLX5E_SW2HW_MTU(params, params->sw_mtu); 505 506 rq->stats = &c->priv->channel_stats[c->ix].rq; 506 507 507 508 rq->xdp_prog = params->xdp_prog ? bpf_prog_inc(params->xdp_prog) : NULL; ··· 1624 1623 int err; 1625 1624 u32 i; 1626 1625 1626 + err = mlx5_vector2eqn(mdev, param->eq_ix, &eqn_not_used, &irqn); 1627 + if (err) 1628 + return err; 1629 + 1627 1630 err = mlx5_cqwq_create(mdev, &param->wq, param->cqc, &cq->wq, 1628 1631 &cq->wq_ctrl); 1629 1632 if (err) 1630 1633 return err; 1631 - 1632 - mlx5_vector2eqn(mdev, param->eq_ix, &eqn_not_used, &irqn); 1633 1634 1634 1635 mcq->cqe_sz = 64; 1635 1636 mcq->set_ci_db = cq->wq_ctrl.db.db; ··· 1690 1687 int eqn; 1691 1688 int err; 1692 1689 1690 + err = mlx5_vector2eqn(mdev, param->eq_ix, &eqn, &irqn_not_used); 1691 + if (err) 1692 + return err; 1693 + 1693 1694 inlen = MLX5_ST_SZ_BYTES(create_cq_in) + 1694 1695 sizeof(u64) * cq->wq_ctrl.buf.npages; 1695 1696 in = kvzalloc(inlen, GFP_KERNEL); ··· 1706 1699 1707 1700 mlx5_fill_page_frag_array(&cq->wq_ctrl.buf, 1708 1701 (__be64 *)MLX5_ADDR_OF(create_cq_in, in, pas)); 1709 - 1710 - mlx5_vector2eqn(mdev, param->eq_ix, &eqn, &irqn_not_used); 1711 1702 1712 1703 MLX5_SET(cqc, cqc, cq_period_mode, param->cq_period_mode); 1713 1704 MLX5_SET(cqc, cqc, c_eqn, eqn); ··· 1926 1921 int err; 1927 1922 int eqn; 1928 1923 1924 + err = mlx5_vector2eqn(priv->mdev, ix, &eqn, &irq); 1925 + if (err) 1926 + return err; 1927 + 1929 1928 c = kvzalloc_node(sizeof(*c), GFP_KERNEL, cpu_to_node(cpu)); 1930 1929 if (!c) 1931 1930 return -ENOMEM; ··· 1946 1937 c->xdp = !!params->xdp_prog; 1947 1938 c->stats = &priv->channel_stats[ix].ch; 1948 1939 1949 - mlx5_vector2eqn(priv->mdev, ix, &eqn, &irq); 1950 1940 c->irq_desc = irq_to_desc(irq); 1951 1941 1952 1942 netif_napi_add(netdev, &c->napi, mlx5e_napi_poll, 64); ··· 3582 3574 return 0; 3583 3575 } 3584 3576 3577 + #ifdef CONFIG_MLX5_ESWITCH 3585 3578 static int set_feature_tc_num_filters(struct net_device *netdev, bool enable) 3586 3579 { 3587 3580 struct mlx5e_priv *priv = netdev_priv(netdev); ··· 3595 3586 3596 3587 return 0; 3597 3588 } 3589 + #endif 3598 3590 3599 3591 static int set_feature_rx_all(struct net_device *netdev, bool enable) 3600 3592 { ··· 3694 3684 err |= MLX5E_HANDLE_FEATURE(NETIF_F_LRO, set_feature_lro); 3695 3685 err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_VLAN_CTAG_FILTER, 3696 3686 set_feature_cvlan_filter); 3687 + #ifdef CONFIG_MLX5_ESWITCH 3697 3688 err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_TC, set_feature_tc_num_filters); 3689 + #endif 3698 3690 err |= MLX5E_HANDLE_FEATURE(NETIF_F_RXALL, set_feature_rx_all); 3699 3691 err |= MLX5E_HANDLE_FEATURE(NETIF_F_RXFCS, set_feature_rx_fcs); 3700 3692 err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_VLAN_CTAG_RX, set_feature_rx_vlan); ··· 3767 3755 } 3768 3756 3769 3757 if (params->rq_wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ) { 3758 + bool is_linear = mlx5e_rx_mpwqe_is_linear_skb(priv->mdev, &new_channels.params); 3770 3759 u8 ppw_old = mlx5e_mpwqe_log_pkts_per_wqe(params); 3771 3760 u8 ppw_new = mlx5e_mpwqe_log_pkts_per_wqe(&new_channels.params); 3772 3761 3773 - reset = reset && (ppw_old != ppw_new); 3762 + reset = reset && (is_linear || (ppw_old != ppw_new)); 3774 3763 } 3775 3764 3776 3765 if (!reset) { ··· 4691 4678 FT_CAP(modify_root) && 4692 4679 FT_CAP(identified_miss_table_mode) && 4693 4680 FT_CAP(flow_table_modify)) { 4681 + #ifdef CONFIG_MLX5_ESWITCH 4694 4682 netdev->hw_features |= NETIF_F_HW_TC; 4683 + #endif 4695 4684 #ifdef CONFIG_MLX5_EN_ARFS 4696 4685 netdev->hw_features |= NETIF_F_NTUPLE; 4697 4686 #endif ··· 5019 5004 int mlx5e_attach_netdev(struct mlx5e_priv *priv) 5020 5005 { 5021 5006 const struct mlx5e_profile *profile; 5007 + int max_nch; 5022 5008 int err; 5023 5009 5024 5010 profile = priv->profile; 5025 5011 clear_bit(MLX5E_STATE_DESTROYING, &priv->state); 5012 + 5013 + /* max number of channels may have changed */ 5014 + max_nch = mlx5e_get_max_num_channels(priv->mdev); 5015 + if (priv->channels.params.num_channels > max_nch) { 5016 + mlx5_core_warn(priv->mdev, "MLX5E: Reducing number of channels to %d\n", max_nch); 5017 + priv->channels.params.num_channels = max_nch; 5018 + mlx5e_build_default_indir_rqt(priv->channels.params.indirection_rqt, 5019 + MLX5E_INDIR_RQT_SIZE, max_nch); 5020 + } 5026 5021 5027 5022 err = profile->init_tx(priv); 5028 5023 if (err)
+6
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
··· 1104 1104 u32 frag_size; 1105 1105 bool consumed; 1106 1106 1107 + /* Check packet size. Note LRO doesn't use linear SKB */ 1108 + if (unlikely(cqe_bcnt > rq->hw_mtu)) { 1109 + rq->stats->oversize_pkts_sw_drop++; 1110 + return NULL; 1111 + } 1112 + 1107 1113 va = page_address(di->page) + head_offset; 1108 1114 data = va + rx_headroom; 1109 1115 frag_size = MLX5_SKB_FRAG_SZ(rx_headroom + cqe_bcnt32);
+10 -16
drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c
··· 98 98 return 1; 99 99 } 100 100 101 - #ifdef CONFIG_INET 102 - /* loopback test */ 103 - #define MLX5E_TEST_PKT_SIZE (MLX5E_RX_MAX_HEAD - NET_IP_ALIGN) 104 - static const char mlx5e_test_text[ETH_GSTRING_LEN] = "MLX5E SELF TEST"; 105 - #define MLX5E_TEST_MAGIC 0x5AEED15C001ULL 106 - 107 101 struct mlx5ehdr { 108 102 __be32 version; 109 103 __be64 magic; 110 - char text[ETH_GSTRING_LEN]; 111 104 }; 105 + 106 + #ifdef CONFIG_INET 107 + /* loopback test */ 108 + #define MLX5E_TEST_PKT_SIZE (sizeof(struct ethhdr) + sizeof(struct iphdr) +\ 109 + sizeof(struct udphdr) + sizeof(struct mlx5ehdr)) 110 + #define MLX5E_TEST_MAGIC 0x5AEED15C001ULL 112 111 113 112 static struct sk_buff *mlx5e_test_get_udp_skb(struct mlx5e_priv *priv) 114 113 { ··· 116 117 struct ethhdr *ethh; 117 118 struct udphdr *udph; 118 119 struct iphdr *iph; 119 - int datalen, iplen; 120 - 121 - datalen = MLX5E_TEST_PKT_SIZE - 122 - (sizeof(*ethh) + sizeof(*iph) + sizeof(*udph)); 120 + int iplen; 123 121 124 122 skb = netdev_alloc_skb(priv->netdev, MLX5E_TEST_PKT_SIZE); 125 123 if (!skb) { ··· 145 149 /* Fill UDP header */ 146 150 udph->source = htons(9); 147 151 udph->dest = htons(9); /* Discard Protocol */ 148 - udph->len = htons(datalen + sizeof(struct udphdr)); 152 + udph->len = htons(sizeof(struct mlx5ehdr) + sizeof(struct udphdr)); 149 153 udph->check = 0; 150 154 151 155 /* Fill IP header */ ··· 153 157 iph->ttl = 32; 154 158 iph->version = 4; 155 159 iph->protocol = IPPROTO_UDP; 156 - iplen = sizeof(struct iphdr) + sizeof(struct udphdr) + datalen; 160 + iplen = sizeof(struct iphdr) + sizeof(struct udphdr) + 161 + sizeof(struct mlx5ehdr); 157 162 iph->tot_len = htons(iplen); 158 163 iph->frag_off = 0; 159 164 iph->saddr = 0; ··· 167 170 mlxh = skb_put(skb, sizeof(*mlxh)); 168 171 mlxh->version = 0; 169 172 mlxh->magic = cpu_to_be64(MLX5E_TEST_MAGIC); 170 - strlcpy(mlxh->text, mlx5e_test_text, sizeof(mlxh->text)); 171 - datalen -= sizeof(*mlxh); 172 - skb_put_zero(skb, datalen); 173 173 174 174 skb->csum = 0; 175 175 skb->ip_summed = CHECKSUM_PARTIAL;
+3
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
··· 83 83 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_wqe_err) }, 84 84 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_mpwqe_filler_cqes) }, 85 85 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_mpwqe_filler_strides) }, 86 + { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_oversize_pkts_sw_drop) }, 86 87 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_buff_alloc_err) }, 87 88 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cqe_compress_blks) }, 88 89 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cqe_compress_pkts) }, ··· 162 161 s->rx_wqe_err += rq_stats->wqe_err; 163 162 s->rx_mpwqe_filler_cqes += rq_stats->mpwqe_filler_cqes; 164 163 s->rx_mpwqe_filler_strides += rq_stats->mpwqe_filler_strides; 164 + s->rx_oversize_pkts_sw_drop += rq_stats->oversize_pkts_sw_drop; 165 165 s->rx_buff_alloc_err += rq_stats->buff_alloc_err; 166 166 s->rx_cqe_compress_blks += rq_stats->cqe_compress_blks; 167 167 s->rx_cqe_compress_pkts += rq_stats->cqe_compress_pkts; ··· 1191 1189 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, wqe_err) }, 1192 1190 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, mpwqe_filler_cqes) }, 1193 1191 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, mpwqe_filler_strides) }, 1192 + { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, oversize_pkts_sw_drop) }, 1194 1193 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, buff_alloc_err) }, 1195 1194 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cqe_compress_blks) }, 1196 1195 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cqe_compress_pkts) },
+2
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
··· 96 96 u64 rx_wqe_err; 97 97 u64 rx_mpwqe_filler_cqes; 98 98 u64 rx_mpwqe_filler_strides; 99 + u64 rx_oversize_pkts_sw_drop; 99 100 u64 rx_buff_alloc_err; 100 101 u64 rx_cqe_compress_blks; 101 102 u64 rx_cqe_compress_pkts; ··· 194 193 u64 wqe_err; 195 194 u64 mpwqe_filler_cqes; 196 195 u64 mpwqe_filler_strides; 196 + u64 oversize_pkts_sw_drop; 197 197 u64 buff_alloc_err; 198 198 u64 cqe_compress_blks; 199 199 u64 cqe_compress_pkts;
+35 -34
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
··· 1447 1447 inner_headers); 1448 1448 } 1449 1449 1450 - if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_ETH_ADDRS)) { 1451 - struct flow_dissector_key_eth_addrs *key = 1450 + if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_BASIC)) { 1451 + struct flow_dissector_key_basic *key = 1452 1452 skb_flow_dissector_target(f->dissector, 1453 - FLOW_DISSECTOR_KEY_ETH_ADDRS, 1453 + FLOW_DISSECTOR_KEY_BASIC, 1454 1454 f->key); 1455 - struct flow_dissector_key_eth_addrs *mask = 1455 + struct flow_dissector_key_basic *mask = 1456 1456 skb_flow_dissector_target(f->dissector, 1457 - FLOW_DISSECTOR_KEY_ETH_ADDRS, 1457 + FLOW_DISSECTOR_KEY_BASIC, 1458 1458 f->mask); 1459 + MLX5_SET(fte_match_set_lyr_2_4, headers_c, ethertype, 1460 + ntohs(mask->n_proto)); 1461 + MLX5_SET(fte_match_set_lyr_2_4, headers_v, ethertype, 1462 + ntohs(key->n_proto)); 1459 1463 1460 - ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c, 1461 - dmac_47_16), 1462 - mask->dst); 1463 - ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, 1464 - dmac_47_16), 1465 - key->dst); 1466 - 1467 - ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c, 1468 - smac_47_16), 1469 - mask->src); 1470 - ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, 1471 - smac_47_16), 1472 - key->src); 1473 - 1474 - if (!is_zero_ether_addr(mask->src) || !is_zero_ether_addr(mask->dst)) 1464 + if (mask->n_proto) 1475 1465 *match_level = MLX5_MATCH_L2; 1476 1466 } 1477 1467 ··· 1495 1505 1496 1506 *match_level = MLX5_MATCH_L2; 1497 1507 } 1498 - } else { 1508 + } else if (*match_level != MLX5_MATCH_NONE) { 1499 1509 MLX5_SET(fte_match_set_lyr_2_4, headers_c, svlan_tag, 1); 1500 1510 MLX5_SET(fte_match_set_lyr_2_4, headers_c, cvlan_tag, 1); 1511 + *match_level = MLX5_MATCH_L2; 1501 1512 } 1502 1513 1503 1514 if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_CVLAN)) { ··· 1536 1545 } 1537 1546 } 1538 1547 1539 - if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_BASIC)) { 1540 - struct flow_dissector_key_basic *key = 1548 + if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_ETH_ADDRS)) { 1549 + struct flow_dissector_key_eth_addrs *key = 1541 1550 skb_flow_dissector_target(f->dissector, 1542 - FLOW_DISSECTOR_KEY_BASIC, 1551 + FLOW_DISSECTOR_KEY_ETH_ADDRS, 1543 1552 f->key); 1544 - struct flow_dissector_key_basic *mask = 1553 + struct flow_dissector_key_eth_addrs *mask = 1545 1554 skb_flow_dissector_target(f->dissector, 1546 - FLOW_DISSECTOR_KEY_BASIC, 1555 + FLOW_DISSECTOR_KEY_ETH_ADDRS, 1547 1556 f->mask); 1548 - MLX5_SET(fte_match_set_lyr_2_4, headers_c, ethertype, 1549 - ntohs(mask->n_proto)); 1550 - MLX5_SET(fte_match_set_lyr_2_4, headers_v, ethertype, 1551 - ntohs(key->n_proto)); 1552 1557 1553 - if (mask->n_proto) 1558 + ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c, 1559 + dmac_47_16), 1560 + mask->dst); 1561 + ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, 1562 + dmac_47_16), 1563 + key->dst); 1564 + 1565 + ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c, 1566 + smac_47_16), 1567 + mask->src); 1568 + ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, 1569 + smac_47_16), 1570 + key->src); 1571 + 1572 + if (!is_zero_ether_addr(mask->src) || !is_zero_ether_addr(mask->dst)) 1554 1573 *match_level = MLX5_MATCH_L2; 1555 1574 } 1556 1575 ··· 1587 1586 1588 1587 /* the HW doesn't need L3 inline to match on frag=no */ 1589 1588 if (!(key->flags & FLOW_DIS_IS_FRAGMENT)) 1590 - *match_level = MLX5_INLINE_MODE_L2; 1589 + *match_level = MLX5_MATCH_L2; 1591 1590 /* *** L2 attributes parsing up to here *** */ 1592 1591 else 1593 - *match_level = MLX5_INLINE_MODE_IP; 1592 + *match_level = MLX5_MATCH_L3; 1594 1593 } 1595 1594 } 1596 1595 ··· 2980 2979 if (!actions_match_supported(priv, exts, parse_attr, flow, extack)) 2981 2980 return -EOPNOTSUPP; 2982 2981 2983 - if (attr->out_count > 1 && !mlx5_esw_has_fwd_fdb(priv->mdev)) { 2982 + if (attr->mirror_count > 0 && !mlx5_esw_has_fwd_fdb(priv->mdev)) { 2984 2983 NL_SET_ERR_MSG_MOD(extack, 2985 2984 "current firmware doesn't support split rule for port mirroring"); 2986 2985 netdev_warn_once(priv->netdev, "current firmware doesn't support split rule for port mirroring\n");
+8 -2
drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
··· 83 83 }; 84 84 85 85 static const struct rhashtable_params rhash_sa = { 86 - .key_len = FIELD_SIZEOF(struct mlx5_fpga_ipsec_sa_ctx, hw_sa), 87 - .key_offset = offsetof(struct mlx5_fpga_ipsec_sa_ctx, hw_sa), 86 + /* Keep out "cmd" field from the key as it's 87 + * value is not constant during the lifetime 88 + * of the key object. 89 + */ 90 + .key_len = FIELD_SIZEOF(struct mlx5_fpga_ipsec_sa_ctx, hw_sa) - 91 + FIELD_SIZEOF(struct mlx5_ifc_fpga_ipsec_sa_v1, cmd), 92 + .key_offset = offsetof(struct mlx5_fpga_ipsec_sa_ctx, hw_sa) + 93 + FIELD_SIZEOF(struct mlx5_ifc_fpga_ipsec_sa_v1, cmd), 88 94 .head_offset = offsetof(struct mlx5_fpga_ipsec_sa_ctx, hash), 89 95 .automatic_shrinking = true, 90 96 .min_size = 1,
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
··· 560 560 561 561 netif_carrier_off(epriv->netdev); 562 562 mlx5_fs_remove_rx_underlay_qpn(mdev, ipriv->qp.qpn); 563 - mlx5i_uninit_underlay_qp(epriv); 564 563 mlx5e_deactivate_priv_channels(epriv); 565 564 mlx5e_close_channels(&epriv->channels); 565 + mlx5i_uninit_underlay_qp(epriv); 566 566 unlock: 567 567 mutex_unlock(&epriv->state_lock); 568 568 return 0;
+24 -5
drivers/net/ethernet/qlogic/qed/qed_dev.c
··· 485 485 struct qed_qm_info *qm_info = &p_hwfn->qm_info; 486 486 487 487 /* Can't have multiple flags set here */ 488 - if (bitmap_weight((unsigned long *)&pq_flags, sizeof(pq_flags)) > 1) 488 + if (bitmap_weight((unsigned long *)&pq_flags, 489 + sizeof(pq_flags) * BITS_PER_BYTE) > 1) { 490 + DP_ERR(p_hwfn, "requested multiple pq flags 0x%x\n", pq_flags); 489 491 goto err; 492 + } 493 + 494 + if (!(qed_get_pq_flags(p_hwfn) & pq_flags)) { 495 + DP_ERR(p_hwfn, "pq flag 0x%x is not set\n", pq_flags); 496 + goto err; 497 + } 490 498 491 499 switch (pq_flags) { 492 500 case PQ_FLAGS_RLS: ··· 518 510 } 519 511 520 512 err: 521 - DP_ERR(p_hwfn, "BAD pq flags %d\n", pq_flags); 522 - return NULL; 513 + return &qm_info->start_pq; 523 514 } 524 515 525 516 /* save pq index in qm info */ ··· 542 535 { 543 536 u8 max_tc = qed_init_qm_get_num_tcs(p_hwfn); 544 537 538 + if (max_tc == 0) { 539 + DP_ERR(p_hwfn, "pq with flag 0x%lx do not exist\n", 540 + PQ_FLAGS_MCOS); 541 + return p_hwfn->qm_info.start_pq; 542 + } 543 + 545 544 if (tc > max_tc) 546 545 DP_ERR(p_hwfn, "tc %d must be smaller than %d\n", tc, max_tc); 547 546 548 - return qed_get_cm_pq_idx(p_hwfn, PQ_FLAGS_MCOS) + tc; 547 + return qed_get_cm_pq_idx(p_hwfn, PQ_FLAGS_MCOS) + (tc % max_tc); 549 548 } 550 549 551 550 u16 qed_get_cm_pq_idx_vf(struct qed_hwfn *p_hwfn, u16 vf) 552 551 { 553 552 u16 max_vf = qed_init_qm_get_num_vfs(p_hwfn); 554 553 554 + if (max_vf == 0) { 555 + DP_ERR(p_hwfn, "pq with flag 0x%lx do not exist\n", 556 + PQ_FLAGS_VFS); 557 + return p_hwfn->qm_info.start_pq; 558 + } 559 + 555 560 if (vf > max_vf) 556 561 DP_ERR(p_hwfn, "vf %d must be smaller than %d\n", vf, max_vf); 557 562 558 - return qed_get_cm_pq_idx(p_hwfn, PQ_FLAGS_VFS) + vf; 563 + return qed_get_cm_pq_idx(p_hwfn, PQ_FLAGS_VFS) + (vf % max_vf); 559 564 } 560 565 561 566 u16 qed_get_cm_pq_idx_ofld_mtc(struct qed_hwfn *p_hwfn, u8 tc)
+5 -9
drivers/net/phy/mscc.c
··· 810 810 811 811 phydev->mdix_ctrl = ETH_TP_MDI_AUTO; 812 812 mutex_lock(&phydev->lock); 813 - rc = phy_select_page(phydev, MSCC_PHY_PAGE_EXTENDED_2); 814 - if (rc < 0) 815 - goto out_unlock; 816 813 817 - reg_val = phy_read(phydev, MSCC_PHY_RGMII_CNTL); 818 - reg_val &= ~(RGMII_RX_CLK_DELAY_MASK); 819 - reg_val |= (RGMII_RX_CLK_DELAY_1_1_NS << RGMII_RX_CLK_DELAY_POS); 820 - phy_write(phydev, MSCC_PHY_RGMII_CNTL, reg_val); 814 + reg_val = RGMII_RX_CLK_DELAY_1_1_NS << RGMII_RX_CLK_DELAY_POS; 821 815 822 - out_unlock: 823 - rc = phy_restore_page(phydev, rc, rc > 0 ? 0 : rc); 816 + rc = phy_modify_paged(phydev, MSCC_PHY_PAGE_EXTENDED_2, 817 + MSCC_PHY_RGMII_CNTL, RGMII_RX_CLK_DELAY_MASK, 818 + reg_val); 819 + 824 820 mutex_unlock(&phydev->lock); 825 821 826 822 return rc;
-2
drivers/net/team/team.c
··· 985 985 team->en_port_count--; 986 986 team_queue_override_port_del(team, port); 987 987 team_adjust_ops(team); 988 - team_notify_peers(team); 989 - team_mcast_rejoin(team); 990 988 team_lower_state_changed(port); 991 989 } 992 990
+5 -8
drivers/net/virtio_net.c
··· 70 70 VIRTIO_NET_F_GUEST_TSO4, 71 71 VIRTIO_NET_F_GUEST_TSO6, 72 72 VIRTIO_NET_F_GUEST_ECN, 73 - VIRTIO_NET_F_GUEST_UFO 73 + VIRTIO_NET_F_GUEST_UFO, 74 + VIRTIO_NET_F_GUEST_CSUM 74 75 }; 75 76 76 77 struct virtnet_stat_desc { ··· 2335 2334 if (!vi->guest_offloads) 2336 2335 return 0; 2337 2336 2338 - if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM)) 2339 - offloads = 1ULL << VIRTIO_NET_F_GUEST_CSUM; 2340 - 2341 2337 return virtnet_set_guest_offloads(vi, offloads); 2342 2338 } 2343 2339 ··· 2344 2346 2345 2347 if (!vi->guest_offloads) 2346 2348 return 0; 2347 - if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM)) 2348 - offloads |= 1ULL << VIRTIO_NET_F_GUEST_CSUM; 2349 2349 2350 2350 return virtnet_set_guest_offloads(vi, offloads); 2351 2351 } ··· 2361 2365 && (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) || 2362 2366 virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6) || 2363 2367 virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_ECN) || 2364 - virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_UFO))) { 2365 - NL_SET_ERR_MSG_MOD(extack, "Can't set XDP while host is implementing LRO, disable LRO first"); 2368 + virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_UFO) || 2369 + virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM))) { 2370 + NL_SET_ERR_MSG_MOD(extack, "Can't set XDP while host is implementing LRO/CSUM, disable LRO/CSUM first"); 2366 2371 return -EOPNOTSUPP; 2367 2372 } 2368 2373
+1 -1
drivers/net/wireless/ath/ath10k/mac.c
··· 6867 6867 u32 bitmap; 6868 6868 6869 6869 if (drop) { 6870 - if (vif->type == NL80211_IFTYPE_STATION) { 6870 + if (vif && vif->type == NL80211_IFTYPE_STATION) { 6871 6871 bitmap = ~(1 << WMI_MGMT_TID); 6872 6872 list_for_each_entry(arvif, &ar->arvifs, list) { 6873 6873 if (arvif->vdev_type == WMI_VDEV_TYPE_STA)
+1 -2
drivers/net/wireless/ath/ath9k/main.c
··· 1251 1251 struct ath_vif *avp = (void *)vif->drv_priv; 1252 1252 struct ath_node *an = &avp->mcast_node; 1253 1253 1254 + mutex_lock(&sc->mutex); 1254 1255 if (IS_ENABLED(CONFIG_ATH9K_TX99)) { 1255 1256 if (sc->cur_chan->nvifs >= 1) { 1256 1257 mutex_unlock(&sc->mutex); ··· 1259 1258 } 1260 1259 sc->tx99_vif = vif; 1261 1260 } 1262 - 1263 - mutex_lock(&sc->mutex); 1264 1261 1265 1262 ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type); 1266 1263 sc->cur_chan->nvifs++;
+2 -1
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
··· 6005 6005 * for subsequent chanspecs. 6006 6006 */ 6007 6007 channel->flags = IEEE80211_CHAN_NO_HT40 | 6008 - IEEE80211_CHAN_NO_80MHZ; 6008 + IEEE80211_CHAN_NO_80MHZ | 6009 + IEEE80211_CHAN_NO_160MHZ; 6009 6010 ch.bw = BRCMU_CHAN_BW_20; 6010 6011 cfg->d11inf.encchspec(&ch); 6011 6012 chaninfo = ch.chspec;
+3
drivers/net/wireless/broadcom/brcm80211/brcmutil/d11.c
··· 193 193 } 194 194 break; 195 195 case BRCMU_CHSPEC_D11AC_BW_160: 196 + ch->bw = BRCMU_CHAN_BW_160; 197 + ch->sb = brcmu_maskget16(ch->chspec, BRCMU_CHSPEC_D11AC_SB_MASK, 198 + BRCMU_CHSPEC_D11AC_SB_SHIFT); 196 199 switch (ch->sb) { 197 200 case BRCMU_CHAN_SB_LLL: 198 201 ch->control_ch_num -= CH_70MHZ_APART;
+3 -1
drivers/net/wireless/intel/iwlwifi/fw/acpi.h
··· 6 6 * GPL LICENSE SUMMARY 7 7 * 8 8 * Copyright(c) 2017 Intel Deutschland GmbH 9 + * Copyright(c) 2018 Intel Corporation 9 10 * 10 11 * This program is free software; you can redistribute it and/or modify 11 12 * it under the terms of version 2 of the GNU General Public License as ··· 27 26 * BSD LICENSE 28 27 * 29 28 * Copyright(c) 2017 Intel Deutschland GmbH 29 + * Copyright(c) 2018 Intel Corporation 30 30 * All rights reserved. 31 31 * 32 32 * Redistribution and use in source and binary forms, with or without ··· 83 81 #define ACPI_WRDS_WIFI_DATA_SIZE (ACPI_SAR_TABLE_SIZE + 2) 84 82 #define ACPI_EWRD_WIFI_DATA_SIZE ((ACPI_SAR_PROFILE_NUM - 1) * \ 85 83 ACPI_SAR_TABLE_SIZE + 3) 86 - #define ACPI_WGDS_WIFI_DATA_SIZE 18 84 + #define ACPI_WGDS_WIFI_DATA_SIZE 19 87 85 #define ACPI_WRDD_WIFI_DATA_SIZE 2 88 86 #define ACPI_SPLC_WIFI_DATA_SIZE 2 89 87
+5 -1
drivers/net/wireless/intel/iwlwifi/fw/runtime.h
··· 154 154 const struct iwl_fw_runtime_ops *ops, void *ops_ctx, 155 155 struct dentry *dbgfs_dir); 156 156 157 - void iwl_fw_runtime_exit(struct iwl_fw_runtime *fwrt); 157 + static inline void iwl_fw_runtime_free(struct iwl_fw_runtime *fwrt) 158 + { 159 + kfree(fwrt->dump.d3_debug_data); 160 + fwrt->dump.d3_debug_data = NULL; 161 + } 158 162 159 163 void iwl_fw_runtime_suspend(struct iwl_fw_runtime *fwrt); 160 164
+29 -9
drivers/net/wireless/intel/iwlwifi/mvm/fw.c
··· 893 893 IWL_DEBUG_RADIO(mvm, "Sending GEO_TX_POWER_LIMIT\n"); 894 894 895 895 BUILD_BUG_ON(ACPI_NUM_GEO_PROFILES * ACPI_WGDS_NUM_BANDS * 896 - ACPI_WGDS_TABLE_SIZE != ACPI_WGDS_WIFI_DATA_SIZE); 896 + ACPI_WGDS_TABLE_SIZE + 1 != ACPI_WGDS_WIFI_DATA_SIZE); 897 897 898 898 BUILD_BUG_ON(ACPI_NUM_GEO_PROFILES > IWL_NUM_GEO_PROFILES); 899 899 ··· 928 928 return -ENOENT; 929 929 } 930 930 931 + static int iwl_mvm_sar_get_wgds_table(struct iwl_mvm *mvm) 932 + { 933 + return -ENOENT; 934 + } 935 + 931 936 static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm) 932 937 { 933 938 return 0; ··· 959 954 IWL_DEBUG_RADIO(mvm, 960 955 "WRDS SAR BIOS table invalid or unavailable. (%d)\n", 961 956 ret); 962 - /* if not available, don't fail and don't bother with EWRD */ 963 - return 0; 957 + /* 958 + * If not available, don't fail and don't bother with EWRD. 959 + * Return 1 to tell that we can't use WGDS either. 960 + */ 961 + return 1; 964 962 } 965 963 966 964 ret = iwl_mvm_sar_get_ewrd_table(mvm); ··· 976 968 /* choose profile 1 (WRDS) as default for both chains */ 977 969 ret = iwl_mvm_sar_select_profile(mvm, 1, 1); 978 970 979 - /* if we don't have profile 0 from BIOS, just skip it */ 971 + /* 972 + * If we don't have profile 0 from BIOS, just skip it. This 973 + * means that SAR Geo will not be enabled either, even if we 974 + * have other valid profiles. 975 + */ 980 976 if (ret == -ENOENT) 981 - return 0; 977 + return 1; 982 978 983 979 return ret; 984 980 } ··· 1180 1168 iwl_mvm_unref(mvm, IWL_MVM_REF_UCODE_DOWN); 1181 1169 1182 1170 ret = iwl_mvm_sar_init(mvm); 1183 - if (ret) 1184 - goto error; 1171 + if (ret == 0) { 1172 + ret = iwl_mvm_sar_geo_init(mvm); 1173 + } else if (ret > 0 && !iwl_mvm_sar_get_wgds_table(mvm)) { 1174 + /* 1175 + * If basic SAR is not available, we check for WGDS, 1176 + * which should *not* be available either. If it is 1177 + * available, issue an error, because we can't use SAR 1178 + * Geo without basic SAR. 1179 + */ 1180 + IWL_ERR(mvm, "BIOS contains WGDS but no WRDS\n"); 1181 + } 1185 1182 1186 - ret = iwl_mvm_sar_geo_init(mvm); 1187 - if (ret) 1183 + if (ret < 0) 1188 1184 goto error; 1189 1185 1190 1186 iwl_mvm_leds_sync(mvm);
+6 -6
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
··· 301 301 goto out; 302 302 } 303 303 304 - if (changed) 305 - *changed = (resp->status == MCC_RESP_NEW_CHAN_PROFILE); 304 + if (changed) { 305 + u32 status = le32_to_cpu(resp->status); 306 + 307 + *changed = (status == MCC_RESP_NEW_CHAN_PROFILE || 308 + status == MCC_RESP_ILLEGAL); 309 + } 306 310 307 311 regd = iwl_parse_nvm_mcc_info(mvm->trans->dev, mvm->cfg, 308 312 __le32_to_cpu(resp->n_channels), ··· 4447 4443 sinfo->signal_avg = mvmsta->avg_energy; 4448 4444 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); 4449 4445 } 4450 - 4451 - if (!fw_has_capa(&mvm->fw->ucode_capa, 4452 - IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS)) 4453 - return; 4454 4446 4455 4447 /* if beacon filtering isn't on mac80211 does it anyway */ 4456 4448 if (!(vif->driver_flags & IEEE80211_VIF_BEACON_FILTER))
+2 -3
drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
··· 539 539 } 540 540 541 541 IWL_DEBUG_LAR(mvm, 542 - "MCC response status: 0x%x. new MCC: 0x%x ('%c%c') change: %d n_chans: %d\n", 543 - status, mcc, mcc >> 8, mcc & 0xff, 544 - !!(status == MCC_RESP_NEW_CHAN_PROFILE), n_channels); 542 + "MCC response status: 0x%x. new MCC: 0x%x ('%c%c') n_chans: %d\n", 543 + status, mcc, mcc >> 8, mcc & 0xff, n_channels); 545 544 546 545 exit: 547 546 iwl_free_resp(&cmd);
+2
drivers/net/wireless/intel/iwlwifi/mvm/ops.c
··· 858 858 iwl_mvm_thermal_exit(mvm); 859 859 out_free: 860 860 iwl_fw_flush_dump(&mvm->fwrt); 861 + iwl_fw_runtime_free(&mvm->fwrt); 861 862 862 863 if (iwlmvm_mod_params.init_dbg) 863 864 return op_mode; ··· 911 910 912 911 iwl_mvm_tof_clean(mvm); 913 912 913 + iwl_fw_runtime_free(&mvm->fwrt); 914 914 mutex_destroy(&mvm->mutex); 915 915 mutex_destroy(&mvm->d0i3_suspend_mutex); 916 916
+6
drivers/net/wireless/mediatek/mt76/Kconfig
··· 1 1 config MT76_CORE 2 2 tristate 3 3 4 + config MT76_LEDS 5 + bool 6 + depends on MT76_CORE 7 + depends on LEDS_CLASS=y || MT76_CORE=LEDS_CLASS 8 + default y 9 + 4 10 config MT76_USB 5 11 tristate 6 12 depends on MT76_CORE
+5 -3
drivers/net/wireless/mediatek/mt76/mac80211.c
··· 345 345 mt76_check_sband(dev, NL80211_BAND_2GHZ); 346 346 mt76_check_sband(dev, NL80211_BAND_5GHZ); 347 347 348 - ret = mt76_led_init(dev); 349 - if (ret) 350 - return ret; 348 + if (IS_ENABLED(CONFIG_MT76_LEDS)) { 349 + ret = mt76_led_init(dev); 350 + if (ret) 351 + return ret; 352 + } 351 353 352 354 return ieee80211_register_hw(hw); 353 355 }
-1
drivers/net/wireless/mediatek/mt76/mt76x02.h
··· 71 71 struct mac_address macaddr_list[8]; 72 72 73 73 struct mutex phy_mutex; 74 - struct mutex mutex; 75 74 76 75 u8 txdone_seq; 77 76 DECLARE_KFIFO_PTR(txstatus_fifo, struct mt76x02_tx_status);
+4 -2
drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
··· 507 507 mt76x2_dfs_init_detector(dev); 508 508 509 509 /* init led callbacks */ 510 - dev->mt76.led_cdev.brightness_set = mt76x2_led_set_brightness; 511 - dev->mt76.led_cdev.blink_set = mt76x2_led_set_blink; 510 + if (IS_ENABLED(CONFIG_MT76_LEDS)) { 511 + dev->mt76.led_cdev.brightness_set = mt76x2_led_set_brightness; 512 + dev->mt76.led_cdev.blink_set = mt76x2_led_set_blink; 513 + } 512 514 513 515 ret = mt76_register_device(&dev->mt76, true, mt76x02_rates, 514 516 ARRAY_SIZE(mt76x02_rates));
+2 -2
drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
··· 272 272 if (val != ~0 && val > 0xffff) 273 273 return -EINVAL; 274 274 275 - mutex_lock(&dev->mutex); 275 + mutex_lock(&dev->mt76.mutex); 276 276 mt76x2_mac_set_tx_protection(dev, val); 277 - mutex_unlock(&dev->mutex); 277 + mutex_unlock(&dev->mt76.mutex); 278 278 279 279 return 0; 280 280 }
+11 -6
drivers/net/wireless/ti/wlcore/sdio.c
··· 285 285 struct resource res[2]; 286 286 mmc_pm_flag_t mmcflags; 287 287 int ret = -ENOMEM; 288 - int irq, wakeirq; 288 + int irq, wakeirq, num_irqs; 289 289 const char *chip_family; 290 290 291 291 /* We are only able to handle the wlan function */ ··· 353 353 irqd_get_trigger_type(irq_get_irq_data(irq)); 354 354 res[0].name = "irq"; 355 355 356 - res[1].start = wakeirq; 357 - res[1].flags = IORESOURCE_IRQ | 358 - irqd_get_trigger_type(irq_get_irq_data(wakeirq)); 359 - res[1].name = "wakeirq"; 360 356 361 - ret = platform_device_add_resources(glue->core, res, ARRAY_SIZE(res)); 357 + if (wakeirq > 0) { 358 + res[1].start = wakeirq; 359 + res[1].flags = IORESOURCE_IRQ | 360 + irqd_get_trigger_type(irq_get_irq_data(wakeirq)); 361 + res[1].name = "wakeirq"; 362 + num_irqs = 2; 363 + } else { 364 + num_irqs = 1; 365 + } 366 + ret = platform_device_add_resources(glue->core, res, num_irqs); 362 367 if (ret) { 363 368 dev_err(glue->dev, "can't add resources\n"); 364 369 goto out_dev_put;
+2
include/linux/net_dim.h
··· 406 406 } 407 407 /* fall through */ 408 408 case NET_DIM_START_MEASURE: 409 + net_dim_sample(end_sample.event_ctr, end_sample.pkt_ctr, end_sample.byte_ctr, 410 + &dim->start_sample); 409 411 dim->state = NET_DIM_MEASURE_IN_PROGRESS; 410 412 break; 411 413 case NET_DIM_APPLY_NEW_PROFILE:
+17 -1
include/linux/skbuff.h
··· 1326 1326 } 1327 1327 } 1328 1328 1329 + static inline void skb_zcopy_set_nouarg(struct sk_buff *skb, void *val) 1330 + { 1331 + skb_shinfo(skb)->destructor_arg = (void *)((uintptr_t) val | 0x1UL); 1332 + skb_shinfo(skb)->tx_flags |= SKBTX_ZEROCOPY_FRAG; 1333 + } 1334 + 1335 + static inline bool skb_zcopy_is_nouarg(struct sk_buff *skb) 1336 + { 1337 + return (uintptr_t) skb_shinfo(skb)->destructor_arg & 0x1UL; 1338 + } 1339 + 1340 + static inline void *skb_zcopy_get_nouarg(struct sk_buff *skb) 1341 + { 1342 + return (void *)((uintptr_t) skb_shinfo(skb)->destructor_arg & ~0x1UL); 1343 + } 1344 + 1329 1345 /* Release a reference on a zerocopy structure */ 1330 1346 static inline void skb_zcopy_clear(struct sk_buff *skb, bool zerocopy) 1331 1347 { ··· 1351 1335 if (uarg->callback == sock_zerocopy_callback) { 1352 1336 uarg->zerocopy = uarg->zerocopy && zerocopy; 1353 1337 sock_zerocopy_put(uarg); 1354 - } else { 1338 + } else if (!skb_zcopy_is_nouarg(skb)) { 1355 1339 uarg->callback(uarg, zerocopy); 1356 1340 } 1357 1341
+1
include/linux/tcp.h
··· 196 196 u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ 197 197 u32 lsndtime; /* timestamp of last sent data packet (for restart window) */ 198 198 u32 last_oow_ack_time; /* timestamp of last out-of-window ACK */ 199 + u32 compressed_ack_rcv_nxt; 199 200 200 201 u32 tsoffset; /* timestamp offset */ 201 202
+12
include/net/sctp/sctp.h
··· 608 608 SCTP_DEFAULT_MINSEGMENT)); 609 609 } 610 610 611 + static inline bool sctp_transport_pmtu_check(struct sctp_transport *t) 612 + { 613 + __u32 pmtu = sctp_dst_mtu(t->dst); 614 + 615 + if (t->pathmtu == pmtu) 616 + return true; 617 + 618 + t->pathmtu = pmtu; 619 + 620 + return false; 621 + } 622 + 611 623 #endif /* __net_sctp_h__ */
+5 -2
net/core/dev.c
··· 5970 5970 if (work_done) 5971 5971 timeout = n->dev->gro_flush_timeout; 5972 5972 5973 + /* When the NAPI instance uses a timeout and keeps postponing 5974 + * it, we need to bound somehow the time packets are kept in 5975 + * the GRO layer 5976 + */ 5977 + napi_gro_flush(n, !!timeout); 5973 5978 if (timeout) 5974 5979 hrtimer_start(&n->timer, ns_to_ktime(timeout), 5975 5980 HRTIMER_MODE_REL_PINNED); 5976 - else 5977 - napi_gro_flush(n, false); 5978 5981 } 5979 5982 if (unlikely(!list_empty(&n->poll_list))) { 5980 5983 /* If n->poll_list is not empty, we need to mask irqs */
+5
net/core/skbuff.c
··· 4854 4854 nf_reset(skb); 4855 4855 nf_reset_trace(skb); 4856 4856 4857 + #ifdef CONFIG_NET_SWITCHDEV 4858 + skb->offload_fwd_mark = 0; 4859 + skb->offload_mr_fwd_mark = 0; 4860 + #endif 4861 + 4857 4862 if (!xnet) 4858 4863 return; 4859 4864
+13 -2
net/ipv4/tcp_input.c
··· 4268 4268 * If the sack array is full, forget about the last one. 4269 4269 */ 4270 4270 if (this_sack >= TCP_NUM_SACKS) { 4271 - if (tp->compressed_ack) 4271 + if (tp->compressed_ack > TCP_FASTRETRANS_THRESH) 4272 4272 tcp_send_ack(sk); 4273 4273 this_sack--; 4274 4274 tp->rx_opt.num_sacks--; ··· 4363 4363 if (TCP_SKB_CB(from)->has_rxtstamp) { 4364 4364 TCP_SKB_CB(to)->has_rxtstamp = true; 4365 4365 to->tstamp = from->tstamp; 4366 + skb_hwtstamps(to)->hwtstamp = skb_hwtstamps(from)->hwtstamp; 4366 4367 } 4367 4368 4368 4369 return true; ··· 5189 5188 if (!tcp_is_sack(tp) || 5190 5189 tp->compressed_ack >= sock_net(sk)->ipv4.sysctl_tcp_comp_sack_nr) 5191 5190 goto send_now; 5192 - tp->compressed_ack++; 5191 + 5192 + if (tp->compressed_ack_rcv_nxt != tp->rcv_nxt) { 5193 + tp->compressed_ack_rcv_nxt = tp->rcv_nxt; 5194 + if (tp->compressed_ack > TCP_FASTRETRANS_THRESH) 5195 + NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPACKCOMPRESSED, 5196 + tp->compressed_ack - TCP_FASTRETRANS_THRESH); 5197 + tp->compressed_ack = 0; 5198 + } 5199 + 5200 + if (++tp->compressed_ack <= TCP_FASTRETRANS_THRESH) 5201 + goto send_now; 5193 5202 5194 5203 if (hrtimer_is_queued(&tp->compressed_ack_timer)) 5195 5204 return;
+3 -3
net/ipv4/tcp_output.c
··· 180 180 { 181 181 struct tcp_sock *tp = tcp_sk(sk); 182 182 183 - if (unlikely(tp->compressed_ack)) { 183 + if (unlikely(tp->compressed_ack > TCP_FASTRETRANS_THRESH)) { 184 184 NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPACKCOMPRESSED, 185 - tp->compressed_ack); 186 - tp->compressed_ack = 0; 185 + tp->compressed_ack - TCP_FASTRETRANS_THRESH); 186 + tp->compressed_ack = TCP_FASTRETRANS_THRESH; 187 187 if (hrtimer_try_to_cancel(&tp->compressed_ack_timer) == 1) 188 188 __sock_put(sk); 189 189 }
+1 -1
net/ipv4/tcp_timer.c
··· 740 740 741 741 bh_lock_sock(sk); 742 742 if (!sock_owned_by_user(sk)) { 743 - if (tp->compressed_ack) 743 + if (tp->compressed_ack > TCP_FASTRETRANS_THRESH) 744 744 tcp_send_ack(sk); 745 745 } else { 746 746 if (!test_and_set_bit(TCP_DELACK_TIMER_DEFERRED,
+13 -6
net/ipv6/addrconf.c
··· 179 179 static void addrconf_dad_work(struct work_struct *w); 180 180 static void addrconf_dad_completed(struct inet6_ifaddr *ifp, bool bump_id, 181 181 bool send_na); 182 - static void addrconf_dad_run(struct inet6_dev *idev); 182 + static void addrconf_dad_run(struct inet6_dev *idev, bool restart); 183 183 static void addrconf_rs_timer(struct timer_list *t); 184 184 static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa); 185 185 static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa); ··· 3439 3439 void *ptr) 3440 3440 { 3441 3441 struct net_device *dev = netdev_notifier_info_to_dev(ptr); 3442 + struct netdev_notifier_change_info *change_info; 3442 3443 struct netdev_notifier_changeupper_info *info; 3443 3444 struct inet6_dev *idev = __in6_dev_get(dev); 3444 3445 struct net *net = dev_net(dev); ··· 3514 3513 break; 3515 3514 } 3516 3515 3517 - if (idev) { 3516 + if (!IS_ERR_OR_NULL(idev)) { 3518 3517 if (idev->if_flags & IF_READY) { 3519 3518 /* device is already configured - 3520 3519 * but resend MLD reports, we might ··· 3522 3521 * multicast snooping switches 3523 3522 */ 3524 3523 ipv6_mc_up(idev); 3524 + change_info = ptr; 3525 + if (change_info->flags_changed & IFF_NOARP) 3526 + addrconf_dad_run(idev, true); 3525 3527 rt6_sync_up(dev, RTNH_F_LINKDOWN); 3526 3528 break; 3527 3529 } ··· 3559 3555 3560 3556 if (!IS_ERR_OR_NULL(idev)) { 3561 3557 if (run_pending) 3562 - addrconf_dad_run(idev); 3558 + addrconf_dad_run(idev, false); 3563 3559 3564 3560 /* Device has an address by now */ 3565 3561 rt6_sync_up(dev, RTNH_F_DEAD); ··· 4177 4173 addrconf_verify_rtnl(); 4178 4174 } 4179 4175 4180 - static void addrconf_dad_run(struct inet6_dev *idev) 4176 + static void addrconf_dad_run(struct inet6_dev *idev, bool restart) 4181 4177 { 4182 4178 struct inet6_ifaddr *ifp; 4183 4179 4184 4180 read_lock_bh(&idev->lock); 4185 4181 list_for_each_entry(ifp, &idev->addr_list, if_list) { 4186 4182 spin_lock(&ifp->lock); 4187 - if (ifp->flags & IFA_F_TENTATIVE && 4188 - ifp->state == INET6_IFADDR_STATE_DAD) 4183 + if ((ifp->flags & IFA_F_TENTATIVE && 4184 + ifp->state == INET6_IFADDR_STATE_DAD) || restart) { 4185 + if (restart) 4186 + ifp->state = INET6_IFADDR_STATE_PREDAD; 4189 4187 addrconf_dad_kick(ifp); 4188 + } 4190 4189 spin_unlock(&ifp->lock); 4191 4190 } 4192 4191 read_unlock_bh(&idev->lock);
+2 -2
net/packet/af_packet.c
··· 2394 2394 void *ph; 2395 2395 __u32 ts; 2396 2396 2397 - ph = skb_shinfo(skb)->destructor_arg; 2397 + ph = skb_zcopy_get_nouarg(skb); 2398 2398 packet_dec_pending(&po->tx_ring); 2399 2399 2400 2400 ts = __packet_set_timestamp(po, ph, skb); ··· 2461 2461 skb->mark = po->sk.sk_mark; 2462 2462 skb->tstamp = sockc->transmit_time; 2463 2463 sock_tx_timestamp(&po->sk, sockc->tsflags, &skb_shinfo(skb)->tx_flags); 2464 - skb_shinfo(skb)->destructor_arg = ph.raw; 2464 + skb_zcopy_set_nouarg(skb, ph.raw); 2465 2465 2466 2466 skb_reserve(skb, hlen); 2467 2467 skb_reset_network_header(skb);
+22 -14
net/sched/act_police.c
··· 27 27 u32 tcfp_ewma_rate; 28 28 s64 tcfp_burst; 29 29 u32 tcfp_mtu; 30 - s64 tcfp_toks; 31 - s64 tcfp_ptoks; 32 30 s64 tcfp_mtu_ptoks; 33 - s64 tcfp_t_c; 34 31 struct psched_ratecfg rate; 35 32 bool rate_present; 36 33 struct psched_ratecfg peak; ··· 38 41 struct tcf_police { 39 42 struct tc_action common; 40 43 struct tcf_police_params __rcu *params; 44 + 45 + spinlock_t tcfp_lock ____cacheline_aligned_in_smp; 46 + s64 tcfp_toks; 47 + s64 tcfp_ptoks; 48 + s64 tcfp_t_c; 41 49 }; 42 50 43 51 #define to_police(pc) ((struct tcf_police *)pc) ··· 124 122 return ret; 125 123 } 126 124 ret = ACT_P_CREATED; 125 + spin_lock_init(&(to_police(*a)->tcfp_lock)); 127 126 } else if (!ovr) { 128 127 tcf_idr_release(*a, bind); 129 128 return -EEXIST; ··· 189 186 } 190 187 191 188 new->tcfp_burst = PSCHED_TICKS2NS(parm->burst); 192 - new->tcfp_toks = new->tcfp_burst; 193 - if (new->peak_present) { 189 + if (new->peak_present) 194 190 new->tcfp_mtu_ptoks = (s64)psched_l2t_ns(&new->peak, 195 191 new->tcfp_mtu); 196 - new->tcfp_ptoks = new->tcfp_mtu_ptoks; 197 - } 198 192 199 193 if (tb[TCA_POLICE_AVRATE]) 200 194 new->tcfp_ewma_rate = nla_get_u32(tb[TCA_POLICE_AVRATE]); ··· 207 207 } 208 208 209 209 spin_lock_bh(&police->tcf_lock); 210 - new->tcfp_t_c = ktime_get_ns(); 210 + spin_lock_bh(&police->tcfp_lock); 211 + police->tcfp_t_c = ktime_get_ns(); 212 + police->tcfp_toks = new->tcfp_burst; 213 + if (new->peak_present) 214 + police->tcfp_ptoks = new->tcfp_mtu_ptoks; 215 + spin_unlock_bh(&police->tcfp_lock); 211 216 police->tcf_action = parm->action; 212 217 rcu_swap_protected(police->params, 213 218 new, ··· 262 257 } 263 258 264 259 now = ktime_get_ns(); 265 - toks = min_t(s64, now - p->tcfp_t_c, p->tcfp_burst); 260 + spin_lock_bh(&police->tcfp_lock); 261 + toks = min_t(s64, now - police->tcfp_t_c, p->tcfp_burst); 266 262 if (p->peak_present) { 267 - ptoks = toks + p->tcfp_ptoks; 263 + ptoks = toks + police->tcfp_ptoks; 268 264 if (ptoks > p->tcfp_mtu_ptoks) 269 265 ptoks = p->tcfp_mtu_ptoks; 270 266 ptoks -= (s64)psched_l2t_ns(&p->peak, 271 267 qdisc_pkt_len(skb)); 272 268 } 273 - toks += p->tcfp_toks; 269 + toks += police->tcfp_toks; 274 270 if (toks > p->tcfp_burst) 275 271 toks = p->tcfp_burst; 276 272 toks -= (s64)psched_l2t_ns(&p->rate, qdisc_pkt_len(skb)); 277 273 if ((toks|ptoks) >= 0) { 278 - p->tcfp_t_c = now; 279 - p->tcfp_toks = toks; 280 - p->tcfp_ptoks = ptoks; 274 + police->tcfp_t_c = now; 275 + police->tcfp_toks = toks; 276 + police->tcfp_ptoks = ptoks; 277 + spin_unlock_bh(&police->tcfp_lock); 281 278 ret = p->tcfp_result; 282 279 goto inc_drops; 283 280 } 281 + spin_unlock_bh(&police->tcfp_lock); 284 282 } 285 283 286 284 inc_overlimits:
+4 -20
net/sctp/output.c
··· 118 118 sctp_transport_route(tp, NULL, sp); 119 119 if (asoc->param_flags & SPP_PMTUD_ENABLE) 120 120 sctp_assoc_sync_pmtu(asoc); 121 + } else if (!sctp_transport_pmtu_check(tp)) { 122 + if (asoc->param_flags & SPP_PMTUD_ENABLE) 123 + sctp_assoc_sync_pmtu(asoc); 121 124 } 122 125 123 126 if (asoc->pmtu_pending) { ··· 399 396 return retval; 400 397 } 401 398 402 - static void sctp_packet_release_owner(struct sk_buff *skb) 403 - { 404 - sk_free(skb->sk); 405 - } 406 - 407 - static void sctp_packet_set_owner_w(struct sk_buff *skb, struct sock *sk) 408 - { 409 - skb_orphan(skb); 410 - skb->sk = sk; 411 - skb->destructor = sctp_packet_release_owner; 412 - 413 - /* 414 - * The data chunks have already been accounted for in sctp_sendmsg(), 415 - * therefore only reserve a single byte to keep socket around until 416 - * the packet has been transmitted. 417 - */ 418 - refcount_inc(&sk->sk_wmem_alloc); 419 - } 420 - 421 399 static void sctp_packet_gso_append(struct sk_buff *head, struct sk_buff *skb) 422 400 { 423 401 if (SCTP_OUTPUT_CB(head)->last == head) ··· 585 601 if (!head) 586 602 goto out; 587 603 skb_reserve(head, packet->overhead + MAX_HEADER); 588 - sctp_packet_set_owner_w(head, sk); 604 + skb_set_owner_w(head, sk); 589 605 590 606 /* set sctp header */ 591 607 sh = skb_push(head, sizeof(struct sctphdr));
+5 -21
net/sctp/socket.c
··· 3940 3940 unsigned int optlen) 3941 3941 { 3942 3942 struct sctp_assoc_value params; 3943 - struct sctp_association *asoc; 3944 - int retval = -EINVAL; 3945 3943 3946 3944 if (optlen != sizeof(params)) 3947 - goto out; 3945 + return -EINVAL; 3948 3946 3949 - if (copy_from_user(&params, optval, optlen)) { 3950 - retval = -EFAULT; 3951 - goto out; 3952 - } 3947 + if (copy_from_user(&params, optval, optlen)) 3948 + return -EFAULT; 3953 3949 3954 - asoc = sctp_id2assoc(sk, params.assoc_id); 3955 - if (asoc) { 3956 - asoc->prsctp_enable = !!params.assoc_value; 3957 - } else if (!params.assoc_id) { 3958 - struct sctp_sock *sp = sctp_sk(sk); 3950 + sctp_sk(sk)->ep->prsctp_enable = !!params.assoc_value; 3959 3951 3960 - sp->ep->prsctp_enable = !!params.assoc_value; 3961 - } else { 3962 - goto out; 3963 - } 3964 - 3965 - retval = 0; 3966 - 3967 - out: 3968 - return retval; 3952 + return 0; 3969 3953 } 3970 3954 3971 3955 static int sctp_setsockopt_default_prinfo(struct sock *sk,
-1
net/sctp/stream.c
··· 535 535 goto out; 536 536 } 537 537 538 - stream->incnt = incnt; 539 538 stream->outcnt = outcnt; 540 539 541 540 asoc->strreset_outstanding = !!out + !!in;
+7 -4
net/smc/af_smc.c
··· 127 127 smc = smc_sk(sk); 128 128 129 129 /* cleanup for a dangling non-blocking connect */ 130 + if (smc->connect_info && sk->sk_state == SMC_INIT) 131 + tcp_abort(smc->clcsock->sk, ECONNABORTED); 130 132 flush_work(&smc->connect_work); 131 133 kfree(smc->connect_info); 132 134 smc->connect_info = NULL; ··· 549 547 550 548 mutex_lock(&smc_create_lgr_pending); 551 549 local_contact = smc_conn_create(smc, false, aclc->hdr.flag, ibdev, 552 - ibport, &aclc->lcl, NULL, 0); 550 + ibport, ntoh24(aclc->qpn), &aclc->lcl, 551 + NULL, 0); 553 552 if (local_contact < 0) { 554 553 if (local_contact == -ENOMEM) 555 554 reason_code = SMC_CLC_DECL_MEM;/* insufficient memory*/ ··· 621 618 int rc = 0; 622 619 623 620 mutex_lock(&smc_create_lgr_pending); 624 - local_contact = smc_conn_create(smc, true, aclc->hdr.flag, NULL, 0, 621 + local_contact = smc_conn_create(smc, true, aclc->hdr.flag, NULL, 0, 0, 625 622 NULL, ismdev, aclc->gid); 626 623 if (local_contact < 0) 627 624 return smc_connect_abort(smc, SMC_CLC_DECL_MEM, 0); ··· 1086 1083 int *local_contact) 1087 1084 { 1088 1085 /* allocate connection / link group */ 1089 - *local_contact = smc_conn_create(new_smc, false, 0, ibdev, ibport, 1086 + *local_contact = smc_conn_create(new_smc, false, 0, ibdev, ibport, 0, 1090 1087 &pclc->lcl, NULL, 0); 1091 1088 if (*local_contact < 0) { 1092 1089 if (*local_contact == -ENOMEM) ··· 1110 1107 struct smc_clc_msg_smcd *pclc_smcd; 1111 1108 1112 1109 pclc_smcd = smc_get_clc_msg_smcd(pclc); 1113 - *local_contact = smc_conn_create(new_smc, true, 0, NULL, 0, NULL, 1110 + *local_contact = smc_conn_create(new_smc, true, 0, NULL, 0, 0, NULL, 1114 1111 ismdev, pclc_smcd->gid); 1115 1112 if (*local_contact < 0) { 1116 1113 if (*local_contact == -ENOMEM)
+15 -11
net/smc/smc_cdc.c
··· 81 81 sizeof(struct smc_cdc_msg) > SMC_WR_BUF_SIZE, 82 82 "must increase SMC_WR_BUF_SIZE to at least sizeof(struct smc_cdc_msg)"); 83 83 BUILD_BUG_ON_MSG( 84 - sizeof(struct smc_cdc_msg) != SMC_WR_TX_SIZE, 84 + offsetofend(struct smc_cdc_msg, reserved) > SMC_WR_TX_SIZE, 85 85 "must adapt SMC_WR_TX_SIZE to sizeof(struct smc_cdc_msg); if not all smc_wr upper layer protocols use the same message size any more, must start to set link->wr_tx_sges[i].length on each individual smc_wr_tx_send()"); 86 86 BUILD_BUG_ON_MSG( 87 87 sizeof(struct smc_cdc_tx_pend) > SMC_WR_TX_PEND_PRIV_SIZE, ··· 177 177 int smcd_cdc_msg_send(struct smc_connection *conn) 178 178 { 179 179 struct smc_sock *smc = container_of(conn, struct smc_sock, conn); 180 + union smc_host_cursor curs; 180 181 struct smcd_cdc_msg cdc; 181 182 int rc, diff; 182 183 183 184 memset(&cdc, 0, sizeof(cdc)); 184 185 cdc.common.type = SMC_CDC_MSG_TYPE; 185 - cdc.prod_wrap = conn->local_tx_ctrl.prod.wrap; 186 - cdc.prod_count = conn->local_tx_ctrl.prod.count; 187 - 188 - cdc.cons_wrap = conn->local_tx_ctrl.cons.wrap; 189 - cdc.cons_count = conn->local_tx_ctrl.cons.count; 190 - cdc.prod_flags = conn->local_tx_ctrl.prod_flags; 191 - cdc.conn_state_flags = conn->local_tx_ctrl.conn_state_flags; 186 + curs.acurs.counter = atomic64_read(&conn->local_tx_ctrl.prod.acurs); 187 + cdc.prod.wrap = curs.wrap; 188 + cdc.prod.count = curs.count; 189 + curs.acurs.counter = atomic64_read(&conn->local_tx_ctrl.cons.acurs); 190 + cdc.cons.wrap = curs.wrap; 191 + cdc.cons.count = curs.count; 192 + cdc.cons.prod_flags = conn->local_tx_ctrl.prod_flags; 193 + cdc.cons.conn_state_flags = conn->local_tx_ctrl.conn_state_flags; 192 194 rc = smcd_tx_ism_write(conn, &cdc, sizeof(cdc), 0, 1); 193 195 if (rc) 194 196 return rc; 195 - smc_curs_copy(&conn->rx_curs_confirmed, &conn->local_tx_ctrl.cons, 196 - conn); 197 + smc_curs_copy(&conn->rx_curs_confirmed, &curs, conn); 197 198 /* Calculate transmitted data and increment free send buffer space */ 198 199 diff = smc_curs_diff(conn->sndbuf_desc->len, &conn->tx_curs_fin, 199 200 &conn->tx_curs_sent); ··· 332 331 static void smcd_cdc_rx_tsklet(unsigned long data) 333 332 { 334 333 struct smc_connection *conn = (struct smc_connection *)data; 334 + struct smcd_cdc_msg *data_cdc; 335 335 struct smcd_cdc_msg cdc; 336 336 struct smc_sock *smc; 337 337 338 338 if (!conn) 339 339 return; 340 340 341 - memcpy(&cdc, conn->rmb_desc->cpu_addr, sizeof(cdc)); 341 + data_cdc = (struct smcd_cdc_msg *)conn->rmb_desc->cpu_addr; 342 + smcd_curs_copy(&cdc.prod, &data_cdc->prod, conn); 343 + smcd_curs_copy(&cdc.cons, &data_cdc->cons, conn); 342 344 smc = container_of(conn, struct smc_sock, conn); 343 345 smc_cdc_msg_recv(smc, (struct smc_cdc_msg *)&cdc); 344 346 }
+45 -15
net/smc/smc_cdc.h
··· 48 48 struct smc_cdc_producer_flags prod_flags; 49 49 struct smc_cdc_conn_state_flags conn_state_flags; 50 50 u8 reserved[18]; 51 - } __packed; /* format defined in RFC7609 */ 51 + }; 52 + 53 + /* SMC-D cursor format */ 54 + union smcd_cdc_cursor { 55 + struct { 56 + u16 wrap; 57 + u32 count; 58 + struct smc_cdc_producer_flags prod_flags; 59 + struct smc_cdc_conn_state_flags conn_state_flags; 60 + } __packed; 61 + #ifdef KERNEL_HAS_ATOMIC64 62 + atomic64_t acurs; /* for atomic processing */ 63 + #else 64 + u64 acurs; /* for atomic processing */ 65 + #endif 66 + } __aligned(8); 52 67 53 68 /* CDC message for SMC-D */ 54 69 struct smcd_cdc_msg { 55 70 struct smc_wr_rx_hdr common; /* Type = 0xFE */ 56 71 u8 res1[7]; 57 - u16 prod_wrap; 58 - u32 prod_count; 59 - u8 res2[2]; 60 - u16 cons_wrap; 61 - u32 cons_count; 62 - struct smc_cdc_producer_flags prod_flags; 63 - struct smc_cdc_conn_state_flags conn_state_flags; 72 + union smcd_cdc_cursor prod; 73 + union smcd_cdc_cursor cons; 64 74 u8 res3[8]; 65 - } __packed; 75 + } __aligned(8); 66 76 67 77 static inline bool smc_cdc_rxed_any_close(struct smc_connection *conn) 68 78 { ··· 133 123 static inline void smc_curs_copy_net(union smc_cdc_cursor *tgt, 134 124 union smc_cdc_cursor *src, 135 125 struct smc_connection *conn) 126 + { 127 + #ifndef KERNEL_HAS_ATOMIC64 128 + unsigned long flags; 129 + 130 + spin_lock_irqsave(&conn->acurs_lock, flags); 131 + tgt->acurs = src->acurs; 132 + spin_unlock_irqrestore(&conn->acurs_lock, flags); 133 + #else 134 + atomic64_set(&tgt->acurs, atomic64_read(&src->acurs)); 135 + #endif 136 + } 137 + 138 + static inline void smcd_curs_copy(union smcd_cdc_cursor *tgt, 139 + union smcd_cdc_cursor *src, 140 + struct smc_connection *conn) 136 141 { 137 142 #ifndef KERNEL_HAS_ATOMIC64 138 143 unsigned long flags; ··· 247 222 static inline void smcd_cdc_msg_to_host(struct smc_host_cdc_msg *local, 248 223 struct smcd_cdc_msg *peer) 249 224 { 250 - local->prod.wrap = peer->prod_wrap; 251 - local->prod.count = peer->prod_count; 252 - local->cons.wrap = peer->cons_wrap; 253 - local->cons.count = peer->cons_count; 254 - local->prod_flags = peer->prod_flags; 255 - local->conn_state_flags = peer->conn_state_flags; 225 + union smc_host_cursor temp; 226 + 227 + temp.wrap = peer->prod.wrap; 228 + temp.count = peer->prod.count; 229 + atomic64_set(&local->prod.acurs, atomic64_read(&temp.acurs)); 230 + 231 + temp.wrap = peer->cons.wrap; 232 + temp.count = peer->cons.count; 233 + atomic64_set(&local->cons.acurs, atomic64_read(&temp.acurs)); 234 + local->prod_flags = peer->cons.prod_flags; 235 + local->conn_state_flags = peer->cons.conn_state_flags; 256 236 } 257 237 258 238 static inline void smc_cdc_msg_to_host(struct smc_host_cdc_msg *local,
+14 -6
net/smc/smc_core.c
··· 184 184 185 185 if (!lgr->is_smcd && lnk->state != SMC_LNK_INACTIVE) 186 186 smc_llc_link_inactive(lnk); 187 + if (lgr->is_smcd) 188 + smc_ism_signal_shutdown(lgr); 187 189 smc_lgr_free(lgr); 188 190 } 189 191 } ··· 487 485 } 488 486 489 487 /* Called when SMC-D device is terminated or peer is lost */ 490 - void smc_smcd_terminate(struct smcd_dev *dev, u64 peer_gid) 488 + void smc_smcd_terminate(struct smcd_dev *dev, u64 peer_gid, unsigned short vlan) 491 489 { 492 490 struct smc_link_group *lgr, *l; 493 491 LIST_HEAD(lgr_free_list); ··· 497 495 list_for_each_entry_safe(lgr, l, &smc_lgr_list.list, list) { 498 496 if (lgr->is_smcd && lgr->smcd == dev && 499 497 (!peer_gid || lgr->peer_gid == peer_gid) && 500 - !list_empty(&lgr->list)) { 498 + (vlan == VLAN_VID_MASK || lgr->vlan_id == vlan)) { 501 499 __smc_lgr_terminate(lgr); 502 500 list_move(&lgr->list, &lgr_free_list); 503 501 } ··· 508 506 list_for_each_entry_safe(lgr, l, &lgr_free_list, list) { 509 507 list_del_init(&lgr->list); 510 508 cancel_delayed_work_sync(&lgr->free_work); 509 + if (!peer_gid && vlan == VLAN_VID_MASK) /* dev terminated? */ 510 + smc_ism_signal_shutdown(lgr); 511 511 smc_lgr_free(lgr); 512 512 } 513 513 } ··· 563 559 564 560 static bool smcr_lgr_match(struct smc_link_group *lgr, 565 561 struct smc_clc_msg_local *lcl, 566 - enum smc_lgr_role role) 562 + enum smc_lgr_role role, u32 clcqpn) 567 563 { 568 564 return !memcmp(lgr->peer_systemid, lcl->id_for_peer, 569 565 SMC_SYSTEMID_LEN) && ··· 571 567 SMC_GID_SIZE) && 572 568 !memcmp(lgr->lnk[SMC_SINGLE_LINK].peer_mac, lcl->mac, 573 569 sizeof(lcl->mac)) && 574 - lgr->role == role; 570 + lgr->role == role && 571 + (lgr->role == SMC_SERV || 572 + lgr->lnk[SMC_SINGLE_LINK].peer_qpn == clcqpn); 575 573 } 576 574 577 575 static bool smcd_lgr_match(struct smc_link_group *lgr, ··· 584 578 585 579 /* create a new SMC connection (and a new link group if necessary) */ 586 580 int smc_conn_create(struct smc_sock *smc, bool is_smcd, int srv_first_contact, 587 - struct smc_ib_device *smcibdev, u8 ibport, 581 + struct smc_ib_device *smcibdev, u8 ibport, u32 clcqpn, 588 582 struct smc_clc_msg_local *lcl, struct smcd_dev *smcd, 589 583 u64 peer_gid) 590 584 { ··· 609 603 list_for_each_entry(lgr, &smc_lgr_list.list, list) { 610 604 write_lock_bh(&lgr->conns_lock); 611 605 if ((is_smcd ? smcd_lgr_match(lgr, smcd, peer_gid) : 612 - smcr_lgr_match(lgr, lcl, role)) && 606 + smcr_lgr_match(lgr, lcl, role, clcqpn)) && 613 607 !lgr->sync_err && 614 608 lgr->vlan_id == vlan_id && 615 609 (role == SMC_CLNT || ··· 1030 1024 smc_llc_link_inactive(lnk); 1031 1025 } 1032 1026 cancel_delayed_work_sync(&lgr->free_work); 1027 + if (lgr->is_smcd) 1028 + smc_ism_signal_shutdown(lgr); 1033 1029 smc_lgr_free(lgr); /* free link group */ 1034 1030 } 1035 1031 }
+3 -2
net/smc/smc_core.h
··· 247 247 void smc_lgr_forget(struct smc_link_group *lgr); 248 248 void smc_lgr_terminate(struct smc_link_group *lgr); 249 249 void smc_port_terminate(struct smc_ib_device *smcibdev, u8 ibport); 250 - void smc_smcd_terminate(struct smcd_dev *dev, u64 peer_gid); 250 + void smc_smcd_terminate(struct smcd_dev *dev, u64 peer_gid, 251 + unsigned short vlan); 251 252 int smc_buf_create(struct smc_sock *smc, bool is_smcd); 252 253 int smc_uncompress_bufsize(u8 compressed); 253 254 int smc_rmb_rtoken_handling(struct smc_connection *conn, ··· 263 262 264 263 void smc_conn_free(struct smc_connection *conn); 265 264 int smc_conn_create(struct smc_sock *smc, bool is_smcd, int srv_first_contact, 266 - struct smc_ib_device *smcibdev, u8 ibport, 265 + struct smc_ib_device *smcibdev, u8 ibport, u32 clcqpn, 267 266 struct smc_clc_msg_local *lcl, struct smcd_dev *smcd, 268 267 u64 peer_gid); 269 268 void smcd_conn_free(struct smc_connection *conn);
+32 -11
net/smc/smc_ism.c
··· 187 187 #define ISM_EVENT_REQUEST 0x0001 188 188 #define ISM_EVENT_RESPONSE 0x0002 189 189 #define ISM_EVENT_REQUEST_IR 0x00000001 190 + #define ISM_EVENT_CODE_SHUTDOWN 0x80 190 191 #define ISM_EVENT_CODE_TESTLINK 0x83 192 + 193 + union smcd_sw_event_info { 194 + u64 info; 195 + struct { 196 + u8 uid[SMC_LGR_ID_SIZE]; 197 + unsigned short vlan_id; 198 + u16 code; 199 + }; 200 + }; 191 201 192 202 static void smcd_handle_sw_event(struct smc_ism_event_work *wrk) 193 203 { 194 - union { 195 - u64 info; 196 - struct { 197 - u32 uid; 198 - unsigned short vlanid; 199 - u16 code; 200 - }; 201 - } ev_info; 204 + union smcd_sw_event_info ev_info; 202 205 206 + ev_info.info = wrk->event.info; 203 207 switch (wrk->event.code) { 208 + case ISM_EVENT_CODE_SHUTDOWN: /* Peer shut down DMBs */ 209 + smc_smcd_terminate(wrk->smcd, wrk->event.tok, ev_info.vlan_id); 210 + break; 204 211 case ISM_EVENT_CODE_TESTLINK: /* Activity timer */ 205 - ev_info.info = wrk->event.info; 206 212 if (ev_info.code == ISM_EVENT_REQUEST) { 207 213 ev_info.code = ISM_EVENT_RESPONSE; 208 214 wrk->smcd->ops->signal_event(wrk->smcd, ··· 221 215 } 222 216 } 223 217 218 + int smc_ism_signal_shutdown(struct smc_link_group *lgr) 219 + { 220 + int rc; 221 + union smcd_sw_event_info ev_info; 222 + 223 + memcpy(ev_info.uid, lgr->id, SMC_LGR_ID_SIZE); 224 + ev_info.vlan_id = lgr->vlan_id; 225 + ev_info.code = ISM_EVENT_REQUEST; 226 + rc = lgr->smcd->ops->signal_event(lgr->smcd, lgr->peer_gid, 227 + ISM_EVENT_REQUEST_IR, 228 + ISM_EVENT_CODE_SHUTDOWN, 229 + ev_info.info); 230 + return rc; 231 + } 232 + 224 233 /* worker for SMC-D events */ 225 234 static void smc_ism_event_work(struct work_struct *work) 226 235 { ··· 244 223 245 224 switch (wrk->event.type) { 246 225 case ISM_EVENT_GID: /* GID event, token is peer GID */ 247 - smc_smcd_terminate(wrk->smcd, wrk->event.tok); 226 + smc_smcd_terminate(wrk->smcd, wrk->event.tok, VLAN_VID_MASK); 248 227 break; 249 228 case ISM_EVENT_DMB: 250 229 break; ··· 310 289 spin_unlock(&smcd_dev_list.lock); 311 290 flush_workqueue(smcd->event_wq); 312 291 destroy_workqueue(smcd->event_wq); 313 - smc_smcd_terminate(smcd, 0); 292 + smc_smcd_terminate(smcd, 0, VLAN_VID_MASK); 314 293 315 294 device_del(&smcd->dev); 316 295 }
+1
net/smc/smc_ism.h
··· 45 45 int smc_ism_unregister_dmb(struct smcd_dev *dev, struct smc_buf_desc *dmb_desc); 46 46 int smc_ism_write(struct smcd_dev *dev, const struct smc_ism_position *pos, 47 47 void *data, size_t len); 48 + int smc_ism_signal_shutdown(struct smc_link_group *lgr); 48 49 #endif
+3 -1
net/smc/smc_wr.c
··· 215 215 216 216 pend = container_of(wr_pend_priv, struct smc_wr_tx_pend, priv); 217 217 if (pend->idx < link->wr_tx_cnt) { 218 + u32 idx = pend->idx; 219 + 218 220 /* clear the full struct smc_wr_tx_pend including .priv */ 219 221 memset(&link->wr_tx_pends[pend->idx], 0, 220 222 sizeof(link->wr_tx_pends[pend->idx])); 221 223 memset(&link->wr_tx_bufs[pend->idx], 0, 222 224 sizeof(link->wr_tx_bufs[pend->idx])); 223 - test_and_clear_bit(pend->idx, link->wr_tx_mask); 225 + test_and_clear_bit(idx, link->wr_tx_mask); 224 226 return 1; 225 227 } 226 228