Skip to contentSkip to conversation

net/qede: fix to get vendor/device id info

PATCH Superseded Rasesh Mody 2 participants 19 messages Dec 3, 2016 – Dec 23, 2016 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/8 net/qede: fix to get vendor/device id info

Fixes ec94dbc5 ("qede: add base driver")
---
 drivers/net/qede/qede_ethdev.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/qede/qede_ethdev.c +4 -0
index 9c2a5eae..b9a325df 100644
@@ -2071,6 +2071,10 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)
 
 	rte_eth_copy_pci_info(eth_dev, pci_dev);
 
+	/* @DPDK */
+	edev->vendor_id = pci_dev->id.vendor_id;
+	edev->device_id = pci_dev->id.device_id;
+
 	qed_ops = qed_get_eth_ops();
 	if (!qed_ops) {
 		DP_ERR(edev, "Failed to get qed_eth_ops_pass\n");
Signature · 1 line
2.11.0.rc1
#1 lore raw

PATCH 2/8 net/qede/base: fix sriov printouts

Remove unmeaningful value in print.

Don't print the number of Multicast filters as part of Acquire response, as this is an obsolete field which isn't enforced by PF.

Fixes 86a2265e ("qede: add SRIOV support")
---
 drivers/net/qede/base/ecore_sriov.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/qede/base/ecore_sriov.c +4 -5
index b28d7281..de54b9a0 100644
@@ -317,10 +317,9 @@ static enum _ecore_status_t ecore_iov_pci_cfg_info(struct ecore_dev *p_dev)
 
 	OSAL_PCI_READ_CONFIG_BYTE(p_dev, pos + PCI_SRIOV_FUNC_LINK, &iov->link);
 
-	DP_VERBOSE(p_dev, ECORE_MSG_IOV, "IOV info[%d]: nres %d, cap 0x%x,"
+	DP_VERBOSE(p_dev, ECORE_MSG_IOV, "IOV info: nres %d, cap 0x%x,"
 		   "ctrl 0x%x, total %d, initial %d, num vfs %d, offset %d,"
-		   " stride %d, page size 0x%x\n", 0,
-		   /* @@@TBD MichalK - function id */
+		   " stride %d, page size 0x%x\n",
 		   iov->nres, iov->cap, iov->ctrl,
 		   iov->total_vfs, iov->initial_vfs, iov->nr_virtfn,
 		   iov->offset, iov->stride, iov->pgsz);
@@ -1575,12 +1574,12 @@ static void ecore_iov_vf_mbx_acquire(struct ecore_hwfn       *p_hwfn,
 		   "VF[%d] ACQUIRE_RESPONSE: pfdev_info- chip_num=0x%x,"
 		   " db_size=%d, idx_per_sb=%d, pf_cap=0x%lx\n"
 		   "resources- n_rxq-%d, n_txq-%d, n_sbs-%d, n_macs-%d,"
-		   " n_vlans-%d, n_mcs-%d\n",
+		   " n_vlans-%d\n",
 		   vf->abs_vf_id, resp->pfdev_info.chip_num,
 		   resp->pfdev_info.db_size, resp->pfdev_info.indices_per_sb,
 		   (unsigned long)resp->pfdev_info.capabilities, resc->num_rxqs,
 		   resc->num_txqs, resc->num_sbs, resc->num_mac_filters,
-		   resc->num_vlan_filters, resc->num_mc_filters);
+		   resc->num_vlan_filters);
 
 	vf->state = VF_ACQUIRED;
 
Signature · 1 line
2.11.0.rc1
#2 lore raw

PATCH 3/8 net/qede/base: fix multiple acquisition requests by VF

In reply to Rasesh Mody

There are certain conditions under which VF would infinitely send ACQUIRE messages, as it will fail to understand that PF has rejected the ACQUIRE request. Fix to reject multiple acquisition requests by VF.

Fixes 22d07d93 ("net/qede/base: update")
---
 drivers/net/qede/base/ecore_vf.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/qede/base/ecore_vf.c +8 -0
index be8b1ec4..161b3176 100644
@@ -296,6 +296,14 @@ static enum _ecore_status_t ecore_vf_pf_acquire(struct ecore_hwfn *p_hwfn)
 						VFPF_ACQUIRE_CAP_PRE_FP_HSI;
 				}
 			}
