History

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

Pull networking fixes from David Miller: 1) ICE, E1000, IGB, IXGBE, and I40E bug fixes from the Intel folks. 2) Better fix for AB-BA deadlock in packet scheduler code, from Cong Wang. 3) bpf sockmap fixes (zero sized key handling, etc.) from Daniel Borkmann. 4) Send zero IPID in TCP resets and SYN-RECV state ACKs, to prevent attackers using it as a side-channel. From Eric Dumazet. 5) Memory leak in mediatek bluetooth driver, from Gustavo A. R. Silva. 6) Hook up rt->dst.input of ipv6 anycast routes properly, from Hangbin Liu. 7) hns and hns3 bug fixes from Huazhong Tan. 8) Fix RIF leak in mlxsw driver, from Ido Schimmel. 9) iova range check fix in vhost, from Jason Wang. 10) Fix hang in do_tcp_sendpages() with tls, from John Fastabend. 11) More r8152 chips need to disable RX aggregation, from Kai-Heng Feng. 12) Memory exposure in TCA_U32_SEL handling, from Kees Cook. 13) TCP BBR congestion control fixes from Kevin Yang. 14) hv_netvsc, ignore non-PCI devices, from Stephen Hemminger. 15) qed driver fixes from Tomer Tayar. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (77 commits) net: sched: Fix memory exposure from short TCA_U32_SEL qed: fix spelling mistake "comparsion" -> "comparison" vhost: correctly check the iova range when waking virtqueue qlge: Fix netdev features configuration. net: macb: do not disable MDIO bus at open/close time Revert "net: stmmac: fix build failure due to missing COMMON_CLK dependency" net: macb: Fix regression breaking non-MDIO fixed-link PHYs mlxsw: spectrum_switchdev: Do not leak RIFs when removing bridge i40e: fix condition of WARN_ONCE for stat strings i40e: Fix for Tx timeouts when interface is brought up if DCB is enabled ixgbe: fix driver behaviour after issuing VFLR ixgbe: Prevent unsupported configurations with XDP ixgbe: Replace GFP_ATOMIC with GFP_KERNEL igb: Replace mdelay() with msleep() in igb_integrated_phy_loopback() igb: Replace GFP_ATOMIC with GFP_KERNEL in igb_sw_init() igb: Use an advanced ctx descriptor for launchtime e1000: ensure to free old tx/rx rings in set_ringparam() e1000: check on netif_running() before calling e1000_up() ixgb: use dma_zalloc_coherent instead of allocator/memset ice: Trivial formatting fixes ...

Linus Torvalds committed 8 years ago

Commit 050cdc62 parents 908946c 98c8f1292 files · +754 −711Browse files

Unified · Split

92 files
  1. drivers/bluetooth/Kconfig +1 −0
  2. drivers/bluetooth/btmtkuart.c +5 −3
  3. drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c +2 −4
  4. drivers/net/ethernet/cadence/macb_main.c +23 −13
  5. drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c +4 −6
  6. drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c +2 −3
  7. drivers/net/ethernet/hisilicon/hns/hnae.h +3 −3
  8. drivers/net/ethernet/hisilicon/hns/hns_enet.c +4 −104
  9. drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +2 −1
  10. drivers/net/ethernet/hisilicon/hns3/hns3_enet.h +3 −3
  11. drivers/net/ethernet/intel/e1000/e1000_ethtool.c +4 −3
  12. drivers/net/ethernet/intel/i40e/i40e_ethtool.c +1 −1
  13. drivers/net/ethernet/intel/i40e/i40e_main.c +8 −7
  14. drivers/net/ethernet/intel/ice/ice.h +11 −4
  15. drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +13 −12
  16. drivers/net/ethernet/intel/ice/ice_common.c +18 −12
  17. drivers/net/ethernet/intel/ice/ice_controlq.c +20 −9
  18. drivers/net/ethernet/intel/ice/ice_ethtool.c +39 −13
  19. drivers/net/ethernet/intel/ice/ice_hw_autogen.h +0 −8
  20. drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h +1 −0
  21. drivers/net/ethernet/intel/ice/ice_main.c +66 −49
  22. drivers/net/ethernet/intel/ice/ice_nvm.c +2 −3
  23. drivers/net/ethernet/intel/ice/ice_sched.c +1 −2
  24. drivers/net/ethernet/intel/ice/ice_switch.c +2 −2
  25. drivers/net/ethernet/intel/ice/ice_switch.h +3 −3
  26. drivers/net/ethernet/intel/ice/ice_txrx.h +1 −1
  27. drivers/net/ethernet/intel/ice/ice_type.h +8 −8
  28. drivers/net/ethernet/intel/igb/igb_ethtool.c +1 −1
  29. drivers/net/ethernet/intel/igb/igb_main.c +4 −3
  30. drivers/net/ethernet/intel/ixgb/ixgb_main.c +2 −3
  31. drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c +2 −2
  32. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +29 −7
  33. drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +31 −0
  34. drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +1 −0
  35. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +9 −10
  36. drivers/net/ethernet/mellanox/mlxsw/spectrum.c +1 −2
  37. drivers/net/ethernet/mellanox/mlxsw/spectrum.h +2 −0
  38. drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c +2 −4
  39. drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +11 −0
  40. drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +20 −0
  41. drivers/net/ethernet/netronome/nfp/flower/action.c +2 −4
  42. drivers/net/ethernet/qlogic/qed/qed_init_ops.c +1 −1
  43. drivers/net/ethernet/qlogic/qed/qed_mcp.c +158 −29
  44. drivers/net/ethernet/qlogic/qed/qed_mcp.h +18 −9
  45. drivers/net/ethernet/qlogic/qed/qed_reg_addr.h +2 −0
  46. drivers/net/ethernet/qlogic/qede/qede_filter.c +2 −4
  47. drivers/net/ethernet/qlogic/qlge/qlge_main.c +8 −15
  48. drivers/net/ethernet/renesas/ravb.h +1 −4
  49. drivers/net/ethernet/renesas/ravb_main.c +1 −4
  50. drivers/net/ethernet/renesas/sh_eth.c +1 −12
  51. drivers/net/ethernet/renesas/sh_eth.h +1 −12
  52. drivers/net/ethernet/stmicro/stmmac/Kconfig +5 −5
  53. drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +2 −3
  54. drivers/net/hyperv/netvsc_drv.c +5 −0
  55. drivers/net/usb/r8152.c +2 −2
  56. drivers/vhost/vhost.c +1 −1
  57. include/net/act_api.h +0 −7
  58. include/net/pkt_cls.h +14 −11
  59. kernel/bpf/hashtab.c +13 −10
  60. kernel/bpf/sockmap.c +9 −2
  61. lib/rhashtable.c +0 −1
  62. net/dsa/slave.c +1 −3
  63. net/ipv4/tcp_bbr.c +24 −18
  64. net/ipv4/tcp_ipv4.c +6 −0
  65. net/ipv6/addrconf.c +3 −3
  66. net/ipv6/ip6_fib.c +2 −0
  67. net/ipv6/ip6_vti.c +2 −1
  68. net/ipv6/route.c +1 −1
  69. net/ncsi/ncsi-netlink.c +2 −2
  70. net/rds/tcp.c +0 −1
  71. net/sched/act_api.c +25 −45
  72. net/sched/act_bpf.c +0 −8
  73. net/sched/act_connmark.c +0 −8
  74. net/sched/act_csum.c +0 −8
  75. net/sched/act_gact.c +0 −8
  76. net/sched/act_ife.c +40 −52
  77. net/sched/act_ipt.c +0 −16
  78. net/sched/act_mirred.c +0 −8
  79. net/sched/act_nat.c +0 −8
  80. net/sched/act_pedit.c +0 −8
  81. net/sched/act_police.c +0 −8
  82. net/sched/act_sample.c +0 −8
  83. net/sched/act_simple.c +0 −8
  84. net/sched/act_skbedit.c +0 −8
  85. net/sched/act_skbmod.c +0 −8
  86. net/sched/act_tunnel_key.c +0 −8
  87. net/sched/act_vlan.c +0 −8
  88. net/sched/cls_u32.c +8 −2
  89. net/sched/sch_cake.c +19 −5
  90. net/tls/tls_main.c +7 −2
  91. net/xdp/xdp_umem.c +2 −2
  92. tools/bpf/bpftool/map_perf_ring.c +4 −1
