re-implement legacy filter functions by private API
cover re-implement legacy filter functions by private API
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 features get_fdir_info, get_fdir_stat and set_gre_key_len as private API.
This patch also enable RSS action in flow query.
Chenxu Di (5):
net/i40e: add private APIs
net/ixgbe: add private APIs
app/testpmd: re-implement commands by using private API net/i40e: enable flow query RSS
app/testpmd: support query RSS config in flow query
app/test-pmd/cmdline.c | 23 ++-- app/test-pmd/config.c | 129 ++++++++++++++++++-- doc/guides/rel_notes/release_20_08.rst | 14 +++ drivers/net/i40e/i40e_ethdev.c | 2 +- drivers/net/i40e/i40e_ethdev.h | 5 + drivers/net/i40e/i40e_fdir.c | 4 +- drivers/net/i40e/i40e_flow.c | 51 ++++++++ drivers/net/i40e/rte_pmd_i40e.c | 51 ++++++++ drivers/net/i40e/rte_pmd_i40e.h | 46 +++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 3 + 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 | 31 +++++ drivers/net/ixgbe/rte_pmd_ixgbe_version.map | 2 + 15 files changed, 378 insertions(+), 28 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/5 net/i40e: add private APIs
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.
--- doc/guides/rel_notes/release_20_08.rst | 14 +++++++ 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 | 46 ++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 3 ++ 7 files changed, 122 insertions(+), 3 deletions(-)
doc/guides/rel_notes/release_20_08.rst +14 -0
@@ -62,6 +62,20 @@ New Features * Added new PMD devarg ``reclaim_mem_mode``. +* **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. + * Added support for flow query RSS. + +* **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 -------------
drivers/net/i40e/i40e_ethdev.c +1 -1
@@ -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;
drivers/net/i40e/i40e_ethdev.h +5 -0
@@ -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);
drivers/net/i40e/i40e_fdir.c +2 -2
@@ -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);
drivers/net/i40e/rte_pmd_i40e.c +51 -0
57 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e.h +46 -0
52 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e_version.map +3 -0
@@ -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; };
Signature · 1 line
2.17.1
PATCH 2/5 net/ixgbe: add private APIs
In reply to Chenxu DiThe 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.
--- 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 | 31 +++++++++++++++++++ drivers/net/ixgbe/rte_pmd_ixgbe_version.map | 2 ++ 5 files changed, 72 insertions(+), 6 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.h +4 -0
@@ -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);
drivers/net/ixgbe/ixgbe_fdir.c +2 -6
@@ -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);
drivers/net/ixgbe/rte_pmd_ixgbe.c +33 -0
@@ -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 ; +}
drivers/net/ixgbe/rte_pmd_ixgbe.h +31 -0
@@ -726,4 +726,35 @@ enum {__rte_experimental intrte_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. +*/ +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. +*/ +int +rte_pmd_ixgbe_get_fdir_stats (uint16_t port, +struct rte_eth_fdir_stats *fdir_stats);#endif /* _PMD_IXGBE_H_ */
drivers/net/ixgbe/rte_pmd_ixgbe_version.map +2 -0
@@ -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;
Signature · 1 line
2.17.1
PATCH 3/5 app/testpmd: re-implement commands by using private API
In reply to Chenxu DiThe legacy filter API will be superseded. This patch use private api to change the implementation of commands global_config <port_id> gre-key-len <key_len> and show port fdir <port_id>
--- app/test-pmd/cmdline.c | 23 ++++++++----- app/test-pmd/config.c | 74 +++++++++++++++++++++++++++++++++++------- 2 files changed, 78 insertions(+), 19 deletions(-)
app/test-pmd/cmdline.c +15 -8
@@ -9280,15 +9280,22 @@ cmd_global_config_parsed(void *parsed_result, {struct cmd_global_config_result *res = parsed_result;struct rte_eth_global_cfg conf; -int ret; +int ret = -ENOTSUP ; -memset (&conf,0 ,sizeof (conf)); - conf.cfg_type =RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN ; - 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); -if (ret !=0 ) -printf ("Global config error\n" ); +#ifdef RTE_LIBRTE_I40E_PMD +if (ret == -ENOTSUP ) + ret =rte_pmd_i40e_set_gre_key_len (res->port_id, res->len); +#endif +if (ret == -ENOTSUP ) { +memset (&conf,0 ,sizeof (conf)); + conf.cfg_type =RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN ; + 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); + } + +if (ret <0 ) +printf ("Global config error: (%s)\n" ,strerror (-ret)); } cmdline_parse_token_string_t cmd_global_config_cmd =
app/test-pmd/config.c +63 -11
93 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH 3/5] app/testpmd: re-implement commands by using private API
Quoted 51 lines · Chenxu Di
The legacy filter API will be superseded. This patch use private api to change the implementation of commands
global_config<port_id> gre-key-len <key_len> and show port fdir <port_id>Signed-off-by Chenxu Di <[email protected]>--- app/test-pmd/cmdline.c | 23 ++++++++----- app/test-pmd/config.c | 74 +++++++++++++++++++++++++++++++++++------- 2 files changed, 78 insertions(+), 19 deletions(-)app/test-pmd/cmdline.c +15
-8@@ -9280,15 +9280,22 @@ cmd_global_config_parsed(void *parsed_result, {struct cmd_global_config_result *res = parsed_result;struct rte_eth_global_cfg conf; -int ret; +int ret = -ENOTSUP ; -memset (&conf,0 ,sizeof (conf)); - conf.cfg_type =RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN ; - 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); -if (ret !=0 ) -printf ("Global config error\n" ); +#ifdef RTE_LIBRTE_I40E_PMD +if (ret == -ENOTSUP ) + ret =rte_pmd_i40e_set_gre_key_len (res->port_id, res->len); +#endif +if (ret == -ENOTSUP ) { +memset (&conf,0 ,sizeof (conf)); + conf.cfg_type =RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN ; + 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); + } + +if (ret <0 ) +printf ("Global config error: (%s)\n" ,strerror (-ret)); } cmdline_parse_token_string_t cmd_global_config_cmd =app/test-pmd/config.c +0
-0
app/test-pmd/config.c print_fdir_flow_type(uint32_t flow_types_mask) · line 3735
Quoted 7 lines
app/test-pmd/config.c +4
-0@@ -3729,30 +3729,82 @@ 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;
this looks like it won't compile if the RTE_LIBRTE_I40E_PMD is undefined, you'll need to initialize ret
Quoted 19 lines
app/test-pmd/config.c +19
-0+#ifdef RTE_LIBRTE_I40E_PMD + 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 +if (ret == -ENOTSUP ) { + 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 ret; + } +rte_eth_dev_filter_ctrl (port_id,RTE_ETH_FILTER_FDIR , +RTE_ETH_FILTER_INFO , fdir_info); + } +
app/test-pmd/config.c print_fdir_flow_type(uint32_t flow_types_mask) · line 3764
Quoted 10 lines
app/test-pmd/config.c +10
-0+if (ret <0 ) +printf ("Get fdir infos error: (%s)\n" ,strerror (-ret)); + +return ret; +} + +static int +get_fdir_stat (portid_t port_id,struct rte_eth_fdir_stats *fdir_stat) +{ +int ret;
Same comment as above
Quoted 58 lines
app/test-pmd/config.c +30
-11+#ifdef RTE_LIBRTE_I40E_PMD + 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 +if (ret == -ENOTSUP ) { + 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 ret; + } +rte_eth_dev_filter_ctrl (port_id,RTE_ETH_FILTER_FDIR , +RTE_ETH_FILTER_STATS , fdir_stat); + } + +if (ret <0 ) +printf ("Get fdir infos error: (%s)\n" ,strerror (-ret)); + +return ret; +} +void fdir_get_infos (portid_t port_id) {struct rte_eth_fdir_stats fdir_stat;struct rte_eth_fdir_info fdir_info; -int ret;static const char *fdir_stats_border ="########################" ;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); +if (get_fdir_info (port_id, &fdir_info)) +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); +if (get_fdir_stat (port_id, &fdir_stat)) +return ; +printf ("\n %s FDIR infos for port %-2d %s\n" , fdir_stats_border, port_id, fdir_stats_border);printf (" MODE: " );
Re: [dpdk-dev] [PATCH 3/5] app/testpmd: re-implement commands by using private API
Quoted 65 lines
-----Original Message-----
From: Kevin Traynor [mailto:[email protected]]
Sent: Wednesday, June 17, 2020 4:12 AM
To: Di, ChenxuX <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>; Yang, Qiming <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 3/5] app/testpmd: re-implement commands by using private APIQuoted 21 lines · Chenxu Di
The legacy filter API will be superseded. This patch use private api to change the implementation of commands
global_config<port_id> gre-key-len <key_len> and show port fdir <port_id>Signed-off-by Chenxu Di <[email protected]>---
app/test-pmd/cmdline.c| 23 ++++++++-----app/test-pmd/config.c|
74 +++++++++++++++++++++++++++++++++++-------2 files changed, 78 insertions(+), 19 deletions(-)app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0
-0
996a49876..01d793e89100644app/test-pmd/cmdline.c +1
-1@@ -9280,15 +9280,22 @@ cmd_global_config_parsed(void *parsed_result, {struct cmd_global_config_result *res = parsed_result;struct rte_eth_global_cfg conf; -int ret; +int ret = -ENOTSUP ;app/test-pmd/cmdline.c cmd_global_config_parsed(void *parsed_result, · line 9287
Quoted 10 lines
app/test-pmd/cmdline.c +3
-7-memset (&conf,0 ,sizeof (conf)); - conf.cfg_type =RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN ; - 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); -if (ret !=0 ) -printf ("Global config error\n" ); +#ifdef RTE_LIBRTE_I40E_PMD +if (ret == -ENOTSUP ) + ret =rte_pmd_i40e_set_gre_key_len (res->port_id, res->len);#endif
app/test-pmd/cmdline.c cmd_global_config_parsed(void *parsed_result,
Quoted 5 lines
app/test-pmd/cmdline.c +5
-0+if (ret == -ENOTSUP ) { +memset (&conf,0 ,sizeof (conf)); + conf.cfg_type =RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN ; + conf.cfg.gre_key_len = res->len; + ret = rte_eth_dev_filter_ctrl(res->port_id,
RTE_ETH_FILTER_NONE,Quoted 16 lines
app/test-pmd/cmdline.c +5
-0+ RTE_ETH_FILTER_SET, &conf); + } + +if (ret <0 ) +printf ("Global config error: (%s)\n" ,strerror (-ret)); } cmdline_parse_token_string_t cmd_global_config_cmd = diff --git
a/app/test-pmd/config.cb/app/test-pmd/config.cindex016bcb09c..f519246c7100644app/test-pmd/config.c +0
-0@@ -3729,30 +3729,82 @@ print_fdir_flow_type(uint32_t flow_types_mask)printf ("\n" ); }
Quoted 8 lines
app/test-pmd/config.c print_fdir_flow_type(uint32_t flow_types_mask) · line 3735
Quoted 4 lines
app/test-pmd/config.c +4
-0+static int +get_fdir_info (portid_t port_id,struct rte_eth_fdir_info *fdir_info) +{ +int ret;this looks like it won't compile if the
RTE_LIBRTE_I40E_PMDis undefined, you'll need to initialize ret
Yes, got it, I will fix it in next version patch.
Quoted 21 lines
Quoted 21 lines
app/test-pmd/config.c +21
-0+#ifdef RTE_LIBRTE_I40E_PMD + 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 +if (ret == -ENOTSUP ) { + 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 ret; + } +rte_eth_dev_filter_ctrl (port_id,RTE_ETH_FILTER_FDIR , +RTE_ETH_FILTER_INFO , fdir_info); + } + +if (ret <0 ) +printf ("Get fdir infos error: (%s)\n" ,strerror (-ret)); + +return ret;
Quoted 9 lines
app/test-pmd/config.c print_fdir_flow_type(uint32_t flow_types_mask) · line 3764
Quoted 6 lines
app/test-pmd/config.c +6
-0+} + +static int +get_fdir_stat (portid_t port_id,struct rte_eth_fdir_stats *fdir_stat) +{ +int ret;Same comment as above
OK
Quoted 56 lines
Quoted 56 lines
app/test-pmd/config.c +28
-11+#ifdef RTE_LIBRTE_I40E_PMD + 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 +if (ret == -ENOTSUP ) { + 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 ret; + } +rte_eth_dev_filter_ctrl (port_id,RTE_ETH_FILTER_FDIR , +RTE_ETH_FILTER_STATS , fdir_stat); + } + +if (ret <0 ) +printf ("Get fdir infos error: (%s)\n" ,strerror (-ret)); + +return ret; +} +void fdir_get_infos (portid_t port_id) {struct rte_eth_fdir_stats fdir_stat;struct rte_eth_fdir_info fdir_info; -int ret;static const char *fdir_stats_border ="########################" ;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); +if (get_fdir_info (port_id, &fdir_info)) +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); +if (get_fdir_stat (port_id, &fdir_stat)) +return ; +printf ("\n %s FDIR infos for port %-2d %s\n" , fdir_stats_border, port_id, fdir_stats_border);printf (" MODE: " );
Re: [dpdk-dev] [PATCH 3/5] app/testpmd: re-implement commands by using private API
hi, chenxu
Quoted 31 lines · ChenxuX
Quoted 31 lines
-----Original Message-----
From: Kevin Traynor [mailto:[email protected]]
Sent: Wednesday, June 17, 2020 4:12 AM
To: Di, ChenxuX <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>; Yang, Qiming <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 3/5] app/testpmd: re-implement commands by using private APIQuoted 21 lines · Chenxu Di
The legacy filter API will be superseded. This patch use private api to change the implementation of commands
global_config<port_id> gre-key-len <key_len> and show port fdir <port_id>Signed-off-by Chenxu Di <[email protected]>---
app/test-pmd/cmdline.c| 23 ++++++++-----app/test-pmd/config.c|
74 +++++++++++++++++++++++++++++++++++-------2 files changed, 78 insertions(+), 19 deletions(-)app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0
-0
996a49876..01d793e89100644app/test-pmd/cmdline.c +1
-1@@ -9280,15 +9280,22 @@ cmd_global_config_parsed(void *parsed_result, {struct cmd_global_config_result *res = parsed_result;struct rte_eth_global_cfg conf; -int ret; +int ret = -ENOTSUP ;
Quoted 9 lines
Quoted 9 lines
app/test-pmd/cmdline.c cmd_global_config_parsed(void *parsed_result, · line 9286
Quoted 9 lines
app/test-pmd/cmdline.c +2
-7-memset (&conf,0 ,sizeof (conf)); - conf.cfg_type =RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN ; - 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); -if (ret !=0 ) -printf ("Global config error\n" ); +#ifdef RTE_LIBRTE_I40E_PMD +if (ret == -ENOTSUP )
you init ret to be default value and then check if ret to be default value, it that need?
Quoted 31 lines
Quoted 24 lines
app/test-pmd/cmdline.c cmd_global_config_parsed(void *parsed_result, · line 9287
Quoted 1 line
app/test-pmd/cmdline.c +1
-0+ ret =rte_pmd_i40e_set_gre_key_len (res->port_id, res->len);#endif
app/test-pmd/cmdline.c cmd_global_config_parsed(void *parsed_result,
Quoted 5 lines
app/test-pmd/cmdline.c +5
-0+if (ret == -ENOTSUP ) { +memset (&conf,0 ,sizeof (conf)); + conf.cfg_type =RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN ; + conf.cfg.gre_key_len = res->len; + ret = rte_eth_dev_filter_ctrl(res->port_id,
RTE_ETH_FILTER_NONE,Quoted 16 lines
app/test-pmd/cmdline.c +5
-0+ RTE_ETH_FILTER_SET, &conf); + } + +if (ret <0 ) +printf ("Global config error: (%s)\n" ,strerror (-ret)); } cmdline_parse_token_string_t cmd_global_config_cmd = diff --git
a/app/test-pmd/config.cb/app/test-pmd/config.cindex016bcb09c..f519246c7100644app/test-pmd/config.c +0
-0@@ -3729,30 +3729,82 @@ print_fdir_flow_type(uint32_t flow_types_mask)printf ("\n" ); }Quoted 7 lines
app/test-pmd/config.c print_fdir_flow_type(uint32_t flow_types_mask) · line 3735
Quoted 4 lines
app/test-pmd/config.c +4
-0+static int +get_fdir_info (portid_t port_id,struct rte_eth_fdir_info *fdir_info) +{ +int ret;this looks like it won't compile if the
RTE_LIBRTE_I40E_PMDis undefined, you'll need to initialize ret
Quoted 6 lines
Yes, got it, I will fix it in next version patch.
Quoted 4 lines
app/test-pmd/config.c print_fdir_flow_type(uint32_t flow_types_mask) · line 3739
Quoted 4 lines
app/test-pmd/config.c +4
-0+#ifdef RTE_LIBRTE_I40E_PMD + ret =rte_pmd_i40e_get_fdir_info (port_id, fdir_info);#endif #ifdef +RTE_LIBRTE_IXGBE_PMD +if (ret == -ENOTSUP )
Suggest not init ret to be -ENOTSUP, so this checking of if (ret == -ENOTSUP) is no need.
Quoted 37 lines
Quoted 16 lines
Quoted 16 lines
app/test-pmd/config.c +16
-0+ ret =rte_pmd_ixgbe_get_fdir_info (port_id, fdir_info);#endif +if (ret == -ENOTSUP ) { + 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 ret; + } +rte_eth_dev_filter_ctrl (port_id,RTE_ETH_FILTER_FDIR , +RTE_ETH_FILTER_INFO , fdir_info); + } + +if (ret <0 ) +printf ("Get fdir infos error: (%s)\n" ,strerror (-ret)); +Quoted 9 lines
app/test-pmd/config.c print_fdir_flow_type(uint32_t flow_types_mask) · line 3764
Quoted 7 lines
app/test-pmd/config.c +7
-0+return ret; +} + +static int +get_fdir_stat (portid_t port_id,struct rte_eth_fdir_stats *fdir_stat) +{ +int ret;Same comment as above
OK
Quoted 10 lines
Quoted 10 lines
app/test-pmd/config.c +10
-0+#ifdef RTE_LIBRTE_I40E_PMD + 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 +if (ret == -ENOTSUP ) { + 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",
Quoted 8 lines
Quoted 8 lines
app/test-pmd/config.c print_fdir_flow_type(uint32_t flow_types_mask) · line 3784
Quoted 8 lines
app/test-pmd/config.c +8
-0+ port_id); +return ret; + } +rte_eth_dev_filter_ctrl (port_id,RTE_ETH_FILTER_FDIR , +RTE_ETH_FILTER_STATS , fdir_stat); + } + +if (ret <0 )
if (ret) should be enough.
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
app/test-pmd/config.c +5
-7+printf ("Get fdir infos error: (%s)\n" ,strerror (-ret)); + +return ret; +} +void fdir_get_infos (portid_t port_id) {struct rte_eth_fdir_stats fdir_stat;struct rte_eth_fdir_info fdir_info; -int ret;static const char *fdir_stats_border ="########################" ;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 ; - }
Quoted 5 lines
Quoted 5 lines
app/test-pmd/config.c print_fdir_flow_type(uint32_t flow_types_mask) · line 3803
Quoted 5 lines
app/test-pmd/config.c +2
-2memset (&fdir_info,0 ,sizeof (fdir_info)); -rte_eth_dev_filter_ctrl (port_id,RTE_ETH_FILTER_FDIR , -RTE_ETH_FILTER_INFO , &fdir_info); +if (get_fdir_info (port_id, &fdir_info)) +return ;
Suggest print error log out of the caller but not in the calling, it should be better.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
app/test-pmd/config.c +3
-2memset (&fdir_stat,0 ,sizeof (fdir_stat)); -rte_eth_dev_filter_ctrl (port_id,RTE_ETH_FILTER_FDIR , -RTE_ETH_FILTER_STATS , &fdir_stat); +if (get_fdir_stat (port_id, &fdir_stat)) +return ; +printf ("\n %s FDIR infos for port %-2d %s\n" , fdir_stats_border, port_id, fdir_stats_border);printf (" MODE: " );
PATCH 4/5 net/i40e: enable flow query RSS
In reply to Chenxu DiThis patch enables flow query function to get the
configuration ofthe specified rule.
--- drivers/net/i40e/i40e_flow.c | 51 ++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
drivers/net/i40e/i40e_flow.c +51 -0
@@ -43,6 +43,11 @@ 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 +134,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 +5468,48 @@ 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 ; +}
Signature · 1 line
2.17.1
PATCH 5/5 app/testpmd: support query RSS config in flow query
In reply to Chenxu DiThis patch support RSS action in flow query.
It can display the RSS configuration of the specified rule.
--- app/test-pmd/config.c | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
app/test-pmd/config.c +55 -0
@@ -1378,6 +1378,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" ); +for (i =0 ; i < rss_conf->queue_num; i++) +printf (" %d" , rss_conf->queue[i]); + +printf ("\n 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,
@@ -1564,6 +1614,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;
@@ -1585,6 +1636,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",
@@ -1609,6 +1661,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);
Signature · 1 line
2.17.1
v2 cover re-implement legacy filter functions by private API
In reply to Chenxu DiThe 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 features get_fdir_info, get_fdir_stat and set_gre_key_len as private API.
This patch also enable RSS action in flow query.
v2:
-fixed the __rte_experimental flag
Chenxu Di (5):
net/i40e: add private APIs
net/ixgbe: add private APIs
app/testpmd: re-implement commands by using private API net/i40e: enable flow query RSS
app/testpmd: support query RSS config in flow query
app/test-pmd/cmdline.c | 23 ++-- app/test-pmd/config.c | 129 ++++++++++++++++++-- doc/guides/rel_notes/release_20_08.rst | 14 +++ drivers/net/i40e/i40e_ethdev.c | 2 +- drivers/net/i40e/i40e_ethdev.h | 5 + drivers/net/i40e/i40e_fdir.c | 4 +- drivers/net/i40e/i40e_flow.c | 51 ++++++++ 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 + 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 + 15 files changed, 383 insertions(+), 28 deletions(-)
Signature · 1 line
2.17.1
PATCH v2 1/5 net/i40e: add private APIs
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.
--- doc/guides/rel_notes/release_20_08.rst | 14 +++++++ 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, 125 insertions(+), 3 deletions(-)
doc/guides/rel_notes/release_20_08.rst +14 -0
@@ -62,6 +62,20 @@ New Features * Added new PMD devarg ``reclaim_mem_mode``. +* **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. + * Added support for flow query RSS. + +* **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 -------------
drivers/net/i40e/i40e_ethdev.c +1 -1
@@ -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;
drivers/net/i40e/i40e_ethdev.h +5 -0
@@ -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);
drivers/net/i40e/i40e_fdir.c +2 -2
@@ -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);
drivers/net/i40e/rte_pmd_i40e.c +51 -0
57 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e.h +49 -0
55 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e_version.map +3 -0
@@ -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; };
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2 1/5] net/i40e: add private APIs
hi, chenxu
Quoted 33 lines · Chenxu Di
The legacy filter API will be superseded by
rte_flow. There are also several small features which can not be implemented inrte_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 <[email protected]>--- doc/guides/rel_notes/release_20_08.rst | 14 +++++++ 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, 125 insertions(+), 3 deletions(-)doc/guides/rel_notes/release_20_08.rst +5
-0@@ -62,6 +62,20 @@ New Features * Added new PMD devarg ``reclaim_mem_mode``. +* **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.
doc/guides/rel_notes/release_20_08.rst New Features · line 79
Quoted 10 lines
doc/guides/rel_notes/release_20_08.rst +9
-0+ * Re-implemented set_gre_key_len in private API. + * Added support for flow query RSS. + +* **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. +
Should the ixgbe part of document remove into the next ixgbe patch [2/5]?
Quoted 20 lines
doc/guides/rel_notes/release_20_08.rst +0
-0Removed Items -------------drivers/net/i40e/i40e_ethdev.c +1
-1@@ -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;drivers/net/i40e/i40e_ethdev.h +0
-0
drivers/net/i40e/i40e_ethdev.h enum i40e_filter_pctype · line 1277
Quoted 8 lines
drivers/net/i40e/i40e_ethdev.h +5
-0@@ -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);
Please check the alignment.
Quoted 160 lines
drivers/net/i40e/i40e_ethdev.h +0
-0int i40e_fdir_ctrl_func (struct rte_eth_dev *dev,enum rte_filter_op filter_op,void *arg);drivers/net/i40e/i40e_fdir.c +2
-2@@ -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);drivers/net/i40e/rte_pmd_i40e.c +51
-0@@ -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) {drivers/net/i40e/rte_pmd_i40e.h +49
-0@@ -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, drivers/net/i40e/rte_pmd_i40e_version.map +3
-0@@ -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; };
Re: [dpdk-dev] [PATCH v2 1/5] net/i40e: add private APIs
In reply to Chenxu DiQuoted 75 lines
-----Original Message-----
From: Di, ChenxuX <[email protected]>
Sent: Monday, June 15, 2020 10:19
To: [email protected]
Cc: Xing, Beilei <[email protected]>; Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: [PATCH v2 1/5] net/i40e: add private APIsThe legacy filter API will be superseded by
rte_flow. There are also several small features which can not be implemented inrte_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 <[email protected]>--- doc/guides/rel_notes/release_20_08.rst | 14 +++++++ 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, 125 insertions(+), 3 deletions(-)doc/guides/rel_notes/release_20_08.rst +3
-0@@ -62,6 +62,20 @@ New Features * Added new PMD devarg ``reclaim_mem_mode``. +* **Updated the Intel i40e driver.** + + Updated the Intel i40e driver with new features and improvements,including:
doc/guides/rel_notes/release_20_08.rst +8
-0+ + * 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.** + + Updated the Intel ixgbe driver with new features and improvements,including:
doc/guides/rel_notes/release_20_08.rst +3
-0+ + * Re-implemented get_fdir_info and get_fdir_stat in private API. + Removed Items -------------drivers/net/i40e/i40e_ethdev.c +1
-1@@ -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.hb/drivers/net/i40e/i40e_ethdev.hindex e5d0ce53f..192636927 100644drivers/net/i40e/i40e_ethdev.h +0
-0@@ -1270,6 +1270,11 @@ enum i40e_filter_pctype uint16_t flow_type);
drivers/net/i40e/i40e_ethdev.h enum i40e_filter_pctype · line 1280
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.h +5
-0uint16_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);
It doesn't make sense to add the definition here as these functions only called by private API. I think it better to move these function to private also
[...]
Quoted 2 lines
--
2.17.1
Re: [dpdk-dev] [PATCH v2 1/5] net/i40e: add private APIs
Quoted 89 lines
-----Original Message-----
From: Yang, Qiming
Sent: Tuesday, June 30, 2020 6:25 PM
To: Di, ChenxuX <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>
Subject: RE: [PATCH v2 1/5] net/i40e: add private APIsQuoted 78 lines
-----Original Message-----
From: Di, ChenxuX <[email protected]>
Sent: Monday, June 15, 2020 10:19
To: [email protected]
Cc: Xing, Beilei <[email protected]>; Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: [PATCH v2 1/5] net/i40e: add private APIsThe legacy filter API will be superseded by
rte_flow. There are also several small features which can not be implemented inrte_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 <[email protected]>--- doc/guides/rel_notes/release_20_08.rst | 14 +++++++ 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, 125 insertions(+), 3 deletions(-)doc/guides/rel_notes/release_20_08.rst +3
-0@@ -62,6 +62,20 @@ New Features * Added new PMD devarg ``reclaim_mem_mode``. +* **Updated the Intel i40e driver.** + + Updated the Intel i40e driver with new features and improvements,including:
doc/guides/rel_notes/release_20_08.rst +8
-0+ + * 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.** + + Updated the Intel ixgbe driver with new features and improvements,including:
doc/guides/rel_notes/release_20_08.rst +3
-0+ + * Re-implemented get_fdir_info and get_fdir_stat in private API. + Removed Items -------------(quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.cindex970a31cb2..674b711d9100644drivers/net/i40e/i40e_ethdev.c +1
-1@@ -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 = &((structi40e_adapter*)hw->back)->pf; diff -- gita/drivers/net/i40e/i40e_ethdev.hb/drivers/net/i40e/i40e_ethdev.hindex e5d0ce53f..192636927 100644drivers/net/i40e/i40e_ethdev.h +3
-0@@ -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
Quoted 9 lines
drivers/net/i40e/i40e_ethdev.h enum i40e_filter_pctype · line 1280
Quoted 4 lines
drivers/net/i40e/i40e_ethdev.h +1
-0+rte_eth_fdir_stats *stat);int i40e_fdir_ctrl_func (struct rte_eth_dev *dev,enum rte_filter_op filter_op,void *arg);It doesn't make sense to add the definition here as these functions only called by private API.
I think it better to move these function to private also
For the reason the legacy filter API and function is not really removed, it will call the function. It may not be the right time to move the functions to private.
The same as ixgbe.
Quoted 6 lines
[...]
Quoted 2 lines
--
2.17.1
PATCH v2 2/5 net/ixgbe: add private APIs
In reply to Chenxu DiThe 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.
--- 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 ++ 5 files changed, 74 insertions(+), 6 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.h +4 -0
@@ -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);
drivers/net/ixgbe/ixgbe_fdir.c +2 -6
@@ -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);
drivers/net/ixgbe/rte_pmd_ixgbe.c +33 -0
@@ -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 ; +}
drivers/net/ixgbe/rte_pmd_ixgbe.h +33 -0
@@ -726,4 +726,37 @@ enum {__rte_experimental intrte_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_ */
drivers/net/ixgbe/rte_pmd_ixgbe_version.map +2 -0
@@ -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;
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2 2/5] net/ixgbe: add private APIs
hi, chenxu
Quoted 83 lines · Chenxu Di
The legacy filter API will be superseded by
rte_flow. There are also several small features which can not be implemented inrte_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 <[email protected]>--- 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 ++ 5 files changed, 74 insertions(+), 6 deletions(-)drivers/net/ixgbe/ixgbe_ethdev.h +4
-0@@ -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);drivers/net/ixgbe/ixgbe_fdir.c +2
-6@@ -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);drivers/net/ixgbe/rte_pmd_ixgbe.c +10
-0@@ -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))
drivers/net/ixgbe/rte_pmd_ixgbe.c rte_pmd_ixgbe_mdio_unlocked_write(uint16_t port, uint32_t reg_addr, · line 1161
Quoted 10 lines
drivers/net/ixgbe/rte_pmd_ixgbe.c +10
-0+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)
Please check the alignment and other places.
Quoted 68 lines
drivers/net/ixgbe/rte_pmd_ixgbe.c +13
-0+{ +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 ; +}drivers/net/ixgbe/rte_pmd_ixgbe.h +33
-0@@ -726,4 +726,37 @@ enum {__rte_experimental intrte_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_ */ drivers/net/ixgbe/rte_pmd_ixgbe_version.map +2
-0@@ -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;
Re: [dpdk-dev] [PATCH v2 2/5] net/ixgbe: add private APIs
In reply to Chenxu DiSame comments as the first one
Quoted 179 lines
-----Original Message-----
From: Di, ChenxuX <[email protected]>
Sent: Monday, June 15, 2020 10:19
To: [email protected]
Cc: Xing, Beilei <[email protected]>; Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: [PATCH v2 2/5] net/ixgbe: add private APIsThe legacy filter API will be superseded by
rte_flow. There are also several small features which can not be implemented inrte_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 <[email protected]>--- 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 ++ 5 files changed, 74 insertions(+), 6 deletions(-)drivers/net/ixgbe/ixgbe_ethdev.h +4
-0@@ -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);drivers/net/ixgbe/ixgbe_fdir.c +0
-3@@ -109,10 +109,6 @@ static int ixgbe_add_del_fdir_filter(structrte_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.drivers/net/ixgbe/ixgbe_fdir.c +1
-1@@ -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); }drivers/net/ixgbe/ixgbe_fdir.c +1
-1-static void +void ixgbe_fdir_stats_get(struct rte_eth_dev *dev, struct rte_eth_fdir_stats
*fdir_stats) {
structixgbe_hw*hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data-Quoted 1 line
dev_private);drivers/net/ixgbe/rte_pmd_ixgbe.c +32
-0@@ -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 ; +}drivers/net/ixgbe/rte_pmd_ixgbe.h +34
-0@@ -726,4 +726,37 @@ enum {__rte_experimental intrte_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_ */ drivers/net/ixgbe/rte_pmd_ixgbe_version.map +2
-1@@ -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; --2.17.1
PATCH v2 3/5 app/testpmd: re-implement commands by using private API
In reply to Chenxu DiThe legacy filter API will be superseded. This patch use private api to change the implementation of commands global_config <port_id> gre-key-len <key_len> and show port fdir <port_id>
--- app/test-pmd/cmdline.c | 23 ++++++++----- app/test-pmd/config.c | 74 +++++++++++++++++++++++++++++++++++------- 2 files changed, 78 insertions(+), 19 deletions(-)
app/test-pmd/cmdline.c +15 -8
@@ -9280,15 +9280,22 @@ cmd_global_config_parsed(void *parsed_result, {struct cmd_global_config_result *res = parsed_result;struct rte_eth_global_cfg conf; -int ret; +int ret = -ENOTSUP ; -memset (&conf,0 ,sizeof (conf)); - conf.cfg_type =RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN ; - 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); -if (ret !=0 ) -printf ("Global config error\n" ); +#ifdef RTE_LIBRTE_I40E_PMD +if (ret == -ENOTSUP ) + ret =rte_pmd_i40e_set_gre_key_len (res->port_id, res->len); +#endif +if (ret == -ENOTSUP ) { +memset (&conf,0 ,sizeof (conf)); + conf.cfg_type =RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN ; + 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); + } + +if (ret <0 ) +printf ("Global config error: (%s)\n" ,strerror (-ret)); } cmdline_parse_token_string_t cmd_global_config_cmd =
app/test-pmd/config.c +63 -11
93 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2 3/5] app/testpmd: re-implement commands by using private API
Quoted 43 lines
-----Original Message-----
From: Di, ChenxuX <[email protected]>
Sent: Monday, June 15, 2020 10:19
To: [email protected]
Cc: Xing, Beilei <[email protected]>; Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: [PATCH v2 3/5] app/testpmd: re-implement commands by using private APIThe legacy filter API will be superseded. This patch use private api to change the implementation of commands
global_config<port_id> gre-key-len <key_len> and show port fdir <port_id>Signed-off-by Chenxu Di <[email protected]>--- app/test-pmd/cmdline.c | 23 ++++++++----- app/test-pmd/config.c | 74 +++++++++++++++++++++++++++++++++++------- 2 files changed, 78 insertions(+), 19 deletions(-)app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0
-0
996a49876..01d793e89100644app/test-pmd/cmdline.c +4
-8@@ -9280,15 +9280,22 @@ cmd_global_config_parsed(void *parsed_result, {struct cmd_global_config_result *res = parsed_result;struct rte_eth_global_cfg conf; -int ret; +int ret = -ENOTSUP ; -memset (&conf,0 ,sizeof (conf)); - conf.cfg_type =RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN ; - 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); -if (ret !=0 ) -printf ("Global config error\n" ); +#ifdef RTE_LIBRTE_I40E_PMD +if (ret == -ENOTSUP ) + ret = rte_pmd_i40e_set_gre_key_len(res->port_id, res-Quoted 1 line
len); #endif
app/test-pmd/cmdline.c
Quoted 1 line
app/test-pmd/cmdline.c +1
-0+if (ret == -ENOTSUP ) {
Why you double check the ret? recommend
If()
#ifdefine
...
#endif
...
And if it is needed to check ret as you set the return value as - ENOTSUP? And it's weird to set as NOT SUPPORT, don't change the exist logical.
Below all have the same issue.
Quoted 110 lines
app/test-pmd/cmdline.c +4
-0+memset (&conf,0 ,sizeof (conf)); + conf.cfg_type =RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN ; + conf.cfg.gre_key_len = res->len; + ret = rte_eth_dev_filter_ctrl(res->port_id,
RTE_ETH_FILTER_NONE,app/test-pmd/cmdline.c +5
-0+ RTE_ETH_FILTER_SET, &conf); + } + +if (ret <0 ) +printf ("Global config error: (%s)\n" ,strerror (-ret)); } cmdline_parse_token_string_t cmd_global_config_cmd = diff --git
a/app/test-pmd/config.cb/app/test-pmd/config.cindex016bcb09c..f519246c7100644app/test-pmd/config.c +57
-12@@ -3729,30 +3729,82 @@ 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; +#ifdef RTE_LIBRTE_I40E_PMD + 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 +if (ret == -ENOTSUP ) { + 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 ret; + } +rte_eth_dev_filter_ctrl (port_id,RTE_ETH_FILTER_FDIR , +RTE_ETH_FILTER_INFO , fdir_info); + } + +if (ret <0 ) +printf ("Get fdir infos error: (%s)\n" ,strerror (-ret)); + +return ret; +} + +static int +get_fdir_stat (portid_t port_id,struct rte_eth_fdir_stats *fdir_stat) { +int ret; +#ifdef RTE_LIBRTE_I40E_PMD + 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 +if (ret == -ENOTSUP ) { + 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 ret; + } +rte_eth_dev_filter_ctrl (port_id,RTE_ETH_FILTER_FDIR , +RTE_ETH_FILTER_STATS , fdir_stat); + } + +if (ret <0 ) +printf ("Get fdir infos error: (%s)\n" ,strerror (-ret)); + +return ret; +} +void fdir_get_infos (portid_t port_id) {struct rte_eth_fdir_stats fdir_stat;struct rte_eth_fdir_info fdir_info; -int ret;static const char *fdir_stats_border ="########################" ;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); +if (get_fdir_info (port_id, &fdir_info)) +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); +if (get_fdir_stat (port_id, &fdir_stat)) +return ; +printf ("\n %s FDIR infos for port %-2d %s\n" , fdir_stats_border, port_id, fdir_stats_border);printf (" MODE: " ); --2.17.1
PATCH v2 4/5 net/i40e: enable flow query RSS
In reply to Chenxu DiThis patch enables flow query function to get the
configuration ofthe specified rule.
--- drivers/net/i40e/i40e_flow.c | 51 ++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
drivers/net/i40e/i40e_flow.c +51 -0
@@ -43,6 +43,11 @@ 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 +134,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 +5468,48 @@ 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 ; +}
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2 4/5] net/i40e: enable flow query RSS
hi, chenxu
Quoted 2 lines · Chenxu Di
This patch enables flow query function to get the
configuration ofthe specified rule.
"ofthe" should be "of the".
Quoted 31 lines
Signed-off-by Chenxu Di <[email protected]>--- drivers/net/i40e/i40e_flow.c | 51 ++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)drivers/net/i40e/i40e_flow.c +6
-0@@ -43,6 +43,11 @@ 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 +134,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;
drivers/net/i40e/i40e_flow.c i40e_flow_flush_rss_filter(struct rte_eth_dev *dev) · line 5477
Quoted 10 lines
drivers/net/i40e/i40e_flow.c +7
-0@@ -5462,3 +5468,48 @@ 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)
This line is no need to separate and please check also below code.
Quoted 38 lines
drivers/net/i40e/i40e_flow.c +38
-0+{ +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 ; +}
Re: [dpdk-dev] [PATCH v2 4/5] net/i40e: enable flow query RSS
In reply to Chenxu DiQuoted 75 lines
-----Original Message-----
From: Di, ChenxuX <[email protected]>
Sent: Monday, June 15, 2020 10:19
To: [email protected]
Cc: Xing, Beilei <[email protected]>; Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: [PATCH v2 4/5] net/i40e: enable flow query RSSThis patch enables flow query function to get the configuration ofthe specified rule.
Signed-off-by Chenxu Di <[email protected]>--- drivers/net/i40e/i40e_flow.c | 51 ++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)drivers/net/i40e/i40e_flow.c +5
-0@@ -43,6 +43,11 @@ 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 +134,7 @@ const struct
rte_flow_opsi40e_flow_ops= {drivers/net/i40e/i40e_flow.c +1
-0.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 +5468,48 @@
i40e_flow_flush_rss_filter(struct rte_eth_dev *dev)drivers/net/i40e/i40e_flow.c +27
-0return 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,
drivers/net/i40e/i40e_flow.c i40e_flow_flush_rss_filter(struct rte_eth_dev *dev) · line 5504
Quoted 7 lines
drivers/net/i40e/i40e_flow.c +7
-0+ actions, + "action not supported"); +return -rte_errno; + } +rte_memcpy (rss_conf, + &rss_rule->rss_filter_info.conf, +sizeof (struct rte_flow_action_rss ));
Don't understand the behavior, what's action means? What's the things this commend query?
Quoted 14 lines
drivers/net/i40e/i40e_flow.c +4
-0+break ; +default : + return rte_flow_error_set(error, ENOTSUP, +
RTE_FLOW_ERROR_TYPE_ACTION,drivers/net/i40e/i40e_flow.c +7
-1+ actions, + "action not supported"); + } + } + +return 0 ; +} --2.17.1
Re: [dpdk-dev] [PATCH v2 4/5] net/i40e: enable flow query RSS
Hi,
Quoted 78 lines
-----Original Message-----
From: Yang, Qiming
Sent: Tuesday, June 30, 2020 6:27 PM
To: Di, ChenxuX <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>
Subject: RE: [PATCH v2 4/5] net/i40e: enable flow query RSSQuoted 69 lines
-----Original Message-----
From: Di, ChenxuX <[email protected]>
Sent: Monday, June 15, 2020 10:19
To: [email protected]
Cc: Xing, Beilei <[email protected]>; Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: [PATCH v2 4/5] net/i40e: enable flow query RSSThis patch enables flow query function to get the configuration ofthe specified rule.
Signed-off-by Chenxu Di <[email protected]>--- drivers/net/i40e/i40e_flow.c | 51 ++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_flow.cindex8f8df6fae..b070802bd100644drivers/net/i40e/i40e_flow.c +5
-0@@ -43,6 +43,11 @@ 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 +134,7 @@ const struct
rte_flow_opsi40e_flow_ops= { .create =i40e_flow_create, .destroy =i40e_flow_destroy, .flush =i40e_flow_flush,
+.query =i40e_flow_query,
};static union
i40e_filter_tcons_filter; @@ -5462,3 +5468,48 @@i40e_flow_flush_rss_filter(struct rte_eth_dev *dev)return ret;
}drivers/net/i40e/i40e_flow.c +22
-0+ +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,drivers/net/i40e/i40e_flow.c +2
-0+ actions, + "action not supported");
Quoted 9 lines
drivers/net/i40e/i40e_flow.c i40e_flow_flush_rss_filter(struct rte_eth_dev *dev) · line 5504
Quoted 5 lines
drivers/net/i40e/i40e_flow.c +5
-0+return -rte_errno; +} +rte_memcpy (rss_conf, + &rss_rule->rss_filter_info.conf, +sizeof (struct rte_flow_action_rss ));Don't understand the behavior, what's action means? What's the things this commend query?
By zhangqi's comment, it will query the configuration of rss rule. It just return the config and display it.
Quoted 15 lines
Quoted 14 lines
drivers/net/i40e/i40e_flow.c +4
-0+break ; +default : +return rte_flow_error_set(error, ENOTSUP, +
RTE_FLOW_ERROR_TYPE_ACTION,drivers/net/i40e/i40e_flow.c +7
-1+ actions, + "action not supported"); +} +} + +return 0 ; +} --2.17.1
PATCH v2 5/5 app/testpmd: support query RSS config in flow query
In reply to Chenxu DiThis patch support RSS action in flow query.
It can display the RSS configuration of the specified rule.
--- app/test-pmd/config.c | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
app/test-pmd/config.c +55 -0
@@ -1378,6 +1378,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" ); +for (i =0 ; i < rss_conf->queue_num; i++) +printf (" %d" , rss_conf->queue[i]); + +printf ("\n 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,
@@ -1564,6 +1614,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;
@@ -1585,6 +1636,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",
@@ -1609,6 +1661,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);
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2 5/5] app/testpmd: support query RSS config in flow query
hi, chenxu
Quoted 2 lines · Chenxu Di
This patch support RSS action in flow query.
It can display the RSS configuration of the specified rule.
Could you add some example command here for better know the usage and the details.
Quoted 92 lines
Signed-off-by Chenxu Di <[email protected]>--- app/test-pmd/config.c | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)app/test-pmd/config.c +55
-0@@ -1378,6 +1378,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" ); +for (i =0 ; i < rss_conf->queue_num; i++) +printf (" %d" , rss_conf->queue[i]); + +printf ("\n 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,@@ -1564,6 +1614,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;@@ -1585,6 +1636,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",@@ -1609,6 +1661,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);
Re: [dpdk-dev] [PATCH v2 5/5] app/testpmd: support query RSS config in flow query
In reply to Chenxu DiQuoted 28 lines
-----Original Message-----
From: Di, ChenxuX <[email protected]>
Sent: Monday, June 15, 2020 10:19
To: [email protected]
Cc: Xing, Beilei <[email protected]>; Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: [PATCH v2 5/5] app/testpmd: support query RSS config in flow queryThis patch support RSS action in flow query.
It can display the RSS configuration of the specified rule.Signed-off-by Chenxu Di <[email protected]>--- app/test-pmd/config.c | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)app/test-pmd/config.c index renamed from app/test-pmd/config.c +0
-0
f519246c7..7e3cccf9a100644app/test-pmd/config.c +1
-0@@ -1378,6 +1378,56 @@ port_flow_complain(struct rte_flow_error *error)return -err; } +static void
app/test-pmd/config.c port_flow_complain(struct rte_flow_error *error) · line 1391
Quoted 10 lines
app/test-pmd/config.c +10
-0+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:" );
Two lines needed? And why don't you add the space in the end of this printf?
app/test-pmd/config.c port_flow_complain(struct rte_flow_error *error) · line 1393
Quoted 1 line
app/test-pmd/config.c +1
-0+if (rss_conf->queue_num ==0 )
If(!rss_conf->queue_num)
app/test-pmd/config.c port_flow_complain(struct rte_flow_error *error) · line 1401
Quoted 8 lines
app/test-pmd/config.c +8
-0+printf (" none" ); +for (i =0 ; i < rss_conf->queue_num; i++) +printf (" %d" , rss_conf->queue[i]); + +printf ("\n function:" ); +switch (rss_conf->func) { +case RTE_ETH_HASH_FUNCTION_DEFAULT : +printf (" default\n" );
No needed space
app/test-pmd/config.c port_flow_complain(struct rte_flow_error *error) · line 1404
Quoted 3 lines
app/test-pmd/config.c +3
-0+break ; +case RTE_ETH_HASH_FUNCTION_TOEPLITZ : +printf (" toeplitz\n" );
Same
Quoted 3 lines
app/test-pmd/config.c +3
-0+break ; +case RTE_ETH_HASH_FUNCTION_SIMPLE_XOR : +printf (" simple_xor\n" );
...
Quoted 3 lines
app/test-pmd/config.c +3
-0+break ; +case RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ : +printf (" symmetric_toeplitz\n" );
..
Quoted 3 lines
app/test-pmd/config.c +3
-0+break ; +default : +printf (" Unknown function\n" );
...
app/test-pmd/config.c port_flow_complain(struct rte_flow_error *error) · line 1417
Quoted 4 lines
app/test-pmd/config.c +4
-0+return ; + } + +printf (" types:\n" );
Same...
app/test-pmd/config.c port_flow_complain(struct rte_flow_error *error) · line 1419
Quoted 2 lines
app/test-pmd/config.c +2
-0+if (rss_conf->types ==0 ) { +printf (" none\n" );
Same...
app/test-pmd/config.c port_flow_complain(struct rte_flow_error *error) · line 1427
Quoted 8 lines
app/test-pmd/config.c +8
-0+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);
All the same..
Quoted 34 lines
app/test-pmd/config.c +9
-1+ } +} +/** Validate flow rule. */ int port_flow_validate(portid_t port_id,@@ -1564,6 +1614,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;@@ -1585,6 +1636,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", @@ -1609,6 +1661,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); --2.17.1
Re: [dpdk-dev] [PATCH v2 5/5] app/testpmd: support query RSS config in flow query
Hi,
For the current code about flow query <portid> <ruleid> count It is printf("%s:\n"
" hits_set: %u\n" " bytes_set: %u\n" " hits: %" PRIu64 "\n" " bytes: %" PRIu64 "\n", name, query.count.hits_set, query.count.bytes_set, query.count.hits, query.count.bytes);
and it will display the info like:
COUNT:
hits_set: xxx
bytes_set : xxx
hits: xxx
bytes: xxx
so for the code style and info style like it, I add some space in the log to make sure the log like RSS:
Queues: none|0|1|...
Function: default| Toeplitz| simple_xor| symmetric_toeplitz| Unknown function Types:
none
Ipv4-tcp
Ipv4-udp
For the reason the types may be many types, and if the line in testpmd log is too long. It may cause error, so the types info is displayed per line and with one more space before.
Quoted 137 lines
-----Original Message-----
From: Yang, Qiming
Sent: Tuesday, June 30, 2020 6:41 PM
To: Di, ChenxuX <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>
Subject: RE: [PATCH v2 5/5] app/testpmd: support query RSS config in flow queryQuoted 25 lines
-----Original Message-----
From: Di, ChenxuX <[email protected]>
Sent: Monday, June 15, 2020 10:19
To: [email protected]
Cc: Xing, Beilei <[email protected]>; Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: [PATCH v2 5/5] app/testpmd: support query RSS config in flow queryThis patch support RSS action in flow query.
It can display the RSS configuration of the specified rule.Signed-off-by Chenxu Di <[email protected]>--- app/test-pmd/config.c | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)app/test-pmd/config.c index renamed from app/test-pmd/config.c +0
-0
f519246c7..7e3cccf9a100644app/test-pmd/config.c +0
-0@@ -1378,6 +1378,56 @@ port_flow_complain(struct rte_flow_error *error) return -err; }app/test-pmd/config.c port_flow_complain(struct rte_flow_error · line 1389
Quoted 10 lines
app/test-pmd/config.c +10
-0+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:" );Two lines needed? And why don't you add the space in the end of this printf?
app/test-pmd/config.c port_flow_complain(struct rte_flow_error *error) · line 1393
Quoted 1 line
app/test-pmd/config.c +1
-0+if (rss_conf->queue_num ==0 )
If(!rss_conf->queue_num)app/test-pmd/config.c port_flow_complain(struct rte_flow_error *error) · line 1401
Quoted 8 lines
app/test-pmd/config.c +8
-0+printf (" none" ); +for (i =0 ; i < rss_conf->queue_num; i++)printf (" %d" , +rss_conf->queue[i]); + +printf ("\n function:" ); +switch (rss_conf->func) { +case RTE_ETH_HASH_FUNCTION_DEFAULT : +printf (" default\n" );No needed space
app/test-pmd/config.c port_flow_complain(struct rte_flow_error *error) · line 1404
Quoted 3 lines
app/test-pmd/config.c +3
-0+break ; +case RTE_ETH_HASH_FUNCTION_TOEPLITZ : +printf (" toeplitz\n" );Same
Quoted 3 lines
app/test-pmd/config.c +3
-0+break ; +case RTE_ETH_HASH_FUNCTION_SIMPLE_XOR : +printf (" simple_xor\n" );...
Quoted 3 lines
app/test-pmd/config.c +3
-0+break ; +case RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ : +printf (" symmetric_toeplitz\n" );..
Quoted 3 lines
app/test-pmd/config.c +3
-0+break ; +default : +printf (" Unknown function\n" );...
app/test-pmd/config.c port_flow_complain(struct rte_flow_error *error) · line 1417
Quoted 4 lines
app/test-pmd/config.c +4
-0+return ; +} + +printf (" types:\n" );Same...
app/test-pmd/config.c port_flow_complain(struct rte_flow_error *error) · line 1419
Quoted 2 lines
app/test-pmd/config.c +2
-0+if (rss_conf->types ==0 ) { +printf (" none\n" );Same...
app/test-pmd/config.c port_flow_complain(struct rte_flow_error *error) · line 1427
Quoted 7 lines
app/test-pmd/config.c +7
-0+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);All the same..
Quoted 31 lines
app/test-pmd/config.c +4
-0+} +} +/** Validate flow rule. */ int port_flow_validate(portid_t port_id,@@ -1564,6 +1614,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;@@ -1585,6 +1636,7 @@ port_flow_query(portid_t port_id, uint32_t rule,return
port_flow_complain(&error); switch (action->type) { caseRTE_FLOW_ACTION_TYPE_COUNT:app/test-pmd/config.c +5
-1+case RTE_FLOW_ACTION_TYPE_RSS :break ;default : printf("Cannot query action type %d (%s)\n", @@ -1609,6 +1661,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); --2.17.1
v3 cover re-implement legacy filter functions by private API
In reply to Chenxu DiThe 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 features get_fdir_info, get_fdir_stat and set_gre_key_len as private API.
This patch also enable RSS action in flow query.
v3:
-updated the init of ret in testpmd
-updated the log style
-added sample in commit log
v2:
-fixed the __rte_experimental flag
Chenxu Di (5):
net/i40e: add private APIs
net/ixgbe: add private APIs
app/testpmd: re-implement commands by using private API net/i40e: enable flow query RSS
app/testpmd: support query RSS config in flow query
app/test-pmd/cmdline.c | 6 + app/test-pmd/config.c | 120 ++++++++++++++++++-- doc/guides/rel_notes/release_20_08.rst | 14 +++ drivers/net/i40e/i40e_ethdev.c | 2 +- drivers/net/i40e/i40e_ethdev.h | 5 + drivers/net/i40e/i40e_fdir.c | 4 +- drivers/net/i40e/i40e_flow.c | 49 ++++++++ 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 + 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 + 15 files changed, 364 insertions(+), 19 deletions(-)
Signature · 1 line
2.17.1
PATCH v3 1/5 net/i40e: add private APIs
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.
--- 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(-)
doc/guides/rel_notes/release_20_08.rst +7 -0
@@ -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 -------------
drivers/net/i40e/i40e_ethdev.c +1 -1
@@ -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;
drivers/net/i40e/i40e_ethdev.h +5 -0
@@ -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);
drivers/net/i40e/i40e_fdir.c +2 -2
@@ -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);
drivers/net/i40e/rte_pmd_i40e.c +51 -0
57 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e.h +49 -0
55 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e_version.map +3 -0
@@ -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; };
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 1/5] net/i40e: add private APIs
Quoted 216 lines · Chenxu Di
The legacy filter API will be superseded by
rte_flow. There are also several small features which can not be implemented inrte_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 <[email protected]>--- 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(-)doc/guides/rel_notes/release_20_08.rst +7
-0@@ -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 -------------drivers/net/i40e/i40e_ethdev.c +1
-1@@ -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;drivers/net/i40e/i40e_ethdev.h +5
-0@@ -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);drivers/net/i40e/i40e_fdir.c +2
-2@@ -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);drivers/net/i40e/rte_pmd_i40e.c +51
-0@@ -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) {drivers/net/i40e/rte_pmd_i40e.h +49
-0@@ -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, drivers/net/i40e/rte_pmd_i40e_version.map +0
-0
drivers/net/i40e/rte_pmd_i40e_version.map DPDK_20.0 { · line 49
Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e_version.map +3
-0@@ -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; };
PATCH v3 2/5 net/ixgbe: add private APIs
In reply to Chenxu DiThe 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.
--- 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(-)
doc/guides/rel_notes/release_20_08.rst +6 -0
@@ -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 -------------
drivers/net/ixgbe/ixgbe_ethdev.h +4 -0
@@ -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);
drivers/net/ixgbe/ixgbe_fdir.c +2 -6
@@ -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);
drivers/net/ixgbe/rte_pmd_ixgbe.c +33 -0
@@ -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 ; +}
drivers/net/ixgbe/rte_pmd_ixgbe.h +33 -0
@@ -726,4 +726,37 @@ enum {__rte_experimental intrte_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_ */
drivers/net/ixgbe/rte_pmd_ixgbe_version.map +2 -0
@@ -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;
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 2/5] net/ixgbe: add private APIs
Quoted 171 lines · Chenxu Di
The legacy filter API will be superseded by
rte_flow. There are also several small features which can not be implemented inrte_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 <[email protected]>--- 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(-)doc/guides/rel_notes/release_20_08.rst +6
-0@@ -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 -------------drivers/net/ixgbe/ixgbe_ethdev.h +4
-0@@ -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);drivers/net/ixgbe/ixgbe_fdir.c +2
-6@@ -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);drivers/net/ixgbe/rte_pmd_ixgbe.c +33
-0@@ -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 ; +}drivers/net/ixgbe/rte_pmd_ixgbe.h +33
-0@@ -726,4 +726,37 @@ enum {__rte_experimental intrte_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_ */ drivers/net/ixgbe/rte_pmd_ixgbe_version.map +0
-0
drivers/net/ixgbe/rte_pmd_ixgbe_version.map DPDK_20.0 { · line 45
Quoted 8 lines
drivers/net/ixgbe/rte_pmd_ixgbe_version.map +2
-0@@ -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;
PATCH v3 3/5 app/testpmd: re-implement commands by using private API
In reply to Chenxu DiThe legacy filter API will be superseded. This patch use private api to change the implementation of commands global_config <port_id> gre-key-len <key_len> and show port fdir <port_id>
--- app/test-pmd/cmdline.c | 6 ++++ app/test-pmd/config.c | 65 +++++++++++++++++++++++++++++++++++------- 2 files changed, 61 insertions(+), 10 deletions(-)
app/test-pmd/cmdline.c +6 -0
@@ -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" ); }
app/test-pmd/config.c +55 -10
80 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 3/5] app/testpmd: re-implement commands by using private API
hi, chenxu
Please use --in-relpy-to next time to help reviewers check all relevant comments,
and some minor comment, after fix it you could bring my ACK in the coming version, thanks.
Quoted 16 lines · Chenxu Di
The legacy filter API will be superseded. This patch use private api to change the implementation of commands
global_config<port_id> gre-key-len <key_len> and show port fdir <port_id>Signed-off-by Chenxu Di <[email protected]>--- app/test-pmd/cmdline.c | 6 ++++ app/test-pmd/config.c | 65 +++++++++++++++++++++++++++++++++++------- 2 files changed, 61 insertions(+), 10 deletions(-)app/test-pmd/cmdline.c +0
-0
app/test-pmd/cmdline.c cmd_global_config_parsed(void *parsed_result, · line 9290
Quoted 4 lines
app/test-pmd/cmdline.c +1
-0@@ -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); +
This blank line is no need.
app/test-pmd/cmdline.c cmd_global_config_parsed(void *parsed_result, · line 9295
Quoted 5 lines
app/test-pmd/cmdline.c +5
-0+#ifdef RTE_LIBRTE_I40E_PMD +if (ret == -ENOTSUP ) + ret =rte_pmd_i40e_set_gre_key_len (res->port_id, res->len); +#endif +
This blank line is also no need, since if the above macro is no defined, there will be two blank lines here.
Quoted 89 lines
app/test-pmd/cmdline.c +0
-0if (ret !=0 )printf ("Global config error\n" ); }app/test-pmd/config.c +55
-10@@ -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: " );
Re: [dpdk-dev] [PATCH v3 3/5] app/testpmd: re-implement commands by using private API
In reply to Chenxu DiQuoted 50 lines
-----Original Message-----
From: Di, ChenxuX <[email protected]>
Sent: Wednesday, July 1, 2020 16:25
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Guo, Jia <[email protected]>; Di, ChenxuX <[email protected]>
Subject: [PATCH v3 3/5] app/testpmd: re-implement commands by using private APIThe legacy filter API will be superseded. This patch use private api to change the implementation of commands
global_config<port_id> gre-key-len <key_len> and show port fdir <port_id>Signed-off-by Chenxu Di <[email protected]>--- app/test-pmd/cmdline.c | 6 ++++ app/test-pmd/config.c | 65 +++++++++++++++++++++++++++++++++++--- ---- 2 files changed, 61 insertions(+), 10 deletions(-)app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0
-0
996a49876..466c54aa9100644app/test-pmd/cmdline.c +4
-0@@ -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-Quoted 1 line
len); #endif
app/test-pmd/cmdline.c +1
-0+if (ret !=0 )printf ("Global config error\n" ); }app/test-pmd/config.c index renamed from app/test-pmd/config.c +0
-0
a7112c998..ed341c715100644app/test-pmd/config.c +3
-0@@ -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;
app/test-pmd/config.c print_fdir_flow_type(uint32_t flow_types_mask) · line 3742
Quoted 10 lines
app/test-pmd/config.c +10
-0+ + 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
No return value check.
app/test-pmd/config.c print_fdir_flow_type(uint32_t flow_types_mask) · line 3747
Quoted 5 lines
app/test-pmd/config.c +3
-0#ifdef +RTE_LIBRTE_IXGBE_PMD +if (ret == -ENOTSUP ) + ret =rte_pmd_ixgbe_get_fdir_info (port_id, fdir_info);#endif
We'd better use
If(ret == -ENOTSUP)
#ifdef RTE_LIBRTE_I40E_PMD
...
#endif
#ifdef RTE_LIBRTE_IXGBE_PMD
...
#endif
Same issue in patch 5
Quoted 20 lines
app/test-pmd/config.c +19
-0+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);
Quoted 1 line
#endif
Same as above
Quoted 19 lines
app/test-pmd/config.c +3
-7+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,
app/test-pmd/config.c fdir_get_infos(portid_t port_id) · line 3793
Quoted 10 lines
app/test-pmd/config.c +6
-3- 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);
Why you add new function here, it's no need to do that
Quoted 10 lines
app/test-pmd/config.c +5
-1+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: " ); --2.17.1
PATCH v3 4/5 net/i40e: enable flow query RSS
In reply to Chenxu DiThis patch enables flow query function to get the
configuration of the specified rule.
--- doc/guides/rel_notes/release_20_08.rst | 1 + drivers/net/i40e/i40e_flow.c | 49 ++++++++++++++++++++++++++ 2 files changed, 50 insertions(+)
doc/guides/rel_notes/release_20_08.rst +1 -0
@@ -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.**
drivers/net/i40e/i40e_flow.c +49 -0
64 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 4/5] net/i40e: enable flow query RSS
Quoted 82 lines · Chenxu Di
This patch enables flow query function to get the
configuration of the specified rule.Signed-off-by Chenxu Di <[email protected]>--- doc/guides/rel_notes/release_20_08.rst | 1 + drivers/net/i40e/i40e_flow.c | 49 ++++++++++++++++++++++++++ 2 files changed, 50 insertions(+)doc/guides/rel_notes/release_20_08.rst +1
-0@@ -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.**drivers/net/i40e/i40e_flow.c +39
-0@@ -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 ;
drivers/net/i40e/i40e_flow.c i40e_flow_flush_rss_filter(struct rte_eth_dev *dev) · line 5513
Quoted 10 lines
drivers/net/i40e/i40e_flow.c +10
-0+default : +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_ACTION , + actions, +"action not supported" ); + } + } + +return 0 ; +}
PATCH v3 5/5 app/testpmd: support query RSS config in flow query
In reply to Chenxu DiThis 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
--- app/test-pmd/config.c | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
app/test-pmd/config.c +55 -0
@@ -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);
Signature · 1 line
2.17.1
v4 cover re-implement legacy filter functions by private API
In reply to Chenxu DiThe 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 features get_fdir_info, get_fdir_stat and set_gre_key_len as private API.
This patch also enable RSS action in flow query.
v4:
-updated code in testpmd
v3:
-updated the init of ret in testpmd
-updated the log style
v2:
-fixed the __rte_experimental flag
Chenxu Di (5):
net/i40e: add private APIs
net/ixgbe: add private APIs
app/testpmd: re-implement commands by using private API net/i40e: enable flow query RSS
app/testpmd: support query RSS config in flow query
app/test-pmd/cmdline.c | 4 + app/test-pmd/config.c | 112 ++++++++++++++++++-- doc/guides/rel_notes/release_20_08.rst | 14 +++ drivers/net/i40e/i40e_ethdev.c | 2 +- drivers/net/i40e/i40e_ethdev.h | 5 + drivers/net/i40e/i40e_fdir.c | 4 +- drivers/net/i40e/i40e_flow.c | 49 +++++++++ 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 + 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 + 15 files changed, 353 insertions(+), 20 deletions(-)
Signature · 1 line
2.17.1
PATCH v4 1/5 net/i40e: add private APIs
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.
--- 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(-)
doc/guides/rel_notes/release_20_08.rst +7 -0
@@ -97,6 +97,13 @@ New Features Updated Marvell octeontx2 driver with cn98xx support. +* **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. + * **Updated the Intel ice driver.** Updated the Intel ice driver with new features and improvements, including:
drivers/net/i40e/i40e_ethdev.c +1 -1
@@ -8775,7 +8775,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;
drivers/net/i40e/i40e_ethdev.h +5 -0
@@ -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);
drivers/net/i40e/i40e_fdir.c +2 -2
@@ -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);
drivers/net/i40e/rte_pmd_i40e.c +51 -0
57 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e.h +49 -0
55 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e_version.map +3 -0
@@ -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; };
Signature · 1 line
2.17.1
PATCH v4 2/5 net/ixgbe: add private APIs
In reply to Chenxu DiThe 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.
--- 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(-)
doc/guides/rel_notes/release_20_08.rst +6 -0
@@ -104,6 +104,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. + * **Updated the Intel ice driver.** Updated the Intel ice driver with new features and improvements, including:
drivers/net/ixgbe/ixgbe_ethdev.h +4 -0
@@ -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);
drivers/net/ixgbe/ixgbe_fdir.c +2 -6
@@ -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);
drivers/net/ixgbe/rte_pmd_ixgbe.c +33 -0
@@ -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 ; +}
drivers/net/ixgbe/rte_pmd_ixgbe.h +33 -0
@@ -726,4 +726,37 @@ enum {__rte_experimental intrte_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_ */
drivers/net/ixgbe/rte_pmd_ixgbe_version.map +2 -0
@@ -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;
Signature · 1 line
2.17.1
PATCH v4 3/5 app/testpmd: re-implement commands by using private API
In reply to Chenxu DiThe legacy filter API will be superseded. This patch use private api to change the implementation of commands global_config <port_id> gre-key-len <key_len> and show port fdir <port_id>
--- app/test-pmd/cmdline.c | 4 +++ app/test-pmd/config.c | 57 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 50 insertions(+), 11 deletions(-)
app/test-pmd/cmdline.c +4 -0
@@ -9291,6 +9291,10 @@ 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" ); }
app/test-pmd/config.c +46 -11
76 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v4 3/5] app/testpmd: re-implement commands by using private API
Quoted 120 lines
-----Original Message-----
From: Di, ChenxuX <[email protected]>
Sent: Wednesday, July 8, 2020 09:19
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: [PATCH v4 3/5] app/testpmd: re-implement commands by using private APIThe legacy filter API will be superseded. This patch use private api to change the implementation of commands
global_config<port_id> gre-key-len <key_len> and show port fdir <port_id>Signed-off-by Chenxu Di <[email protected]>--- app/test-pmd/cmdline.c | 4 +++ app/test-pmd/config.c | 57 ++++++++++++++++++++++++++++++++++---- ---- 2 files changed, 50 insertions(+), 11 deletions(-)app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0
-0
81c87c8c3..39ad93838100644app/test-pmd/cmdline.c +3
-0@@ -9291,6 +9291,10 @@ 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-Quoted 1 line
len); #endif
app/test-pmd/cmdline.c +0
-0if (ret !=0 )printf ("Global config error\n" ); }app/test-pmd/config.c index renamed from app/test-pmd/config.c +0
-0
75013100f..cf14b584f100644app/test-pmd/config.c +45
-12@@ -3746,30 +3746,65 @@ 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, +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_INFO , fdir_info); +rte_eth_dev_filter_ctrl (port_id,RTE_ETH_FILTER_FDIR , +RTE_ETH_FILTER_STATS , fdir_stat); +return 0 ; + } + +#ifdef RTE_LIBRTE_I40E_PMD +if (ret == -ENOTSUP ) { + ret =rte_pmd_i40e_get_fdir_info (port_id, fdir_info); +if (!ret) + 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_info (port_id, fdir_info); +if (!ret) + ret =rte_pmd_ixgbe_get_fdir_stats (port_id, fdir_stat); + } +#endif +switch (ret) { +case 0 : +break ; +case -ENOTSUP : +printf ("\n FDIR is not supported on port %-2d\n" , + port_id); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); +break ; + } +return ret; +} +void fdir_get_infos (portid_t port_id) {struct rte_eth_fdir_stats fdir_stat;struct rte_eth_fdir_info fdir_info; -int ret;static const char *fdir_stats_border ="########################" ;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);memset (&fdir_stat,0 ,sizeof (fdir_stat)); -rte_eth_dev_filter_ctrl (port_id,RTE_ETH_FILTER_FDIR , -RTE_ETH_FILTER_STATS , &fdir_stat); +if (get_fdir_info (port_id, &fdir_info, &fdir_stat)) +return ; +printf ("\n %s FDIR infos for port %-2d %s\n" , fdir_stats_border, port_id, fdir_stats_border);printf (" MODE: " ); --2.17.1
PATCH v4 4/5 net/i40e: enable flow query RSS
In reply to Chenxu DiThis patch enables flow query function to get the
configuration of the specified rule.
--- doc/guides/rel_notes/release_20_08.rst | 1 + drivers/net/i40e/i40e_flow.c | 49 ++++++++++++++++++++++++++ 2 files changed, 50 insertions(+)
doc/guides/rel_notes/release_20_08.rst +1 -0
@@ -103,6 +103,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.**
drivers/net/i40e/i40e_flow.c +49 -0
64 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v4 5/5 app/testpmd: support query RSS config in flow query
In reply to Chenxu DiThis 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
--- app/test-pmd/config.c | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
app/test-pmd/config.c +55 -0
@@ -1395,6 +1395,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,
@@ -1581,6 +1631,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;
@@ -1602,6 +1653,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",
@@ -1626,6 +1678,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);
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v4 5/5] app/testpmd: support query RSS config in flow query
Quoted 118 lines
-----Original Message-----
From: Di, ChenxuX <[email protected]>
Sent: Wednesday, July 8, 2020 09:19
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: [PATCH v4 5/5] app/testpmd: support query RSS config in flow queryThis 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 funcsymmetric_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-onlySigned-off-by Chenxu Di <[email protected]>--- app/test-pmd/config.c | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)app/test-pmd/config.c index renamed from app/test-pmd/config.c +0
-0
cf14b584f..53a9b97d6100644app/test-pmd/config.c +55
-1@@ -1395,6 +1395,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,@@ -1581,6 +1631,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;@@ -1602,6 +1653,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", @@ -1626,6 +1678,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); --2.17.1
Zhang, Qi Z
AppliedQuoted 51 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Chenxu Di
Sent: Wednesday, July 8, 2020 9:19 AM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: [dpdk-dev] [PATCH v4 0/5] re-implement legacy filter functions by private APIThe legacy filter API will be superseded by
rte_flow. There are also several small features which can not be implemented inrte_flow.
This patch re-implemented featuresget_fdir_info,get_fdir_statandset_gre_key_lenas private API.
This patch also enable RSS action in flow query.v4:
-updated code in testpmd
v3:(quoted diff) +0
-2-updated the init of ret in testpmd -updated the log stylev2:
-fixed the__rte_experimentalflagChenxu Di (5):
net/i40e: add private APIs
net/ixgbe: add private APIs
app/testpmd: re-implement commands by using private API net/i40e: enable flow query RSS
app/testpmd: support query RSS config in flow queryapp/test-pmd/cmdline.c | 4 + app/test-pmd/config.c | 112 ++++++++++++++++++-- doc/guides/rel_notes/release_20_08.rst | 14 +++ drivers/net/i40e/i40e_ethdev.c | 2 +- drivers/net/i40e/i40e_ethdev.h | 5 + drivers/net/i40e/i40e_fdir.c | 4 +- drivers/net/i40e/i40e_flow.c | 49 +++++++++ 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 + 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 + 15 files changed, 353 insertions(+), 20 deletions(-)
Quoted 2 lines
--
2.17.1
Applied to dpdk-next-net-intel.
Thanks
Qi