[v2,3/7] net/ice: initiate to acquire the DCF capability
Checks
Commit Message
Since the DCF (Device Config Function) controls the flow setting of
other VFs by the mailbox with PF, for security, it needs to acquire
the DCF capability from PF when starts, and exits to disable it.
Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
---
drivers/net/ice/ice_dcf.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
Comments
For the subject, since this patch is about acquire + disable, how about
net/ice: support DCF capability acquire/disable
On 03/10, Haiyue Wang wrote:
>Since the DCF (Device Config Function) controls the flow setting of
>other VFs by the mailbox with PF, for security, it needs to acquire
>the DCF capability from PF when starts, and exits to disable it.
s/exits to disable it/disable it when exits
>
>Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
>---
> drivers/net/ice/ice_dcf.c | 28 +++++++++++++++++++++++++++-
> 1 file changed, 27 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
>index efb258a5a..7a3626939 100644
>--- a/drivers/net/ice/ice_dcf.c
>+++ b/drivers/net/ice/ice_dcf.c
>@@ -227,7 +227,7 @@ ice_dcf_get_vf_resource(struct ice_dcf_hw *hw)
> int err, i;
>
> caps = VIRTCHNL_VF_OFFLOAD_WB_ON_ITR | VIRTCHNL_VF_OFFLOAD_RX_POLLING |
>- VIRTCHNL_VF_CAP_ADV_LINK_SPEED |
>+ VIRTCHNL_VF_CAP_ADV_LINK_SPEED | VIRTCHNL_VF_CAP_DCF |
> VF_BASE_MODE_OFFLOADS;
>
> err = ice_dcf_send_cmd_req_no_irq(hw, VIRTCHNL_OP_GET_VF_RESOURCES,
>@@ -264,6 +264,31 @@ ice_dcf_get_vf_resource(struct ice_dcf_hw *hw)
> return 0;
> }
>
>+static int
>+ice_dcf_mode_disable(struct ice_dcf_hw *hw)
>+{
>+ int err;
>+
>+ err = ice_dcf_send_cmd_req_no_irq(hw, VIRTCHNL_OP_DCF_DISABLE,
>+ NULL, 0);
>+ if (err) {
>+ PMD_DRV_LOG(ERR, "Fail to send msg OP_DCF_DISABLE");
>+ return err;
>+ }
>+
>+ err = ice_dcf_recv_cmd_rsp_no_irq(hw, VIRTCHNL_OP_DCF_DISABLE,
>+ (uint8_t *)hw->arq_buf,
>+ ICE_DCF_AQ_BUF_SZ, NULL);
>+ if (err) {
>+ PMD_DRV_LOG(ERR,
>+ "Fail to get response of OP_DCF_DISABLE %d",
>+ err);
>+ return -1;
>+ }
>+
>+ return 0;
>+}
>+
> static int
> ice_dcf_check_reset_done(struct ice_dcf_hw *hw)
> {
>@@ -467,6 +492,7 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
> rte_intr_callback_unregister(intr_handle,
> ice_dcf_dev_interrupt_handler, hw);
>
>+ ice_dcf_mode_disable(hw);
> iavf_shutdown_adminq(&hw->avf);
>
> rte_free(hw->arq_buf);
>--
>2.25.1
>
For the patch,
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
On 03/10, Haiyue Wang wrote:
>
>+static int
>+ice_dcf_mode_disable(struct ice_dcf_hw *hw)
>+{
>+ int err;
>+
>+ err = ice_dcf_send_cmd_req_no_irq(hw, VIRTCHNL_OP_DCF_DISABLE,
>+ NULL, 0);
>+ if (err) {
>+ PMD_DRV_LOG(ERR, "Fail to send msg OP_DCF_DISABLE");
>+ return err;
>+ }
>+
>+ err = ice_dcf_recv_cmd_rsp_no_irq(hw, VIRTCHNL_OP_DCF_DISABLE,
>+ (uint8_t *)hw->arq_buf,
Unnecessary cast.
>+ ICE_DCF_AQ_BUF_SZ, NULL);
>+ if (err) {
>+ PMD_DRV_LOG(ERR,
>+ "Fail to get response of OP_DCF_DISABLE %d",
>+ err);
>+ return -1;
>+ }
>+
>+ return 0;
>+}
> -----Original Message-----
> From: Ye, Xiaolong <xiaolong.ye@intel.com>
> Sent: Friday, March 13, 2020 14:04
> To: Wang, Haiyue <haiyue.wang@intel.com>
> Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming <qiming.yang@intel.com>; Xing,
> Beilei <beilei.xing@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> Subject: Re: [PATCH v2 3/7] net/ice: initiate to acquire the DCF capability
>
> On 03/10, Haiyue Wang wrote:
>
> >
> >+static int
> >+ice_dcf_mode_disable(struct ice_dcf_hw *hw)
> >+{
> >+ int err;
> >+
> >+ err = ice_dcf_send_cmd_req_no_irq(hw, VIRTCHNL_OP_DCF_DISABLE,
> >+ NULL, 0);
> >+ if (err) {
> >+ PMD_DRV_LOG(ERR, "Fail to send msg OP_DCF_DISABLE");
> >+ return err;
> >+ }
> >+
> >+ err = ice_dcf_recv_cmd_rsp_no_irq(hw, VIRTCHNL_OP_DCF_DISABLE,
> >+ (uint8_t *)hw->arq_buf,
>
> Unnecessary cast.
will be fixed in next patch.
>
> >+ ICE_DCF_AQ_BUF_SZ, NULL);
> >+ if (err) {
> >+ PMD_DRV_LOG(ERR,
> >+ "Fail to get response of OP_DCF_DISABLE %d",
> >+ err);
> >+ return -1;
> >+ }
> >+
> >+ return 0;
> >+}
> -----Original Message-----
> From: Ye, Xiaolong <xiaolong.ye@intel.com>
> Sent: Friday, March 13, 2020 13:52
> To: Wang, Haiyue <haiyue.wang@intel.com>
> Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming <qiming.yang@intel.com>; Xing,
> Beilei <beilei.xing@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> Subject: Re: [PATCH v2 3/7] net/ice: initiate to acquire the DCF capability
>
> For the subject, since this patch is about acquire + disable, how about
>
> net/ice: support DCF capability acquire/disable
Make sense, will improve the title.
>
> On 03/10, Haiyue Wang wrote:
> >Since the DCF (Device Config Function) controls the flow setting of
> >other VFs by the mailbox with PF, for security, it needs to acquire
> >the DCF capability from PF when starts, and exits to disable it.
>
> s/exits to disable it/disable it when exits
>
OK.
> >
> >Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
> >---
> > drivers/net/ice/ice_dcf.c | 28 +++++++++++++++++++++++++++-
> > 1 file changed, 27 insertions(+), 1 deletion(-)
> >
> >diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
> >index efb258a5a..7a3626939 100644
> >--- a/drivers/net/ice/ice_dcf.c
> >+++ b/drivers/net/ice/ice_dcf.c
> >@@ -227,7 +227,7 @@ ice_dcf_get_vf_resource(struct ice_dcf_hw *hw)
> > int err, i;
> >
> > caps = VIRTCHNL_VF_OFFLOAD_WB_ON_ITR | VIRTCHNL_VF_OFFLOAD_RX_POLLING |
> >- VIRTCHNL_VF_CAP_ADV_LINK_SPEED |
> >+ VIRTCHNL_VF_CAP_ADV_LINK_SPEED | VIRTCHNL_VF_CAP_DCF |
> > VF_BASE_MODE_OFFLOADS;
> >
> > err = ice_dcf_send_cmd_req_no_irq(hw, VIRTCHNL_OP_GET_VF_RESOURCES,
> >@@ -264,6 +264,31 @@ ice_dcf_get_vf_resource(struct ice_dcf_hw *hw)
> > return 0;
> > }
> >
> >+static int
> >+ice_dcf_mode_disable(struct ice_dcf_hw *hw)
> >+{
> >+ int err;
> >+
> >+ err = ice_dcf_send_cmd_req_no_irq(hw, VIRTCHNL_OP_DCF_DISABLE,
> >+ NULL, 0);
> >+ if (err) {
> >+ PMD_DRV_LOG(ERR, "Fail to send msg OP_DCF_DISABLE");
> >+ return err;
> >+ }
> >+
> >+ err = ice_dcf_recv_cmd_rsp_no_irq(hw, VIRTCHNL_OP_DCF_DISABLE,
> >+ (uint8_t *)hw->arq_buf,
> >+ ICE_DCF_AQ_BUF_SZ, NULL);
> >+ if (err) {
> >+ PMD_DRV_LOG(ERR,
> >+ "Fail to get response of OP_DCF_DISABLE %d",
> >+ err);
> >+ return -1;
> >+ }
> >+
> >+ return 0;
> >+}
> >+
> > static int
> > ice_dcf_check_reset_done(struct ice_dcf_hw *hw)
> > {
> >@@ -467,6 +492,7 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
> > rte_intr_callback_unregister(intr_handle,
> > ice_dcf_dev_interrupt_handler, hw);
> >
> >+ ice_dcf_mode_disable(hw);
> > iavf_shutdown_adminq(&hw->avf);
> >
> > rte_free(hw->arq_buf);
> >--
> >2.25.1
> >
>
> For the patch,
>
> Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
@@ -227,7 +227,7 @@ ice_dcf_get_vf_resource(struct ice_dcf_hw *hw)
int err, i;
caps = VIRTCHNL_VF_OFFLOAD_WB_ON_ITR | VIRTCHNL_VF_OFFLOAD_RX_POLLING |
- VIRTCHNL_VF_CAP_ADV_LINK_SPEED |
+ VIRTCHNL_VF_CAP_ADV_LINK_SPEED | VIRTCHNL_VF_CAP_DCF |
VF_BASE_MODE_OFFLOADS;
err = ice_dcf_send_cmd_req_no_irq(hw, VIRTCHNL_OP_GET_VF_RESOURCES,
@@ -264,6 +264,31 @@ ice_dcf_get_vf_resource(struct ice_dcf_hw *hw)
return 0;
}
+static int
+ice_dcf_mode_disable(struct ice_dcf_hw *hw)
+{
+ int err;
+
+ err = ice_dcf_send_cmd_req_no_irq(hw, VIRTCHNL_OP_DCF_DISABLE,
+ NULL, 0);
+ if (err) {
+ PMD_DRV_LOG(ERR, "Fail to send msg OP_DCF_DISABLE");
+ return err;
+ }
+
+ err = ice_dcf_recv_cmd_rsp_no_irq(hw, VIRTCHNL_OP_DCF_DISABLE,
+ (uint8_t *)hw->arq_buf,
+ ICE_DCF_AQ_BUF_SZ, NULL);
+ if (err) {
+ PMD_DRV_LOG(ERR,
+ "Fail to get response of OP_DCF_DISABLE %d",
+ err);
+ return -1;
+ }
+
+ return 0;
+}
+
static int
ice_dcf_check_reset_done(struct ice_dcf_hw *hw)
{
@@ -467,6 +492,7 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
rte_intr_callback_unregister(intr_handle,
ice_dcf_dev_interrupt_handler, hw);
+ ice_dcf_mode_disable(hw);
iavf_shutdown_adminq(&hw->avf);
rte_free(hw->arq_buf);