+
+			/* If PF/VF are using same Major, PF must have had
+			 * it's reasons. Simply fail.
+			 */
+			DP_NOTICE(p_hwfn, false,
+				  "PF rejected acquisition by VF\n");
+			rc = ECORE_INVAL;
+			goto exit;
 		} else {
 			DP_ERR(p_hwfn,
 			       "PF returned err %d to VF acquisition request\n",
Signature · 1 line
2.11.0.rc1
#3 lore raw

PATCH 4/8 net/qede/base: fix error return code in resc alloc

In reply to Rasesh Mody

Fix to return error code ECORE_INVAL instead of 0 when EQ elements is too large as done elsewhere in this function.

Fixes 22d07d93 ("net/qede/base: update")
---
 drivers/net/qede/base/ecore_dev.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/qede/base/ecore_dev.c +1 -0
index 6060f9ee..58b93877 100644
@@ -667,6 +667,7 @@ enum _ecore_status_t ecore_resc_alloc(struct ecore_dev *p_dev)
 			DP_ERR(p_hwfn, "Cannot allocate 0x%x EQ elements."
 				       "The maximum of a u16 chain is 0x%x\n",
 			       n_eqes, 0xFFFF);
+			rc = ECORE_INVAL;
 			goto alloc_err;
 		}
 
Signature · 1 line
2.11.0.rc1
#4 lore raw

PATCH 5/8 net/qede/base: fix mutex in freeing context manager

In reply to Rasesh Mody

Fix OSAL_MUTEX_DEALLOC() in freeing the context manager.

Fixes 22d07d93 ("net/qede/base: update")
---
 drivers/net/qede/base/ecore_cxt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/qede/base/ecore_cxt.c +1 -1
index 3dd953d9..5ea4f5cd 100644
@@ -1155,7 +1155,7 @@ void ecore_cxt_mngr_free(struct ecore_hwfn *p_hwfn)
 	ecore_cid_map_free(p_hwfn);
 	ecore_cxt_src_t2_free(p_hwfn);
 	ecore_ilt_shadow_free(p_hwfn);
-	OSAL_MUTEX_DEALLOC(&p_mngr->mutex);
+	OSAL_MUTEX_DEALLOC(&p_hwfn->p_cxt_mngr->mutex);
 	OSAL_FREE(p_hwfn->p_dev, p_hwfn->p_cxt_mngr);
 
 	p_hwfn->p_cxt_mngr = OSAL_NULL;
Signature · 1 line
2.11.0.rc1
#5 lore raw

PATCH 6/8 net/qede/base: fix Rx queue access by malicious VFs

In reply to Rasesh Mody

8.10.x.x was supposed to prevent malicious VFs from using out-of-bound queue indices, but apparently Rx queue access is still done prior to the index being validated by PF.

Fixes 98bc693e ("net/qede/base: change queue start")
---
 drivers/net/qede/base/ecore_sriov.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/qede/base/ecore_sriov.c +5 -4
index de54b9a0..12552966 100644
@@ -1968,6 +1968,11 @@ static void ecore_iov_vf_mbx_start_rxq(struct ecore_hwfn *p_hwfn,
 	enum _ecore_status_t rc;
 
 	req = &mbx->req_virt->start_rxq;
+
+	if (!ecore_iov_validate_rxq(p_hwfn, vf, req->rx_qid) ||
+	    !ecore_iov_validate_sb(p_hwfn, vf, req->hw_sb))
+		goto out;
+
 	OSAL_MEMSET(&p_params, 0, sizeof(p_params));
 	p_params.queue_id = (u8)vf->vf_queues[req->rx_qid].fw_rx_qid;
 	p_params.vf_qid = req->rx_qid;
@@ -1976,10 +1981,6 @@ static void ecore_iov_vf_mbx_start_rxq(struct ecore_hwfn *p_hwfn,
 	p_params.sb = req->hw_sb;
 	p_params.sb_idx = req->sb_index;
 
-	if (!ecore_iov_validate_rxq(p_hwfn, vf, req->rx_qid) ||
-	    !ecore_iov_validate_sb(p_hwfn, vf, req->hw_sb))
-		goto out;
-
 	/* Legacy VFs have their Producers in a different location, which they
 	 * calculate on their own and clean the producer prior to this.
 	 */
Signature · 1 line
2.11.0.rc1
#6 lore raw

PATCH 7/8 net/qede/base: fix to handle acquire request from VF

In reply to Rasesh Mody

Add a check and fail the VF's probe request if VF is already in VF_ACQUIRED state.

Fixes 22d07d93 ("net/qede/base: update")
---
 drivers/net/qede/base/ecore_sriov.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/net/qede/base/ecore_sriov.c +12 -0
index 12552966..c2fbee87 100644
@@ -1459,6 +1459,18 @@ static void ecore_iov_vf_mbx_acquire(struct ecore_hwfn       *p_hwfn,
 	pfdev_info->major_fp_hsi = ETH_HSI_VER_MAJOR;
 	pfdev_info->minor_fp_hsi = ETH_HSI_VER_MINOR;
 
+	/* TODO - not doing anything is bad since we'll assert, but this isn't
+	 * necessarily the right behavior - perhaps we should have allowed some
+	 * versatility here.
+	 */
+	if (vf->state != VF_FREE &&
+	    vf->state != VF_STOPPED) {
+		DP_VERBOSE(p_hwfn, ECORE_MSG_IOV,
+			   "VF[%d] sent ACQUIRE but is already in state %d - fail request\n",
+			   vf->abs_vf_id, vf->state);
+		goto out;
+	}
+
 	/* Validate FW compatibility */
 	if (req->vfdev_info.eth_fp_hsi_major != ETH_HSI_VER_MAJOR) {
 		if (req->vfdev_info.capabilities &
Signature · 1 line
2.11.0.rc1
#7 lore raw

PATCH 8/8 net/qede/base: fix to check FW override after rejection

In reply to Rasesh Mody

Apparently VF over Legacy PF doesn't work, as VF would fail after getting the initial rejection message [instead of sending an additional one where it asks for a FW override and see if it works].

Fixes 22d07d93 ("net/qede/base: update")
---
 drivers/net/qede/base/ecore_vf.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/qede/base/ecore_vf.c +1 -0
index 161b3176..c26b602b 100644
@@ -294,6 +294,7 @@ static enum _ecore_status_t ecore_vf_pf_acquire(struct ecore_hwfn *p_hwfn)
 						" override\n");
 					req->vfdev_info.capabilities |=
 						VFPF_ACQUIRE_CAP_PRE_FP_HSI;
+					continue;
 				}
 			}
 
Signature · 1 line
2.11.0.rc1
#8 lore raw
In reply to Rasesh Mody

Hi Rasesh,

Quoted 3 lines · Rasesh Mody
Fixes ec94dbc5 ("qede: add base driver")

Related to the commit logs of this patchset. Many people, including me, won't know technical details of your driver as you do.

Quoted 1 line

From below patch, I also can see vendor_id and device_id get, which were

not there before. But I have no clue why? Or what happens when you don't have them, or what works fine when you have them.
Overall a little context helps a lot to understand what is really fixed, and what happens if not fixed.

For example in patch 8/8, it is a one line easy modification :), but there is no way that I can understand what really it does, but commit log comes to help there, and describes it really fixes VF over legacy PF, by VF asking a FW overwrite instead of failing on PF reject msg. So patch subject can be here: fix VF over legacy PF.

Please trying to provide more context on fixes.

Also you need to add CC:[email protected] to commit log, so that git send-email ensures this fixes also sent to stable trees.

Thanks,

Quoted 20 lines
---
 drivers/net/qede/qede_ethdev.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/qede/qede_ethdev.c +4 -0
index 9c2a5eae..b9a325df 100644
@@ -2071,6 +2071,10 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)
 
 	rte_eth_copy_pci_info(eth_dev, pci_dev);
 
+	/* @DPDK */
+	edev->vendor_id = pci_dev->id.vendor_id;
+	edev->device_id = pci_dev->id.device_id;
+
 	qed_ops = qed_get_eth_ops();
 	if (!qed_ops) {
 		DP_ERR(edev, "Failed to get qed_eth_ops_pass\n");
#9 lore raw

Hi Ferruh,

Quoted 10 lines

From: Ferruh Yigit [mailto:[email protected]]
Sent: Friday, December 09, 2016 5:36 AM

Hi Rasesh,

Quoted 3 lines · Rasesh Mody
Fixes ec94dbc5 ("qede: add base driver")
Quoted 8 lines

Related to the commit logs of this patchset. Many people, including me, won't know technical details of your driver as you do.

From below patch, I also can see vendor_id and device_id get, which were not there before. But I have no clue why? Or what happens when you don't have them, or what works fine when you have them.
Overall a little context helps a lot to understand what is really fixed, and what happens if not fixed.

The vendor_id and device_id are used to determine device type. If you don't have them, then check for determining device type fails and is always set to default device type.

Hope this helps.

Quoted 5 lines

For example in patch 8/8, it is a one line easy modification :), but there is no way that I can understand what really it does, but commit log comes to help there, and describes it really fixes VF over legacy PF, by VF asking a FW overwrite instead of failing on PF reject msg. So patch subject can be here:
fix VF over legacy PF.

Sounds good, will reword the subject.

Quoted 5 lines

Please trying to provide more context on fixes.

Also you need to add CC:[email protected] to commit log, so that git send- email ensures this fixes also sent to stable trees.

Will take care of this in v2 submission.

Thanks!
Rasesh

Quoted 25 lines

Thanks,

Quoted 21 lines
---
 drivers/net/qede/qede_ethdev.c | 4 ++++
 1 file changed, 4 insertions(+)
(quoted diff) +0 -0

b/drivers/net/qede/qede_ethdev.c index 9c2a5eae..b9a325df 100644

drivers/net/qede/qede_ethdev.c +4 -0
@@ -2071,6 +2071,10 @@ static int qede_common_dev_init(struct
 rte_eth_dev *eth_dev, bool is_vf)
 
 	rte_eth_copy_pci_info(eth_dev, pci_dev);
 
+	/* @DPDK */
+	edev->vendor_id = pci_dev->id.vendor_id;
+	edev->device_id = pci_dev->id.device_id;
+
 	qed_ops = qed_get_eth_ops();
 	if (!qed_ops) {

DP_ERR(edev, "Failed to get qed_eth_ops_pass\n");

#10 lore raw

PATCH v2 1/8 net/qede: fix to get vendor/device id info

In reply to Ferruh Yigit

The vendor_id and device_id are used to determine device type. If you don't have them, then check for determining device type fails and is always set to default device type.

Fixes ec94dbc57362 ("qede: add base driver")
---
 drivers/net/qede/qede_ethdev.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/net/qede/qede_ethdev.c +4 -0
index 2c600c1..4943358 100644
@@ -1422,6 +1422,10 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)
 
 	rte_eth_copy_pci_info(eth_dev, pci_dev);
 
+	/* @DPDK */
+	edev->vendor_id = pci_dev->id.vendor_id;
+	edev->device_id = pci_dev->id.device_id;
+
 	qed_ops = qed_get_eth_ops();
 	if (!qed_ops) {
 		DP_ERR(edev, "Failed to get qed_eth_ops_pass\n");
Signature · 1 line
1.7.10.3
#11 lore raw
Quoted 7 lines · Rasesh Mody

The vendor_id and device_id are used to determine device type. If you don't have them, then check for determining device type fails and is always set to default device type.

Fixes ec94dbc57362 ("qede: add base driver")

Series applied to dpdk-next-net/master, thanks.

#12 lore raw

PATCH v2 2/8 net/qede/base: fix sriov printouts

In reply to Ferruh Yigit

Remove unmeaningful function ID value in print.

Don't print the number of Multicast filters as part of Acquire response, as this is an obsolete field which isn't enforced by PF.

Fixes 86a2265e59d7 ("qede: add SRIOV support")
---
 drivers/net/qede/base/ecore_sriov.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/qede/base/ecore_sriov.c +4 -5
index b28d728..de54b9a 100644
@@ -317,10 +317,9 @@ static enum _ecore_status_t ecore_iov_pci_cfg_info(struct ecore_dev *p_dev)
 
 	OSAL_PCI_READ_CONFIG_BYTE(p_dev, pos + PCI_SRIOV_FUNC_LINK, &iov->link);
 
-	DP_VERBOSE(p_dev, ECORE_MSG_IOV, "IOV info[%d]: nres %d, cap 0x%x,"
+	DP_VERBOSE(p_dev, ECORE_MSG_IOV, "IOV info: nres %d, cap 0x%x,"
 		   "ctrl 0x%x, total %d, initial %d, num vfs %d, offset %d,"
-		   " stride %d, page size 0x%x\n", 0,
-		   /* @@@TBD MichalK - function id */
+		   " stride %d, page size 0x%x\n",
 		   iov->nres, iov->cap, iov->ctrl,
 		   iov->total_vfs, iov->initial_vfs, iov->nr_virtfn,
 		   iov->offset, iov->stride, iov->pgsz);
@@ -1575,12 +1574,12 @@ static void ecore_iov_vf_mbx_acquire(struct ecore_hwfn       *p_hwfn,
 		   "VF[%d] ACQUIRE_RESPONSE: pfdev_info- chip_num=0x%x,"
 		   " db_size=%d, idx_per_sb=%d, pf_cap=0x%lx\n"
 		   "resources- n_rxq-%d, n_txq-%d, n_sbs-%d, n_macs-%d,"
-		   " n_vlans-%d, n_mcs-%d\n",
+		   " n_vlans-%d\n",
 		   vf->abs_vf_id, resp->pfdev_info.chip_num,
 		   resp->pfdev_info.db_size, resp->pfdev_info.indices_per_sb,
 		   (unsigned long)resp->pfdev_info.capabilities, resc->num_rxqs,
 		   resc->num_txqs, resc->num_sbs, resc->num_mac_filters,
-		   resc->num_vlan_filters, resc->num_mc_filters);
+		   resc->num_vlan_filters);
 
 	vf->state = VF_ACQUIRED;
 
Signature · 1 line
1.7.10.3
#13 lore raw

PATCH v2 3/8 net/qede/base: fix multiple acquisition requests by VF

In reply to Ferruh Yigit

There are certain conditions under which VF would infinitely send ACQUIRE messages, as it will fail to understand that PF has rejected the ACQUIRE request. Fix to reject multiple acquisition requests by VF.

Fixes 22d07d939c3c ("net/qede/base: update")
---
 drivers/net/qede/base/ecore_vf.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/qede/base/ecore_vf.c +8 -0
index be8b1ec..161b317 100644
@@ -296,6 +296,14 @@ static enum _ecore_status_t ecore_vf_pf_acquire(struct ecore_hwfn *p_hwfn)
 						VFPF_ACQUIRE_CAP_PRE_FP_HSI;
 				}
 			}
