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 A6F5841BB4; Fri, 3 Feb 2023 03:16:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 81DAC4014F; Fri, 3 Feb 2023 03:16:14 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 5F4F340141 for ; Fri, 3 Feb 2023 03:16:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675390573; x=1706926573; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xAXEbY/Nt66EDotpE5bvyb4DqjrMGBi8MPcbZ3XdlhU=; b=SFdaooKeV9ulP+wGFwHtsovUHkHSIc/pCzxFs0ORfGdIDujf7f4wBQfE PZvB7glwdBrR3QnT1NI6p2H68gbYLo/elt5CJqmEP6TFefrmOYwEinlEJ RqCOCDFf2+dgklhZQJ10BRD53uF8i8r2AeHU2W81MkXoG8mIhgTR80X1r K7pkPtDSjEhMgwhYoIZWXf+5zcRVItLLVml+diPCgQhSEfqYkUOR3MN4/ daG21vos0JjAxilDRSztcR9TtDBStGP/yoVNPCYDj4Z0UwkoE6SCkpmit PGs611jF0oO2BuvY0YN+FsqSt57ocD8UpcjbH998lBUig+jkokKTxMO4v Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10609"; a="312287719" X-IronPort-AV: E=Sophos;i="5.97,269,1669104000"; d="scan'208";a="312287719" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2023 18:16:11 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10609"; a="643109743" X-IronPort-AV: E=Sophos;i="5.97,269,1669104000"; d="scan'208";a="643109743" Received: from unknown (HELO localhost.localdomain) ([10.239.252.104]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2023 18:16:09 -0800 From: Ke Zhang To: qi.z.zhang@intel.com, yuying.zhang@intel.com, yong.liu@intel.com, dev@dpdk.org Cc: "ke1x.zhang" Subject: [PATCH v4] net/ice: add devargs for disabling default mac Date: Fri, 3 Feb 2023 10:02:07 +0800 Message-Id: <20230203020207.99778-1-ke1x.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230112075538.206709-1-ke1x.zhang@intel.com> References: <20230112075538.206709-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: "ke1x.zhang" There is a requirement that if a flow rule is created, received packet is permitted to pass if rule matching, or else drop. But in default, a mac filter will be created and the default mac will be added into lookup table during driver initialization, it makes drop action impossilbe. Add the feature that support to disable default mac which will be used by ice driver when setting dpdk_devargs config field. Default mac is not disabled in default, user can choose to disable the default mac by setting ``devargs`` parameter ``default-mac-disable``, for example:: -a 80:00.0,default-mac-disable=1 Signed-off-by: Ke Zhang --- v4: explain what's the typical usage with this feature in general v3: rename the feature name remove some unecessary codes. --- doc/guides/nics/ice.rst | 16 ++++++++++++++++ drivers/net/ice/ice_ethdev.c | 21 ++++++++++++++++++--- drivers/net/ice/ice_ethdev.h | 1 + 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst index 335b558338..24bbd5b145 100644 --- a/doc/guides/nics/ice.rst +++ b/doc/guides/nics/ice.rst @@ -107,6 +107,22 @@ Runtime Config Options -a 80:00.0,pipeline-mode-support=1 +- ``Default Mac Disable`` (default ``0``) + + There is a requirement that if a flow rule is created, received packet is permitted + to pass if rule matching, or else drop. + But in default, a mac filter will be created and the default mac will be added into + lookup table during driver initialization, it makes drop action impossilbe. + + Add the feature that support to disable default mac which will be used by ice driver + when setting dpdk_devargs config field. + + Default mac is not disabled in default, user can choose to disable the default mac + by setting ``devargs`` parameter ``default-mac-disable``, + for example:: + + -a 80:00.0,default-mac-disable=1 + - ``Protocol extraction for per queue`` Configure the RX queues to do protocol extraction into mbuf for protocol diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 0bc739daf0..0d011bbffa 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -28,6 +28,7 @@ /* devargs */ #define ICE_SAFE_MODE_SUPPORT_ARG "safe-mode-support" #define ICE_PIPELINE_MODE_SUPPORT_ARG "pipeline-mode-support" +#define ICE_DEFAULT_MAC_DISABLE "default-mac-disable" #define ICE_PROTO_XTR_ARG "proto_xtr" #define ICE_FIELD_OFFS_ARG "field_offs" #define ICE_FIELD_NAME_ARG "field_name" @@ -49,6 +50,7 @@ static const char * const ice_valid_args[] = { ICE_HW_DEBUG_MASK_ARG, ICE_ONE_PPS_OUT_ARG, ICE_RX_LOW_LATENCY_ARG, + ICE_DEFAULT_MAC_DISABLE, NULL }; @@ -916,6 +918,7 @@ static int ice_init_mac_address(struct rte_eth_dev *dev) { struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct ice_adapter *ad = (struct ice_adapter *)hw->back; if (!rte_is_unicast_ether_addr ((struct rte_ether_addr *)hw->port_info[0].mac.lan_addr)) { @@ -935,9 +938,9 @@ ice_init_mac_address(struct rte_eth_dev *dev) return -ENOMEM; } /* store it to dev data */ - rte_ether_addr_copy( - (struct rte_ether_addr *)hw->port_info[0].mac.perm_addr, - &dev->data->mac_addrs[0]); + if (ad->devargs.default_mac_disable != 1) + rte_ether_addr_copy((struct rte_ether_addr *)hw->port_info[0].mac.perm_addr, + &dev->data->mac_addrs[0]); return 0; } @@ -962,8 +965,14 @@ ice_add_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *mac_addr) struct ice_mac_filter *f; struct LIST_HEAD_TYPE list_head; struct ice_hw *hw = ICE_VSI_TO_HW(vsi); + struct ice_adapter *ad = (struct ice_adapter *)hw->back; int ret = 0; + if (ad->devargs.default_mac_disable == 1 && rte_is_same_ether_addr(mac_addr, + (struct rte_ether_addr *)hw->port_info[0].mac.perm_addr)) { + PMD_DRV_LOG(ERR, "This Default MAC filter is disabled."); + return 0; + } /* If it's added and configured, return */ f = ice_find_mac_filter(vsi, mac_addr); if (f) { @@ -2075,6 +2084,11 @@ static int ice_parse_devargs(struct rte_eth_dev *dev) if (ret) goto bail; + ret = rte_kvargs_process(kvlist, ICE_DEFAULT_MAC_DISABLE, + &parse_bool, &ad->devargs.default_mac_disable); + if (ret) + goto bail; + ret = rte_kvargs_process(kvlist, ICE_HW_DEBUG_MASK_ARG, &parse_u64, &ad->hw.debug_mask); if (ret) @@ -6050,6 +6064,7 @@ RTE_PMD_REGISTER_PARAM_STRING(net_ice, ICE_PROTO_XTR_ARG "=[queue:]" ICE_SAFE_MODE_SUPPORT_ARG "=<0|1>" ICE_PIPELINE_MODE_SUPPORT_ARG "=<0|1>" + ICE_DEFAULT_MAC_DISABLE "=<0|1>" ICE_RX_LOW_LATENCY_ARG "=<0|1>"); RTE_LOG_REGISTER_SUFFIX(ice_logtype_init, init, NOTICE); diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index c8311be179..9140f3af79 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -563,6 +563,7 @@ struct ice_devargs { int safe_mode_support; uint8_t proto_xtr_dflt; int pipe_mode_support; + uint8_t default_mac_disable; uint8_t proto_xtr[ICE_MAX_QUEUE_NUM]; uint8_t pin_idx; uint8_t pps_out_ena; -- 2.25.1