From patchwork Wed Jul 1 08:24:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chenxu Di X-Patchwork-Id: 72579 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 dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CC480A0350; Wed, 1 Jul 2020 10:47:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A4E911C2A5; Wed, 1 Jul 2020 10:47:27 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id C57791C1A8 for ; Wed, 1 Jul 2020 10:47:25 +0200 (CEST) IronPort-SDR: v2LG80PS5CF1hUV+d19tc1nWCKy/z4SA5oOlpsu+vXEIuuNloNVRjAcaJ6EaUIRu1TIymW1d2T 8hRGJTjnZ1EQ== X-IronPort-AV: E=McAfee;i="6000,8403,9668"; a="208021320" X-IronPort-AV: E=Sophos;i="5.75,299,1589266800"; d="scan'208";a="208021320" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2020 01:47:25 -0700 IronPort-SDR: CWT2iKCJomqo/nXnoagyV++awr8q4cT0EvjHy0aWJ7F1o6sKwNrEo2B6ZuzyEaVUsjEWnbLcOm wJJ1PDX3MZ4g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,299,1589266800"; d="scan'208";a="295495800" Received: from intel.sh.intel.com ([10.239.255.20]) by orsmga002.jf.intel.com with ESMTP; 01 Jul 2020 01:47:23 -0700 From: Chenxu Di To: dev@dpdk.org Cc: Yang Qiming , jia.guo@intel.com, Chenxu Di Date: Wed, 1 Jul 2020 08:24:47 +0000 Message-Id: <20200701082451.34511-2-chenxux.di@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200701082451.34511-1-chenxux.di@intel.com> References: <20200611060142.75465-1-chenxux.di@intel.com> <20200701082451.34511-1-chenxux.di@intel.com> Subject: [dpdk-dev] [PATCH v3 1/5] net/i40e: add private APIs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The legacy filter API will be superseded by rte_flow. There are also several small features which can not be implemented in rte_flow. This patch re-implemented these features as private API. Three APIs are added: rte_pmd_i40e_get_fdir_info. rte_pmd_i40e_get_fdir_stats. rte_pmd_i40e_set_gre_key_len. Signed-off-by: Chenxu Di Acked-by: Jeff Guo > --- doc/guides/rel_notes/release_20_08.rst | 7 ++++ drivers/net/i40e/i40e_ethdev.c | 2 +- drivers/net/i40e/i40e_ethdev.h | 5 +++ drivers/net/i40e/i40e_fdir.c | 4 +- drivers/net/i40e/rte_pmd_i40e.c | 51 +++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 49 ++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 3 ++ 7 files changed, 118 insertions(+), 3 deletions(-) diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/rel_notes/release_20_08.rst index eaaf11c37..54bfd4322 100644 --- a/doc/guides/rel_notes/release_20_08.rst +++ b/doc/guides/rel_notes/release_20_08.rst @@ -84,6 +84,13 @@ New Features * Dump ``rte_flow`` memory consumption. * Measure packet per second forwarding. +* **Updated the Intel i40e driver.** + + Updated the Intel i40e driver with new features and improvements, including: + + * Re-implemented get_fdir_info and get_fdir_stat in private API. + * Re-implemented set_gre_key_len in private API. + Removed Items ------------- diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 970a31cb2..674b711d9 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -8787,7 +8787,7 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf, #define I40E_GL_PRS_FVBM_MSK_ENA 0x80000000 #define I40E_GL_PRS_FVBM(_i) (0x00269760 + ((_i) * 4)) -static int +int i40e_dev_set_gre_key_len(struct i40e_hw *hw, uint8_t len) { struct i40e_pf *pf = &((struct i40e_adapter *)hw->back)->pf; diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index e5d0ce53f..192636927 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -1270,6 +1270,11 @@ enum i40e_filter_pctype uint16_t flow_type); uint16_t i40e_pctype_to_flowtype(const struct i40e_adapter *adapter, enum i40e_filter_pctype pctype); +int i40e_dev_set_gre_key_len(struct i40e_hw *hw, uint8_t len); +void i40e_fdir_info_get(struct rte_eth_dev *dev, + struct rte_eth_fdir_info *fdir); +void i40e_fdir_stats_get(struct rte_eth_dev *dev, + struct rte_eth_fdir_stats *stat); int i40e_fdir_ctrl_func(struct rte_eth_dev *dev, enum rte_filter_op filter_op, void *arg); diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index d59399afe..4a778db4c 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -2169,7 +2169,7 @@ i40e_fdir_info_get_flex_mask(struct i40e_pf *pf, * @fdir: a pointer to a structure of type *rte_eth_fdir_info* to be filled with * the flow director information. */ -static void +void i40e_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir) { struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -2214,7 +2214,7 @@ i40e_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir) * @stat: a pointer to a structure of type *rte_eth_fdir_stats* to be filled with * the flow director statistics. */ -static void +void i40e_fdir_stats_get(struct rte_eth_dev *dev, struct rte_eth_fdir_stats *stat) { struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c index 446e31710..e216e6783 100644 --- a/drivers/net/i40e/rte_pmd_i40e.c +++ b/drivers/net/i40e/rte_pmd_i40e.c @@ -3209,6 +3209,57 @@ rte_pmd_i40e_inset_set(uint16_t port, uint8_t pctype, return 0; } +int +rte_pmd_i40e_get_fdir_info(uint16_t port, struct rte_eth_fdir_info *fdir_info) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); + + dev = &rte_eth_devices[port]; + if (!is_i40e_supported(dev)) + return -ENOTSUP; + + i40e_fdir_info_get(dev, fdir_info); + + return 0; +} + +int +rte_pmd_i40e_get_fdir_stats(uint16_t port, struct rte_eth_fdir_stats *fdir_stat) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); + + dev = &rte_eth_devices[port]; + if (!is_i40e_supported(dev)) + return -ENOTSUP; + + i40e_fdir_stats_get(dev, fdir_stat); + + return 0; +} + +int +rte_pmd_i40e_set_gre_key_len(uint16_t port, uint8_t len) +{ + struct rte_eth_dev *dev; + struct i40e_pf *pf; + struct i40e_hw *hw; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); + + dev = &rte_eth_devices[port]; + if (!is_i40e_supported(dev)) + return -ENOTSUP; + + pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); + hw = I40E_PF_TO_HW(pf); + + return i40e_dev_set_gre_key_len(hw, len); +} + int rte_pmd_i40e_set_switch_dev(uint16_t port_id, struct rte_eth_dev *switch_dev) { diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h index 915cdf076..0f6715efc 100644 --- a/drivers/net/i40e/rte_pmd_i40e.h +++ b/drivers/net/i40e/rte_pmd_i40e.h @@ -1061,6 +1061,55 @@ rte_pmd_i40e_inset_field_clear(uint64_t *inset, uint8_t field_idx) return 0; } +/** + * Get port fdir info + * + * @param port + * The port identifier of the Ethernet device. + * @param fdir_info + * The fdir info of the port + * @return + * - (0) if successful. + * - (-ENODEV) if *port* invalid. + * - (-ENOTSUP) if operation not supported. + */ +__rte_experimental +int +rte_pmd_i40e_get_fdir_info(uint16_t port, struct rte_eth_fdir_info *fdir_info); + +/** + * Get port fdir status + * + * @param port + * The port identifier of the Ethernet device. + * @param fdir_stat + * The fdir status of the port + * @return + * - (0) if successful. + * - (-ENODEV) if *port* invalid. + * - (-ENOTSUP) if operation not supported. + */ +__rte_experimental +int +rte_pmd_i40e_get_fdir_stats(uint16_t port, + struct rte_eth_fdir_stats *fdir_stat); + +/** + * Set GRE key length + * + * @param port + * The port identifier of the Ethernet device. + * @param len + * Length of gre-key + * @return + * - (0) if successful. + * - (-ENODEV) if *port* invalid. + * - (-ENOTSUP) if operation not supported. + */ +__rte_experimental +int +rte_pmd_i40e_set_gre_key_len(uint16_t port, uint8_t len); + /** * For ipn3ke, i40e works with FPGA. * In this situation, i40e get link status from fpga, diff --git a/drivers/net/i40e/rte_pmd_i40e_version.map b/drivers/net/i40e/rte_pmd_i40e_version.map index c92c0cf46..f6cd3b356 100644 --- a/drivers/net/i40e/rte_pmd_i40e_version.map +++ b/drivers/net/i40e/rte_pmd_i40e_version.map @@ -42,5 +42,8 @@ DPDK_20.0 { EXPERIMENTAL { global: + rte_pmd_i40e_get_fdir_info; + rte_pmd_i40e_get_fdir_stats; + rte_pmd_i40e_set_gre_key_len; rte_pmd_i40e_set_switch_dev; }; From patchwork Wed Jul 1 08:24:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chenxu Di X-Patchwork-Id: 72580 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 dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 116C8A0350; Wed, 1 Jul 2020 10:47:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0F0BD1C2F8; Wed, 1 Jul 2020 10:47:30 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id C17E21C2AA for ; Wed, 1 Jul 2020 10:47:27 +0200 (CEST) IronPort-SDR: bnLZGstpWJbmws6/v2sUkiLTrLvYCF83AUors8BhwJfAlFAr7SLPLEjKoJ2KB3yxmE9ANOkNaP du/1XrZxB6/Q== X-IronPort-AV: E=McAfee;i="6000,8403,9668"; a="208021323" X-IronPort-AV: E=Sophos;i="5.75,299,1589266800"; d="scan'208";a="208021323" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2020 01:47:27 -0700 IronPort-SDR: d/aTSgL/AA0aA6GP51aR6jtNClsrsBGCBlWBWmapPjRtGaE4ZIuaC2rNq+9MichHG1IbjdCCmk P0T2IgUcODBQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,299,1589266800"; d="scan'208";a="295495811" Received: from intel.sh.intel.com ([10.239.255.20]) by orsmga002.jf.intel.com with ESMTP; 01 Jul 2020 01:47:25 -0700 From: Chenxu Di To: dev@dpdk.org Cc: Yang Qiming , jia.guo@intel.com, Chenxu Di Date: Wed, 1 Jul 2020 08:24:48 +0000 Message-Id: <20200701082451.34511-3-chenxux.di@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200701082451.34511-1-chenxux.di@intel.com> References: <20200611060142.75465-1-chenxux.di@intel.com> <20200701082451.34511-1-chenxux.di@intel.com> Subject: [dpdk-dev] [PATCH v3 2/5] net/ixgbe: add private APIs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The legacy filter API will be superseded by rte_flow. There are also several small features which can not be implemented in rte_flow. This patch re-implemented these features as private API. Two APIs are added: rte_pmd_ixgbe_get_fdir_info. rte_pmd_ixgbe_get_fdir_stats. Signed-off-by: Chenxu Di Acked-by: Jeff Guo > --- doc/guides/rel_notes/release_20_08.rst | 6 ++++ drivers/net/ixgbe/ixgbe_ethdev.h | 4 +++ drivers/net/ixgbe/ixgbe_fdir.c | 8 ++--- drivers/net/ixgbe/rte_pmd_ixgbe.c | 33 +++++++++++++++++++++ drivers/net/ixgbe/rte_pmd_ixgbe.h | 33 +++++++++++++++++++++ drivers/net/ixgbe/rte_pmd_ixgbe_version.map | 2 ++ 6 files changed, 80 insertions(+), 6 deletions(-) diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/rel_notes/release_20_08.rst index 54bfd4322..1252a337a 100644 --- a/doc/guides/rel_notes/release_20_08.rst +++ b/doc/guides/rel_notes/release_20_08.rst @@ -91,6 +91,12 @@ New Features * Re-implemented get_fdir_info and get_fdir_stat in private API. * Re-implemented set_gre_key_len in private API. +* **Updated the Intel ixgbe driver.** + + Updated the Intel ixgbe driver with new features and improvements, including: + + * Re-implemented get_fdir_info and get_fdir_stat in private API. + Removed Items ------------- diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index 3d78b2ee2..9bdef87fb 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -697,6 +697,10 @@ int ixgbe_fdir_set_flexbytes_offset(struct rte_eth_dev *dev, int ixgbe_fdir_filter_program(struct rte_eth_dev *dev, struct ixgbe_fdir_rule *rule, bool del, bool update); +void ixgbe_fdir_info_get(struct rte_eth_dev *dev, + struct rte_eth_fdir_info *fdir_info); +void ixgbe_fdir_stats_get(struct rte_eth_dev *dev, + struct rte_eth_fdir_stats *fdir_stats); void ixgbe_configure_dcb(struct rte_eth_dev *dev); diff --git a/drivers/net/ixgbe/ixgbe_fdir.c b/drivers/net/ixgbe/ixgbe_fdir.c index 166dae1e0..6faaa8f06 100644 --- a/drivers/net/ixgbe/ixgbe_fdir.c +++ b/drivers/net/ixgbe/ixgbe_fdir.c @@ -109,10 +109,6 @@ static int ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev, bool del, bool update); static int ixgbe_fdir_flush(struct rte_eth_dev *dev); -static void ixgbe_fdir_info_get(struct rte_eth_dev *dev, - struct rte_eth_fdir_info *fdir_info); -static void ixgbe_fdir_stats_get(struct rte_eth_dev *dev, - struct rte_eth_fdir_stats *fdir_stats); /** * This function is based on ixgbe_fdir_enable_82599() in base/ixgbe_82599.c. @@ -1414,7 +1410,7 @@ ixgbe_fdir_flush(struct rte_eth_dev *dev) } #define FDIRENTRIES_NUM_SHIFT 10 -static void +void ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir_info) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -1473,7 +1469,7 @@ ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir_info (uint8_t)((info->mask.flex_bytes_mask & 0xFF00) >> 8); } -static void +void ixgbe_fdir_stats_get(struct rte_eth_dev *dev, struct rte_eth_fdir_stats *fdir_stats) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c index 9bff557f9..d2f708242 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe.c +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c @@ -1139,3 +1139,36 @@ rte_pmd_ixgbe_mdio_unlocked_write(uint16_t port, uint32_t reg_addr, } return 0; } + +int +rte_pmd_ixgbe_get_fdir_info(uint16_t port, struct rte_eth_fdir_info *fdir_info) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); + + dev = &rte_eth_devices[port]; + if (!is_ixgbe_supported(dev)) + return -ENOTSUP; + + ixgbe_fdir_info_get(dev, fdir_info); + + return 0; +} + +int +rte_pmd_ixgbe_get_fdir_stats(uint16_t port, + struct rte_eth_fdir_stats *fdir_stats) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); + + dev = &rte_eth_devices[port]; + if (!is_ixgbe_supported(dev)) + return -ENOTSUP; + + ixgbe_fdir_stats_get(dev, fdir_stats); + + return 0; +} diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h b/drivers/net/ixgbe/rte_pmd_ixgbe.h index f62fd761d..8b6bb99a5 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe.h +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h @@ -726,4 +726,37 @@ enum { __rte_experimental int rte_pmd_ixgbe_upd_fctrl_sbp(uint16_t port, int enable); + +/** + * Get port fdir info + * + * @param port + * The port identifier of the Ethernet device. + * @param fdir_info + * The fdir info of the port + * @return + * - (0) if successful. + * - (-ENODEV) if *port* invalid. + * - (-ENOTSUP) if operation not supported. + */ +__rte_experimental +int +rte_pmd_ixgbe_get_fdir_info(uint16_t port, struct rte_eth_fdir_info *fdir_info); + +/** + * Get port fdir status + * + * @param port + * The port identifier of the Ethernet device. + * @param fdir_stats + * The fdir status of the port + * @return + * - (0) if successful. + * - (-ENODEV) if *port* invalid. + * - (-ENOTSUP) if operation not supported. + */ +__rte_experimental +int +rte_pmd_ixgbe_get_fdir_stats(uint16_t port, + struct rte_eth_fdir_stats *fdir_stats); #endif /* _PMD_IXGBE_H_ */ diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe_version.map b/drivers/net/ixgbe/rte_pmd_ixgbe_version.map index 21534dbc3..911f8083f 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe_version.map +++ b/drivers/net/ixgbe/rte_pmd_ixgbe_version.map @@ -38,6 +38,8 @@ DPDK_20.0 { EXPERIMENTAL { global: + rte_pmd_ixgbe_get_fdir_info; + rte_pmd_ixgbe_get_fdir_stats; rte_pmd_ixgbe_mdio_lock; rte_pmd_ixgbe_mdio_unlock; rte_pmd_ixgbe_mdio_unlocked_read; From patchwork Wed Jul 1 08:24:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chenxu Di X-Patchwork-Id: 72581 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 dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 274D7A0350; Wed, 1 Jul 2020 10:47:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 199311C438; Wed, 1 Jul 2020 10:47:31 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 9F9051C2F5 for ; Wed, 1 Jul 2020 10:47:29 +0200 (CEST) IronPort-SDR: RzC1PgZGr+KTN5bD2AqaXSWjNxw0I7Y8/c/6Gw4G1VGpuM5q5amu6AicjpjzLeo6EzaCfD723x KHFj974vEDEA== X-IronPort-AV: E=McAfee;i="6000,8403,9668"; a="208021326" X-IronPort-AV: E=Sophos;i="5.75,299,1589266800"; d="scan'208";a="208021326" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2020 01:47:29 -0700 IronPort-SDR: +80Gi8SH5YLuuwYYG66XGAxtVP2S9VqQx3VqhcFFJSJ+v9coACY3DlUUUq2+SfJalcVQ+Uupbb 0BB7hyqaZBjQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,299,1589266800"; d="scan'208";a="295495820" Received: from intel.sh.intel.com ([10.239.255.20]) by orsmga002.jf.intel.com with ESMTP; 01 Jul 2020 01:47:27 -0700 From: Chenxu Di To: dev@dpdk.org Cc: Yang Qiming , jia.guo@intel.com, Chenxu Di Date: Wed, 1 Jul 2020 08:24:49 +0000 Message-Id: <20200701082451.34511-4-chenxux.di@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200701082451.34511-1-chenxux.di@intel.com> References: <20200611060142.75465-1-chenxux.di@intel.com> <20200701082451.34511-1-chenxux.di@intel.com> Subject: [dpdk-dev] [PATCH v3 3/5] app/testpmd: re-implement commands by using private API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The legacy filter API will be superseded. This patch use private api to change the implementation of commands global_config gre-key-len and show port fdir Signed-off-by: Chenxu Di --- app/test-pmd/cmdline.c | 6 ++++ app/test-pmd/config.c | 65 +++++++++++++++++++++++++++++++++++------- 2 files changed, 61 insertions(+), 10 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 996a49876..466c54aa9 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -9287,6 +9287,12 @@ cmd_global_config_parsed(void *parsed_result, conf.cfg.gre_key_len = res->len; ret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_NONE, RTE_ETH_FILTER_SET, &conf); + +#ifdef RTE_LIBRTE_I40E_PMD + if (ret == -ENOTSUP) + ret = rte_pmd_i40e_set_gre_key_len(res->port_id, res->len); +#endif + if (ret != 0) printf("Global config error\n"); } diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index a7112c998..ed341c715 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -3727,6 +3727,50 @@ print_fdir_flow_type(uint32_t flow_types_mask) printf("\n"); } +static int +get_fdir_info(portid_t port_id, struct rte_eth_fdir_info *fdir_info) +{ + int ret; + + ret = rte_eth_dev_filter_supported(port_id, + RTE_ETH_FILTER_FDIR); + if (!ret) + rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR, + RTE_ETH_FILTER_INFO, fdir_info); + +#ifdef RTE_LIBRTE_I40E_PMD + if (ret == -ENOTSUP) + ret = rte_pmd_i40e_get_fdir_info(port_id, fdir_info); +#endif +#ifdef RTE_LIBRTE_IXGBE_PMD + if (ret == -ENOTSUP) + ret = rte_pmd_ixgbe_get_fdir_info(port_id, fdir_info); +#endif + return ret; +} + +static int +get_fdir_stat(portid_t port_id, struct rte_eth_fdir_stats *fdir_stat) +{ + int ret; + + ret = rte_eth_dev_filter_supported(port_id, + RTE_ETH_FILTER_FDIR); + if (!ret) + rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR, + RTE_ETH_FILTER_STATS, fdir_stat); + +#ifdef RTE_LIBRTE_I40E_PMD + if (ret == -ENOTSUP) + ret = rte_pmd_i40e_get_fdir_stats(port_id, fdir_stat); +#endif +#ifdef RTE_LIBRTE_IXGBE_PMD + if (ret == -ENOTSUP) + ret = rte_pmd_ixgbe_get_fdir_stats(port_id, fdir_stat); +#endif + return ret; +} + void fdir_get_infos(portid_t port_id) { @@ -3738,19 +3782,20 @@ fdir_get_infos(portid_t port_id) if (port_id_is_invalid(port_id, ENABLED_WARN)) return; - ret = rte_eth_dev_filter_supported(port_id, RTE_ETH_FILTER_FDIR); - if (ret < 0) { - printf("\n FDIR is not supported on port %-2d\n", - port_id); - return; - } memset(&fdir_info, 0, sizeof(fdir_info)); - rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR, - RTE_ETH_FILTER_INFO, &fdir_info); + ret = get_fdir_info(port_id, &fdir_info); + if (ret) { + printf("Get fdir infos error: (%s)\n", strerror(-ret)); + return; + } memset(&fdir_stat, 0, sizeof(fdir_stat)); - rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR, - RTE_ETH_FILTER_STATS, &fdir_stat); + ret = get_fdir_stat(port_id, &fdir_stat); + if (ret) { + printf("Get fdir status error: (%s)\n", strerror(-ret)); + return; + } + printf("\n %s FDIR infos for port %-2d %s\n", fdir_stats_border, port_id, fdir_stats_border); printf(" MODE: "); From patchwork Wed Jul 1 08:24:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chenxu Di X-Patchwork-Id: 72582 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 dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1F1EAA0350; Wed, 1 Jul 2020 10:47:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4EE981D147; Wed, 1 Jul 2020 10:47:33 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 8A3CF1C43D for ; Wed, 1 Jul 2020 10:47:31 +0200 (CEST) IronPort-SDR: PkhqtX+vzZ5BxI1TKDpdPBO/2wP6vTCUPTLGh4Id2IZruDkyQLL+fGaMKE1aJxnVJucjkmU2bo ZrokSVziO8gw== X-IronPort-AV: E=McAfee;i="6000,8403,9668"; a="208021327" X-IronPort-AV: E=Sophos;i="5.75,299,1589266800"; d="scan'208";a="208021327" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2020 01:47:31 -0700 IronPort-SDR: /ggbVJlSDRM6rran+vmntP92/F5leEmqjiPcmjEg3PoYI9LBA425OSyAwSo3/Z75VnWLFzS6x4 hhNpaOS7QzFA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,299,1589266800"; d="scan'208";a="295495836" Received: from intel.sh.intel.com ([10.239.255.20]) by orsmga002.jf.intel.com with ESMTP; 01 Jul 2020 01:47:29 -0700 From: Chenxu Di To: dev@dpdk.org Cc: Yang Qiming , jia.guo@intel.com, Chenxu Di Date: Wed, 1 Jul 2020 08:24:50 +0000 Message-Id: <20200701082451.34511-5-chenxux.di@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200701082451.34511-1-chenxux.di@intel.com> References: <20200611060142.75465-1-chenxux.di@intel.com> <20200701082451.34511-1-chenxux.di@intel.com> Subject: [dpdk-dev] [PATCH v3 4/5] net/i40e: enable flow query RSS X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch enables flow query function to get the configuration of the specified rule. Signed-off-by: Chenxu Di Acked-by: Jeff Guo > --- doc/guides/rel_notes/release_20_08.rst | 1 + drivers/net/i40e/i40e_flow.c | 49 ++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/rel_notes/release_20_08.rst index 1252a337a..a7fb3136d 100644 --- a/doc/guides/rel_notes/release_20_08.rst +++ b/doc/guides/rel_notes/release_20_08.rst @@ -90,6 +90,7 @@ New Features * Re-implemented get_fdir_info and get_fdir_stat in private API. * Re-implemented set_gre_key_len in private API. + * Added support for flow query RSS. * **Updated the Intel ixgbe driver.** diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index 8f8df6fae..4186a5df2 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -43,6 +43,10 @@ static int i40e_flow_destroy(struct rte_eth_dev *dev, struct rte_flow_error *error); static int i40e_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error); +static int i40e_flow_query(struct rte_eth_dev *dev, + struct rte_flow *flow, + const struct rte_flow_action *actions, + void *data, struct rte_flow_error *error); static int i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, const struct rte_flow_item *pattern, @@ -129,6 +133,7 @@ const struct rte_flow_ops i40e_flow_ops = { .create = i40e_flow_create, .destroy = i40e_flow_destroy, .flush = i40e_flow_flush, + .query = i40e_flow_query, }; static union i40e_filter_t cons_filter; @@ -5462,3 +5467,47 @@ i40e_flow_flush_rss_filter(struct rte_eth_dev *dev) return ret; } + +static int +i40e_flow_query(struct rte_eth_dev *dev __rte_unused, + struct rte_flow *flow, + const struct rte_flow_action *actions, + void *data, struct rte_flow_error *error) +{ + struct i40e_rss_filter *rss_rule = (struct i40e_rss_filter *)flow->rule; + enum rte_filter_type filter_type = flow->filter_type; + struct rte_flow_action_rss *rss_conf = data; + + if (!rss_rule) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_HANDLE, + NULL, "Invalid rule"); + return -rte_errno; + } + + for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) { + switch (actions->type) { + case RTE_FLOW_ACTION_TYPE_VOID: + break; + case RTE_FLOW_ACTION_TYPE_RSS: + if (filter_type != RTE_ETH_FILTER_HASH) { + rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, + actions, + "action not supported"); + return -rte_errno; + } + rte_memcpy(rss_conf, + &rss_rule->rss_filter_info.conf, + sizeof(struct rte_flow_action_rss)); + break; + default: + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, + actions, + "action not supported"); + } + } + + return 0; +} From patchwork Wed Jul 1 08:24:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chenxu Di X-Patchwork-Id: 72583 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 dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7ED00A0350; Wed, 1 Jul 2020 10:48:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 68F231D155; Wed, 1 Jul 2020 10:47:35 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id BCBF51C21E for ; Wed, 1 Jul 2020 10:47:33 +0200 (CEST) IronPort-SDR: 80kCJQiyzNZFpcz6OvoCTdAFBlxsnihXFDSTiB98ZY2zSTM1mzS7pcUmEctaWSzYsu2To3dOoj lIURtDA1iK1A== X-IronPort-AV: E=McAfee;i="6000,8403,9668"; a="208021331" X-IronPort-AV: E=Sophos;i="5.75,299,1589266800"; d="scan'208";a="208021331" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2020 01:47:33 -0700 IronPort-SDR: 8KbLP/vPbOg6sBNGbdcRKWAiAqB5X0ng/k4pm3gnrpOpFN6vRsUtJJ7KevNtLhXReQ5TqWMOko jnAXMqjgn9+Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,299,1589266800"; d="scan'208";a="295495846" Received: from intel.sh.intel.com ([10.239.255.20]) by orsmga002.jf.intel.com with ESMTP; 01 Jul 2020 01:47:31 -0700 From: Chenxu Di To: dev@dpdk.org Cc: Yang Qiming , jia.guo@intel.com, Chenxu Di Date: Wed, 1 Jul 2020 08:24:51 +0000 Message-Id: <20200701082451.34511-6-chenxux.di@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200701082451.34511-1-chenxux.di@intel.com> References: <20200611060142.75465-1-chenxux.di@intel.com> <20200701082451.34511-1-chenxux.di@intel.com> Subject: [dpdk-dev] [PATCH v3 5/5] app/testpmd: support query RSS config in flow query X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch support RSS action in flow query. It can display the RSS configuration of the specified rule. For example: we can create an RSS rule by command "flow create 0 ingress pattern eth / ipv4 / tcp / end actions rss types ipv4-tcp l3-src-only l4-dst-only end queues end func symmetric_toeplitz / end" and then query it "flow query 0 0 rss" the log will be follow RSS: queues: none function: symmetric_toeplitz types: ipv4-tcp l3-src-only l4-dst-only Signed-off-by: Chenxu Di --- app/test-pmd/config.c | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index ed341c715..df2ea5d81 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1376,6 +1376,56 @@ port_flow_complain(struct rte_flow_error *error) return -err; } +static void +rss_config_display(struct rte_flow_action_rss *rss_conf) +{ + uint8_t i; + + if (rss_conf == NULL) { + printf("Invalid rule\n"); + return; + } + + printf("RSS:\n" + " queues: "); + if (rss_conf->queue_num == 0) + printf("none\n"); + for (i = 0; i < rss_conf->queue_num; i++) + printf("%d\n", rss_conf->queue[i]); + + printf(" function: "); + switch (rss_conf->func) { + case RTE_ETH_HASH_FUNCTION_DEFAULT: + printf("default\n"); + break; + case RTE_ETH_HASH_FUNCTION_TOEPLITZ: + printf("toeplitz\n"); + break; + case RTE_ETH_HASH_FUNCTION_SIMPLE_XOR: + printf("simple_xor\n"); + break; + case RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ: + printf("symmetric_toeplitz\n"); + break; + default: + printf("Unknown function\n"); + return; + } + + printf(" types:\n"); + if (rss_conf->types == 0) { + printf(" none\n"); + return; + } + for (i = 0; rss_type_table[i].str; i++) { + if ((rss_conf->types & + rss_type_table[i].rss_type) == + rss_type_table[i].rss_type && + rss_type_table[i].rss_type != 0) + printf(" %s\n", rss_type_table[i].str); + } +} + /** Validate flow rule. */ int port_flow_validate(portid_t port_id, @@ -1562,6 +1612,7 @@ port_flow_query(portid_t port_id, uint32_t rule, const char *name; union { struct rte_flow_query_count count; + struct rte_flow_action_rss rss_conf; } query; int ret; @@ -1583,6 +1634,7 @@ port_flow_query(portid_t port_id, uint32_t rule, return port_flow_complain(&error); switch (action->type) { case RTE_FLOW_ACTION_TYPE_COUNT: + case RTE_FLOW_ACTION_TYPE_RSS: break; default: printf("Cannot query action type %d (%s)\n", @@ -1607,6 +1659,9 @@ port_flow_query(portid_t port_id, uint32_t rule, query.count.hits, query.count.bytes); break; + case RTE_FLOW_ACTION_TYPE_RSS: + rss_config_display(&query.rss_conf); + break; default: printf("Cannot display result for action type %d (%s)\n", action->type, name);