net/qede: fix to get vendor/device id info
PATCH 1/8 net/qede: fix to get vendor/device id info
--- drivers/net/qede/qede_ethdev.c | 4 ++++ 1 file changed, 4 insertions(+)
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" );
Signature · 1 line
2.11.0.rc1
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.
--- drivers/net/qede/base/ecore_sriov.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/qede/base/ecore_sriov.c +4 -5
@@ -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
PATCH 4/8 net/qede/base: fix error return code in resc alloc
In reply to Rasesh ModyFix to return error code ECORE_INVAL instead of 0 when EQ elements is too large as done elsewhere in this function.
--- drivers/net/qede/base/ecore_dev.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/qede/base/ecore_dev.c +1 -0
@@ -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
PATCH 5/8 net/qede/base: fix mutex in freeing context manager
In reply to Rasesh ModyFix OSAL_MUTEX_DEALLOC() in freeing the context manager.
--- drivers/net/qede/base/ecore_cxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/qede/base/ecore_cxt.c +1 -1
@@ -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
PATCH 3/8 net/qede/base: fix multiple acquisition requests by VF
In reply to Rasesh ModyThere 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.
--- drivers/net/qede/base/ecore_vf.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/qede/base/ecore_vf.c +8 -0
@@ -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
PATCH 6/8 net/qede/base: fix Rx queue access by malicious VFs
In reply to Rasesh Mody8.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.
--- drivers/net/qede/base/ecore_sriov.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/qede/base/ecore_sriov.c +5 -4
@@ -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
PATCH 8/8 net/qede/base: fix to check FW override after rejection
In reply to Rasesh ModyApparently 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].
--- drivers/net/qede/base/ecore_vf.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/qede/base/ecore_vf.c +1 -0
@@ -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
PATCH 7/8 net/qede/base: fix to handle acquire request from VF
In reply to Rasesh ModyAdd a check and fail the VF's probe request if VF is already in VF_ACQUIRED state.
--- drivers/net/qede/base/ecore_sriov.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/qede/base/ecore_sriov.c +12 -0
@@ -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
Hi Rasesh,
Quoted 3 lines · Rasesh Mody
Fixes ec94dbc5 ("qede: add base driver")Signed-off-by Rasesh Mody <[email protected]>
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_idanddevice_idget, 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@@ -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" );
Hi Ferruh,
Quoted 10 lines
From: Ferruh Yigit [mailto:[email protected]]
Sent: Friday, December 09, 2016 5:36 AMHi Rasesh,
Quoted 3 lines · Rasesh Mody
Fixes ec94dbc5 ("qede: add base driver")Signed-off-by Rasesh Mody <[email protected]>
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_idanddevice_idget, 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.cindex9c2a5eae..b9a325df100644drivers/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");
PATCH v2 1/8 net/qede: fix to get vendor/device id info
In reply to Ferruh YigitThe 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.
--- drivers/net/qede/qede_ethdev.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/qede/qede_ethdev.c +4 -0
@@ -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
PATCH v2 2/8 net/qede/base: fix sriov printouts
In reply to Ferruh YigitRemove 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.
--- drivers/net/qede/base/ecore_sriov.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/qede/base/ecore_sriov.c +4 -5
@@ -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
PATCH v2 3/8 net/qede/base: fix multiple acquisition requests by VF
In reply to Ferruh YigitThere 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.
--- drivers/net/qede/base/ecore_vf.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/qede/base/ecore_vf.c +8 -0
@@ -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
PATCH v2 4/8 net/qede/base: fix error return code in resc alloc
In reply to Ferruh YigitFix to return error code ECORE_INVAL instead of 0 when EQ elements is too large as done elsewhere in this function.
--- drivers/net/qede/base/ecore_dev.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/qede/base/ecore_dev.c +1 -0
@@ -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
PATCH v2 5/8 net/qede/base: fix mutex in freeing context manager
In reply to Ferruh YigitFix OSAL_MUTEX_DEALLOC() in freeing the context manager.
--- drivers/net/qede/base/ecore_cxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/qede/base/ecore_cxt.c +1 -1
@@ -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
PATCH v2 6/8 net/qede/base: fix Rx queue access by malicious VFs
In reply to Ferruh YigitRx 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.
--- drivers/net/qede/base/ecore_sriov.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/qede/base/ecore_sriov.c +5 -4
@@ -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
PATCH v2 7/8 net/qede/base: fix to handle acquire request from VF
In reply to Ferruh YigitAdd a check and fail the VF's probe request if VF is already in VF_ACQUIRED state.
--- drivers/net/qede/base/ecore_sriov.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/qede/base/ecore_sriov.c +12 -0
@@ -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
PATCH v2 8/8 net/qede/base: fix VF over legacy PF
In reply to Ferruh YigitApparently 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].
--- drivers/net/qede/base/ecore_vf.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/qede/base/ecore_vf.c +1 -0
@@ -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
Quoted 7 lines · Rasesh Mody
The
vendor_idanddevice_idare 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")Signed-off-by Rasesh Mody <[email protected]>
Series applied to dpdk-next-net/master, thanks.