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

Configure Feed

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

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

Pull networking fixes from David Miller:

1) Fix NAPI poll list corruption in enic driver, from Christian
Lamparter.

2) Fix route use after free, from Eric Dumazet.

3) Fix regression in reuseaddr handling, from Josef Bacik.

4) Assert the size of control messages in compat handling since we copy
it in from userspace twice. From Meng Xu.

5) SMC layer bug fixes (missing RCU locking, bad refcounting, etc.)
from Ursula Braun.

6) Fix races in AF_PACKET fanout handling, from Willem de Bruijn.

7) Don't use ARRAY_SIZE on spinlock array which might have zero
entries, from Geert Uytterhoeven.

8) Fix miscomputation of checksum in ipv6 udp code, from Subash Abhinov
Kasiviswanathan.

9) Push the ipv6 header properly in ipv6 GRE tunnel driver, from Xin
Long.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (75 commits)
inet: fix improper empty comparison
net: use inet6_rcv_saddr to compare sockets
net: set tb->fast_sk_family
net: orphan frags on stand-alone ptype in dev_queue_xmit_nit
MAINTAINERS: update git tree locations for ieee802154 subsystem
net: prevent dst uses after free
net: phy: Fix truncation of large IRQ numbers in phy_attached_print()
net/smc: no close wait in case of process shut down
net/smc: introduce a delay
net/smc: terminate link group if out-of-sync is received
net/smc: longer delay for client link group removal
net/smc: adapt send request completion notification
net/smc: adjust net_device refcount
net/smc: take RCU read lock for routing cache lookup
net/smc: add receive timeout check
net/smc: add missing dev_put
net: stmmac: Cocci spatch "of_table"
lan78xx: Use default values loaded from EEPROM/OTP after reset
lan78xx: Allow EEPROM write for less than MAX_EEPROM_SIZE
lan78xx: Fix for eeprom read/write when device auto suspend
...

