DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yiding Zhou <yidingx.zhou@intel.com>
To: qiming.yang@intel.com, qi.z.zhang@intel.com
Cc: junfeng.guo@intel.com, dev@dpdk.org
Subject: [PATCH] net/ice: add support for setting promisc by DCF
Date: Wed, 26 Jan 2022 15:53:21 +0000	[thread overview]
Message-ID: <20220126155321.6454-1-yidingx.zhou@intel.com> (raw)

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


             reply	other threads:[~2022-01-26  7:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26 15:53 Yiding Zhou [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-01-26 15:22 Yiding Zhou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220126155321.6454-1-yidingx.zhou@intel.com \
    --to=yidingx.zhou@intel.com \
    --cc=dev@dpdk.org \
    --cc=junfeng.guo@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).