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 4DF80A04A7; Wed, 26 Jan 2022 08:49:46 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 125AF42702; Wed, 26 Jan 2022 08:49:46 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id DB6E24069D for ; Wed, 26 Jan 2022 08:49:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643183384; x=1674719384; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=oKfGQxM/Wg4omkHXkk4A0LRDDDJNuvPeYW9TwNVzjOo=; b=a0IVmxHEAIYqi1KgmvGLDfLW2iSsSfvi1TevIPt9NzelhIWm3fsXB2l0 CVREPvyXTmj0zSnpknfIuKSZwWp1GeaWCy4yyUIph4DZISDNhA74hpivp VrhvERUwFFEOwA+iu8GeRL/1gSqkfUpY5q8+Fvxtag3raJB0Wo3UNSvPU UlQe5EOQtjCkgaItOpmF34vl3I9JA6ugRBibaiSCcuryGhtgMHN9+McLh 3xMDYQoEPObL+pima31B4OHbH6zUgCLiAmS55xj3oloOU1rd/q/1xvTlf w/F1fq6Nd1MsyUG9kW6Q3WGYDxvpAywXP9UxVWfSTk/my/fBb/lbne6pY A==; X-IronPort-AV: E=McAfee;i="6200,9189,10238"; a="332853923" X-IronPort-AV: E=Sophos;i="5.88,317,1635231600"; d="scan'208";a="332853923" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2022 23:49:42 -0800 X-IronPort-AV: E=Sophos;i="5.88,317,1635231600"; d="scan'208";a="495279991" Received: from unknown (HELO localhost.localdomain) ([10.239.251.174]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2022 23:49:40 -0800 From: Yiding Zhou 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 Message-Id: <20220126155321.6454-1-yidingx.zhou@intel.com> X-Mailer: git-send-email 2.25.1 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 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 --- 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