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 CE269A0093; Fri, 29 Apr 2022 03:22:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0A5234283D; Fri, 29 Apr 2022 03:22:38 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 8D0D242834 for ; Fri, 29 Apr 2022 03:22:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651195353; x=1682731353; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SJdFnXElSs/OCjs0t8jyeIS8L+n2ei7pLELtZME0huo=; b=CP65hn2RRHJak5i0s3hkT0XyH2dRvAYvR6j/86DmSQyakHasiqyGhsf1 7IhRJgtsKmdxnCVwVRYkD4oAinsaCj+58mgaZrKn8bMNR2k7Zj7F3uFF6 5TN3Atga/MpV8cHhbzu8aDvduFSekb6noaAU2txiqs5Qm0viDfiSZV8Rt 7pRbSHwhubfkdVwkraPOv+mxRM6F58OGO4FuGBTXoUGm+9xFDkbphcXdn Tg3BvCs2CrCheobSzHS0w+nI1QCs3GWy+CrQ0zZTwiIjP15mZ5J8962Cr K7l1AXLHLsgw6tSvpm4a9AMRAqyRp3fJS9cKxnz8EANapD3XCx5huEYKz w==; X-IronPort-AV: E=McAfee;i="6400,9594,10331"; a="266013708" X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="266013708" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2022 18:22:33 -0700 X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="581767882" Received: from intel-cd-odc-kevin.cd.intel.com ([10.240.178.195]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2022 18:22:31 -0700 From: Kevin Liu To: dev@dpdk.org Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, stevex.yang@intel.com, Alvin Zhang , Kevin Liu Subject: [PATCH v7 06/12] net/ice: support dcf promisc configuration Date: Fri, 29 Apr 2022 09:19:52 +0000 Message-Id: <20220429091958.3103384-7-kevinx.liu@intel.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220429091958.3103384-1-kevinx.liu@intel.com> References: <20220427181301.1414196-1-kevinx.liu@intel.com> <20220429091958.3103384-1-kevinx.liu@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: Alvin Zhang Support configuration of unicast and multicast promisc on dcf. Signed-off-by: Alvin Zhang Signed-off-by: Kevin Liu --- doc/guides/nics/features/ice_dcf.ini | 2 + doc/guides/rel_notes/release_22_07.rst | 1 + drivers/net/ice/ice_dcf_ethdev.c | 77 ++++++++++++++++++++++++-- drivers/net/ice/ice_dcf_ethdev.h | 3 + 4 files changed, 79 insertions(+), 4 deletions(-) diff --git a/doc/guides/nics/features/ice_dcf.ini b/doc/guides/nics/features/ice_dcf.ini index be34ab4692..fe3ada8733 100644 --- a/doc/guides/nics/features/ice_dcf.ini +++ b/doc/guides/nics/features/ice_dcf.ini @@ -18,6 +18,8 @@ Inner L4 checksum = P RSS reta update = Y RSS key update = Y MTU update = Y +Promiscuous mode = Y +Allmulticast mode = Y Basic stats = Y Linux = Y x86-32 = Y diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst index 3c8412c82e..f23e5cafd1 100644 --- a/doc/guides/rel_notes/release_22_07.rst +++ b/doc/guides/rel_notes/release_22_07.rst @@ -65,6 +65,7 @@ New Features * Added support for RSS RETA configure in DCF mode. * Added support for RSS HASH configure in DCF mode. * Added support for MTU configure in DCF mode. + * Added support for promisc configuration in DCF mode. Removed Items ------------- diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index 6a577a6582..87d281ee93 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -727,27 +727,95 @@ ice_dcf_dev_info_get(struct rte_eth_dev *dev, } static int -ice_dcf_dev_promiscuous_enable(__rte_unused struct rte_eth_dev *dev) +dcf_config_promisc(struct ice_dcf_adapter *adapter, + bool enable_unicast, + bool enable_multicast) { + struct ice_dcf_hw *hw = &adapter->real_hw; + struct virtchnl_promisc_info promisc; + struct dcf_virtchnl_cmd args; + int err; + + promisc.flags = 0; + promisc.vsi_id = hw->vsi_res->vsi_id; + + if (enable_unicast) + promisc.flags |= FLAG_VF_UNICAST_PROMISC; + + if (enable_multicast) + promisc.flags |= FLAG_VF_MULTICAST_PROMISC; + + memset(&args, 0, sizeof(args)); + args.v_op = VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE; + args.req_msg = (uint8_t *)&promisc; + args.req_msglen = sizeof(promisc); + + err = ice_dcf_execute_virtchnl_cmd(hw, &args); + if (err) { + PMD_DRV_LOG(ERR, + "fail to execute command VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE"); + return err; + } + + adapter->promisc_unicast_enabled = enable_unicast; + adapter->promisc_multicast_enabled = enable_multicast; return 0; } +static int +ice_dcf_dev_promiscuous_enable(__rte_unused struct rte_eth_dev *dev) +{ + struct ice_dcf_adapter *adapter = dev->data->dev_private; + + if (adapter->promisc_unicast_enabled) { + PMD_DRV_LOG(INFO, "promiscuous has been enabled"); + return 0; + } + + return dcf_config_promisc(adapter, true, + adapter->promisc_multicast_enabled); +} + static int ice_dcf_dev_promiscuous_disable(__rte_unused struct rte_eth_dev *dev) { - return 0; + struct ice_dcf_adapter *adapter = dev->data->dev_private; + + if (!adapter->promisc_unicast_enabled) { + PMD_DRV_LOG(INFO, "promiscuous has been disabled"); + return 0; + } + + return dcf_config_promisc(adapter, false, + adapter->promisc_multicast_enabled); } static int ice_dcf_dev_allmulticast_enable(__rte_unused struct rte_eth_dev *dev) { - return 0; + struct ice_dcf_adapter *adapter = dev->data->dev_private; + + if (adapter->promisc_multicast_enabled) { + PMD_DRV_LOG(INFO, "allmulticast has been enabled"); + return 0; + } + + return dcf_config_promisc(adapter, adapter->promisc_unicast_enabled, + true); } static int ice_dcf_dev_allmulticast_disable(__rte_unused struct rte_eth_dev *dev) { - return 0; + struct ice_dcf_adapter *adapter = dev->data->dev_private; + + if (!adapter->promisc_multicast_enabled) { + PMD_DRV_LOG(INFO, "allmulticast has been disabled"); + return 0; + } + + return dcf_config_promisc(adapter, adapter->promisc_unicast_enabled, + false); } static int @@ -1299,6 +1367,7 @@ ice_dcf_dev_init(struct rte_eth_dev *eth_dev) return -1; } + dcf_config_promisc(adapter, false, false); return 0; } diff --git a/drivers/net/ice/ice_dcf_ethdev.h b/drivers/net/ice/ice_dcf_ethdev.h index f2faf26f58..22e450527b 100644 --- a/drivers/net/ice/ice_dcf_ethdev.h +++ b/drivers/net/ice/ice_dcf_ethdev.h @@ -33,6 +33,9 @@ struct ice_dcf_adapter { struct ice_adapter parent; /* Must be first */ struct ice_dcf_hw real_hw; + bool promisc_unicast_enabled; + bool promisc_multicast_enabled; + int num_reprs; struct ice_dcf_repr_info *repr_infos; }; -- 2.33.1