+646 -414
+14 -4
Documentation/networking/ip-sysctl.txt
··· 1680 1680 2: Enable DAD, and disable IPv6 operation if MAC-based duplicate 1681 1681 link-local address has been found. 1682 1682 1683 + DAD operation and mode on a given interface will be selected according 1684 + to the maximum value of conf/{all,interface}/accept_dad. 1685 + 1683 1686 force_tllao - BOOLEAN 1684 1687 Enable sending the target link-layer address option even when 1685 1688 responding to a unicast neighbor solicitation. ··· 1730 1727 1731 1728 optimistic_dad - BOOLEAN 1732 1729 Whether to perform Optimistic Duplicate Address Detection (RFC 4429). 1733 - 0: disabled (default) 1734 - 1: enabled 1730 + 0: disabled (default) 1731 + 1: enabled 1732 + 1733 + Optimistic Duplicate Address Detection for the interface will be enabled 1734 + if at least one of conf/{all,interface}/optimistic_dad is set to 1, 1735 + it will be disabled otherwise. 1735 1736 1736 1737 use_optimistic - BOOLEAN 1737 1738 If enabled, do not classify optimistic addresses as deprecated during 1738 1739 source address selection. Preferred addresses will still be chosen 1739 1740 before optimistic addresses, subject to other ranking in the source 1740 1741 address selection algorithm. 1741 - 0: disabled (default) 1742 - 1: enabled 1742 + 0: disabled (default) 1743 + 1: enabled 1744 + 1745 + This will be enabled if at least one of 1746 + conf/{all,interface}/use_optimistic is set to 1, disabled otherwise. 1743 1747 1744 1748 stable_secret - IPv6 address 1745 1749 This IPv6 address will be used as a secret to generate IPv6
+32 -32
Documentation/networking/switchdev.txt
··· 13 13 with SR-IOV or soft switches, such as OVS, are possible. 14 14 15 15 16 -                              User-space tools 16 + User-space tools 17 17 18 -        user space                   | 19 -       +-------------------------------------------------------------------+ 20 -        kernel                       | Netlink 21 -                                     | 22 -                      +--------------+-------------------------------+ 23 -                      |         Network stack                        | 24 -                      |           (Linux)                            | 25 -                      |                                              | 26 -                      +----------------------------------------------+ 18 + user space | 19 + +-------------------------------------------------------------------+ 20 + kernel | Netlink 21 + | 22 + +--------------+-------------------------------+ 23 + | Network stack | 24 + | (Linux) | 25 + | | 26 + +----------------------------------------------+ 27 27 28 28 sw1p2 sw1p4 sw1p6 29 -                       sw1p1  + sw1p3 +  sw1p5 +         eth1 30 -                         +    |    +    |    +    |            + 31 -                         |    |    |    |    |    |            | 32 -                      +--+----+----+----+-+--+----+---+  +-----+-----+ 33 -                      |         Switch driver         |  |    mgmt   | 34 -                      |        (this document)        |  |   driver  | 35 -                      |                               |  |           | 36 -                      +--------------+----------------+  +-----------+ 37 -                                     | 38 -        kernel                       | HW bus (eg PCI) 39 -       +-------------------------------------------------------------------+ 40 -        hardware                     | 41 -                      +--------------+---+------------+ 42 -                      |         Switch device (sw1)   | 43 -                      |  +----+                       +--------+ 44 -                      |  |    v offloaded data path   | mgmt port 45 -                      |  |    |                       | 46 -                      +--|----|----+----+----+----+---+ 47 -                         |    |    |    |    |    | 48 -                         +    +    +    +    +    + 49 -                        p1   p2   p3   p4   p5   p6 29 + sw1p1 + sw1p3 + sw1p5 + eth1 30 + + | + | + | + 31 + | | | | | | | 32 + +--+----+----+----+----+----+---+ +-----+-----+ 33 + | Switch driver | | mgmt | 34 + | (this document) | | driver | 35 + | | | | 36 + +--------------+----------------+ +-----------+ 37 + | 38 + kernel | HW bus (eg PCI) 39 + +-------------------------------------------------------------------+ 40 + hardware | 41 + +--------------+----------------+ 42 + | Switch device (sw1) | 43 + | +----+ +--------+ 44 + | | v offloaded data path | mgmt port 45 + | | | | 46 + +--|----|----+----+----+----+---+ 47 + | | | | | | 48 + + + + + + + 49 + p1 p2 p3 p4 p5 p6 50 50 51 -                              front-panel ports 51 + front-panel ports 52 52 53 53 54 54 Fig 1.
+2 -4
MAINTAINERS
··· 2865 2865 F: drivers/scsi/bnx2i/ 2866 2866 2867 2867 BROADCOM BNX2X 10 GIGABIT ETHERNET DRIVER 2868 - M: Yuval Mintz <Yuval.Mintz@cavium.com> 2869 2868 M: Ariel Elior <ariel.elior@cavium.com> 2870 2869 M: everest-linux-l2@cavium.com 2871 2870 L: netdev@vger.kernel.org ··· 6654 6655 M: Stefan Schmidt <stefan@osg.samsung.com> 6655 6656 L: linux-wpan@vger.kernel.org 6656 6657 W: http://wpan.cakelab.org/ 6657 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git 6658 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git 6658 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/sschmidt/wpan.git 6659 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/sschmidt/wpan-next.git 6659 6660 S: Maintained 6660 6661 F: net/ieee802154/ 6661 6662 F: net/mac802154/ ··· 11058 11059 F: drivers/scsi/qedi/ 11059 11060 11060 11061 QLOGIC QL4xxx ETHERNET DRIVER 11061 - M: Yuval Mintz <Yuval.Mintz@cavium.com> 11062 11062 M: Ariel Elior <Ariel.Elior@cavium.com> 11063 11063 M: everest-linux-l2@cavium.com 11064 11064 L: netdev@vger.kernel.org
+25 -12
drivers/isdn/i4l/isdn_ppp.c
··· 825 825 isdn_net_local *lp; 826 826 struct ippp_struct *is; 827 827 int proto; 828 - unsigned char protobuf[4]; 829 828 830 829 is = file->private_data; 831 830 ··· 838 839 if (!lp) 839 840 printk(KERN_DEBUG "isdn_ppp_write: lp == NULL\n"); 840 841 else { 841 - /* 842 - * Don't reset huptimer for 843 - * LCP packets. (Echo requests). 844 - */ 845 - if (copy_from_user(protobuf, buf, 4)) 846 - return -EFAULT; 847 - proto = PPP_PROTOCOL(protobuf); 848 - if (proto != PPP_LCP) 849 - lp->huptimer = 0; 842 + if (lp->isdn_device < 0 || lp->isdn_channel < 0) { 843 + unsigned char protobuf[4]; 844 + /* 845 + * Don't reset huptimer for 846 + * LCP packets. (Echo requests). 847 + */ 848 + if (copy_from_user(protobuf, buf, 4)) 849 + return -EFAULT; 850 850 851 - if (lp->isdn_device < 0 || lp->isdn_channel < 0) 851 + proto = PPP_PROTOCOL(protobuf); 852 + if (proto != PPP_LCP) 853 + lp->huptimer = 0; 854 + 852 855 return 0; 856 + } 853 857 854 858 if ((dev->drv[lp->isdn_device]->flags & DRV_FLAG_RUNNING) && 855 859 lp->dialstate == 0 && 856 860 (lp->flags & ISDN_NET_CONNECTED)) { 857 861 unsigned short hl; 858 862 struct sk_buff *skb; 863 + unsigned char *cpy_buf; 859 864 /* 860 865 * we need to reserve enough space in front of 861 866 * sk_buff. old call to dev_alloc_skb only reserved ··· 872 869 return count; 873 870 } 874 871 skb_reserve(skb, hl); 875 - if (copy_from_user(skb_put(skb, count), buf, count)) 872 + cpy_buf = skb_put(skb, count); 873 + if (copy_from_user(cpy_buf, buf, count)) 876 874 { 877 875 kfree_skb(skb); 878 876 return -EFAULT; 879 877 } 878 + 879 + /* 880 + * Don't reset huptimer for 881 + * LCP packets. (Echo requests). 882 + */ 883 + proto = PPP_PROTOCOL(cpy_buf); 884 + if (proto != PPP_LCP) 885 + lp->huptimer = 0; 886 + 880 887 if (is->debug & 0x40) { 881 888 printk(KERN_DEBUG "ppp xmit: len %d\n", (int) skb->len); 882 889 isdn_ppp_frame_log("xmit", skb->data, skb->len, 32, is->unit, lp->ppp_slot);
+32 -20
drivers/net/ethernet/broadcom/bcmsysport.c
··· 432 432 netif_dbg(priv, hw, priv->netdev, "updated MIB counters\n"); 433 433 } 434 434 435 + static void bcm_sysport_update_tx_stats(struct bcm_sysport_priv *priv, 436 + u64 *tx_bytes, u64 *tx_packets) 437 + { 438 + struct bcm_sysport_tx_ring *ring; 439 + u64 bytes = 0, packets = 0; 440 + unsigned int start; 441 + unsigned int q; 442 + 443 + for (q = 0; q < priv->netdev->num_tx_queues; q++) { 444 + ring = &priv->tx_rings[q]; 445 + do { 446 + start = u64_stats_fetch_begin_irq(&priv->syncp); 447 + bytes = ring->bytes; 448 + packets = ring->packets; 449 + } while (u64_stats_fetch_retry_irq(&priv->syncp, start)); 450 + 451 + *tx_bytes += bytes; 452 + *tx_packets += packets; 453 + } 454 + } 455 + 435 456 static void bcm_sysport_get_stats(struct net_device *dev, 436 457 struct ethtool_stats *stats, u64 *data) 437 458 { ··· 460 439 struct bcm_sysport_stats64 *stats64 = &priv->stats64; 461 440 struct u64_stats_sync *syncp = &priv->syncp; 462 441 struct bcm_sysport_tx_ring *ring; 442 + u64 tx_bytes = 0, tx_packets = 0; 463 443 unsigned int start; 464 444 int i, j; 465 445 466 - if (netif_running(dev)) 446 + if (netif_running(dev)) { 467 447 bcm_sysport_update_mib_counters(priv); 448 + bcm_sysport_update_tx_stats(priv, &tx_bytes, &tx_packets); 449 + stats64->tx_bytes = tx_bytes; 450 + stats64->tx_packets = tx_packets; 451 + } 468 452 469 453 for (i = 0, j = 0; i < BCM_SYSPORT_STATS_LEN; i++) { 470 454 const struct bcm_sysport_stats *s; ··· 487 461 continue; 488 462 p += s->stat_offset; 489 463 490 - if (s->stat_sizeof == sizeof(u64)) 464 + if (s->stat_sizeof == sizeof(u64) && 465 + s->type == BCM_SYSPORT_STAT_NETDEV64) { 491 466 do { 492 467 start = u64_stats_fetch_begin_irq(syncp); 493 468 data[i] = *(u64 *)p; 494 469 } while (u64_stats_fetch_retry_irq(syncp, start)); 495 - else 470 + } else 496 471 data[i] = *(u32 *)p; 497 472 j++; 498 473 } ··· 1743 1716 { 1744 1717 struct bcm_sysport_priv *priv = netdev_priv(dev); 1745 1718 struct bcm_sysport_stats64 *stats64 = &priv->stats64; 1746 - struct bcm_sysport_tx_ring *ring; 1747 - u64 tx_packets = 0, tx_bytes = 0; 1748 1719 unsigned int start; 1749 - unsigned int q; 1750 1720 1751 1721 netdev_stats_to_stats64(stats, &dev->stats); 1752 1722 1753 - for (q = 0; q < dev->num_tx_queues; q++) { 1754 - ring = &priv->tx_rings[q]; 1755 - do { 1756 - start = u64_stats_fetch_begin_irq(&priv->syncp); 1757 - tx_bytes = ring->bytes; 1758 - tx_packets = ring->packets; 1759 - } while (u64_stats_fetch_retry_irq(&priv->syncp, start)); 1760 - 1761 - stats->tx_bytes += tx_bytes; 1762 - stats->tx_packets += tx_packets; 1763 - } 1764 - 1765 - stats64->tx_bytes = stats->tx_bytes; 1766 - stats64->tx_packets = stats->tx_packets; 1723 + bcm_sysport_update_tx_stats(priv, &stats->tx_bytes, 1724 + &stats->tx_packets); 1767 1725 1768 1726 do { 1769 1727 start = u64_stats_fetch_begin_irq(&priv->syncp);
+4
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
··· 750 750 { 751 751 int rc = 0; 752 752 753 + if (!is_classid_clsact_ingress(cls_flower->common.classid) || 754 + cls_flower->common.chain_index) 755 + return -EOPNOTSUPP; 756 + 753 757 switch (cls_flower->command) { 754 758 case TC_CLSFLOWER_REPLACE: 755 759 rc = bnxt_tc_add_flow(bp, src_fid, cls_flower);
+2 -2
drivers/net/ethernet/freescale/fec.h
··· 374 374 #define FEC_ENET_TS_AVAIL ((uint)0x00010000) 375 375 #define FEC_ENET_TS_TIMER ((uint)0x00008000) 376 376 377 - #define FEC_DEFAULT_IMASK (FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII | FEC_ENET_TS_TIMER) 378 - #define FEC_NAPI_IMASK (FEC_ENET_MII | FEC_ENET_TS_TIMER) 377 + #define FEC_DEFAULT_IMASK (FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII) 378 + #define FEC_NAPI_IMASK FEC_ENET_MII 379 379 #define FEC_RX_DISABLED_IMASK (FEC_DEFAULT_IMASK & (~FEC_ENET_RXF)) 380 380 381 381 /* ENET interrupt coalescing macro define */
+4 -4
drivers/net/ethernet/freescale/fec_main.c
··· 1559 1559 if (int_events == 0) 1560 1560 return false; 1561 1561 1562 - if (int_events & FEC_ENET_RXF) 1562 + if (int_events & FEC_ENET_RXF_0) 1563 1563 fep->work_rx |= (1 << 2); 1564 1564 if (int_events & FEC_ENET_RXF_1) 1565 1565 fep->work_rx |= (1 << 0); 1566 1566 if (int_events & FEC_ENET_RXF_2) 1567 1567 fep->work_rx |= (1 << 1); 1568 1568 1569 - if (int_events & FEC_ENET_TXF) 1569 + if (int_events & FEC_ENET_TXF_0) 1570 1570 fep->work_tx |= (1 << 2); 1571 1571 if (int_events & FEC_ENET_TXF_1) 1572 1572 fep->work_tx |= (1 << 0); ··· 1604 1604 } 1605 1605 1606 1606 if (fep->ptp_clock) 1607 - fec_ptp_check_pps_event(fep); 1608 - 1607 + if (fec_ptp_check_pps_event(fep)) 1608 + ret = IRQ_HANDLED; 1609 1609 return ret; 1610 1610 } 1611 1611
+9 -34
drivers/net/ethernet/hisilicon/hns3/hnae3.c
··· 37 37 } 38 38 39 39 static int hnae3_match_n_instantiate(struct hnae3_client *client, 40 - struct hnae3_ae_dev *ae_dev, 41 - bool is_reg, bool *matched) 40 + struct hnae3_ae_dev *ae_dev, bool is_reg) 42 41 { 43 42 int ret; 44 - 45 - *matched = false; 46 43 47 44 /* check if this client matches the type of ae_dev */ 48 45 if (!(hnae3_client_match(client->type, ae_dev->dev_type) && 49 46 hnae_get_bit(ae_dev->flag, HNAE3_DEV_INITED_B))) { 50 47 return 0; 51 48 } 52 - /* there is a match of client and dev */ 53 - *matched = true; 54 49 55 50 /* now, (un-)instantiate client by calling lower layer */ 56 51 if (is_reg) { ··· 64 69 { 65 70 struct hnae3_client *client_tmp; 66 71 struct hnae3_ae_dev *ae_dev; 67 - bool matched; 68 72 int ret = 0; 69 73 70 74 mutex_lock(&hnae3_common_lock); ··· 80 86 /* if the client could not be initialized on current port, for 81 87 * any error reasons, move on to next available port 82 88 */ 83 - ret = hnae3_match_n_instantiate(client, ae_dev, true, &matched); 89 + ret = hnae3_match_n_instantiate(client, ae_dev, true); 84 90 if (ret) 85 91 dev_err(&ae_dev->pdev->dev, 86 92 "match and instantiation failed for port\n"); ··· 96 102 void hnae3_unregister_client(struct hnae3_client *client) 97 103 { 98 104 struct hnae3_ae_dev *ae_dev; 99 - bool matched; 100 105 101 106 mutex_lock(&hnae3_common_lock); 102 107 /* un-initialize the client on every matched port */ 103 108 list_for_each_entry(ae_dev, &hnae3_ae_dev_list, node) { 104 - hnae3_match_n_instantiate(client, ae_dev, false, &matched); 109 + hnae3_match_n_instantiate(client, ae_dev, false); 105 110 } 106 111 107 112 list_del(&client->node); ··· 117 124 const struct pci_device_id *id; 118 125 struct hnae3_ae_dev *ae_dev; 119 126 struct hnae3_client *client; 120 - bool matched; 121 127 int ret = 0; 122 128 123 129 mutex_lock(&hnae3_common_lock); ··· 143 151 * initialize the figure out client instance 144 152 */ 145 153 list_for_each_entry(client, &hnae3_client_list, node) { 146 - ret = hnae3_match_n_instantiate(client, ae_dev, true, 147 - &matched); 154 + ret = hnae3_match_n_instantiate(client, ae_dev, true); 148 155 if (ret) 149 156 dev_err(&ae_dev->pdev->dev, 150 157 "match and instantiation failed\n"); 151 - if (matched) 152 - break; 153 158 } 154 159 } 155 160 ··· 164 175 const struct pci_device_id *id; 165 176 struct hnae3_ae_dev *ae_dev; 166 177 struct hnae3_client *client; 167 - bool matched; 168 178 169 179 mutex_lock(&hnae3_common_lock); 170 180 /* Check if there are matched ae_dev */ ··· 175 187 /* check the client list for the match with this ae_dev type and 176 188 * un-initialize the figure out client instance 177 189 */ 178 - list_for_each_entry(client, &hnae3_client_list, node) { 179 - hnae3_match_n_instantiate(client, ae_dev, false, 180 - &matched); 181 - if (matched) 182 - break; 183 - } 190 + list_for_each_entry(client, &hnae3_client_list, node) 191 + hnae3_match_n_instantiate(client, ae_dev, false); 184 192 185 193 ae_algo->ops->uninit_ae_dev(ae_dev); 186 194 hnae_set_bit(ae_dev->flag, HNAE3_DEV_INITED_B, 0); ··· 196 212 const struct pci_device_id *id; 197 213 struct hnae3_ae_algo *ae_algo; 198 214 struct hnae3_client *client; 199 - bool matched; 200 215 int ret = 0; 201 216 202 217 mutex_lock(&hnae3_common_lock); ··· 229 246 * initialize the figure out client instance 230 247 */ 231 248 list_for_each_entry(client, &hnae3_client_list, node) { 232 - ret = hnae3_match_n_instantiate(client, ae_dev, true, 233 - &matched); 249 + ret = hnae3_match_n_instantiate(client, ae_dev, true); 234 250 if (ret) 235 251 dev_err(&ae_dev->pdev->dev, 236 252 "match and instantiation failed\n"); 237 - if (matched) 238 - break; 239 253 } 240 254 241 255 out_err: ··· 250 270 const struct pci_device_id *id; 251 271 struct hnae3_ae_algo *ae_algo; 252 272 struct hnae3_client *client; 253 - bool matched; 254 273 255 274 mutex_lock(&hnae3_common_lock); 256 275 /* Check if there are matched ae_algo */ ··· 258 279 if (!id) 259 280 continue; 260 281 261 - list_for_each_entry(client, &hnae3_client_list, node) { 262 - hnae3_match_n_instantiate(client, ae_dev, false, 263 - &matched); 264 - if (matched) 265 - break; 266 - } 282 + list_for_each_entry(client, &hnae3_client_list, node) 283 + hnae3_match_n_instantiate(client, ae_dev, false); 267 284 268 285 ae_algo->ops->uninit_ae_dev(ae_dev); 269 286 hnae_set_bit(ae_dev->flag, HNAE3_DEV_INITED_B, 0);
+13 -2
drivers/net/ethernet/hisilicon/hns3/hnae3.h
··· 49 49 #define HNAE3_CLASS_NAME_SIZE 16 50 50 51 51 #define HNAE3_DEV_INITED_B 0x0 52 - #define HNAE_DEV_SUPPORT_ROCE_B 0x1 52 + #define HNAE3_DEV_SUPPORT_ROCE_B 0x1 53 + #define HNAE3_DEV_SUPPORT_DCB_B 0x2 54 + 55 + #define HNAE3_DEV_SUPPORT_ROCE_DCB_BITS (BIT(HNAE3_DEV_SUPPORT_DCB_B) |\ 56 + BIT(HNAE3_DEV_SUPPORT_ROCE_B)) 57 + 58 + #define hnae3_dev_roce_supported(hdev) \ 59 + hnae_get_bit(hdev->ae_dev->flag, HNAE3_DEV_SUPPORT_ROCE_B) 60 + 61 + #define hnae3_dev_dcb_supported(hdev) \ 62 + hnae_get_bit(hdev->ae_dev->flag, HNAE3_DEV_SUPPORT_DCB_B) 53 63 54 64 #define ring_ptr_move_fw(ring, p) \ 55 65 ((ring)->p = ((ring)->p + 1) % (ring)->desc_num) ··· 376 366 struct hnae3_tc_info { 377 367 u16 tqp_offset; /* TQP offset from base TQP */ 378 368 u16 tqp_count; /* Total TQPs */ 379 - u8 up; /* user priority */ 380 369 u8 tc; /* TC index */ 381 370 bool enable; /* If this TC is enable or not */ 382 371 }; 383 372 384 373 #define HNAE3_MAX_TC 8 374 + #define HNAE3_MAX_USER_PRIO 8 385 375 struct hnae3_knic_private_info { 386 376 struct net_device *netdev; /* Set by KNIC client when init instance */ 387 377 u16 rss_size; /* Allocated RSS queues */ ··· 389 379 u16 num_desc; 390 380 391 381 u8 num_tc; /* Total number of enabled TCs */ 382 + u8 prio_tc[HNAE3_MAX_USER_PRIO]; /* TC indexed by prio */ 392 383 struct hnae3_tc_info tc_info[HNAE3_MAX_TC]; /* Idx of array is HW TC */ 393 384 394 385 u16 num_tqps; /* total number of TQPs in this handle */
+9 -3
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
··· 238 238 u8 rsv[18]; 239 239 }; 240 240 241 - #define HCLGE_VECTOR_ELEMENTS_PER_CMD 11 241 + #define HCLGE_VECTOR_ELEMENTS_PER_CMD 10 242 242 243 243 enum hclge_int_type { 244 244 HCLGE_INT_TX, ··· 252 252 #define HCLGE_INT_TYPE_S 0 253 253 #define HCLGE_INT_TYPE_M 0x3 254 254 #define HCLGE_TQP_ID_S 2 255 - #define HCLGE_TQP_ID_M (0x3fff << HCLGE_TQP_ID_S) 255 + #define HCLGE_TQP_ID_M (0x7ff << HCLGE_TQP_ID_S) 256 + #define HCLGE_INT_GL_IDX_S 13 257 + #define HCLGE_INT_GL_IDX_M (0x3 << HCLGE_INT_GL_IDX_S) 256 258 __le16 tqp_type_and_id[HCLGE_VECTOR_ELEMENTS_PER_CMD]; 259 + u8 vfid; 260 + u8 rsv; 257 261 }; 258 262 259 263 #define HCLGE_TC_NUM 8 ··· 270 266 271 267 struct hclge_rx_priv_buff { 272 268 __le16 buf_num[HCLGE_TC_NUM]; 273 - u8 rsv[8]; 269 + __le16 shared_buf; 270 + u8 rsv[6]; 274 271 }; 275 272 276 273 struct hclge_query_version { ··· 689 684 #define HCLGE_DEFAULT_TX_BUF 0x4000 /* 16k bytes */ 690 685 #define HCLGE_TOTAL_PKT_BUF 0x108000 /* 1.03125M bytes */ 691 686 #define HCLGE_DEFAULT_DV 0xA000 /* 40k byte */ 687 + #define HCLGE_DEFAULT_NON_DCB_DV 0x7800 /* 30K byte */ 692 688 693 689 #define HCLGE_TYPE_CRQ 0 694 690 #define HCLGE_TYPE_CSQ 1
+106 -81
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
··· 46 46 {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA), 0}, 47 47 {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA_MACSEC), 0}, 48 48 {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_100G_RDMA_MACSEC), 0}, 49 - /* Required last entry */ 50 - {0, } 51 - }; 52 - 53 - static const struct pci_device_id roce_pci_tbl[] = { 54 - {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE_RDMA), 0}, 55 - {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE_RDMA_MACSEC), 0}, 56 - {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA), 0}, 57 - {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA_MACSEC), 0}, 58 - {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_100G_RDMA_MACSEC), 0}, 59 - /* Required last entry */ 49 + /* required last entry */ 60 50 {0, } 61 51 }; 62 52 ··· 884 894 hdev->num_tqps = __le16_to_cpu(req->tqp_num); 885 895 hdev->pkt_buf_size = __le16_to_cpu(req->buf_size) << HCLGE_BUF_UNIT_S; 886 896 887 - if (hnae_get_bit(hdev->ae_dev->flag, HNAE_DEV_SUPPORT_ROCE_B)) { 897 + if (hnae3_dev_roce_supported(hdev)) { 888 898 hdev->num_roce_msix = 889 899 hnae_get_field(__le16_to_cpu(req->pf_intr_vector_number), 890 900 HCLGE_PF_VEC_NUM_M, HCLGE_PF_VEC_NUM_S); ··· 1053 1063 hdev->base_tqp_pid = 0; 1054 1064 hdev->rss_size_max = 1; 1055 1065 hdev->rx_buf_len = cfg.rx_buf_len; 1056 - for (i = 0; i < ETH_ALEN; i++) 1057 - hdev->hw.mac.mac_addr[i] = cfg.mac_addr[i]; 1066 + ether_addr_copy(hdev->hw.mac.mac_addr, cfg.mac_addr); 1058 1067 hdev->hw.mac.media_type = cfg.media_type; 1068 + hdev->hw.mac.phy_addr = cfg.phy_addr; 1059 1069 hdev->num_desc = cfg.tqp_desc_num; 1060 1070 hdev->tm_info.num_pg = 1; 1061 1071 hdev->tm_info.num_tc = cfg.tc_num; ··· 1444 1454 tc_num = hclge_get_tc_num(hdev); 1445 1455 pfc_enable_num = hclge_get_pfc_enalbe_num(hdev); 1446 1456 1447 - shared_buf_min = 2 * hdev->mps + HCLGE_DEFAULT_DV; 1457 + if (hnae3_dev_dcb_supported(hdev)) 1458 + shared_buf_min = 2 * hdev->mps + HCLGE_DEFAULT_DV; 1459 + else 1460 + shared_buf_min = 2 * hdev->mps + HCLGE_DEFAULT_NON_DCB_DV; 1461 + 1448 1462 shared_buf_tc = pfc_enable_num * hdev->mps + 1449 1463 (tc_num - pfc_enable_num) * hdev->mps / 2 + 1450 1464 hdev->mps; ··· 1489 1495 struct hclge_priv_buf *priv; 1490 1496 int i; 1491 1497 1498 + /* When DCB is not supported, rx private 1499 + * buffer is not allocated. 1500 + */ 1501 + if (!hnae3_dev_dcb_supported(hdev)) { 1502 + if (!hclge_is_rx_buf_ok(hdev, rx_all)) 1503 + return -ENOMEM; 1504 + 1505 + return 0; 1506 + } 1507 + 1492 1508 /* step 1, try to alloc private buffer for all enabled tc */ 1493 1509 for (i = 0; i < HCLGE_MAX_TC_NUM; i++) { 1494 1510 priv = &hdev->priv_buf[i]; ··· 1514 1510 priv->wl.high = 2 * hdev->mps; 1515 1511 priv->buf_size = priv->wl.high; 1516 1512 } 1513 + } else { 1514 + priv->enable = 0; 1515 + priv->wl.low = 0; 1516 + priv->wl.high = 0; 1517 + priv->buf_size = 0; 1517 1518 } 1518 1519 } 1519 1520 ··· 1531 1522 for (i = 0; i < HCLGE_MAX_TC_NUM; i++) { 1532 1523 priv = &hdev->priv_buf[i]; 1533 1524 1534 - if (hdev->hw_tc_map & BIT(i)) 1535 - priv->enable = 1; 1525 + priv->enable = 0; 1526 + priv->wl.low = 0; 1527 + priv->wl.high = 0; 1528 + priv->buf_size = 0; 1529 + 1530 + if (!(hdev->hw_tc_map & BIT(i))) 1531 + continue; 1532 + 1533 + priv->enable = 1; 1536 1534 1537 1535 if (hdev->tm_info.hw_pfc_map & BIT(i)) { 1538 1536 priv->wl.low = 128; ··· 1631 1615 req->buf_num[i] |= 1632 1616 cpu_to_le16(true << HCLGE_TC0_PRI_BUF_EN_B); 1633 1617 } 1618 + 1619 + req->shared_buf = 1620 + cpu_to_le16((hdev->s_buf.buf_size >> HCLGE_BUF_UNIT_S) | 1621 + (1 << HCLGE_TC0_PRI_BUF_EN_B)); 1634 1622 1635 1623 ret = hclge_cmd_send(&hdev->hw, &desc, 1); 1636 1624 if (ret) { ··· 1802 1782 return ret; 1803 1783 } 1804 1784 1805 - ret = hclge_rx_priv_wl_config(hdev); 1806 - if (ret) { 1807 - dev_err(&hdev->pdev->dev, 1808 - "could not configure rx private waterline %d\n", ret); 1809 - return ret; 1810 - } 1785 + if (hnae3_dev_dcb_supported(hdev)) { 1786 + ret = hclge_rx_priv_wl_config(hdev); 1787 + if (ret) { 1788 + dev_err(&hdev->pdev->dev, 1789 + "could not configure rx private waterline %d\n", 1790 + ret); 1791 + return ret; 1792 + } 1811 1793 1812 - ret = hclge_common_thrd_config(hdev); 1813 - if (ret) { 1814 - dev_err(&hdev->pdev->dev, 1815 - "could not configure common threshold %d\n", ret); 1816 - return ret; 1794 + ret = hclge_common_thrd_config(hdev); 1795 + if (ret) { 1796 + dev_err(&hdev->pdev->dev, 1797 + "could not configure common threshold %d\n", 1798 + ret); 1799 + return ret; 1800 + } 1817 1801 } 1818 1802 1819 1803 ret = hclge_common_wl_config(hdev); ··· 2606 2582 u16 tc_valid[HCLGE_MAX_TC_NUM]; 2607 2583 u16 tc_size[HCLGE_MAX_TC_NUM]; 2608 2584 u32 *rss_indir = NULL; 2585 + u16 rss_size = 0, roundup_size; 2609 2586 const u8 *key; 2610 2587 int i, ret, j; 2611 2588 ··· 2621 2596 for (j = 0; j < hdev->num_vmdq_vport + 1; j++) { 2622 2597 for (i = 0; i < HCLGE_RSS_IND_TBL_SIZE; i++) { 2623 2598 vport[j].rss_indirection_tbl[i] = 2624 - i % hdev->rss_size_max; 2599 + i % vport[j].alloc_rss_size; 2600 + 2601 + /* vport 0 is for PF */ 2602 + if (j != 0) 2603 + continue; 2604 + 2605 + rss_size = vport[j].alloc_rss_size; 2625 2606 rss_indir[i] = vport[j].rss_indirection_tbl[i]; 2626 2607 } 2627 2608 } ··· 2644 2613 if (ret) 2645 2614 goto err; 2646 2615 2647 - for (i = 0; i < HCLGE_MAX_TC_NUM; i++) { 2648 - if (hdev->hw_tc_map & BIT(i)) 2649 - tc_valid[i] = 1; 2650 - else 2651 - tc_valid[i] = 0; 2652 - 2653 - switch (hdev->rss_size_max) { 2654 - case HCLGE_RSS_TC_SIZE_0: 2655 - tc_size[i] = 0; 2656 - break; 2657 - case HCLGE_RSS_TC_SIZE_1: 2658 - tc_size[i] = 1; 2659 - break; 2660 - case HCLGE_RSS_TC_SIZE_2: 2661 - tc_size[i] = 2; 2662 - break; 2663 - case HCLGE_RSS_TC_SIZE_3: 2664 - tc_size[i] = 3; 2665 - break; 2666 - case HCLGE_RSS_TC_SIZE_4: 2667 - tc_size[i] = 4; 2668 - break; 2669 - case HCLGE_RSS_TC_SIZE_5: 2670 - tc_size[i] = 5; 2671 - break; 2672 - case HCLGE_RSS_TC_SIZE_6: 2673 - tc_size[i] = 6; 2674 - break; 2675 - case HCLGE_RSS_TC_SIZE_7: 2676 - tc_size[i] = 7; 2677 - break; 2678 - default: 2679 - break; 2680 - } 2681 - tc_offset[i] = hdev->rss_size_max * i; 2616 + /* Each TC have the same queue size, and tc_size set to hardware is 2617 + * the log2 of roundup power of two of rss_size, the acutal queue 2618 + * size is limited by indirection table. 2619 + */ 2620 + if (rss_size > HCLGE_RSS_TC_SIZE_7 || rss_size == 0) { 2621 + dev_err(&hdev->pdev->dev, 2622 + "Configure rss tc size failed, invalid TC_SIZE = %d\n", 2623 + rss_size); 2624 + return -EINVAL; 2682 2625 } 2626 + 2627 + roundup_size = roundup_pow_of_two(rss_size); 2628 + roundup_size = ilog2(roundup_size); 2629 + 2630 + for (i = 0; i < HCLGE_MAX_TC_NUM; i++) { 2631 + tc_valid[i] = 0; 2632 + 2633 + if (!(hdev->hw_tc_map & BIT(i))) 2634 + continue; 2635 + 2636 + tc_valid[i] = 1; 2637 + tc_size[i] = roundup_size; 2638 + tc_offset[i] = rss_size * i; 2639 + } 2640 + 2683 2641 ret = hclge_set_rss_tc_mode(hdev, tc_valid, tc_size, tc_offset); 2684 2642 2685 2643 err: ··· 2699 2679 hnae_get_bit(node->flag, HNAE3_RING_TYPE_B)); 2700 2680 hnae_set_field(req->tqp_type_and_id[i], HCLGE_TQP_ID_M, 2701 2681 HCLGE_TQP_ID_S, node->tqp_index); 2682 + hnae_set_field(req->tqp_type_and_id[i], HCLGE_INT_GL_IDX_M, 2683 + HCLGE_INT_GL_IDX_S, 2684 + hnae_get_bit(node->flag, HNAE3_RING_TYPE_B)); 2702 2685 req->tqp_type_and_id[i] = cpu_to_le16(req->tqp_type_and_id[i]); 2686 + req->vfid = vport->vport_id; 2703 2687 2704 2688 if (++i >= HCLGE_VECTOR_ELEMENTS_PER_CMD) { 2705 2689 req->int_cause_num = HCLGE_VECTOR_ELEMENTS_PER_CMD; ··· 2787 2763 hnae_get_bit(node->flag, HNAE3_RING_TYPE_B)); 2788 2764 hnae_set_field(req->tqp_type_and_id[i], HCLGE_TQP_ID_M, 2789 2765 HCLGE_TQP_ID_S, node->tqp_index); 2766 + hnae_set_field(req->tqp_type_and_id[i], HCLGE_INT_GL_IDX_M, 2767 + HCLGE_INT_GL_IDX_S, 2768 + hnae_get_bit(node->flag, HNAE3_RING_TYPE_B)); 2790 2769 2791 2770 req->tqp_type_and_id[i] = cpu_to_le16(req->tqp_type_and_id[i]); 2771 + req->vfid = vport->vport_id; 2792 2772 2793 2773 if (++i >= HCLGE_VECTOR_ELEMENTS_PER_CMD) { 2794 2774 req->int_cause_num = HCLGE_VECTOR_ELEMENTS_PER_CMD; ··· 2806 2778 } 2807 2779 i = 0; 2808 2780 hclge_cmd_setup_basic_desc(&desc, 2809 - HCLGE_OPC_ADD_RING_TO_VECTOR, 2781 + HCLGE_OPC_DEL_RING_TO_VECTOR, 2810 2782 false); 2811 2783 req->int_vector_id = vector_id; 2812 2784 } ··· 3693 3665 { 3694 3666 #define HCLGE_VLAN_TYPE_VF_TABLE 0 3695 3667 #define HCLGE_VLAN_TYPE_PORT_TABLE 1 3668 + struct hnae3_handle *handle; 3696 3669 int ret; 3697 3670 3698 3671 ret = hclge_set_vlan_filter_ctrl(hdev, HCLGE_VLAN_TYPE_VF_TABLE, ··· 3703 3674 3704 3675 ret = hclge_set_vlan_filter_ctrl(hdev, HCLGE_VLAN_TYPE_PORT_TABLE, 3705 3676 true); 3677 + if (ret) 3678 + return ret; 3706 3679 3707 - return ret; 3680 + handle = &hdev->vport[0].nic; 3681 + return hclge_set_port_vlan_filter(handle, htons(ETH_P_8021Q), 0, false); 3708 3682 } 3709 3683 3710 3684 static int hclge_set_mtu(struct hnae3_handle *handle, int new_mtu) ··· 3952 3920 goto err; 3953 3921 3954 3922 if (hdev->roce_client && 3955 - hnae_get_bit(hdev->ae_dev->flag, 3956 - HNAE_DEV_SUPPORT_ROCE_B)) { 3923 + hnae3_dev_roce_supported(hdev)) { 3957 3924 struct hnae3_client *rc = hdev->roce_client; 3958 3925 3959 3926 ret = hclge_init_roce_base_info(vport); ··· 3975 3944 3976 3945 break; 3977 3946 case HNAE3_CLIENT_ROCE: 3978 - if (hnae_get_bit(hdev->ae_dev->flag, 3979 - HNAE_DEV_SUPPORT_ROCE_B)) { 3947 + if (hnae3_dev_roce_supported(hdev)) { 3980 3948 hdev->roce_client = client; 3981 3949 vport->roce.client = client; 3982 3950 } ··· 4087 4057 static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev) 4088 4058 { 4089 4059 struct pci_dev *pdev = ae_dev->pdev; 4090 - const struct pci_device_id *id; 4091 4060 struct hclge_dev *hdev; 4092 4061 int ret; 4093 4062 ··· 4100 4071 hdev->pdev = pdev; 4101 4072 hdev->ae_dev = ae_dev; 4102 4073 ae_dev->priv = hdev; 4103 - 4104 - id = pci_match_id(roce_pci_tbl, ae_dev->pdev); 4105 - if (id) 4106 - hnae_set_bit(ae_dev->flag, HNAE_DEV_SUPPORT_ROCE_B, 1); 4107 4074 4108 4075 ret = hclge_pci_init(hdev); 4109 4076 if (ret) { ··· 4163 4138 return ret; 4164 4139 } 4165 4140 4166 - ret = hclge_rss_init_hw(hdev); 4167 - if (ret) { 4168 - dev_err(&pdev->dev, "Rss init fail, ret =%d\n", ret); 4169 - return ret; 4170 - } 4171 - 4172 4141 ret = hclge_init_vlan_config(hdev); 4173 4142 if (ret) { 4174 4143 dev_err(&pdev->dev, "VLAN init fail, ret =%d\n", ret); ··· 4172 4153 ret = hclge_tm_schd_init(hdev); 4173 4154 if (ret) { 4174 4155 dev_err(&pdev->dev, "tm schd init fail, ret =%d\n", ret); 4156 + return ret; 4157 + } 4158 + 4159 + ret = hclge_rss_init_hw(hdev); 4160 + if (ret) { 4161 + dev_err(&pdev->dev, "Rss init fail, ret =%d\n", ret); 4175 4162 return ret; 4176 4163 } 4177 4164
+2 -1
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
··· 176 176 struct hclge_tc_info { 177 177 u8 tc_id; 178 178 u8 tc_sch_mode; /* 0: sp; 1: dwrr */ 179 - u8 up; 180 179 u8 pgid; 181 180 u32 bw_limit; 182 181 }; ··· 196 197 u8 num_tc; 197 198 u8 num_pg; /* It must be 1 if vNET-Base schd */ 198 199 u8 pg_dwrr[HCLGE_PG_NUM]; 200 + u8 prio_tc[HNAE3_MAX_USER_PRIO]; 199 201 struct hclge_pg_info pg_info[HCLGE_PG_NUM]; 200 202 struct hclge_tc_info tc_info[HNAE3_MAX_TC]; 201 203 enum hclge_fc_mode fc_mode; ··· 477 477 u8 rss_hash_key[HCLGE_RSS_KEY_SIZE]; /* User configured hash keys */ 478 478 /* User configured lookup table entries */ 479 479 u8 rss_indirection_tbl[HCLGE_RSS_IND_TBL_SIZE]; 480 + u16 alloc_rss_size; 480 481 481 482 u16 qs_offset; 482 483 u16 bw_limit; /* VSI BW Limit (0 = disabled) */
+24 -17
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
··· 128 128 { 129 129 u8 tc; 130 130 131 - for (tc = 0; tc < hdev->tm_info.num_tc; tc++) 132 - if (hdev->tm_info.tc_info[tc].up == pri_id) 133 - break; 131 + tc = hdev->tm_info.prio_tc[pri_id]; 134 132 135 133 if (tc >= hdev->tm_info.num_tc) 136 134 return -EINVAL; ··· 156 158 157 159 hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_PRI_TO_TC_MAPPING, false); 158 160 159 - for (pri_id = 0; pri_id < hdev->tm_info.num_tc; pri_id++) { 161 + for (pri_id = 0; pri_id < HNAE3_MAX_USER_PRIO; pri_id++) { 160 162 ret = hclge_fill_pri_array(hdev, pri, pri_id); 161 163 if (ret) 162 164 return ret; ··· 278 280 279 281 shap_cfg_cmd->pg_id = pg_id; 280 282 281 - hclge_tm_set_feild(shap_cfg_cmd->pg_shapping_para, IR_B, ir_b); 282 - hclge_tm_set_feild(shap_cfg_cmd->pg_shapping_para, IR_U, ir_u); 283 - hclge_tm_set_feild(shap_cfg_cmd->pg_shapping_para, IR_S, ir_s); 284 - hclge_tm_set_feild(shap_cfg_cmd->pg_shapping_para, BS_B, bs_b); 285 - hclge_tm_set_feild(shap_cfg_cmd->pg_shapping_para, BS_S, bs_s); 283 + hclge_tm_set_field(shap_cfg_cmd->pg_shapping_para, IR_B, ir_b); 284 + hclge_tm_set_field(shap_cfg_cmd->pg_shapping_para, IR_U, ir_u); 285 + hclge_tm_set_field(shap_cfg_cmd->pg_shapping_para, IR_S, ir_s); 286 + hclge_tm_set_field(shap_cfg_cmd->pg_shapping_para, BS_B, bs_b); 287 + hclge_tm_set_field(shap_cfg_cmd->pg_shapping_para, BS_S, bs_s); 286 288 287 289 return hclge_cmd_send(&hdev->hw, &desc, 1); 288 290 } ··· 305 307 306 308 shap_cfg_cmd->pri_id = pri_id; 307 309 308 - hclge_tm_set_feild(shap_cfg_cmd->pri_shapping_para, IR_B, ir_b); 309 - hclge_tm_set_feild(shap_cfg_cmd->pri_shapping_para, IR_U, ir_u); 310 - hclge_tm_set_feild(shap_cfg_cmd->pri_shapping_para, IR_S, ir_s); 311 - hclge_tm_set_feild(shap_cfg_cmd->pri_shapping_para, BS_B, bs_b); 312 - hclge_tm_set_feild(shap_cfg_cmd->pri_shapping_para, BS_S, bs_s); 310 + hclge_tm_set_field(shap_cfg_cmd->pri_shapping_para, IR_B, ir_b); 311 + hclge_tm_set_field(shap_cfg_cmd->pri_shapping_para, IR_U, ir_u); 312 + hclge_tm_set_field(shap_cfg_cmd->pri_shapping_para, IR_S, ir_s); 313 + hclge_tm_set_field(shap_cfg_cmd->pri_shapping_para, BS_B, bs_b); 314 + hclge_tm_set_field(shap_cfg_cmd->pri_shapping_para, BS_S, bs_s); 313 315 314 316 return hclge_cmd_send(&hdev->hw, &desc, 1); 315 317 } ··· 395 397 kinfo->num_tqps / kinfo->num_tc); 396 398 vport->qs_offset = hdev->tm_info.num_tc * vport->vport_id; 397 399 vport->dwrr = 100; /* 100 percent as init */ 400 + vport->alloc_rss_size = kinfo->rss_size; 398 401 399 402 for (i = 0; i < kinfo->num_tc; i++) { 400 403 if (hdev->hw_tc_map & BIT(i)) { ··· 403 404 kinfo->tc_info[i].tqp_offset = i * kinfo->rss_size; 404 405 kinfo->tc_info[i].tqp_count = kinfo->rss_size; 405 406 kinfo->tc_info[i].tc = i; 406 - kinfo->tc_info[i].up = hdev->tm_info.tc_info[i].up; 407 407 } else { 408 408 /* Set to default queue if TC is disable */ 409 409 kinfo->tc_info[i].enable = false; 410 410 kinfo->tc_info[i].tqp_offset = 0; 411 411 kinfo->tc_info[i].tqp_count = 1; 412 412 kinfo->tc_info[i].tc = 0; 413 - kinfo->tc_info[i].up = 0; 414 413 } 415 414 } 415 + 416 + memcpy(kinfo->prio_tc, hdev->tm_info.prio_tc, 417 + FIELD_SIZEOF(struct hnae3_knic_private_info, prio_tc)); 416 418 } 417 419 418 420 static void hclge_tm_vport_info_update(struct hclge_dev *hdev) ··· 435 435 for (i = 0; i < hdev->tm_info.num_tc; i++) { 436 436 hdev->tm_info.tc_info[i].tc_id = i; 437 437 hdev->tm_info.tc_info[i].tc_sch_mode = HCLGE_SCH_MODE_DWRR; 438 - hdev->tm_info.tc_info[i].up = i; 439 438 hdev->tm_info.tc_info[i].pgid = 0; 440 439 hdev->tm_info.tc_info[i].bw_limit = 441 440 hdev->tm_info.pg_info[0].bw_limit; 442 441 } 442 + 443 + for (i = 0; i < HNAE3_MAX_USER_PRIO; i++) 444 + hdev->tm_info.prio_tc[i] = 445 + (i >= hdev->tm_info.num_tc) ? 0 : i; 443 446 444 447 hdev->flag &= ~HCLGE_FLAG_DCB_ENABLE; 445 448 } ··· 978 975 ret = hclge_mac_pause_en_cfg(hdev, en, en); 979 976 if (ret) 980 977 return ret; 978 + 979 + /* Only DCB-supported dev supports qset back pressure setting */ 980 + if (!hnae3_dev_dcb_supported(hdev)) 981 + return 0; 981 982 982 983 for (i = 0; i < hdev->tm_info.num_tc; i++) { 983 984 ret = hclge_tm_qs_bp_cfg(hdev, i);
+2 -2
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h
··· 94 94 u32 rsvd1; 95 95 }; 96 96 97 - #define hclge_tm_set_feild(dest, string, val) \ 97 + #define hclge_tm_set_field(dest, string, val) \ 98 98 hnae_set_field((dest), (HCLGE_TM_SHAP_##string##_MSK), \ 99 99 (HCLGE_TM_SHAP_##string##_LSH), val) 100 - #define hclge_tm_get_feild(src, string) \ 100 + #define hclge_tm_get_field(src, string) \ 101 101 hnae_get_field((src), (HCLGE_TM_SHAP_##string##_MSK), \ 102 102 (HCLGE_TM_SHAP_##string##_LSH)) 103 103
+15 -8
drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c
··· 41 41 static const struct pci_device_id hns3_pci_tbl[] = { 42 42 {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_GE), 0}, 43 43 {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE), 0}, 44 - {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE_RDMA), 0}, 45 - {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE_RDMA_MACSEC), 0}, 46 - {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA), 0}, 47 - {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA_MACSEC), 0}, 48 - {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_100G_RDMA_MACSEC), 0}, 44 + {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE_RDMA), 45 + HNAE3_DEV_SUPPORT_ROCE_DCB_BITS}, 46 + {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE_RDMA_MACSEC), 47 + HNAE3_DEV_SUPPORT_ROCE_DCB_BITS}, 48 + {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA), 49 + HNAE3_DEV_SUPPORT_ROCE_DCB_BITS}, 50 + {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA_MACSEC), 51 + HNAE3_DEV_SUPPORT_ROCE_DCB_BITS}, 52 + {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_100G_RDMA_MACSEC), 53 + HNAE3_DEV_SUPPORT_ROCE_DCB_BITS}, 49 54 /* required last entry */ 50 55 {0, } 51 56 }; ··· 1353 1348 } 1354 1349 1355 1350 ae_dev->pdev = pdev; 1351 + ae_dev->flag = ent->driver_data; 1356 1352 ae_dev->dev_type = HNAE3_DEV_KNIC; 1357 1353 pci_set_drvdata(pdev, ae_dev); 1358 1354 ··· 2711 2705 eth_hw_addr_random(netdev); 2712 2706 dev_warn(priv->dev, "using random MAC address %pM\n", 2713 2707 netdev->dev_addr); 2714 - /* Also copy this new MAC address into hdev */ 2715 - if (h->ae_algo->ops->set_mac_addr) 2716 - h->ae_algo->ops->set_mac_addr(h, netdev->dev_addr); 2717 2708 } 2709 + 2710 + if (h->ae_algo->ops->set_mac_addr) 2711 + h->ae_algo->ops->set_mac_addr(h, netdev->dev_addr); 2712 + 2718 2713 } 2719 2714 2720 2715 static void hns3_nic_set_priv_ops(struct net_device *netdev)
+1 -2
drivers/net/ethernet/ibm/emac/mal.c
··· 402 402 unsigned long flags; 403 403 404 404 MAL_DBG2(mal, "poll(%d)" NL, budget); 405 - again: 405 + 406 406 /* Process TX skbs */ 407 407 list_for_each(l, &mal->poll_list) { 408 408 struct mal_commac *mc = ··· 451 451 spin_lock_irqsave(&mal->lock, flags); 452 452 mal_disable_eob_irq(mal); 453 453 spin_unlock_irqrestore(&mal->lock, flags); 454 - goto again; 455 454 } 456 455 mc->ops->poll_tx(mc->dev); 457 456 }
+30
drivers/net/ethernet/qualcomm/emac/emac-ethtool.c
··· 88 88 static int emac_get_sset_count(struct net_device *netdev, int sset) 89 89 { 90 90 switch (sset) { 91 + case ETH_SS_PRIV_FLAGS: 92 + return 1; 91 93 case ETH_SS_STATS: 92 94 return EMAC_STATS_LEN; 93 95 default: ··· 102 100 unsigned int i; 103 101 104 102 switch (stringset) { 103 + case ETH_SS_PRIV_FLAGS: 104 + strcpy(data, "single-pause-mode"); 105 + break; 106 + 105 107 case ETH_SS_STATS: 106 108 for (i = 0; i < EMAC_STATS_LEN; i++) { 107 109 strlcpy(data, emac_ethtool_stat_strings[i], ··· 236 230 return EMAC_MAX_REG_SIZE * sizeof(u32); 237 231 } 238 232 233 + #define EMAC_PRIV_ENABLE_SINGLE_PAUSE BIT(0) 234 + 235 + static int emac_set_priv_flags(struct net_device *netdev, u32 flags) 236 + { 237 + struct emac_adapter *adpt = netdev_priv(netdev); 238 + 239 + adpt->single_pause_mode = !!(flags & EMAC_PRIV_ENABLE_SINGLE_PAUSE); 240 + 241 + if (netif_running(netdev)) 242 + return emac_reinit_locked(adpt); 243 + 244 + return 0; 245 + } 246 + 247 + static u32 emac_get_priv_flags(struct net_device *netdev) 248 + { 249 + struct emac_adapter *adpt = netdev_priv(netdev); 250 + 251 + return adpt->single_pause_mode ? EMAC_PRIV_ENABLE_SINGLE_PAUSE : 0; 252 + } 253 + 239 254 static const struct ethtool_ops emac_ethtool_ops = { 240 255 .get_link_ksettings = phy_ethtool_get_link_ksettings, 241 256 .set_link_ksettings = phy_ethtool_set_link_ksettings, ··· 280 253 281 254 .get_regs_len = emac_get_regs_len, 282 255 .get_regs = emac_get_regs, 256 + 257 + .set_priv_flags = emac_set_priv_flags, 258 + .get_priv_flags = emac_get_priv_flags, 283 259 }; 284 260 285 261 void emac_set_ethtool_ops(struct net_device *netdev)
+22
drivers/net/ethernet/qualcomm/emac/emac-mac.c
··· 551 551 mac &= ~(HUGEN | VLAN_STRIP | TPAUSE | SIMR | HUGE | MULTI_ALL | 552 552 DEBUG_MODE | SINGLE_PAUSE_MODE); 553 553 554 + /* Enable single-pause-frame mode if requested. 555 + * 556 + * If enabled, the EMAC will send a single pause frame when the RX 557 + * queue is full. This normally leads to packet loss because 558 + * the pause frame disables the remote MAC only for 33ms (the quanta), 559 + * and then the remote MAC continues sending packets even though 560 + * the RX queue is still full. 561 + * 562 + * If disabled, the EMAC sends a pause frame every 31ms until the RX 563 + * queue is no longer full. Normally, this is the preferred 564 + * method of operation. However, when the system is hung (e.g. 565 + * cores are halted), the EMAC interrupt handler is never called 566 + * and so the RX queue fills up quickly and stays full. The resuling 567 + * non-stop "flood" of pause frames sometimes has the effect of 568 + * disabling nearby switches. In some cases, other nearby switches 569 + * are also affected, shutting down the entire network. 570 + * 571 + * The user can enable or disable single-pause-frame mode 572 + * via ethtool. 573 + */ 574 + mac |= adpt->single_pause_mode ? SINGLE_PAUSE_MODE : 0; 575 + 554 576 writel_relaxed(csr1, adpt->csr + EMAC_EMAC_WRAPPER_CSR1); 555 577 556 578 writel_relaxed(mac, adpt->base + EMAC_MAC_CTRL);
+3
drivers/net/ethernet/qualcomm/emac/emac.c
··· 443 443 444 444 /* default to automatic flow control */ 445 445 adpt->automatic = true; 446 + 447 + /* Disable single-pause-frame mode by default */ 448 + adpt->single_pause_mode = false; 446 449 } 447 450 448 451 /* Get the clock */
+3
drivers/net/ethernet/qualcomm/emac/emac.h
··· 363 363 bool tx_flow_control; 364 364 bool rx_flow_control; 365 365 366 + /* True == use single-pause-frame mode. */ 367 + bool single_pause_mode; 368 + 366 369 /* Ring parameter */ 367 370 u8 tpd_burst; 368 371 u8 rfd_burst;
+3 -2
drivers/net/ethernet/realtek/8139too.c
··· 2135 2135 if (likely(RTL_R16(IntrStatus) & RxAckBits)) 2136 2136 work_done += rtl8139_rx(dev, tp, budget); 2137 2137 2138 - if (work_done < budget && napi_complete_done(napi, work_done)) { 2138 + if (work_done < budget) { 2139 2139 unsigned long flags; 2140 2140 2141 2141 spin_lock_irqsave(&tp->lock, flags); 2142 - RTL_W16_F(IntrMask, rtl8139_intr_mask); 2142 + if (napi_complete_done(napi, work_done)) 2143 + RTL_W16_F(IntrMask, rtl8139_intr_mask); 2143 2144 spin_unlock_irqrestore(&tp->lock, flags); 2144 2145 } 2145 2146 spin_unlock(&tp->rx_lock);
+1
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
··· 315 315 { .compatible = "allwinner,sun8i-h3-emac" }, 316 316 { .compatible = "allwinner,sun8i-v3s-emac" }, 317 317 { .compatible = "allwinner,sun50i-a64-emac" }, 318 + {}, 318 319 }; 319 320 320 321 /* If phy-handle property is passed from DT, use it as the PHY */
+2
drivers/net/hyperv/hyperv_net.h
··· 150 150 u32 num_chn; 151 151 u32 send_sections; 152 152 u32 recv_sections; 153 + u32 send_section_size; 154 + u32 recv_section_size; 153 155 }; 154 156 155 157 enum rndis_device_state {
+2 -5
drivers/net/hyperv/netvsc.c
··· 76 76 net_device->max_pkt = RNDIS_MAX_PKT_DEFAULT; 77 77 net_device->pkt_align = RNDIS_PKT_ALIGN_DEFAULT; 78 78 79 - net_device->recv_section_size = NETVSC_RECV_SECTION_SIZE; 80 - net_device->send_section_size = NETVSC_SEND_SECTION_SIZE; 81 - 82 79 init_completion(&net_device->channel_init_wait); 83 80 init_waitqueue_head(&net_device->subchan_open); 84 81 INIT_WORK(&net_device->subchan_work, rndis_set_subchannel); ··· 259 262 int ret = 0; 260 263 261 264 /* Get receive buffer area. */ 262 - buf_size = device_info->recv_sections * net_device->recv_section_size; 265 + buf_size = device_info->recv_sections * device_info->recv_section_size; 263 266 buf_size = roundup(buf_size, PAGE_SIZE); 264 267 265 268 net_device->recv_buf = vzalloc(buf_size); ··· 341 344 goto cleanup; 342 345 343 346 /* Now setup the send buffer. */ 344 - buf_size = device_info->send_sections * net_device->send_section_size; 347 + buf_size = device_info->send_sections * device_info->send_section_size; 345 348 buf_size = round_up(buf_size, PAGE_SIZE); 346 349 347 350 net_device->send_buf = vzalloc(buf_size);
+8
drivers/net/hyperv/netvsc_drv.c
··· 848 848 device_info.num_chn = count; 849 849 device_info.ring_size = ring_size; 850 850 device_info.send_sections = nvdev->send_section_cnt; 851 + device_info.send_section_size = nvdev->send_section_size; 851 852 device_info.recv_sections = nvdev->recv_section_cnt; 853 + device_info.recv_section_size = nvdev->recv_section_size; 852 854 853 855 rndis_filter_device_remove(dev, nvdev); 854 856 ··· 965 963 device_info.ring_size = ring_size; 966 964 device_info.num_chn = nvdev->num_chn; 967 965 device_info.send_sections = nvdev->send_section_cnt; 966 + device_info.send_section_size = nvdev->send_section_size; 968 967 device_info.recv_sections = nvdev->recv_section_cnt; 968 + device_info.recv_section_size = nvdev->recv_section_size; 969 969 970 970 rndis_filter_device_remove(hdev, nvdev); 971 971 ··· 1489 1485 device_info.num_chn = nvdev->num_chn; 1490 1486 device_info.ring_size = ring_size; 1491 1487 device_info.send_sections = new_tx; 1488 + device_info.send_section_size = nvdev->send_section_size; 1492 1489 device_info.recv_sections = new_rx; 1490 + device_info.recv_section_size = nvdev->recv_section_size; 1493 1491 1494 1492 netif_device_detach(ndev); 1495 1493 was_opened = rndis_filter_opened(nvdev); ··· 1940 1934 device_info.ring_size = ring_size; 1941 1935 device_info.num_chn = VRSS_CHANNEL_DEFAULT; 1942 1936 device_info.send_sections = NETVSC_DEFAULT_TX; 1937 + device_info.send_section_size = NETVSC_SEND_SECTION_SIZE; 1943 1938 device_info.recv_sections = NETVSC_DEFAULT_RX; 1939 + device_info.recv_section_size = NETVSC_RECV_SECTION_SIZE; 1944 1940 1945 1941 nvdev = rndis_filter_device_add(dev, &device_info); 1946 1942 if (IS_ERR(nvdev)) {
+9 -9
drivers/net/phy/Kconfig
··· 160 160 161 161 endif 162 162 163 - menuconfig PHYLIB 164 - tristate "PHY Device support and infrastructure" 165 - depends on NETDEVICES 166 - select MDIO_DEVICE 167 - help 168 - Ethernet controllers are usually attached to PHY 169 - devices. This option provides infrastructure for 170 - managing PHY devices. 171 - 172 163 config PHYLINK 173 164 tristate 174 165 depends on NETDEVICES ··· 169 178 PHYlink models the link between the PHY and MAC, allowing fixed 170 179 configuration links, PHYs, and Serdes links with MAC level 171 180 autonegotiation modes. 181 + 182 + menuconfig PHYLIB 183 + tristate "PHY Device support and infrastructure" 184 + depends on NETDEVICES 185 + select MDIO_DEVICE 186 + help 187 + Ethernet controllers are usually attached to PHY 188 + devices. This option provides infrastructure for 189 + managing PHY devices. 172 190 173 191 if PHYLIB 174 192
+2 -1
drivers/net/phy/phy.c
··· 373 373 cmd->base.port = PORT_BNC; 374 374 else 375 375 cmd->base.port = PORT_MII; 376 - 376 + cmd->base.transceiver = phy_is_internal(phydev) ? 377 + XCVR_INTERNAL : XCVR_EXTERNAL; 377 378 cmd->base.phy_address = phydev->mdio.addr; 378 379 cmd->base.autoneg = phydev->autoneg; 379 380 cmd->base.eth_tp_mdix_ctrl = phydev->mdix_ctrl;
+1 -1
drivers/net/phy/phy_device.c
··· 879 879 { 880 880 const char *drv_name = phydev->drv ? phydev->drv->name : "unbound"; 881 881 char *irq_str; 882 - char irq_num[4]; 882 + char irq_num[8]; 883 883 884 884 switch(phydev->irq) { 885 885 case PHY_POLL:
+1 -1
drivers/net/phy/xilinx_gmii2rgmii.c
··· 44 44 priv->phy_drv->read_status(phydev); 45 45 46 46 val = mdiobus_read(phydev->mdio.bus, priv->addr, XILINX_GMII2RGMII_REG); 47 - val &= XILINX_GMII2RGMII_SPEED_MASK; 47 + val &= ~XILINX_GMII2RGMII_SPEED_MASK; 48 48 49 49 if (phydev->speed == SPEED_1000) 50 50 val |= BMCR_SPEED1000;
+24 -10
drivers/net/usb/lan78xx.c
··· 1265 1265 struct ethtool_eeprom *ee, u8 *data) 1266 1266 { 1267 1267 struct lan78xx_net *dev = netdev_priv(netdev); 1268 + int ret; 1269 + 1270 + ret = usb_autopm_get_interface(dev->intf); 1271 + if (ret) 1272 + return ret; 1268 1273 1269 1274 ee->magic = LAN78XX_EEPROM_MAGIC; 1270 1275 1271 - return lan78xx_read_raw_eeprom(dev, ee->offset, ee->len, data); 1276 + ret = lan78xx_read_raw_eeprom(dev, ee->offset, ee->len, data); 1277 + 1278 + usb_autopm_put_interface(dev->intf); 1279 + 1280 + return ret; 1272 1281 } 1273 1282 1274 1283 static int lan78xx_ethtool_set_eeprom(struct net_device *netdev, 1275 1284 struct ethtool_eeprom *ee, u8 *data) 1276 1285 { 1277 1286 struct lan78xx_net *dev = netdev_priv(netdev); 1287 + int ret; 1278 1288 1279 - /* Allow entire eeprom update only */ 1280 - if ((ee->magic == LAN78XX_EEPROM_MAGIC) && 1281 - (ee->offset == 0) && 1282 - (ee->len == 512) && 1283 - (data[0] == EEPROM_INDICATOR)) 1284 - return lan78xx_write_raw_eeprom(dev, ee->offset, ee->len, data); 1289 + ret = usb_autopm_get_interface(dev->intf); 1290 + if (ret) 1291 + return ret; 1292 + 1293 + /* Invalid EEPROM_INDICATOR at offset zero will result in a failure 1294 + * to load data from EEPROM 1295 + */ 1296 + if (ee->magic == LAN78XX_EEPROM_MAGIC) 1297 + ret = lan78xx_write_raw_eeprom(dev, ee->offset, ee->len, data); 1285 1298 else if ((ee->magic == LAN78XX_OTP_MAGIC) && 1286 1299 (ee->offset == 0) && 1287 1300 (ee->len == 512) && 1288 1301 (data[0] == OTP_INDICATOR_1)) 1289 - return lan78xx_write_raw_otp(dev, ee->offset, ee->len, data); 1302 + ret = lan78xx_write_raw_otp(dev, ee->offset, ee->len, data); 1290 1303 1291 - return -EINVAL; 1304 + usb_autopm_put_interface(dev->intf); 1305 + 1306 + return ret; 1292 1307 } 1293 1308 1294 1309 static void lan78xx_get_strings(struct net_device *netdev, u32 stringset, ··· 2449 2434 /* LAN7801 only has RGMII mode */ 2450 2435 if (dev->chipid == ID_REV_CHIP_ID_7801_) 2451 2436 buf &= ~MAC_CR_GMII_EN_; 2452 - buf |= MAC_CR_AUTO_DUPLEX_ | MAC_CR_AUTO_SPEED_; 2453 2437 ret = lan78xx_write_reg(dev, MAC_CR, buf); 2454 2438 2455 2439 ret = lan78xx_read_reg(dev, MAC_TX, &buf);
+1
include/linux/trace_events.h
··· 272 272 int perf_refcount; 273 273 struct hlist_head __percpu *perf_events; 274 274 struct bpf_prog *prog; 275 + struct perf_event *bpf_prog_owner; 275 276 276 277 int (*perf_perm)(struct trace_event_call *, 277 278 struct perf_event *);
+4 -18
include/net/dst.h
··· 271 271 static inline struct dst_entry *dst_clone(struct dst_entry *dst) 272 272 { 273 273 if (dst) 274 - atomic_inc(&dst->__refcnt); 274 + dst_hold(dst); 275 275 return dst; 276 276 } 277 277 ··· 312 312 } 313 313 314 314 /** 315 - * skb_dst_force - makes sure skb dst is refcounted 316 - * @skb: buffer 317 - * 318 - * If dst is not yet refcounted, let's do it 319 - */ 320 - static inline void skb_dst_force(struct sk_buff *skb) 321 - { 322 - if (skb_dst_is_noref(skb)) { 323 - WARN_ON(!rcu_read_lock_held()); 324 - skb->_skb_refdst &= ~SKB_DST_NOREF; 325 - dst_clone(skb_dst(skb)); 326 - } 327 - } 328 - 329 - /** 330 315 * dst_hold_safe - Take a reference on a dst if possible 331 316 * @dst: pointer to dst entry 332 317 * ··· 324 339 } 325 340 326 341 /** 327 - * skb_dst_force_safe - makes sure skb dst is refcounted 342 + * skb_dst_force - makes sure skb dst is refcounted 328 343 * @skb: buffer 329 344 * 330 345 * If dst is not yet refcounted and not destroyed, grab a ref on it. 331 346 */ 332 - static inline void skb_dst_force_safe(struct sk_buff *skb) 347 + static inline void skb_dst_force(struct sk_buff *skb) 333 348 { 334 349 if (skb_dst_is_noref(skb)) { 335 350 struct dst_entry *dst = skb_dst(skb); 336 351 352 + WARN_ON(!rcu_read_lock_held()); 337 353 if (!dst_hold_safe(dst)) 338 354 dst = NULL; 339 355
+1 -1
include/net/route.h
··· 190 190 rcu_read_lock(); 191 191 err = ip_route_input_noref(skb, dst, src, tos, devin); 192 192 if (!err) { 193 - skb_dst_force_safe(skb); 193 + skb_dst_force(skb); 194 194 if (!skb_dst(skb)) 195 195 err = -EINVAL; 196 196 }
+1 -1
include/net/sock.h
··· 856 856 static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb) 857 857 { 858 858 /* dont let skb dst not refcounted, we are going to leave rcu lock */ 859 - skb_dst_force_safe(skb); 859 + skb_dst_force(skb); 860 860 861 861 if (!sk->sk_backlog.tail) 862 862 sk->sk_backlog.head = skb;
-1
include/net/tcp.h
··· 544 544 int min_tso_segs); 545 545 void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, 546 546 int nonagle); 547 - bool tcp_may_send_now(struct sock *sk); 548 547 int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs); 549 548 int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs); 550 549 void tcp_retransmit_timer(struct sock *sk);
+5 -1
include/uapi/linux/ethtool.h
··· 1753 1753 * %ethtool_link_mode_bit_indices for the link modes, and other 1754 1754 * link features that the link partner advertised through 1755 1755 * autonegotiation; 0 if unknown or not applicable. Read-only. 1756 + * @transceiver: Used to distinguish different possible PHY types, 1757 + * reported consistently by PHYLIB. Read-only. 1756 1758 * 1757 1759 * If autonegotiation is disabled, the speed and @duplex represent the 1758 1760 * fixed link mode and are writable if the driver supports multiple ··· 1806 1804 __u8 eth_tp_mdix; 1807 1805 __u8 eth_tp_mdix_ctrl; 1808 1806 __s8 link_mode_masks_nwords; 1809 - __u32 reserved[8]; 1807 + __u8 transceiver; 1808 + __u8 reserved1[3]; 1809 + __u32 reserved[7]; 1810 1810 __u32 link_mode_masks[0]; 1811 1811 /* layout of link_mode_masks fields: 1812 1812 * __u32 map_supported[link_mode_masks_nwords];
+4 -2
kernel/bpf/devmap.c
··· 75 75 static struct bpf_map *dev_map_alloc(union bpf_attr *attr) 76 76 { 77 77 struct bpf_dtab *dtab; 78 + int err = -EINVAL; 78 79 u64 cost; 79 - int err; 80 80 81 81 /* check sanity of attributes */ 82 82 if (attr->max_entries == 0 || attr->key_size != 4 || ··· 108 108 if (err) 109 109 goto free_dtab; 110 110 111 + err = -ENOMEM; 112 + 111 113 /* A per cpu bitfield with a bit per possible net device */ 112 114 dtab->flush_needed = __alloc_percpu(dev_map_bitmap_size(attr), 113 115 __alignof__(unsigned long)); ··· 130 128 free_dtab: 131 129 free_percpu(dtab->flush_needed); 132 130 kfree(dtab); 133 - return ERR_PTR(-ENOMEM); 131 + return ERR_PTR(err); 134 132 } 135 133 136 134 static void dev_map_free(struct bpf_map *map)
+4 -2
kernel/bpf/syscall.c
··· 186 186 187 187 static void bpf_map_free_id(struct bpf_map *map, bool do_idr_lock) 188 188 { 189 + unsigned long flags; 190 + 189 191 if (do_idr_lock) 190 - spin_lock_bh(&map_idr_lock); 192 + spin_lock_irqsave(&map_idr_lock, flags); 191 193 else 192 194 __acquire(&map_idr_lock); 193 195 194 196 idr_remove(&map_idr, map->id); 195 197 196 198 if (do_idr_lock) 197 - spin_unlock_bh(&map_idr_lock); 199 + spin_unlock_irqrestore(&map_idr_lock, flags); 198 200 else 199 201 __release(&map_idr_lock); 200 202 }
+6 -1
kernel/bpf/verifier.c
··· 4205 4205 } 4206 4206 4207 4207 if (insn->imm == BPF_FUNC_redirect_map) { 4208 - u64 addr = (unsigned long)prog; 4208 + /* Note, we cannot use prog directly as imm as subsequent 4209 + * rewrites would still change the prog pointer. The only 4210 + * stable address we can use is aux, which also works with 4211 + * prog clones during blinding. 4212 + */ 4213 + u64 addr = (unsigned long)prog->aux; 4209 4214 struct bpf_insn r4_ld[] = { 4210 4215 BPF_LD_IMM64(BPF_REG_4, addr), 4211 4216 *insn,
+2 -1
kernel/events/core.c
··· 8171 8171 } 8172 8172 } 8173 8173 event->tp_event->prog = prog; 8174 + event->tp_event->bpf_prog_owner = event; 8174 8175 8175 8176 return 0; 8176 8177 } ··· 8186 8185 return; 8187 8186 8188 8187 prog = event->tp_event->prog; 8189 - if (prog) { 8188 + if (prog && event->tp_event->bpf_prog_owner == event) { 8190 8189 event->tp_event->prog = NULL; 8191 8190 bpf_prog_put(prog); 8192 8191 }
+5 -4
lib/rhashtable.c
··· 735 735 * rhashtable_walk_start - Start a hash table walk 736 736 * @iter: Hash table iterator 737 737 * 738 - * Start a hash table walk. Note that we take the RCU lock in all 739 - * cases including when we return an error. So you must always call 740 - * rhashtable_walk_stop to clean up. 738 + * Start a hash table walk at the current iterator position. Note that we take 739 + * the RCU lock in all cases including when we return an error. So you must 740 + * always call rhashtable_walk_stop to clean up. 741 741 * 742 742 * Returns zero if successful. 743 743 * ··· 846 846 * rhashtable_walk_stop - Finish a hash table walk 847 847 * @iter: Hash table iterator 848 848 * 849 - * Finish a hash table walk. 849 + * Finish a hash table walk. Does not reset the iterator to the start of the 850 + * hash table. 850 851 */ 851 852 void rhashtable_walk_stop(struct rhashtable_iter *iter) 852 853 __releases(RCU)
+7
net/compat.c
··· 185 185 ucmsg = cmsg_compat_nxthdr(kmsg, ucmsg, ucmlen); 186 186 } 187 187 188 + /* 189 + * check the length of messages copied in is the same as the 190 + * what we get from the first loop 191 + */ 192 + if ((char *)kcmsg - (char *)kcmsg_base != kcmlen) 193 + goto Einval; 194 + 188 195 /* Ok, looks like we made it. Hook it up and return success. */ 189 196 kmsg->msg_control = kcmsg_base; 190 197 kmsg->msg_controllen = kcmlen;
+7 -2
net/core/dev.c
··· 1948 1948 goto again; 1949 1949 } 1950 1950 out_unlock: 1951 - if (pt_prev) 1952 - pt_prev->func(skb2, skb->dev, pt_prev, skb->dev); 1951 + if (pt_prev) { 1952 + if (!skb_orphan_frags_rx(skb2, GFP_ATOMIC)) 1953 + pt_prev->func(skb2, skb->dev, pt_prev, skb->dev); 1954 + else 1955 + kfree_skb(skb2); 1956 + } 1953 1957 rcu_read_unlock(); 1954 1958 } 1955 1959 EXPORT_SYMBOL_GPL(dev_queue_xmit_nit); ··· 3896 3892 __skb_pull(skb, off); 3897 3893 else if (off < 0) 3898 3894 __skb_push(skb, -off); 3895 + skb->mac_header += off; 3899 3896 3900 3897 switch (act) { 3901 3898 case XDP_REDIRECT:
+2
net/core/ethtool.c
··· 525 525 = link_ksettings->base.eth_tp_mdix; 526 526 legacy_settings->eth_tp_mdix_ctrl 527 527 = link_ksettings->base.eth_tp_mdix_ctrl; 528 + legacy_settings->transceiver 529 + = link_ksettings->base.transceiver; 528 530 return retval; 529 531 } 530 532
+15 -9
net/core/filter.c
··· 1794 1794 u32 flags; 1795 1795 struct bpf_map *map; 1796 1796 struct bpf_map *map_to_flush; 1797 - const struct bpf_prog *map_owner; 1797 + unsigned long map_owner; 1798 1798 }; 1799 1799 1800 1800 static DEFINE_PER_CPU(struct redirect_info, redirect_info); ··· 2500 2500 } 2501 2501 EXPORT_SYMBOL_GPL(xdp_do_flush_map); 2502 2502 2503 + static inline bool xdp_map_invalid(const struct bpf_prog *xdp_prog, 2504 + unsigned long aux) 2505 + { 2506 + return (unsigned long)xdp_prog->aux != aux; 2507 + } 2508 + 2503 2509 static int xdp_do_redirect_map(struct net_device *dev, struct xdp_buff *xdp, 2504 2510 struct bpf_prog *xdp_prog) 2505 2511 { 2506 2512 struct redirect_info *ri = this_cpu_ptr(&redirect_info); 2507 - const struct bpf_prog *map_owner = ri->map_owner; 2513 + unsigned long map_owner = ri->map_owner; 2508 2514 struct bpf_map *map = ri->map; 2509 2515 struct net_device *fwd = NULL; 2510 2516 u32 index = ri->ifindex; ··· 2518 2512 2519 2513 ri->ifindex = 0; 2520 2514 ri->map = NULL; 2521 - ri->map_owner = NULL; 2515 + ri->map_owner = 0; 2522 2516 2523 - if (unlikely(map_owner != xdp_prog)) { 2517 + if (unlikely(xdp_map_invalid(xdp_prog, map_owner))) { 2524 2518 err = -EFAULT; 2525 2519 map = NULL; 2526 2520 goto err; ··· 2580 2574 struct bpf_prog *xdp_prog) 2581 2575 { 2582 2576 struct redirect_info *ri = this_cpu_ptr(&redirect_info); 2583 - const struct bpf_prog *map_owner = ri->map_owner; 2577 + unsigned long map_owner = ri->map_owner; 2584 2578 struct bpf_map *map = ri->map; 2585 2579 struct net_device *fwd = NULL; 2586 2580 u32 index = ri->ifindex; ··· 2589 2583 2590 2584 ri->ifindex = 0; 2591 2585 ri->map = NULL; 2592 - ri->map_owner = NULL; 2586 + ri->map_owner = 0; 2593 2587 2594 2588 if (map) { 2595 - if (unlikely(map_owner != xdp_prog)) { 2589 + if (unlikely(xdp_map_invalid(xdp_prog, map_owner))) { 2596 2590 err = -EFAULT; 2597 2591 map = NULL; 2598 2592 goto err; ··· 2638 2632 ri->ifindex = ifindex; 2639 2633 ri->flags = flags; 2640 2634 ri->map = NULL; 2641 - ri->map_owner = NULL; 2635 + ri->map_owner = 0; 2642 2636 2643 2637 return XDP_REDIRECT; 2644 2638 } ··· 2652 2646 }; 2653 2647 2654 2648 BPF_CALL_4(bpf_xdp_redirect_map, struct bpf_map *, map, u32, ifindex, u64, flags, 2655 - const struct bpf_prog *, map_owner) 2649 + unsigned long, map_owner) 2656 2650 { 2657 2651 struct redirect_info *ri = this_cpu_ptr(&redirect_info); 2658 2652
+4 -2
net/ipv4/inet_connection_sock.c
··· 266 266 #if IS_ENABLED(CONFIG_IPV6) 267 267 if (tb->fast_sk_family == AF_INET6) 268 268 return ipv6_rcv_saddr_equal(&tb->fast_v6_rcv_saddr, 269 - &sk->sk_v6_rcv_saddr, 269 + inet6_rcv_saddr(sk), 270 270 tb->fast_rcv_saddr, 271 271 sk->sk_rcv_saddr, 272 272 tb->fast_ipv6_only, ··· 321 321 goto fail_unlock; 322 322 } 323 323 success: 324 - if (!hlist_empty(&tb->owners)) { 324 + if (hlist_empty(&tb->owners)) { 325 325 tb->fastreuse = reuse; 326 326 if (sk->sk_reuseport) { 327 327 tb->fastreuseport = FASTREUSEPORT_ANY; 328 328 tb->fastuid = uid; 329 329 tb->fast_rcv_saddr = sk->sk_rcv_saddr; 330 330 tb->fast_ipv6_only = ipv6_only_sock(sk); 331 + tb->fast_sk_family = sk->sk_family; 331 332 #if IS_ENABLED(CONFIG_IPV6) 332 333 tb->fast_v6_rcv_saddr = sk->sk_v6_rcv_saddr; 333 334 #endif ··· 355 354 tb->fastuid = uid; 356 355 tb->fast_rcv_saddr = sk->sk_rcv_saddr; 357 356 tb->fast_ipv6_only = ipv6_only_sock(sk); 357 + tb->fast_sk_family = sk->sk_family; 358 358 #if IS_ENABLED(CONFIG_IPV6) 359 359 tb->fast_v6_rcv_saddr = sk->sk_v6_rcv_saddr; 360 360 #endif
+9 -34
net/ipv4/tcp_output.c
··· 1806 1806 return !after(end_seq, tcp_wnd_end(tp)); 1807 1807 } 1808 1808 1809 - /* This checks if the data bearing packet SKB (usually tcp_send_head(sk)) 1810 - * should be put on the wire right now. If so, it returns the number of 1811 - * packets allowed by the congestion window. 1812 - */ 1813 - static unsigned int tcp_snd_test(const struct sock *sk, struct sk_buff *skb, 1814 - unsigned int cur_mss, int nonagle) 1815 - { 1816 - const struct tcp_sock *tp = tcp_sk(sk); 1817 - unsigned int cwnd_quota; 1818 - 1819 - tcp_init_tso_segs(skb, cur_mss); 1820 - 1821 - if (!tcp_nagle_test(tp, skb, cur_mss, nonagle)) 1822 - return 0; 1823 - 1824 - cwnd_quota = tcp_cwnd_test(tp, skb); 1825 - if (cwnd_quota && !tcp_snd_wnd_test(tp, skb, cur_mss)) 1826 - cwnd_quota = 0; 1827 - 1828 - return cwnd_quota; 1829 - } 1830 - 1831 - /* Test if sending is allowed right now. */ 1832 - bool tcp_may_send_now(struct sock *sk) 1833 - { 1834 - const struct tcp_sock *tp = tcp_sk(sk); 1835 - struct sk_buff *skb = tcp_send_head(sk); 1836 - 1837 - return skb && 1838 - tcp_snd_test(sk, skb, tcp_current_mss(sk), 1839 - (tcp_skb_is_last(sk, skb) ? 1840 - tp->nonagle : TCP_NAGLE_PUSH)); 1841 - } 1842 - 1843 1809 /* Trim TSO SKB to LEN bytes, put the remaining data into a new packet 1844 1810 * which is put after SKB on the list. It is very much like 1845 1811 * tcp_fragment() except that it may make several kinds of assumptions ··· 3389 3423 goto done; 3390 3424 } 3391 3425 3426 + /* data was not sent, this is our new send_head */ 3427 + sk->sk_send_head = syn_data; 3428 + tp->packets_out -= tcp_skb_pcount(syn_data); 3429 + 3392 3430 fallback: 3393 3431 /* Send a regular SYN with Fast Open cookie request option */ 3394 3432 if (fo->cookie.len > 0) ··· 3445 3475 */ 3446 3476 tp->snd_nxt = tp->write_seq; 3447 3477 tp->pushed_seq = tp->write_seq; 3478 + buff = tcp_send_head(sk); 3479 + if (unlikely(buff)) { 3480 + tp->snd_nxt = TCP_SKB_CB(buff)->seq; 3481 + tp->pushed_seq = TCP_SKB_CB(buff)->seq; 3482 + } 3448 3483 TCP_INC_STATS(sock_net(sk), TCP_MIB_ACTIVEOPENS); 3449 3484 3450 3485 /* Timer for repeating the SYN until an answer. */
+23 -9
net/ipv6/addrconf.c
··· 1399 1399 return 0; 1400 1400 } 1401 1401 1402 - static inline bool ipv6_use_optimistic_addr(struct inet6_dev *idev) 1402 + static bool ipv6_use_optimistic_addr(struct net *net, 1403 + struct inet6_dev *idev) 1403 1404 { 1404 1405 #ifdef CONFIG_IPV6_OPTIMISTIC_DAD 1405 - return idev && idev->cnf.optimistic_dad && idev->cnf.use_optimistic; 1406 + if (!idev) 1407 + return false; 1408 + if (!net->ipv6.devconf_all->optimistic_dad && !idev->cnf.optimistic_dad) 1409 + return false; 1410 + if (!net->ipv6.devconf_all->use_optimistic && !idev->cnf.use_optimistic) 1411 + return false; 1412 + 1413 + return true; 1406 1414 #else 1407 1415 return false; 1408 1416 #endif ··· 1480 1472 /* Rule 3: Avoid deprecated and optimistic addresses */ 1481 1473 u8 avoid = IFA_F_DEPRECATED; 1482 1474 1483 - if (!ipv6_use_optimistic_addr(score->ifa->idev)) 1475 + if (!ipv6_use_optimistic_addr(net, score->ifa->idev)) 1484 1476 avoid |= IFA_F_OPTIMISTIC; 1485 1477 ret = ipv6_saddr_preferred(score->addr_type) || 1486 1478 !(score->ifa->flags & avoid); ··· 2468 2460 int max_addresses = in6_dev->cnf.max_addresses; 2469 2461 2470 2462 #ifdef CONFIG_IPV6_OPTIMISTIC_DAD 2471 - if (in6_dev->cnf.optimistic_dad && 2463 + if ((net->ipv6.devconf_all->optimistic_dad || 2464 + in6_dev->cnf.optimistic_dad) && 2472 2465 !net->ipv6.devconf_all->forwarding && sllao) 2473 2466 addr_flags |= IFA_F_OPTIMISTIC; 2474 2467 #endif ··· 3060 3051 u32 addr_flags = flags | IFA_F_PERMANENT; 3061 3052 3062 3053 #ifdef CONFIG_IPV6_OPTIMISTIC_DAD 3063 - if (idev->cnf.optimistic_dad && 3054 + if ((dev_net(idev->dev)->ipv6.devconf_all->optimistic_dad || 3055 + idev->cnf.optimistic_dad) && 3064 3056 !dev_net(idev->dev)->ipv6.devconf_all->forwarding) 3065 3057 addr_flags |= IFA_F_OPTIMISTIC; 3066 3058 #endif ··· 3820 3810 goto out; 3821 3811 3822 3812 if (dev->flags&(IFF_NOARP|IFF_LOOPBACK) || 3813 + dev_net(dev)->ipv6.devconf_all->accept_dad < 1 || 3823 3814 idev->cnf.accept_dad < 1 || 3824 3815 !(ifp->flags&IFA_F_TENTATIVE) || 3825 3816 ifp->flags & IFA_F_NODAD) { ··· 3852 3841 */ 3853 3842 if (ifp->flags & IFA_F_OPTIMISTIC) { 3854 3843 ip6_ins_rt(ifp->rt); 3855 - if (ipv6_use_optimistic_addr(idev)) { 3844 + if (ipv6_use_optimistic_addr(dev_net(dev), idev)) { 3856 3845 /* Because optimistic nodes can use this address, 3857 3846 * notify listeners. If DAD fails, RTM_DELADDR is sent. 3858 3847 */ ··· 3908 3897 action = DAD_ABORT; 3909 3898 ifp->state = INET6_IFADDR_STATE_POSTDAD; 3910 3899 3911 - if (idev->cnf.accept_dad > 1 && !idev->cnf.disable_ipv6 && 3900 + if ((dev_net(idev->dev)->ipv6.devconf_all->accept_dad > 1 || 3901 + idev->cnf.accept_dad > 1) && 3902 + !idev->cnf.disable_ipv6 && 3912 3903 !(ifp->flags & IFA_F_STABLE_PRIVACY)) { 3913 3904 struct in6_addr addr; 3914 3905 ··· 4953 4940 4954 4941 /* Don't send DELADDR notification for TENTATIVE address, 4955 4942 * since NEWADDR notification is sent only after removing 4956 - * TENTATIVE flag. 4943 + * TENTATIVE flag, if DAD has not failed. 4957 4944 */ 4958 - if (ifa->flags & IFA_F_TENTATIVE && event == RTM_DELADDR) 4945 + if (ifa->flags & IFA_F_TENTATIVE && !(ifa->flags & IFA_F_DADFAILED) && 4946 + event == RTM_DELADDR) 4959 4947 return; 4960 4948 4961 4949 skb = nlmsg_new(inet6_ifaddr_msgsize(), GFP_ATOMIC);
+11 -10
net/ipv6/ip6_gre.c
··· 940 940 } 941 941 942 942 static int ip6gre_header(struct sk_buff *skb, struct net_device *dev, 943 - unsigned short type, 944 - const void *daddr, const void *saddr, unsigned int len) 943 + unsigned short type, const void *daddr, 944 + const void *saddr, unsigned int len) 945 945 { 946 946 struct ip6_tnl *t = netdev_priv(dev); 947 - struct ipv6hdr *ipv6h = skb_push(skb, t->hlen); 948 - __be16 *p = (__be16 *)(ipv6h+1); 947 + struct ipv6hdr *ipv6h; 948 + __be16 *p; 949 949 950 - ip6_flow_hdr(ipv6h, 0, 951 - ip6_make_flowlabel(dev_net(dev), skb, 952 - t->fl.u.ip6.flowlabel, true, 953 - &t->fl.u.ip6)); 950 + ipv6h = skb_push(skb, t->hlen + sizeof(*ipv6h)); 951 + ip6_flow_hdr(ipv6h, 0, ip6_make_flowlabel(dev_net(dev), skb, 952 + t->fl.u.ip6.flowlabel, 953 + true, &t->fl.u.ip6)); 954 954 ipv6h->hop_limit = t->parms.hop_limit; 955 955 ipv6h->nexthdr = NEXTHDR_GRE; 956 956 ipv6h->saddr = t->parms.laddr; 957 957 ipv6h->daddr = t->parms.raddr; 958 958 959 - p[0] = t->parms.o_flags; 960 - p[1] = htons(type); 959 + p = (__be16 *)(ipv6h + 1); 960 + p[0] = t->parms.o_flags; 961 + p[1] = htons(type); 961 962 962 963 /* 963 964 * Set the source hardware address.
+3
net/ipv6/ip6_tunnel.c
··· 2259 2259 { 2260 2260 int err; 2261 2261 2262 + if (!ipv6_mod_enabled()) 2263 + return -EOPNOTSUPP; 2264 + 2262 2265 err = register_pernet_device(&ip6_tnl_net_ops); 2263 2266 if (err < 0) 2264 2267 goto out_pernet;
+1
net/ipv6/udp.c
··· 1015 1015 */ 1016 1016 offset = skb_transport_offset(skb); 1017 1017 skb->csum = skb_checksum(skb, offset, skb->len - offset, 0); 1018 + csum = skb->csum; 1018 1019 1019 1020 skb->ip_summed = CHECKSUM_NONE; 1020 1021
+13 -1
net/netfilter/ipset/ip_set_hash_gen.h
··· 1041 1041 static int 1042 1042 mtype_head(struct ip_set *set, struct sk_buff *skb) 1043 1043 { 1044 - const struct htype *h = set->data; 1044 + struct htype *h = set->data; 1045 1045 const struct htable *t; 1046 1046 struct nlattr *nested; 1047 1047 size_t memsize; 1048 1048 u8 htable_bits; 1049 + 1050 + /* If any members have expired, set->elements will be wrong 1051 + * mytype_expire function will update it with the right count. 1052 + * we do not hold set->lock here, so grab it first. 1053 + * set->elements can still be incorrect in the case of a huge set, 1054 + * because elements might time out during the listing. 1055 + */ 1056 + if (SET_WITH_TIMEOUT(set)) { 1057 + spin_lock_bh(&set->lock); 1058 + mtype_expire(set, h); 1059 + spin_unlock_bh(&set->lock); 1060 + } 1049 1061 1050 1062 rcu_read_lock_bh(); 1051 1063 t = rcu_dereference_bh_nfnl(h->table);
+6 -6
net/netfilter/nf_nat_core.c
··· 429 429 430 430 srchash = hash_by_src(net, 431 431 &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); 432 - lock = &nf_nat_locks[srchash % ARRAY_SIZE(nf_nat_locks)]; 432 + lock = &nf_nat_locks[srchash % CONNTRACK_LOCKS]; 433 433 spin_lock_bh(lock); 434 434 hlist_add_head_rcu(&ct->nat_bysource, 435 435 &nf_nat_bysource[srchash]); ··· 532 532 unsigned int h; 533 533 534 534 h = hash_by_src(nf_ct_net(ct), &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); 535 - spin_lock_bh(&nf_nat_locks[h % ARRAY_SIZE(nf_nat_locks)]); 535 + spin_lock_bh(&nf_nat_locks[h % CONNTRACK_LOCKS]); 536 536 hlist_del_rcu(&ct->nat_bysource); 537 - spin_unlock_bh(&nf_nat_locks[h % ARRAY_SIZE(nf_nat_locks)]); 537 + spin_unlock_bh(&nf_nat_locks[h % CONNTRACK_LOCKS]); 538 538 } 539 539 540 540 static int nf_nat_proto_clean(struct nf_conn *ct, void *data) ··· 807 807 808 808 /* Leave them the same for the moment. */ 809 809 nf_nat_htable_size = nf_conntrack_htable_size; 810 - if (nf_nat_htable_size < ARRAY_SIZE(nf_nat_locks)) 811 - nf_nat_htable_size = ARRAY_SIZE(nf_nat_locks); 810 + if (nf_nat_htable_size < CONNTRACK_LOCKS) 811 + nf_nat_htable_size = CONNTRACK_LOCKS; 812 812 813 813 nf_nat_bysource = nf_ct_alloc_hashtable(&nf_nat_htable_size, 0); 814 814 if (!nf_nat_bysource) ··· 821 821 return ret; 822 822 } 823 823 824 - for (i = 0; i < ARRAY_SIZE(nf_nat_locks); i++) 824 + for (i = 0; i < CONNTRACK_LOCKS; i++) 825 825 spin_lock_init(&nf_nat_locks[i]); 826 826 827 827 nf_ct_helper_expectfn_register(&follow_master_nat);
+11 -5
net/packet/af_packet.c
··· 1684 1684 1685 1685 mutex_lock(&fanout_mutex); 1686 1686 1687 - err = -EINVAL; 1688 - if (!po->running) 1689 - goto out; 1690 - 1691 1687 err = -EALREADY; 1692 1688 if (po->fanout) 1693 1689 goto out; ··· 1745 1749 list_add(&match->list, &fanout_list); 1746 1750 } 1747 1751 err = -EINVAL; 1748 - if (match->type == type && 1752 + 1753 + spin_lock(&po->bind_lock); 1754 + if (po->running && 1755 + match->type == type && 1749 1756 match->prot_hook.type == po->prot_hook.type && 1750 1757 match->prot_hook.dev == po->prot_hook.dev) { 1751 1758 err = -ENOSPC; ··· 1760 1761 err = 0; 1761 1762 } 1762 1763 } 1764 + spin_unlock(&po->bind_lock); 1765 + 1766 + if (err && !refcount_read(&match->sk_ref)) { 1767 + list_del(&match->list); 1768 + kfree(match); 1769 + } 1770 + 1763 1771 out: 1764 1772 if (err && rollover) { 1765 1773 kfree(rollover);
+9 -6
net/sched/cls_flower.c
··· 922 922 923 923 if (!tc_flags_valid(fnew->flags)) { 924 924 err = -EINVAL; 925 - goto errout; 925 + goto errout_idr; 926 926 } 927 927 } 928 928 929 929 err = fl_set_parms(net, tp, fnew, &mask, base, tb, tca[TCA_RATE], ovr); 930 930 if (err) 931 - goto errout; 931 + goto errout_idr; 932 932 933 933 err = fl_check_assign_mask(head, &mask); 934 934 if (err) 935 - goto errout; 935 + goto errout_idr; 936 936 937 937 if (!tc_skip_sw(fnew->flags)) { 938 938 if (!fold && fl_lookup(head, &fnew->mkey)) { 939 939 err = -EEXIST; 940 - goto errout; 940 + goto errout_idr; 941 941 } 942 942 943 943 err = rhashtable_insert_fast(&head->ht, &fnew->ht_node, 944 944 head->ht_params); 945 945 if (err) 946 - goto errout; 946 + goto errout_idr; 947 947 } 948 948 949 949 if (!tc_skip_hw(fnew->flags)) { ··· 952 952 &mask.key, 953 953 fnew); 954 954 if (err) 955 - goto errout; 955 + goto errout_idr; 956 956 } 957 957 958 958 if (!tc_in_hw(fnew->flags)) ··· 981 981 kfree(tb); 982 982 return 0; 983 983 984 + errout_idr: 985 + if (fnew->handle) 986 + idr_remove_ext(&head->handle_idr, fnew->handle); 984 987 errout: 985 988 tcf_exts_destroy(&fnew->exts); 986 989 kfree(fnew);
+1
net/sched/cls_matchall.c
··· 32 32 if (tc_skip_sw(head->flags)) 33 33 return -1; 34 34 35 + *res = head->res; 35 36 return tcf_exts_exec(skb, &head->exts, res); 36 37 } 37 38
+1
net/sched/sch_generic.c
··· 685 685 qdisc->gso_skb = NULL; 686 686 } 687 687 qdisc->q.qlen = 0; 688 + qdisc->qstats.backlog = 0; 688 689 } 689 690 EXPORT_SYMBOL(qdisc_reset); 690 691
+19 -4
net/sched/sch_hfsc.c
··· 958 958 } 959 959 960 960 if (cl != NULL) { 961 + int old_flags; 962 + 961 963 if (parentid) { 962 964 if (cl->cl_parent && 963 965 cl->cl_parent->cl_common.classid != parentid) ··· 980 978 } 981 979 982 980 sch_tree_lock(sch); 981 + old_flags = cl->cl_flags; 982 + 983 983 if (rsc != NULL) 984 984 hfsc_change_rsc(cl, rsc, cur_time); 985 985 if (fsc != NULL) ··· 990 986 hfsc_change_usc(cl, usc, cur_time); 991 987 992 988 if (cl->qdisc->q.qlen != 0) { 993 - if (cl->cl_flags & HFSC_RSC) 994 - update_ed(cl, qdisc_peek_len(cl->qdisc)); 995 - if (cl->cl_flags & HFSC_FSC) 996 - update_vf(cl, 0, cur_time); 989 + int len = qdisc_peek_len(cl->qdisc); 990 + 991 + if (cl->cl_flags & HFSC_RSC) { 992 + if (old_flags & HFSC_RSC) 993 + update_ed(cl, len); 994 + else 995 + init_ed(cl, len); 996 + } 997 + 998 + if (cl->cl_flags & HFSC_FSC) { 999 + if (old_flags & HFSC_FSC) 1000 + update_vf(cl, 0, cur_time); 1001 + else 1002 + init_vf(cl, len); 1003 + } 997 1004 } 998 1005 sch_tree_unlock(sch); 999 1006
+9 -7
net/smc/af_smc.c
··· 282 282 __be32 *subnet, u8 *prefix_len) 283 283 { 284 284 struct dst_entry *dst = sk_dst_get(clcsock->sk); 285 + struct in_device *in_dev; 285 286 struct sockaddr_in addr; 286 287 int rc = -ENOENT; 287 288 int len; ··· 299 298 /* get address to which the internal TCP socket is bound */ 300 299 kernel_getsockname(clcsock, (struct sockaddr *)&addr, &len); 301 300 /* analyze IPv4 specific data of net_device belonging to TCP socket */ 302 - for_ifa(dst->dev->ip_ptr) { 303 - if (ifa->ifa_address != addr.sin_addr.s_addr) 301 + rcu_read_lock(); 302 + in_dev = __in_dev_get_rcu(dst->dev); 303 + for_ifa(in_dev) { 304 + if (!inet_ifa_match(addr.sin_addr.s_addr, ifa)) 304 305 continue; 305 306 *prefix_len = inet_mask_len(ifa->ifa_mask); 306 307 *subnet = ifa->ifa_address & ifa->ifa_mask; 307 308 rc = 0; 308 309 break; 309 - } endfor_ifa(dst->dev->ip_ptr); 310 + } endfor_ifa(in_dev); 311 + rcu_read_unlock(); 310 312 311 313 out_rel: 312 314 dst_release(dst); ··· 513 509 /* RDMA setup failed, switch back to TCP */ 514 510 smc->use_fallback = true; 515 511 if (reason_code && (reason_code != SMC_CLC_DECL_REPLY)) { 516 - rc = smc_clc_send_decline(smc, reason_code, 0); 512 + rc = smc_clc_send_decline(smc, reason_code); 517 513 if (rc < sizeof(struct smc_clc_msg_decline)) 518 514 goto out_err; 519 515 } ··· 808 804 rc = local_contact; 809 805 if (rc == -ENOMEM) 810 806 reason_code = SMC_CLC_DECL_MEM;/* insufficient memory*/ 811 - else if (rc == -ENOLINK) 812 - reason_code = SMC_CLC_DECL_SYNCERR; /* synchr. error */ 813 807 goto decline_rdma; 814 808 } 815 809 link = &new_smc->conn.lgr->lnk[SMC_SINGLE_LINK]; ··· 901 899 smc_conn_free(&new_smc->conn); 902 900 new_smc->use_fallback = true; 903 901 if (reason_code && (reason_code != SMC_CLC_DECL_REPLY)) { 904 - rc = smc_clc_send_decline(new_smc, reason_code, 0); 902 + rc = smc_clc_send_decline(new_smc, reason_code); 905 903 if (rc < sizeof(struct smc_clc_msg_decline)) 906 904 goto out_err; 907 905 }
+1 -1
net/smc/smc.h
··· 149 149 atomic_t sndbuf_space; /* remaining space in sndbuf */ 150 150 u16 tx_cdc_seq; /* sequence # for CDC send */ 151 151 spinlock_t send_lock; /* protect wr_sends */ 152 - struct work_struct tx_work; /* retry of smc_cdc_msg_send */ 152 + struct delayed_work tx_work; /* retry of smc_cdc_msg_send */ 153 153 154 154 struct smc_host_cdc_msg local_rx_ctrl; /* filled during event_handl. 155 155 * .prod cf. TCP rcv_nxt
+5 -5
net/smc/smc_clc.c
··· 95 95 } 96 96 if (clcm->type == SMC_CLC_DECLINE) { 97 97 reason_code = SMC_CLC_DECL_REPLY; 98 - if (ntohl(((struct smc_clc_msg_decline *)buf)->peer_diagnosis) 99 - == SMC_CLC_DECL_SYNCERR) 98 + if (((struct smc_clc_msg_decline *)buf)->hdr.flag) { 100 99 smc->conn.lgr->sync_err = true; 100 + smc_lgr_terminate(smc->conn.lgr); 101 + } 101 102 } 102 103 103 104 out: ··· 106 105 } 107 106 108 107 /* send CLC DECLINE message across internal TCP socket */ 109 - int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info, 110 - u8 out_of_sync) 108 + int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info) 111 109 { 112 110 struct smc_clc_msg_decline dclc; 113 111 struct msghdr msg; ··· 118 118 dclc.hdr.type = SMC_CLC_DECLINE; 119 119 dclc.hdr.length = htons(sizeof(struct smc_clc_msg_decline)); 120 120 dclc.hdr.version = SMC_CLC_V1; 121 - dclc.hdr.flag = out_of_sync ? 1 : 0; 121 + dclc.hdr.flag = (peer_diag_info == SMC_CLC_DECL_SYNCERR) ? 1 : 0; 122 122 memcpy(dclc.id_for_peer, local_systemid, sizeof(local_systemid)); 123 123 dclc.peer_diagnosis = htonl(peer_diag_info); 124 124 memcpy(dclc.trl.eyecatcher, SMC_EYECATCHER, sizeof(SMC_EYECATCHER));
+1 -2
net/smc/smc_clc.h
··· 106 106 107 107 int smc_clc_wait_msg(struct smc_sock *smc, void *buf, int buflen, 108 108 u8 expected_type); 109 - int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info, 110 - u8 out_of_sync); 109 + int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info); 111 110 int smc_clc_send_proposal(struct smc_sock *smc, struct smc_ib_device *smcibdev, 112 111 u8 ibport); 113 112 int smc_clc_send_confirm(struct smc_sock *smc);
+15 -12
net/smc/smc_close.c
··· 174 174 { 175 175 struct smc_cdc_conn_state_flags *txflags = 176 176 &smc->conn.local_tx_ctrl.conn_state_flags; 177 - long timeout = SMC_MAX_STREAM_WAIT_TIMEOUT; 178 177 struct smc_connection *conn = &smc->conn; 179 178 struct sock *sk = &smc->sk; 180 179 int old_state; 180 + long timeout; 181 181 int rc = 0; 182 182 183 - if (sock_flag(sk, SOCK_LINGER) && 184 - !(current->flags & PF_EXITING)) 185 - timeout = sk->sk_lingertime; 183 + timeout = current->flags & PF_EXITING ? 184 + 0 : sock_flag(sk, SOCK_LINGER) ? 185 + sk->sk_lingertime : SMC_MAX_STREAM_WAIT_TIMEOUT; 186 186 187 187 again: 188 188 old_state = sk->sk_state; ··· 208 208 case SMC_ACTIVE: 209 209 smc_close_stream_wait(smc, timeout); 210 210 release_sock(sk); 211 - cancel_work_sync(&conn->tx_work); 211 + cancel_delayed_work_sync(&conn->tx_work); 212 212 lock_sock(sk); 213 213 if (sk->sk_state == SMC_ACTIVE) { 214 214 /* send close request */ ··· 234 234 if (!smc_cdc_rxed_any_close(conn)) 235 235 smc_close_stream_wait(smc, timeout); 236 236 release_sock(sk); 237 - cancel_work_sync(&conn->tx_work); 237 + cancel_delayed_work_sync(&conn->tx_work); 238 238 lock_sock(sk); 239 239 if (sk->sk_err != ECONNABORTED) { 240 240 /* confirm close from peer */ ··· 263 263 /* peer sending PeerConnectionClosed will cause transition */ 264 264 break; 265 265 case SMC_PROCESSABORT: 266 - cancel_work_sync(&conn->tx_work); 266 + release_sock(sk); 267 + cancel_delayed_work_sync(&conn->tx_work); 268 + lock_sock(sk); 267 269 smc_close_abort(conn); 268 270 sk->sk_state = SMC_CLOSED; 269 271 smc_close_wait_tx_pends(smc); ··· 413 411 int smc_close_shutdown_write(struct smc_sock *smc) 414 412 { 415 413 struct smc_connection *conn = &smc->conn; 416 - long timeout = SMC_MAX_STREAM_WAIT_TIMEOUT; 417 414 struct sock *sk = &smc->sk; 418 415 int old_state; 416 + long timeout; 419 417 int rc = 0; 420 418 421 - if (sock_flag(sk, SOCK_LINGER)) 422 - timeout = sk->sk_lingertime; 419 + timeout = current->flags & PF_EXITING ? 420 + 0 : sock_flag(sk, SOCK_LINGER) ? 421 + sk->sk_lingertime : SMC_MAX_STREAM_WAIT_TIMEOUT; 423 422 424 423 again: 425 424 old_state = sk->sk_state; ··· 428 425 case SMC_ACTIVE: 429 426 smc_close_stream_wait(smc, timeout); 430 427 release_sock(sk); 431 - cancel_work_sync(&conn->tx_work); 428 + cancel_delayed_work_sync(&conn->tx_work); 432 429 lock_sock(sk); 433 430 /* send close wr request */ 434 431 rc = smc_close_wr(conn); ··· 442 439 if (!smc_cdc_rxed_any_close(conn)) 443 440 smc_close_stream_wait(smc, timeout); 444 441 release_sock(sk); 445 - cancel_work_sync(&conn->tx_work); 442 + cancel_delayed_work_sync(&conn->tx_work); 446 443 lock_sock(sk); 447 444 /* confirm close from peer */ 448 445 rc = smc_close_wr(conn);
+12 -4
net/smc/smc_core.c
··· 25 25 #include "smc_cdc.h" 26 26 #include "smc_close.h" 27 27 28 - #define SMC_LGR_NUM_INCR 256 29 - #define SMC_LGR_FREE_DELAY (600 * HZ) 28 + #define SMC_LGR_NUM_INCR 256 29 + #define SMC_LGR_FREE_DELAY_SERV (600 * HZ) 30 + #define SMC_LGR_FREE_DELAY_CLNT (SMC_LGR_FREE_DELAY_SERV + 10) 30 31 31 32 static u32 smc_lgr_num; /* unique link group number */ 32 33 ··· 108 107 __smc_lgr_unregister_conn(conn); 109 108 } 110 109 write_unlock_bh(&lgr->conns_lock); 111 - if (reduced && !lgr->conns_num) 112 - schedule_delayed_work(&lgr->free_work, SMC_LGR_FREE_DELAY); 110 + if (!reduced || lgr->conns_num) 111 + return; 112 + /* client link group creation always follows the server link group 113 + * creation. For client use a somewhat higher removal delay time, 114 + * otherwise there is a risk of out-of-sync link groups. 115 + */ 116 + mod_delayed_work(system_wq, &lgr->free_work, 117 + lgr->role == SMC_CLNT ? SMC_LGR_FREE_DELAY_CLNT : 118 + SMC_LGR_FREE_DELAY_SERV); 113 119 } 114 120 115 121 static void smc_lgr_free_work(struct work_struct *work)
+1
net/smc/smc_ib.c
··· 380 380 ndev = smcibdev->ibdev->get_netdev(smcibdev->ibdev, ibport); 381 381 if (ndev) { 382 382 memcpy(&smcibdev->mac, ndev->dev_addr, ETH_ALEN); 383 + dev_put(ndev); 383 384 } else if (!rc) { 384 385 memcpy(&smcibdev->mac[ibport - 1][0], 385 386 &smcibdev->gid[ibport - 1].raw[8], 3);
+3 -1
net/smc/smc_pnet.c
··· 181 181 sizeof(new_pnetelem->ndev->name)) || 182 182 smc_pnet_same_ibname(pnetelem, 183 183 new_pnetelem->smcibdev->ibdev->name, 184 - new_pnetelem->ib_port)) 184 + new_pnetelem->ib_port)) { 185 + dev_put(pnetelem->ndev); 185 186 goto found; 187 + } 186 188 } 187 189 list_add_tail(&new_pnetelem->list, &smc_pnettable.pnetlist); 188 190 rc = 0;
+2
net/smc/smc_rx.c
··· 148 148 read_done = sock_intr_errno(timeo); 149 149 break; 150 150 } 151 + if (!timeo) 152 + return -EAGAIN; 151 153 } 152 154 153 155 if (!atomic_read(&conn->bytes_to_rcv)) {
+8 -4
net/smc/smc_tx.c
··· 24 24 #include "smc_cdc.h" 25 25 #include "smc_tx.h" 26 26 27 + #define SMC_TX_WORK_DELAY HZ 28 + 27 29 /***************************** sndbuf producer *******************************/ 28 30 29 31 /* callback implementation for sk.sk_write_space() ··· 408 406 goto out_unlock; 409 407 } 410 408 rc = 0; 411 - schedule_work(&conn->tx_work); 409 + schedule_delayed_work(&conn->tx_work, 410 + SMC_TX_WORK_DELAY); 412 411 } 413 412 goto out_unlock; 414 413 } ··· 433 430 */ 434 431 static void smc_tx_work(struct work_struct *work) 435 432 { 436 - struct smc_connection *conn = container_of(work, 433 + struct smc_connection *conn = container_of(to_delayed_work(work), 437 434 struct smc_connection, 438 435 tx_work); 439 436 struct smc_sock *smc = container_of(conn, struct smc_sock, conn); ··· 471 468 if (!rc) 472 469 rc = smc_cdc_msg_send(conn, wr_buf, pend); 473 470 if (rc < 0) { 474 - schedule_work(&conn->tx_work); 471 + schedule_delayed_work(&conn->tx_work, 472 + SMC_TX_WORK_DELAY); 475 473 return; 476 474 } 477 475 smc_curs_write(&conn->rx_curs_confirmed, ··· 491 487 void smc_tx_init(struct smc_sock *smc) 492 488 { 493 489 smc->sk.sk_write_space = smc_tx_write_space; 494 - INIT_WORK(&smc->conn.tx_work, smc_tx_work); 490 + INIT_DELAYED_WORK(&smc->conn.tx_work, smc_tx_work); 495 491 spin_lock_init(&smc->conn.send_lock); 496 492 }
+1 -1
net/smc/smc_wr.c
··· 244 244 int rc; 245 245 246 246 ib_req_notify_cq(link->smcibdev->roce_cq_send, 247 - IB_CQ_SOLICITED_MASK | IB_CQ_REPORT_MISSED_EVENTS); 247 + IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS); 248 248 pend = container_of(priv, struct smc_wr_tx_pend, priv); 249 249 rc = ib_post_send(link->roce_qp, &link->wr_tx_ibs[pend->idx], 250 250 &failed_wr);
+6
net/wireless/nl80211.c
··· 9987 9987 if (err) 9988 9988 return err; 9989 9989 9990 + if (!setup.chandef.chan) 9991 + return -EINVAL; 9992 + 9990 9993 err = validate_beacon_tx_rate(rdev, setup.chandef.chan->band, 9991 9994 &setup.beacon_rate); 9992 9995 if (err) ··· 10906 10903 if (err) 10907 10904 return err; 10908 10905 10906 + if (!tb[NL80211_REKEY_DATA_REPLAY_CTR] || !tb[NL80211_REKEY_DATA_KEK] || 10907 + !tb[NL80211_REKEY_DATA_KCK]) 10908 + return -EINVAL; 10909 10909 if (nla_len(tb[NL80211_REKEY_DATA_REPLAY_CTR]) != NL80211_REPLAY_CTR_LEN) 10910 10910 return -ERANGE; 10911 10911 if (nla_len(tb[NL80211_REKEY_DATA_KEK]) != NL80211_KEK_LEN)