[v6,1/4] net/ice: add support for setting promisc by DCF

Message ID 20220302063052.347122-2-ke1x.zhang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series ice repr functions by DCF |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Zhang, Ke1X March 2, 2022, 6:30 a.m. UTC
  From: Yiding Zhou <yidingx.zhou@intel.com>

allow to enable/disable VFs promisc mode over VF0.
this feature need to update ice kernel driver (newer than v1.8.0)

Signed-off-by: Yiding Zhou <yidingx.zhou@intel.com>
Signed-off-by: Ke Zhang <ke1x.zhang@intel.com>
---
 drivers/net/ice/ice_dcf_vf_representor.c | 56 +++++++++++++++++-------
 1 file changed, 39 insertions(+), 17 deletions(-)
  

Comments

David Marchand March 2, 2022, 9:14 a.m. UTC | #1
On Wed, Mar 2, 2022 at 7:35 AM Ke Zhang <ke1x.zhang@intel.com> wrote:
>
> From: Yiding Zhou <yidingx.zhou@intel.com>
>
> allow to enable/disable VFs promisc mode over VF0.
> this feature need to update ice kernel driver (newer than v1.8.0)

I guess v1.8.0 is about the out of tree driver Intel maintains.
If so, please state it clearly.


I had a quick look but I can't find a released v1.8.0 driver.
Is this series aimed at v22.03 or for later dpdk release?


About upstream kernel, is there plans to make it work in the future?
Were non regression tests passed with upstream?

Thanks.
  

Patch

diff --git a/drivers/net/ice/ice_dcf_vf_representor.c b/drivers/net/ice/ice_dcf_vf_representor.c
index b9fcfc80ad..781282f68c 100644
--- a/drivers/net/ice/ice_dcf_vf_representor.c
+++ b/drivers/net/ice/ice_dcf_vf_representor.c
@@ -10,6 +10,20 @@ 
 #include "ice_dcf_ethdev.h"
 #include "ice_rxtx.h"
 
+static __rte_always_inline struct ice_dcf_hw *
+ice_dcf_vf_repr_hw(struct ice_dcf_vf_repr *repr)
+{
+	struct ice_dcf_adapter *dcf_adapter =
+			repr->dcf_eth_dev->data->dev_private;
+
+	if (!dcf_adapter) {
+		PMD_DRV_LOG(ERR, "DCF for VF representor has been released\n");
+		return NULL;
+	}
+
+	return &dcf_adapter->real_hw;
+}
+
 static uint16_t
 ice_dcf_vf_repr_rx_burst(__rte_unused void *rxq,
 			 __rte_unused struct rte_mbuf **rx_pkts,
@@ -78,15 +92,36 @@  ice_dcf_vf_repr_tx_queue_setup(__rte_unused struct rte_eth_dev *dev,
 }
 
 static int
-ice_dcf_vf_repr_promiscuous_enable(__rte_unused struct rte_eth_dev *ethdev)
+ice_dcf_vf_repr_promiscuous_enable(struct rte_eth_dev *ethdev)
 {
-	return 0;
+	struct ice_dcf_vf_repr *repr = ethdev->data->dev_private;
+	struct dcf_virtchnl_cmd args;
+	struct virtchnl_promisc_info promisc;
+	struct ice_dcf_hw *hw = ice_dcf_vf_repr_hw(repr);
+	memset(&args, 0, sizeof(args));
+	args.v_op = VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE;
+	promisc.flags = 0;
+	promisc.vsi_id = hw->vf_vsi_map[repr->vf_id] & ~VIRTCHNL_DCF_VF_VSI_VALID;
+	promisc.flags |= FLAG_VF_UNICAST_PROMISC;
+	args.req_msg = (uint8_t *)&promisc;
+	args.req_msglen = sizeof(promisc);
+	return ice_dcf_execute_virtchnl_cmd(hw, &args);
 }
 
 static int
-ice_dcf_vf_repr_promiscuous_disable(__rte_unused struct rte_eth_dev *ethdev)
+ice_dcf_vf_repr_promiscuous_disable(struct rte_eth_dev *ethdev)
 {
-	return 0;
+	struct ice_dcf_vf_repr *repr = ethdev->data->dev_private;
+	struct dcf_virtchnl_cmd args;
+	struct virtchnl_promisc_info promisc;
+	struct ice_dcf_hw *hw = ice_dcf_vf_repr_hw(repr);
+	memset(&args, 0, sizeof(args));
+	args.v_op = VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE;
+	promisc.flags = 0;
+	promisc.vsi_id = hw->vf_vsi_map[repr->vf_id] & ~VIRTCHNL_DCF_VF_VSI_VALID;
+	args.req_msg = (uint8_t *)&promisc;
+	args.req_msglen = sizeof(promisc);
+	return ice_dcf_execute_virtchnl_cmd(hw, &args);
 }
 
 static int
@@ -108,19 +143,6 @@  ice_dcf_vf_repr_link_update(__rte_unused struct rte_eth_dev *ethdev,
 	return 0;
 }
 
-static __rte_always_inline struct ice_dcf_hw *
-ice_dcf_vf_repr_hw(struct ice_dcf_vf_repr *repr)
-{
-	struct ice_dcf_adapter *dcf_adapter =
-			repr->dcf_eth_dev->data->dev_private;
-
-	if (!dcf_adapter) {
-		PMD_DRV_LOG(ERR, "DCF for VF representor has been released\n");
-		return NULL;
-	}
-
-	return &dcf_adapter->real_hw;
-}
 
 static int
 ice_dcf_vf_repr_dev_info_get(struct rte_eth_dev *dev,