+
+			/* If PF/VF are using same Major, PF must have had
+			 * it's reasons. Simply fail.
+			 */
+			DP_NOTICE(p_hwfn, false,
+				  "PF rejected acquisition by VF\n");
+			rc = ECORE_INVAL;
+			goto exit;
 		} else {
 			DP_ERR(p_hwfn,
 			       "PF returned err %d to VF acquisition request\n",
Signature · 1 line
1.7.10.3
#14 lore raw

PATCH v2 4/8 net/qede/base: fix error return code in resc alloc

In reply to Ferruh Yigit

Fix to return error code ECORE_INVAL instead of 0 when EQ elements is too large as done elsewhere in this function.

Fixes 22d07d939c3c ("net/qede/base: update")
---
 drivers/net/qede/base/ecore_dev.c |    1 +
 1 file changed, 1 insertion(+)
drivers/net/qede/base/ecore_dev.c +1 -0
index 6060f9e..58b9387 100644
@@ -667,6 +667,7 @@ enum _ecore_status_t ecore_resc_alloc(struct ecore_dev *p_dev)
 			DP_ERR(p_hwfn, "Cannot allocate 0x%x EQ elements."
 				       "The maximum of a u16 chain is 0x%x\n",
 			       n_eqes, 0xFFFF);
+			rc = ECORE_INVAL;
 			goto alloc_err;
 		}
 
Signature · 1 line
1.7.10.3
#15 lore raw

PATCH v2 5/8 net/qede/base: fix mutex in freeing context manager

In reply to Ferruh Yigit

Fix OSAL_MUTEX_DEALLOC() in freeing the context manager.

Fixes 22d07d939c3c ("net/qede/base: update")
---
 drivers/net/qede/base/ecore_cxt.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/qede/base/ecore_cxt.c +1 -1
index 3dd953d..5ea4f5c 100644
@@ -1155,7 +1155,7 @@ void ecore_cxt_mngr_free(struct ecore_hwfn *p_hwfn)
 	ecore_cid_map_free(p_hwfn);
 	ecore_cxt_src_t2_free(p_hwfn);
 	ecore_ilt_shadow_free(p_hwfn);
-	OSAL_MUTEX_DEALLOC(&p_mngr->mutex);
+	OSAL_MUTEX_DEALLOC(&p_hwfn->p_cxt_mngr->mutex);
 	OSAL_FREE(p_hwfn->p_dev, p_hwfn->p_cxt_mngr);
 
 	p_hwfn->p_cxt_mngr = OSAL_NULL;
Signature · 1 line
1.7.10.3
#16 lore raw

PATCH v2 6/8 net/qede/base: fix Rx queue access by malicious VFs

In reply to Ferruh Yigit

Rx queue access is still done prior to the index being validated by PF. Hence move Rx queue and status block validation check before accessing Rx queue to prevent malicious VFs from using out-of-bound queue indices.

Fixes 98bc693e1938 ("net/qede/base: change queue start")
---
 drivers/net/qede/base/ecore_sriov.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/qede/base/ecore_sriov.c +5 -4
index de54b9a..1255296 100644
@@ -1968,6 +1968,11 @@ static void ecore_iov_vf_mbx_start_rxq(struct ecore_hwfn *p_hwfn,
 	enum _ecore_status_t rc;
 
 	req = &mbx->req_virt->start_rxq;
+
+	if (!ecore_iov_validate_rxq(p_hwfn, vf, req->rx_qid) ||
+	    !ecore_iov_validate_sb(p_hwfn, vf, req->hw_sb))
+		goto out;
+
 	OSAL_MEMSET(&p_params, 0, sizeof(p_params));
 	p_params.queue_id = (u8)vf->vf_queues[req->rx_qid].fw_rx_qid;
 	p_params.vf_qid = req->rx_qid;
@@ -1976,10 +1981,6 @@ static void ecore_iov_vf_mbx_start_rxq(struct ecore_hwfn *p_hwfn,
 	p_params.sb = req->hw_sb;
 	p_params.sb_idx = req->sb_index;
 
-	if (!ecore_iov_validate_rxq(p_hwfn, vf, req->rx_qid) ||
-	    !ecore_iov_validate_sb(p_hwfn, vf, req->hw_sb))
-		goto out;
-
 	/* Legacy VFs have their Producers in a different location, which they
 	 * calculate on their own and clean the producer prior to this.
 	 */
Signature · 1 line
1.7.10.3
#17 lore raw

PATCH v2 7/8 net/qede/base: fix to handle acquire request from VF

In reply to Ferruh Yigit

Add a check and fail the VF's probe request if VF is already in VF_ACQUIRED state.

Fixes 22d07d939c3c ("net/qede/base: update")
---
 drivers/net/qede/base/ecore_sriov.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/net/qede/base/ecore_sriov.c +12 -0
index 1255296..c2fbee8 100644
@@ -1459,6 +1459,18 @@ static void ecore_iov_vf_mbx_acquire(struct ecore_hwfn       *p_hwfn,
 	pfdev_info->major_fp_hsi = ETH_HSI_VER_MAJOR;
 	pfdev_info->minor_fp_hsi = ETH_HSI_VER_MINOR;
 
+	/* TODO - not doing anything is bad since we'll assert, but this isn't
+	 * necessarily the right behavior - perhaps we should have allowed some
+	 * versatility here.
+	 */
+	if (vf->state != VF_FREE &&
+	    vf->state != VF_STOPPED) {
+		DP_VERBOSE(p_hwfn, ECORE_MSG_IOV,
+			   "VF[%d] sent ACQUIRE but is already in state %d - fail request\n",
+			   vf->abs_vf_id, vf->state);
+		goto out;
+	}
+
 	/* Validate FW compatibility */
 	if (req->vfdev_info.eth_fp_hsi_major != ETH_HSI_VER_MAJOR) {
 		if (req->vfdev_info.capabilities &
Signature · 1 line
1.7.10.3
#18 lore raw

PATCH v2 8/8 net/qede/base: fix VF over legacy PF

In reply to Ferruh Yigit

Apparently VF over Legacy PF doesn't work, as VF would fail after getting the initial rejection message [instead of sending an additional one where it asks for a FW override and see if it works].

Fixes 22d07d939c3c ("net/qede/base: update")
---
 drivers/net/qede/base/ecore_vf.c |    1 +
 1 file changed, 1 insertion(+)
drivers/net/qede/base/ecore_vf.c +1 -0
index 161b317..c26b602 100644
@@ -294,6 +294,7 @@ static enum _ecore_status_t ecore_vf_pf_acquire(struct ecore_hwfn *p_hwfn)
 						" override\n");
 					req->vfdev_info.capabilities |=
 						VFPF_ACQUIRE_CAP_PRE_FP_HSI;
+					continue;
 				}
 			}
 
Signature · 1 line
1.7.10.3