Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 007676b4 authored by Anirudh Venkataramanan's avatar Anirudh Venkataramanan Committed by Jeff Kirsher
Browse files

ice: Add support for VF reset events



Post VF initialization, there are a couple of different ways in which a
VF reset can be triggered. One is when the underlying PF itself goes
through a reset and other is via a VFLR interrupt. ice_reset_vf introduced
in this patch handles both these cases.

Also introduced in this patch is a helper function ice_aq_send_msg_to_vf
to send messages to VF over the mailbox queue. The PF uses this to send
reset notifications to VFs.

Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 8ede0178
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -16,4 +16,4 @@ ice-y := ice_main.o \
	 ice_lib.o	\
	 ice_txrx.o	\
	 ice_ethtool.o
ice-$(CONFIG_PCI_IOV) += ice_virtchnl_pf.o
ice-$(CONFIG_PCI_IOV) += ice_virtchnl_pf.o ice_sriov.o
+2 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include "ice_common.h"
#include "ice_sched.h"
#include "ice_virtchnl_pf.h"
#include "ice_sriov.h"

extern const char ice_drv_ver[];
#define ICE_BAR0		0
@@ -155,6 +156,7 @@ enum ice_state {
	__ICE_ADMINQ_EVENT_PENDING,
	__ICE_MAILBOXQ_EVENT_PENDING,
	__ICE_MDD_EVENT_PENDING,
	__ICE_VFLR_EVENT_PENDING,
	__ICE_FLTR_OVERFLOW_PROMISC,
	__ICE_VF_DIS,
	__ICE_CFG_BUSY,
+17 −0
Original line number Diff line number Diff line
@@ -1077,6 +1077,19 @@ struct ice_aqc_nvm {
	__le32 addr_low;
};

/**
 * Send to PF command (indirect 0x0801) id is only used by PF
 *
 * Send to VF command (indirect 0x0802) id is only used by PF
 *
 */
struct ice_aqc_pf_vf_msg {
	__le32 id;
	u32 reserved;
	__le32 addr_high;
	__le32 addr_low;
};

/* Get/Set RSS key (indirect 0x0B04/0x0B02) */
struct ice_aqc_get_set_rss_key {
#define ICE_AQC_GSET_RSS_KEY_VSI_VALID	BIT(15)
@@ -1334,6 +1347,7 @@ struct ice_aq_desc {
		struct ice_aqc_query_txsched_res query_sched_res;
		struct ice_aqc_add_move_delete_elem add_move_delete_elem;
		struct ice_aqc_nvm nvm;
		struct ice_aqc_pf_vf_msg virt;
		struct ice_aqc_get_set_rss_lut get_set_rss_lut;
		struct ice_aqc_get_set_rss_key get_set_rss_key;
		struct ice_aqc_add_txqs add_txqs;
@@ -1431,6 +1445,9 @@ enum ice_adminq_opc {
	/* NVM commands */
	ice_aqc_opc_nvm_read				= 0x0701,

	/* PF/VF mailbox commands */
	ice_mbx_opc_send_msg_to_vf			= 0x0802,

	/* RSS commands */
	ice_aqc_opc_set_rss_key				= 0x0B02,
	ice_aqc_opc_set_rss_lut				= 0x0B03,
+1 −0
Original line number Diff line number Diff line
@@ -136,6 +136,7 @@
#define PFINT_OICR_PCI_EXCEPTION_M		BIT(21)
#define PFINT_OICR_HMC_ERR_M			BIT(26)
#define PFINT_OICR_PE_CRITERR_M			BIT(28)
#define PFINT_OICR_VFLR_M			BIT(29)
#define PFINT_OICR_CTL				0x0016CA80
#define PFINT_OICR_CTL_MSIX_INDX_M		ICE_M(0x7FF, 0)
#define PFINT_OICR_CTL_ITR_INDX_S		11
+15 −0
Original line number Diff line number Diff line
@@ -342,6 +342,10 @@ ice_prepare_for_reset(struct ice_pf *pf)
{
	struct ice_hw *hw = &pf->hw;

	/* Notify VFs of impending reset */
	if (ice_check_sq_alive(hw, &hw->mailboxq))
		ice_vc_notify_reset(pf);

	/* disable the VSIs and their queues that are not already DOWN */
	ice_pf_dis_all_vsi(pf);

@@ -1064,6 +1068,7 @@ static void ice_service_task(struct work_struct *work)
	ice_check_for_hang_subtask(pf);
	ice_sync_fltr_subtask(pf);
	ice_handle_mdd_event(pf);
	ice_process_vflr_event(pf);
	ice_watchdog_subtask(pf);
	ice_clean_adminq_subtask(pf);
	ice_clean_mailboxq_subtask(pf);
@@ -1077,6 +1082,7 @@ static void ice_service_task(struct work_struct *work)
	 */
	if (time_after(jiffies, (start_time + pf->serv_tmr_period)) ||
	    test_bit(__ICE_MDD_EVENT_PENDING, pf->state) ||
	    test_bit(__ICE_VFLR_EVENT_PENDING, pf->state) ||
	    test_bit(__ICE_MAILBOXQ_EVENT_PENDING, pf->state) ||
	    test_bit(__ICE_ADMINQ_EVENT_PENDING, pf->state))
		mod_timer(&pf->serv_tmr, jiffies);
@@ -1229,6 +1235,7 @@ static void ice_ena_misc_vector(struct ice_pf *pf)
	       PFINT_OICR_MAL_DETECT_M |
	       PFINT_OICR_GRST_M |
	       PFINT_OICR_PCI_EXCEPTION_M |
	       PFINT_OICR_VFLR_M |
	       PFINT_OICR_HMC_ERR_M |
	       PFINT_OICR_PE_CRITERR_M);

@@ -1261,6 +1268,10 @@ static irqreturn_t ice_misc_intr(int __always_unused irq, void *data)
		ena_mask &= ~PFINT_OICR_MAL_DETECT_M;
		set_bit(__ICE_MDD_EVENT_PENDING, pf->state);
	}
	if (oicr & PFINT_OICR_VFLR_M) {
		ena_mask &= ~PFINT_OICR_VFLR_M;
		set_bit(__ICE_VFLR_EVENT_PENDING, pf->state);
	}

	if (oicr & PFINT_OICR_GRST_M) {
		u32 reset;
@@ -3224,6 +3235,10 @@ static int ice_vsi_rebuild_all(struct ice_pf *pf)
		if (!pf->vsi[i])
			continue;

		/* VF VSI rebuild isn't supported yet */
		if (pf->vsi[i]->type == ICE_VSI_VF)
			continue;

		err = ice_vsi_rebuild(pf->vsi[i]);
		if (err) {
			dev_err(&pf->pdev->dev,
Loading