From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 48437A04A4; Wed, 2 Mar 2022 07:35:43 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1EF07426E8; Wed, 2 Mar 2022 07:35:43 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id A9EA040688 for ; Wed, 2 Mar 2022 07:35:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646202941; x=1677738941; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AP7O24EhymZOawVHFtYV9DldDCuCquNl8I5vFc+/hAM=; b=FbvFYHg7M74W4CCfnkZP4KhQdMfwz7c415/wj25eJblGENwjsfHQ0nGo 74ZWHZZUmhChomLCfYKe2Ln6AP5wY/RZWgbtax43In+E5ugXdTuANLBqn Fg4viObeRpvBOluPKdAjTwfs5MR7o0rLcpmh19yx1oJkRxXKaizMmuiGF pcnMyMOv4oLMVEfYB7U+Z/MIN8ZRFh/Dr1meehqThT8yOdfy6h9NzuZiP Fsryz7Je9GnJo1BLQcvwpaFd8Oyt/4ZyWNCdhAogL5Q85GGX2no0cfdE/ c6lC8bcMor6BnGb94EIyUT6fOsUWgkJVUsXDhbUaUMDc0KMoPPgi4lC9g g==; X-IronPort-AV: E=McAfee;i="6200,9189,10273"; a="236832517" X-IronPort-AV: E=Sophos;i="5.90,148,1643702400"; d="scan'208";a="236832517" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2022 22:35:40 -0800 X-IronPort-AV: E=Sophos;i="5.90,148,1643702400"; d="scan'208";a="641583262" Received: from intel-corei7-64.sh.intel.com (HELO localhost.localdomain) ([10.239.251.104]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2022 22:35:38 -0800 From: Ke Zhang To: dev@dpdk.org, qiming.yang@intel.com, qi.z.zhang@intel.com Cc: Yiding Zhou , Ke Zhang Subject: [PATCH v6 1/4] net/ice: add support for setting promisc by DCF Date: Wed, 2 Mar 2022 06:30:49 +0000 Message-Id: <20220302063052.347122-2-ke1x.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220302063052.347122-1-ke1x.zhang@intel.com> References: <20220302063052.347122-1-ke1x.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Yiding Zhou 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 Signed-off-by: Ke Zhang --- 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