Support configuring hash functions
v2 cover Support configuring hash functions
These pathches mainly support configuring hash functions. In detail,
- It can select Toeplitz or simple XOR hash functions.
- It can configure symmetric hash functions.
* Get/set symmetric hash enable per port.
* Get/set symmetric hash enable per 'PCTYPE'.
* Get/set filter swap configurations.
- 'ethdev' level interfaces are added.
* 'is_command_supported', to check if a feature (command) is supported on a port.
* 'rx_classification_filter_ctl', a common API to execute specific command of each feature.
- Seven commands are implemented in testpmd to support testing above.
Note that 'PCTYPE' means 'Packet Classification Type'.
Helin Zhang (6):
ethdev: rename macros of packet classification type
ethdev: add new ops of 'is_command_supported' and
'rx_classification_filter_ctl'
i40e: support of 'rx_classification_filter_ctl'
i40e: support of 'is_command_supported'
i40e: Initialize hash function during port initialization. app/testpmd: add commands for configuring hash functions
app/test-pmd/cmdline.c | 579 ++++++++++++++++++++++++++++++++++++ lib/librte_ether/Makefile | 1 + lib/librte_ether/rte_eth_features.h | 73 +++++ lib/librte_ether/rte_ethdev.c | 31 ++ lib/librte_ether/rte_ethdev.h | 131 +++++--- lib/librte_pmd_i40e/Makefile | 6 + lib/librte_pmd_i40e/i40e_ethdev.c | 484 ++++++++++++++++++++++++++++++ lib/librte_pmd_i40e/i40e_ethdev.h | 2 + lib/librte_pmd_i40e/rte_i40e.h | 108 +++++++ 9 files changed, 1377 insertions(+), 38 deletions(-) create mode 100644 lib/librte_ether/rte_eth_features.h create mode 100644 lib/librte_pmd_i40e/rte_i40e.h
Signature · 1 line
1.8.1.4
A message that is not in the archive (sent off-list or not yet received): 1406535955-31070-1-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
PATCH v2 1/6 ethdev: rename macros of packet classification type
For better understanding, 'PCTYPE' which represents 'Packet Classification Type' is used to replace 'RSS' in the name of shift macros.
--- lib/librte_ether/rte_ethdev.h | 76 +++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 38 deletions(-)
lib/librte_ether/rte_ethdev.h +38 -38
@@ -345,47 +345,47 @@ struct rte_eth_rss_conf {#define ETH_RSS_IPV4_UDP_SHIFT 6#define ETH_RSS_IPV6_UDP_SHIFT 7#define ETH_RSS_IPV6_UDP_EX_SHIFT 8 -/* for 40G only */ -#define ETH_RSS_NONF_IPV4_UDP_SHIFT 31 -#define ETH_RSS_NONF_IPV4_TCP_SHIFT 33 -#define ETH_RSS_NONF_IPV4_SCTP_SHIFT 34 -#define ETH_RSS_NONF_IPV4_OTHER_SHIFT 35 -#define ETH_RSS_FRAG_IPV4_SHIFT 36 -#define ETH_RSS_NONF_IPV6_UDP_SHIFT 41 -#define ETH_RSS_NONF_IPV6_TCP_SHIFT 43 -#define ETH_RSS_NONF_IPV6_SCTP_SHIFT 44 -#define ETH_RSS_NONF_IPV6_OTHER_SHIFT 45 -#define ETH_RSS_FRAG_IPV6_SHIFT 46 -#define ETH_RSS_FCOE_OX_SHIFT 48 -#define ETH_RSS_FCOE_RX_SHIFT 49 -#define ETH_RSS_FCOE_OTHER_SHIFT 50 -#define ETH_RSS_L2_PAYLOAD_SHIFT 63 +/* Packet Classification Type for 40G only */ +#define ETH_PCTYPE_NONF_IPV4_UDP 31 +#define ETH_PCTYPE_NONF_IPV4_TCP 33 +#define ETH_PCTYPE_NONF_IPV4_SCTP 34 +#define ETH_PCTYPE_NONF_IPV4_OTHER 35 +#define ETH_PCTYPE_FRAG_IPV4 36 +#define ETH_PCTYPE_NONF_IPV6_UDP 41 +#define ETH_PCTYPE_NONF_IPV6_TCP 43 +#define ETH_PCTYPE_NONF_IPV6_SCTP 44 +#define ETH_PCTYPE_NONF_IPV6_OTHER 45 +#define ETH_PCTYPE_FRAG_IPV6 46 +#define ETH_PCTYPE_FCOE_OX 48/* not used */ +#define ETH_PCTYPE_FCOE_RX 49/* not used */ +#define ETH_PCTYPE_FCOE_OTHER 50/* not used */ +#define ETH_PCTYPE_L2_PAYLOAD 63/* for 1G & 10G */ -#define ETH_RSS_IPV4 ((uint16_t)1 << ETH_RSS_IPV4_SHIFT) -#define ETH_RSS_IPV4_TCP ((uint16_t)1 << ETH_RSS_IPV4_TCP_SHIFT) -#define ETH_RSS_IPV6 ((uint16_t)1 << ETH_RSS_IPV6_SHIFT) -#define ETH_RSS_IPV6_EX ((uint16_t)1 << ETH_RSS_IPV6_EX_SHIFT) -#define ETH_RSS_IPV6_TCP ((uint16_t)1 << ETH_RSS_IPV6_TCP_SHIFT) -#define ETH_RSS_IPV6_TCP_EX ((uint16_t)1 << ETH_RSS_IPV6_TCP_EX_SHIFT) -#define ETH_RSS_IPV4_UDP ((uint16_t)1 << ETH_RSS_IPV4_UDP_SHIFT) -#define ETH_RSS_IPV6_UDP ((uint16_t)1 << ETH_RSS_IPV6_UDP_SHIFT) -#define ETH_RSS_IPV6_UDP_EX ((uint16_t)1 << ETH_RSS_IPV6_UDP_EX_SHIFT) +#define ETH_RSS_IPV4 (1 << ETH_RSS_IPV4_SHIFT) +#define ETH_RSS_IPV4_TCP (1 << ETH_RSS_IPV4_TCP_SHIFT) +#define ETH_RSS_IPV6 (1 << ETH_RSS_IPV6_SHIFT) +#define ETH_RSS_IPV6_EX (1 << ETH_RSS_IPV6_EX_SHIFT) +#define ETH_RSS_IPV6_TCP (1 << ETH_RSS_IPV6_TCP_SHIFT) +#define ETH_RSS_IPV6_TCP_EX (1 << ETH_RSS_IPV6_TCP_EX_SHIFT) +#define ETH_RSS_IPV4_UDP (1 << ETH_RSS_IPV4_UDP_SHIFT) +#define ETH_RSS_IPV6_UDP (1 << ETH_RSS_IPV6_UDP_SHIFT) +#define ETH_RSS_IPV6_UDP_EX (1 << ETH_RSS_IPV6_UDP_EX_SHIFT)/* for 40G only */ -#define ETH_RSS_NONF_IPV4_UDP ((uint64_t)1 << ETH_RSS_NONF_IPV4_UDP_SHIFT) -#define ETH_RSS_NONF_IPV4_TCP ((uint64_t)1 << ETH_RSS_NONF_IPV4_TCP_SHIFT) -#define ETH_RSS_NONF_IPV4_SCTP ((uint64_t)1 << ETH_RSS_NONF_IPV4_SCTP_SHIFT) -#define ETH_RSS_NONF_IPV4_OTHER ((uint64_t)1 << ETH_RSS_NONF_IPV4_OTHER_SHIFT) -#define ETH_RSS_FRAG_IPV4 ((uint64_t)1 << ETH_RSS_FRAG_IPV4_SHIFT) -#define ETH_RSS_NONF_IPV6_UDP ((uint64_t)1 << ETH_RSS_NONF_IPV6_UDP_SHIFT) -#define ETH_RSS_NONF_IPV6_TCP ((uint64_t)1 << ETH_RSS_NONF_IPV6_TCP_SHIFT) -#define ETH_RSS_NONF_IPV6_SCTP ((uint64_t)1 << ETH_RSS_NONF_IPV6_SCTP_SHIFT) -#define ETH_RSS_NONF_IPV6_OTHER ((uint64_t)1 << ETH_RSS_NONF_IPV6_OTHER_SHIFT) -#define ETH_RSS_FRAG_IPV6 ((uint64_t)1 << ETH_RSS_FRAG_IPV6_SHIFT) -#define ETH_RSS_FCOE_OX ((uint64_t)1 << ETH_RSS_FCOE_OX_SHIFT)/* not used */ -#define ETH_RSS_FCOE_RX ((uint64_t)1 << ETH_RSS_FCOE_RX_SHIFT)/* not used */ -#define ETH_RSS_FCOE_OTHER ((uint64_t)1 << ETH_RSS_FCOE_OTHER_SHIFT)/* not used */ -#define ETH_RSS_L2_PAYLOAD ((uint64_t)1 << ETH_RSS_L2_PAYLOAD_SHIFT) +#define ETH_RSS_NONF_IPV4_UDP (1ULL << ETH_PCTYPE_NONF_IPV4_UDP) +#define ETH_RSS_NONF_IPV4_TCP (1ULL << ETH_PCTYPE_NONF_IPV4_TCP) +#define ETH_RSS_NONF_IPV4_SCTP (1ULL << ETH_PCTYPE_NONF_IPV4_SCTP) +#define ETH_RSS_NONF_IPV4_OTHER (1ULL << ETH_PCTYPE_NONF_IPV4_OTHER) +#define ETH_RSS_FRAG_IPV4 (1ULL << ETH_PCTYPE_FRAG_IPV4) +#define ETH_RSS_NONF_IPV6_UDP (1ULL << ETH_PCTYPE_NONF_IPV6_UDP) +#define ETH_RSS_NONF_IPV6_TCP (1ULL << ETH_PCTYPE_NONF_IPV6_TCP) +#define ETH_RSS_NONF_IPV6_SCTP (1ULL << ETH_PCTYPE_NONF_IPV6_SCTP) +#define ETH_RSS_NONF_IPV6_OTHER (1ULL << ETH_PCTYPE_NONF_IPV6_OTHER) +#define ETH_RSS_FRAG_IPV6 (1ULL << ETH_PCTYPE_FRAG_IPV6) +#define ETH_RSS_FCOE_OX (1ULL << ETH_PCTYPE_FCOE_OX) +#define ETH_RSS_FCOE_RX (1ULL << ETH_PCTYPE_FCOE_RX) +#define ETH_RSS_FCOE_OTHER (1ULL << ETH_PCTYPE_FCOE_OTHER) +#define ETH_RSS_L2_PAYLOAD (1ULL << ETH_PCTYPE_L2_PAYLOAD)#define ETH_RSS_IP ( \ ETH_RSS_IPV4 | \
Signature · 1 line
1.8.1.4
A message that is not in the archive (sent off-list or not yet received): 1406535955-31070-2-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [PATCH v2 1/6] ethdev: rename macros of packet classification type
Hi Helin,
2014-07-28 16:25, Helin Zhang:
Quoted 3 lines
For better understanding, 'PCTYPE' which represents 'Packet Classification Type' is used to replace 'RSS' in the name of shift macros.
I have the same comments as for VF RSS serie, since it's almost the same patch ;)
Signature · 1 line
Thomas
PATCH v2 2/6 ethdev: add new ops of 'is_command_supported' and 'rx_classification_filter_ctl'
In reply to a message not in the archiveTwo ops of 'is_command_supported' and 'rx_classification_filter_ctl' are added. New header file of 'rte_eth_features.h' is added.
* 'is_command_supported': It is for capability discovery, that is to check if specific feature/command is supported on a port.
* 'rx_classification_filter_ctl': It is for receive classification filter configuring. e.g. selecting hash function, possibly configuring flow director. It is a common API where a lot of commands can be implemented for different sub features, to avoid defining quite a lot of ops for device specific features.
* 'rte_eth_features.h': It includes all the feature commands which can be checked and processed in above two ops. Also it may include other commands for future implementations.
--- lib/librte_ether/Makefile | 1 + lib/librte_ether/rte_eth_features.h | 73 +++++++++++++++++++++++++++++++++++++ lib/librte_ether/rte_ethdev.c | 31 ++++++++++++++++ lib/librte_ether/rte_ethdev.h | 55 ++++++++++++++++++++++++++++ 4 files changed, 160 insertions(+) create mode 100644 lib/librte_ether/rte_eth_features.h
lib/librte_ether/Makefile +1 -0
@@ -46,6 +46,7 @@ SRCS-y += rte_ethdev.c # SYMLINK-y-include += rte_ether.h SYMLINK-y-include += rte_ethdev.h +SYMLINK-y-include += rte_eth_features.h # this lib depends upon: DEPDIRS-y += lib/librte_eal lib/librte_mempool lib/librte_ring lib/librte_mbuf
lib/librte_ether/rte_eth_features.h new file +73 -0
73 lines not on this page · raw message
lib/librte_ether/rte_ethdev.c +31 -0
@@ -3002,3 +3002,34 @@ rte_eth_dev_get_flex_filter(uint8_t port_id, uint16_t index,return (*dev->dev_ops->get_flex_filter)(dev, index, filter, rx_queue); } + +int +rte_eth_dev_is_command_supported (uint8_t port_id,enum rte_eth_command cmd) +{ +struct rte_eth_dev *dev; + +if (port_id >= nb_ports) { +PMD_DEBUG_TRACE ("Invalid port_id=%d\n" , port_id); +return -ENODEV ; + } + dev = &rte_eth_devices[port_id]; +FUNC_PTR_OR_ERR_RET (*dev->dev_ops->is_command_supported, -ENOTSUP ); +return (*dev->dev_ops->is_command_supported)(dev, cmd); +} + +int +rte_eth_dev_rx_classification_filter_ctl (uint8_t port_id, +enum rte_eth_command cmd, +void *args) +{ +struct rte_eth_dev *dev; + +if (port_id >= nb_ports) { +PMD_DEBUG_TRACE ("Invalid port_id=%d\n" , port_id); +return -ENODEV ; + } + dev = &rte_eth_devices[port_id]; +FUNC_PTR_OR_ERR_RET (*dev->dev_ops->rx_classification_filter_ctl, + -ENOTSUP ); +return (*dev->dev_ops->rx_classification_filter_ctl)(dev, cmd, args); +}
lib/librte_ether/rte_ethdev.h +55 -0
79 lines not on this page · raw message
Signature · 1 line
1.8.1.4
PATCH v2 3/6 i40e: support of 'rx_classification_filter_ctl'
In reply to a message not in the archive'rx_classification_filter_ctl' was defined as a common API for receive classification filter features. Eight commands has been implemented for selecting hash functions of 'Toeplitz' and 'Simple XOR', and configuring symmetric hash functions. In detail, RTE_CMD_GET_SYM_HASH_ENABLE_PER_PCTYPE:
- Get symmetric hash enable configuration per 'PCTYPE'.RTE_CMD_SET_SYM_HASH_ENABLE_PER_PCTYPE:
- Set symmetric hash enable configuration per 'PCTYPE'.RTE_CMD_GET_SYM_HASH_ENABLE_PER_PORT:
- Get symmetric hash enable configuration per port.RTE_CMD_SET_SYM_HASH_ENABLE_PER_PORT:
- Set symmetric hash enable configuration per port.RTE_CMD_GET_FILTER_SWAP:
- Get filter swap configurations.RTE_CMD_SET_FILTER_SWAP:
- Set filter swap configurations.RTE_CMD_GET_HASH_FUNCTION:
- Get current hash function.RTE_CMD_SET_HASH_FUNCTION:
- Set hash function of 'Toeplitz' or 'Simple XOR'.
Note that 'PCTYPE' means 'Packet Classification Type'.
--- lib/librte_pmd_i40e/Makefile | 6 + lib/librte_pmd_i40e/i40e_ethdev.c | 385 ++++++++++++++++++++++++++++++++++++++ lib/librte_pmd_i40e/i40e_ethdev.h | 2 + lib/librte_pmd_i40e/rte_i40e.h | 108 +++++++++++ 4 files changed, 501 insertions(+) create mode 100644 lib/librte_pmd_i40e/rte_i40e.h
lib/librte_pmd_i40e/Makefile +6 -0
@@ -87,6 +87,12 @@ SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_ethdev.c SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_rxtx.c SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_ethdev_vf.c SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_pf.c + +# +# Export include file +# +SYMLINK-$(CONFIG_RTE_LIBRTE_I40E_PMD)-include += rte_i40e.h + # this lib depends upon: DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_eal lib/librte_ether DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_mempool lib/librte_mbuf
lib/librte_pmd_i40e/i40e_ethdev.c +385 -0
406 lines not on this page · raw message
lib/librte_pmd_i40e/i40e_ethdev.h +2 -0
@@ -34,6 +34,8 @@#ifndef _I40E_ETHDEV_H_#define _I40E_ETHDEV_H_ +#include "rte_i40e.h" +#define I40E_AQ_LEN 32#define I40E_AQ_BUF_SZ 4096/* Number of queues per TC should be one of 1, 2, 4, 8, 16, 32, 64 */
lib/librte_pmd_i40e/rte_i40e.h new file +108 -0
108 lines not on this page · raw message
Signature · 1 line
1.8.1.4
PATCH v2 4/6 i40e: support of 'is_command_supported'
In reply to a message not in the archive'is_command_supported' is defined for the capability discovery. Actually it is to check if a command (feature) is supported on a specific type of NIC port. Now i40e supports below eight commands. Of cause, more commands can be supported later.
- RTE_CMD_GET_SYM_HASH_ENABLE_PER_PCTYPE
- RTE_CMD_SET_SYM_HASH_ENABLE_PER_PCTYPE
- RTE_CMD_GET_SYM_HASH_ENABLE_PER_PORT
- RTE_CMD_SET_SYM_HASH_ENABLE_PER_PORT
- RTE_CMD_GET_FILTER_SWAP
- RTE_CMD_SET_FILTER_SWAP
- RTE_CMD_GET_HASH_FUNCTION
- RTE_CMD_SET_HASH_FUNCTION
--- lib/librte_pmd_i40e/i40e_ethdev.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
lib/librte_pmd_i40e/i40e_ethdev.c +28 -0
@@ -204,6 +204,8 @@ static int i40e_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf);static int i40e_dev_rss_hash_conf_get (struct rte_eth_dev *dev,struct rte_eth_rss_conf *rss_conf); +static int i40e_dev_is_command_supported(struct rte_eth_dev *dev __rte_unused, +enum rte_eth_command cmd);static int i40e_rx_classification_filter_ctl (struct rte_eth_dev *dev,enum rte_eth_command cmd,void *args);
@@ -252,6 +254,7 @@ static struct eth_dev_ops i40e_eth_dev_ops = { .reta_query = i40e_dev_rss_reta_query, .rss_hash_update = i40e_dev_rss_hash_update, .rss_hash_conf_get = i40e_dev_rss_hash_conf_get, + .is_command_supported = i40e_dev_is_command_supported, .rx_classification_filter_ctl = i40e_rx_classification_filter_ctl, };
@@ -4292,6 +4295,31 @@ i40e_get_hash_function(struct i40e_hw *hw, enum rte_i40e_hash_function *hf) }static int +i40e_dev_is_command_supported(struct rte_eth_dev *dev __rte_unused, +enum rte_eth_command cmd) +{ +uint32_t i; +/* Below commands defined in rte_eth_features.h are for i40e only */ +static const enum rte_eth_command i40e_commands[] = { +RTE_CMD_GET_SYM_HASH_ENABLE_PER_PCTYPE , +RTE_CMD_SET_SYM_HASH_ENABLE_PER_PCTYPE , +RTE_CMD_GET_SYM_HASH_ENABLE_PER_PORT , +RTE_CMD_SET_SYM_HASH_ENABLE_PER_PORT , +RTE_CMD_GET_FILTER_SWAP , +RTE_CMD_SET_FILTER_SWAP , +RTE_CMD_GET_HASH_FUNCTION , +RTE_CMD_SET_HASH_FUNCTION , + }; + +for (i =0 ; i <RTE_DIM (i40e_commands); i++) { +if (i40e_commands[i] == cmd) +return 1 ; + } + +return 0 ; +} + +static int i40e_rx_classification_filter_ctl (struct rte_eth_dev *dev,enum rte_eth_command cmd,void *args)
Signature · 1 line
1.8.1.4
PATCH v2 5/6 i40e: Initialize hash function during port initialization.
In reply to a message not in the archiveAs hash function are configured in gloabal registers, those registers will not be reloaded unless a gloabl NIC hardware reset. That means a DPDK application launch will not load the default configuration of hash functions. It needs an initialization of those registers during the port initialization to make sure all those registers are in an expected state.
--- lib/librte_pmd_i40e/i40e_ethdev.c | 71 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+)
lib/librte_pmd_i40e/i40e_ethdev.c +71 -0
@@ -204,6 +204,7 @@ static int i40e_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf);static int i40e_dev_rss_hash_conf_get (struct rte_eth_dev *dev,struct rte_eth_rss_conf *rss_conf); +static void i40e_init_hash_function (struct i40e_hw *hw); static int i40e_dev_is_command_supported(struct rte_eth_dev *dev __rte_unused,enum rte_eth_command cmd); static int i40e_rx_classification_filter_ctl(struct rte_eth_dev *dev,
@@ -392,6 +393,9 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,return ret; } +/* Init hash functions */ +i40e_init_hash_function (hw); +/* Initialize the shared code (base driver) */ ret =i40e_init_shared_code (hw);if (ret) {
@@ -4369,3 +4373,70 @@ i40e_rx_classification_filter_ctl(struct rte_eth_dev *dev,return ret; } + +/** +* Initialize hash functions. It includes, +* - set hash function to Toeplitz. +* - set the default filter swap configurations. +* - disable hash function enable per port. +* - disable hash function enable per pctype. +* Only global reset can reload the firmware configurations. +*/ +static void +i40e_init_hash_function (struct i40e_hw *hw) +{ +static struct rte_i40e_filter_swap_info swap_info[] = { + {ETH_PCTYPE_NONF_IPV4_UDP , +0x1e ,0x36 ,0x04 ,0x3a ,0x3c ,0x02 }, + {ETH_PCTYPE_NONF_IPV4_TCP , +0x1e ,0x36 ,0x04 ,0x3a ,0x3c ,0x02 }, + {ETH_PCTYPE_NONF_IPV4_SCTP , +0x1e ,0x36 ,0x04 ,0x00 ,0x00 ,0x00 }, + {ETH_PCTYPE_NONF_IPV4_OTHER , +0x1e ,0x36 ,0x04 ,0x00 ,0x00 ,0x00 }, + {ETH_PCTYPE_FRAG_IPV4 , +0x1e ,0x36 ,0x04 ,0x00 ,0x00 ,0x00 }, + {ETH_PCTYPE_NONF_IPV6_UDP , +0x1a ,0x2a ,0x10 ,0x3a ,0x3c ,0x02 }, + {ETH_PCTYPE_NONF_IPV6_TCP , +0x1a ,0x2a ,0x10 ,0x3a ,0x3c ,0x02 }, + {ETH_PCTYPE_NONF_IPV6_SCTP , +0x1a ,0x2a ,0x10 ,0x00 ,0x00 ,0x00 }, + {ETH_PCTYPE_NONF_IPV6_OTHER , +0x1a ,0x2a ,0x10 ,0x00 ,0x00 ,0x00 }, + {ETH_PCTYPE_FRAG_IPV6 , +0x1a ,0x2a ,0x10 ,0x00 ,0x00 ,0x00 }, + {ETH_PCTYPE_L2_PAYLOAD , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 }, + }; +static struct rte_i40e_sym_hash_enable_info sym_hash_ena_info[] = { + {ETH_PCTYPE_NONF_IPV4_UDP ,0 }, + {ETH_PCTYPE_NONF_IPV4_TCP ,0 }, + {ETH_PCTYPE_NONF_IPV4_SCTP ,0 }, + {ETH_PCTYPE_NONF_IPV4_OTHER ,0 }, + {ETH_PCTYPE_FRAG_IPV4 ,0 }, + {ETH_PCTYPE_NONF_IPV6_UDP ,0 }, + {ETH_PCTYPE_NONF_IPV6_TCP ,0 }, + {ETH_PCTYPE_NONF_IPV6_SCTP ,0 }, + {ETH_PCTYPE_NONF_IPV6_OTHER ,0 }, + {ETH_PCTYPE_FRAG_IPV6 ,0 }, + {ETH_PCTYPE_L2_PAYLOAD ,0 }, + }; +static enum rte_i40e_hash_function hf = rte_i40e_hash_function_toeplitz; +uint32_t i; + +/* set hash function to Toeplitz by default */ +i40e_set_hash_function (hw, &hf); + +/* initialize filter swap */ +for (i =0 ; i <RTE_DIM (swap_info); i++) +i40e_set_filter_swap (hw, &swap_info[i]); + +/* disable all symmetric hash per pctype */ +for (i =0 ; i <RTE_DIM (sym_hash_ena_info); i++) +i40e_set_symmetric_hash_enable_per_pctype (hw, + &sym_hash_ena_info[i]); + +/* disable symmetric hash per port */ +i40e_set_symmetric_hash_enable_per_port (hw,0 ); +}
Signature · 1 line
1.8.1.4
PATCH v2 6/6 app/testpmd: add commands for configuring hash functions
In reply to a message not in the archiveEight commands are added to configure hash functions. They are,
- i40e_get_sym_hash_ena_per_port
Get symmetric hash enable per port.
- i40e_set_sym_hash_ena_per_port
Set symmetric hash enable per port.
- i40e_get_sym_hash_ena_per_pctype
Get symmetric hash enable per PCTYPE (Packet Classification Type).
- i40e_set_sym_hash_ena_per_pctype
Set symmetric hash enable per PCTYPE (Packet Classification Type).
- i40e_get_filter_swap
Get filter swap configurations.
- i40e_set_filter_swap
Set filter swap configurations.
- i40e_get_hash_function
Get hash function.
- i40e_set_hash_function
Set hash function to 'Toeplitz' or 'Simple XOR'
--- app/test-pmd/cmdline.c | 579 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 579 insertions(+)
app/test-pmd/cmdline.c +579 -0
@@ -74,6 +74,10 @@#include <rte_ethdev.h> #include <rte_string_fns.h> #include <rte_devargs.h> +#include <rte_eth_features.h> +#ifdef RTE_LIBRTE_I40E_PMD +#include <rte_i40e.h> +#endif #include <cmdline_rdline.h> #include <cmdline_parse.h>
@@ -655,6 +659,43 @@ static void cmd_help_long_parsed(void *parsed_result,"get_flex_filter (port_id) index (idx)\n" " get info of a flex filter.\n\n" + +#ifdef RTE_LIBRTE_I40E_PMD +"i40e_get_sym_hash_ena_per_port (port_id)\n" +" get symmetric hash enable configuration per port," +" on i40e only\n\n" + +"i40e_set_sym_hash_ena_per_port (port_id)" +" (enable|disable)\n" +" set symmetric hash enable configuration per port" +" to enable or disable, on i40e only\n\n" + +"i40e_get_sym_hash_ena_per_pctype (port_id) (pctype)\n" +" get symmetric hash enable configuration per port," +" on i40e only\n\n" + +"i40e_set_sym_hash_ena_per_pctype (port_id) (pctype)" +" (enable|disable)\n" +" set symmetric hash enable configuration per" +" pctype to enable or disable, on i40e only\n\n" + +"i40e_get_filter_swap (port_id) (pctype)\n" +" get filter swap configurations on i40e," +" on i40e only\n\n" + +"i40e_set_filter_swap (port_id) (pctype) (off0_src0)" +" (off0_src1) (len0) (off1_src0) (off1_src1) (len1)\n" +" set filter swap configurations, on i40e only\n\n" + +"i40e_get_hash_function (port_id)\n" +" get hash function of Toeplitz or Simple XOR," +" on i40e only\n\n" + +"i40e_set_hash_function (port_id)" +" (toeplitz|simple_xor)\n" +" set the hash function to Toeplitz or Simple XOR," +" on i40e only\n\n" +#endif /* RTE_LIBRTE_I40E_PMD */ ); } }
@@ -7304,6 +7345,534 @@ cmdline_parse_inst_t cmd_get_flex_filter = { }, }; +/* *** Classification Filters Control *** */ +#ifdef RTE_LIBRTE_I40E_PMD +/* *** Get symmetric hash enable per port *** */ +struct cmd_i40e_get_sym_hash_ena_per_port_result { +cmdline_fixed_string_t i40e_get_sym_hash_ena_per_port; +uint8_t port_id; +}; + +static void +cmd_i40e_get_sym_hash_per_port_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_i40e_get_sym_hash_ena_per_port_result *res = parsed_result; +uint8_t enable =0 ; +int ret; + +if (rte_eth_dev_is_command_supported (res->port_id, +RTE_CMD_GET_SYM_HASH_ENABLE_PER_PORT ) <=0 ) { +printf ("Command of RTE_CMD_GET_SYM_HASH_ENABLE_PER_PORT " +"not supported on port: %d\n" , res->port_id); +return ; + } + + ret =rte_eth_dev_rx_classification_filter_ctl (res->port_id, +RTE_CMD_GET_SYM_HASH_ENABLE_PER_PORT , &enable); +if (ret <0 ) { +printf ("Cannot get symmetric hash enable per port " +"on i40e port %u\n" , res->port_id); +return ; + } + +printf ("Symmetric hash is %s on i40e port %u\n" , + enable ?"enabled" :"disabled" , res->port_id); +} + +cmdline_parse_token_string_t cmd_i40e_get_sym_hash_ena_per_port_all = +TOKEN_STRING_INITIALIZER ( + struct cmd_i40e_get_sym_hash_ena_per_port_result, + i40e_get_sym_hash_ena_per_port, +"i40e_get_sym_hash_ena_per_port" ); +cmdline_parse_token_num_t cmd_i40e_get_sym_hash_ena_per_port_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_i40e_get_sym_hash_ena_per_port_result, + port_id,UINT8 ); + +cmdline_parse_inst_t cmd_i40e_get_sym_hash_ena_per_port = { + .f = cmd_i40e_get_sym_hash_per_port_parsed, + .data =NULL , + .help_str ="i40e_get_sym_hash_ena_per_port port_id" , + .tokens = { + (void *)&cmd_i40e_get_sym_hash_ena_per_port_all, + (void *)&cmd_i40e_get_sym_hash_ena_per_port_port_id, +NULL , + }, +}; + +/* *** Set symmetric hash enable per port *** */ +struct cmd_i40e_set_sym_hash_ena_per_port_result { +cmdline_fixed_string_t i40e_set_sym_hash_ena_per_port; +cmdline_fixed_string_t enable; +uint8_t port_id; +}; + +static void +cmd_i40e_set_sym_hash_per_port_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_i40e_set_sym_hash_ena_per_port_result *res = parsed_result; +uint8_t enable =0 ; +int ret; + +if (rte_eth_dev_is_command_supported (res->port_id, +RTE_CMD_SET_SYM_HASH_ENABLE_PER_PORT ) <=0 ) { +printf ("Command of RTE_CMD_SET_SYM_HASH_ENABLE_PER_PORT " +"not supported on port: %d\n" , res->port_id); +return ; + } + +if (!strcmp (res->enable,"enable" )) + enable =1 ; + ret =rte_eth_dev_rx_classification_filter_ctl (res->port_id, +RTE_CMD_SET_SYM_HASH_ENABLE_PER_PORT , &enable); +if (ret <0 ) { +printf ("Cannot set symmetric hash enable per port " +"on i40e port %u\n" , res->port_id); +return ; + } + +printf ("Symmetric hash has been set to %s on i40e port %u\n" , + res->enable, res->port_id); +} + +cmdline_parse_token_string_t cmd_i40e_set_sym_hash_ena_per_port_all = +TOKEN_STRING_INITIALIZER ( + struct cmd_i40e_set_sym_hash_ena_per_port_result, + i40e_set_sym_hash_ena_per_port, +"i40e_set_sym_hash_ena_per_port" ); +cmdline_parse_token_num_t cmd_i40e_set_sym_hash_ena_per_port_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_i40e_set_sym_hash_ena_per_port_result, + port_id,UINT8 ); +cmdline_parse_token_string_t cmd_i40e_set_sym_hash_ena_per_port_enable = +TOKEN_STRING_INITIALIZER ( + struct cmd_i40e_set_sym_hash_ena_per_port_result, + enable,"enable#disable" ); + +cmdline_parse_inst_t cmd_i40e_set_sym_hash_ena_per_port = { + .f = cmd_i40e_set_sym_hash_per_port_parsed, + .data =NULL , + .help_str ="i40e_set_sym_hash_ena_per_port port_id enable|disable" , + .tokens = { + (void *)&cmd_i40e_set_sym_hash_ena_per_port_all, + (void *)&cmd_i40e_set_sym_hash_ena_per_port_port_id, + (void *)&cmd_i40e_set_sym_hash_ena_per_port_enable, +NULL , + }, +}; + +/* *** Get symmetric hash enable per pctype *** */ +struct cmd_i40e_get_sym_hash_ena_per_pctype_result { +cmdline_fixed_string_t i40e_get_sym_hash_ena_per_pctype; +uint8_t port_id; +uint8_t pctype; +}; + +static void +cmd_i40e_get_sym_hash_per_pctype_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_i40e_get_sym_hash_ena_per_pctype_result *res = + parsed_result; +struct rte_i40e_sym_hash_enable_info info; +int ret; + +if (rte_eth_dev_is_command_supported (res->port_id, +RTE_CMD_GET_SYM_HASH_ENABLE_PER_PCTYPE ) <=0 ) { +printf ("Command of RTE_CMD_GET_SYM_HASH_ENABLE_PER_PCTYPE " +"not supported on port: %d\n" , res->port_id); +return ; + } + +memset (&info,0 ,sizeof (info)); + info.pctype = res->pctype; + ret =rte_eth_dev_rx_classification_filter_ctl (res->port_id, +RTE_CMD_GET_SYM_HASH_ENABLE_PER_PCTYPE , &info); +if (ret <0 ) { +printf ("Cannot get symmetric hash enable per pctype on i40e " +"port %u, pctype %u\n" , res->port_id, res->pctype); +return ; + } +printf ("Symmetric hash is %s on i40e port %u, pctype %u\n" , + info.enable ?"enabled" :"disabled" , + res->port_id, res->pctype); +} + +cmdline_parse_token_string_t cmd_i40e_get_sym_hash_ena_per_pctype_all = +TOKEN_STRING_INITIALIZER ( + struct cmd_i40e_get_sym_hash_ena_per_pctype_result, + i40e_get_sym_hash_ena_per_pctype, +"i40e_get_sym_hash_ena_per_pctype" ); +cmdline_parse_token_num_t cmd_i40e_get_sym_hash_ena_per_pctype_port_id = +TOKEN_NUM_INITIALIZER ( + struct cmd_i40e_get_sym_hash_ena_per_pctype_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_i40e_get_sym_hash_ena_per_pctype_pctype = +TOKEN_NUM_INITIALIZER ( + struct cmd_i40e_get_sym_hash_ena_per_pctype_result, + pctype,UINT8 ); + +cmdline_parse_inst_t cmd_i40e_get_sym_hash_ena_per_pctype = { + .f = cmd_i40e_get_sym_hash_per_pctype_parsed, + .data =NULL , + .help_str ="i40e_get_sym_hash_ena_per_pctype port_id pctype" , + .tokens = { + (void *)&cmd_i40e_get_sym_hash_ena_per_pctype_all, + (void *)&cmd_i40e_get_sym_hash_ena_per_pctype_port_id, + (void *)&cmd_i40e_get_sym_hash_ena_per_pctype_pctype, +NULL , + }, +}; + +/* *** Set symmetric hash enable per pctype *** */ +struct cmd_i40e_set_sym_hash_ena_per_pctype_result { +cmdline_fixed_string_t i40e_set_sym_hash_ena_per_pctype; +cmdline_fixed_string_t enable; +uint8_t port_id; +uint8_t pctype; +}; + +static void +cmd_i40e_set_sym_hash_per_pctype_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_i40e_set_sym_hash_ena_per_pctype_result *res = + parsed_result; +struct rte_i40e_sym_hash_enable_info info; +int ret; + +if (rte_eth_dev_is_command_supported (res->port_id, +RTE_CMD_SET_SYM_HASH_ENABLE_PER_PCTYPE ) <=0 ) { +printf ("Command of RTE_CMD_SET_SYM_HASH_ENABLE_PER_PCTYPE " +"not supported on port: %d\n" , res->port_id); +return ; + } + +memset (&info,0 ,sizeof (info)); + info.pctype = res->pctype; +if (!strcmp (res->enable,"enable" )) + info.enable =1 ; + ret =rte_eth_dev_rx_classification_filter_ctl (res->port_id, +RTE_CMD_SET_SYM_HASH_ENABLE_PER_PCTYPE , &info); +if (ret <0 ) { +printf ("Cannot set symmetric hash enable per pctype to %s " +"on i40e port %u, pctype %u\n" , res->enable ? +"enabled" :"disabled" , res->port_id, res->pctype); +return ; + } +printf ("Symmetic hash has been set to %s on i40e port %u, pctype %u\n" , + res->enable, res->port_id, res->pctype); +} + +cmdline_parse_token_string_t cmd_i40e_set_sym_hash_ena_per_pctype_all = +TOKEN_STRING_INITIALIZER ( + struct cmd_i40e_set_sym_hash_ena_per_pctype_result, + i40e_set_sym_hash_ena_per_pctype, +"i40e_set_sym_hash_ena_per_pctype" ); +cmdline_parse_token_num_t cmd_i40e_set_sym_hash_ena_per_pctype_port_id = +TOKEN_NUM_INITIALIZER ( + struct cmd_i40e_set_sym_hash_ena_per_pctype_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_i40e_set_sym_hash_ena_per_pctype_pctype = +TOKEN_NUM_INITIALIZER ( + struct cmd_i40e_set_sym_hash_ena_per_pctype_result, + pctype,UINT8 ); +cmdline_parse_token_string_t cmd_i40e_set_sym_hash_ena_per_pctype_enable = +TOKEN_STRING_INITIALIZER ( + struct cmd_i40e_set_sym_hash_ena_per_pctype_result, + enable,"enable#disable" ); + +cmdline_parse_inst_t cmd_i40e_set_sym_hash_ena_per_pctype = { + .f = cmd_i40e_set_sym_hash_per_pctype_parsed, + .data =NULL , + .help_str ="i40e_set_sym_hash_ena_per_pctype pord_id " +"pctype enable|disable" , + .tokens = { + (void *)&cmd_i40e_set_sym_hash_ena_per_pctype_all, + (void *)&cmd_i40e_set_sym_hash_ena_per_pctype_port_id, + (void *)&cmd_i40e_set_sym_hash_ena_per_pctype_pctype, + (void *)&cmd_i40e_set_sym_hash_ena_per_pctype_enable, +NULL , + }, +}; + +/* *** Get filter swap *** */ +struct cmd_i40e_get_filter_swap_result { +cmdline_fixed_string_t i40e_get_filter_swap; +uint8_t port_id; +uint8_t pctype; +}; + +static void +cmd_i40e_get_filter_swap_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_i40e_get_filter_swap_result *res = parsed_result; +struct rte_i40e_filter_swap_info info; +int ret; + +if (rte_eth_dev_is_command_supported (res->port_id, +RTE_CMD_GET_FILTER_SWAP ) <=0 ) { +printf ("Command of RTE_CMD_GET_FILTER_SWAP not supported " +"on port: %d\n" , res->port_id); +return ; + } + +memset (&info,0 ,sizeof (info)); + info.pctype = res->pctype; + ret =rte_eth_dev_rx_classification_filter_ctl (res->port_id, +RTE_CMD_GET_FILTER_SWAP , &info); +if (ret <0 ) { +printf ("Cannot get filter swap on i40e port %u, pctype %u\n" , + res->port_id, res->pctype); +return ; + } +printf ("Filter swap of i40e port %u, pctype %u is configured as:\n" +"off0_src0: 0x%02x, off0_src1: 0x%02x, len0: 0x%02x\n" +"off1_src0: 0x%02x, off1_src1: 0x%02x, len1: 0x%02x\n" , + res->port_id, res->pctype, info.off0_src0, info.off0_src1, + info.len0, info.off1_src0, info.off1_src1, info.len1); +} + +cmdline_parse_token_string_t cmd_i40e_get_filter_swap_all = + TOKEN_STRING_INITIALIZER(struct cmd_i40e_get_filter_swap_result, + i40e_get_filter_swap,"i40e_get_filter_swap" ); +cmdline_parse_token_num_t cmd_i40e_get_filter_swap_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_i40e_get_filter_swap_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_i40e_get_filter_swap_pctype = + TOKEN_NUM_INITIALIZER(struct cmd_i40e_get_filter_swap_result, + pctype,UINT8 ); + +cmdline_parse_inst_t cmd_i40e_get_filter_swap = { + .f = cmd_i40e_get_filter_swap_parsed, + .data =NULL , + .help_str ="i40e_get_filter_swap port_id pctype" , + .tokens = { + (void *)&cmd_i40e_get_filter_swap_all, + (void *)&cmd_i40e_get_filter_swap_port_id, + (void *)&cmd_i40e_get_filter_swap_pctype, +NULL , + }, +}; + +/* *** Set filter swap *** */ +struct cmd_i40e_set_filter_swap_result { +cmdline_fixed_string_t i40e_set_filter_swap; +uint8_t port_id; +uint8_t pctype; +uint8_t off0_src0; +uint8_t off0_src1; +uint8_t len0; +uint8_t off1_src0; +uint8_t off1_src1; +uint8_t len1; +}; + +static void +cmd_i40e_set_filter_swap_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_i40e_set_filter_swap_result *res = parsed_result; +struct rte_i40e_filter_swap_info info; +int ret; + +if (rte_eth_dev_is_command_supported (res->port_id, +RTE_CMD_SET_FILTER_SWAP ) <=0 ) { +printf ("Command of RTE_CMD_SET_FILTER_SWAP not supported " +"on port: %d\n" , res->port_id); +return ; + } + +memset (&info,0 ,sizeof (info)); + info.pctype = res->pctype; + info.off0_src0 = res->off0_src0; + info.off0_src1 = res->off0_src1; + info.len0 = res->len0; + info.off1_src0 = res->off1_src0; + info.off1_src1 = res->off1_src1; + info.len1 = res->len1; + ret =rte_eth_dev_rx_classification_filter_ctl (res->port_id, +RTE_CMD_SET_FILTER_SWAP , &info); +if (ret <0 ) { +printf ("Cannot set filter swap on i40e port %u, pctype %u\n" , + res->port_id, res->pctype); +return ; + } +printf ("Filter swap of i40e port %u, pctype %u has been set as:\n" +"off0_src0: 0x%02x, off0_src1: 0x%02x, len0: 0x%02x\n" +"off1_src0: 0x%02x, off1_src1: 0x%02x, len1: 0x%02x\n" , + res->port_id, res->pctype, info.off0_src0, info.off0_src1, + info.len0, info.off1_src0, info.off1_src1, info.len1); +} + +cmdline_parse_token_string_t cmd_i40e_set_filter_swap_all = + TOKEN_STRING_INITIALIZER(struct cmd_i40e_set_filter_swap_result, + i40e_set_filter_swap,"i40e_set_filter_swap" ); +cmdline_parse_token_num_t cmd_i40e_set_filter_swap_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_i40e_set_filter_swap_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_i40e_set_filter_swap_pctype = + TOKEN_NUM_INITIALIZER(struct cmd_i40e_set_filter_swap_result, + pctype,UINT8 ); +cmdline_parse_token_num_t cmd_i40e_set_filter_swap_off0_src0 = + TOKEN_NUM_INITIALIZER(struct cmd_i40e_set_filter_swap_result, + off0_src0,UINT8 ); +cmdline_parse_token_num_t cmd_i40e_set_filter_swap_off0_src1 = + TOKEN_NUM_INITIALIZER(struct cmd_i40e_set_filter_swap_result, + off0_src1,UINT8 ); +cmdline_parse_token_num_t cmd_i40e_set_filter_swap_len0 = + TOKEN_NUM_INITIALIZER(struct cmd_i40e_set_filter_swap_result, + len0,UINT8 ); +cmdline_parse_token_num_t cmd_i40e_set_filter_swap_off1_src0 = + TOKEN_NUM_INITIALIZER(struct cmd_i40e_set_filter_swap_result, + off1_src0,UINT8 ); +cmdline_parse_token_num_t cmd_i40e_set_filter_swap_off1_src1 = + TOKEN_NUM_INITIALIZER(struct cmd_i40e_set_filter_swap_result, + off1_src1,UINT8 ); +cmdline_parse_token_num_t cmd_i40e_set_filter_swap_len1 = + TOKEN_NUM_INITIALIZER(struct cmd_i40e_set_filter_swap_result, + len1,UINT8 ); + +cmdline_parse_inst_t cmd_i40e_set_filter_swap = { + .f = cmd_i40e_set_filter_swap_parsed, + .data =NULL , + .help_str ="i40e_set_filter_swap port_id pctype off0_src0 off0_src1 " +"len0 off1_src0 off1_src1 len1" , + .tokens = { + (void *)&cmd_i40e_set_filter_swap_all, + (void *)&cmd_i40e_set_filter_swap_port_id, + (void *)&cmd_i40e_set_filter_swap_pctype, + (void *)&cmd_i40e_set_filter_swap_off0_src0, + (void *)&cmd_i40e_set_filter_swap_off0_src1, + (void *)&cmd_i40e_set_filter_swap_len0, + (void *)&cmd_i40e_set_filter_swap_off1_src0, + (void *)&cmd_i40e_set_filter_swap_off1_src1, + (void *)&cmd_i40e_set_filter_swap_len1, +NULL , + }, +}; + +/* Get hash function */ +struct cmd_i40e_get_hash_function_result { +cmdline_fixed_string_t i40e_get_hash_function; +uint8_t port_id; +}; + +static void +cmd_i40e_get_hash_function_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_i40e_get_hash_function_result *res = parsed_result; +enum rte_i40e_hash_function hf; +int ret; + +if (rte_eth_dev_is_command_supported (res->port_id, +RTE_CMD_GET_HASH_FUNCTION ) <=0 ) { +printf ("Command of RTE_CMD_GET_HASH_FUNCTION not " +"supported on port %d\n" , res->port_id); +return ; + } + ret =rte_eth_dev_rx_classification_filter_ctl (res->port_id, +RTE_CMD_GET_HASH_FUNCTION , &hf); +if (ret <0 ) { +printf ("Cannot get hash function on port %d\n" , res->port_id); +return ; + } +printf ("Hash function is %s\n" , hf == rte_i40e_hash_function_toeplitz ? +"Toeplitz" :"Simple XOR" ); +} + +cmdline_parse_token_string_t cmd_i40e_get_hash_function_all = + TOKEN_STRING_INITIALIZER(struct cmd_i40e_get_hash_function_result, + i40e_get_hash_function,"i40e_get_hash_function" ); +cmdline_parse_token_num_t cmd_i40e_get_hash_function_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_i40e_get_hash_function_result, + port_id,UINT8 ); + +cmdline_parse_inst_t cmd_i40e_get_hash_function = { + .f = cmd_i40e_get_hash_function_parsed, + .data =NULL , + .help_str ="i40e_get_hash_function port_id" , + .tokens = { + (void *)&cmd_i40e_get_hash_function_all, + (void *)&cmd_i40e_get_hash_function_port_id, +NULL , + }, +}; + +/* Set hash function of Hoeplitz or Simple XOR */ +struct cmd_i40e_set_hash_function_result { +cmdline_fixed_string_t i40e_set_hash_function; +uint8_t port_id; +cmdline_fixed_string_t hash_function; +}; + +static void +cmd_i40e_set_hash_function_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_i40e_set_hash_function_result *res = parsed_result; +enum rte_i40e_hash_function hf; +int ret; + +if (!strcmp (res->hash_function,"toeplitz" )) + hf = rte_i40e_hash_function_toeplitz; +else if (!strcmp (res->hash_function,"simple_xor" )) + hf = rte_i40e_hash_function_simple_xor; +else { +printf ("Unsupported hash function %s\n" , res->hash_function); +return ; + } +if (rte_eth_dev_is_command_supported (res->port_id, +RTE_CMD_SET_HASH_FUNCTION ) <=0 ) { +printf ("Command of RTE_CMD_SET_HASH_FUNCTION not " +"supported on port %d\n" , res->port_id); +return ; + } + ret =rte_eth_dev_rx_classification_filter_ctl (res->port_id, +RTE_CMD_SET_HASH_FUNCTION , &hf); +if (ret <0 ) { +printf ("Cannot set hash function to %s on port %d\n" , + res->hash_function, res->port_id); +return ; + } +printf ("Hash function has been successfully set to %s on port %d\n" , + res->hash_function, res->port_id); +} + +cmdline_parse_token_string_t cmd_i40e_set_hash_function_all = + TOKEN_STRING_INITIALIZER(struct cmd_i40e_set_hash_function_result, + i40e_set_hash_function,"i40e_set_hash_function" ); +cmdline_parse_token_num_t cmd_i40e_set_hash_function_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_i40e_set_hash_function_result, + port_id,UINT8 ); +cmdline_parse_token_string_t cmd_i40e_set_hash_function_hash_function = + TOKEN_STRING_INITIALIZER(struct cmd_i40e_set_hash_function_result, + hash_function,"toeplitz#simple_xor" ); + +cmdline_parse_inst_t cmd_i40e_set_hash_function = { + .f = cmd_i40e_set_hash_function_parsed, + .data =NULL , + .help_str ="i40e_set_hash_function port_id toeplitz|simple_xor" , + .tokens = { + (void *)&cmd_i40e_set_hash_function_all, + (void *)&cmd_i40e_set_hash_function_port_id, + (void *)&cmd_i40e_set_hash_function_hash_function, +NULL , + }, +}; + +#endif /* RTE_LIBRTE_I40E_PMD */ +/* ******************************************************************************** */ /* list of instructions */
@@ -7429,6 +7998,16 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_add_flex_filter, (cmdline_parse_inst_t *)&cmd_remove_flex_filter, (cmdline_parse_inst_t *)&cmd_get_flex_filter, +#ifdef RTE_LIBRTE_I40E_PMD + (cmdline_parse_inst_t *)&cmd_i40e_get_sym_hash_ena_per_port, + (cmdline_parse_inst_t *)&cmd_i40e_set_sym_hash_ena_per_port, + (cmdline_parse_inst_t *)&cmd_i40e_get_sym_hash_ena_per_pctype, + (cmdline_parse_inst_t *)&cmd_i40e_set_sym_hash_ena_per_pctype, + (cmdline_parse_inst_t *)&cmd_i40e_get_filter_swap, + (cmdline_parse_inst_t *)&cmd_i40e_set_filter_swap, + (cmdline_parse_inst_t *)&cmd_i40e_set_hash_function, + (cmdline_parse_inst_t *)&cmd_i40e_get_hash_function, +#endif /* RTE_LIBRTE_I40E_PMD */ NULL, };
Signature · 1 line
1.8.1.4
Wu, Jingjing
Reviewed-byQuoted 47 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Helin Zhang
Sent: Monday, July 28, 2014 4:26 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH v2 0/6] Support configuring hash functionsThese pathches mainly support configuring hash functions. In detail,
- It can select Toeplitz or simple XOR hash functions.
- It can configure symmetric hash functions.
* Get/set symmetric hash enable per port.
* Get/set symmetric hash enable per 'PCTYPE'.
* Get/set filter swap configurations.
- 'ethdev' level interfaces are added.
* 'is_command_supported', to check if a feature (command) is supported on a port.
* 'rx_classification_filter_ctl', a common API to execute specific command of each feature.
- Seven commands are implemented in testpmd to support testing above.
Note that 'PCTYPE' means 'Packet Classification Type'.Helin Zhang (6):
ethdev: rename macros of packet classification type
ethdev: add new ops of 'is_command_supported' and
'rx_classification_filter_ctl'
i40e: support of 'rx_classification_filter_ctl'
i40e: support of 'is_command_supported'
i40e: Initialize hash function during port initialization. app/testpmd: add commands for configuring hash functionsapp/test-pmd/cmdline.c | 579 ++++++++++++++++++++++++++++++++++++ lib/librte_ether/Makefile | 1 + lib/librte_ether/rte_eth_features.h | 73 +++++ lib/librte_ether/rte_ethdev.c | 31 ++ lib/librte_ether/rte_ethdev.h | 131 +++++--- lib/librte_pmd_i40e/Makefile | 6 + lib/librte_pmd_i40e/i40e_ethdev.c | 484 ++++++++++++++++++++++++++++++ lib/librte_pmd_i40e/i40e_ethdev.h | 2 + lib/librte_pmd_i40e/rte_i40e.h | 108 +++++++ 9 files changed, 1377 insertions(+), 38 deletions(-) create mode 100644 lib/librte_ether/rte_eth_features.h create mode 100644 lib/librte_pmd_i40e/rte_i40e.h--
1.8.1.4
Zhan, Zhaochen
Tested-byQuoted 17 lines
These pathches mainly support configuring hash functions. In detail,
- It can select Toeplitz or simple XOR hash functions.
- It can configure symmetric hash functions.
* Get/set symmetric hash enable per port.
* Get/set symmetric hash enable per 'PCTYPE'.
* Get/set filter swap configurations.
- 'ethdev' level interfaces are added.
* 'is_command_supported', to check if a feature (command) is supported on a port.
* 'rx_classification_filter_ctl', a common API to execute specific command of each feature.
- Seven commands are implemented in testpmd to support testing above.
Note that 'PCTYPE' means 'Packet Classification Type'.
Quoted 8 lines
Helin Zhang (6):
ethdev: rename macros of packet classification type
ethdev: add new ops of 'is_command_supported' and
'rx_classification_filter_ctl'
i40e: support of 'rx_classification_filter_ctl'
i40e: support of 'is_command_supported'
i40e: Initialize hash function during port initialization. app/testpmd: add commands for configuring hash functions
I have tested this patch on fedora20 with Fortville NIC. The hash function toeplitz/simple XOR/ symmetric all works well for ip/udp both ipv4 and ipv6 packets in testpmd support RSS.
A message that is not in the archive (sent off-list or not yet received): 6D0EE020084B194084D70B0A8D2207B8EB0BC8-0J0gbvR4kTg/[email protected]
Quoted 34 lines
-----Original Message-----
From: Zhan, Zhaochen
Sent: Thursday, July 31, 2014 10:49 AM
To: Zhang, Helin; [email protected]
Subject: RE: [dpdk-dev] [PATCH v2 0/6] Support configuring hash functionsQuoted 16 lines
These pathches mainly support configuring hash functions. In detail,
- It can select Toeplitz or simple XOR hash functions.
- It can configure symmetric hash functions.
* Get/set symmetric hash enable per port.
* Get/set symmetric hash enable per 'PCTYPE'.
* Get/set filter swap configurations.
- 'ethdev' level interfaces are added.
* 'is_command_supported', to check if a feature (command) is supported on a port.
* 'rx_classification_filter_ctl', a common API to execute specific command of each feature.
- Seven commands are implemented in testpmd to support testing above.
Note that 'PCTYPE' means 'Packet Classification Type'.Quoted 8 lines
Helin Zhang (6):
ethdev: rename macros of packet classification type
ethdev: add new ops of 'is_command_supported' and
'rx_classification_filter_ctl'
i40e: support of 'rx_classification_filter_ctl'
i40e: support of 'is_command_supported'
i40e: Initialize hash function during port initialization. app/testpmd: add commands for configuring hash functions
Quoted 5 lines
Tested-by Zhaochen Zhan <[email protected]>I have tested this patch on fedora20 with Fortville NIC.
The hash function toeplitz/simple XOR/ symmetric all works well for ip/udp both ipv4 and ipv6 packets in testpmd support RSS.
Hi Thomas
Would you please help to apply it as soon as possible, as another developer here who is now developing another feature (Flow Director) which has dependency on these patches? Thank you very much!
Regards,
Helin
A message that is not in the archive (sent off-list or not yet received): F35DEAC7BCE34641BA9FAC6BCA4A12E70A770920-0J0gbvR4kTg/[email protected]
2014-08-01 05:26, Zhang, Helin:
Quoted 3 lines
Would you please help to apply it as soon as possible, as another developer here who is now developing another feature (Flow Director) which has dependency on these patches?
This patchset about hash functions and the ones about flow director and VxLAN are pending for an agreement on a good design for filters in general. The target is to have these new filters in release 1.8.0.
Signature · 1 line
Thomas
Quoted 49 lines
-----Original Message-----
From: Zhang, Helin
Sent: Monday, July 28, 2014 4:26 PM
To: [email protected]
Cc: Zhang, Helin
Subject: [PATCH v2 0/6] Support configuring hash functionsThese pathches mainly support configuring hash functions. In detail,
- It can select Toeplitz or simple XOR hash functions.
- It can configure symmetric hash functions.
* Get/set symmetric hash enable per port.
* Get/set symmetric hash enable per 'PCTYPE'.
* Get/set filter swap configurations.
- 'ethdev' level interfaces are added.
* 'is_command_supported', to check if a feature (command) is supported on a port.
* 'rx_classification_filter_ctl', a common API to execute specific command of each feature.
- Seven commands are implemented in testpmd to support testing above.
Note that 'PCTYPE' means 'Packet Classification Type'.Helin Zhang (6):
ethdev: rename macros of packet classification type
ethdev: add new ops of 'is_command_supported' and
'rx_classification_filter_ctl'
i40e: support of 'rx_classification_filter_ctl'
i40e: support of 'is_command_supported'
i40e: Initialize hash function during port initialization. app/testpmd: add commands for configuring hash functionsapp/test-pmd/cmdline.c | 579 ++++++++++++++++++++++++++++++++++++ lib/librte_ether/Makefile | 1 + lib/librte_ether/rte_eth_features.h | 73 +++++ lib/librte_ether/rte_ethdev.c | 31 ++ lib/librte_ether/rte_ethdev.h | 131 +++++--- lib/librte_pmd_i40e/Makefile | 6 + lib/librte_pmd_i40e/i40e_ethdev.c | 484 ++++++++++++++++++++++++++++++ lib/librte_pmd_i40e/i40e_ethdev.h | 2 + lib/librte_pmd_i40e/rte_i40e.h | 108 +++++++ 9 files changed, 1377 insertions(+), 38 deletions(-) create mode 100644 lib/librte_ether/rte_eth_features.h create mode 100644 lib/librte_pmd_i40e/rte_i40e.h
Quoted 2 lines
--
1.8.1.4
Hi guys
Any comments for these patches? Any next steps for merging these patches to main line?
Regards,
Helin