--- /dev/null
+From 0f344c8129a5337dae50e31b817dd50a60ff238c Mon Sep 17 00:00:00 2001
+From: Karen Sornek <karen.sornek@intel.com>
+Date: Thu, 2 Dec 2021 12:52:01 +0100
+Subject: i40e: Fix for failed to init adminq while VF reset
+
+From: Karen Sornek <karen.sornek@intel.com>
+
+commit 0f344c8129a5337dae50e31b817dd50a60ff238c upstream.
+
+Fix for failed to init adminq: -53 while VF is resetting via MAC
+address changing procedure.
+Added sync module to avoid reading deadbeef value in reinit adminq
+during software reset.
+Without this patch it is possible to trigger VF reset procedure
+during reinit adminq. This resulted in an incorrect reading of
+value from the AQP registers and generated the -53 error.
+
+Fixes: 5c3c48ac6bf5 ("i40e: implement virtual device interface")
+Signed-off-by: Grzegorz Szczurek <grzegorzx.szczurek@intel.com>
+Signed-off-by: Karen Sornek <karen.sornek@intel.com>
+Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
+Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/intel/i40e/i40e_register.h | 3 +
+ drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 44 ++++++++++++++++++++-
+ drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 1
+ 3 files changed, 46 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/ethernet/intel/i40e/i40e_register.h
++++ b/drivers/net/ethernet/intel/i40e/i40e_register.h
+@@ -413,6 +413,9 @@
+ #define I40E_VFINT_DYN_CTLN(_INTVF) (0x00024800 + ((_INTVF) * 4)) /* _i=0...511 */ /* Reset: VFR */
+ #define I40E_VFINT_DYN_CTLN_CLEARPBA_SHIFT 1
+ #define I40E_VFINT_DYN_CTLN_CLEARPBA_MASK I40E_MASK(0x1, I40E_VFINT_DYN_CTLN_CLEARPBA_SHIFT)
++#define I40E_VFINT_ICR0_ADMINQ_SHIFT 30
++#define I40E_VFINT_ICR0_ADMINQ_MASK I40E_MASK(0x1, I40E_VFINT_ICR0_ADMINQ_SHIFT)
++#define I40E_VFINT_ICR0_ENA(_VF) (0x0002C000 + ((_VF) * 4)) /* _i=0...127 */ /* Reset: CORER */
+ #define I40E_VPINT_AEQCTL(_VF) (0x0002B800 + ((_VF) * 4)) /* _i=0...127 */ /* Reset: CORER */
+ #define I40E_VPINT_AEQCTL_MSIX_INDX_SHIFT 0
+ #define I40E_VPINT_AEQCTL_ITR_INDX_SHIFT 11
+--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+@@ -1377,6 +1377,32 @@ static i40e_status i40e_config_vf_promis
+ }
+
+ /**
++ * i40e_sync_vfr_reset
++ * @hw: pointer to hw struct
++ * @vf_id: VF identifier
++ *
++ * Before trigger hardware reset, we need to know if no other process has
++ * reserved the hardware for any reset operations. This check is done by
++ * examining the status of the RSTAT1 register used to signal the reset.
++ **/
++static int i40e_sync_vfr_reset(struct i40e_hw *hw, int vf_id)
++{
++ u32 reg;
++ int i;
++
++ for (i = 0; i < I40E_VFR_WAIT_COUNT; i++) {
++ reg = rd32(hw, I40E_VFINT_ICR0_ENA(vf_id)) &
++ I40E_VFINT_ICR0_ADMINQ_MASK;
++ if (reg)
++ return 0;
++
++ usleep_range(100, 200);
++ }
++
++ return -EAGAIN;
++}
++
++/**
+ * i40e_trigger_vf_reset
+ * @vf: pointer to the VF structure
+ * @flr: VFLR was issued or not
+@@ -1390,9 +1416,11 @@ static void i40e_trigger_vf_reset(struct
+ struct i40e_pf *pf = vf->pf;
+ struct i40e_hw *hw = &pf->hw;
+ u32 reg, reg_idx, bit_idx;
++ bool vf_active;
++ u32 radq;
+
+ /* warn the VF */
+- clear_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states);
++ vf_active = test_and_clear_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states);
+
+ /* Disable VF's configuration API during reset. The flag is re-enabled
+ * in i40e_alloc_vf_res(), when it's safe again to access VF's VSI.
+@@ -1406,7 +1434,19 @@ static void i40e_trigger_vf_reset(struct
+ * just need to clean up, so don't hit the VFRTRIG register.
+ */
+ if (!flr) {
+- /* reset VF using VPGEN_VFRTRIG reg */
++ /* Sync VFR reset before trigger next one */
++ radq = rd32(hw, I40E_VFINT_ICR0_ENA(vf->vf_id)) &
++ I40E_VFINT_ICR0_ADMINQ_MASK;
++ if (vf_active && !radq)
++ /* waiting for finish reset by virtual driver */
++ if (i40e_sync_vfr_reset(hw, vf->vf_id))
++ dev_info(&pf->pdev->dev,
++ "Reset VF %d never finished\n",
++ vf->vf_id);
++
++ /* Reset VF using VPGEN_VFRTRIG reg. It is also setting
++ * in progress state in rstat1 register.
++ */
+ reg = rd32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id));
+ reg |= I40E_VPGEN_VFRTRIG_VFSWR_MASK;
+ wr32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id), reg);
+--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
+@@ -19,6 +19,7 @@
+ #define I40E_MAX_VF_PROMISC_FLAGS 3
+
+ #define I40E_VF_STATE_WAIT_COUNT 20
++#define I40E_VFR_WAIT_COUNT 100
+
+ /* Various queue ctrls */
+ enum i40e_queue_ctrl {
--- /dev/null
+From d701658a50a471591094b3eb3961b4926cc8f104 Mon Sep 17 00:00:00 2001
+From: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
+Date: Fri, 5 Nov 2021 11:17:00 +0000
+Subject: i40e: Fix issue when maximum queues is exceeded
+
+From: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
+
+commit d701658a50a471591094b3eb3961b4926cc8f104 upstream.
+
+Before this patch VF interface vanished when
+maximum queue number was exceeded. Driver tried
+to add next queues even if there was not enough
+space. PF sent incorrect number of queues to
+the VF when there were not enough of them.
+
+Add an additional condition introduced to check
+available space in 'qp_pile' before proceeding.
+This condition makes it impossible to add queues
+if they number is greater than the number resulting
+from available space.
+Also add the search for free space in PF queue
+pair piles.
+
+Without this patch VF interfaces are not seen
+when available space for queues has been
+exceeded and following logs appears permanently
+in dmesg:
+"Unable to get VF config (-32)".
+"VF 62 failed opcode 3, retval: -5"
+"Unable to get VF config due to PF error condition, not retrying"
+
+Fixes: 7daa6bf3294e ("i40e: driver core headers")
+Fixes: 41c445ff0f48 ("i40e: main driver core")
+Signed-off-by: Jaroslaw Gawin <jaroslawx.gawin@intel.com>
+Signed-off-by: Slawomir Laba <slawomirx.laba@intel.com>
+Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
+Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
+Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/intel/i40e/i40e.h | 1
+ drivers/net/ethernet/intel/i40e/i40e_main.c | 14 ----
+ drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 59 +++++++++++++++++++++
+ 3 files changed, 61 insertions(+), 13 deletions(-)
+
+--- a/drivers/net/ethernet/intel/i40e/i40e.h
++++ b/drivers/net/ethernet/intel/i40e/i40e.h
+@@ -174,7 +174,6 @@ enum i40e_interrupt_policy {
+
+ struct i40e_lump_tracking {
+ u16 num_entries;
+- u16 search_hint;
+ u16 list[0];
+ #define I40E_PILE_VALID_BIT 0x8000
+ #define I40E_IWARP_IRQ_PILE_ID (I40E_PILE_VALID_BIT - 2)
+--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
+@@ -196,10 +196,6 @@ int i40e_free_virt_mem_d(struct i40e_hw
+ * @id: an owner id to stick on the items assigned
+ *
+ * Returns the base item index of the lump, or negative for error
+- *
+- * The search_hint trick and lack of advanced fit-finding only work
+- * because we're highly likely to have all the same size lump requests.
+- * Linear search time and any fragmentation should be minimal.
+ **/
+ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile,
+ u16 needed, u16 id)
+@@ -214,8 +210,7 @@ static int i40e_get_lump(struct i40e_pf
+ return -EINVAL;
+ }
+
+- /* start the linear search with an imperfect hint */
+- i = pile->search_hint;
++ i = 0;
+ while (i < pile->num_entries) {
+ /* skip already allocated entries */
+ if (pile->list[i] & I40E_PILE_VALID_BIT) {
+@@ -234,7 +229,6 @@ static int i40e_get_lump(struct i40e_pf
+ for (j = 0; j < needed; j++)
+ pile->list[i+j] = id | I40E_PILE_VALID_BIT;
+ ret = i;
+- pile->search_hint = i + j;
+ break;
+ }
+
+@@ -257,7 +251,7 @@ static int i40e_put_lump(struct i40e_lum
+ {
+ int valid_id = (id | I40E_PILE_VALID_BIT);
+ int count = 0;
+- int i;
++ u16 i;
+
+ if (!pile || index >= pile->num_entries)
+ return -EINVAL;
+@@ -269,8 +263,6 @@ static int i40e_put_lump(struct i40e_lum
+ count++;
+ }
+
+- if (count && index < pile->search_hint)
+- pile->search_hint = index;
+
+ return count;
+ }
+@@ -11786,7 +11778,6 @@ static int i40e_init_interrupt_scheme(st
+ return -ENOMEM;
+
+ pf->irq_pile->num_entries = vectors;
+- pf->irq_pile->search_hint = 0;
+
+ /* track first vector for misc interrupts, ignore return */
+ (void)i40e_get_lump(pf, pf->irq_pile, 1, I40E_PILE_VALID_BIT - 1);
+@@ -12589,7 +12580,6 @@ static int i40e_sw_init(struct i40e_pf *
+ goto sw_init_done;
+ }
+ pf->qp_pile->num_entries = pf->hw.func_caps.num_tx_qp;
+- pf->qp_pile->search_hint = 0;
+
+ pf->tx_timeout_recovery_level = 1;
+
+--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+@@ -2618,6 +2618,59 @@ error_param:
+ }
+
+ /**
++ * i40e_check_enough_queue - find big enough queue number
++ * @vf: pointer to the VF info
++ * @needed: the number of items needed
++ *
++ * Returns the base item index of the queue, or negative for error
++ **/
++static int i40e_check_enough_queue(struct i40e_vf *vf, u16 needed)
++{
++ unsigned int i, cur_queues, more, pool_size;
++ struct i40e_lump_tracking *pile;
++ struct i40e_pf *pf = vf->pf;
++ struct i40e_vsi *vsi;
++
++ vsi = pf->vsi[vf->lan_vsi_idx];
++ cur_queues = vsi->alloc_queue_pairs;
++
++ /* if current allocated queues are enough for need */
++ if (cur_queues >= needed)
++ return vsi->base_queue;
++
++ pile = pf->qp_pile;
++ if (cur_queues > 0) {
++ /* if the allocated queues are not zero
++ * just check if there are enough queues for more
++ * behind the allocated queues.
++ */
++ more = needed - cur_queues;
++ for (i = vsi->base_queue + cur_queues;
++ i < pile->num_entries; i++) {
++ if (pile->list[i] & I40E_PILE_VALID_BIT)
++ break;
++
++ if (more-- == 1)
++ /* there is enough */
++ return vsi->base_queue;
++ }
++ }
++
++ pool_size = 0;
++ for (i = 0; i < pile->num_entries; i++) {
++ if (pile->list[i] & I40E_PILE_VALID_BIT) {
++ pool_size = 0;
++ continue;
++ }
++ if (needed <= ++pool_size)
++ /* there is enough */
++ return i;
++ }
++
++ return -ENOMEM;
++}
++
++/**
+ * i40e_vc_request_queues_msg
+ * @vf: pointer to the VF info
+ * @msg: pointer to the msg buffer
+@@ -2651,6 +2704,12 @@ static int i40e_vc_request_queues_msg(st
+ req_pairs - cur_pairs,
+ pf->queues_left);
+ vfres->num_queue_pairs = pf->queues_left + cur_pairs;
++ } else if (i40e_check_enough_queue(vf, req_pairs) < 0) {
++ dev_warn(&pf->pdev->dev,
++ "VF %d requested %d more queues, but there is not enough for it.\n",
++ vf->vf_id,
++ req_pairs - cur_pairs);
++ vfres->num_queue_pairs = cur_pairs;
+ } else {
+ /* successful request */
+ vf->num_req_queues = req_pairs;
--- /dev/null
+From 92947844b8beee988c0ce17082b705c2f75f0742 Mon Sep 17 00:00:00 2001
+From: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
+Date: Fri, 26 Nov 2021 11:11:22 +0100
+Subject: i40e: Fix queues reservation for XDP
+
+From: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
+
+commit 92947844b8beee988c0ce17082b705c2f75f0742 upstream.
+
+When XDP was configured on a system with large number of CPUs
+and X722 NIC there was a call trace with NULL pointer dereference.
+
+i40e 0000:87:00.0: failed to get tracking for 256 queues for VSI 0 err -12
+i40e 0000:87:00.0: setup of MAIN VSI failed
+
+BUG: kernel NULL pointer dereference, address: 0000000000000000
+RIP: 0010:i40e_xdp+0xea/0x1b0 [i40e]
+Call Trace:
+? i40e_reconfig_rss_queues+0x130/0x130 [i40e]
+dev_xdp_install+0x61/0xe0
+dev_xdp_attach+0x18a/0x4c0
+dev_change_xdp_fd+0x1e6/0x220
+do_setlink+0x616/0x1030
+? ahci_port_stop+0x80/0x80
+? ata_qc_issue+0x107/0x1e0
+? lock_timer_base+0x61/0x80
+? __mod_timer+0x202/0x380
+rtnl_setlink+0xe5/0x170
+? bpf_lsm_binder_transaction+0x10/0x10
+? security_capable+0x36/0x50
+rtnetlink_rcv_msg+0x121/0x350
+? rtnl_calcit.isra.0+0x100/0x100
+netlink_rcv_skb+0x50/0xf0
+netlink_unicast+0x1d3/0x2a0
+netlink_sendmsg+0x22a/0x440
+sock_sendmsg+0x5e/0x60
+__sys_sendto+0xf0/0x160
+? __sys_getsockname+0x7e/0xc0
+? _copy_from_user+0x3c/0x80
+? __sys_setsockopt+0xc8/0x1a0
+__x64_sys_sendto+0x20/0x30
+do_syscall_64+0x33/0x40
+entry_SYSCALL_64_after_hwframe+0x44/0xae
+RIP: 0033:0x7f83fa7a39e0
+
+This was caused by PF queue pile fragmentation due to
+flow director VSI queue being placed right after main VSI.
+Because of this main VSI was not able to resize its
+queue allocation for XDP resulting in no queues allocated
+for main VSI when XDP was turned on.
+
+Fix this by always allocating last queue in PF queue pile
+for a flow director VSI.
+
+Fixes: 41c445ff0f48 ("i40e: main driver core")
+Fixes: 74608d17fe29 ("i40e: add support for XDP_TX action")
+Signed-off-by: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
+Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
+Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
+Tested-by: Kiran Bhandare <kiranx.bhandare@intel.com>
+Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/intel/i40e/i40e_main.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
+@@ -210,6 +210,20 @@ static int i40e_get_lump(struct i40e_pf
+ return -EINVAL;
+ }
+
++ /* Allocate last queue in the pile for FDIR VSI queue
++ * so it doesn't fragment the qp_pile
++ */
++ if (pile == pf->qp_pile && pf->vsi[id]->type == I40E_VSI_FDIR) {
++ if (pile->list[pile->num_entries - 1] & I40E_PILE_VALID_BIT) {
++ dev_err(&pf->pdev->dev,
++ "Cannot allocate queue %d for I40E_VSI_FDIR\n",
++ pile->num_entries - 1);
++ return -ENOMEM;
++ }
++ pile->list[pile->num_entries - 1] = id | I40E_PILE_VALID_BIT;
++ return pile->num_entries - 1;
++ }
++
+ i = 0;
+ while (i < pile->num_entries) {
+ /* skip already allocated entries */
--- /dev/null
+From 3b8428b84539c78fdc8006c17ebd25afd4722d51 Mon Sep 17 00:00:00 2001
+From: Joe Damato <jdamato@fastly.com>
+Date: Wed, 8 Dec 2021 17:56:33 -0800
+Subject: i40e: fix unsigned stat widths
+
+From: Joe Damato <jdamato@fastly.com>
+
+commit 3b8428b84539c78fdc8006c17ebd25afd4722d51 upstream.
+
+Change i40e_update_vsi_stats and struct i40e_vsi to use u64 fields to match
+the width of the stats counters in struct i40e_rx_queue_stats.
+
+Update debugfs code to use the correct format specifier for u64.
+
+Fixes: 41c445ff0f48 ("i40e: main driver core")
+Signed-off-by: Joe Damato <jdamato@fastly.com>
+Reported-by: kernel test robot <lkp@intel.com>
+Tested-by: Gurucharan G <gurucharanx.g@intel.com>
+Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/intel/i40e/i40e.h | 8 ++++----
+ drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 2 +-
+ drivers/net/ethernet/intel/i40e/i40e_main.c | 4 ++--
+ 3 files changed, 7 insertions(+), 7 deletions(-)
+
+--- a/drivers/net/ethernet/intel/i40e/i40e.h
++++ b/drivers/net/ethernet/intel/i40e/i40e.h
+@@ -847,12 +847,12 @@ struct i40e_vsi {
+ struct rtnl_link_stats64 net_stats_offsets;
+ struct i40e_eth_stats eth_stats;
+ struct i40e_eth_stats eth_stats_offsets;
+- u32 tx_restart;
+- u32 tx_busy;
++ u64 tx_restart;
++ u64 tx_busy;
+ u64 tx_linearize;
+ u64 tx_force_wb;
+- u32 rx_buf_failed;
+- u32 rx_page_failed;
++ u64 rx_buf_failed;
++ u64 rx_page_failed;
+
+ /* These are containers of ring pointers, allocated at run-time */
+ struct i40e_ring **rx_rings;
+--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
++++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
+@@ -240,7 +240,7 @@ static void i40e_dbg_dump_vsi_seid(struc
+ (unsigned long int)vsi->net_stats_offsets.rx_compressed,
+ (unsigned long int)vsi->net_stats_offsets.tx_compressed);
+ dev_info(&pf->pdev->dev,
+- " tx_restart = %d, tx_busy = %d, rx_buf_failed = %d, rx_page_failed = %d\n",
++ " tx_restart = %llu, tx_busy = %llu, rx_buf_failed = %llu, rx_page_failed = %llu\n",
+ vsi->tx_restart, vsi->tx_busy,
+ vsi->rx_buf_failed, vsi->rx_page_failed);
+ rcu_read_lock();
+--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
+@@ -778,9 +778,9 @@ static void i40e_update_vsi_stats(struct
+ struct rtnl_link_stats64 *ns; /* netdev stats */
+ struct i40e_eth_stats *oes;
+ struct i40e_eth_stats *es; /* device's eth stats */
+- u32 tx_restart, tx_busy;
++ u64 tx_restart, tx_busy;
+ struct i40e_ring *p;
+- u32 rx_page, rx_buf;
++ u64 rx_page, rx_buf;
+ u64 bytes, packets;
+ unsigned int start;
+ u64 tx_linearize;
--- /dev/null
+From 9b13bd53134c9ddd544a790125199fdbdb505e67 Mon Sep 17 00:00:00 2001
+From: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
+Date: Thu, 28 Oct 2021 13:51:14 +0000
+Subject: i40e: Increase delay to 1 s after global EMP reset
+
+From: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
+
+commit 9b13bd53134c9ddd544a790125199fdbdb505e67 upstream.
+
+Recently simplified i40e_rebuild causes that FW sometimes
+is not ready after NVM update, the ping does not return.
+
+Increase the delay in case of EMP reset.
+Old delay of 300 ms was introduced for specific cards for 710 series.
+Now it works for all the cards and delay was increased.
+
+Fixes: 1fa51a650e1d ("i40e: Add delay after EMP reset for firmware to recover")
+Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
+Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
+Tested-by: Gurucharan G <gurucharanx.g@intel.com>
+Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/intel/i40e/i40e_main.c | 12 +++---------
+ 1 file changed, 3 insertions(+), 9 deletions(-)
+
+--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
+@@ -10574,15 +10574,9 @@ static void i40e_rebuild(struct i40e_pf
+ }
+ i40e_get_oem_version(&pf->hw);
+
+- if (test_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state) &&
+- ((hw->aq.fw_maj_ver == 4 && hw->aq.fw_min_ver <= 33) ||
+- hw->aq.fw_maj_ver < 4) && hw->mac.type == I40E_MAC_XL710) {
+- /* The following delay is necessary for 4.33 firmware and older
+- * to recover after EMP reset. 200 ms should suffice but we
+- * put here 300 ms to be sure that FW is ready to operate
+- * after reset.
+- */
+- mdelay(300);
++ if (test_and_clear_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state)) {
++ /* The following delay is necessary for firmware update. */
++ mdelay(1000);
+ }
+
+ /* re-verify the eeprom if we just had an EMP reset */
+++ /dev/null
-From 680a2ead741ad9b479a53adf154ed5eee74d2b9a Mon Sep 17 00:00:00 2001
-From: Lorenzo Bianconi <lorenzo@kernel.org>
-Date: Thu, 9 Dec 2021 14:06:27 +0100
-Subject: mt76: connac: introduce MCU_CE_CMD macro
-
-From: Lorenzo Bianconi <lorenzo@kernel.org>
-
-commit 680a2ead741ad9b479a53adf154ed5eee74d2b9a upstream.
-
-Similar to MCU_EXT_CMD, introduce MCU_CE_CMD for CE commands
-
-Stable kernel notes:
-
-Upstream commit 547224024579 (mt76: connac: introduce MCU_UNI_CMD macro,
-2021-12-09) introduced a bug by removing MCU_UNI_PREFIX, but not
-updating MCU_CMD_MASK accordingly, so when commands are compared in
-mt7921_mcu_parse_response() one has the extra bit __MCU_CMD_FIELD_UNI
-set and the comparison fails:
-
- if (mcu_cmd != event->cid)
- if (20001 != 1)
-
-The fix was sneaked by in the next commit 680a2ead741a (mt76: connac:
-introduce MCU_CE_CMD macro, 2021-12-09):
-
-- int mcu_cmd = cmd & MCU_CMD_MASK;
-+ int mcu_cmd = FIELD_GET(__MCU_CMD_FIELD_ID, cmd);
-
-But it was never merged into linux-stable.
-
-We need either both commits, or none.
-
-Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
-Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- .../net/wireless/mediatek/mt76/mt7615/mcu.c | 16 +++----
- .../wireless/mediatek/mt76/mt76_connac_mcu.c | 47 ++++++++++--------
- .../wireless/mediatek/mt76/mt76_connac_mcu.h | 48 ++++++++++---------
- .../net/wireless/mediatek/mt76/mt7921/mcu.c | 24 +++++-----
- .../wireless/mediatek/mt76/mt7921/testmode.c | 4 +-
- 5 files changed, 73 insertions(+), 66 deletions(-)
-
-diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
-index fcbcfc9f5a04..58be537adb1f 100644
---- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
-+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
-@@ -145,7 +145,7 @@ void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct sk_buff *skb,
- mcu_txd->cid = mcu_cmd;
- mcu_txd->ext_cid = FIELD_GET(__MCU_CMD_FIELD_EXT_ID, cmd);
-
-- if (mcu_txd->ext_cid || (cmd & MCU_CE_PREFIX)) {
-+ if (mcu_txd->ext_cid || (cmd & __MCU_CMD_FIELD_CE)) {
- if (cmd & __MCU_CMD_FIELD_QUERY)
- mcu_txd->set_query = MCU_Q_QUERY;
- else
-@@ -193,7 +193,7 @@ int mt7615_mcu_parse_response(struct mt76_dev *mdev, int cmd,
- skb_pull(skb, sizeof(*rxd));
- event = (struct mt7615_mcu_uni_event *)skb->data;
- ret = le32_to_cpu(event->status);
-- } else if (cmd == MCU_CMD_REG_READ) {
-+ } else if (cmd == MCU_CE_QUERY(REG_READ)) {
- struct mt7615_mcu_reg_event *event;
-
- skb_pull(skb, sizeof(*rxd));
-@@ -2737,13 +2737,13 @@ int mt7615_mcu_set_bss_pm(struct mt7615_dev *dev, struct ieee80211_vif *vif,
- if (vif->type != NL80211_IFTYPE_STATION)
- return 0;
-
-- err = mt76_mcu_send_msg(&dev->mt76, MCU_CMD_SET_BSS_ABORT, &req_hdr,
-- sizeof(req_hdr), false);
-+ err = mt76_mcu_send_msg(&dev->mt76, MCU_CE_CMD(SET_BSS_ABORT),
-+ &req_hdr, sizeof(req_hdr), false);
- if (err < 0 || !enable)
- return err;
-
-- return mt76_mcu_send_msg(&dev->mt76, MCU_CMD_SET_BSS_CONNECTED, &req,
-- sizeof(req), false);
-+ return mt76_mcu_send_msg(&dev->mt76, MCU_CE_CMD(SET_BSS_CONNECTED),
-+ &req, sizeof(req), false);
- }
-
- int mt7615_mcu_set_roc(struct mt7615_phy *phy, struct ieee80211_vif *vif,
-@@ -2762,6 +2762,6 @@ int mt7615_mcu_set_roc(struct mt7615_phy *phy, struct ieee80211_vif *vif,
-
- phy->roc_grant = false;
-
-- return mt76_mcu_send_msg(&dev->mt76, MCU_CMD_SET_ROC, &req,
-- sizeof(req), false);
-+ return mt76_mcu_send_msg(&dev->mt76, MCU_CE_CMD(SET_ROC),
-+ &req, sizeof(req), false);
- }
-diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
-index 4a693368a4bf..71896e56256e 100644
---- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
-+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
-@@ -160,7 +160,8 @@ int mt76_connac_mcu_set_channel_domain(struct mt76_phy *phy)
-
- memcpy(__skb_push(skb, sizeof(hdr)), &hdr, sizeof(hdr));
-
-- return mt76_mcu_skb_send_msg(dev, skb, MCU_CMD_SET_CHAN_DOMAIN, false);
-+ return mt76_mcu_skb_send_msg(dev, skb, MCU_CE_CMD(SET_CHAN_DOMAIN),
-+ false);
- }
- EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_channel_domain);
-
-@@ -198,8 +199,8 @@ int mt76_connac_mcu_set_vif_ps(struct mt76_dev *dev, struct ieee80211_vif *vif)
- if (vif->type != NL80211_IFTYPE_STATION)
- return -EOPNOTSUPP;
-
-- return mt76_mcu_send_msg(dev, MCU_CMD_SET_PS_PROFILE, &req,
-- sizeof(req), false);
-+ return mt76_mcu_send_msg(dev, MCU_CE_CMD(SET_PS_PROFILE),
-+ &req, sizeof(req), false);
- }
- EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_vif_ps);
-
-@@ -1519,7 +1520,8 @@ int mt76_connac_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
- req->scan_func |= SCAN_FUNC_RANDOM_MAC;
- }
-
-- err = mt76_mcu_skb_send_msg(mdev, skb, MCU_CMD_START_HW_SCAN, false);
-+ err = mt76_mcu_skb_send_msg(mdev, skb, MCU_CE_CMD(START_HW_SCAN),
-+ false);
- if (err < 0)
- clear_bit(MT76_HW_SCANNING, &phy->state);
-
-@@ -1547,8 +1549,8 @@ int mt76_connac_mcu_cancel_hw_scan(struct mt76_phy *phy,
- ieee80211_scan_completed(phy->hw, &info);
- }
-
-- return mt76_mcu_send_msg(phy->dev, MCU_CMD_CANCEL_HW_SCAN, &req,
-- sizeof(req), false);
-+ return mt76_mcu_send_msg(phy->dev, MCU_CE_CMD(CANCEL_HW_SCAN),
-+ &req, sizeof(req), false);
- }
- EXPORT_SYMBOL_GPL(mt76_connac_mcu_cancel_hw_scan);
-
-@@ -1634,7 +1636,8 @@ int mt76_connac_mcu_sched_scan_req(struct mt76_phy *phy,
- memcpy(skb_put(skb, sreq->ie_len), sreq->ie, sreq->ie_len);
- }
-
-- return mt76_mcu_skb_send_msg(mdev, skb, MCU_CMD_SCHED_SCAN_REQ, false);
-+ return mt76_mcu_skb_send_msg(mdev, skb, MCU_CE_CMD(SCHED_SCAN_REQ),
-+ false);
- }
- EXPORT_SYMBOL_GPL(mt76_connac_mcu_sched_scan_req);
-
-@@ -1654,8 +1657,8 @@ int mt76_connac_mcu_sched_scan_enable(struct mt76_phy *phy,
- else
- clear_bit(MT76_HW_SCHED_SCANNING, &phy->state);
-
-- return mt76_mcu_send_msg(phy->dev, MCU_CMD_SCHED_SCAN_ENABLE, &req,
-- sizeof(req), false);
-+ return mt76_mcu_send_msg(phy->dev, MCU_CE_CMD(SCHED_SCAN_ENABLE),
-+ &req, sizeof(req), false);
- }
- EXPORT_SYMBOL_GPL(mt76_connac_mcu_sched_scan_enable);
-
-@@ -1667,8 +1670,8 @@ int mt76_connac_mcu_chip_config(struct mt76_dev *dev)
-
- memcpy(req.data, "assert", 7);
-
-- return mt76_mcu_send_msg(dev, MCU_CMD_CHIP_CONFIG, &req, sizeof(req),
-- false);
-+ return mt76_mcu_send_msg(dev, MCU_CE_CMD(CHIP_CONFIG),
-+ &req, sizeof(req), false);
- }
- EXPORT_SYMBOL_GPL(mt76_connac_mcu_chip_config);
-
-@@ -1680,8 +1683,8 @@ int mt76_connac_mcu_set_deep_sleep(struct mt76_dev *dev, bool enable)
-
- snprintf(req.data, sizeof(req.data), "KeepFullPwr %d", !enable);
-
-- return mt76_mcu_send_msg(dev, MCU_CMD_CHIP_CONFIG, &req, sizeof(req),
-- false);
-+ return mt76_mcu_send_msg(dev, MCU_CE_CMD(CHIP_CONFIG),
-+ &req, sizeof(req), false);
- }
- EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_deep_sleep);
-
-@@ -1783,8 +1786,8 @@ int mt76_connac_mcu_get_nic_capability(struct mt76_phy *phy)
- struct sk_buff *skb;
- int ret, i;
-
-- ret = mt76_mcu_send_and_get_msg(phy->dev, MCU_CMD_GET_NIC_CAPAB, NULL,
-- 0, true, &skb);
-+ ret = mt76_mcu_send_and_get_msg(phy->dev, MCU_CE_CMD(GET_NIC_CAPAB),
-+ NULL, 0, true, &skb);
- if (ret)
- return ret;
-
-@@ -2042,7 +2045,8 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
- memcpy(skb->data, &tx_power_tlv, sizeof(tx_power_tlv));
-
- err = mt76_mcu_skb_send_msg(dev, skb,
-- MCU_CMD_SET_RATE_TX_POWER, false);
-+ MCU_CE_CMD(SET_RATE_TX_POWER),
-+ false);
- if (err < 0)
- return err;
- }
-@@ -2134,8 +2138,8 @@ int mt76_connac_mcu_set_p2p_oppps(struct ieee80211_hw *hw,
- .bss_idx = mvif->idx,
- };
-
-- return mt76_mcu_send_msg(phy->dev, MCU_CMD_SET_P2P_OPPPS, &req,
-- sizeof(req), false);
-+ return mt76_mcu_send_msg(phy->dev, MCU_CE_CMD(SET_P2P_OPPPS),
-+ &req, sizeof(req), false);
- }
- EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_p2p_oppps);
-
-@@ -2461,8 +2465,8 @@ u32 mt76_connac_mcu_reg_rr(struct mt76_dev *dev, u32 offset)
- .addr = cpu_to_le32(offset),
- };
-
-- return mt76_mcu_send_msg(dev, MCU_CMD_REG_READ, &req, sizeof(req),
-- true);
-+ return mt76_mcu_send_msg(dev, MCU_CE_QUERY(REG_READ), &req,
-+ sizeof(req), true);
- }
- EXPORT_SYMBOL_GPL(mt76_connac_mcu_reg_rr);
-
-@@ -2476,7 +2480,8 @@ void mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val)
- .val = cpu_to_le32(val),
- };
-
-- mt76_mcu_send_msg(dev, MCU_CMD_REG_WRITE, &req, sizeof(req), false);
-+ mt76_mcu_send_msg(dev, MCU_CE_CMD(REG_WRITE), &req,
-+ sizeof(req), false);
- }
- EXPORT_SYMBOL_GPL(mt76_connac_mcu_reg_wr);
-
-diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
-index 655dfd955310..039e228e0435 100644
---- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
-+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
-@@ -497,13 +497,11 @@ enum {
- #define MCU_CMD_UNI_EXT_ACK (MCU_CMD_ACK | MCU_CMD_UNI | \
- MCU_CMD_QUERY)
-
--#define MCU_CE_PREFIX BIT(29)
--#define MCU_CMD_MASK ~(MCU_CE_PREFIX)
--
- #define __MCU_CMD_FIELD_ID GENMASK(7, 0)
- #define __MCU_CMD_FIELD_EXT_ID GENMASK(15, 8)
- #define __MCU_CMD_FIELD_QUERY BIT(16)
- #define __MCU_CMD_FIELD_UNI BIT(17)
-+#define __MCU_CMD_FIELD_CE BIT(18)
-
- #define MCU_CMD(_t) FIELD_PREP(__MCU_CMD_FIELD_ID, \
- MCU_CMD_##_t)
-@@ -514,6 +512,10 @@ enum {
- #define MCU_UNI_CMD(_t) (__MCU_CMD_FIELD_UNI | \
- FIELD_PREP(__MCU_CMD_FIELD_ID, \
- MCU_UNI_CMD_##_t))
-+#define MCU_CE_CMD(_t) (__MCU_CMD_FIELD_CE | \
-+ FIELD_PREP(__MCU_CMD_FIELD_ID, \
-+ MCU_CE_CMD_##_t))
-+#define MCU_CE_QUERY(_t) (MCU_CE_CMD(_t) | __MCU_CMD_FIELD_QUERY)
-
- enum {
- MCU_EXT_CMD_EFUSE_ACCESS = 0x01,
-@@ -590,26 +592,26 @@ enum {
-
- /* offload mcu commands */
- enum {
-- MCU_CMD_TEST_CTRL = MCU_CE_PREFIX | 0x01,
-- MCU_CMD_START_HW_SCAN = MCU_CE_PREFIX | 0x03,
-- MCU_CMD_SET_PS_PROFILE = MCU_CE_PREFIX | 0x05,
-- MCU_CMD_SET_CHAN_DOMAIN = MCU_CE_PREFIX | 0x0f,
-- MCU_CMD_SET_BSS_CONNECTED = MCU_CE_PREFIX | 0x16,
-- MCU_CMD_SET_BSS_ABORT = MCU_CE_PREFIX | 0x17,
-- MCU_CMD_CANCEL_HW_SCAN = MCU_CE_PREFIX | 0x1b,
-- MCU_CMD_SET_ROC = MCU_CE_PREFIX | 0x1d,
-- MCU_CMD_SET_P2P_OPPPS = MCU_CE_PREFIX | 0x33,
-- MCU_CMD_SET_RATE_TX_POWER = MCU_CE_PREFIX | 0x5d,
-- MCU_CMD_SCHED_SCAN_ENABLE = MCU_CE_PREFIX | 0x61,
-- MCU_CMD_SCHED_SCAN_REQ = MCU_CE_PREFIX | 0x62,
-- MCU_CMD_GET_NIC_CAPAB = MCU_CE_PREFIX | 0x8a,
-- MCU_CMD_SET_MU_EDCA_PARMS = MCU_CE_PREFIX | 0xb0,
-- MCU_CMD_REG_WRITE = MCU_CE_PREFIX | 0xc0,
-- MCU_CMD_REG_READ = MCU_CE_PREFIX | __MCU_CMD_FIELD_QUERY | 0xc0,
-- MCU_CMD_CHIP_CONFIG = MCU_CE_PREFIX | 0xca,
-- MCU_CMD_FWLOG_2_HOST = MCU_CE_PREFIX | 0xc5,
-- MCU_CMD_GET_WTBL = MCU_CE_PREFIX | 0xcd,
-- MCU_CMD_GET_TXPWR = MCU_CE_PREFIX | 0xd0,
-+ MCU_CE_CMD_TEST_CTRL = 0x01,
-+ MCU_CE_CMD_START_HW_SCAN = 0x03,
-+ MCU_CE_CMD_SET_PS_PROFILE = 0x05,
-+ MCU_CE_CMD_SET_CHAN_DOMAIN = 0x0f,
-+ MCU_CE_CMD_SET_BSS_CONNECTED = 0x16,
-+ MCU_CE_CMD_SET_BSS_ABORT = 0x17,
-+ MCU_CE_CMD_CANCEL_HW_SCAN = 0x1b,
-+ MCU_CE_CMD_SET_ROC = 0x1d,
-+ MCU_CE_CMD_SET_P2P_OPPPS = 0x33,
-+ MCU_CE_CMD_SET_RATE_TX_POWER = 0x5d,
-+ MCU_CE_CMD_SCHED_SCAN_ENABLE = 0x61,
-+ MCU_CE_CMD_SCHED_SCAN_REQ = 0x62,
-+ MCU_CE_CMD_GET_NIC_CAPAB = 0x8a,
-+ MCU_CE_CMD_SET_MU_EDCA_PARMS = 0xb0,
-+ MCU_CE_CMD_REG_WRITE = 0xc0,
-+ MCU_CE_CMD_REG_READ = 0xc0,
-+ MCU_CE_CMD_CHIP_CONFIG = 0xca,
-+ MCU_CE_CMD_FWLOG_2_HOST = 0xc5,
-+ MCU_CE_CMD_GET_WTBL = 0xcd,
-+ MCU_CE_CMD_GET_TXPWR = 0xd0,
- };
-
- enum {
-diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
-index bbb53b4507e8..7f04af865046 100644
---- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
-+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
-@@ -163,8 +163,8 @@ mt7921_mcu_parse_eeprom(struct mt76_dev *dev, struct sk_buff *skb)
- int mt7921_mcu_parse_response(struct mt76_dev *mdev, int cmd,
- struct sk_buff *skb, int seq)
- {
-+ int mcu_cmd = FIELD_GET(__MCU_CMD_FIELD_ID, cmd);
- struct mt7921_mcu_rxd *rxd;
-- int mcu_cmd = cmd & MCU_CMD_MASK;
- int ret = 0;
-
- if (!skb) {
-@@ -201,7 +201,7 @@ int mt7921_mcu_parse_response(struct mt76_dev *mdev, int cmd,
- /* skip invalid event */
- if (mcu_cmd != event->cid)
- ret = -EAGAIN;
-- } else if (cmd == MCU_CMD_REG_READ) {
-+ } else if (cmd == MCU_CE_QUERY(REG_READ)) {
- struct mt7921_mcu_reg_event *event;
-
- skb_pull(skb, sizeof(*rxd));
-@@ -274,7 +274,7 @@ int mt7921_mcu_fill_message(struct mt76_dev *mdev, struct sk_buff *skb,
- mcu_txd->s2d_index = MCU_S2D_H2N;
- mcu_txd->ext_cid = FIELD_GET(__MCU_CMD_FIELD_EXT_ID, cmd);
-
-- if (mcu_txd->ext_cid || (cmd & MCU_CE_PREFIX)) {
-+ if (mcu_txd->ext_cid || (cmd & __MCU_CMD_FIELD_CE)) {
- if (cmd & __MCU_CMD_FIELD_QUERY)
- mcu_txd->set_query = MCU_Q_QUERY;
- else
-@@ -894,8 +894,8 @@ int mt7921_mcu_fw_log_2_host(struct mt7921_dev *dev, u8 ctrl)
- .ctrl_val = ctrl
- };
-
-- return mt76_mcu_send_msg(&dev->mt76, MCU_CMD_FWLOG_2_HOST, &data,
-- sizeof(data), false);
-+ return mt76_mcu_send_msg(&dev->mt76, MCU_CE_CMD(FWLOG_2_HOST),
-+ &data, sizeof(data), false);
- }
-
- int mt7921_run_firmware(struct mt7921_dev *dev)
-@@ -1020,8 +1020,8 @@ int mt7921_mcu_set_tx(struct mt7921_dev *dev, struct ieee80211_vif *vif)
- e->timer = q->mu_edca_timer;
- }
-
-- return mt76_mcu_send_msg(&dev->mt76, MCU_CMD_SET_MU_EDCA_PARMS, &req_mu,
-- sizeof(req_mu), false);
-+ return mt76_mcu_send_msg(&dev->mt76, MCU_CE_CMD(SET_MU_EDCA_PARMS),
-+ &req_mu, sizeof(req_mu), false);
- }
-
- int mt7921_mcu_set_chan_info(struct mt7921_phy *phy, int cmd)
-@@ -1225,13 +1225,13 @@ mt7921_mcu_set_bss_pm(struct mt7921_dev *dev, struct ieee80211_vif *vif,
- if (vif->type != NL80211_IFTYPE_STATION)
- return 0;
-
-- err = mt76_mcu_send_msg(&dev->mt76, MCU_CMD_SET_BSS_ABORT, &req_hdr,
-- sizeof(req_hdr), false);
-+ err = mt76_mcu_send_msg(&dev->mt76, MCU_CE_CMD(SET_BSS_ABORT),
-+ &req_hdr, sizeof(req_hdr), false);
- if (err < 0 || !enable)
- return err;
-
-- return mt76_mcu_send_msg(&dev->mt76, MCU_CMD_SET_BSS_CONNECTED, &req,
-- sizeof(req), false);
-+ return mt76_mcu_send_msg(&dev->mt76, MCU_CE_CMD(SET_BSS_CONNECTED),
-+ &req, sizeof(req), false);
- }
-
- int mt7921_mcu_sta_update(struct mt7921_dev *dev, struct ieee80211_sta *sta,
-@@ -1341,7 +1341,7 @@ int mt7921_get_txpwr_info(struct mt7921_dev *dev, struct mt7921_txpwr *txpwr)
- struct sk_buff *skb;
- int ret;
-
-- ret = mt76_mcu_send_and_get_msg(&dev->mt76, MCU_CMD_GET_TXPWR,
-+ ret = mt76_mcu_send_and_get_msg(&dev->mt76, MCU_CE_CMD(GET_TXPWR),
- &req, sizeof(req), true, &skb);
- if (ret)
- return ret;
-diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/testmode.c b/drivers/net/wireless/mediatek/mt76/mt7921/testmode.c
-index 8bd43879dd6f..bdec8684ce94 100644
---- a/drivers/net/wireless/mediatek/mt76/mt7921/testmode.c
-+++ b/drivers/net/wireless/mediatek/mt76/mt7921/testmode.c
-@@ -66,7 +66,7 @@ mt7921_tm_set(struct mt7921_dev *dev, struct mt7921_tm_cmd *req)
- if (!mt76_testmode_enabled(phy))
- goto out;
-
-- ret = mt76_mcu_send_msg(&dev->mt76, MCU_CMD_TEST_CTRL, &cmd,
-+ ret = mt76_mcu_send_msg(&dev->mt76, MCU_CE_CMD(TEST_CTRL), &cmd,
- sizeof(cmd), false);
- if (ret)
- goto out;
-@@ -95,7 +95,7 @@ mt7921_tm_query(struct mt7921_dev *dev, struct mt7921_tm_cmd *req,
- struct sk_buff *skb;
- int ret;
-
-- ret = mt76_mcu_send_and_get_msg(&dev->mt76, MCU_CMD_TEST_CTRL,
-+ ret = mt76_mcu_send_and_get_msg(&dev->mt76, MCU_CE_CMD(TEST_CTRL),
- &cmd, sizeof(cmd), true, &skb);
- if (ret)
- goto out;
---
-2.35.1
-
powerpc-32s-allocate-one-256k-ibat-instead-of-two-consecutives-128k-ibats.patch
powerpc-32s-fix-kasan_init_region-for-kasan.patch
powerpc-32-fix-boot-failure-with-gcc-latent-entropy-plugin.patch
-mt76-connac-introduce-mcu_ce_cmd-macro.patch
+i40e-increase-delay-to-1-s-after-global-emp-reset.patch
+i40e-fix-issue-when-maximum-queues-is-exceeded.patch
+i40e-fix-queues-reservation-for-xdp.patch
+i40e-fix-for-failed-to-init-adminq-while-vf-reset.patch
+i40e-fix-unsigned-stat-widths.patch
+usb-roles-fix-include-linux-usb-role.h-compile-issue.patch
--- /dev/null
+From 945c37ed564770c78dfe6b9f08bed57a1b4e60ef Mon Sep 17 00:00:00 2001
+From: Linyu Yuan <quic_linyyuan@quicinc.com>
+Date: Mon, 10 Jan 2022 20:43:28 +0800
+Subject: usb: roles: fix include/linux/usb/role.h compile issue
+
+From: Linyu Yuan <quic_linyyuan@quicinc.com>
+
+commit 945c37ed564770c78dfe6b9f08bed57a1b4e60ef upstream.
+
+when CONFIG_USB_ROLE_SWITCH is not defined,
+add usb_role_switch_find_by_fwnode() definition which return NULL.
+
+Fixes: c6919d5e0cd1 ("usb: roles: Add usb_role_switch_find_by_fwnode()")
+Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
+Link: https://lore.kernel.org/r/1641818608-25039-1-git-send-email-quic_linyyuan@quicinc.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/usb/role.h | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/include/linux/usb/role.h
++++ b/include/linux/usb/role.h
+@@ -92,6 +92,12 @@ fwnode_usb_role_switch_get(struct fwnode
+ static inline void usb_role_switch_put(struct usb_role_switch *sw) { }
+
+ static inline struct usb_role_switch *
++usb_role_switch_find_by_fwnode(const struct fwnode_handle *fwnode)
++{
++ return NULL;
++}
++
++static inline struct usb_role_switch *
+ usb_role_switch_register(struct device *parent,
+ const struct usb_role_switch_desc *desc)
+ {