From patchwork Fri Apr 29 09:19:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Liu X-Patchwork-Id: 110460 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 164F5A0093; Fri, 29 Apr 2022 03:22:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 07AEE4281C; Fri, 29 Apr 2022 03:22:29 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id C2E36410E3 for ; Fri, 29 Apr 2022 03:22:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651195342; x=1682731342; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RAa+apHcTp9O+RYMbi4sG4AScyabm2VxBAfd6Ubq3vg=; b=dZaipDmmUytGJkY2h0f+KdX/AgelOFWgOzkMa5b5eZZh8kzVRyUq6Zum 7mlVwJXwtTA/CP3qZEDy8GlLcSTAKdkoIh2Fkh11Uk/MFF7tBz5U1+V/S 7HggD5khjKqOqmYTf/QEMcnFBLaYg7hKRHTTzsGA8N5HQuw4+cpuz3rlP ldDPPS9NeWonIL49xhO7Dar7qOwY4NfbKGzf4dE+Np0qOYTuUTyZ+bbxn CsgVXkQOMN4okT8yzJxlyepkfGBzmHHx4FGh/R4vzVXSEtswPz7e8bWSc +lSf0m9hBZ7Uh1FMIBv97dOTrs8W51wPD6Or0yzlXeFLqC98v9JbfCKpP A==; X-IronPort-AV: E=McAfee;i="6400,9594,10331"; a="266013642" X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="266013642" 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:21 -0700 X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="581767752" 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:19 -0700 From: Kevin Liu To: dev@dpdk.org Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, stevex.yang@intel.com, Kevin Liu Subject: [PATCH v7 01/12] net/ice: support for RSS RETA configure in DCF mode Date: Fri, 29 Apr 2022 09:19:47 +0000 Message-Id: <20220429091958.3103384-2-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 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: Steve Yang RSS RETA should be updated and queried by application, Add related ops ('.reta_update', '.reta_query') for DCF. Signed-off-by: Steve Yang Signed-off-by: Kevin Liu --- doc/guides/nics/features/ice_dcf.ini | 1 + doc/guides/rel_notes/release_22_07.rst | 3 + drivers/net/ice/ice_dcf.c | 2 +- drivers/net/ice/ice_dcf.h | 1 + drivers/net/ice/ice_dcf_ethdev.c | 77 ++++++++++++++++++++++++++ 5 files changed, 83 insertions(+), 1 deletion(-) diff --git a/doc/guides/nics/features/ice_dcf.ini b/doc/guides/nics/features/ice_dcf.ini index 54073f0b88..5221c99a9c 100644 --- a/doc/guides/nics/features/ice_dcf.ini +++ b/doc/guides/nics/features/ice_dcf.ini @@ -15,6 +15,7 @@ L3 checksum offload = P L4 checksum offload = P Inner L3 checksum = P Inner L4 checksum = P +RSS reta update = 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 90123bb807..1f07d3e1b3 100644 --- a/doc/guides/rel_notes/release_22_07.rst +++ b/doc/guides/rel_notes/release_22_07.rst @@ -60,6 +60,9 @@ New Features * Added Tx QoS queue rate limitation support. * Added quanta size configuration support. +* **Updated Intel ice driver.** + + * Added support for RSS RETA configure in DCF mode. Removed Items ------------- diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index 7f0c074b01..070d1b71ac 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -790,7 +790,7 @@ ice_dcf_configure_rss_key(struct ice_dcf_hw *hw) return err; } -static int +int ice_dcf_configure_rss_lut(struct ice_dcf_hw *hw) { struct virtchnl_rss_lut *rss_lut; diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h index 6ec766ebda..b2c6aa2684 100644 --- a/drivers/net/ice/ice_dcf.h +++ b/drivers/net/ice/ice_dcf.h @@ -122,6 +122,7 @@ int ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc, int ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw); int ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw); void ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw); +int ice_dcf_configure_rss_lut(struct ice_dcf_hw *hw); int ice_dcf_init_rss(struct ice_dcf_hw *hw); int ice_dcf_configure_queues(struct ice_dcf_hw *hw); int ice_dcf_config_irq_map(struct ice_dcf_hw *hw); diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index 59610e058f..1ac66ed990 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -761,6 +761,81 @@ ice_dcf_dev_flow_ops_get(struct rte_eth_dev *dev, return 0; } +static int +ice_dcf_dev_rss_reta_update(struct rte_eth_dev *dev, + struct rte_eth_rss_reta_entry64 *reta_conf, + uint16_t reta_size) +{ + struct ice_dcf_adapter *adapter = dev->data->dev_private; + struct ice_dcf_hw *hw = &adapter->real_hw; + uint8_t *lut; + uint16_t i, idx, shift; + int ret; + + if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF)) + return -ENOTSUP; + + if (reta_size != hw->vf_res->rss_lut_size) { + PMD_DRV_LOG(ERR, "The size of hash lookup table configured " + "(%d) doesn't match the number of hardware can " + "support (%d)", reta_size, hw->vf_res->rss_lut_size); + return -EINVAL; + } + + lut = rte_zmalloc("rss_lut", reta_size, 0); + if (!lut) { + PMD_DRV_LOG(ERR, "No memory can be allocated"); + return -ENOMEM; + } + /* store the old lut table temporarily */ + rte_memcpy(lut, hw->rss_lut, reta_size); + + for (i = 0; i < reta_size; i++) { + idx = i / RTE_ETH_RETA_GROUP_SIZE; + shift = i % RTE_ETH_RETA_GROUP_SIZE; + if (reta_conf[idx].mask & (1ULL << shift)) + lut[i] = reta_conf[idx].reta[shift]; + } + + rte_memcpy(hw->rss_lut, lut, reta_size); + /* send virtchnnl ops to configure rss*/ + ret = ice_dcf_configure_rss_lut(hw); + if (ret) /* revert back */ + rte_memcpy(hw->rss_lut, lut, reta_size); + rte_free(lut); + + return ret; +} + +static int +ice_dcf_dev_rss_reta_query(struct rte_eth_dev *dev, + struct rte_eth_rss_reta_entry64 *reta_conf, + uint16_t reta_size) +{ + struct ice_dcf_adapter *adapter = dev->data->dev_private; + struct ice_dcf_hw *hw = &adapter->real_hw; + uint16_t i, idx, shift; + + if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF)) + return -ENOTSUP; + + if (reta_size != hw->vf_res->rss_lut_size) { + PMD_DRV_LOG(ERR, "The size of hash lookup table configured " + "(%d) doesn't match the number of hardware can " + "support (%d)", reta_size, hw->vf_res->rss_lut_size); + return -EINVAL; + } + + for (i = 0; i < reta_size; i++) { + idx = i / RTE_ETH_RETA_GROUP_SIZE; + shift = i % RTE_ETH_RETA_GROUP_SIZE; + if (reta_conf[idx].mask & (1ULL << shift)) + reta_conf[idx].reta[shift] = hw->rss_lut[i]; + } + + return 0; +} + #define ICE_DCF_32_BIT_WIDTH (CHAR_BIT * 4) #define ICE_DCF_48_BIT_WIDTH (CHAR_BIT * 6) #define ICE_DCF_48_BIT_MASK RTE_LEN2MASK(ICE_DCF_48_BIT_WIDTH, uint64_t) @@ -1107,6 +1182,8 @@ static const struct eth_dev_ops ice_dcf_eth_dev_ops = { .udp_tunnel_port_add = ice_dcf_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ice_dcf_dev_udp_tunnel_port_del, .tm_ops_get = ice_dcf_tm_ops_get, + .reta_update = ice_dcf_dev_rss_reta_update, + .reta_query = ice_dcf_dev_rss_reta_query, }; static int From patchwork Fri Apr 29 09:19:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Liu X-Patchwork-Id: 110461 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 97B81A0093; Fri, 29 Apr 2022 03:22:34 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 228CC4282B; Fri, 29 Apr 2022 03:22:30 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 04AE64281C for ; Fri, 29 Apr 2022 03:22:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651195344; x=1682731344; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0p6zks75Mo867icsNU85Q8yLBOYrAwdOlwpopWmZEg0=; b=XgqLa8Xq+yJyuYBSL0nxn5r8TDaoME8l86F9ks9qSAVp6UPxAinZkBhE HuOehTzQCG9OQfwUiA6BDyyqFkuu906pyZEyFUtA6Ss+i4hJhjkXS9DdW LQnUKa+YxfWEkWAoCasuJ3NDkDHNoHATnYdOfJHw5dk4gm1fjYgYz6Ysn leFviWmQvF2pWjZqay8d+Aqb5ooJasm10aOKIwRS8kW0+BM6N5ZrMFTfQ yUPqrxyGSHScUJRdH30s4U3y8TSuyJ3vqg0KVG5i8dRjSHZ8LiJV4Fuet mtnfLRaOyC63C47q4xy7OR3KOSDRjo8tk4rxrstkcoR1pnJUki/acNGMW A==; X-IronPort-AV: E=McAfee;i="6400,9594,10331"; a="266013650" X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="266013650" 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:23 -0700 X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="581767776" 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:21 -0700 From: Kevin Liu To: dev@dpdk.org Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, stevex.yang@intel.com, Kevin Liu Subject: [PATCH v7 02/12] net/ice: support for RSS HASH configure in DCF mode Date: Fri, 29 Apr 2022 09:19:48 +0000 Message-Id: <20220429091958.3103384-3-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 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: Steve Yang RSS HASH should be updated and queried by application, Add related ops ('.rss_hash_update', '.rss_hash_conf_get') for DCF. Because DCF doesn't support configure RSS HASH, only HASH key can be updated within ops '.rss_hash_update'. Signed-off-by: Steve Yang Signed-off-by: Kevin Liu --- doc/guides/nics/features/ice_dcf.ini | 1 + doc/guides/rel_notes/release_22_07.rst | 1 + drivers/net/ice/ice_dcf.c | 2 +- drivers/net/ice/ice_dcf.h | 1 + drivers/net/ice/ice_dcf_ethdev.c | 51 ++++++++++++++++++++++++++ 5 files changed, 55 insertions(+), 1 deletion(-) diff --git a/doc/guides/nics/features/ice_dcf.ini b/doc/guides/nics/features/ice_dcf.ini index 5221c99a9c..d9c1b25407 100644 --- a/doc/guides/nics/features/ice_dcf.ini +++ b/doc/guides/nics/features/ice_dcf.ini @@ -16,6 +16,7 @@ L4 checksum offload = P Inner L3 checksum = P Inner L4 checksum = P RSS reta update = Y +RSS key update = 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 1f07d3e1b3..866af8c0b3 100644 --- a/doc/guides/rel_notes/release_22_07.rst +++ b/doc/guides/rel_notes/release_22_07.rst @@ -63,6 +63,7 @@ New Features * **Updated Intel ice driver.** * Added support for RSS RETA configure in DCF mode. + * Added support for RSS HASH configure in DCF mode. Removed Items ------------- diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index 070d1b71ac..89c0203ba3 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -758,7 +758,7 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) hw->ets_config = NULL; } -static int +int ice_dcf_configure_rss_key(struct ice_dcf_hw *hw) { struct virtchnl_rss_key *rss_key; diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h index b2c6aa2684..f0b45af5ae 100644 --- a/drivers/net/ice/ice_dcf.h +++ b/drivers/net/ice/ice_dcf.h @@ -122,6 +122,7 @@ int ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc, int ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw); int ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw); void ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw); +int ice_dcf_configure_rss_key(struct ice_dcf_hw *hw); int ice_dcf_configure_rss_lut(struct ice_dcf_hw *hw); int ice_dcf_init_rss(struct ice_dcf_hw *hw); int ice_dcf_configure_queues(struct ice_dcf_hw *hw); diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index 1ac66ed990..ccad7fc304 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -836,6 +836,55 @@ ice_dcf_dev_rss_reta_query(struct rte_eth_dev *dev, return 0; } +static int +ice_dcf_dev_rss_hash_update(struct rte_eth_dev *dev, + struct rte_eth_rss_conf *rss_conf) +{ + struct ice_dcf_adapter *adapter = dev->data->dev_private; + struct ice_dcf_hw *hw = &adapter->real_hw; + + if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF)) + return -ENOTSUP; + + /* HENA setting, it is enabled by default, no change */ + if (!rss_conf->rss_key || rss_conf->rss_key_len == 0) { + PMD_DRV_LOG(DEBUG, "No key to be configured"); + return 0; + } else if (rss_conf->rss_key_len != hw->vf_res->rss_key_size) { + PMD_DRV_LOG(ERR, "The size of hash key configured " + "(%d) doesn't match the size of hardware can " + "support (%d)", rss_conf->rss_key_len, + hw->vf_res->rss_key_size); + return -EINVAL; + } + + rte_memcpy(hw->rss_key, rss_conf->rss_key, rss_conf->rss_key_len); + + return ice_dcf_configure_rss_key(hw); +} + +static int +ice_dcf_dev_rss_hash_conf_get(struct rte_eth_dev *dev, + struct rte_eth_rss_conf *rss_conf) +{ + struct ice_dcf_adapter *adapter = dev->data->dev_private; + struct ice_dcf_hw *hw = &adapter->real_hw; + + if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF)) + return -ENOTSUP; + + /* Just set it to default value now. */ + rss_conf->rss_hf = ICE_RSS_OFFLOAD_ALL; + + if (!rss_conf->rss_key) + return 0; + + rss_conf->rss_key_len = hw->vf_res->rss_key_size; + rte_memcpy(rss_conf->rss_key, hw->rss_key, rss_conf->rss_key_len); + + return 0; +} + #define ICE_DCF_32_BIT_WIDTH (CHAR_BIT * 4) #define ICE_DCF_48_BIT_WIDTH (CHAR_BIT * 6) #define ICE_DCF_48_BIT_MASK RTE_LEN2MASK(ICE_DCF_48_BIT_WIDTH, uint64_t) @@ -1184,6 +1233,8 @@ static const struct eth_dev_ops ice_dcf_eth_dev_ops = { .tm_ops_get = ice_dcf_tm_ops_get, .reta_update = ice_dcf_dev_rss_reta_update, .reta_query = ice_dcf_dev_rss_reta_query, + .rss_hash_update = ice_dcf_dev_rss_hash_update, + .rss_hash_conf_get = ice_dcf_dev_rss_hash_conf_get, }; static int From patchwork Fri Apr 29 09:19:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Liu X-Patchwork-Id: 110462 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 49A6FA0093; Fri, 29 Apr 2022 03:22:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 10DB44282F; Fri, 29 Apr 2022 03:22:31 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 6B7844281C for ; Fri, 29 Apr 2022 03:22:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651195346; x=1682731346; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5FnmNbyjznWNp/QvhpWMhZ+N23zqp246e9Z1lWhhsmg=; b=XOuWNIo/BmXP+ChyuaOnMNJ30+Pi19Mgy9mNT8+FU3Vk5ouei4QC2THE w07sQ0jA9m0/N3btFpXbs6Fztp7rS2LCa9IsYH+chTJuUkLuVcGyRy+2h 2rq25peHGhhM1/5DCKKIsmmwwqY8qamX3z0PS21b3eMO2qpanlCgLWA1k tL43yJi8KleI1SwbsgBHjZs/QniIR/SdYtkld0vaL3qid7tgisjlPiaQ/ v02ouiPu/KF7jCSctTzX4LeDghdW6OTNoWy7QFbWf43amDSpnVd5vpLbI qfuBAvOO9X32+8Q1tq1+q1Y1tG3t23G1LCFm1NovaB+Df2xKkZXC9t9R2 g==; X-IronPort-AV: E=McAfee;i="6400,9594,10331"; a="266013672" X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="266013672" 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:26 -0700 X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="581767801" 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:23 -0700 From: Kevin Liu To: dev@dpdk.org Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, stevex.yang@intel.com, Robin Zhang , Kevin Liu Subject: [PATCH v7 03/12] net/ice: support cleanup Tx buffers in DCF mode Date: Fri, 29 Apr 2022 09:19:49 +0000 Message-Id: <20220429091958.3103384-4-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 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: Robin Zhang Add support for ops rte_eth_tx_done_cleanup in dcf Signed-off-by: Robin Zhang Signed-off-by: Kevin Liu --- drivers/net/ice/ice_dcf_ethdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index ccad7fc304..d8b5961514 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -1235,6 +1235,7 @@ static const struct eth_dev_ops ice_dcf_eth_dev_ops = { .reta_query = ice_dcf_dev_rss_reta_query, .rss_hash_update = ice_dcf_dev_rss_hash_update, .rss_hash_conf_get = ice_dcf_dev_rss_hash_conf_get, + .tx_done_cleanup = ice_tx_done_cleanup, }; static int From patchwork Fri Apr 29 09:19:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Liu X-Patchwork-Id: 110463 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9677FA0093; Fri, 29 Apr 2022 03:22:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 118B742833; Fri, 29 Apr 2022 03:22:36 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 7D8FD42824 for ; Fri, 29 Apr 2022 03:22:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651195349; x=1682731349; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HfXaZqLdVExQqbVcF/5HisiK3yEnonzQidoM0GkTRaw=; b=NETt3yapTbxdXtDwo9IncinPFhhNOXXsdiXW1wE+lRlTQh7xCjZ1Nm40 WatuHsPlUyksQIKmYnUeyF11Y1oASHJU4+6YgMYqxZ3dTyBp5v43SNyI/ aXYKpx2wEDem9wCCKPxuufVNFk+lA7a3Y3n8r6ysS9pllb4bkl4G/YQo2 SgEA1mR2tKpyhVt2qkD9Nd84u+WDTxn06IDaBGI7KpRALnYlPex/6kQoV SWyV2+CZijQaIN+UHHyi3LO1nPmqXF8F8EfeKnfmBF7tM1tgTZ/4qieEw Gg7NlZZdQ93Rvc+YTxne0UQAmdo9rZtDjtxj5T325T1bEPh+I7pBs0JL1 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10331"; a="266013691" X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="266013691" 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:29 -0700 X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="581767833" 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:26 -0700 From: Kevin Liu To: dev@dpdk.org Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, stevex.yang@intel.com, Jie Wang , Kevin Liu Subject: [PATCH v7 04/12] net/ice: support for MTU configure in DCF mode Date: Fri, 29 Apr 2022 09:19:50 +0000 Message-Id: <20220429091958.3103384-5-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 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: Jie Wang add API "mtu_set" to dcf, and it can configure the port mtu through cmdline. Signed-off-by: Jie Wang Signed-off-by: Kevin Liu --- doc/guides/nics/features/ice_dcf.ini | 1 + doc/guides/rel_notes/release_22_07.rst | 1 + drivers/net/ice/ice_dcf_ethdev.c | 14 ++++++++++++++ drivers/net/ice/ice_dcf_ethdev.h | 6 ++++++ 4 files changed, 22 insertions(+) diff --git a/doc/guides/nics/features/ice_dcf.ini b/doc/guides/nics/features/ice_dcf.ini index d9c1b25407..be34ab4692 100644 --- a/doc/guides/nics/features/ice_dcf.ini +++ b/doc/guides/nics/features/ice_dcf.ini @@ -17,6 +17,7 @@ Inner L3 checksum = P Inner L4 checksum = P RSS reta update = Y RSS key update = Y +MTU update = 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 866af8c0b3..3c8412c82e 100644 --- a/doc/guides/rel_notes/release_22_07.rst +++ b/doc/guides/rel_notes/release_22_07.rst @@ -64,6 +64,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. Removed Items ------------- diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index d8b5961514..06d752fd61 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -1081,6 +1081,19 @@ ice_dcf_link_update(struct rte_eth_dev *dev, return rte_eth_linkstatus_set(dev, &new_link); } +static int +ice_dcf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu __rte_unused) +{ + /* mtu setting is forbidden if port is start */ + if (dev->data->dev_started != 0) { + PMD_DRV_LOG(ERR, "port %d must be stopped before configuration", + dev->data->port_id); + return -EBUSY; + } + + return 0; +} + bool ice_dcf_adminq_need_retry(struct ice_adapter *ad) { @@ -1236,6 +1249,7 @@ static const struct eth_dev_ops ice_dcf_eth_dev_ops = { .rss_hash_update = ice_dcf_dev_rss_hash_update, .rss_hash_conf_get = ice_dcf_dev_rss_hash_conf_get, .tx_done_cleanup = ice_tx_done_cleanup, + .mtu_set = ice_dcf_dev_mtu_set, }; static int diff --git a/drivers/net/ice/ice_dcf_ethdev.h b/drivers/net/ice/ice_dcf_ethdev.h index 11a1305038..f2faf26f58 100644 --- a/drivers/net/ice/ice_dcf_ethdev.h +++ b/drivers/net/ice/ice_dcf_ethdev.h @@ -15,6 +15,12 @@ #define ICE_DCF_MAX_RINGS 1 +#define ICE_DCF_FRAME_SIZE_MAX 9728 +#define ICE_DCF_VLAN_TAG_SIZE 4 +#define ICE_DCF_ETH_OVERHEAD \ + (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + ICE_DCF_VLAN_TAG_SIZE * 2) +#define ICE_DCF_ETH_MAX_LEN (RTE_ETHER_MTU + ICE_DCF_ETH_OVERHEAD) + struct ice_dcf_queue { uint64_t dummy; }; From patchwork Fri Apr 29 09:19:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Liu X-Patchwork-Id: 110464 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4CD14A0093; Fri, 29 Apr 2022 03:22:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1252542839; Fri, 29 Apr 2022 03:22:37 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 3A79E42831 for ; Fri, 29 Apr 2022 03:22:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651195351; x=1682731351; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HAg21Ie7KGkUTfzVHs6REN3QEDKJCuyvy8CYzTL9F7A=; b=oBmzXqNdrBEUKwK7uL6DfuVwKERlPFQnwTQyhZRXk2IaSk6+9Vs/9H3V Iay9ANy4jT/Ef5sbjthTJWgnKZqWKyEfbA2w4/HOEh7sRxGj4jXcg+7Ja KbUhI0aq63qXHRA13tRXcUgvoDHrED+OsZNx1MJHINXgqEJUNZsgdFHc3 6QYxKCG0i+xOzmaBVOCk0uBZIenYGHR8ui7ieXUTxeSwcy1k0CecDVfDT KrHAkw2OINbUl88PvKJGabqxpTDpEYstMQQyOXRPkJ2NFbnWHJOK/tsk9 MyFy9lWoh+WRyng5RJdvXuWmcCwx20DUyg53KQGe023rzdQeTA0eVDqOy w==; X-IronPort-AV: E=McAfee;i="6400,9594,10331"; a="266013698" X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="266013698" 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:30 -0700 X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="581767857" 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:28 -0700 From: Kevin Liu To: dev@dpdk.org Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, stevex.yang@intel.com, Jie Wang , Kevin Liu Subject: [PATCH v7 05/12] net/ice: add ops dev-supported-ptypes-get to dcf Date: Fri, 29 Apr 2022 09:19:51 +0000 Message-Id: <20220429091958.3103384-6-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 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: Jie Wang add API "dev_supported_ptypes_get" to dcf, that dcf pmd can get ptypes through the new API. Signed-off-by: Jie Wang Signed-off-by: Kevin Liu --- drivers/net/ice/ice_dcf_ethdev.c | 80 +++++++++++++++++++------------- 1 file changed, 49 insertions(+), 31 deletions(-) diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index 06d752fd61..6a577a6582 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -1218,38 +1218,56 @@ ice_dcf_dev_reset(struct rte_eth_dev *dev) return ret; } +static const uint32_t * +ice_dcf_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused) +{ + static const uint32_t ptypes[] = { + RTE_PTYPE_L2_ETHER, + RTE_PTYPE_L3_IPV4_EXT_UNKNOWN, + RTE_PTYPE_L4_FRAG, + RTE_PTYPE_L4_ICMP, + RTE_PTYPE_L4_NONFRAG, + RTE_PTYPE_L4_SCTP, + RTE_PTYPE_L4_TCP, + RTE_PTYPE_L4_UDP, + RTE_PTYPE_UNKNOWN + }; + return ptypes; +} + static const struct eth_dev_ops ice_dcf_eth_dev_ops = { - .dev_start = ice_dcf_dev_start, - .dev_stop = ice_dcf_dev_stop, - .dev_close = ice_dcf_dev_close, - .dev_reset = ice_dcf_dev_reset, - .dev_configure = ice_dcf_dev_configure, - .dev_infos_get = ice_dcf_dev_info_get, - .rx_queue_setup = ice_rx_queue_setup, - .tx_queue_setup = ice_tx_queue_setup, - .rx_queue_release = ice_dev_rx_queue_release, - .tx_queue_release = ice_dev_tx_queue_release, - .rx_queue_start = ice_dcf_rx_queue_start, - .tx_queue_start = ice_dcf_tx_queue_start, - .rx_queue_stop = ice_dcf_rx_queue_stop, - .tx_queue_stop = ice_dcf_tx_queue_stop, - .link_update = ice_dcf_link_update, - .stats_get = ice_dcf_stats_get, - .stats_reset = ice_dcf_stats_reset, - .promiscuous_enable = ice_dcf_dev_promiscuous_enable, - .promiscuous_disable = ice_dcf_dev_promiscuous_disable, - .allmulticast_enable = ice_dcf_dev_allmulticast_enable, - .allmulticast_disable = ice_dcf_dev_allmulticast_disable, - .flow_ops_get = ice_dcf_dev_flow_ops_get, - .udp_tunnel_port_add = ice_dcf_dev_udp_tunnel_port_add, - .udp_tunnel_port_del = ice_dcf_dev_udp_tunnel_port_del, - .tm_ops_get = ice_dcf_tm_ops_get, - .reta_update = ice_dcf_dev_rss_reta_update, - .reta_query = ice_dcf_dev_rss_reta_query, - .rss_hash_update = ice_dcf_dev_rss_hash_update, - .rss_hash_conf_get = ice_dcf_dev_rss_hash_conf_get, - .tx_done_cleanup = ice_tx_done_cleanup, - .mtu_set = ice_dcf_dev_mtu_set, + .dev_start = ice_dcf_dev_start, + .dev_stop = ice_dcf_dev_stop, + .dev_close = ice_dcf_dev_close, + .dev_reset = ice_dcf_dev_reset, + .dev_configure = ice_dcf_dev_configure, + .dev_infos_get = ice_dcf_dev_info_get, + .dev_supported_ptypes_get = ice_dcf_dev_supported_ptypes_get, + .rx_queue_setup = ice_rx_queue_setup, + .tx_queue_setup = ice_tx_queue_setup, + .rx_queue_release = ice_dev_rx_queue_release, + .tx_queue_release = ice_dev_tx_queue_release, + .rx_queue_start = ice_dcf_rx_queue_start, + .tx_queue_start = ice_dcf_tx_queue_start, + .rx_queue_stop = ice_dcf_rx_queue_stop, + .tx_queue_stop = ice_dcf_tx_queue_stop, + .link_update = ice_dcf_link_update, + .stats_get = ice_dcf_stats_get, + .stats_reset = ice_dcf_stats_reset, + .promiscuous_enable = ice_dcf_dev_promiscuous_enable, + .promiscuous_disable = ice_dcf_dev_promiscuous_disable, + .allmulticast_enable = ice_dcf_dev_allmulticast_enable, + .allmulticast_disable = ice_dcf_dev_allmulticast_disable, + .flow_ops_get = ice_dcf_dev_flow_ops_get, + .udp_tunnel_port_add = ice_dcf_dev_udp_tunnel_port_add, + .udp_tunnel_port_del = ice_dcf_dev_udp_tunnel_port_del, + .tm_ops_get = ice_dcf_tm_ops_get, + .reta_update = ice_dcf_dev_rss_reta_update, + .reta_query = ice_dcf_dev_rss_reta_query, + .rss_hash_update = ice_dcf_dev_rss_hash_update, + .rss_hash_conf_get = ice_dcf_dev_rss_hash_conf_get, + .tx_done_cleanup = ice_tx_done_cleanup, + .mtu_set = ice_dcf_dev_mtu_set, }; static int From patchwork Fri Apr 29 09:19:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Liu X-Patchwork-Id: 110465 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org 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 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; }; From patchwork Fri Apr 29 09:19:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Liu X-Patchwork-Id: 110466 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9C7CEA0093; Fri, 29 Apr 2022 03:23:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 868AA42831; Fri, 29 Apr 2022 03:23:07 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 2687D4282D for ; Fri, 29 Apr 2022 03:23:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651195386; x=1682731386; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5y0F+u1p3D7obAtNvw9p8qJg0GC3ZZ6N473PbYe2V24=; b=W1SkFBVz8iePaHxd5M8XjmfM0X4XS1iUWpuczkhbIU7r+3/2HjDCboqH wwnK96P/jL6nR8KkkVWS8NFjJTflh0Hb/9etyQlDMoyO6BLpxFia/urlu COkSiCAPpxZf/LOu+iyw8zJIstHOp1ILlJnksK74814PPP3YOv/ypmYnh VDXCfWp8ZadQhDlSMs3sC2RhHBwrYtDeB9iL6EN33ULh8qB+jh1PVxIMk 4TdD5Py9w/T7Y6MxHW+450gItgBtbdZR4TVwk5f0EN7N3WtCduoiwYqM8 eOI5J1eXC9sRrLyxLeYrahLpAiiH1z3nBM4+94IdCBT9A/89Oet6fCMmS A==; X-IronPort-AV: E=McAfee;i="6400,9594,10331"; a="352918636" X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="352918636" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2022 18:23:05 -0700 X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="581767938" 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:33 -0700 From: Kevin Liu To: dev@dpdk.org Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, stevex.yang@intel.com, Kevin Liu , Alvin Zhang Subject: [PATCH v7 07/12] net/ice: support dcf MAC configuration Date: Fri, 29 Apr 2022 09:19:53 +0000 Message-Id: <20220429091958.3103384-8-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 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 Below PMD ops are supported in this patch: .mac_addr_add = dcf_dev_add_mac_addr .mac_addr_remove = dcf_dev_del_mac_addr .set_mc_addr_list = dcf_set_mc_addr_list .mac_addr_set = dcf_dev_set_default_mac_addr Signed-off-by: Alvin Zhang Signed-off-by: Kevin Liu --- doc/guides/nics/features/ice_dcf.ini | 1 + doc/guides/rel_notes/release_22_07.rst | 1 + drivers/net/ice/ice_dcf.c | 9 +- drivers/net/ice/ice_dcf.h | 4 +- drivers/net/ice/ice_dcf_ethdev.c | 218 ++++++++++++++++++++++++- drivers/net/ice/ice_dcf_ethdev.h | 5 +- 6 files changed, 228 insertions(+), 10 deletions(-) diff --git a/doc/guides/nics/features/ice_dcf.ini b/doc/guides/nics/features/ice_dcf.ini index fe3ada8733..c9bdbcd6cc 100644 --- a/doc/guides/nics/features/ice_dcf.ini +++ b/doc/guides/nics/features/ice_dcf.ini @@ -20,6 +20,7 @@ RSS key update = Y MTU update = Y Promiscuous mode = Y Allmulticast mode = Y +Unicast MAC filter = 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 f23e5cafd1..97517d303e 100644 --- a/doc/guides/rel_notes/release_22_07.rst +++ b/doc/guides/rel_notes/release_22_07.rst @@ -66,6 +66,7 @@ New Features * 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. + * Added support for MAC configuration in DCF mode. Removed Items ------------- diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index 89c0203ba3..55ae68c456 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -1089,10 +1089,11 @@ ice_dcf_query_stats(struct ice_dcf_hw *hw, } int -ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add) +ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, + struct rte_ether_addr *addr, + bool add, uint8_t type) { struct virtchnl_ether_addr_list *list; - struct rte_ether_addr *addr; struct dcf_virtchnl_cmd args; int len, err = 0; @@ -1105,7 +1106,6 @@ ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add) } len = sizeof(struct virtchnl_ether_addr_list); - addr = hw->eth_dev->data->mac_addrs; len += sizeof(struct virtchnl_ether_addr); list = rte_zmalloc(NULL, len, 0); @@ -1116,9 +1116,10 @@ ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add) rte_memcpy(list->list[0].addr, addr->addr_bytes, sizeof(addr->addr_bytes)); + PMD_DRV_LOG(DEBUG, "add/rm mac:" RTE_ETHER_ADDR_PRT_FMT, RTE_ETHER_ADDR_BYTES(addr)); - + list->list[0].type = type; list->vsi_id = hw->vsi_res->vsi_id; list->num_elements = 1; diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h index f0b45af5ae..78df202a77 100644 --- a/drivers/net/ice/ice_dcf.h +++ b/drivers/net/ice/ice_dcf.h @@ -131,7 +131,9 @@ int ice_dcf_switch_queue(struct ice_dcf_hw *hw, uint16_t qid, bool rx, bool on); int ice_dcf_disable_queues(struct ice_dcf_hw *hw); int ice_dcf_query_stats(struct ice_dcf_hw *hw, struct virtchnl_eth_stats *pstats); -int ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add); +int ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, + struct rte_ether_addr *addr, bool add, + uint8_t type); int ice_dcf_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete); void ice_dcf_tm_conf_init(struct rte_eth_dev *dev); diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index 87d281ee93..0d944f9fd2 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -26,6 +26,12 @@ #include "ice_dcf_ethdev.h" #include "ice_rxtx.h" +#define DCF_NUM_MACADDR_MAX 64 + +static int dcf_add_del_mc_addr_list(struct ice_dcf_hw *hw, + struct rte_ether_addr *mc_addrs, + uint32_t mc_addrs_num, bool add); + static int ice_dcf_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, struct rte_eth_udp_tunnel *udp_tunnel); @@ -561,12 +567,22 @@ ice_dcf_dev_start(struct rte_eth_dev *dev) return ret; } - ret = ice_dcf_add_del_all_mac_addr(hw, true); + ret = ice_dcf_add_del_all_mac_addr(hw, hw->eth_dev->data->mac_addrs, + true, VIRTCHNL_ETHER_ADDR_PRIMARY); if (ret) { PMD_DRV_LOG(ERR, "Failed to add mac addr"); return ret; } + if (dcf_ad->mc_addrs_num) { + /* flush previous addresses */ + ret = dcf_add_del_mc_addr_list(hw, dcf_ad->mc_addrs, + dcf_ad->mc_addrs_num, true); + if (ret) + return ret; + } + + dev->data->dev_link.link_status = RTE_ETH_LINK_UP; return 0; @@ -625,7 +641,16 @@ ice_dcf_dev_stop(struct rte_eth_dev *dev) rte_intr_efd_disable(intr_handle); rte_intr_vec_list_free(intr_handle); - ice_dcf_add_del_all_mac_addr(&dcf_ad->real_hw, false); + ice_dcf_add_del_all_mac_addr(&dcf_ad->real_hw, + dcf_ad->real_hw.eth_dev->data->mac_addrs, + false, VIRTCHNL_ETHER_ADDR_PRIMARY); + + if (dcf_ad->mc_addrs_num) + /* flush previous addresses */ + (void)dcf_add_del_mc_addr_list(&dcf_ad->real_hw, + dcf_ad->mc_addrs, + dcf_ad->mc_addrs_num, false); + dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN; ad->pf.adapter_stopped = 1; hw->tm_conf.committed = false; @@ -655,7 +680,7 @@ ice_dcf_dev_info_get(struct rte_eth_dev *dev, struct ice_dcf_adapter *adapter = dev->data->dev_private; struct ice_dcf_hw *hw = &adapter->real_hw; - dev_info->max_mac_addrs = 1; + dev_info->max_mac_addrs = DCF_NUM_MACADDR_MAX; dev_info->max_rx_queues = hw->vsi_res->num_queue_pairs; dev_info->max_tx_queues = hw->vsi_res->num_queue_pairs; dev_info->min_rx_bufsize = ICE_BUF_SIZE_MIN; @@ -818,6 +843,189 @@ ice_dcf_dev_allmulticast_disable(__rte_unused struct rte_eth_dev *dev) false); } +static int +dcf_dev_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr, + __rte_unused uint32_t index, + __rte_unused uint32_t pool) +{ + struct ice_dcf_adapter *adapter = dev->data->dev_private; + int err; + + if (rte_is_zero_ether_addr(addr)) { + PMD_DRV_LOG(ERR, "Invalid Ethernet Address"); + return -EINVAL; + } + + err = ice_dcf_add_del_all_mac_addr(&adapter->real_hw, addr, true, + VIRTCHNL_ETHER_ADDR_EXTRA); + if (err) { + PMD_DRV_LOG(ERR, "fail to add MAC address"); + return err; + } + + return 0; +} + +static void +dcf_dev_del_mac_addr(struct rte_eth_dev *dev, uint32_t index) +{ + struct ice_dcf_adapter *adapter = dev->data->dev_private; + struct rte_ether_addr *addr = &dev->data->mac_addrs[index]; + int err; + + err = ice_dcf_add_del_all_mac_addr(&adapter->real_hw, addr, false, + VIRTCHNL_ETHER_ADDR_EXTRA); + if (err) + PMD_DRV_LOG(ERR, "fail to remove MAC address"); +} + +static int +dcf_add_del_mc_addr_list(struct ice_dcf_hw *hw, + struct rte_ether_addr *mc_addrs, + uint32_t mc_addrs_num, bool add) +{ + struct virtchnl_ether_addr_list *list; + struct dcf_virtchnl_cmd args; + uint32_t i; + int len, err = 0; + + len = sizeof(struct virtchnl_ether_addr_list); + len += sizeof(struct virtchnl_ether_addr) * mc_addrs_num; + + list = rte_zmalloc(NULL, len, 0); + if (!list) { + PMD_DRV_LOG(ERR, "fail to allocate memory"); + return -ENOMEM; + } + + for (i = 0; i < mc_addrs_num; i++) { + memcpy(list->list[i].addr, mc_addrs[i].addr_bytes, + sizeof(list->list[i].addr)); + list->list[i].type = VIRTCHNL_ETHER_ADDR_EXTRA; + } + + list->vsi_id = hw->vsi_res->vsi_id; + list->num_elements = mc_addrs_num; + + memset(&args, 0, sizeof(args)); + args.v_op = add ? VIRTCHNL_OP_ADD_ETH_ADDR : + VIRTCHNL_OP_DEL_ETH_ADDR; + args.req_msg = (uint8_t *)list; + args.req_msglen = len; + err = ice_dcf_execute_virtchnl_cmd(hw, &args); + if (err) + PMD_DRV_LOG(ERR, "fail to execute command %s", + add ? "OP_ADD_ETHER_ADDRESS" : + "OP_DEL_ETHER_ADDRESS"); + rte_free(list); + return err; +} + +static int +dcf_set_mc_addr_list(struct rte_eth_dev *dev, + struct rte_ether_addr *mc_addrs, + uint32_t mc_addrs_num) +{ + struct ice_dcf_adapter *adapter = dev->data->dev_private; + struct ice_dcf_hw *hw = &adapter->real_hw; + uint32_t i; + int ret; + + + if (mc_addrs_num > DCF_NUM_MACADDR_MAX) { + PMD_DRV_LOG(ERR, + "can't add more than a limited number (%u) of addresses.", + (uint32_t)DCF_NUM_MACADDR_MAX); + return -EINVAL; + } + + for (i = 0; i < mc_addrs_num; i++) { + if (!rte_is_multicast_ether_addr(&mc_addrs[i])) { + const uint8_t *mac = mc_addrs[i].addr_bytes; + + PMD_DRV_LOG(ERR, + "Invalid mac: %02x:%02x:%02x:%02x:%02x:%02x", + mac[0], mac[1], mac[2], mac[3], mac[4], + mac[5]); + return -EINVAL; + } + } + + if (adapter->mc_addrs_num) { + /* flush previous addresses */ + ret = dcf_add_del_mc_addr_list(hw, adapter->mc_addrs, + adapter->mc_addrs_num, false); + if (ret) + return ret; + } + if (!mc_addrs_num) { + adapter->mc_addrs_num = 0; + return 0; + } + + /* add new ones */ + ret = dcf_add_del_mc_addr_list(hw, mc_addrs, mc_addrs_num, true); + if (ret) { + /* if adding mac address list fails, should add the + * previous addresses back. + */ + if (adapter->mc_addrs_num) + (void)dcf_add_del_mc_addr_list(hw, adapter->mc_addrs, + adapter->mc_addrs_num, + true); + return ret; + } + adapter->mc_addrs_num = mc_addrs_num; + memcpy(adapter->mc_addrs, + mc_addrs, mc_addrs_num * sizeof(*mc_addrs)); + + return 0; +} + +static int +dcf_dev_set_default_mac_addr(struct rte_eth_dev *dev, + struct rte_ether_addr *mac_addr) +{ + struct ice_dcf_adapter *adapter = dev->data->dev_private; + struct ice_dcf_hw *hw = &adapter->real_hw; + struct rte_ether_addr *old_addr; + int ret; + + old_addr = hw->eth_dev->data->mac_addrs; + if (rte_is_same_ether_addr(old_addr, mac_addr)) + return 0; + + ret = ice_dcf_add_del_all_mac_addr(&adapter->real_hw, old_addr, false, + VIRTCHNL_ETHER_ADDR_PRIMARY); + if (ret) + PMD_DRV_LOG(ERR, "Fail to delete old MAC:" + " %02X:%02X:%02X:%02X:%02X:%02X", + old_addr->addr_bytes[0], + old_addr->addr_bytes[1], + old_addr->addr_bytes[2], + old_addr->addr_bytes[3], + old_addr->addr_bytes[4], + old_addr->addr_bytes[5]); + + ret = ice_dcf_add_del_all_mac_addr(&adapter->real_hw, mac_addr, true, + VIRTCHNL_ETHER_ADDR_PRIMARY); + if (ret) + PMD_DRV_LOG(ERR, "Fail to add new MAC:" + " %02X:%02X:%02X:%02X:%02X:%02X", + mac_addr->addr_bytes[0], + mac_addr->addr_bytes[1], + mac_addr->addr_bytes[2], + mac_addr->addr_bytes[3], + mac_addr->addr_bytes[4], + mac_addr->addr_bytes[5]); + + if (ret) + return -EIO; + + rte_ether_addr_copy(mac_addr, hw->eth_dev->data->mac_addrs); + return 0; +} + static int ice_dcf_dev_flow_ops_get(struct rte_eth_dev *dev, const struct rte_flow_ops **ops) @@ -1326,6 +1534,10 @@ static const struct eth_dev_ops ice_dcf_eth_dev_ops = { .promiscuous_disable = ice_dcf_dev_promiscuous_disable, .allmulticast_enable = ice_dcf_dev_allmulticast_enable, .allmulticast_disable = ice_dcf_dev_allmulticast_disable, + .mac_addr_add = dcf_dev_add_mac_addr, + .mac_addr_remove = dcf_dev_del_mac_addr, + .set_mc_addr_list = dcf_set_mc_addr_list, + .mac_addr_set = dcf_dev_set_default_mac_addr, .flow_ops_get = ice_dcf_dev_flow_ops_get, .udp_tunnel_port_add = ice_dcf_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ice_dcf_dev_udp_tunnel_port_del, diff --git a/drivers/net/ice/ice_dcf_ethdev.h b/drivers/net/ice/ice_dcf_ethdev.h index 22e450527b..27f6402786 100644 --- a/drivers/net/ice/ice_dcf_ethdev.h +++ b/drivers/net/ice/ice_dcf_ethdev.h @@ -14,7 +14,7 @@ #include "ice_dcf.h" #define ICE_DCF_MAX_RINGS 1 - +#define DCF_NUM_MACADDR_MAX 64 #define ICE_DCF_FRAME_SIZE_MAX 9728 #define ICE_DCF_VLAN_TAG_SIZE 4 #define ICE_DCF_ETH_OVERHEAD \ @@ -35,7 +35,8 @@ struct ice_dcf_adapter { bool promisc_unicast_enabled; bool promisc_multicast_enabled; - + uint32_t mc_addrs_num; + struct rte_ether_addr mc_addrs[DCF_NUM_MACADDR_MAX]; int num_reprs; struct ice_dcf_repr_info *repr_infos; }; From patchwork Fri Apr 29 09:19:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Liu X-Patchwork-Id: 110469 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E36CFA0093; Fri, 29 Apr 2022 03:23:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 794664284F; Fri, 29 Apr 2022 03:23:12 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 0C29F42841 for ; Fri, 29 Apr 2022 03:23:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651195388; x=1682731388; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=66wxK/0urhyavqIISfUQdtM5AfZcws/B2E1HNwYY3bM=; b=krzhLOVqem881//sm7sY6Y1H+gk3ssSu4chUWEj7BP0fo3cDYyFgdr5T QZE+h4GH/27FS7G/2URGPOz4bjtzWRVWmpFYQCQ91PaGKdwOrl9k5NxAY 7MFFNKPUE8UXOBxsy/hpcp5Wtt7+/lRhT0SJM621jfMNJ9h09AupvcUaj v5GHVTlPeAEuuHONa+Wpmg4jU0sEh+hc2QZCmGa5aLEpjeXTdJgSueI3V xx9akeZisuSeFLKw4PbNjLaXTEFv+ZqE/cy4wZf6rHR6m9ruzk4ogIN/8 tEXxROI/hLKuZQCXRWKOddnHi3eS/iFDfLKcmnOSTt+xzfYMir49sp0Y6 Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10331"; a="352918648" X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="352918648" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2022 18:23:07 -0700 X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="581768135" 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:36 -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 08/12] net/ice: support dcf VLAN filter and offload configuration Date: Fri, 29 Apr 2022 09:19:54 +0000 Message-Id: <20220429091958.3103384-9-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 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 Below PMD ops are supported in this patch: .vlan_filter_set = dcf_dev_vlan_filter_set .vlan_offload_set = dcf_dev_vlan_offload_set 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 | 101 +++++++++++++++++++++++++ 3 files changed, 104 insertions(+) diff --git a/doc/guides/nics/features/ice_dcf.ini b/doc/guides/nics/features/ice_dcf.ini index c9bdbcd6cc..01e7527915 100644 --- a/doc/guides/nics/features/ice_dcf.ini +++ b/doc/guides/nics/features/ice_dcf.ini @@ -21,6 +21,8 @@ MTU update = Y Promiscuous mode = Y Allmulticast mode = Y Unicast MAC filter = Y +VLAN filter = Y +VLAN offload = 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 97517d303e..e66f84db9c 100644 --- a/doc/guides/rel_notes/release_22_07.rst +++ b/doc/guides/rel_notes/release_22_07.rst @@ -67,6 +67,7 @@ New Features * Added support for MTU configure in DCF mode. * Added support for promisc configuration in DCF mode. * Added support for MAC configuration in DCF mode. + * Added support for VLAN filter and offload 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 0d944f9fd2..e58cdf47d2 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -1026,6 +1026,105 @@ dcf_dev_set_default_mac_addr(struct rte_eth_dev *dev, return 0; } +static int +dcf_add_del_vlan(struct ice_dcf_hw *hw, uint16_t vlanid, bool add) +{ + struct virtchnl_vlan_filter_list *vlan_list; + uint8_t cmd_buffer[sizeof(struct virtchnl_vlan_filter_list) + + sizeof(uint16_t)]; + struct dcf_virtchnl_cmd args; + int err; + + vlan_list = (struct virtchnl_vlan_filter_list *)cmd_buffer; + vlan_list->vsi_id = hw->vsi_res->vsi_id; + vlan_list->num_elements = 1; + vlan_list->vlan_id[0] = vlanid; + + memset(&args, 0, sizeof(args)); + args.v_op = add ? VIRTCHNL_OP_ADD_VLAN : VIRTCHNL_OP_DEL_VLAN; + args.req_msg = cmd_buffer; + args.req_msglen = sizeof(cmd_buffer); + err = ice_dcf_execute_virtchnl_cmd(hw, &args); + if (err) + PMD_DRV_LOG(ERR, "fail to execute command %s", + add ? "OP_ADD_VLAN" : "OP_DEL_VLAN"); + + return err; +} + +static int +dcf_enable_vlan_strip(struct ice_dcf_hw *hw) +{ + struct dcf_virtchnl_cmd args; + int ret; + + memset(&args, 0, sizeof(args)); + args.v_op = VIRTCHNL_OP_ENABLE_VLAN_STRIPPING; + ret = ice_dcf_execute_virtchnl_cmd(hw, &args); + if (ret) + PMD_DRV_LOG(ERR, + "Failed to execute command of OP_ENABLE_VLAN_STRIPPING"); + + return ret; +} + +static int +dcf_disable_vlan_strip(struct ice_dcf_hw *hw) +{ + struct dcf_virtchnl_cmd args; + int ret; + + memset(&args, 0, sizeof(args)); + args.v_op = VIRTCHNL_OP_DISABLE_VLAN_STRIPPING; + ret = ice_dcf_execute_virtchnl_cmd(hw, &args); + if (ret) + PMD_DRV_LOG(ERR, + "Failed to execute command of OP_DISABLE_VLAN_STRIPPING"); + + return ret; +} + +static int +dcf_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) +{ + struct ice_dcf_adapter *adapter = dev->data->dev_private; + struct ice_dcf_hw *hw = &adapter->real_hw; + int err; + + if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN)) + return -ENOTSUP; + + err = dcf_add_del_vlan(hw, vlan_id, on); + if (err) + return -EIO; + return 0; +} + +static int +dcf_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask) +{ + struct ice_dcf_adapter *adapter = dev->data->dev_private; + struct ice_dcf_hw *hw = &adapter->real_hw; + struct rte_eth_conf *dev_conf = &dev->data->dev_conf; + int err; + + if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN)) + return -ENOTSUP; + + /* Vlan stripping setting */ + if (mask & RTE_ETH_VLAN_STRIP_MASK) { + /* Enable or disable VLAN stripping */ + if (dev_conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_VLAN_STRIP) + err = dcf_enable_vlan_strip(hw); + else + err = dcf_disable_vlan_strip(hw); + + if (err) + return -EIO; + } + return 0; +} + static int ice_dcf_dev_flow_ops_get(struct rte_eth_dev *dev, const struct rte_flow_ops **ops) @@ -1538,6 +1637,8 @@ static const struct eth_dev_ops ice_dcf_eth_dev_ops = { .mac_addr_remove = dcf_dev_del_mac_addr, .set_mc_addr_list = dcf_set_mc_addr_list, .mac_addr_set = dcf_dev_set_default_mac_addr, + .vlan_filter_set = dcf_dev_vlan_filter_set, + .vlan_offload_set = dcf_dev_vlan_offload_set, .flow_ops_get = ice_dcf_dev_flow_ops_get, .udp_tunnel_port_add = ice_dcf_dev_udp_tunnel_port_add, .udp_tunnel_port_del = ice_dcf_dev_udp_tunnel_port_del, From patchwork Fri Apr 29 09:19:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Liu X-Patchwork-Id: 110467 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AC038A0093; Fri, 29 Apr 2022 03:23:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A8ECE4282E; Fri, 29 Apr 2022 03:23:10 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id F037A4281B for ; Fri, 29 Apr 2022 03:23:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651195387; x=1682731387; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Q11qgd/ua7MwSEgWla8agS3Yut8kSlgBjr9tThydEkg=; b=JYpN29yJS5QK4okCIRPSye5aKjH8BxJaBq0nF7DmTlAq6+0AkJqINb1v SvWzYlQuTV3TCst1HgwNymVlsLMXXR6LCxsm9gjx5cTYvaFbhFUEePLr5 YICqjNzPkM9Hg1ys+osfZ7+NICKdwT/MdmstDCAUgcAqMCV0t5+zKeMqC X31LxmU4zba7BCvEk5gcVmhOjwK7rxb2iwkq4rrlnzk4+j2u+ERl6V3a5 EDx347q+aj/ec6Y9QcjdtiKHWAn1sQ7UymbFTw9KTHbDfX/74Qsa7WPcT bDO+b50aUibrv26U4lJJdDHoBNjkhI+DNtRKY7zJMgcA+ZhQP6qy5e/R1 Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10331"; a="352918637" X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="352918637" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2022 18:23:05 -0700 X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="581768140" 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:38 -0700 From: Kevin Liu To: dev@dpdk.org Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, stevex.yang@intel.com, Kevin Liu Subject: [PATCH v7 09/12] net/ice: add extended stats Date: Fri, 29 Apr 2022 09:19:55 +0000 Message-Id: <20220429091958.3103384-10-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 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 Add implementation of xstats() functions in DCF PMD. Signed-off-by: Kevin Liu --- doc/guides/nics/features/ice_dcf.ini | 1 + drivers/net/ice/ice_dcf.h | 22 ++++++++ drivers/net/ice/ice_dcf_ethdev.c | 75 ++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+) diff --git a/doc/guides/nics/features/ice_dcf.ini b/doc/guides/nics/features/ice_dcf.ini index 01e7527915..54ea7f150c 100644 --- a/doc/guides/nics/features/ice_dcf.ini +++ b/doc/guides/nics/features/ice_dcf.ini @@ -23,6 +23,7 @@ Allmulticast mode = Y Unicast MAC filter = Y VLAN filter = Y VLAN offload = Y +Extended stats = Y Basic stats = Y Linux = Y x86-32 = Y diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h index 78df202a77..44a61404c3 100644 --- a/drivers/net/ice/ice_dcf.h +++ b/drivers/net/ice/ice_dcf.h @@ -15,6 +15,12 @@ #include "base/ice_type.h" #include "ice_logs.h" +/* ICE_DCF_DEV_PRIVATE_TO */ +#define ICE_DCF_DEV_PRIVATE_TO_ADAPTER(adapter) \ + ((struct ice_dcf_adapter *)adapter) +#define ICE_DCF_DEV_PRIVATE_TO_VF(adapter) \ + (&((struct ice_dcf_adapter *)adapter)->vf) + struct dcf_virtchnl_cmd { TAILQ_ENTRY(dcf_virtchnl_cmd) next; @@ -74,6 +80,22 @@ struct ice_dcf_tm_conf { bool committed; }; +struct ice_dcf_eth_stats { + u64 rx_bytes; /* gorc */ + u64 rx_unicast; /* uprc */ + u64 rx_multicast; /* mprc */ + u64 rx_broadcast; /* bprc */ + u64 rx_discards; /* rdpc */ + u64 rx_unknown_protocol; /* rupp */ + u64 tx_bytes; /* gotc */ + u64 tx_unicast; /* uptc */ + u64 tx_multicast; /* mptc */ + u64 tx_broadcast; /* bptc */ + u64 tx_discards; /* tdpc */ + u64 tx_errors; /* tepc */ + u64 rx_no_desc; /* repc */ + u64 rx_errors; /* repc */ +}; struct ice_dcf_hw { struct iavf_hw avf; diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index e58cdf47d2..6503700e02 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -45,6 +45,30 @@ ice_dcf_dev_init(struct rte_eth_dev *eth_dev); static int ice_dcf_dev_uninit(struct rte_eth_dev *eth_dev); +struct rte_ice_dcf_xstats_name_off { + char name[RTE_ETH_XSTATS_NAME_SIZE]; + unsigned int offset; +}; + +static const struct rte_ice_dcf_xstats_name_off rte_ice_dcf_stats_strings[] = { + {"rx_bytes", offsetof(struct ice_dcf_eth_stats, rx_bytes)}, + {"rx_unicast_packets", offsetof(struct ice_dcf_eth_stats, rx_unicast)}, + {"rx_multicast_packets", offsetof(struct ice_dcf_eth_stats, rx_multicast)}, + {"rx_broadcast_packets", offsetof(struct ice_dcf_eth_stats, rx_broadcast)}, + {"rx_dropped_packets", offsetof(struct ice_dcf_eth_stats, rx_discards)}, + {"rx_unknown_protocol_packets", offsetof(struct ice_dcf_eth_stats, + rx_unknown_protocol)}, + {"tx_bytes", offsetof(struct ice_dcf_eth_stats, tx_bytes)}, + {"tx_unicast_packets", offsetof(struct ice_dcf_eth_stats, tx_unicast)}, + {"tx_multicast_packets", offsetof(struct ice_dcf_eth_stats, tx_multicast)}, + {"tx_broadcast_packets", offsetof(struct ice_dcf_eth_stats, tx_broadcast)}, + {"tx_dropped_packets", offsetof(struct ice_dcf_eth_stats, tx_discards)}, + {"tx_error_packets", offsetof(struct ice_dcf_eth_stats, tx_errors)}, +}; + +#define ICE_DCF_NB_XSTATS (sizeof(rte_ice_dcf_stats_strings) / \ + sizeof(rte_ice_dcf_stats_strings[0])) + static uint16_t ice_dcf_recv_pkts(__rte_unused void *rx_queue, __rte_unused struct rte_mbuf **bufs, @@ -1358,6 +1382,54 @@ ice_dcf_stats_reset(struct rte_eth_dev *dev) return 0; } +static int ice_dcf_xstats_get_names(__rte_unused struct rte_eth_dev *dev, + struct rte_eth_xstat_name *xstats_names, + __rte_unused unsigned int limit) +{ + unsigned int i; + + if (xstats_names != NULL) + for (i = 0; i < ICE_DCF_NB_XSTATS; i++) { + snprintf(xstats_names[i].name, + sizeof(xstats_names[i].name), + "%s", rte_ice_dcf_stats_strings[i].name); + } + return ICE_DCF_NB_XSTATS; +} + +static int ice_dcf_xstats_get(struct rte_eth_dev *dev, + struct rte_eth_xstat *xstats, unsigned int n) +{ + int ret; + unsigned int i; + struct ice_dcf_adapter *adapter = + ICE_DCF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); + struct ice_dcf_hw *hw = &adapter->real_hw; + struct virtchnl_eth_stats *postats = &hw->eth_stats_offset; + struct virtchnl_eth_stats pnstats; + + if (n < ICE_DCF_NB_XSTATS) + return ICE_DCF_NB_XSTATS; + + ret = ice_dcf_query_stats(hw, &pnstats); + if (ret != 0) + return 0; + + if (!xstats) + return 0; + + ice_dcf_update_stats(postats, &pnstats); + + /* loop over xstats array and values from pstats */ + for (i = 0; i < ICE_DCF_NB_XSTATS; i++) { + xstats[i].id = i; + xstats[i].value = *(uint64_t *)(((char *)&pnstats) + + rte_ice_dcf_stats_strings[i].offset); + } + + return ICE_DCF_NB_XSTATS; +} + static void ice_dcf_free_repr_info(struct ice_dcf_adapter *dcf_adapter) { @@ -1629,6 +1701,9 @@ static const struct eth_dev_ops ice_dcf_eth_dev_ops = { .link_update = ice_dcf_link_update, .stats_get = ice_dcf_stats_get, .stats_reset = ice_dcf_stats_reset, + .xstats_get = ice_dcf_xstats_get, + .xstats_get_names = ice_dcf_xstats_get_names, + .xstats_reset = ice_dcf_stats_reset, .promiscuous_enable = ice_dcf_dev_promiscuous_enable, .promiscuous_disable = ice_dcf_dev_promiscuous_disable, .allmulticast_enable = ice_dcf_dev_allmulticast_enable, From patchwork Fri Apr 29 09:19:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Liu X-Patchwork-Id: 110468 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 51356A0093; Fri, 29 Apr 2022 03:23:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 99A6D4284A; Fri, 29 Apr 2022 03:23:11 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id C5A674281B for ; Fri, 29 Apr 2022 03:23:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651195388; x=1682731388; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Kf5Du6HWCyXhdBO19SVuR2cTZb++ZkTR9FH2B2wSCyY=; b=T9EyuC+uj6WXdYs/lIRZpqXS8RejFec2wsv9Ku0Qn5a1LNk3VTgtYtBH o6i9adQPB4+oo9NqYBs1P91J3DvUa3ddC4DC6TKRhDYkCowXgEwid7kHh gP4bjQhW4xeyIn1JD0Z8Nk/Y1yCKRLhlh5RsOi4b6hAuqOrlqceVpL1pL kup4cnlI7MoSIf1NxaV2zvDOdzLqfbdDig0jRo8t63t/+N6na93R2GQ/f 3mEfezYOFtPlj+PybSGi2OZ262fkmSrEwja+/oqR5keUqtIl6HJhgOmP8 Yt7jU2/oxfmSwFCJtYZdZHnGrq6GRbHxXwb4uOfPiUYbixtUBlrJo+EQD g==; X-IronPort-AV: E=McAfee;i="6400,9594,10331"; a="352918647" X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="352918647" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2022 18:23:07 -0700 X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="581768143" 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:40 -0700 From: Kevin Liu To: dev@dpdk.org Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, stevex.yang@intel.com, Kevin Liu Subject: [PATCH v7 10/12] net/ice: support queue information getting Date: Fri, 29 Apr 2022 09:19:56 +0000 Message-Id: <20220429091958.3103384-11-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 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 Add below ops, rxq_info_get txq_info_get Signed-off-by: Kevin Liu --- drivers/net/ice/ice_dcf_ethdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index 6503700e02..9217392d04 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -1698,6 +1698,8 @@ static const struct eth_dev_ops ice_dcf_eth_dev_ops = { .tx_queue_start = ice_dcf_tx_queue_start, .rx_queue_stop = ice_dcf_rx_queue_stop, .tx_queue_stop = ice_dcf_tx_queue_stop, + .rxq_info_get = ice_rxq_info_get, + .txq_info_get = ice_txq_info_get, .link_update = ice_dcf_link_update, .stats_get = ice_dcf_stats_get, .stats_reset = ice_dcf_stats_reset, From patchwork Fri Apr 29 09:19:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Liu X-Patchwork-Id: 110470 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 43169A0093; Fri, 29 Apr 2022 03:23:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6478B4282B; Fri, 29 Apr 2022 03:23:16 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 8C63942848 for ; Fri, 29 Apr 2022 03:23:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651195391; x=1682731391; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pxI5262n7+wVmFVcDK3A0WFhBnN4FQSx+hEuzYQxjjg=; b=gAAJIgBt/TFYOPi64Nw1URgRdVSxUNJ7ecxfS78t9KR14QzWiCyQlmtD wYbP3AMVbmPfSAsjIy+nWgGeJysAR5jWdwCG+7j8V6qOSBwcMWQb0pq/C IDg/u/vUU7RVHDwrg7B+X9wZF6Ulb3pRoEa+H5gQ7F/wpwXzdcJEiyiyG vaIIDJ7tnzrKLeFguvFr4hOk40Fu8bIjhmchWrC+VWtQI8q43jNlfESHD 0EGvs5oxDCm4MQicJTwU4zZET92U0G8bebx5UdXS0OasQ0qR1Mcvr9LvQ k1sMUPIM+87H0ooYFv82NjI8c3BairqBP5miYFRWk/41QrJOpoz4iCDfZ w==; X-IronPort-AV: E=McAfee;i="6400,9594,10331"; a="248419761" X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="248419761" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2022 18:23:10 -0700 X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="581768148" 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:43 -0700 From: Kevin Liu To: dev@dpdk.org Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, stevex.yang@intel.com, Kevin Liu Subject: [PATCH v7 11/12] net/ice: add implement power management Date: Fri, 29 Apr 2022 09:19:57 +0000 Message-Id: <20220429091958.3103384-12-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 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 Implement support for the power management API by implementing a 'get_monitor_addr' function that will return an address of an RX ring's status bit. Signed-off-by: Kevin Liu --- doc/guides/nics/features/ice_dcf.ini | 1 + drivers/net/ice/ice_dcf_ethdev.c | 1 + 2 files changed, 2 insertions(+) diff --git a/doc/guides/nics/features/ice_dcf.ini b/doc/guides/nics/features/ice_dcf.ini index 54ea7f150c..3b11622d4c 100644 --- a/doc/guides/nics/features/ice_dcf.ini +++ b/doc/guides/nics/features/ice_dcf.ini @@ -25,6 +25,7 @@ VLAN filter = Y VLAN offload = Y Extended stats = Y Basic stats = Y +Power mgmt address monitor = Y Linux = Y x86-32 = Y x86-64 = Y diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index 9217392d04..236c0395e0 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -1700,6 +1700,7 @@ static const struct eth_dev_ops ice_dcf_eth_dev_ops = { .tx_queue_stop = ice_dcf_tx_queue_stop, .rxq_info_get = ice_rxq_info_get, .txq_info_get = ice_txq_info_get, + .get_monitor_addr = ice_get_monitor_addr, .link_update = ice_dcf_link_update, .stats_get = ice_dcf_stats_get, .stats_reset = ice_dcf_stats_reset, From patchwork Fri Apr 29 09:19:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Liu X-Patchwork-Id: 110471 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 021F2A0093; Fri, 29 Apr 2022 03:23:43 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6A8D142856; Fri, 29 Apr 2022 03:23:17 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id AA70742851 for ; Fri, 29 Apr 2022 03:23:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651195392; x=1682731392; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ucXosylVqNNOcAf6nPWvXAdwRVkM6vIvGkRX9rHBHpM=; b=MCbHSewXS4GeeI0NS7AcNN4d0grDwMFKFDBDhE7XjtmDd2XW6qiqY++r CSX8A+4u92qhIAUNeQhsFe3bFS+E6aPaOrHsKcTezWv9hYqi4kiE4tRqt JTUBhkM1u/1yKNMHsMPRUurqRKDrdMM1gI6layNy03FN9MRx9X7DvbWhX bWdvPQ7aBxhbQOYPcIjTfVgP2cguEJexX06LjkGr/3bJzReUQfoWcjaTC AprzAyRYD6WXSWLkNJ8yLfmTppbwEyxsl9YsiI0UityvtuhnhiL/yK5Ve tLKPBhh57OplDi3PDTBFF5GVr4xkksaKbPn/fP9FhmBAZvEDW9AGP18sB g==; X-IronPort-AV: E=McAfee;i="6400,9594,10331"; a="248419766" X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="248419766" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2022 18:23:11 -0700 X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="581768153" 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:45 -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 12/12] net/ice: support DCF new VLAN capabilities Date: Fri, 29 Apr 2022 09:19:58 +0000 Message-Id: <20220429091958.3103384-13-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 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 The new VLAN virtchnl opcodes introduce new capabilities like VLAN filtering, stripping and insertion. The DCF needs to query the VLAN capabilities based on current device configuration firstly. DCF is able to configure inner VLAN filter when port VLAN is enabled base on negotiation; and DCF is able to configure outer VLAN (0x8100) if port VLAN is disabled to be compatible with legacy mode. When port VLAN is updated by DCF, the DCF needs to reset to query the new VLAN capabilities. Signed-off-by: Alvin Zhang Signed-off-by: Kevin Liu --- drivers/net/ice/ice_dcf.c | 27 +++++ drivers/net/ice/ice_dcf.h | 1 + drivers/net/ice/ice_dcf_ethdev.c | 171 ++++++++++++++++++++++++++++--- 3 files changed, 182 insertions(+), 17 deletions(-) diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index 55ae68c456..885d58c0f4 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -587,6 +587,29 @@ ice_dcf_get_supported_rxdid(struct ice_dcf_hw *hw) return 0; } +static int +dcf_get_vlan_offload_caps_v2(struct ice_dcf_hw *hw) +{ + struct virtchnl_vlan_caps vlan_v2_caps; + struct dcf_virtchnl_cmd args; + int ret; + + memset(&args, 0, sizeof(args)); + args.v_op = VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS; + args.rsp_msgbuf = (uint8_t *)&vlan_v2_caps; + args.rsp_buflen = sizeof(vlan_v2_caps); + + ret = ice_dcf_execute_virtchnl_cmd(hw, &args); + if (ret) { + PMD_DRV_LOG(ERR, + "Failed to execute command of VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS"); + return ret; + } + + rte_memcpy(&hw->vlan_v2_caps, &vlan_v2_caps, sizeof(vlan_v2_caps)); + return 0; +} + int ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) { @@ -701,6 +724,10 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) rte_intr_enable(pci_dev->intr_handle); ice_dcf_enable_irq0(hw); + if ((hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN_V2) && + dcf_get_vlan_offload_caps_v2(hw)) + goto err_rss; + return 0; err_rss: diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h index 44a61404c3..7f42ebabe9 100644 --- a/drivers/net/ice/ice_dcf.h +++ b/drivers/net/ice/ice_dcf.h @@ -129,6 +129,7 @@ struct ice_dcf_hw { uint16_t nb_msix; uint16_t rxq_map[16]; struct virtchnl_eth_stats eth_stats_offset; + struct virtchnl_vlan_caps vlan_v2_caps; /* Link status */ bool link_up; diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index 236c0395e0..8005eb2ab8 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -1050,6 +1050,46 @@ dcf_dev_set_default_mac_addr(struct rte_eth_dev *dev, return 0; } +static int +dcf_add_del_vlan_v2(struct ice_dcf_hw *hw, uint16_t vlanid, bool add) +{ + struct virtchnl_vlan_supported_caps *supported_caps = + &hw->vlan_v2_caps.filtering.filtering_support; + struct virtchnl_vlan *vlan_setting; + struct virtchnl_vlan_filter_list_v2 vlan_filter; + struct dcf_virtchnl_cmd args; + uint32_t filtering_caps; + int err; + + if (supported_caps->outer) { + filtering_caps = supported_caps->outer; + vlan_setting = &vlan_filter.filters[0].outer; + } else { + filtering_caps = supported_caps->inner; + vlan_setting = &vlan_filter.filters[0].inner; + } + + if (!(filtering_caps & VIRTCHNL_VLAN_ETHERTYPE_8100)) + return -ENOTSUP; + + memset(&vlan_filter, 0, sizeof(vlan_filter)); + vlan_filter.vport_id = hw->vsi_res->vsi_id; + vlan_filter.num_elements = 1; + vlan_setting->tpid = RTE_ETHER_TYPE_VLAN; + vlan_setting->tci = vlanid; + + memset(&args, 0, sizeof(args)); + args.v_op = add ? VIRTCHNL_OP_ADD_VLAN_V2 : VIRTCHNL_OP_DEL_VLAN_V2; + args.req_msg = (uint8_t *)&vlan_filter; + args.req_msglen = sizeof(vlan_filter); + err = ice_dcf_execute_virtchnl_cmd(hw, &args); + if (err) + PMD_DRV_LOG(ERR, "fail to execute command %s", + add ? "OP_ADD_VLAN_V2" : "OP_DEL_VLAN_V2"); + + return err; +} + static int dcf_add_del_vlan(struct ice_dcf_hw *hw, uint16_t vlanid, bool add) { @@ -1076,6 +1116,116 @@ dcf_add_del_vlan(struct ice_dcf_hw *hw, uint16_t vlanid, bool add) return err; } +static int +dcf_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) +{ + struct ice_dcf_adapter *adapter = dev->data->dev_private; + struct ice_dcf_hw *hw = &adapter->real_hw; + int err; + + if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN_V2) { + err = dcf_add_del_vlan_v2(hw, vlan_id, on); + if (err) + return -EIO; + return 0; + } + + if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN)) + return -ENOTSUP; + + err = dcf_add_del_vlan(hw, vlan_id, on); + if (err) + return -EIO; + return 0; +} + +static void +dcf_iterate_vlan_filters_v2(struct rte_eth_dev *dev, bool enable) +{ + struct rte_vlan_filter_conf *vfc = &dev->data->vlan_filter_conf; + struct ice_dcf_adapter *adapter = dev->data->dev_private; + struct ice_dcf_hw *hw = &adapter->real_hw; + uint32_t i, j; + uint64_t ids; + + for (i = 0; i < RTE_DIM(vfc->ids); i++) { + if (vfc->ids[i] == 0) + continue; + + ids = vfc->ids[i]; + for (j = 0; ids != 0 && j < 64; j++, ids >>= 1) { + if (ids & 1) + dcf_add_del_vlan_v2(hw, 64 * i + j, enable); + } + } +} + +static int +dcf_config_vlan_strip_v2(struct ice_dcf_hw *hw, bool enable) +{ + struct virtchnl_vlan_supported_caps *stripping_caps = + &hw->vlan_v2_caps.offloads.stripping_support; + struct virtchnl_vlan_setting vlan_strip; + struct dcf_virtchnl_cmd args; + uint32_t *ethertype; + int ret; + + if ((stripping_caps->outer & VIRTCHNL_VLAN_ETHERTYPE_8100) && + (stripping_caps->outer & VIRTCHNL_VLAN_TOGGLE)) + ethertype = &vlan_strip.outer_ethertype_setting; + else if ((stripping_caps->inner & VIRTCHNL_VLAN_ETHERTYPE_8100) && + (stripping_caps->inner & VIRTCHNL_VLAN_TOGGLE)) + ethertype = &vlan_strip.inner_ethertype_setting; + else + return -ENOTSUP; + + memset(&vlan_strip, 0, sizeof(vlan_strip)); + vlan_strip.vport_id = hw->vsi_res->vsi_id; + *ethertype = VIRTCHNL_VLAN_ETHERTYPE_8100; + + memset(&args, 0, sizeof(args)); + args.v_op = enable ? VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2 : + VIRTCHNL_OP_DISABLE_VLAN_STRIPPING_V2; + args.req_msg = (uint8_t *)&vlan_strip; + args.req_msglen = sizeof(vlan_strip); + ret = ice_dcf_execute_virtchnl_cmd(hw, &args); + if (ret) + PMD_DRV_LOG(ERR, "fail to execute command %s", + enable ? "VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2" : + "VIRTCHNL_OP_DISABLE_VLAN_STRIPPING_V2"); + + return ret; +} + +static int +dcf_dev_vlan_offload_set_v2(struct rte_eth_dev *dev, int mask) +{ + struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; + struct ice_dcf_adapter *adapter = dev->data->dev_private; + struct ice_dcf_hw *hw = &adapter->real_hw; + bool enable; + int err; + + if (mask & RTE_ETH_VLAN_FILTER_MASK) { + enable = !!(rxmode->offloads & RTE_ETH_RX_OFFLOAD_VLAN_FILTER); + + dcf_iterate_vlan_filters_v2(dev, enable); + } + + if (mask & RTE_ETH_VLAN_STRIP_MASK) { + enable = !!(rxmode->offloads & RTE_ETH_RX_OFFLOAD_VLAN_STRIP); + + err = dcf_config_vlan_strip_v2(hw, enable); + /* If not support, the stripping is already disabled by PF */ + if (err == -ENOTSUP && !enable) + err = 0; + if (err) + return -EIO; + } + + return 0; +} + static int dcf_enable_vlan_strip(struct ice_dcf_hw *hw) { @@ -1108,30 +1258,17 @@ dcf_disable_vlan_strip(struct ice_dcf_hw *hw) return ret; } -static int -dcf_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) -{ - struct ice_dcf_adapter *adapter = dev->data->dev_private; - struct ice_dcf_hw *hw = &adapter->real_hw; - int err; - - if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN)) - return -ENOTSUP; - - err = dcf_add_del_vlan(hw, vlan_id, on); - if (err) - return -EIO; - return 0; -} - static int dcf_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask) { + struct rte_eth_conf *dev_conf = &dev->data->dev_conf; struct ice_dcf_adapter *adapter = dev->data->dev_private; struct ice_dcf_hw *hw = &adapter->real_hw; - struct rte_eth_conf *dev_conf = &dev->data->dev_conf; int err; + if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN_V2) + return dcf_dev_vlan_offload_set_v2(dev, mask); + if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN)) return -ENOTSUP;