DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/ice: add support for setting promisc by DCF
@ 2022-01-26 15:53 Yiding Zhou
  0 siblings, 0 replies; 2+ messages in thread
From: Yiding Zhou @ 2022-01-26 15:53 UTC (permalink / raw)
  To: qiming.yang, qi.z.zhang; +Cc: junfeng.guo, dev

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>
---
 drivers/net/ice/ice_dcf_vf_representor.c | 56 +++++++++++++++++-------
 1 file changed, 39 insertions(+), 17 deletions(-)

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,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] net/ice: add support for setting promisc by DCF
@ 2022-01-26 15:22 Yiding Zhou
  0 siblings, 0 replies; 2+ messages in thread
From: Yiding Zhou @ 2022-01-26 15:22 UTC (permalink / raw)
  To: qiming.yang, qi.z.zhang; +Cc: junfeng.guo, dev

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>
---
 drivers/net/ice/ice_dcf_vf_representor.c | 56 +++++++++++++++++-------
 1 file changed, 39 insertions(+), 17 deletions(-)

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,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-26 15:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26 15:53 [PATCH] net/ice: add support for setting promisc by DCF Yiding Zhou
  -- strict thread matches above, loose matches on Subject: below --
2022-01-26 15:22 Yiding Zhou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).