drivers/bluetooth/Kconfig+1−0
@@ -200,6 +200,7 @@ config BT_HCIUART_RTL · 199 unmodified lines
200200 depends on BT_HCIUART
201201 depends on BT_HCIUART_SERDEV
202202 depends on GPIOLIB
203+ depends on ACPI
203204 select BT_HCIUART_3WIRE
204205 select BT_RTL
205206 help
drivers/bluetooth/btmtkuart.c+5−3
@@ -144,8 +144,10 @@ static int mtk_setup_fw(struct hci_dev *hdev) · 143 unmodified lines
144144 fw_size = fw->size;
145145
146146 /* The size of patch header is 30 bytes, should be skip */
147− if (fw_size < 30)
148− return -EINVAL;
147+ if (fw_size < 30) {
148+ err = -EINVAL;
149+ goto free_fw;
150+ }
149151
150152 fw_size -= 30;
151153 fw_ptr += 30;
@@ -172,8 +174,8 @@ static int mtk_setup_fw(struct hci_dev *hdev) · 20 unmodified lines
172174 fw_ptr += dlen;
173175 }
174176
177+free_fw:
175178 release_firmware(fw);
176−
177179 return err;
178180 }
179181
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c+2−4
@@ -110,16 +110,14 @@ static int bnxt_tc_parse_actions(struct bnxt *bp, · 109 unmodified lines
110110 struct tcf_exts *tc_exts)
111111 {
112112 const struct tc_action *tc_act;
113− LIST_HEAD(tc_actions);
114− int rc;
113+ int i, rc;
115114
116115 if (!tcf_exts_has_actions(tc_exts)) {
117116 netdev_info(bp->dev, "no actions");
118117 return -EINVAL;
119118 }
120119
121− tcf_exts_to_list(tc_exts, &tc_actions);
122− list_for_each_entry(tc_act, &tc_actions, list) {
120+ tcf_exts_for_each_action(i, tc_act, tc_exts) {
123121 /* Drop action */
124122 if (is_tcf_gact_shot(tc_act)) {
125123 actions->flags |= BNXT_TC_ACTION_FLAG_DROP;
drivers/net/ethernet/cadence/macb_main.c+23−13
@@ -482,11 +482,6 @@ static int macb_mii_probe(struct net_device *dev) · 481 unmodified lines
482482
483483 if (np) {
484484 if (of_phy_is_fixed_link(np)) {
485− if (of_phy_register_fixed_link(np) < 0) {
486− dev_err(&bp->pdev->dev,
487− "broken fixed-link specification\n");
488− return -ENODEV;
489− }
490485 bp->phy_node = of_node_get(np);
491486 } else {
492487 bp->phy_node = of_parse_phandle(np, "phy-handle", 0);
@@ -569,7 +564,7 @@ static int macb_mii_init(struct macb *bp) · 76 unmodified lines
569564 {
570565 struct macb_platform_data *pdata;
571566 struct device_node *np;
572− int err;
567+ int err = -ENXIO;
573568
574569 /* Enable management port */
575570 macb_writel(bp, NCR, MACB_BIT(MPE));
@@ -592,12 +587,23 @@ static int macb_mii_init(struct macb *bp) · 16 unmodified lines
592587 dev_set_drvdata(&bp->dev->dev, bp->mii_bus);
593588
594589 np = bp->pdev->dev.of_node;
595− if (pdata)
596− bp->mii_bus->phy_mask = pdata->phy_mask;
590+ if (np && of_phy_is_fixed_link(np)) {
591+ if (of_phy_register_fixed_link(np) < 0) {
592+ dev_err(&bp->pdev->dev,
593+ "broken fixed-link specification %pOF\n", np);
594+ goto err_out_free_mdiobus;
595+ }
596+
597+ err = mdiobus_register(bp->mii_bus);
598+ } else {
599+ if (pdata)
600+ bp->mii_bus->phy_mask = pdata->phy_mask;
601+
602+ err = of_mdiobus_register(bp->mii_bus, np);
603+ }
597604
598− err = of_mdiobus_register(bp->mii_bus, np);
599605 if (err)
600− goto err_out_free_mdiobus;
606+ goto err_out_free_fixed_link;
601607
602608 err = macb_mii_probe(bp->dev);
603609 if (err)
@@ -607,6 +613,7 @@ static int macb_mii_init(struct macb *bp) · 3 unmodified lines
607613
608614 err_out_unregister_bus:
609615 mdiobus_unregister(bp->mii_bus);
616+err_out_free_fixed_link:
610617 if (np && of_phy_is_fixed_link(np))
611618 of_phy_deregister_fixed_link(np);
612619 err_out_free_mdiobus:
@@ -2028,14 +2035,17 @@ static void macb_reset_hw(struct macb *bp) · 1415 unmodified lines
20282035 {
20292036 struct macb_queue *queue;
20302037 unsigned int q;
2038+ u32 ctrl = macb_readl(bp, NCR);
20312039
20322040 /* Disable RX and TX (XXX: Should we halt the transmission
20332041 * more gracefully?)
20342042 */
2035− macb_writel(bp, NCR, 0);
2043+ ctrl &= ~(MACB_BIT(RE) | MACB_BIT(TE));
20362044
20372045 /* Clear the stats registers (XXX: Update stats first?) */
2038− macb_writel(bp, NCR, MACB_BIT(CLRSTAT));
2046+ ctrl |= MACB_BIT(CLRSTAT);
2047+
2048+ macb_writel(bp, NCR, ctrl);
20392049
20402050 /* Clear all status flags */
20412051 macb_writel(bp, TSR, -1);
@@ -2223,7 +2233,7 @@ static void macb_init_hw(struct macb *bp) · 181 unmodified lines
22232233 }
22242234
22252235 /* Enable TX and RX */
2226− macb_writel(bp, NCR, MACB_BIT(RE) | MACB_BIT(TE) | MACB_BIT(MPE));
2236+ macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(RE) | MACB_BIT(TE));
22272237 }
22282238
22292239 /* The hash address register is 64 bits long and takes up two
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c+4−6
@@ -417,10 +417,9 @@ static void cxgb4_process_flow_actions(struct net_device *in, · 416 unmodified lines
417417 struct ch_filter_specification *fs)
418418 {
419419 const struct tc_action *a;
420− LIST_HEAD(actions);
420+ int i;
421421
422− tcf_exts_to_list(cls->exts, &actions);
423− list_for_each_entry(a, &actions, list) {
422+ tcf_exts_for_each_action(i, a, cls->exts) {
424423 if (is_tcf_gact_ok(a)) {
425424 fs->action = FILTER_PASS;
426425 } else if (is_tcf_gact_shot(a)) {
@@ -591,10 +590,9 @@ static int cxgb4_validate_flow_actions(struct net_device *dev, · 164 unmodified lines
591590 bool act_redir = false;
592591 bool act_pedit = false;
593592 bool act_vlan = false;
594− LIST_HEAD(actions);
593+ int i;
595594
596− tcf_exts_to_list(cls->exts, &actions);
597− list_for_each_entry(a, &actions, list) {
595+ tcf_exts_for_each_action(i, a, cls->exts) {
598596 if (is_tcf_gact_ok(a)) {
599597 /* Do nothing */
600598 } else if (is_tcf_gact_shot(a)) {
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c+2−3
@@ -93,14 +93,13 @@ static int fill_action_fields(struct adapter *adap, · 92 unmodified lines
9393 unsigned int num_actions = 0;
9494 const struct tc_action *a;
9595 struct tcf_exts *exts;
96− LIST_HEAD(actions);
96+ int i;
9797
9898 exts = cls->knode.exts;
9999 if (!tcf_exts_has_actions(exts))
100100 return -EINVAL;
101101
102− tcf_exts_to_list(exts, &actions);
103− list_for_each_entry(a, &actions, list) {
102+ tcf_exts_for_each_action(i, a, exts) {
104103 /* Don't allow more than one action per rule. */
105104 if (num_actions)
106105 return -EINVAL;
drivers/net/ethernet/hisilicon/hns/hnae.h+3−3
@@ -220,10 +220,10 @@ struct hnae_desc_cb { · 219 unmodified lines
220220
221221 /* priv data for the desc, e.g. skb when use with ip stack*/
222222 void *priv;
223− u16 page_offset;
224− u16 reuse_flag;
223+ u32 page_offset;
224+ u32 length; /* length of the buffer */
225225
226− u16 length; /* length of the buffer */
226+ u16 reuse_flag;
227227
228228 /* desc type, used by the ring user to mark the type of the priv data */
229229 u16 type;
drivers/net/ethernet/hisilicon/hns/hns_enet.c+4−104
@@ -406,113 +406,13 @@ out_net_tx_busy: · 405 unmodified lines
406406 return NETDEV_TX_BUSY;
407407 }
408408
409−/**
410− * hns_nic_get_headlen - determine size of header for RSC/LRO/GRO/FCOE
411− * @data: pointer to the start of the headers
412− * @max: total length of section to find headers in
413− *
414− * This function is meant to determine the length of headers that will
415− * be recognized by hardware for LRO, GRO, and RSC offloads. The main
416− * motivation of doing this is to only perform one pull for IPv4 TCP
417− * packets so that we can do basic things like calculating the gso_size
418− * based on the average data per packet.
419− **/
420−static unsigned int hns_nic_get_headlen(unsigned char *data, u32 flag,
421− unsigned int max_size)
422−{
423− unsigned char *network;
424− u8 hlen;
425−
426− /* this should never happen, but better safe than sorry */
427− if (max_size < ETH_HLEN)
428− return max_size;
429−
430− /* initialize network frame pointer */
431− network = data;
432−
433− /* set first protocol and move network header forward */
434− network += ETH_HLEN;
435−
436− /* handle any vlan tag if present */
437− if (hnae_get_field(flag, HNS_RXD_VLAN_M, HNS_RXD_VLAN_S)
438− == HNS_RX_FLAG_VLAN_PRESENT) {
439− if ((typeof(max_size))(network - data) > (max_size - VLAN_HLEN))
440− return max_size;
441−
442− network += VLAN_HLEN;
443− }
444−
445− /* handle L3 protocols */
446− if (hnae_get_field(flag, HNS_RXD_L3ID_M, HNS_RXD_L3ID_S)
447− == HNS_RX_FLAG_L3ID_IPV4) {
448− if ((typeof(max_size))(network - data) >
449− (max_size - sizeof(struct iphdr)))
450− return max_size;
451−
452− /* access ihl as a u8 to avoid unaligned access on ia64 */
453− hlen = (network[0] & 0x0F) << 2;
454−
455− /* verify hlen meets minimum size requirements */
456− if (hlen < sizeof(struct iphdr))
457− return network - data;
458−
459− /* record next protocol if header is present */
460− } else if (hnae_get_field(flag, HNS_RXD_L3ID_M, HNS_RXD_L3ID_S)
461− == HNS_RX_FLAG_L3ID_IPV6) {
462− if ((typeof(max_size))(network - data) >
463− (max_size - sizeof(struct ipv6hdr)))
464− return max_size;
465−
466− /* record next protocol */
467− hlen = sizeof(struct ipv6hdr);
468− } else {
469− return network - data;
470− }
471−
472− /* relocate pointer to start of L4 header */
473− network += hlen;
474−
475− /* finally sort out TCP/UDP */
476− if (hnae_get_field(flag, HNS_RXD_L4ID_M, HNS_RXD_L4ID_S)
477− == HNS_RX_FLAG_L4ID_TCP) {
478− if ((typeof(max_size))(network - data) >
479− (max_size - sizeof(struct tcphdr)))
480− return max_size;
481−
482− /* access doff as a u8 to avoid unaligned access on ia64 */
483− hlen = (network[12] & 0xF0) >> 2;
484−
485− /* verify hlen meets minimum size requirements */
486− if (hlen < sizeof(struct tcphdr))
487− return network - data;
488−
489− network += hlen;
490− } else if (hnae_get_field(flag, HNS_RXD_L4ID_M, HNS_RXD_L4ID_S)
491− == HNS_RX_FLAG_L4ID_UDP) {
492− if ((typeof(max_size))(network - data) >
493− (max_size - sizeof(struct udphdr)))
494− return max_size;
495−
496− network += sizeof(struct udphdr);
497− }
498−
499− /* If everything has gone correctly network should be the
500− * data section of the packet and will be the end of the header.
501− * If not then it probably represents the end of the last recognized
502− * header.
503− */
504− if ((typeof(max_size))(network - data) < max_size)
505− return network - data;
506− else
507− return max_size;
508−}
509−
510409 static void hns_nic_reuse_page(struct sk_buff *skb, int i,
511410 struct hnae_ring *ring, int pull_len,
512411 struct hnae_desc_cb *desc_cb)
513412 {
514413 struct hnae_desc *desc;
515− int truesize, size;
414+ u32 truesize;
415+ int size;
516416 int last_offset;
517417 bool twobufs;
518418
@@ -530,7 +430,7 @@ static void hns_nic_reuse_page(struct sk_buff *skb, int i, · 11 unmodified lines
530430 }
531431
532432 skb_add_rx_frag(skb, i, desc_cb->priv, desc_cb->page_offset + pull_len,
533− size - pull_len, truesize - pull_len);
433+ size - pull_len, truesize);
534434
535435 /* avoid re-using remote pages,flag default unreuse */
536436 if (unlikely(page_to_nid(desc_cb->priv) != numa_node_id()))
@@ -695,7 +595,7 @@ static int hns_nic_poll_rx_skb(struct hns_nic_ring_data *ring_data, · 158 unmodified lines
695595 } else {
696596 ring->stats.seg_pkt_cnt++;
697597
698− pull_len = hns_nic_get_headlen(va, bnum_flag, HNS_RX_HEAD_SIZE);
598+ pull_len = eth_get_headlen(va, HNS_RX_HEAD_SIZE);
699599 memcpy(__skb_put(skb, pull_len), va,
700600 ALIGN(pull_len, sizeof(long)));
701601
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c+2−1
@@ -2019,7 +2019,8 @@ static void hns3_nic_reuse_page(struct sk_buff *skb, int i, · 2018 unmodified lines
20192019 struct hns3_desc_cb *desc_cb)
20202020 {
20212021 struct hns3_desc *desc;
2022− int truesize, size;
2022+ u32 truesize;
2023+ int size;
20232024 int last_offset;
20242025 bool twobufs;
20252026
drivers/net/ethernet/hisilicon/hns3/hns3_enet.h+3−3
@@ -284,11 +284,11 @@ struct hns3_desc_cb { · 283 unmodified lines
284284
285285 /* priv data for the desc, e.g. skb when use with ip stack*/
286286 void *priv;
287− u16 page_offset;
288− u16 reuse_flag;
289−
287+ u32 page_offset;
290288 u32 length; /* length of the buffer */
291289
290+ u16 reuse_flag;
291+
292292 /* desc type, used by the ring user to mark the type of the priv data */
293293 u16 type;
294294 };
drivers/net/ethernet/intel/e1000/e1000_ethtool.c+4−3
@@ -624,14 +624,14 @@ static int e1000_set_ringparam(struct net_device *netdev, · 623 unmodified lines
624624 adapter->tx_ring = tx_old;
625625 e1000_free_all_rx_resources(adapter);
626626 e1000_free_all_tx_resources(adapter);
627− kfree(tx_old);
628− kfree(rx_old);
629627 adapter->rx_ring = rxdr;
630628 adapter->tx_ring = txdr;
631629 err = e1000_up(adapter);
632630 if (err)
633631 goto err_setup;
634632 }
633+ kfree(tx_old);
634+ kfree(rx_old);
635635
636636 clear_bit(__E1000_RESETTING, &adapter->flags);
637637 return 0;
@@ -644,7 +644,8 @@ err_setup_rx: · 6 unmodified lines
644644 err_alloc_rx:
645645 kfree(txdr);
646646 err_alloc_tx:
647− e1000_up(adapter);
647+ if (netif_running(adapter->netdev))
648+ e1000_up(adapter);
648649 err_setup:
649650 clear_bit(__E1000_RESETTING, &adapter->flags);
650651 return err;
drivers/net/ethernet/intel/i40e/i40e_ethtool.c+1−1
@@ -2013,7 +2013,7 @@ static void i40e_get_stat_strings(struct net_device *netdev, u8 *data) · 2012 unmodified lines
20132013 for (i = 0; i < I40E_MAX_USER_PRIORITY; i++)
20142014 i40e_add_stat_strings(&data, i40e_gstrings_pfc_stats, i);
20152015
2016− WARN_ONCE(p - data != i40e_get_stats_count(netdev) * ETH_GSTRING_LEN,
2016+ WARN_ONCE(data - p != i40e_get_stats_count(netdev) * ETH_GSTRING_LEN,
20172017 "stat strings count mismatch!");
20182018 }
20192019
drivers/net/ethernet/intel/i40e/i40e_main.c+8−7
@@ -5122,15 +5122,17 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc, · 5121 unmodified lines
51225122 u8 *bw_share)
51235123 {
51245124 struct i40e_aqc_configure_vsi_tc_bw_data bw_data;
5125+ struct i40e_pf *pf = vsi->back;
51255126 i40e_status ret;
51265127 int i;
51275128
5128− if (vsi->back->flags & I40E_FLAG_TC_MQPRIO)
5129+ /* There is no need to reset BW when mqprio mode is on. */
5130+ if (pf->flags & I40E_FLAG_TC_MQPRIO)
51295131 return 0;
5130− if (!vsi->mqprio_qopt.qopt.hw) {
5132+ if (!vsi->mqprio_qopt.qopt.hw && !(pf->flags & I40E_FLAG_DCB_ENABLED)) {
51315133 ret = i40e_set_bw_limit(vsi, vsi->seid, 0);
51325134 if (ret)
5133− dev_info(&vsi->back->pdev->dev,
5135+ dev_info(&pf->pdev->dev,
51345136 "Failed to reset tx rate for vsi->seid %u\n",
51355137 vsi->seid);
51365138 return ret;
@@ -5139,12 +5141,11 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc, · 2 unmodified lines
51395141 for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++)
51405142 bw_data.tc_bw_credits[i] = bw_share[i];
51415143
5142− ret = i40e_aq_config_vsi_tc_bw(&vsi->back->hw, vsi->seid, &bw_data,
5143− NULL);
5144+ ret = i40e_aq_config_vsi_tc_bw(&pf->hw, vsi->seid, &bw_data, NULL);
51445145 if (ret) {
5145− dev_info(&vsi->back->pdev->dev,
5146+ dev_info(&pf->pdev->dev,
51465147 "AQ command Config VSI BW allocation per TC failed = %d\n",
5147− vsi->back->hw.aq.asq_last_status);
5148+ pf->hw.aq.asq_last_status);
51485149 return -EINVAL;
51495150 }
51505151
drivers/net/ethernet/intel/ice/ice.h+11−4
@@ -89,6 +89,13 @@ extern const char ice_drv_ver[]; · 88 unmodified lines
8989 #define ice_for_each_rxq(vsi, i) \
9090 for ((i) = 0; (i) < (vsi)->num_rxq; (i)++)
9191
92+/* Macros for each allocated tx/rx ring whether used or not in a VSI */
93+#define ice_for_each_alloc_txq(vsi, i) \
94+ for ((i) = 0; (i) < (vsi)->alloc_txq; (i)++)
95+
96+#define ice_for_each_alloc_rxq(vsi, i) \
97+ for ((i) = 0; (i) < (vsi)->alloc_rxq; (i)++)
98+
9299 struct ice_tc_info {
93100 u16 qoffset;
94101 u16 qcount;
@@ -189,9 +196,9 @@ struct ice_vsi { · 94 unmodified lines
189196 struct list_head tmp_sync_list; /* MAC filters to be synced */
190197 struct list_head tmp_unsync_list; /* MAC filters to be unsynced */
191198
192− bool irqs_ready;
193− bool current_isup; /* Sync 'link up' logging */
194− bool stat_offsets_loaded;
199+ u8 irqs_ready;
200+ u8 current_isup; /* Sync 'link up' logging */
201+ u8 stat_offsets_loaded;
195202
196203 /* queue information */
197204 u8 tx_mapping_mode; /* ICE_MAP_MODE_[CONTIG|SCATTER] */
@@ -262,7 +269,7 @@ struct ice_pf { · 64 unmodified lines
262269 struct ice_hw_port_stats stats;
263270 struct ice_hw_port_stats stats_prev;
264271 struct ice_hw hw;
265− bool stat_prev_loaded; /* has previous stats been loaded */
272+ u8 stat_prev_loaded; /* has previous stats been loaded */
266273 char int_name[ICE_INT_NAME_STR_LEN];
267274 };
268275
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h+13−12
@@ -329,19 +329,19 @@ struct ice_aqc_vsi_props { · 328 unmodified lines
329329 /* VLAN section */
330330 __le16 pvid; /* VLANS include priority bits */
331331 u8 pvlan_reserved[2];
332− u8 port_vlan_flags;
333−#define ICE_AQ_VSI_PVLAN_MODE_S 0
334−#define ICE_AQ_VSI_PVLAN_MODE_M (0x3 << ICE_AQ_VSI_PVLAN_MODE_S)
335−#define ICE_AQ_VSI_PVLAN_MODE_UNTAGGED 0x1
336−#define ICE_AQ_VSI_PVLAN_MODE_TAGGED 0x2
337−#define ICE_AQ_VSI_PVLAN_MODE_ALL 0x3
332+ u8 vlan_flags;
333+#define ICE_AQ_VSI_VLAN_MODE_S 0
334+#define ICE_AQ_VSI_VLAN_MODE_M (0x3 << ICE_AQ_VSI_VLAN_MODE_S)
335+#define ICE_AQ_VSI_VLAN_MODE_UNTAGGED 0x1
336+#define ICE_AQ_VSI_VLAN_MODE_TAGGED 0x2
337+#define ICE_AQ_VSI_VLAN_MODE_ALL 0x3
338338 #define ICE_AQ_VSI_PVLAN_INSERT_PVID BIT(2)
339−#define ICE_AQ_VSI_PVLAN_EMOD_S 3
340−#define ICE_AQ_VSI_PVLAN_EMOD_M (0x3 << ICE_AQ_VSI_PVLAN_EMOD_S)
341−#define ICE_AQ_VSI_PVLAN_EMOD_STR_BOTH (0x0 << ICE_AQ_VSI_PVLAN_EMOD_S)
342−#define ICE_AQ_VSI_PVLAN_EMOD_STR_UP (0x1 << ICE_AQ_VSI_PVLAN_EMOD_S)
343−#define ICE_AQ_VSI_PVLAN_EMOD_STR (0x2 << ICE_AQ_VSI_PVLAN_EMOD_S)
344−#define ICE_AQ_VSI_PVLAN_EMOD_NOTHING (0x3 << ICE_AQ_VSI_PVLAN_EMOD_S)
339+#define ICE_AQ_VSI_VLAN_EMOD_S 3
340+#define ICE_AQ_VSI_VLAN_EMOD_M (0x3 << ICE_AQ_VSI_VLAN_EMOD_S)
341+#define ICE_AQ_VSI_VLAN_EMOD_STR_BOTH (0x0 << ICE_AQ_VSI_VLAN_EMOD_S)
342+#define ICE_AQ_VSI_VLAN_EMOD_STR_UP (0x1 << ICE_AQ_VSI_VLAN_EMOD_S)
343+#define ICE_AQ_VSI_VLAN_EMOD_STR (0x2 << ICE_AQ_VSI_VLAN_EMOD_S)
344+#define ICE_AQ_VSI_VLAN_EMOD_NOTHING (0x3 << ICE_AQ_VSI_VLAN_EMOD_S)
345345 u8 pvlan_reserved2[3];
346346 /* ingress egress up sections */
347347 __le32 ingress_table; /* bitmap, 3 bits per up */
@@ -594,6 +594,7 @@ struct ice_sw_rule_lg_act { · 246 unmodified lines
594594 #define ICE_LG_ACT_GENERIC_OFFSET_M (0x7 << ICE_LG_ACT_GENERIC_OFFSET_S)
595595 #define ICE_LG_ACT_GENERIC_PRIORITY_S 22
596596 #define ICE_LG_ACT_GENERIC_PRIORITY_M (0x7 << ICE_LG_ACT_GENERIC_PRIORITY_S)
597+#define ICE_LG_ACT_GENERIC_OFF_RX_DESC_PROF_IDX 7
597598
598599 /* Action = 7 - Set Stat count */
599600 #define ICE_LG_ACT_STAT_COUNT 0x7
drivers/net/ethernet/intel/ice/ice_common.c+18−12
@@ -45,6 +45,9 @@ static enum ice_status ice_set_mac_type(struct ice_hw *hw) · 44 unmodified lines
4545 /**
4646 * ice_clear_pf_cfg - Clear PF configuration
4747 * @hw: pointer to the hardware structure
48+ *
49+ * Clears any existing PF configuration (VSIs, VSI lists, switch rules, port
50+ * configuration, flow director filters, etc.).
4851 */
4952 enum ice_status ice_clear_pf_cfg(struct ice_hw *hw)
5053 {
@@ -1483,7 +1486,7 @@ enum ice_status ice_get_link_status(struct ice_port_info *pi, bool *link_up) · 1432 unmodified lines
14831486 struct ice_phy_info *phy_info;
14841487 enum ice_status status = 0;
14851488
1486− if (!pi)
1489+ if (!pi || !link_up)
14871490 return ICE_ERR_PARAM;
14881491
14891492 phy_info = &pi->phy;
@@ -1619,20 +1622,23 @@ __ice_aq_get_set_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut, · 129 unmodified lines
16191622 }
16201623
16211624 /* LUT size is only valid for Global and PF table types */
1622− if (lut_size == ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128) {
1623− flags |= (ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128_FLAG <<
1624− ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S) &
1625− ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M;
1626− } else if (lut_size == ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512) {
1625+ switch (lut_size) {
1626+ case ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128:
1627+ break;
1628+ case ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512:
16271629 flags |= (ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512_FLAG <<
16281630 ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S) &
16291631 ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M;
1630− } else if ((lut_size == ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K) &&
1631− (lut_type == ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF)) {
1632− flags |= (ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K_FLAG <<
1633− ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S) &
1634− ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M;
1635− } else {
1632+ break;
1633+ case ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K:
1634+ if (lut_type == ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF) {
1635+ flags |= (ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K_FLAG <<
1636+ ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S) &
1637+ ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M;
1638+ break;
1639+ }
1640+ /* fall-through */
1641+ default:
16361642 status = ICE_ERR_PARAM;
16371643 goto ice_aq_get_set_rss_lut_exit;
16381644 }
drivers/net/ethernet/intel/ice/ice_controlq.c+20−9
@@ -597,10 +597,14 @@ static enum ice_status ice_init_check_adminq(struct ice_hw *hw) · 596 unmodified lines
597597 return 0;
598598
599599 init_ctrlq_free_rq:
600− ice_shutdown_rq(hw, cq);
601− ice_shutdown_sq(hw, cq);
602− mutex_destroy(&cq->sq_lock);
603− mutex_destroy(&cq->rq_lock);
600+ if (cq->rq.head) {
601+ ice_shutdown_rq(hw, cq);
602+ mutex_destroy(&cq->rq_lock);
603+ }
604+ if (cq->sq.head) {
605+ ice_shutdown_sq(hw, cq);
606+ mutex_destroy(&cq->sq_lock);
607+ }
604608 return status;
605609 }
606610
@@ -706,10 +710,14 @@ static void ice_shutdown_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type) · 99 unmodified lines
706710 return;
707711 }
708712
709− ice_shutdown_sq(hw, cq);
710− ice_shutdown_rq(hw, cq);
711− mutex_destroy(&cq->sq_lock);
712− mutex_destroy(&cq->rq_lock);
713+ if (cq->sq.head) {
714+ ice_shutdown_sq(hw, cq);
715+ mutex_destroy(&cq->sq_lock);
716+ }
717+ if (cq->rq.head) {
718+ ice_shutdown_rq(hw, cq);
719+ mutex_destroy(&cq->rq_lock);
720+ }
713721 }
714722
715723 /**
@@ -1057,8 +1065,11 @@ ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq, · 341 unmodified lines
10571065
10581066 clean_rq_elem_out:
10591067 /* Set pending if needed, unlock and return */
1060− if (pending)
1068+ if (pending) {
1069+ /* re-read HW head to calculate actual pending messages */
1070+ ntu = (u16)(rd32(hw, cq->rq.head) & cq->rq.head_mask);
10611071 *pending = (u16)((ntc > ntu ? cq->rq.count : 0) + (ntu - ntc));
1072+ }
10621073 clean_rq_elem_err:
10631074 mutex_unlock(&cq->rq_lock);
10641075
drivers/net/ethernet/intel/ice/ice_ethtool.c+39−13
@@ -26,7 +26,7 @@ static int ice_q_stats_len(struct net_device *netdev) · 25 unmodified lines
2626 {
2727 struct ice_netdev_priv *np = netdev_priv(netdev);
2828
29− return ((np->vsi->num_txq + np->vsi->num_rxq) *
29+ return ((np->vsi->alloc_txq + np->vsi->alloc_rxq) *
3030 (sizeof(struct ice_q_stats) / sizeof(u64)));
3131 }
3232
@@ -218,7 +218,7 @@ static void ice_get_strings(struct net_device *netdev, u32 stringset, u8 *data) · 185 unmodified lines
218218 p += ETH_GSTRING_LEN;
219219 }
220220
221− ice_for_each_txq(vsi, i) {
221+ ice_for_each_alloc_txq(vsi, i) {
222222 snprintf(p, ETH_GSTRING_LEN,
223223 "tx-queue-%u.tx_packets", i);
224224 p += ETH_GSTRING_LEN;
@@ -226,7 +226,7 @@ static void ice_get_strings(struct net_device *netdev, u32 stringset, u8 *data) · 1 unmodified line
226226 p += ETH_GSTRING_LEN;
227227 }
228228
229− ice_for_each_rxq(vsi, i) {
229+ ice_for_each_alloc_rxq(vsi, i) {
230230 snprintf(p, ETH_GSTRING_LEN,
231231 "rx-queue-%u.rx_packets", i);
232232 p += ETH_GSTRING_LEN;
@@ -253,6 +253,24 @@ static int ice_get_sset_count(struct net_device *netdev, int sset) · 20 unmodified lines
253253 {
254254 switch (sset) {
255255 case ETH_SS_STATS:
256+ /* The number (and order) of strings reported *must* remain
257+ * constant for a given netdevice. This function must not
258+ * report a different number based on run time parameters
259+ * (such as the number of queues in use, or the setting of
260+ * a private ethtool flag). This is due to the nature of the
261+ * ethtool stats API.
262+ *
263+ * User space programs such as ethtool must make 3 separate
264+ * ioctl requests, one for size, one for the strings, and
265+ * finally one for the stats. Since these cross into
266+ * user space, changes to the number or size could result in
267+ * undefined memory access or incorrect string<->value
268+ * correlations for statistics.
269+ *
270+ * Even if it appears to be safe, changes to the size or
271+ * order of strings will suffer from race conditions and are
272+ * not safe.
273+ */
256274 return ICE_ALL_STATS_LEN(netdev);
257275 default:
258276 return -EOPNOTSUPP;
@@ -280,18 +298,26 @@ ice_get_ethtool_stats(struct net_device *netdev, · 21 unmodified lines
280298 /* populate per queue stats */
281299 rcu_read_lock();
282300
283− ice_for_each_txq(vsi, j) {
301+ ice_for_each_alloc_txq(vsi, j) {
284302 ring = READ_ONCE(vsi->tx_rings[j]);
285− if (!ring)
286− continue;
287− data[i++] = ring->stats.pkts;
288− data[i++] = ring->stats.bytes;
303+ if (ring) {
304+ data[i++] = ring->stats.pkts;
305+ data[i++] = ring->stats.bytes;
306+ } else {
307+ data[i++] = 0;
308+ data[i++] = 0;
309+ }
289310 }
290311
291− ice_for_each_rxq(vsi, j) {
312+ ice_for_each_alloc_rxq(vsi, j) {
292313 ring = READ_ONCE(vsi->rx_rings[j]);
293− data[i++] = ring->stats.pkts;
294− data[i++] = ring->stats.bytes;
314+ if (ring) {
315+ data[i++] = ring->stats.pkts;
316+ data[i++] = ring->stats.bytes;
317+ } else {
318+ data[i++] = 0;
319+ data[i++] = 0;
320+ }
295321 }
296322
297323 rcu_read_unlock();
@@ -519,7 +545,7 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) · 221 unmodified lines
519545 goto done;
520546 }
521547
522− for (i = 0; i < vsi->num_txq; i++) {
548+ for (i = 0; i < vsi->alloc_txq; i++) {
523549 /* clone ring and setup updated count */
524550 tx_rings[i] = *vsi->tx_rings[i];
525551 tx_rings[i].count = new_tx_cnt;
@@ -551,7 +577,7 @@ process_rx: · 25 unmodified lines
551577 goto done;
552578 }
553579
554− for (i = 0; i < vsi->num_rxq; i++) {
580+ for (i = 0; i < vsi->alloc_rxq; i++) {
555581 /* clone ring and setup updated count */
556582 rx_rings[i] = *vsi->rx_rings[i];
557583 rx_rings[i].count = new_rx_cnt;
drivers/net/ethernet/intel/ice/ice_hw_autogen.h+0−8
@@ -121,10 +121,6 @@ · 120 unmodified lines
121121 #define PFINT_FW_CTL_CAUSE_ENA_S 30
122122 #define PFINT_FW_CTL_CAUSE_ENA_M BIT(PFINT_FW_CTL_CAUSE_ENA_S)
123123 #define PFINT_OICR 0x0016CA00
124−#define PFINT_OICR_HLP_RDY_S 14
125−#define PFINT_OICR_HLP_RDY_M BIT(PFINT_OICR_HLP_RDY_S)
126−#define PFINT_OICR_CPM_RDY_S 15
127−#define PFINT_OICR_CPM_RDY_M BIT(PFINT_OICR_CPM_RDY_S)
128124 #define PFINT_OICR_ECC_ERR_S 16
129125 #define PFINT_OICR_ECC_ERR_M BIT(PFINT_OICR_ECC_ERR_S)
130126 #define PFINT_OICR_MAL_DETECT_S 19
@@ -133,10 +129,6 @@ · 2 unmodified lines
133129 #define PFINT_OICR_GRST_M BIT(PFINT_OICR_GRST_S)
134130 #define PFINT_OICR_PCI_EXCEPTION_S 21
135131 #define PFINT_OICR_PCI_EXCEPTION_M BIT(PFINT_OICR_PCI_EXCEPTION_S)
136−#define PFINT_OICR_GPIO_S 22
137−#define PFINT_OICR_GPIO_M BIT(PFINT_OICR_GPIO_S)
138−#define PFINT_OICR_STORM_DETECT_S 24
139−#define PFINT_OICR_STORM_DETECT_M BIT(PFINT_OICR_STORM_DETECT_S)
140132 #define PFINT_OICR_HMC_ERR_S 26
141133 #define PFINT_OICR_HMC_ERR_M BIT(PFINT_OICR_HMC_ERR_S)
142134 #define PFINT_OICR_PE_CRITERR_S 28
drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h+1−0
@@ -265,6 +265,7 @@ enum ice_rx_flex_desc_status_error_0_bits { · 264 unmodified lines
265265 struct ice_rlan_ctx {
266266 u16 head;
267267 u16 cpuid; /* bigger than needed, see above for reason */
268+#define ICE_RLAN_BASE_S 7
268269 u64 base;
269270 u16 qlen;
270271 #define ICE_RLAN_CTX_DBUF_S 7
drivers/net/ethernet/intel/ice/ice_main.c+66−49
@@ -901,7 +901,7 @@ static int __ice_clean_ctrlq(struct ice_pf *pf, enum ice_ctl_q q_type) · 900 unmodified lines
901901 case ice_aqc_opc_get_link_status:
902902 if (ice_handle_link_event(pf))
903903 dev_err(&pf->pdev->dev,
904− "Could not handle link event");
904+ "Could not handle link event\n");
905905 break;
906906 default:
907907 dev_dbg(&pf->pdev->dev,
@@ -916,6 +916,21 @@ static int __ice_clean_ctrlq(struct ice_pf *pf, enum ice_ctl_q q_type) · 8 unmodified lines
916916 return pending && (i == ICE_DFLT_IRQ_WORK);
917917 }
918918
919+/**
920+ * ice_ctrlq_pending - check if there is a difference between ntc and ntu
921+ * @hw: pointer to hardware info
922+ * @cq: control queue information
923+ *
924+ * returns true if there are pending messages in a queue, false if there aren't
925+ */
926+static bool ice_ctrlq_pending(struct ice_hw *hw, struct ice_ctl_q_info *cq)
927+{
928+ u16 ntu;
929+
930+ ntu = (u16)(rd32(hw, cq->rq.head) & cq->rq.head_mask);
931+ return cq->rq.next_to_clean != ntu;
932+}
933+
919934 /**
920935 * ice_clean_adminq_subtask - clean the AdminQ rings
921936 * @pf: board private structure
@@ -923,7 +938,6 @@ static int __ice_clean_ctrlq(struct ice_pf *pf, enum ice_ctl_q q_type) · 1 unmodified line
923938 static void ice_clean_adminq_subtask(struct ice_pf *pf)
924939 {
925940 struct ice_hw *hw = &pf->hw;
926− u32 val;
927941
928942 if (!test_bit(__ICE_ADMINQ_EVENT_PENDING, pf->state))
929943 return;
@@ -933,9 +947,13 @@ static void ice_clean_adminq_subtask(struct ice_pf *pf) · 3 unmodified lines
933947
934948 clear_bit(__ICE_ADMINQ_EVENT_PENDING, pf->state);
935949
936− /* re-enable Admin queue interrupt causes */
937− val = rd32(hw, PFINT_FW_CTL);
938− wr32(hw, PFINT_FW_CTL, (val | PFINT_FW_CTL_CAUSE_ENA_M));
950+ /* There might be a situation where new messages arrive to a control
951+ * queue between processing the last message and clearing the
952+ * EVENT_PENDING bit. So before exiting, check queue head again (using
953+ * ice_ctrlq_pending) and process new messages if any.
954+ */
955+ if (ice_ctrlq_pending(hw, &hw->adminq))
956+ __ice_clean_ctrlq(pf, ICE_CTL_Q_ADMIN);
939957
940958 ice_flush(hw);
941959 }
@@ -1295,11 +1313,8 @@ static void ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt) · 353 unmodified lines
12951313 qcount = numq_tc;
12961314 }
12971315
1298− /* find higher power-of-2 of qcount */
1299− pow = ilog2(qcount);
1300−
1301− if (!is_power_of_2(qcount))
1302− pow++;
1316+ /* find the (rounded up) power-of-2 of qcount */
1317+ pow = order_base_2(qcount);
13031318
13041319 for (i = 0; i < ICE_MAX_TRAFFIC_CLASS; i++) {
13051320 if (!(vsi->tc_cfg.ena_tc & BIT(i))) {
@@ -1352,14 +1367,15 @@ static void ice_set_dflt_vsi_ctx(struct ice_vsi_ctx *ctxt) · 46 unmodified lines
13521367 ctxt->info.sw_flags = ICE_AQ_VSI_SW_FLAG_SRC_PRUNE;
13531368 /* Traffic from VSI can be sent to LAN */
13541369 ctxt->info.sw_flags2 = ICE_AQ_VSI_SW_FLAG_LAN_ENA;
1355− /* Allow all packets untagged/tagged */
1356− ctxt->info.port_vlan_flags = ((ICE_AQ_VSI_PVLAN_MODE_ALL &
1357− ICE_AQ_VSI_PVLAN_MODE_M) >>
1358− ICE_AQ_VSI_PVLAN_MODE_S);
1359− /* Show VLAN/UP from packets in Rx descriptors */
1360− ctxt->info.port_vlan_flags |= ((ICE_AQ_VSI_PVLAN_EMOD_STR_BOTH &
1361− ICE_AQ_VSI_PVLAN_EMOD_M) >>
1362− ICE_AQ_VSI_PVLAN_EMOD_S);
1370+
1371+ /* By default bits 3 and 4 in vlan_flags are 0's which results in legacy
1372+ * behavior (show VLAN, DEI, and UP) in descriptor. Also, allow all
1373+ * packets untagged/tagged.
1374+ */
1375+ ctxt->info.vlan_flags = ((ICE_AQ_VSI_VLAN_MODE_ALL &
1376+ ICE_AQ_VSI_VLAN_MODE_M) >>
1377+ ICE_AQ_VSI_VLAN_MODE_S);
1378+
13631379 /* Have 1:1 UP mapping for both ingress/egress tables */
13641380 table |= ICE_UP_TABLE_TRANSLATE(0, 0);
13651381 table |= ICE_UP_TABLE_TRANSLATE(1, 1);
@@ -1688,15 +1704,12 @@ static void ice_ena_misc_vector(struct ice_pf *pf) · 322 unmodified lines
16881704 wr32(hw, PFINT_OICR_ENA, 0); /* disable all */
16891705 rd32(hw, PFINT_OICR); /* read to clear */
16901706
1691− val = (PFINT_OICR_HLP_RDY_M |
1692− PFINT_OICR_CPM_RDY_M |
1693− PFINT_OICR_ECC_ERR_M |
1707+ val = (PFINT_OICR_ECC_ERR_M |
16941708 PFINT_OICR_MAL_DETECT_M |
16951709 PFINT_OICR_GRST_M |
16961710 PFINT_OICR_PCI_EXCEPTION_M |
1697− PFINT_OICR_GPIO_M |
1698− PFINT_OICR_STORM_DETECT_M |
1699− PFINT_OICR_HMC_ERR_M);
1711+ PFINT_OICR_HMC_ERR_M |
1712+ PFINT_OICR_PE_CRITERR_M);
17001713
17011714 wr32(hw, PFINT_OICR_ENA, val);
17021715
@@ -2058,15 +2071,13 @@ static int ice_req_irq_msix_misc(struct ice_pf *pf) · 355 unmodified lines
20582071 skip_req_irq:
20592072 ice_ena_misc_vector(pf);
20602073
2061− val = (pf->oicr_idx & PFINT_OICR_CTL_MSIX_INDX_M) |
2062− (ICE_RX_ITR & PFINT_OICR_CTL_ITR_INDX_M) |
2063− PFINT_OICR_CTL_CAUSE_ENA_M;
2074+ val = ((pf->oicr_idx & PFINT_OICR_CTL_MSIX_INDX_M) |
2075+ PFINT_OICR_CTL_CAUSE_ENA_M);
20642076 wr32(hw, PFINT_OICR_CTL, val);
20652077
20662078 /* This enables Admin queue Interrupt causes */
2067− val = (pf->oicr_idx & PFINT_FW_CTL_MSIX_INDX_M) |
2068− (ICE_RX_ITR & PFINT_FW_CTL_ITR_INDX_M) |
2069− PFINT_FW_CTL_CAUSE_ENA_M;
2079+ val = ((pf->oicr_idx & PFINT_FW_CTL_MSIX_INDX_M) |
2080+ PFINT_FW_CTL_CAUSE_ENA_M);
20702081 wr32(hw, PFINT_FW_CTL, val);
20712082
20722083 itr_gran = hw->itr_gran_200;
@@ -3246,8 +3257,10 @@ static void ice_clear_interrupt_scheme(struct ice_pf *pf) · 1173 unmodified lines
32463257 if (test_bit(ICE_FLAG_MSIX_ENA, pf->flags))
32473258 ice_dis_msix(pf);
32483259
3249− devm_kfree(&pf->pdev->dev, pf->irq_tracker);
3250− pf->irq_tracker = NULL;
3260+ if (pf->irq_tracker) {
3261+ devm_kfree(&pf->pdev->dev, pf->irq_tracker);
3262+ pf->irq_tracker = NULL;
3263+ }
32513264 }
32523265
32533266 /**
@@ -3271,7 +3284,7 @@ static int ice_probe(struct pci_dev *pdev, · 17 unmodified lines
32713284
32723285 err = pcim_iomap_regions(pdev, BIT(ICE_BAR0), pci_name(pdev));
32733286 if (err) {
3274− dev_err(&pdev->dev, "I/O map error %d\n", err);
3287+ dev_err(&pdev->dev, "BAR0 I/O map error %d\n", err);
32753288 return err;
32763289 }
32773290
@@ -3720,10 +3733,10 @@ static int ice_vsi_manage_vlan_insertion(struct ice_vsi *vsi) · 442 unmodified lines
37203733 enum ice_status status;
37213734
37223735 /* Here we are configuring the VSI to let the driver add VLAN tags by
3723− * setting port_vlan_flags to ICE_AQ_VSI_PVLAN_MODE_ALL. The actual VLAN
3724− * tag insertion happens in the Tx hot path, in ice_tx_map.
3736+ * setting vlan_flags to ICE_AQ_VSI_VLAN_MODE_ALL. The actual VLAN tag
3737+ * insertion happens in the Tx hot path, in ice_tx_map.
37253738 */
3726− ctxt.info.port_vlan_flags = ICE_AQ_VSI_PVLAN_MODE_ALL;
3739+ ctxt.info.vlan_flags = ICE_AQ_VSI_VLAN_MODE_ALL;
37273740
37283741 ctxt.info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID);
37293742 ctxt.vsi_num = vsi->vsi_num;
@@ -3735,7 +3748,7 @@ static int ice_vsi_manage_vlan_insertion(struct ice_vsi *vsi) · 5 unmodified lines
37353748 return -EIO;
37363749 }
37373750
3738− vsi->info.port_vlan_flags = ctxt.info.port_vlan_flags;
3751+ vsi->info.vlan_flags = ctxt.info.vlan_flags;
37393752 return 0;
37403753 }
37413754
@@ -3757,12 +3770,15 @@ static int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena) · 15 unmodified lines
37573770 */
37583771 if (ena) {
37593772 /* Strip VLAN tag from Rx packet and put it in the desc */
3760− ctxt.info.port_vlan_flags = ICE_AQ_VSI_PVLAN_EMOD_STR_BOTH;
3773+ ctxt.info.vlan_flags = ICE_AQ_VSI_VLAN_EMOD_STR_BOTH;
37613774 } else {
37623775 /* Disable stripping. Leave tag in packet */
3763− ctxt.info.port_vlan_flags = ICE_AQ_VSI_PVLAN_EMOD_NOTHING;
3776+ ctxt.info.vlan_flags = ICE_AQ_VSI_VLAN_EMOD_NOTHING;
37643777 }
37653778
3779+ /* Allow all packets untagged/tagged */
3780+ ctxt.info.vlan_flags |= ICE_AQ_VSI_VLAN_MODE_ALL;
3781+
37663782 ctxt.info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID);
37673783 ctxt.vsi_num = vsi->vsi_num;
37683784
@@ -3773,7 +3789,7 @@ static int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena) · 4 unmodified lines
37733789 return -EIO;
37743790 }
37753791
3776− vsi->info.port_vlan_flags = ctxt.info.port_vlan_flags;
3792+ vsi->info.vlan_flags = ctxt.info.vlan_flags;
37773793 return 0;
37783794 }
37793795
@@ -3986,7 +4002,7 @@ static int ice_setup_rx_ctx(struct ice_ring *ring) · 206 unmodified lines
39864002 /* clear the context structure first */
39874003 memset(&rlan_ctx, 0, sizeof(rlan_ctx));
39884004
3989− rlan_ctx.base = ring->dma >> 7;
4005+ rlan_ctx.base = ring->dma >> ICE_RLAN_BASE_S;
39904006
39914007 rlan_ctx.qlen = ring->count;
39924008
@@ -4098,11 +4114,12 @@ static int ice_vsi_cfg(struct ice_vsi *vsi) · 105 unmodified lines
40984114 {
40994115 int err;
41004116
4101− ice_set_rx_mode(vsi->netdev);
4102−
4103− err = ice_restore_vlan(vsi);
4104− if (err)
4105− return err;
4117+ if (vsi->netdev) {
4118+ ice_set_rx_mode(vsi->netdev);
4119+ err = ice_restore_vlan(vsi);
4120+ if (err)
4121+ return err;
4122+ }
41064123
41074124 err = ice_vsi_cfg_txqs(vsi);
41084125 if (!err)
@@ -4868,7 +4885,7 @@ int ice_down(struct ice_vsi *vsi) · 759 unmodified lines
48684885 */
48694886 static int ice_vsi_setup_tx_rings(struct ice_vsi *vsi)
48704887 {
4871− int i, err;
4888+ int i, err = 0;
48724889
48734890 if (!vsi->num_txq) {
48744891 dev_err(&vsi->back->pdev->dev, "VSI %d has 0 Tx queues\n",
@@ -4893,7 +4910,7 @@ static int ice_vsi_setup_tx_rings(struct ice_vsi *vsi) · 18 unmodified lines
48934910 */
48944911 static int ice_vsi_setup_rx_rings(struct ice_vsi *vsi)
48954912 {
4896− int i, err;
4913+ int i, err = 0;
48974914
48984915 if (!vsi->num_rxq) {
48994916 dev_err(&vsi->back->pdev->dev, "VSI %d has 0 Rx queues\n",
@@ -5235,7 +5252,7 @@ static int ice_change_mtu(struct net_device *netdev, int new_mtu) · 335 unmodified lines
52355252 u8 count = 0;
52365253
52375254 if (new_mtu == netdev->mtu) {
5238− netdev_warn(netdev, "mtu is already %d\n", netdev->mtu);
5255+ netdev_warn(netdev, "mtu is already %u\n", netdev->mtu);
52395256 return 0;
52405257 }
52415258
drivers/net/ethernet/intel/ice/ice_nvm.c+2−3
@@ -131,9 +131,8 @@ ice_read_sr_word_aq(struct ice_hw *hw, u16 offset, u16 *data) · 130 unmodified lines
131131 *
132132 * This function will request NVM ownership.
133133 */
134−static enum
135−ice_status ice_acquire_nvm(struct ice_hw *hw,
136− enum ice_aq_res_access_type access)
134+static enum ice_status
135+ice_acquire_nvm(struct ice_hw *hw, enum ice_aq_res_access_type access)
137136 {
138137 if (hw->nvm.blank_nvm_mode)
139138 return 0;
drivers/net/ethernet/intel/ice/ice_sched.c+1−2
@@ -1576,8 +1576,7 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_id, u8 tc, · 1575 unmodified lines
15761576 return status;
15771577 }
15781578
1579− if (owner == ICE_SCHED_NODE_OWNER_LAN)
1580− vsi->max_lanq[tc] = new_numqs;
1579+ vsi->max_lanq[tc] = new_numqs;
15811580
15821581 return status;
15831582 }
drivers/net/ethernet/intel/ice/ice_switch.c+2−2
@@ -645,14 +645,14 @@ ice_add_marker_act(struct ice_hw *hw, struct ice_fltr_mgmt_list_entry *m_ent, · 644 unmodified lines
645645 act |= (1 << ICE_LG_ACT_GENERIC_VALUE_S) & ICE_LG_ACT_GENERIC_VALUE_M;
646646 lg_act->pdata.lg_act.act[1] = cpu_to_le32(act);
647647
648− act = (7 << ICE_LG_ACT_GENERIC_OFFSET_S) & ICE_LG_ACT_GENERIC_VALUE_M;
648+ act = (ICE_LG_ACT_GENERIC_OFF_RX_DESC_PROF_IDX <<
649+ ICE_LG_ACT_GENERIC_OFFSET_S) & ICE_LG_ACT_GENERIC_OFFSET_M;
649650
650651 /* Third action Marker value */
651652 act |= ICE_LG_ACT_GENERIC;
652653 act |= (sw_marker << ICE_LG_ACT_GENERIC_VALUE_S) &
653654 ICE_LG_ACT_GENERIC_VALUE_M;
654655
655− act |= (0 << ICE_LG_ACT_GENERIC_OFFSET_S) & ICE_LG_ACT_GENERIC_VALUE_M;
656656 lg_act->pdata.lg_act.act[2] = cpu_to_le32(act);
657657
658658 /* call the fill switch rule to fill the lookup tx rx structure */
drivers/net/ethernet/intel/ice/ice_switch.h+3−3
@@ -17,7 +17,7 @@ struct ice_vsi_ctx { · 16 unmodified lines
1717 u16 vsis_unallocated;
1818 u16 flags;
1919 struct ice_aqc_vsi_props info;
20− bool alloc_from_pool;
20+ u8 alloc_from_pool;
2121 };
2222
2323 enum ice_sw_fwd_act_type {
@@ -94,8 +94,8 @@ struct ice_fltr_info { · 70 unmodified lines
9494 u8 qgrp_size;
9595
9696 /* Rule creations populate these indicators basing on the switch type */
97− bool lb_en; /* Indicate if packet can be looped back */
98− bool lan_en; /* Indicate if packet can be forwarded to the uplink */
97+ u8 lb_en; /* Indicate if packet can be looped back */
98+ u8 lan_en; /* Indicate if packet can be forwarded to the uplink */
9999 };
100100
101101 /* Bookkeeping structure to hold bitmap of VSIs corresponding to VSI list id */
drivers/net/ethernet/intel/ice/ice_txrx.h+1−1
@@ -143,7 +143,7 @@ struct ice_ring { · 142 unmodified lines
143143 u16 next_to_use;
144144 u16 next_to_clean;
145145
146− bool ring_active; /* is ring online or not */
146+ u8 ring_active; /* is ring online or not */
147147
148148 /* stats structs */
149149 struct ice_q_stats stats;
drivers/net/ethernet/intel/ice/ice_type.h+8−8
@@ -83,7 +83,7 @@ struct ice_link_status { · 82 unmodified lines
8383 u64 phy_type_low;
8484 u16 max_frame_size;
8585 u16 link_speed;
86− bool lse_ena; /* Link Status Event notification */
86+ u8 lse_ena; /* Link Status Event notification */
8787 u8 link_info;
8888 u8 an_info;
8989 u8 ext_info;
@@ -101,7 +101,7 @@ struct ice_phy_info { · 11 unmodified lines
101101 struct ice_link_status link_info_old;
102102 u64 phy_type_low;
103103 enum ice_media_type media_type;
104− bool get_link_info;
104+ u8 get_link_info;
105105 };
106106
107107 /* Common HW capabilities for SW use */
@@ -167,7 +167,7 @@ struct ice_nvm_info { · 59 unmodified lines
167167 u32 oem_ver; /* OEM version info */
168168 u16 sr_words; /* Shadow RAM size in words */
169169 u16 ver; /* NVM package version */
170− bool blank_nvm_mode; /* is NVM empty (no FW present) */
170+ u8 blank_nvm_mode; /* is NVM empty (no FW present) */
171171 };
172172
173173 /* Max number of port to queue branches w.r.t topology */
@@ -181,7 +181,7 @@ struct ice_sched_node { · 7 unmodified lines
181181 struct ice_aqc_txsched_elem_data info;
182182 u32 agg_id; /* aggregator group id */
183183 u16 vsi_id;
184− bool in_use; /* suspended or in use */
184+ u8 in_use; /* suspended or in use */
185185 u8 tx_sched_layer; /* Logical Layer (1-9) */
186186 u8 num_children;
187187 u8 tc_num;
@@ -218,7 +218,7 @@ struct ice_sched_vsi_info { · 30 unmodified lines
218218 struct ice_sched_tx_policy {
219219 u16 max_num_vsis;
220220 u8 max_num_lan_qs_per_tc[ICE_MAX_TRAFFIC_CLASS];
221− bool rdma_ena;
221+ u8 rdma_ena;
222222 };
223223
224224 struct ice_port_info {
@@ -243,7 +243,7 @@ struct ice_port_info { · 18 unmodified lines
243243 struct list_head agg_list; /* lists all aggregator */
244244 u8 lport;
245245 #define ICE_LPORT_MASK 0xff
246− bool is_vf;
246+ u8 is_vf;
247247 };
248248
249249 struct ice_switch_info {
@@ -287,7 +287,7 @@ struct ice_hw { · 37 unmodified lines
287287 u8 max_cgds;
288288 u8 sw_entry_point_layer;
289289
290− bool evb_veb; /* true for VEB, false for VEPA */
290+ u8 evb_veb; /* true for VEB, false for VEPA */
291291 struct ice_bus_info bus;
292292 struct ice_nvm_info nvm;
293293 struct ice_hw_dev_caps dev_caps; /* device capabilities */
@@ -318,7 +318,7 @@ struct ice_hw { · 24 unmodified lines
318318 u8 itr_gran_100;
319319 u8 itr_gran_50;
320320 u8 itr_gran_25;
321− bool ucast_shared; /* true if VSIs can share unicast addr */
321+ u8 ucast_shared; /* true if VSIs can share unicast addr */
322322
323323 };
324324
drivers/net/ethernet/intel/igb/igb_ethtool.c+1−1
@@ -1649,7 +1649,7 @@ static int igb_integrated_phy_loopback(struct igb_adapter *adapter) · 1648 unmodified lines
16491649 if (hw->phy.type == e1000_phy_m88)
16501650 igb_phy_disable_receiver(adapter);
16511651
1652− mdelay(500);
1652+ msleep(500);
16531653 return 0;
16541654 }
16551655
drivers/net/ethernet/intel/igb/igb_main.c+4−3
@@ -3873,7 +3873,7 @@ static int igb_sw_init(struct igb_adapter *adapter) · 3872 unmodified lines
38733873
38743874 adapter->mac_table = kcalloc(hw->mac.rar_entry_count,
38753875 sizeof(struct igb_mac_addr),
3876− GFP_ATOMIC);
3876+ GFP_KERNEL);
38773877 if (!adapter->mac_table)
38783878 return -ENOMEM;
38793879
@@ -3883,7 +3883,7 @@ static int igb_sw_init(struct igb_adapter *adapter) · 3 unmodified lines
38833883
38843884 /* Setup and initialize a copy of the hw vlan table array */
38853885 adapter->shadow_vfta = kcalloc(E1000_VLAN_FILTER_TBL_SIZE, sizeof(u32),
3886− GFP_ATOMIC);
3886+ GFP_KERNEL);
38873887 if (!adapter->shadow_vfta)
38883888 return -ENOMEM;
38893889
@@ -5816,7 +5816,8 @@ static void igb_tx_csum(struct igb_ring *tx_ring, struct igb_tx_buffer *first) · 1926 unmodified lines
58165816
58175817 if (skb->ip_summed != CHECKSUM_PARTIAL) {
58185818 csum_failed:
5819− if (!(first->tx_flags & IGB_TX_FLAGS_VLAN))
5819+ if (!(first->tx_flags & IGB_TX_FLAGS_VLAN) &&
5820+ !tx_ring->launchtime_enable)
58205821 return;
58215822 goto no_csum;
58225823 }
drivers/net/ethernet/intel/ixgb/ixgb_main.c+2−3
@@ -771,14 +771,13 @@ ixgb_setup_rx_resources(struct ixgb_adapter *adapter) · 770 unmodified lines
771771 rxdr->size = rxdr->count * sizeof(struct ixgb_rx_desc);
772772 rxdr->size = ALIGN(rxdr->size, 4096);
773773
774− rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
775− GFP_KERNEL);
774+ rxdr->desc = dma_zalloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
775+ GFP_KERNEL);
776776
777777 if (!rxdr->desc) {
778778 vfree(rxdr->buffer_info);
779779 return -ENOMEM;
780780 }
781− memset(rxdr->desc, 0, rxdr->size);
782781
783782 rxdr->next_to_clean = 0;
784783 rxdr->next_to_use = 0;
drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c+2−2
@@ -192,7 +192,7 @@ static int ixgbe_fcoe_ddp_setup(struct net_device *netdev, u16 xid, · 191 unmodified lines
192192 }
193193
194194 /* alloc the udl from per cpu ddp pool */
195− ddp->udl = dma_pool_alloc(ddp_pool->pool, GFP_ATOMIC, &ddp->udp);
195+ ddp->udl = dma_pool_alloc(ddp_pool->pool, GFP_KERNEL, &ddp->udp);
196196 if (!ddp->udl) {
197197 e_err(drv, "failed allocated ddp context\n");
198198 goto out_noddp_unmap;
@@ -760,7 +760,7 @@ int ixgbe_setup_fcoe_ddp_resources(struct ixgbe_adapter *adapter) · 561 unmodified lines
760760 return 0;
761761
762762 /* Extra buffer to be shared by all DDPs for HW work around */
763− buffer = kmalloc(IXGBE_FCBUFF_MIN, GFP_ATOMIC);
763+ buffer = kmalloc(IXGBE_FCBUFF_MIN, GFP_KERNEL);
764764 if (!buffer)
765765 return -ENOMEM;
766766
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c+29−7
@@ -6201,7 +6201,7 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter, · 6200 unmodified lines
62016201
62026202 adapter->mac_table = kcalloc(hw->mac.num_rar_entries,
62036203 sizeof(struct ixgbe_mac_addr),
6204− GFP_ATOMIC);
6204+ GFP_KERNEL);
62056205 if (!adapter->mac_table)
62066206 return -ENOMEM;
62076207
@@ -6620,8 +6620,18 @@ static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu) · 412 unmodified lines
66206620 struct ixgbe_adapter *adapter = netdev_priv(netdev);
66216621
66226622 if (adapter->xdp_prog) {
6623− e_warn(probe, "MTU cannot be changed while XDP program is loaded\n");
6624− return -EPERM;
6623+ int new_frame_size = new_mtu + ETH_HLEN + ETH_FCS_LEN +
6624+ VLAN_HLEN;
6625+ int i;
6626+
6627+ for (i = 0; i < adapter->num_rx_queues; i++) {
6628+ struct ixgbe_ring *ring = adapter->rx_ring[i];
6629+
6630+ if (new_frame_size > ixgbe_rx_bufsz(ring)) {
6631+ e_warn(probe, "Requested MTU size is not supported with XDP\n");
6632+ return -EINVAL;
6633+ }
6634+ }
66256635 }
66266636
66276637 /*
@@ -8983,6 +8993,15 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc) · 2355 unmodified lines
89838993
89848994 #ifdef CONFIG_IXGBE_DCB
89858995 if (tc) {
8996+ if (adapter->xdp_prog) {
8997+ e_warn(probe, "DCB is not supported with XDP\n");
8998+
8999+ ixgbe_init_interrupt_scheme(adapter);
9000+ if (netif_running(dev))
9001+ ixgbe_open(dev);
9002+ return -EINVAL;
9003+ }
9004+
89869005 netdev_set_num_tc(dev, tc);
89879006 ixgbe_set_prio_tc_map(adapter);
89889007
@@ -9171,14 +9190,12 @@ static int parse_tc_actions(struct ixgbe_adapter *adapter, · 182 unmodified lines
91719190 struct tcf_exts *exts, u64 *action, u8 *queue)
91729191 {
91739192 const struct tc_action *a;
9174− LIST_HEAD(actions);
9193+ int i;
91759194
91769195 if (!tcf_exts_has_actions(exts))
91779196 return -EINVAL;
91789197
9179− tcf_exts_to_list(exts, &actions);
9180− list_for_each_entry(a, &actions, list) {
9181−
9198+ tcf_exts_for_each_action(i, a, exts) {
91829199 /* Drop action */
91839200 if (is_tcf_gact_shot(a)) {
91849201 *action = IXGBE_FDIR_DROP_QUEUE;
@@ -9936,6 +9953,11 @@ static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev) · 751 unmodified lines
99369953 int tcs = adapter->hw_tcs ? : 1;
99379954 int pool, err;
99389955
9956+ if (adapter->xdp_prog) {
9957+ e_warn(probe, "L2FW offload is not supported with XDP\n");
9958+ return ERR_PTR(-EINVAL);
9959+ }
9960+
99399961 /* The hardware supported by ixgbe only filters on the destination MAC
99409962 * address. In order to avoid issues we only support offloading modes
99419963 * where the hardware can actually provide the functionality.
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c+31−0
@@ -53,6 +53,11 @@ static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter, · 52 unmodified lines
5353 struct ixgbe_hw *hw = &adapter->hw;
5454 int i;
5555
56+ if (adapter->xdp_prog) {
57+ e_warn(probe, "SRIOV is not supported with XDP\n");
58+ return -EINVAL;
59+ }
60+
5661 /* Enable VMDq flag so device will be set in VM mode */
5762 adapter->flags |= IXGBE_FLAG_SRIOV_ENABLED |
5863 IXGBE_FLAG_VMDQ_ENABLED;
@@ -688,8 +693,13 @@ static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter, · 629 unmodified lines
688693 static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf)
689694 {
690695 struct ixgbe_hw *hw = &adapter->hw;
696+ struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ];
691697 struct vf_data_storage *vfinfo = &adapter->vfinfo[vf];
698+ u32 q_per_pool = __ALIGN_MASK(1, ~vmdq->mask);
692699 u8 num_tcs = adapter->hw_tcs;
700+ u32 reg_val;
701+ u32 queue;
702+ u32 word;
693703
694704 /* remove VLAN filters beloning to this VF */
695705 ixgbe_clear_vf_vlans(adapter, vf);
@@ -726,6 +736,27 @@ static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf) · 30 unmodified lines
726736
727737 /* reset VF api back to unknown */
728738 adapter->vfinfo[vf].vf_api = ixgbe_mbox_api_10;
739+
740+ /* Restart each queue for given VF */
741+ for (queue = 0; queue < q_per_pool; queue++) {
742+ unsigned int reg_idx = (vf * q_per_pool) + queue;
743+
744+ reg_val = IXGBE_READ_REG(hw, IXGBE_PVFTXDCTL(reg_idx));
745+
746+ /* Re-enabling only configured queues */
747+ if (reg_val) {
748+ reg_val |= IXGBE_TXDCTL_ENABLE;
749+ IXGBE_WRITE_REG(hw, IXGBE_PVFTXDCTL(reg_idx), reg_val);
750+ reg_val &= ~IXGBE_TXDCTL_ENABLE;
751+ IXGBE_WRITE_REG(hw, IXGBE_PVFTXDCTL(reg_idx), reg_val);
752+ }
753+ }
754+
755+ /* Clear VF's mailbox memory */
756+ for (word = 0; word < IXGBE_VFMAILBOX_SIZE; word++)
757+ IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf), word, 0);
758+
759+ IXGBE_WRITE_FLUSH(hw);
729760 }
730761
731762 static int ixgbe_set_vf_mac(struct ixgbe_adapter *adapter,
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h+1−0
@@ -2518,6 +2518,7 @@ enum { · 2517 unmodified lines
25182518 /* Translated register #defines */
25192519 #define IXGBE_PVFTDH(P) (0x06010 + (0x40 * (P)))
25202520 #define IXGBE_PVFTDT(P) (0x06018 + (0x40 * (P)))
2521+#define IXGBE_PVFTXDCTL(P) (0x06028 + (0x40 * (P)))
25212522 #define IXGBE_PVFTDWBAL(P) (0x06038 + (0x40 * (P)))
25222523 #define IXGBE_PVFTDWBAH(P) (0x0603C + (0x40 * (P)))
25232524
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+9−10
@@ -1982,14 +1982,15 @@ static bool modify_header_match_supported(struct mlx5_flow_spec *spec, · 1981 unmodified lines
19821982 goto out_ok;
19831983
19841984 modify_ip_header = false;
1985− tcf_exts_to_list(exts, &actions);
1986− list_for_each_entry(a, &actions, list) {
1985+ tcf_exts_for_each_action(i, a, exts) {
1986+ int k;
1987+
19871988 if (!is_tcf_pedit(a))
19881989 continue;
19891990
19901991 nkeys = tcf_pedit_nkeys(a);
1991− for (i = 0; i < nkeys; i++) {
1992− htype = tcf_pedit_htype(a, i);
1992+ for (k = 0; k < nkeys; k++) {
1993+ htype = tcf_pedit_htype(a, k);
19931994 if (htype == TCA_PEDIT_KEY_EX_HDR_TYPE_IP4 ||
19941995 htype == TCA_PEDIT_KEY_EX_HDR_TYPE_IP6) {
19951996 modify_ip_header = true;
@@ -2053,15 +2054,14 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, · 57 unmodified lines
20532054 const struct tc_action *a;
20542055 LIST_HEAD(actions);
20552056 u32 action = 0;
2056− int err;
2057+ int err, i;
20572058
20582059 if (!tcf_exts_has_actions(exts))
20592060 return -EINVAL;
20602061
20612062 attr->flow_tag = MLX5_FS_DEFAULT_FLOW_TAG;
20622063
2063− tcf_exts_to_list(exts, &actions);
2064− list_for_each_entry(a, &actions, list) {
2064+ tcf_exts_for_each_action(i, a, exts) {
20652065 if (is_tcf_gact_shot(a)) {
20662066 action |= MLX5_FLOW_CONTEXT_ACTION_DROP;
20672067 if (MLX5_CAP_FLOWTABLE(priv->mdev,
@@ -2666,7 +2666,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, · 598 unmodified lines
26662666 LIST_HEAD(actions);
26672667 bool encap = false;
26682668 u32 action = 0;
2669− int err;
2669+ int err, i;
26702670
26712671 if (!tcf_exts_has_actions(exts))
26722672 return -EINVAL;
@@ -2674,8 +2674,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, · 1 unmodified line
26742674 attr->in_rep = rpriv->rep;
26752675 attr->in_mdev = priv->mdev;
26762676
2677− tcf_exts_to_list(exts, &actions);
2678− list_for_each_entry(a, &actions, list) {
2677+ tcf_exts_for_each_action(i, a, exts) {
26792678 if (is_tcf_gact_shot(a)) {
26802679 action |= MLX5_FLOW_CONTEXT_ACTION_DROP |
26812680 MLX5_FLOW_CONTEXT_ACTION_COUNT;
drivers/net/ethernet/mellanox/mlxsw/spectrum.c+1−2
@@ -1346,8 +1346,7 @@ static int mlxsw_sp_port_add_cls_matchall(struct mlxsw_sp_port *mlxsw_sp_port, · 1345 unmodified lines
13461346 return -ENOMEM;
13471347 mall_tc_entry->cookie = f->cookie;
13481348
1349− tcf_exts_to_list(f->exts, &actions);
1350− a = list_first_entry(&actions, struct tc_action, list);
1349+ a = tcf_exts_first_action(f->exts);
13511350
13521351 if (is_tcf_mirred_egress_mirror(a) && protocol == htons(ETH_P_ALL)) {
13531352 struct mlxsw_sp_port_mall_mirror_tc_entry *mirror;
drivers/net/ethernet/mellanox/mlxsw/spectrum.h+2−0
@@ -414,6 +414,8 @@ mlxsw_sp_netdevice_ipip_ul_event(struct mlxsw_sp *mlxsw_sp, · 413 unmodified lines
414414 void
415415 mlxsw_sp_port_vlan_router_leave(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan);
416416 void mlxsw_sp_rif_destroy(struct mlxsw_sp_rif *rif);
417+void mlxsw_sp_rif_destroy_by_dev(struct mlxsw_sp *mlxsw_sp,
418+ struct net_device *dev);
417419
418420 /* spectrum_kvdl.c */
419421 enum mlxsw_sp_kvdl_entry_type {
drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c+2−4
@@ -21,8 +21,7 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp, · 20 unmodified lines
2121 struct netlink_ext_ack *extack)
2222 {
2323 const struct tc_action *a;
24− LIST_HEAD(actions);
25− int err;
24+ int err, i;
2625
2726 if (!tcf_exts_has_actions(exts))
2827 return 0;
@@ -32,8 +31,7 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp, · 3 unmodified lines
3231 if (err)
3332 return err;
3433
35− tcf_exts_to_list(exts, &actions);
36− list_for_each_entry(a, &actions, list) {
34+ tcf_exts_for_each_action(i, a, exts) {
3735 if (is_tcf_gact_ok(a)) {
3836 err = mlxsw_sp_acl_rulei_act_terminate(rulei);
3937 if (err) {
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c+11−0
@@ -6234,6 +6234,17 @@ void mlxsw_sp_rif_destroy(struct mlxsw_sp_rif *rif) · 6233 unmodified lines
62346234 mlxsw_sp_vr_put(mlxsw_sp, vr);
62356235 }
62366236
6237+void mlxsw_sp_rif_destroy_by_dev(struct mlxsw_sp *mlxsw_sp,
6238+ struct net_device *dev)
6239+{
6240+ struct mlxsw_sp_rif *rif;
6241+
6242+ rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, dev);
6243+ if (!rif)
6244+ return;
6245+ mlxsw_sp_rif_destroy(rif);
6246+}
6247+
62376248 static void
62386249 mlxsw_sp_rif_subport_params_init(struct mlxsw_sp_rif_params *params,
62396250 struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan)
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c+20−0
@@ -127,6 +127,24 @@ bool mlxsw_sp_bridge_device_is_offloaded(const struct mlxsw_sp *mlxsw_sp, · 126 unmodified lines
127127 return !!mlxsw_sp_bridge_device_find(mlxsw_sp->bridge, br_dev);
128128 }
129129
130+static int mlxsw_sp_bridge_device_upper_rif_destroy(struct net_device *dev,
131+ void *data)
132+{
133+ struct mlxsw_sp *mlxsw_sp = data;
134+
135+ mlxsw_sp_rif_destroy_by_dev(mlxsw_sp, dev);
136+ return 0;
137+}
138+
139+static void mlxsw_sp_bridge_device_rifs_destroy(struct mlxsw_sp *mlxsw_sp,
140+ struct net_device *dev)
141+{
142+ mlxsw_sp_rif_destroy_by_dev(mlxsw_sp, dev);
143+ netdev_walk_all_upper_dev_rcu(dev,
144+ mlxsw_sp_bridge_device_upper_rif_destroy,
145+ mlxsw_sp);
146+}
147+
130148 static struct mlxsw_sp_bridge_device *
131149 mlxsw_sp_bridge_device_create(struct mlxsw_sp_bridge *bridge,
132150 struct net_device *br_dev)
@@ -165,6 +183,8 @@ static void · 32 unmodified lines
165183 mlxsw_sp_bridge_device_destroy(struct mlxsw_sp_bridge *bridge,
166184 struct mlxsw_sp_bridge_device *bridge_device)
167185 {
186+ mlxsw_sp_bridge_device_rifs_destroy(bridge->mlxsw_sp,
187+ bridge_device->dev);
168188 list_del(&bridge_device->list);
169189 if (bridge_device->vlan_enabled)
170190 bridge->vlan_enabled_exists = false;
drivers/net/ethernet/netronome/nfp/flower/action.c+2−4
@@ -796,11 +796,10 @@ int nfp_flower_compile_action(struct nfp_app *app, · 795 unmodified lines
796796 struct net_device *netdev,
797797 struct nfp_fl_payload *nfp_flow)
798798 {
799− int act_len, act_cnt, err, tun_out_cnt, out_cnt;
799+ int act_len, act_cnt, err, tun_out_cnt, out_cnt, i;
800800 enum nfp_flower_tun_type tun_type;
801801 const struct tc_action *a;
802802 u32 csum_updated = 0;
803− LIST_HEAD(actions);
804803
805804 memset(nfp_flow->action_data, 0, NFP_FL_MAX_A_SIZ);
806805 nfp_flow->meta.act_len = 0;
@@ -810,8 +809,7 @@ int nfp_flower_compile_action(struct nfp_app *app, · 3 unmodified lines
810809 tun_out_cnt = 0;
811810 out_cnt = 0;
812811
813− tcf_exts_to_list(flow->exts, &actions);
814− list_for_each_entry(a, &actions, list) {
812+ tcf_exts_for_each_action(i, a, flow->exts) {
815813 err = nfp_flower_loop_action(app, a, flow, nfp_flow, &act_len,
816814 netdev, &tun_type, &tun_out_cnt,
817815 &out_cnt, &csum_updated);
drivers/net/ethernet/qlogic/qed/qed_init_ops.c+1−1
@@ -407,7 +407,7 @@ static void qed_init_cmd_rd(struct qed_hwfn *p_hwfn, · 406 unmodified lines
407407
408408 if (i == QED_INIT_MAX_POLL_COUNT) {
409409 DP_ERR(p_hwfn,
410− "Timeout when polling reg: 0x%08x [ Waiting-for: %08x Got: %08x (comparsion %08x)]\n",
410+ "Timeout when polling reg: 0x%08x [ Waiting-for: %08x Got: %08x (comparison %08x)]\n",
411411 addr, le32_to_cpu(cmd->expected_val),
412412 val, le32_to_cpu(cmd->op_data));
413413 }
drivers/net/ethernet/qlogic/qed/qed_mcp.c+158−29
@@ -48,7 +48,7 @@ · 47 unmodified lines
4848 #include "qed_reg_addr.h"
4949 #include "qed_sriov.h"
5050
51−#define CHIP_MCP_RESP_ITER_US 10
51+#define QED_MCP_RESP_ITER_US 10
5252
5353 #define QED_DRV_MB_MAX_RETRIES (500 * 1000) /* Account for 5 sec */
5454 #define QED_MCP_RESET_RETRIES (50 * 1000) /* Account for 500 msec */
@@ -183,18 +183,57 @@ int qed_mcp_free(struct qed_hwfn *p_hwfn) · 128 unmodified lines
183183 return 0;
184184 }
185185
186+/* Maximum of 1 sec to wait for the SHMEM ready indication */
187+#define QED_MCP_SHMEM_RDY_MAX_RETRIES 20
188+#define QED_MCP_SHMEM_RDY_ITER_MS 50
189+
186190 static int qed_load_mcp_offsets(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
187191 {
188192 struct qed_mcp_info *p_info = p_hwfn->mcp_info;
193+ u8 cnt = QED_MCP_SHMEM_RDY_MAX_RETRIES;
194+ u8 msec = QED_MCP_SHMEM_RDY_ITER_MS;
189195 u32 drv_mb_offsize, mfw_mb_offsize;
190196 u32 mcp_pf_id = MCP_PF_ID(p_hwfn);
191197
192198 p_info->public_base = qed_rd(p_hwfn, p_ptt, MISC_REG_SHARED_MEM_ADDR);
193− if (!p_info->public_base)
194− return 0;
199+ if (!p_info->public_base) {
200+ DP_NOTICE(p_hwfn,
201+ "The address of the MCP scratch-pad is not configured\n");
202+ return -EINVAL;
203+ }
195204
196205 p_info->public_base |= GRCBASE_MCP;
197206
207+ /* Get the MFW MB address and number of supported messages */
208+ mfw_mb_offsize = qed_rd(p_hwfn, p_ptt,
209+ SECTION_OFFSIZE_ADDR(p_info->public_base,
210+ PUBLIC_MFW_MB));
211+ p_info->mfw_mb_addr = SECTION_ADDR(mfw_mb_offsize, mcp_pf_id);
212+ p_info->mfw_mb_length = (u16)qed_rd(p_hwfn, p_ptt,
213+ p_info->mfw_mb_addr +
214+ offsetof(struct public_mfw_mb,
215+ sup_msgs));
216+
217+ /* The driver can notify that there was an MCP reset, and might read the
218+ * SHMEM values before the MFW has completed initializing them.
219+ * To avoid this, the "sup_msgs" field in the MFW mailbox is used as a
220+ * data ready indication.
221+ */
222+ while (!p_info->mfw_mb_length && --cnt) {
223+ msleep(msec);
224+ p_info->mfw_mb_length =
225+ (u16)qed_rd(p_hwfn, p_ptt,
226+ p_info->mfw_mb_addr +
227+ offsetof(struct public_mfw_mb, sup_msgs));
228+ }
229+
230+ if (!cnt) {
231+ DP_NOTICE(p_hwfn,
232+ "Failed to get the SHMEM ready notification after %d msec\n",
233+ QED_MCP_SHMEM_RDY_MAX_RETRIES * msec);
234+ return -EBUSY;
235+ }
236+
198237 /* Calculate the driver and MFW mailbox address */
199238 drv_mb_offsize = qed_rd(p_hwfn, p_ptt,
200239 SECTION_OFFSIZE_ADDR(p_info->public_base,
@@ -204,13 +243,6 @@ static int qed_load_mcp_offsets(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) · 3 unmodified lines
204243 "drv_mb_offsiz = 0x%x, drv_mb_addr = 0x%x mcp_pf_id = 0x%x\n",
205244 drv_mb_offsize, p_info->drv_mb_addr, mcp_pf_id);
206245
207− /* Set the MFW MB address */
208− mfw_mb_offsize = qed_rd(p_hwfn, p_ptt,
209− SECTION_OFFSIZE_ADDR(p_info->public_base,
210− PUBLIC_MFW_MB));
211− p_info->mfw_mb_addr = SECTION_ADDR(mfw_mb_offsize, mcp_pf_id);
212− p_info->mfw_mb_length = (u16)qed_rd(p_hwfn, p_ptt, p_info->mfw_mb_addr);
213−
214246 /* Get the current driver mailbox sequence before sending
215247 * the first command
216248 */
@@ -285,9 +317,15 @@ static void qed_mcp_reread_offsets(struct qed_hwfn *p_hwfn, · 68 unmodified lines
285317
286318 int qed_mcp_reset(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
287319 {
288− u32 org_mcp_reset_seq, seq, delay = CHIP_MCP_RESP_ITER_US, cnt = 0;
320+ u32 org_mcp_reset_seq, seq, delay = QED_MCP_RESP_ITER_US, cnt = 0;
289321 int rc = 0;
290322
323+ if (p_hwfn->mcp_info->b_block_cmd) {
324+ DP_NOTICE(p_hwfn,
325+ "The MFW is not responsive. Avoid sending MCP_RESET mailbox command.\n");
326+ return -EBUSY;
327+ }
328+
291329 /* Ensure that only a single thread is accessing the mailbox */
292330 spin_lock_bh(&p_hwfn->mcp_info->cmd_lock);
293331
@@ -413,14 +451,41 @@ static void __qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, · 119 unmodified lines
413451 (p_mb_params->cmd | seq_num), p_mb_params->param);
414452 }
415453
454+static void qed_mcp_cmd_set_blocking(struct qed_hwfn *p_hwfn, bool block_cmd)
455+{
456+ p_hwfn->mcp_info->b_block_cmd = block_cmd;
457+
458+ DP_INFO(p_hwfn, "%s sending of mailbox commands to the MFW\n",
459+ block_cmd ? "Block" : "Unblock");
460+}
461+
462+static void qed_mcp_print_cpu_info(struct qed_hwfn *p_hwfn,
463+ struct qed_ptt *p_ptt)
464+{
465+ u32 cpu_mode, cpu_state, cpu_pc_0, cpu_pc_1, cpu_pc_2;
466+ u32 delay = QED_MCP_RESP_ITER_US;
467+
468+ cpu_mode = qed_rd(p_hwfn, p_ptt, MCP_REG_CPU_MODE);
469+ cpu_state = qed_rd(p_hwfn, p_ptt, MCP_REG_CPU_STATE);
470+ cpu_pc_0 = qed_rd(p_hwfn, p_ptt, MCP_REG_CPU_PROGRAM_COUNTER);
471+ udelay(delay);
472+ cpu_pc_1 = qed_rd(p_hwfn, p_ptt, MCP_REG_CPU_PROGRAM_COUNTER);
473+ udelay(delay);
474+ cpu_pc_2 = qed_rd(p_hwfn, p_ptt, MCP_REG_CPU_PROGRAM_COUNTER);
475+
476+ DP_NOTICE(p_hwfn,
477+ "MCP CPU info: mode 0x%08x, state 0x%08x, pc {0x%08x, 0x%08x, 0x%08x}\n",
478+ cpu_mode, cpu_state, cpu_pc_0, cpu_pc_1, cpu_pc_2);
479+}
480+
416481 static int
417482 _qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn,
418483 struct qed_ptt *p_ptt,
419484 struct qed_mcp_mb_params *p_mb_params,
420− u32 max_retries, u32 delay)
485+ u32 max_retries, u32 usecs)
421486 {
487+ u32 cnt = 0, msecs = DIV_ROUND_UP(usecs, 1000);
422488 struct qed_mcp_cmd_elem *p_cmd_elem;
423− u32 cnt = 0;
424489 u16 seq_num;
425490 int rc = 0;
426491
@@ -443,7 +508,11 @@ _qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, · 16 unmodified lines
443508 goto err;
444509
445510 spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock);
446− udelay(delay);
511+
512+ if (QED_MB_FLAGS_IS_SET(p_mb_params, CAN_SLEEP))
513+ msleep(msecs);
514+ else
515+ udelay(usecs);
447516 } while (++cnt < max_retries);
448517
449518 if (cnt >= max_retries) {
@@ -472,7 +541,11 @@ _qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, · 22 unmodified lines
472541 * The spinlock stays locked until the list element is removed.
473542 */
474543
475− udelay(delay);
544+ if (QED_MB_FLAGS_IS_SET(p_mb_params, CAN_SLEEP))
545+ msleep(msecs);
546+ else
547+ udelay(usecs);
548+
476549 spin_lock_bh(&p_hwfn->mcp_info->cmd_lock);
477550
478551 if (p_cmd_elem->b_is_completed)
@@ -491,11 +564,15 @@ _qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, · 12 unmodified lines
491564 DP_NOTICE(p_hwfn,
492565 "The MFW failed to respond to command 0x%08x [param 0x%08x].\n",
493566 p_mb_params->cmd, p_mb_params->param);
567+ qed_mcp_print_cpu_info(p_hwfn, p_ptt);
494568
495569 spin_lock_bh(&p_hwfn->mcp_info->cmd_lock);
496570 qed_mcp_cmd_del_elem(p_hwfn, p_cmd_elem);
497571 spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock);
498572
573+ if (!QED_MB_FLAGS_IS_SET(p_mb_params, AVOID_BLOCK))
574+ qed_mcp_cmd_set_blocking(p_hwfn, true);
575+
499576 return -EAGAIN;
500577 }
501578
@@ -507,7 +584,7 @@ _qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, · 5 unmodified lines
507584 "MFW mailbox: response 0x%08x param 0x%08x [after %d.%03d ms]\n",
508585 p_mb_params->mcp_resp,
509586 p_mb_params->mcp_param,
510− (cnt * delay) / 1000, (cnt * delay) % 1000);
587+ (cnt * usecs) / 1000, (cnt * usecs) % 1000);
511588
512589 /* Clear the sequence number from the MFW response */
513590 p_mb_params->mcp_resp &= FW_MSG_CODE_MASK;
@@ -525,7 +602,7 @@ static int qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, · 11 unmodified lines
525602 {
526603 size_t union_data_size = sizeof(union drv_union_data);
527604 u32 max_retries = QED_DRV_MB_MAX_RETRIES;
528− u32 delay = CHIP_MCP_RESP_ITER_US;
605+ u32 usecs = QED_MCP_RESP_ITER_US;
529606
530607 /* MCP not initialized */
531608 if (!qed_mcp_is_init(p_hwfn)) {
@@ -533,6 +610,13 @@ static int qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, · 1 unmodified line
533610 return -EBUSY;
534611 }
535612
613+ if (p_hwfn->mcp_info->b_block_cmd) {
614+ DP_NOTICE(p_hwfn,
615+ "The MFW is not responsive. Avoid sending mailbox command 0x%08x [param 0x%08x].\n",
616+ p_mb_params->cmd, p_mb_params->param);
617+ return -EBUSY;
618+ }
619+
536620 if (p_mb_params->data_src_size > union_data_size ||
537621 p_mb_params->data_dst_size > union_data_size) {
538622 DP_ERR(p_hwfn,
@@ -542,8 +626,13 @@ static int qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, · 3 unmodified lines
542626 return -EINVAL;
543627 }
544628
629+ if (QED_MB_FLAGS_IS_SET(p_mb_params, CAN_SLEEP)) {
630+ max_retries = DIV_ROUND_UP(max_retries, 1000);
631+ usecs *= 1000;
632+ }
633+
545634 return _qed_mcp_cmd_and_union(p_hwfn, p_ptt, p_mb_params, max_retries,
546− delay);
635+ usecs);
547636 }
548637
549638 int qed_mcp_cmd(struct qed_hwfn *p_hwfn,
@@ -761,6 +850,7 @@ __qed_mcp_load_req(struct qed_hwfn *p_hwfn, · 211 unmodified lines
761850 mb_params.data_src_size = sizeof(load_req);
762851 mb_params.p_data_dst = &load_rsp;
763852 mb_params.data_dst_size = sizeof(load_rsp);
853+ mb_params.flags = QED_MB_FLAG_CAN_SLEEP | QED_MB_FLAG_AVOID_BLOCK;
764854
765855 DP_VERBOSE(p_hwfn, QED_MSG_SP,
766856 "Load Request: param 0x%08x [init_hw %d, drv_type %d, hsi_ver %d, pda 0x%04x]\n",
@@ -982,7 +1072,8 @@ int qed_mcp_load_req(struct qed_hwfn *p_hwfn, · 215 unmodified lines
9821072
9831073 int qed_mcp_unload_req(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
9841074 {
985− u32 wol_param, mcp_resp, mcp_param;
1075+ struct qed_mcp_mb_params mb_params;
1076+ u32 wol_param;
9861077
9871078 switch (p_hwfn->cdev->wol_config) {
9881079 case QED_OV_WOL_DISABLED:
@@ -1000,8 +1091,12 @@ int qed_mcp_unload_req(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) · 11 unmodified lines
10001091 wol_param = DRV_MB_PARAM_UNLOAD_WOL_MCP;
10011092 }
10021093
1003− return qed_mcp_cmd(p_hwfn, p_ptt, DRV_MSG_CODE_UNLOAD_REQ, wol_param,
1004− &mcp_resp, &mcp_param);
1094+ memset(&mb_params, 0, sizeof(mb_params));
1095+ mb_params.cmd = DRV_MSG_CODE_UNLOAD_REQ;
1096+ mb_params.param = wol_param;
1097+ mb_params.flags = QED_MB_FLAG_CAN_SLEEP | QED_MB_FLAG_AVOID_BLOCK;
1098+
1099+ return qed_mcp_cmd_and_union(p_hwfn, p_ptt, &mb_params);
10051100 }
10061101
10071102 int qed_mcp_unload_done(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
@@ -2077,31 +2172,65 @@ qed_mcp_send_drv_version(struct qed_hwfn *p_hwfn, · 1069 unmodified lines
20772172 return rc;
20782173 }
20792174
2175+/* A maximal 100 msec waiting time for the MCP to halt */
2176+#define QED_MCP_HALT_SLEEP_MS 10
2177+#define QED_MCP_HALT_MAX_RETRIES 10
2178+
20802179 int qed_mcp_halt(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
20812180 {
2082− u32 resp = 0, param = 0;
2181+ u32 resp = 0, param = 0, cpu_state, cnt = 0;
20832182 int rc;
20842183
20852184 rc = qed_mcp_cmd(p_hwfn, p_ptt, DRV_MSG_CODE_MCP_HALT, 0, &resp,
20862185 &param);
2087− if (rc)
2186+ if (rc) {
20882187 DP_ERR(p_hwfn, "MCP response failure, aborting\n");
2188+ return rc;
2189+ }
20892190
2090− return rc;
2191+ do {
2192+ msleep(QED_MCP_HALT_SLEEP_MS);
2193+ cpu_state = qed_rd(p_hwfn, p_ptt, MCP_REG_CPU_STATE);
2194+ if (cpu_state & MCP_REG_CPU_STATE_SOFT_HALTED)
2195+ break;
2196+ } while (++cnt < QED_MCP_HALT_MAX_RETRIES);
2197+
2198+ if (cnt == QED_MCP_HALT_MAX_RETRIES) {
2199+ DP_NOTICE(p_hwfn,
2200+ "Failed to halt the MCP [CPU_MODE = 0x%08x, CPU_STATE = 0x%08x]\n",
2201+ qed_rd(p_hwfn, p_ptt, MCP_REG_CPU_MODE), cpu_state);
2202+ return -EBUSY;
2203+ }
2204+
2205+ qed_mcp_cmd_set_blocking(p_hwfn, true);
2206+
2207+ return 0;
20912208 }
20922209
2210+#define QED_MCP_RESUME_SLEEP_MS 10
2211+
20932212 int qed_mcp_resume(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
20942213 {
2095− u32 value, cpu_mode;
2214+ u32 cpu_mode, cpu_state;
20962215
20972216 qed_wr(p_hwfn, p_ptt, MCP_REG_CPU_STATE, 0xffffffff);
20982217
2099− value = qed_rd(p_hwfn, p_ptt, MCP_REG_CPU_MODE);
2100− value &= ~MCP_REG_CPU_MODE_SOFT_HALT;
2101− qed_wr(p_hwfn, p_ptt, MCP_REG_CPU_MODE, value);
21022218 cpu_mode = qed_rd(p_hwfn, p_ptt, MCP_REG_CPU_MODE);
2219+ cpu_mode &= ~MCP_REG_CPU_MODE_SOFT_HALT;
2220+ qed_wr(p_hwfn, p_ptt, MCP_REG_CPU_MODE, cpu_mode);
2221+ msleep(QED_MCP_RESUME_SLEEP_MS);
2222+ cpu_state = qed_rd(p_hwfn, p_ptt, MCP_REG_CPU_STATE);
21032223
2104− return (cpu_mode & MCP_REG_CPU_MODE_SOFT_HALT) ? -EAGAIN : 0;
2224+ if (cpu_state & MCP_REG_CPU_STATE_SOFT_HALTED) {
2225+ DP_NOTICE(p_hwfn,
2226+ "Failed to resume the MCP [CPU_MODE = 0x%08x, CPU_STATE = 0x%08x]\n",
2227+ cpu_mode, cpu_state);
2228+ return -EBUSY;
2229+ }
2230+
2231+ qed_mcp_cmd_set_blocking(p_hwfn, false);
2232+
2233+ return 0;
21052234 }
21062235
21072236 int qed_mcp_ov_update_current_config(struct qed_hwfn *p_hwfn,
drivers/net/ethernet/qlogic/qed/qed_mcp.h+18−9
@@ -635,11 +635,14 @@ struct qed_mcp_info { · 634 unmodified lines
635635 */
636636 spinlock_t cmd_lock;
637637
638+ /* Flag to indicate whether sending a MFW mailbox command is blocked */
639+ bool b_block_cmd;
640+
638641 /* Spinlock used for syncing SW link-changes and link-changes
639642 * originating from attention context.
640643 */
641644 spinlock_t link_lock;
642− bool block_mb_sending;
645+
643646 u32 public_base;
644647 u32 drv_mb_addr;
645648 u32 mfw_mb_addr;
@@ -660,14 +663,20 @@ struct qed_mcp_info { · 14 unmodified lines
660663 };
661664
662665 struct qed_mcp_mb_params {
663− u32 cmd;
664− u32 param;
665− void *p_data_src;
666− u8 data_src_size;
667− void *p_data_dst;
668− u8 data_dst_size;
669− u32 mcp_resp;
670− u32 mcp_param;
666+ u32 cmd;
667+ u32 param;
668+ void *p_data_src;
669+ void *p_data_dst;
670+ u8 data_src_size;
671+ u8 data_dst_size;
672+ u32 mcp_resp;
673+ u32 mcp_param;
674+ u32 flags;
675+#define QED_MB_FLAG_CAN_SLEEP (0x1 << 0)
676+#define QED_MB_FLAG_AVOID_BLOCK (0x1 << 1)
677+#define QED_MB_FLAGS_IS_SET(params, flag) \
678+ ({ typeof(params) __params = (params); \
679+ (__params && (__params->flags & QED_MB_FLAG_ ## flag)); })
671680 };
672681
673682 struct qed_drv_tlv_hdr {
drivers/net/ethernet/qlogic/qed/qed_reg_addr.h+2−0
@@ -562,8 +562,10 @@ · 561 unmodified lines
562562 0
563563 #define MCP_REG_CPU_STATE \
564564 0xe05004UL
565+#define MCP_REG_CPU_STATE_SOFT_HALTED (0x1UL << 10)
565566 #define MCP_REG_CPU_EVENT_MASK \
566567 0xe05008UL
568+#define MCP_REG_CPU_PROGRAM_COUNTER 0xe0501cUL
567569 #define PGLUE_B_REG_PF_BAR0_SIZE \
568570 0x2aae60UL
569571 #define PGLUE_B_REG_PF_BAR1_SIZE \
drivers/net/ethernet/qlogic/qede/qede_filter.c+2−4
@@ -2006,18 +2006,16 @@ unlock: · 2005 unmodified lines
20062006 static int qede_parse_actions(struct qede_dev *edev,
20072007 struct tcf_exts *exts)
20082008 {
2009− int rc = -EINVAL, num_act = 0;
2009+ int rc = -EINVAL, num_act = 0, i;
20102010 const struct tc_action *a;
20112011 bool is_drop = false;
2012− LIST_HEAD(actions);
20132012
20142013 if (!tcf_exts_has_actions(exts)) {
20152014 DP_NOTICE(edev, "No tc actions received\n");
20162015 return rc;
20172016 }
20182017
2019− tcf_exts_to_list(exts, &actions);
2020− list_for_each_entry(a, &actions, list) {
2018+ tcf_exts_for_each_action(i, a, exts) {
20212019 num_act++;
20222020
20232021 if (is_tcf_gact_shot(a))
drivers/net/ethernet/qlogic/qlge/qlge_main.c+8−15
@@ -2384,26 +2384,20 @@ static int qlge_update_hw_vlan_features(struct net_device *ndev, · 2383 unmodified lines
23842384 return status;
23852385 }
23862386
2387−static netdev_features_t qlge_fix_features(struct net_device *ndev,
2388− netdev_features_t features)
2389−{
2390− int err;
2391−
2392− /* Update the behavior of vlan accel in the adapter */
2393− err = qlge_update_hw_vlan_features(ndev, features);
2394− if (err)
2395− return err;
2396−
2397− return features;
2398−}
2399−
24002387 static int qlge_set_features(struct net_device *ndev,
24012388 netdev_features_t features)
24022389 {
24032390 netdev_features_t changed = ndev->features ^ features;
2391+ int err;
2392+
2393+ if (changed & NETIF_F_HW_VLAN_CTAG_RX) {
2394+ /* Update the behavior of vlan accel in the adapter */
2395+ err = qlge_update_hw_vlan_features(ndev, features);
2396+ if (err)
2397+ return err;
24042398
2405− if (changed & NETIF_F_HW_VLAN_CTAG_RX)
24062399 qlge_vlan_mode(ndev, features);
2400+ }
24072401
24082402 return 0;
24092403 }
@@ -4719,7 +4713,6 @@ static const struct net_device_ops qlge_netdev_ops = { · 2309 unmodified lines
47194713 .ndo_set_mac_address = qlge_set_mac_address,
47204714 .ndo_validate_addr = eth_validate_addr,
47214715 .ndo_tx_timeout = qlge_tx_timeout,
4722− .ndo_fix_features = qlge_fix_features,
47234716 .ndo_set_features = qlge_set_features,
47244717 .ndo_vlan_rx_add_vid = qlge_vlan_rx_add_vid,
47254718 .ndo_vlan_rx_kill_vid = qlge_vlan_rx_kill_vid,
drivers/net/ethernet/renesas/ravb.h+1−4
@@ -1,3 +1,4 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
12 /* Renesas Ethernet AVB device driver
23 *
34 * Copyright (C) 2014-2015 Renesas Electronics Corporation
@@ -5,10 +6,6 @@ · 1 unmodified line
56 * Copyright (C) 2015-2016 Cogent Embedded, Inc. <source@cogentembedded.com>
67 *
78 * Based on the SuperH Ethernet driver
8− *
9− * This program is free software; you can redistribute it and/or modify it
10− * under the terms and conditions of the GNU General Public License version 2,
11− * as published by the Free Software Foundation.
129 */
1310
1411 #ifndef __RAVB_H__
drivers/net/ethernet/renesas/ravb_main.c+1−4
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /* Renesas Ethernet AVB device driver
23 *
34 * Copyright (C) 2014-2015 Renesas Electronics Corporation
@@ -5,10 +6,6 @@ · 1 unmodified line
56 * Copyright (C) 2015-2016 Cogent Embedded, Inc. <source@cogentembedded.com>
67 *
78 * Based on the SuperH Ethernet driver
8− *
9− * This program is free software; you can redistribute it and/or modify it
10− * under the terms and conditions of the GNU General Public License version 2,
11− * as published by the Free Software Foundation.
129 */
1310
1411 #include <linux/cache.h>
drivers/net/ethernet/renesas/sh_eth.c+1−12
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /* SuperH Ethernet device driver
23 *
34 * Copyright (C) 2014 Renesas Electronics Corporation
@@ -5,18 +6,6 @@ · 1 unmodified line
56 * Copyright (C) 2008-2014 Renesas Solutions Corp.
67 * Copyright (C) 2013-2017 Cogent Embedded, Inc.
78 * Copyright (C) 2014 Codethink Limited
8− *
9− * This program is free software; you can redistribute it and/or modify it
10− * under the terms and conditions of the GNU General Public License,
11− * version 2, as published by the Free Software Foundation.
12− *
13− * This program is distributed in the hope it will be useful, but WITHOUT
14− * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15− * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16− * more details.
17− *
18− * The full GNU General Public License is included in this distribution in
19− * the file called "COPYING".
209 */
2110
2211 #include <linux/module.h>
drivers/net/ethernet/renesas/sh_eth.h+1−12
@@ -1,19 +1,8 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
12 /* SuperH Ethernet device driver
23 *
34 * Copyright (C) 2006-2012 Nobuhiro Iwamatsu
45 * Copyright (C) 2008-2012 Renesas Solutions Corp.
5− *
6− * This program is free software; you can redistribute it and/or modify it
7− * under the terms and conditions of the GNU General Public License,
8− * version 2, as published by the Free Software Foundation.
9− *
10− * This program is distributed in the hope it will be useful, but WITHOUT
11− * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12− * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13− * more details.
14− *
15− * The full GNU General Public License is included in this distribution in
16− * the file called "COPYING".
176 */
187
198 #ifndef __SH_ETH_H__
drivers/net/ethernet/stmicro/stmmac/Kconfig+5−5
@@ -33,7 +33,7 @@ config DWMAC_DWC_QOS_ETH · 32 unmodified lines
3333 select PHYLIB
3434 select CRC32
3535 select MII
36− depends on OF && COMMON_CLK && HAS_DMA
36+ depends on OF && HAS_DMA
3737 help
3838 Support for chips using the snps,dwc-qos-ethernet.txt DT binding.
3939
@@ -57,7 +57,7 @@ config DWMAC_ANARION · 17 unmodified lines
5757 config DWMAC_IPQ806X
5858 tristate "QCA IPQ806x DWMAC support"
5959 default ARCH_QCOM
60− depends on OF && COMMON_CLK && (ARCH_QCOM || COMPILE_TEST)
60+ depends on OF && (ARCH_QCOM || COMPILE_TEST)
6161 select MFD_SYSCON
6262 help
6363 Support for QCA IPQ806X DWMAC Ethernet.
@@ -100,7 +100,7 @@ config DWMAC_OXNAS · 36 unmodified lines
100100 config DWMAC_ROCKCHIP
101101 tristate "Rockchip dwmac support"
102102 default ARCH_ROCKCHIP
103− depends on OF && COMMON_CLK && (ARCH_ROCKCHIP || COMPILE_TEST)
103+ depends on OF && (ARCH_ROCKCHIP || COMPILE_TEST)
104104 select MFD_SYSCON
105105 help
106106 Support for Ethernet controller on Rockchip RK3288 SoC.
@@ -123,7 +123,7 @@ config DWMAC_SOCFPGA · 16 unmodified lines
123123 config DWMAC_STI
124124 tristate "STi GMAC support"
125125 default ARCH_STI
126− depends on OF && COMMON_CLK && (ARCH_STI || COMPILE_TEST)
126+ depends on OF && (ARCH_STI || COMPILE_TEST)
127127 select MFD_SYSCON
128128 ---help---
129129 Support for ethernet controller on STi SOCs.
@@ -147,7 +147,7 @@ config DWMAC_STM32 · 17 unmodified lines
147147 config DWMAC_SUNXI
148148 tristate "Allwinner GMAC support"
149149 default ARCH_SUNXI
150− depends on OF && COMMON_CLK && (ARCH_SUNXI || COMPILE_TEST)
150+ depends on OF && (ARCH_SUNXI || COMPILE_TEST)
151151 ---help---
152152 Support for Allwinner A20/A31 GMAC ethernet controllers.
153153
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c+2−3
@@ -61,7 +61,7 @@ static int tc_fill_actions(struct stmmac_tc_entry *entry, · 60 unmodified lines
6161 struct stmmac_tc_entry *action_entry = entry;
6262 const struct tc_action *act;
6363 struct tcf_exts *exts;
64− LIST_HEAD(actions);
64+ int i;
6565
6666 exts = cls->knode.exts;
6767 if (!tcf_exts_has_actions(exts))
@@ -69,8 +69,7 @@ static int tc_fill_actions(struct stmmac_tc_entry *entry, · 1 unmodified line
6969 if (frag)
7070 action_entry = frag;
7171
72− tcf_exts_to_list(exts, &actions);
73− list_for_each_entry(act, &actions, list) {
72+ tcf_exts_for_each_action(i, act, exts) {
7473 /* Accept */
7574 if (is_tcf_gact_ok(act)) {
7675 action_entry->val.af = 1;
drivers/net/hyperv/netvsc_drv.c+5−0
@@ -29,6 +29,7 @@ · 28 unmodified lines
2929 #include <linux/netdevice.h>
3030 #include <linux/inetdevice.h>
3131 #include <linux/etherdevice.h>
32+#include <linux/pci.h>
3233 #include <linux/skbuff.h>
3334 #include <linux/if_vlan.h>
3435 #include <linux/in.h>
@@ -2039,12 +2040,16 @@ static int netvsc_register_vf(struct net_device *vf_netdev) · 2004 unmodified lines
20392040 {
20402041 struct net_device *ndev;
20412042 struct net_device_context *net_device_ctx;
2043+ struct device *pdev = vf_netdev->dev.parent;
20422044 struct netvsc_device *netvsc_dev;
20432045 int ret;
20442046
20452047 if (vf_netdev->addr_len != ETH_ALEN)
20462048 return NOTIFY_DONE;
20472049
2050+ if (!pdev || !dev_is_pci(pdev) || dev_is_pf(pdev))
2051+ return NOTIFY_DONE;
2052+
20482053 /*
20492054 * We will use the MAC address to locate the synthetic interface to
20502055 * associate with the VF interface. If we don't find a matching
drivers/net/usb/r8152.c+2−2
@@ -5217,8 +5217,8 @@ static int rtl8152_probe(struct usb_interface *intf, · 5216 unmodified lines
52175217 netdev->hw_features &= ~NETIF_F_RXCSUM;
52185218 }
52195219
5220− if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x3011 &&
5221− udev->serial && !strcmp(udev->serial, "000001000000")) {
5220+ if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x3011 && udev->serial &&
5221+ (!strcmp(udev->serial, "000001000000") || !strcmp(udev->serial, "000002000000"))) {
52225222 dev_info(&udev->dev, "Dell TB16 Dock, disable RX aggregation");
52235223 set_bit(DELL_TB_RX_AGG_BUG, &tp->flags);
52245224 }
drivers/vhost/vhost.c+1−1
@@ -952,7 +952,7 @@ static void vhost_iotlb_notify_vq(struct vhost_dev *d, · 951 unmodified lines
952952 list_for_each_entry_safe(node, n, &d->pending_list, node) {
953953 struct vhost_iotlb_msg *vq_msg = &node->msg.iotlb;
954954 if (msg->iova <= vq_msg->iova &&
955− msg->iova + msg->size - 1 > vq_msg->iova &&
955+ msg->iova + msg->size - 1 >= vq_msg->iova &&
956956 vq_msg->type == VHOST_IOTLB_MISS) {
957957 vhost_poll_queue(&node->vq->poll);
958958 list_del(&node->node);
include/net/act_api.h+0−7
@@ -23,13 +23,11 @@ struct tc_action { · 22 unmodified lines
2323 const struct tc_action_ops *ops;
2424 __u32 type; /* for backward compat(TCA_OLD_COMPAT) */
2525 __u32 order;
26− struct list_head list;
2726 struct tcf_idrinfo *idrinfo;
2827
2928 u32 tcfa_index;
3029 refcount_t tcfa_refcnt;
3130 atomic_t tcfa_bindcnt;
32− u32 tcfa_capab;
3331 int tcfa_action;
3432 struct tcf_t tcfa_tm;
3533 struct gnet_stats_basic_packed tcfa_bstats;
@@ -44,7 +42,6 @@ struct tc_action { · 8 unmodified lines
4442 #define tcf_index common.tcfa_index
4543 #define tcf_refcnt common.tcfa_refcnt
4644 #define tcf_bindcnt common.tcfa_bindcnt
47−#define tcf_capab common.tcfa_capab
4845 #define tcf_action common.tcfa_action
4946 #define tcf_tm common.tcfa_tm
5047 #define tcf_bstats common.tcfa_bstats
@@ -102,7 +99,6 @@ struct tc_action_ops { · 51 unmodified lines
10299 size_t (*get_fill_size)(const struct tc_action *act);
103100 struct net_device *(*get_dev)(const struct tc_action *a);
104101 void (*put_dev)(struct net_device *dev);
105− int (*delete)(struct net *net, u32 index);
106102 };
107103
108104 struct tc_action_net {
@@ -148,8 +144,6 @@ int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb, · 39 unmodified lines
148144 const struct tc_action_ops *ops,
149145 struct netlink_ext_ack *extack);
150146 int tcf_idr_search(struct tc_action_net *tn, struct tc_action **a, u32 index);
151−bool tcf_idr_check(struct tc_action_net *tn, u32 index, struct tc_action **a,
152− int bind);
153147 int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est,
154148 struct tc_action **a, const struct tc_action_ops *ops,
155149 int bind, bool cpustats);
@@ -158,7 +152,6 @@ void tcf_idr_insert(struct tc_action_net *tn, struct tc_action *a); · 2 unmodified lines
158152 void tcf_idr_cleanup(struct tc_action_net *tn, u32 index);
159153 int tcf_idr_check_alloc(struct tc_action_net *tn, u32 *index,
160154 struct tc_action **a, int bind);
161−int tcf_idr_delete_index(struct tc_action_net *tn, u32 index);
162155 int __tcf_idr_release(struct tc_action *a, bool bind, bool strict);
163156
164157 static inline int tcf_idr_release(struct tc_action *a, bool bind)
include/net/pkt_cls.h+14−11
@@ -298,19 +298,13 @@ static inline void tcf_exts_put_net(struct tcf_exts *exts) · 297 unmodified lines
298298 #endif
299299 }
300300
301−static inline void tcf_exts_to_list(const struct tcf_exts *exts,
302− struct list_head *actions)
303−{
304301 #ifdef CONFIG_NET_CLS_ACT
305− int i;
306−
307− for (i = 0; i < exts->nr_actions; i++) {
308− struct tc_action *a = exts->actions[i];
309−
310− list_add_tail(&a->list, actions);
311− }
302+#define tcf_exts_for_each_action(i, a, exts) \
303+ for (i = 0; i < TCA_ACT_MAX_PRIO && ((a) = (exts)->actions[i]); i++)
304+#else
305+#define tcf_exts_for_each_action(i, a, exts) \
306+ for (; 0; (void)(i), (void)(a), (void)(exts))
312307 #endif
313−}
314308
315309 static inline void
316310 tcf_exts_stats_update(const struct tcf_exts *exts,
@@ -361,6 +355,15 @@ static inline bool tcf_exts_has_one_action(struct tcf_exts *exts) · 44 unmodified lines
361355 #endif
362356 }
363357
358+static inline struct tc_action *tcf_exts_first_action(struct tcf_exts *exts)
359+{
360+#ifdef CONFIG_NET_CLS_ACT
361+ return exts->actions[0];
362+#else
363+ return NULL;
364+#endif
365+}
366+
364367 /**
365368 * tcf_exts_exec - execute tc filter extensions
366369 * @skb: socket buffer
kernel/bpf/hashtab.c+13−10
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <linux/jhash.h>
1616 #include <linux/filter.h>
1717 #include <linux/rculist_nulls.h>
18+#include <linux/random.h>
1819 #include <uapi/linux/btf.h>
1920 #include "percpu_freelist.h"
2021 #include "bpf_lru_list.h"
@@ -41,6 +42,7 @@ struct bpf_htab { · 20 unmodified lines
4142 atomic_t count; /* number of elements in this hashtable */
4243 u32 n_buckets; /* number of hash buckets */
4344 u32 elem_size; /* size of each element in bytes */
45+ u32 hashrnd;
4446 };
4547
4648 /* each htab element is struct htab_elem + key + value */
@@ -371,6 +373,7 @@ static struct bpf_map *htab_map_alloc(union bpf_attr *attr) · 324 unmodified lines
371373 if (!htab->buckets)
372374 goto free_htab;
373375
376+ htab->hashrnd = get_random_int();
374377 for (i = 0; i < htab->n_buckets; i++) {
375378 INIT_HLIST_NULLS_HEAD(&htab->buckets[i].head, i);
376379 raw_spin_lock_init(&htab->buckets[i].lock);
@@ -402,9 +405,9 @@ free_htab: · 25 unmodified lines
402405 return ERR_PTR(err);
403406 }
404407
405−static inline u32 htab_map_hash(const void *key, u32 key_len)
408+static inline u32 htab_map_hash(const void *key, u32 key_len, u32 hashrnd)
406409 {
407− return jhash(key, key_len, 0);
410+ return jhash(key, key_len, hashrnd);
408411 }
409412
410413 static inline struct bucket *__select_bucket(struct bpf_htab *htab, u32 hash)
@@ -470,7 +473,7 @@ static void *__htab_map_lookup_elem(struct bpf_map *map, void *key) · 59 unmodified lines
470473
471474 key_size = map->key_size;
472475
473− hash = htab_map_hash(key, key_size);
476+ hash = htab_map_hash(key, key_size, htab->hashrnd);
474477
475478 head = select_bucket(htab, hash);
476479
@@ -597,7 +600,7 @@ static int htab_map_get_next_key(struct bpf_map *map, void *key, void *next_key) · 120 unmodified lines
597600 if (!key)
598601 goto find_first_elem;
599602
600− hash = htab_map_hash(key, key_size);
603+ hash = htab_map_hash(key, key_size, htab->hashrnd);
601604
602605 head = select_bucket(htab, hash);
603606
@@ -824,7 +827,7 @@ static int htab_map_update_elem(struct bpf_map *map, void *key, void *value, · 220 unmodified lines
824827
825828 key_size = map->key_size;
826829
827− hash = htab_map_hash(key, key_size);
830+ hash = htab_map_hash(key, key_size, htab->hashrnd);
828831
829832 b = __select_bucket(htab, hash);
830833 head = &b->head;
@@ -880,7 +883,7 @@ static int htab_lru_map_update_elem(struct bpf_map *map, void *key, void *value, · 49 unmodified lines
880883
881884 key_size = map->key_size;
882885
883− hash = htab_map_hash(key, key_size);
886+ hash = htab_map_hash(key, key_size, htab->hashrnd);
884887
885888 b = __select_bucket(htab, hash);
886889 head = &b->head;
@@ -945,7 +948,7 @@ static int __htab_percpu_map_update_elem(struct bpf_map *map, void *key, · 58 unmodified lines
945948
946949 key_size = map->key_size;
947950
948− hash = htab_map_hash(key, key_size);
951+ hash = htab_map_hash(key, key_size, htab->hashrnd);
949952
950953 b = __select_bucket(htab, hash);
951954 head = &b->head;
@@ -998,7 +1001,7 @@ static int __htab_lru_percpu_map_update_elem(struct bpf_map *map, void *key, · 46 unmodified lines
9981001
9991002 key_size = map->key_size;
10001003
1001− hash = htab_map_hash(key, key_size);
1004+ hash = htab_map_hash(key, key_size, htab->hashrnd);
10021005
10031006 b = __select_bucket(htab, hash);
10041007 head = &b->head;
@@ -1071,7 +1074,7 @@ static int htab_map_delete_elem(struct bpf_map *map, void *key) · 66 unmodified lines
10711074
10721075 key_size = map->key_size;
10731076
1074− hash = htab_map_hash(key, key_size);
1077+ hash = htab_map_hash(key, key_size, htab->hashrnd);
10751078 b = __select_bucket(htab, hash);
10761079 head = &b->head;
10771080
@@ -1103,7 +1106,7 @@ static int htab_lru_map_delete_elem(struct bpf_map *map, void *key) · 25 unmodified lines
11031106
11041107 key_size = map->key_size;
11051108
1106− hash = htab_map_hash(key, key_size);
1109+ hash = htab_map_hash(key, key_size, htab->hashrnd);
11071110 b = __select_bucket(htab, hash);
11081111 head = &b->head;
11091112
kernel/bpf/sockmap.c+9−2
@@ -1427,12 +1427,15 @@ out: · 1426 unmodified lines
14271427 static void smap_write_space(struct sock *sk)
14281428 {
14291429 struct smap_psock *psock;
1430+ void (*write_space)(struct sock *sk);
14301431
14311432 rcu_read_lock();
14321433 psock = smap_psock_sk(sk);
14331434 if (likely(psock && test_bit(SMAP_TX_RUNNING, &psock->state)))
14341435 schedule_work(&psock->tx_work);
1436+ write_space = psock->save_write_space;
14351437 rcu_read_unlock();
1438+ write_space(sk);
14361439 }
14371440
14381441 static void smap_stop_sock(struct smap_psock *psock, struct sock *sk)
@@ -2140,7 +2143,9 @@ static struct bpf_map *sock_hash_alloc(union bpf_attr *attr) · 701 unmodified lines
21402143 return ERR_PTR(-EPERM);
21412144
21422145 /* check sanity of attributes */
2143− if (attr->max_entries == 0 || attr->value_size != 4 ||
2146+ if (attr->max_entries == 0 ||
2147+ attr->key_size == 0 ||
2148+ attr->value_size != 4 ||
21442149 attr->map_flags & ~SOCK_CREATE_FLAG_MASK)
21452150 return ERR_PTR(-EINVAL);
21462151
@@ -2267,8 +2272,10 @@ static struct htab_elem *alloc_sock_hash_elem(struct bpf_htab *htab, · 120 unmodified lines
22672272 }
22682273 l_new = kmalloc_node(htab->elem_size, GFP_ATOMIC | __GFP_NOWARN,
22692274 htab->map.numa_node);
2270− if (!l_new)
2275+ if (!l_new) {
2276+ atomic_dec(&htab->count);
22712277 return ERR_PTR(-ENOMEM);
2278+ }
22722279
22732280 memcpy(l_new->key, key, key_size);
22742281 l_new->sk = sk;
lib/rhashtable.c+0−1
@@ -28,7 +28,6 @@ · 27 unmodified lines
2828 #include <linux/rhashtable.h>
2929 #include <linux/err.h>
3030 #include <linux/export.h>
31−#include <linux/rhashtable.h>
3231
3332 #define HASH_DEFAULT_SIZE 64UL
3433 #define HASH_MIN_SIZE 4U
net/dsa/slave.c+1−3
@@ -767,7 +767,6 @@ static int dsa_slave_add_cls_matchall(struct net_device *dev, · 766 unmodified lines
767767 const struct tc_action *a;
768768 struct dsa_port *to_dp;
769769 int err = -EOPNOTSUPP;
770− LIST_HEAD(actions);
771770
772771 if (!ds->ops->port_mirror_add)
773772 return err;
@@ -775,8 +774,7 @@ static int dsa_slave_add_cls_matchall(struct net_device *dev, · 1 unmodified line
775774 if (!tcf_exts_has_one_action(cls->exts))
776775 return err;
777776
778− tcf_exts_to_list(cls->exts, &actions);
779− a = list_first_entry(&actions, struct tc_action, list);
777+ a = tcf_exts_first_action(cls->exts);
780778
781779 if (is_tcf_mirred_egress_mirror(a) && protocol == htons(ETH_P_ALL)) {
782780 struct dsa_mall_mirror_tc_entry *mirror;
net/ipv4/tcp_bbr.c+24−18
@@ -95,11 +95,10 @@ struct bbr { · 94 unmodified lines
9595 u32 mode:3, /* current bbr_mode in state machine */
9696 prev_ca_state:3, /* CA state on previous ACK */
9797 packet_conservation:1, /* use packet conservation? */
98− restore_cwnd:1, /* decided to revert cwnd to old value */
9998 round_start:1, /* start of packet-timed tx->ack round? */
10099 idle_restart:1, /* restarting after idle? */
101100 probe_rtt_round_done:1, /* a BBR_PROBE_RTT round at 4 pkts? */
102− unused:12,
101+ unused:13,
103102 lt_is_sampling:1, /* taking long-term ("LT") samples now? */
104103 lt_rtt_cnt:7, /* round trips in long-term interval */
105104 lt_use_bw:1; /* use lt_bw as our bw estimate? */
@@ -175,6 +174,8 @@ static const u32 bbr_lt_bw_diff = 4000 / 8; · 69 unmodified lines
175174 /* If we estimate we're policed, use lt_bw for this many round trips: */
176175 static const u32 bbr_lt_bw_max_rtts = 48;
177176
177+static void bbr_check_probe_rtt_done(struct sock *sk);
178+
178179 /* Do we estimate that STARTUP filled the pipe? */
179180 static bool bbr_full_bw_reached(const struct sock *sk)
180181 {
@@ -309,6 +310,8 @@ static void bbr_cwnd_event(struct sock *sk, enum tcp_ca_event event) · 128 unmodified lines
309310 */
310311 if (bbr->mode == BBR_PROBE_BW)
311312 bbr_set_pacing_rate(sk, bbr_bw(sk), BBR_UNIT);
313+ else if (bbr->mode == BBR_PROBE_RTT)
314+ bbr_check_probe_rtt_done(sk);
312315 }
313316 }
314317
@@ -396,17 +399,11 @@ static bool bbr_set_cwnd_to_recover_or_restore( · 81 unmodified lines
396399 cwnd = tcp_packets_in_flight(tp) + acked;
397400 } else if (prev_state >= TCP_CA_Recovery && state < TCP_CA_Recovery) {
398401 /* Exiting loss recovery; restore cwnd saved before recovery. */
399− bbr->restore_cwnd = 1;
402+ cwnd = max(cwnd, bbr->prior_cwnd);
400403 bbr->packet_conservation = 0;
401404 }
402405 bbr->prev_ca_state = state;
403406
404− if (bbr->restore_cwnd) {
405− /* Restore cwnd after exiting loss recovery or PROBE_RTT. */
406− cwnd = max(cwnd, bbr->prior_cwnd);
407− bbr->restore_cwnd = 0;
408− }
409−
410407 if (bbr->packet_conservation) {
411408 *new_cwnd = max(cwnd, tcp_packets_in_flight(tp) + acked);
412409 return true; /* yes, using packet conservation */
@@ -423,10 +420,10 @@ static void bbr_set_cwnd(struct sock *sk, const struct rate_sample *rs, · 10 unmodified lines
423420 {
424421 struct tcp_sock *tp = tcp_sk(sk);
425422 struct bbr *bbr = inet_csk_ca(sk);
426− u32 cwnd = 0, target_cwnd = 0;
423+ u32 cwnd = tp->snd_cwnd, target_cwnd = 0;
427424
428425 if (!acked)
429− return;
426+ goto done; /* no packet fully ACKed; just apply caps */
430427
431428 if (bbr_set_cwnd_to_recover_or_restore(sk, rs, acked, &cwnd))
432429 goto done;
@@ -748,6 +745,20 @@ static void bbr_check_drain(struct sock *sk, const struct rate_sample *rs) · 315 unmodified lines
748745 bbr_reset_probe_bw_mode(sk); /* we estimate queue is drained */
749746 }
750747
748+static void bbr_check_probe_rtt_done(struct sock *sk)
749+{
750+ struct tcp_sock *tp = tcp_sk(sk);
751+ struct bbr *bbr = inet_csk_ca(sk);
752+
753+ if (!(bbr->probe_rtt_done_stamp &&
754+ after(tcp_jiffies32, bbr->probe_rtt_done_stamp)))
755+ return;
756+
757+ bbr->min_rtt_stamp = tcp_jiffies32; /* wait a while until PROBE_RTT */
758+ tp->snd_cwnd = max(tp->snd_cwnd, bbr->prior_cwnd);
759+ bbr_reset_mode(sk);
760+}
761+
751762 /* The goal of PROBE_RTT mode is to have BBR flows cooperatively and
752763 * periodically drain the bottleneck queue, to converge to measure the true
753764 * min_rtt (unloaded propagation delay). This allows the flows to keep queues
@@ -806,12 +817,8 @@ static void bbr_update_min_rtt(struct sock *sk, const struct rate_sample *rs) · 52 unmodified lines
806817 } else if (bbr->probe_rtt_done_stamp) {
807818 if (bbr->round_start)
808819 bbr->probe_rtt_round_done = 1;
809− if (bbr->probe_rtt_round_done &&
810− after(tcp_jiffies32, bbr->probe_rtt_done_stamp)) {
811− bbr->min_rtt_stamp = tcp_jiffies32;
812− bbr->restore_cwnd = 1; /* snap to prior_cwnd */
813− bbr_reset_mode(sk);
814− }
820+ if (bbr->probe_rtt_round_done)
821+ bbr_check_probe_rtt_done(sk);
815822 }
816823 }
817824 /* Restart after idle ends only once we process a new S/ACK for data */
@@ -862,7 +869,6 @@ static void bbr_init(struct sock *sk) · 44 unmodified lines
862869 bbr->has_seen_rtt = 0;
863870 bbr_init_pacing_rate_from_rtt(sk);
864871
865− bbr->restore_cwnd = 0;
866872 bbr->round_start = 0;
867873 bbr->idle_restart = 0;
868874 bbr->full_bw_reached = 0;
net/ipv4/tcp_ipv4.c+6−0
@@ -2517,6 +2517,12 @@ static int __net_init tcp_sk_init(struct net *net) · 2516 unmodified lines
25172517 if (res)
25182518 goto fail;
25192519 sock_set_flag(sk, SOCK_USE_WRITE_QUEUE);
2520+
2521+ /* Please enforce IP_DF and IPID==0 for RST and
2522+ * ACK sent in SYN-RECV and TIME-WAIT state.
2523+ */
2524+ inet_sk(sk)->pmtudisc = IP_PMTUDISC_DO;
2525+
25202526 *per_cpu_ptr(net->ipv4.tcp_sk, cpu) = sk;
25212527 }
25222528
net/ipv6/addrconf.c+3−3
@@ -2398,7 +2398,7 @@ static void addrconf_add_mroute(struct net_device *dev) · 2397 unmodified lines
23982398
23992399 ipv6_addr_set(&cfg.fc_dst, htonl(0xFF000000), 0, 0, 0);
24002400
2401− ip6_route_add(&cfg, GFP_ATOMIC, NULL);
2401+ ip6_route_add(&cfg, GFP_KERNEL, NULL);
24022402 }
24032403
24042404 static struct inet6_dev *addrconf_add_dev(struct net_device *dev)
@@ -3062,7 +3062,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev) · 657 unmodified lines
30623062 if (addr.s6_addr32[3]) {
30633063 add_addr(idev, &addr, plen, scope);
30643064 addrconf_prefix_route(&addr, plen, 0, idev->dev, 0, pflags,
3065− GFP_ATOMIC);
3065+ GFP_KERNEL);
30663066 return;
30673067 }
30683068
@@ -3087,7 +3087,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev) · 18 unmodified lines
30873087
30883088 add_addr(idev, &addr, plen, flag);
30893089 addrconf_prefix_route(&addr, plen, 0, idev->dev,
3090− 0, pflags, GFP_ATOMIC);
3090+ 0, pflags, GFP_KERNEL);
30913091 }
30923092 }
30933093 }
net/ipv6/ip6_fib.c+2−0
@@ -198,6 +198,8 @@ void fib6_info_destroy_rcu(struct rcu_head *head) · 197 unmodified lines
198198 }
199199 }
200200
201+ lwtstate_put(f6i->fib6_nh.nh_lwtstate);
202+
201203 if (f6i->fib6_nh.nh_dev)
202204 dev_put(f6i->fib6_nh.nh_dev);
203205
net/ipv6/ip6_vti.c+2−1
@@ -1094,7 +1094,8 @@ static void __net_exit vti6_destroy_tunnels(struct vti6_net *ip6n, · 1093 unmodified lines
10941094 }
10951095
10961096 t = rtnl_dereference(ip6n->tnls_wc[0]);
1097− unregister_netdevice_queue(t->dev, list);
1097+ if (t)
1098+ unregister_netdevice_queue(t->dev, list);
10981099 }
10991100
11001101 static int __net_init vti6_init_net(struct net *net)
net/ipv6/route.c+1−1
@@ -956,7 +956,7 @@ static void ip6_rt_init_dst(struct rt6_info *rt, struct fib6_info *ort) · 955 unmodified lines
956956 rt->dst.error = 0;
957957 rt->dst.output = ip6_output;
958958
959− if (ort->fib6_type == RTN_LOCAL) {
959+ if (ort->fib6_type == RTN_LOCAL || ort->fib6_type == RTN_ANYCAST) {
960960 rt->dst.input = ip6_input;
961961 } else if (ipv6_addr_type(&ort->fib6_dst.addr) & IPV6_ADDR_MULTICAST) {
962962 rt->dst.input = ip6_mc_input;
net/ncsi/ncsi-netlink.c+2−2
@@ -100,7 +100,7 @@ static int ncsi_write_package_info(struct sk_buff *skb, · 99 unmodified lines
100100 bool found;
101101 int rc;
102102
103− if (id > ndp->package_num) {
103+ if (id > ndp->package_num - 1) {
104104 netdev_info(ndp->ndev.dev, "NCSI: No package with id %u\n", id);
105105 return -ENODEV;
106106 }
@@ -240,7 +240,7 @@ static int ncsi_pkg_info_all_nl(struct sk_buff *skb, · 133 unmodified lines
240240 return 0; /* done */
241241
242242 hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq,
243− &ncsi_genl_family, 0, NCSI_CMD_PKG_INFO);
243+ &ncsi_genl_family, NLM_F_MULTI, NCSI_CMD_PKG_INFO);
244244 if (!hdr) {
245245 rc = -EMSGSIZE;
246246 goto err;
net/rds/tcp.c+0−1
@@ -37,7 +37,6 @@ · 36 unmodified lines
3737 #include <net/tcp.h>
3838 #include <net/net_namespace.h>
3939 #include <net/netns/generic.h>
40−#include <net/tcp.h>
4140 #include <net/addrconf.h>
4241
4342 #include "rds.h"
net/sched/act_api.c+25−45
@@ -300,21 +300,17 @@ int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb, · 299 unmodified lines
300300 }
301301 EXPORT_SYMBOL(tcf_generic_walker);
302302
303−static bool __tcf_idr_check(struct tc_action_net *tn, u32 index,
304− struct tc_action **a, int bind)
303+int tcf_idr_search(struct tc_action_net *tn, struct tc_action **a, u32 index)
305304 {
306305 struct tcf_idrinfo *idrinfo = tn->idrinfo;
307306 struct tc_action *p;
308307
309308 spin_lock(&idrinfo->lock);
310309 p = idr_find(&idrinfo->action_idr, index);
311− if (IS_ERR(p)) {
310+ if (IS_ERR(p))
312311 p = NULL;
313− } else if (p) {
312+ else if (p)
314313 refcount_inc(&p->tcfa_refcnt);
315− if (bind)
316− atomic_inc(&p->tcfa_bindcnt);
317− }
318314 spin_unlock(&idrinfo->lock);
319315
320316 if (p) {
@@ -323,23 +319,10 @@ static bool __tcf_idr_check(struct tc_action_net *tn, u32 index, · 2 unmodified lines
323319 }
324320 return false;
325321 }
326−
327−int tcf_idr_search(struct tc_action_net *tn, struct tc_action **a, u32 index)
328−{
329− return __tcf_idr_check(tn, index, a, 0);
330−}
331322 EXPORT_SYMBOL(tcf_idr_search);
332323
333−bool tcf_idr_check(struct tc_action_net *tn, u32 index, struct tc_action **a,
334− int bind)
324+static int tcf_idr_delete_index(struct tcf_idrinfo *idrinfo, u32 index)
335325 {
336− return __tcf_idr_check(tn, index, a, bind);
337−}
338−EXPORT_SYMBOL(tcf_idr_check);
339−
340−int tcf_idr_delete_index(struct tc_action_net *tn, u32 index)
341−{
342− struct tcf_idrinfo *idrinfo = tn->idrinfo;
343326 struct tc_action *p;
344327 int ret = 0;
345328
@@ -370,7 +353,6 @@ int tcf_idr_delete_index(struct tc_action_net *tn, u32 index) · 24 unmodified lines
370353 spin_unlock(&idrinfo->lock);
371354 return ret;
372355 }
373−EXPORT_SYMBOL(tcf_idr_delete_index);
374356
375357 int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est,
376358 struct tc_action **a, const struct tc_action_ops *ops,
@@ -409,7 +391,6 @@ int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est, · 32 unmodified lines
409391
410392 p->idrinfo = idrinfo;
411393 p->ops = ops;
412− INIT_LIST_HEAD(&p->list);
413394 *a = p;
414395 return 0;
415396 err3:
@@ -686,14 +667,18 @@ static int tcf_action_put(struct tc_action *p) · 270 unmodified lines
686667 return __tcf_action_put(p, false);
687668 }
688669
670+/* Put all actions in this array, skip those NULL's. */
689671 static void tcf_action_put_many(struct tc_action *actions[])
690672 {
691673 int i;
692674
693− for (i = 0; i < TCA_ACT_MAX_PRIO && actions[i]; i++) {
675+ for (i = 0; i < TCA_ACT_MAX_PRIO; i++) {
694676 struct tc_action *a = actions[i];
695− const struct tc_action_ops *ops = a->ops;
677+ const struct tc_action_ops *ops;
696678
679+ if (!a)
680+ continue;
681+ ops = a->ops;
697682 if (tcf_action_put(a))
698683 module_put(ops->owner);
699684 }
@@ -1175,41 +1160,38 @@ err_out: · 475 unmodified lines
11751160 return err;
11761161 }
11771162
1178−static int tcf_action_delete(struct net *net, struct tc_action *actions[],
1179− int *acts_deleted, struct netlink_ext_ack *extack)
1163+static int tcf_action_delete(struct net *net, struct tc_action *actions[])
11801164 {
1181− u32 act_index;
1182− int ret, i;
1165+ int i;
11831166
11841167 for (i = 0; i < TCA_ACT_MAX_PRIO && actions[i]; i++) {
11851168 struct tc_action *a = actions[i];
11861169 const struct tc_action_ops *ops = a->ops;
1187−
11881170 /* Actions can be deleted concurrently so we must save their
11891171 * type and id to search again after reference is released.
11901172 */
1191− act_index = a->tcfa_index;
1173+ struct tcf_idrinfo *idrinfo = a->idrinfo;
1174+ u32 act_index = a->tcfa_index;
11921175
11931176 if (tcf_action_put(a)) {
11941177 /* last reference, action was deleted concurrently */
11951178 module_put(ops->owner);
11961179 } else {
1180+ int ret;
1181+
11971182 /* now do the delete */
1198− ret = ops->delete(net, act_index);
1199− if (ret < 0) {
1200− *acts_deleted = i + 1;
1183+ ret = tcf_idr_delete_index(idrinfo, act_index);
1184+ if (ret < 0)
12011185 return ret;
1202− }
12031186 }
1187+ actions[i] = NULL;
12041188 }
1205− *acts_deleted = i;
12061189 return 0;
12071190 }
12081191
12091192 static int
12101193 tcf_del_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[],
1211− int *acts_deleted, u32 portid, size_t attr_size,
1212− struct netlink_ext_ack *extack)
1194+ u32 portid, size_t attr_size, struct netlink_ext_ack *extack)
12131195 {
12141196 int ret;
12151197 struct sk_buff *skb;
@@ -1227,7 +1209,7 @@ tcf_del_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[], · 11 unmodified lines
12271209 }
12281210
12291211 /* now do the delete */
1230− ret = tcf_action_delete(net, actions, acts_deleted, extack);
1212+ ret = tcf_action_delete(net, actions);
12311213 if (ret < 0) {
12321214 NL_SET_ERR_MSG(extack, "Failed to delete TC action");
12331215 kfree_skb(skb);
@@ -1249,8 +1231,7 @@ tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n, · 15 unmodified lines
12491231 struct nlattr *tb[TCA_ACT_MAX_PRIO + 1];
12501232 struct tc_action *act;
12511233 size_t attr_size = 0;
1252− struct tc_action *actions[TCA_ACT_MAX_PRIO + 1] = {};
1253− int acts_deleted = 0;
1234+ struct tc_action *actions[TCA_ACT_MAX_PRIO] = {};
12541235
12551236 ret = nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL, extack);
12561237 if (ret < 0)
@@ -1280,14 +1261,13 @@ tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n, · 23 unmodified lines
12801261 if (event == RTM_GETACTION)
12811262 ret = tcf_get_notify(net, portid, n, actions, event, extack);
12821263 else { /* delete */
1283− ret = tcf_del_notify(net, n, actions, &acts_deleted, portid,
1284− attr_size, extack);
1264+ ret = tcf_del_notify(net, n, actions, portid, attr_size, extack);
12851265 if (ret)
12861266 goto err;
1287− return ret;
1267+ return 0;
12881268 }
12891269 err:
1290− tcf_action_put_many(&actions[acts_deleted]);
1270+ tcf_action_put_many(actions);
12911271 return ret;
12921272 }
12931273
net/sched/act_bpf.c+0−8
@@ -395,13 +395,6 @@ static int tcf_bpf_search(struct net *net, struct tc_action **a, u32 index, · 394 unmodified lines
395395 return tcf_idr_search(tn, a, index);
396396 }
397397
398−static int tcf_bpf_delete(struct net *net, u32 index)
399−{
400− struct tc_action_net *tn = net_generic(net, bpf_net_id);
401−
402− return tcf_idr_delete_index(tn, index);
403−}
404−
405398 static struct tc_action_ops act_bpf_ops __read_mostly = {
406399 .kind = "bpf",
407400 .type = TCA_ACT_BPF,
@@ -412,7 +405,6 @@ static struct tc_action_ops act_bpf_ops __read_mostly = { · 4 unmodified lines
412405 .init = tcf_bpf_init,
413406 .walk = tcf_bpf_walker,
414407 .lookup = tcf_bpf_search,
415− .delete = tcf_bpf_delete,
416408 .size = sizeof(struct tcf_bpf),
417409 };
418410
net/sched/act_connmark.c+0−8
@@ -198,13 +198,6 @@ static int tcf_connmark_search(struct net *net, struct tc_action **a, u32 index, · 197 unmodified lines
198198 return tcf_idr_search(tn, a, index);
199199 }
200200
201−static int tcf_connmark_delete(struct net *net, u32 index)
202−{
203− struct tc_action_net *tn = net_generic(net, connmark_net_id);
204−
205− return tcf_idr_delete_index(tn, index);
206−}
207−
208201 static struct tc_action_ops act_connmark_ops = {
209202 .kind = "connmark",
210203 .type = TCA_ACT_CONNMARK,
@@ -214,7 +207,6 @@ static struct tc_action_ops act_connmark_ops = { · 3 unmodified lines
214207 .init = tcf_connmark_init,
215208 .walk = tcf_connmark_walker,
216209 .lookup = tcf_connmark_search,
217− .delete = tcf_connmark_delete,
218210 .size = sizeof(struct tcf_connmark_info),
219211 };
220212
net/sched/act_csum.c+0−8
@@ -659,13 +659,6 @@ static size_t tcf_csum_get_fill_size(const struct tc_action *act) · 658 unmodified lines
659659 return nla_total_size(sizeof(struct tc_csum));
660660 }
661661
662−static int tcf_csum_delete(struct net *net, u32 index)
663−{
664− struct tc_action_net *tn = net_generic(net, csum_net_id);
665−
666− return tcf_idr_delete_index(tn, index);
667−}
668−
669662 static struct tc_action_ops act_csum_ops = {
670663 .kind = "csum",
671664 .type = TCA_ACT_CSUM,
@@ -677,7 +670,6 @@ static struct tc_action_ops act_csum_ops = { · 5 unmodified lines
677670 .walk = tcf_csum_walker,
678671 .lookup = tcf_csum_search,
679672 .get_fill_size = tcf_csum_get_fill_size,
680− .delete = tcf_csum_delete,
681673 .size = sizeof(struct tcf_csum),
682674 };
683675
net/sched/act_gact.c+0−8
@@ -243,13 +243,6 @@ static size_t tcf_gact_get_fill_size(const struct tc_action *act) · 242 unmodified lines
243243 return sz;
244244 }
245245
246−static int tcf_gact_delete(struct net *net, u32 index)
247−{
248− struct tc_action_net *tn = net_generic(net, gact_net_id);
249−
250− return tcf_idr_delete_index(tn, index);
251−}
252−
253246 static struct tc_action_ops act_gact_ops = {
254247 .kind = "gact",
255248 .type = TCA_ACT_GACT,
@@ -261,7 +254,6 @@ static struct tc_action_ops act_gact_ops = { · 5 unmodified lines
261254 .walk = tcf_gact_walker,
262255 .lookup = tcf_gact_search,
263256 .get_fill_size = tcf_gact_get_fill_size,
264− .delete = tcf_gact_delete,
265257 .size = sizeof(struct tcf_gact),
266258 };
267259
net/sched/act_ife.c+40−52
@@ -167,16 +167,16 @@ static struct tcf_meta_ops *find_ife_oplist(u16 metaid) · 166 unmodified lines
167167 {
168168 struct tcf_meta_ops *o;
169169
170− read_lock_bh(&ife_mod_lock);
170+ read_lock(&ife_mod_lock);
171171 list_for_each_entry(o, &ifeoplist, list) {
172172 if (o->metaid == metaid) {
173173 if (!try_module_get(o->owner))
174174 o = NULL;
175− read_unlock_bh(&ife_mod_lock);
175+ read_unlock(&ife_mod_lock);
176176 return o;
177177 }
178178 }
179− read_unlock_bh(&ife_mod_lock);
179+ read_unlock(&ife_mod_lock);
180180
181181 return NULL;
182182 }
@@ -190,12 +190,12 @@ int register_ife_op(struct tcf_meta_ops *mops) · 7 unmodified lines
190190 !mops->get || !mops->alloc)
191191 return -EINVAL;
192192
193− write_lock_bh(&ife_mod_lock);
193+ write_lock(&ife_mod_lock);
194194
195195 list_for_each_entry(m, &ifeoplist, list) {
196196 if (m->metaid == mops->metaid ||
197197 (strcmp(mops->name, m->name) == 0)) {
198− write_unlock_bh(&ife_mod_lock);
198+ write_unlock(&ife_mod_lock);
199199 return -EEXIST;
200200 }
201201 }
@@ -204,7 +204,7 @@ int register_ife_op(struct tcf_meta_ops *mops) · 2 unmodified lines
204204 mops->release = ife_release_meta_gen;
205205
206206 list_add_tail(&mops->list, &ifeoplist);
207− write_unlock_bh(&ife_mod_lock);
207+ write_unlock(&ife_mod_lock);
208208 return 0;
209209 }
210210 EXPORT_SYMBOL_GPL(unregister_ife_op);
@@ -214,7 +214,7 @@ int unregister_ife_op(struct tcf_meta_ops *mops) · 3 unmodified lines
214214 struct tcf_meta_ops *m;
215215 int err = -ENOENT;
216216
217− write_lock_bh(&ife_mod_lock);
217+ write_lock(&ife_mod_lock);
218218 list_for_each_entry(m, &ifeoplist, list) {
219219 if (m->metaid == mops->metaid) {
220220 list_del(&mops->list);
@@ -222,7 +222,7 @@ int unregister_ife_op(struct tcf_meta_ops *mops) · 1 unmodified line
222222 break;
223223 }
224224 }
225− write_unlock_bh(&ife_mod_lock);
225+ write_unlock(&ife_mod_lock);
226226
227227 return err;
228228 }
@@ -265,11 +265,8 @@ static const char *ife_meta_id2name(u32 metaid) · 36 unmodified lines
265265 #endif
266266
267267 /* called when adding new meta information
268− * under ife->tcf_lock for existing action
269268 */
270−static int load_metaops_and_vet(struct tcf_ife_info *ife, u32 metaid,
271− void *val, int len, bool exists,
272− bool rtnl_held)
269+static int load_metaops_and_vet(u32 metaid, void *val, int len, bool rtnl_held)
273270 {
274271 struct tcf_meta_ops *ops = find_ife_oplist(metaid);
275272 int ret = 0;
@@ -277,15 +274,11 @@ static int load_metaops_and_vet(struct tcf_ife_info *ife, u32 metaid, · 1 unmodified line
277274 if (!ops) {
278275 ret = -ENOENT;
279276 #ifdef CONFIG_MODULES
280− if (exists)
281− spin_unlock_bh(&ife->tcf_lock);
282277 if (rtnl_held)
283278 rtnl_unlock();
284279 request_module("ife-meta-%s", ife_meta_id2name(metaid));
285280 if (rtnl_held)
286281 rtnl_lock();
287− if (exists)
288− spin_lock_bh(&ife->tcf_lock);
289282 ops = find_ife_oplist(metaid);
290283 #endif
291284 }
@@ -302,24 +295,17 @@ static int load_metaops_and_vet(struct tcf_ife_info *ife, u32 metaid, · 10 unmodified lines
302295 }
303296
304297 /* called when adding new meta information
305− * under ife->tcf_lock for existing action
306298 */
307−static int add_metainfo(struct tcf_ife_info *ife, u32 metaid, void *metaval,
308− int len, bool atomic)
299+static int __add_metainfo(const struct tcf_meta_ops *ops,
300+ struct tcf_ife_info *ife, u32 metaid, void *metaval,
301+ int len, bool atomic, bool exists)
309302 {
310303 struct tcf_meta_info *mi = NULL;
311− struct tcf_meta_ops *ops = find_ife_oplist(metaid);
312304 int ret = 0;
313305
314− if (!ops)
315− return -ENOENT;
316−
317306 mi = kzalloc(sizeof(*mi), atomic ? GFP_ATOMIC : GFP_KERNEL);
318− if (!mi) {
319− /*put back what find_ife_oplist took */
320− module_put(ops->owner);
307+ if (!mi)
321308 return -ENOMEM;
322− }
323309
324310 mi->metaid = metaid;
325311 mi->ops = ops;
@@ -327,29 +313,47 @@ static int add_metainfo(struct tcf_ife_info *ife, u32 metaid, void *metaval, · 1 unmodified line
327313 ret = ops->alloc(mi, metaval, atomic ? GFP_ATOMIC : GFP_KERNEL);
328314 if (ret != 0) {
329315 kfree(mi);
330− module_put(ops->owner);
331316 return ret;
332317 }
333318 }
334319
320+ if (exists)
321+ spin_lock_bh(&ife->tcf_lock);
335322 list_add_tail(&mi->metalist, &ife->metalist);
323+ if (exists)
324+ spin_unlock_bh(&ife->tcf_lock);
325+
326+ return ret;
327+}
328+
329+static int add_metainfo(struct tcf_ife_info *ife, u32 metaid, void *metaval,
330+ int len, bool exists)
331+{
332+ const struct tcf_meta_ops *ops = find_ife_oplist(metaid);
333+ int ret;
336334
335+ if (!ops)
336+ return -ENOENT;
337+ ret = __add_metainfo(ops, ife, metaid, metaval, len, false, exists);
338+ if (ret)
339+ /*put back what find_ife_oplist took */
340+ module_put(ops->owner);
337341 return ret;
338342 }
339343
340−static int use_all_metadata(struct tcf_ife_info *ife)
344+static int use_all_metadata(struct tcf_ife_info *ife, bool exists)
341345 {
342346 struct tcf_meta_ops *o;
343347 int rc = 0;
344348 int installed = 0;
345349
346− read_lock_bh(&ife_mod_lock);
350+ read_lock(&ife_mod_lock);
347351 list_for_each_entry(o, &ifeoplist, list) {
348− rc = add_metainfo(ife, o->metaid, NULL, 0, true);
352+ rc = __add_metainfo(o, ife, o->metaid, NULL, 0, true, exists);
349353 if (rc == 0)
350354 installed += 1;
351355 }
352− read_unlock_bh(&ife_mod_lock);
356+ read_unlock(&ife_mod_lock);
353357
354358 if (installed)
355359 return 0;
@@ -422,7 +426,6 @@ static void tcf_ife_cleanup(struct tc_action *a) · 66 unmodified lines
422426 kfree_rcu(p, rcu);
423427 }
424428
425−/* under ife->tcf_lock for existing action */
426429 static int populate_metalist(struct tcf_ife_info *ife, struct nlattr **tb,
427430 bool exists, bool rtnl_held)
428431 {
@@ -436,8 +439,7 @@ static int populate_metalist(struct tcf_ife_info *ife, struct nlattr **tb, · 7 unmodified lines
436439 val = nla_data(tb[i]);
437440 len = nla_len(tb[i]);
438441
439− rc = load_metaops_and_vet(ife, i, val, len, exists,
440− rtnl_held);
442+ rc = load_metaops_and_vet(i, val, len, rtnl_held);
441443 if (rc != 0)
442444 return rc;
443445
@@ -540,8 +542,6 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla, · 96 unmodified lines
540542 p->eth_type = ife_type;
541543 }
542544
543− if (exists)
544− spin_lock_bh(&ife->tcf_lock);
545545
546546 if (ret == ACT_P_CREATED)
547547 INIT_LIST_HEAD(&ife->metalist);
@@ -551,10 +551,7 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla, · 3 unmodified lines
551551 NULL, NULL);
552552 if (err) {
553553 metadata_parse_err:
554− if (exists)
555− spin_unlock_bh(&ife->tcf_lock);
556554 tcf_idr_release(*a, bind);
557−
558555 kfree(p);
559556 return err;
560557 }
@@ -569,17 +566,16 @@ metadata_parse_err: · 8 unmodified lines
569566 * as we can. You better have at least one else we are
570567 * going to bail out
571568 */
572− err = use_all_metadata(ife);
569+ err = use_all_metadata(ife, exists);
573570 if (err) {
574− if (exists)
575− spin_unlock_bh(&ife->tcf_lock);
576571 tcf_idr_release(*a, bind);
577−
578572 kfree(p);
579573 return err;
580574 }
581575 }
582576
577+ if (exists)
578+ spin_lock_bh(&ife->tcf_lock);
583579 ife->tcf_action = parm->action;
584580 /* protected by tcf_lock when modifying existing action */
585581 rcu_swap_protected(ife->params, p, 1);
@@ -853,13 +849,6 @@ static int tcf_ife_search(struct net *net, struct tc_action **a, u32 index, · 267 unmodified lines
853849 return tcf_idr_search(tn, a, index);
854850 }
855851
856−static int tcf_ife_delete(struct net *net, u32 index)
857−{
858− struct tc_action_net *tn = net_generic(net, ife_net_id);
859−
860− return tcf_idr_delete_index(tn, index);
861−}
862−
863852 static struct tc_action_ops act_ife_ops = {
864853 .kind = "ife",
865854 .type = TCA_ACT_IFE,
@@ -870,7 +859,6 @@ static struct tc_action_ops act_ife_ops = { · 4 unmodified lines
870859 .init = tcf_ife_init,
871860 .walk = tcf_ife_walker,
872861 .lookup = tcf_ife_search,
873− .delete = tcf_ife_delete,
874862 .size = sizeof(struct tcf_ife_info),
875863 };
876864
net/sched/act_ipt.c+0−16
@@ -337,13 +337,6 @@ static int tcf_ipt_search(struct net *net, struct tc_action **a, u32 index, · 336 unmodified lines
337337 return tcf_idr_search(tn, a, index);
338338 }
339339
340−static int tcf_ipt_delete(struct net *net, u32 index)
341−{
342− struct tc_action_net *tn = net_generic(net, ipt_net_id);
343−
344− return tcf_idr_delete_index(tn, index);
345−}
346−
347340 static struct tc_action_ops act_ipt_ops = {
348341 .kind = "ipt",
349342 .type = TCA_ACT_IPT,
@@ -354,7 +347,6 @@ static struct tc_action_ops act_ipt_ops = { · 4 unmodified lines
354347 .init = tcf_ipt_init,
355348 .walk = tcf_ipt_walker,
356349 .lookup = tcf_ipt_search,
357− .delete = tcf_ipt_delete,
358350 .size = sizeof(struct tcf_ipt),
359351 };
360352
@@ -395,13 +387,6 @@ static int tcf_xt_search(struct net *net, struct tc_action **a, u32 index, · 34 unmodified lines
395387 return tcf_idr_search(tn, a, index);
396388 }
397389
398−static int tcf_xt_delete(struct net *net, u32 index)
399−{
400− struct tc_action_net *tn = net_generic(net, xt_net_id);
401−
402− return tcf_idr_delete_index(tn, index);
403−}
404−
405390 static struct tc_action_ops act_xt_ops = {
406391 .kind = "xt",
407392 .type = TCA_ACT_XT,
@@ -412,7 +397,6 @@ static struct tc_action_ops act_xt_ops = { · 4 unmodified lines
412397 .init = tcf_xt_init,
413398 .walk = tcf_xt_walker,
414399 .lookup = tcf_xt_search,
415− .delete = tcf_xt_delete,
416400 .size = sizeof(struct tcf_ipt),
417401 };
418402
net/sched/act_mirred.c+0−8
@@ -395,13 +395,6 @@ static void tcf_mirred_put_dev(struct net_device *dev) · 394 unmodified lines
395395 dev_put(dev);
396396 }
397397
398−static int tcf_mirred_delete(struct net *net, u32 index)
399−{
400− struct tc_action_net *tn = net_generic(net, mirred_net_id);
401−
402− return tcf_idr_delete_index(tn, index);
403−}
404−
405398 static struct tc_action_ops act_mirred_ops = {
406399 .kind = "mirred",
407400 .type = TCA_ACT_MIRRED,
@@ -416,7 +409,6 @@ static struct tc_action_ops act_mirred_ops = { · 8 unmodified lines
416409 .size = sizeof(struct tcf_mirred),
417410 .get_dev = tcf_mirred_get_dev,
418411 .put_dev = tcf_mirred_put_dev,
419− .delete = tcf_mirred_delete,
420412 };
421413
422414 static __net_init int mirred_init_net(struct net *net)
net/sched/act_nat.c+0−8
@@ -300,13 +300,6 @@ static int tcf_nat_search(struct net *net, struct tc_action **a, u32 index, · 299 unmodified lines
300300 return tcf_idr_search(tn, a, index);
301301 }
302302
303−static int tcf_nat_delete(struct net *net, u32 index)
304−{
305− struct tc_action_net *tn = net_generic(net, nat_net_id);
306−
307− return tcf_idr_delete_index(tn, index);
308−}
309−
310303 static struct tc_action_ops act_nat_ops = {
311304 .kind = "nat",
312305 .type = TCA_ACT_NAT,
@@ -316,7 +309,6 @@ static struct tc_action_ops act_nat_ops = { · 3 unmodified lines
316309 .init = tcf_nat_init,
317310 .walk = tcf_nat_walker,
318311 .lookup = tcf_nat_search,
319− .delete = tcf_nat_delete,
320312 .size = sizeof(struct tcf_nat),
321313 };
322314
net/sched/act_pedit.c+0−8
@@ -460,13 +460,6 @@ static int tcf_pedit_search(struct net *net, struct tc_action **a, u32 index, · 459 unmodified lines
460460 return tcf_idr_search(tn, a, index);
461461 }
462462
463−static int tcf_pedit_delete(struct net *net, u32 index)
464−{
465− struct tc_action_net *tn = net_generic(net, pedit_net_id);
466−
467− return tcf_idr_delete_index(tn, index);
468−}
469−
470463 static struct tc_action_ops act_pedit_ops = {
471464 .kind = "pedit",
472465 .type = TCA_ACT_PEDIT,
@@ -477,7 +470,6 @@ static struct tc_action_ops act_pedit_ops = { · 4 unmodified lines
477470 .init = tcf_pedit_init,
478471 .walk = tcf_pedit_walker,
479472 .lookup = tcf_pedit_search,
480− .delete = tcf_pedit_delete,
481473 .size = sizeof(struct tcf_pedit),
482474 };
483475
net/sched/act_police.c+0−8
@@ -320,13 +320,6 @@ static int tcf_police_search(struct net *net, struct tc_action **a, u32 index, · 319 unmodified lines
320320 return tcf_idr_search(tn, a, index);
321321 }
322322
323−static int tcf_police_delete(struct net *net, u32 index)
324−{
325− struct tc_action_net *tn = net_generic(net, police_net_id);
326−
327− return tcf_idr_delete_index(tn, index);
328−}
329−
330323 MODULE_AUTHOR("Alexey Kuznetsov");
331324 MODULE_DESCRIPTION("Policing actions");
332325 MODULE_LICENSE("GPL");
@@ -340,7 +333,6 @@ static struct tc_action_ops act_police_ops = { · 7 unmodified lines
340333 .init = tcf_police_init,
341334 .walk = tcf_police_walker,
342335 .lookup = tcf_police_search,
343− .delete = tcf_police_delete,
344336 .size = sizeof(struct tcf_police),
345337 };
346338
net/sched/act_sample.c+0−8
@@ -232,13 +232,6 @@ static int tcf_sample_search(struct net *net, struct tc_action **a, u32 index, · 231 unmodified lines
232232 return tcf_idr_search(tn, a, index);
233233 }
234234
235−static int tcf_sample_delete(struct net *net, u32 index)
236−{
237− struct tc_action_net *tn = net_generic(net, sample_net_id);
238−
239− return tcf_idr_delete_index(tn, index);
240−}
241−
242235 static struct tc_action_ops act_sample_ops = {
243236 .kind = "sample",
244237 .type = TCA_ACT_SAMPLE,
@@ -249,7 +242,6 @@ static struct tc_action_ops act_sample_ops = { · 4 unmodified lines
249242 .cleanup = tcf_sample_cleanup,
250243 .walk = tcf_sample_walker,
251244 .lookup = tcf_sample_search,
252− .delete = tcf_sample_delete,
253245 .size = sizeof(struct tcf_sample),
254246 };
255247
net/sched/act_simple.c+0−8
@@ -196,13 +196,6 @@ static int tcf_simp_search(struct net *net, struct tc_action **a, u32 index, · 195 unmodified lines
196196 return tcf_idr_search(tn, a, index);
197197 }
198198
199−static int tcf_simp_delete(struct net *net, u32 index)
200−{
201− struct tc_action_net *tn = net_generic(net, simp_net_id);
202−
203− return tcf_idr_delete_index(tn, index);
204−}
205−
206199 static struct tc_action_ops act_simp_ops = {
207200 .kind = "simple",
208201 .type = TCA_ACT_SIMP,
@@ -213,7 +206,6 @@ static struct tc_action_ops act_simp_ops = { · 4 unmodified lines
213206 .init = tcf_simp_init,
214207 .walk = tcf_simp_walker,
215208 .lookup = tcf_simp_search,
216− .delete = tcf_simp_delete,
217209 .size = sizeof(struct tcf_defact),
218210 };
219211
net/sched/act_skbedit.c+0−8
@@ -299,13 +299,6 @@ static int tcf_skbedit_search(struct net *net, struct tc_action **a, u32 index, · 298 unmodified lines
299299 return tcf_idr_search(tn, a, index);
300300 }
301301
302−static int tcf_skbedit_delete(struct net *net, u32 index)
303−{
304− struct tc_action_net *tn = net_generic(net, skbedit_net_id);
305−
306− return tcf_idr_delete_index(tn, index);
307−}
308−
309302 static struct tc_action_ops act_skbedit_ops = {
310303 .kind = "skbedit",
311304 .type = TCA_ACT_SKBEDIT,
@@ -316,7 +309,6 @@ static struct tc_action_ops act_skbedit_ops = { · 4 unmodified lines
316309 .cleanup = tcf_skbedit_cleanup,
317310 .walk = tcf_skbedit_walker,
318311 .lookup = tcf_skbedit_search,
319− .delete = tcf_skbedit_delete,
320312 .size = sizeof(struct tcf_skbedit),
321313 };
322314
net/sched/act_skbmod.c+0−8
@@ -259,13 +259,6 @@ static int tcf_skbmod_search(struct net *net, struct tc_action **a, u32 index, · 258 unmodified lines
259259 return tcf_idr_search(tn, a, index);
260260 }
261261
262−static int tcf_skbmod_delete(struct net *net, u32 index)
263−{
264− struct tc_action_net *tn = net_generic(net, skbmod_net_id);
265−
266− return tcf_idr_delete_index(tn, index);
267−}
268−
269262 static struct tc_action_ops act_skbmod_ops = {
270263 .kind = "skbmod",
271264 .type = TCA_ACT_SKBMOD,
@@ -276,7 +269,6 @@ static struct tc_action_ops act_skbmod_ops = { · 4 unmodified lines
276269 .cleanup = tcf_skbmod_cleanup,
277270 .walk = tcf_skbmod_walker,
278271 .lookup = tcf_skbmod_search,
279− .delete = tcf_skbmod_delete,
280272 .size = sizeof(struct tcf_skbmod),
281273 };
282274
net/sched/act_tunnel_key.c+0−8
@@ -548,13 +548,6 @@ static int tunnel_key_search(struct net *net, struct tc_action **a, u32 index, · 547 unmodified lines
548548 return tcf_idr_search(tn, a, index);
549549 }
550550
551−static int tunnel_key_delete(struct net *net, u32 index)
552−{
553− struct tc_action_net *tn = net_generic(net, tunnel_key_net_id);
554−
555− return tcf_idr_delete_index(tn, index);
556−}
557−
558551 static struct tc_action_ops act_tunnel_key_ops = {
559552 .kind = "tunnel_key",
560553 .type = TCA_ACT_TUNNEL_KEY,
@@ -565,7 +558,6 @@ static struct tc_action_ops act_tunnel_key_ops = { · 4 unmodified lines
565558 .cleanup = tunnel_key_release,
566559 .walk = tunnel_key_walker,
567560 .lookup = tunnel_key_search,
568− .delete = tunnel_key_delete,
569561 .size = sizeof(struct tcf_tunnel_key),
570562 };
571563
net/sched/act_vlan.c+0−8
@@ -296,13 +296,6 @@ static int tcf_vlan_search(struct net *net, struct tc_action **a, u32 index, · 295 unmodified lines
296296 return tcf_idr_search(tn, a, index);
297297 }
298298
299−static int tcf_vlan_delete(struct net *net, u32 index)
300−{
301− struct tc_action_net *tn = net_generic(net, vlan_net_id);
302−
303− return tcf_idr_delete_index(tn, index);
304−}
305−
306299 static struct tc_action_ops act_vlan_ops = {
307300 .kind = "vlan",
308301 .type = TCA_ACT_VLAN,
@@ -313,7 +306,6 @@ static struct tc_action_ops act_vlan_ops = { · 4 unmodified lines
313306 .cleanup = tcf_vlan_cleanup,
314307 .walk = tcf_vlan_walker,
315308 .lookup = tcf_vlan_search,
316− .delete = tcf_vlan_delete,
317309 .size = sizeof(struct tcf_vlan),
318310 };
319311
net/sched/cls_u32.c+8−2
@@ -914,6 +914,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, · 913 unmodified lines
914914 struct nlattr *opt = tca[TCA_OPTIONS];
915915 struct nlattr *tb[TCA_U32_MAX + 1];
916916 u32 htid, flags = 0;
917+ size_t sel_size;
917918 int err;
918919 #ifdef CONFIG_CLS_U32_PERF
919920 size_t size;
@@ -1076,8 +1077,13 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, · 156 unmodified lines
10761077 }
10771078
10781079 s = nla_data(tb[TCA_U32_SEL]);
1080+ sel_size = struct_size(s, keys, s->nkeys);
1081+ if (nla_len(tb[TCA_U32_SEL]) < sel_size) {
1082+ err = -EINVAL;
1083+ goto erridr;
1084+ }
10791085
1080− n = kzalloc(sizeof(*n) + s->nkeys*sizeof(struct tc_u32_key), GFP_KERNEL);
1086+ n = kzalloc(offsetof(typeof(*n), sel) + sel_size, GFP_KERNEL);
10811087 if (n == NULL) {
10821088 err = -ENOBUFS;
10831089 goto erridr;
@@ -1092,7 +1098,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, · 8 unmodified lines
10921098 }
10931099 #endif
10941100
1095− memcpy(&n->sel, s, sizeof(*s) + s->nkeys*sizeof(struct tc_u32_key));
1101+ memcpy(&n->sel, s, sel_size);
10961102 RCU_INIT_POINTER(n->ht_up, ht);
10971103 n->handle = handle;
10981104 n->fshift = s->hmask ? ffs(ntohl(s->hmask)) - 1 : 0;
net/sched/sch_cake.c+19−5
@@ -64,7 +64,6 @@ · 63 unmodified lines
6464 #include <linux/vmalloc.h>
6565 #include <linux/reciprocal_div.h>
6666 #include <net/netlink.h>
67−#include <linux/version.h>
6867 #include <linux/if_vlan.h>
6968 #include <net/pkt_sched.h>
7069 #include <net/pkt_cls.h>
@@ -621,15 +620,20 @@ static bool cake_ddst(int flow_mode) · 550 unmodified lines
621620 }
622621
623622 static u32 cake_hash(struct cake_tin_data *q, const struct sk_buff *skb,
624− int flow_mode)
623+ int flow_mode, u16 flow_override, u16 host_override)
625624 {
626− u32 flow_hash = 0, srchost_hash, dsthost_hash;
625+ u32 flow_hash = 0, srchost_hash = 0, dsthost_hash = 0;
627626 u16 reduced_hash, srchost_idx, dsthost_idx;
628627 struct flow_keys keys, host_keys;
629628
630629 if (unlikely(flow_mode == CAKE_FLOW_NONE))
631630 return 0;
632631
632+ /* If both overrides are set we can skip packet dissection entirely */
633+ if ((flow_override || !(flow_mode & CAKE_FLOW_FLOWS)) &&
634+ (host_override || !(flow_mode & CAKE_FLOW_HOSTS)))
635+ goto skip_hash;
636+
633637 skb_flow_dissect_flow_keys(skb, &keys,
634638 FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL);
635639
@@ -676,6 +680,14 @@ static u32 cake_hash(struct cake_tin_data *q, const struct sk_buff *skb, · 40 unmodified lines
676680 if (flow_mode & CAKE_FLOW_FLOWS)
677681 flow_hash = flow_hash_from_keys(&keys);
678682
683+skip_hash:
684+ if (flow_override)
685+ flow_hash = flow_override - 1;
686+ if (host_override) {
687+ dsthost_hash = host_override - 1;
688+ srchost_hash = host_override - 1;
689+ }
690+
679691 if (!(flow_mode & CAKE_FLOW_FLOWS)) {
680692 if (flow_mode & CAKE_FLOW_SRC_IP)
681693 flow_hash ^= srchost_hash;
@@ -1571,7 +1583,7 @@ static u32 cake_classify(struct Qdisc *sch, struct cake_tin_data **t, · 889 unmodified lines
15711583 struct cake_sched_data *q = qdisc_priv(sch);
15721584 struct tcf_proto *filter;
15731585 struct tcf_result res;
1574− u32 flow = 0;
1586+ u16 flow = 0, host = 0;
15751587 int result;
15761588
15771589 filter = rcu_dereference_bh(q->filter_list);
@@ -1595,10 +1607,12 @@ static u32 cake_classify(struct Qdisc *sch, struct cake_tin_data **t, · 17 unmodified lines
15951607 #endif
15961608 if (TC_H_MIN(res.classid) <= CAKE_QUEUES)
15971609 flow = TC_H_MIN(res.classid);
1610+ if (TC_H_MAJ(res.classid) <= (CAKE_QUEUES << 16))
1611+ host = TC_H_MAJ(res.classid) >> 16;
15981612 }
15991613 hash:
16001614 *t = cake_select_tin(sch, skb);
1601− return flow ?: cake_hash(*t, skb, flow_mode) + 1;
1615+ return cake_hash(*t, skb, flow_mode, flow, host) + 1;
16021616 }
16031617
16041618 static void cake_reconfigure(struct Qdisc *sch);
net/tls/tls_main.c+7−2
@@ -213,9 +213,14 @@ static void tls_write_space(struct sock *sk) · 212 unmodified lines
213213 {
214214 struct tls_context *ctx = tls_get_ctx(sk);
215215
216− /* We are already sending pages, ignore notification */
217− if (ctx->in_tcp_sendpages)
216+ /* If in_tcp_sendpages call lower protocol write space handler
217+ * to ensure we wake up any waiting operations there. For example
218+ * if do_tcp_sendpages where to call sk_wait_event.
219+ */
220+ if (ctx->in_tcp_sendpages) {
221+ ctx->sk_write_space(sk);
218222 return;
223+ }
219224
220225 if (!sk->sk_write_pending && tls_is_pending_closed_record(ctx)) {
221226 gfp_t sk_allocation = sk->sk_allocation;
net/xdp/xdp_umem.c+2−2
@@ -74,14 +74,14 @@ int xdp_umem_assign_dev(struct xdp_umem *umem, struct net_device *dev, · 73 unmodified lines
7474 return 0;
7575
7676 if (!dev->netdev_ops->ndo_bpf || !dev->netdev_ops->ndo_xsk_async_xmit)
77− return force_zc ? -ENOTSUPP : 0; /* fail or fallback */
77+ return force_zc ? -EOPNOTSUPP : 0; /* fail or fallback */
7878
7979 bpf.command = XDP_QUERY_XSK_UMEM;
8080
8181 rtnl_lock();
8282 err = xdp_umem_query(dev, queue_id);
8383 if (err) {
84− err = err < 0 ? -ENOTSUPP : -EBUSY;
84+ err = err < 0 ? -EOPNOTSUPP : -EBUSY;
8585 goto err_rtnl_unlock;
8686 }
8787
tools/bpf/bpftool/map_perf_ring.c+4−1
@@ -194,8 +194,10 @@ int do_event_pipe(int argc, char **argv) · 193 unmodified lines
194194 }
195195
196196 while (argc) {
197− if (argc < 2)
197+ if (argc < 2) {
198198 BAD_ARG();
199+ goto err_close_map;
200+ }
199201
200202 if (is_prefix(*argv, "cpu")) {
201203 char *endptr;
@@ -221,6 +223,7 @@ int do_event_pipe(int argc, char **argv) · 19 unmodified lines
221223 NEXT_ARG();
222224 } else {
223225 BAD_ARG();
226+ goto err_close_map;
224227 }
225228
226229 do_all = false;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t