add flow action map
cover add flow action map
Add map action to rte_flow API to map a Packet Classification type (pctype) to a flowtype for the i40e PMD.
This feature requires changes to be made to the rte_flow code in librte_ethdev, testpmd and the i40e PMD.
Bernard Iremonger (8):
librte_ethdev: add new flow types and action
librte_ethdev: add map filter type
librte_ethdev: add map action
app/testpmd: parse map actions
net/i40e: add map filter
net/i40e: add map functions
net/i40e: parse map pattern and action
doc: release note
app/test-pmd/cmdline_flow.c | 85 ++++++++++++ doc/guides/prog_guide/rte_flow.rst | 55 ++++++++ doc/guides/rel_notes/release_20_08.rst | 18 +++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 27 ++++ drivers/net/i40e/i40e_ethdev.c | 56 ++++++++ drivers/net/i40e/i40e_ethdev.h | 24 ++++ drivers/net/i40e/i40e_flow.c | 196 ++++++++++++++++++++++++++++ lib/librte_ethdev/rte_eth_ctrl.h | 1 + lib/librte_ethdev/rte_flow.c | 14 ++ lib/librte_ethdev/rte_flow.h | 78 +++++++++++ 10 files changed, 554 insertions(+)
Signature · 1 line
2.7.4
PATCH 1/8 librte_ethdev: add new flow types and action
In rte_flow.h:
add RTE_FLOW_ITEM_TYPE_PCTYPE
add RTE_FLOW_ITEM_TYPE_FLOWTYPE
add RTE_FLOW_ACTION_TYPE_MAP
add structs and masks for new flow types
In rte_flow.rst:
add items for pctype and flowtype
add action for map
--- doc/guides/prog_guide/rte_flow.rst | 55 +++++++++++++++++++++++++++ lib/librte_ethdev/rte_flow.h | 78 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+)
doc/guides/prog_guide/rte_flow.rst +55 -0
@@ -1362,6 +1362,44 @@ Matches a PFCP Header. - ``seid``: session endpoint identifier. - Default ``mask`` matches s_field and seid. +Item: ``PCTYPE`` +^^^^^^^^^^^^^^^^ + +Matches a PCTYPE + +.. _table_rte_flow_item_pctype: + +.. table:: PCTYPE + + +----------+----------+---------------------------------------+ + | Field | Subfield | Value | + +==========+==========+=======================================+ + | ``spec`` | ``data`` | 64 bit pctype value | + +----------+----------+---------------------------------------+ + | ``last`` | ``data`` | upper range value | + +----------+----------+---------------------------------------+ + | ``mask`` | ``data`` | bit-mask applies to "spec" and "last" | + +----------+----------+---------------------------------------+ + +Item: ``FLOWTYPE`` +^^^^^^^^^^^^^^^^^^ + +Matches a FLOWTYPE + +.. _table_rte_flow_item_flowtype: + +.. table:: FLOWTYPE + + +----------+----------+---------------------------------------+ + | Field | Subfield | Value | + +==========+==========+=======================================+ + | ``spec`` | ``data`` | 16 bit flowtype value | + +----------+----------+---------------------------------------+ + | ``last`` | ``data`` | upper range value | + +----------+----------+---------------------------------------+ + | ``mask`` | ``data`` | bit-mask applies to "spec" and "last" | + +----------+----------+---------------------------------------+ + Actions ~~~~~~~
@@ -2645,6 +2683,23 @@ timeout passed without any matching on the flow. | ``context`` | user input flow context | +--------------+---------------------------------+ +Action: ``MAP`` +^^^^^^^^^^^^^^^ + +Map pctype to flowtype. + +.. _table_rte_flow_action_map: + +.. table:: MAP + + +--------------+---------------------------------+ + | Field | Value | + +==============+=================================+ + | ``pctype`` | 64 bit pctype value | + +--------------+---------------------------------+ + | ``flowtype`` | 16 bit flowtype value | + +--------------+---------------------------------+ + Negative types ~~~~~~~~~~~~~~
lib/librte_ethdev/rte_flow.h +78 -0
102 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 2/8 librte_ethdev: add map filter type
In reply to Bernard Iremongeradd RTE_ETH_FILTER_MAP in rte_eth_ctrl.h
--- lib/librte_ethdev/rte_eth_ctrl.h | 1 + 1 file changed, 1 insertion(+)
lib/librte_ethdev/rte_eth_ctrl.h +1 -0
@@ -37,6 +37,7 @@ enum rte_filter_type {RTE_ETH_FILTER_HASH ,RTE_ETH_FILTER_L2_TUNNEL ,RTE_ETH_FILTER_GENERIC , +RTE_ETH_FILTER_MAP , RTE_ETH_FILTER_MAX };
Signature · 1 line
2.7.4
PATCH 3/8 librte_ethdev: add map action
In reply to Bernard Iremongeradd MK_FLOW_ACTION(MAP, sizeof(struct rte_flow_action_map)) add case RTE_FLOW_ACTION_TYPE_MAP
--- lib/librte_ethdev/rte_flow.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
lib/librte_ethdev/rte_flow.c +14 -0
@@ -173,6 +173,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {MK_FLOW_ACTION (SET_IPV4_DSCP ,sizeof (struct rte_flow_action_set_dscp )),MK_FLOW_ACTION (SET_IPV6_DSCP ,sizeof (struct rte_flow_action_set_dscp )),MK_FLOW_ACTION (AGE ,sizeof (struct rte_flow_action_age )), + MK_FLOW_ACTION(MAP, sizeof(struct rte_flow_action_map)), };int
@@ -596,11 +597,13 @@ rte_flow_conv_action_conf(void *buf, const size_t size,const struct rte_flow_action_rss *rss;const struct rte_flow_action_vxlan_encap *vxlan_encap;const struct rte_flow_action_nvgre_encap *nvgre_encap; +const struct rte_flow_action_map *map; } src;union {struct rte_flow_action_rss *rss;struct rte_flow_action_vxlan_encap *vxlan_encap;struct rte_flow_action_nvgre_encap *nvgre_encap; +struct rte_flow_action_map *map; } dst;size_t tmp;int ret;
@@ -665,6 +668,17 @@ rte_flow_conv_action_conf(void *buf, const size_t size, off += ret; }break ; +case RTE_FLOW_ACTION_TYPE_MAP : + src.map = action->conf; + dst.map = buf; +rte_memcpy (dst.map, + (&(struct rte_flow_action_map ){ + .pctype = src.map->pctype, + .flowtype = src.map->flowtype, + }), + size >sizeof (*dst.map) ?sizeof (*dst.map) : size); + off =sizeof (*dst.map); +break ;default : off = rte_flow_desc_action[action->type].size;rte_memcpy (buf, action->conf, (size > off ? off : size));
Signature · 1 line
2.7.4
PATCH 4/8 app/testpmd: parse map actions
In reply to Bernard IremongerParse map, pctype and flowtype on testpmd command line.
In cmdline_flow.c add the following:
ACTION_MAPACTION_MAP_PCTYPEACTION_MAP_FLOWTYPE
add parse_vc_action_map()
Update testpmd user guide with map action and
sample map action rules.
--- app/test-pmd/cmdline_flow.c | 85 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 27 +++++++++ 2 files changed, 112 insertions(+)
app/test-pmd/cmdline_flow.c +85 -0
@@ -349,6 +349,9 @@ enum index {ACTION_SET_IPV6_DSCP_VALUE ,ACTION_AGE ,ACTION_AGE_TIMEOUT , +ACTION_MAP , +ACTION_MAP_PCTYPE , + ACTION_MAP_FLOWTYPE, };/** Maximum size for pattern in struct rte_flow_item_raw. */
@@ -368,6 +371,11 @@ struct action_rss_data {uint16_t queue[ACTION_RSS_QUEUE_NUM ]; }; +/** Storage for struct rte_flow_action_map including external data. */ +struct action_map_data { +struct rte_flow_action_map conf; +}; +/** Maximum data size in struct rte_flow_action_raw_encap. */ #define ACTION_RAW_ENCAP_MAX_DATA 128#define RAW_ENCAP_CONFS_MAX_NUM 8
@@ -1161,6 +1169,7 @@ static const enum index next_action[] = {ACTION_SET_IPV4_DSCP ,ACTION_SET_IPV6_DSCP ,ACTION_AGE , +ACTION_MAP , ZERO, };
@@ -1194,6 +1203,13 @@ static const enum index action_rss[] = { ZERO, }; +static const enum index action_map[] = { +ACTION_MAP_PCTYPE , +ACTION_MAP_FLOWTYPE , +ACTION_NEXT , +ZERO , +}; +static const enum index action_vf[] = {ACTION_VF_ORIGINAL ,ACTION_VF_ID ,
@@ -1421,6 +1437,9 @@ static int parse_vc_action_rss_type(struct context *, const struct token *,static int parse_vc_action_rss_queue (struct context *,const struct token *,const char *,unsigned int ,void *,unsigned int ); +static int parse_vc_action_map (struct context *,const struct token *, +const char *,unsigned int ,void *, +unsigned int );static int parse_vc_action_vxlan_encap (struct context *,const struct token *,const char *,unsigned int ,void *,unsigned int );
@@ -3609,6 +3628,36 @@ static const struct token token_list[] = { .call = parse_vc_action_raw_decap_index, .comp = comp_set_raw_index, }, + [ACTION_MAP] = { + .name = "map", + .help = "map Packet Classification type to flow type", + .priv = PRIV_ACTION(MAP, sizeof(struct action_map_data)), + .next = NEXT(action_map), + .args = ARGS(ARGS_ENTRY(struct rte_flow_action_map, pctype), + ARGS_ENTRY(struct rte_flow_action_map, + flowtype)), + .call = parse_vc_action_map, + }, + [ACTION_MAP_PCTYPE] = { + .name = "pctype", + .help = "Packet Classification type ", + .next = NEXT(action_map, NEXT_ENTRY(UNSIGNED)), + .args =ARGS (ARGS_ENTRY_ARB + (offsetof(struct action_map_data , conf) + + offsetof(struct rte_flow_action_map , pctype), +sizeof (((struct rte_flow_action_map *)0 )-> + pctype))), + }, + [ACTION_MAP_FLOWTYPE] = { + .name = "flowtype", + .help = "flow type ", + .next = NEXT(action_map, NEXT_ENTRY(UNSIGNED)), + .args =ARGS (ARGS_ENTRY_ARB + (offsetof(struct action_map_data , conf) + + offsetof(struct rte_flow_action_map , flowtype), +sizeof (((struct rte_flow_action_map *)0 )-> + flowtype))), + },/* Top level command. */ [SET] = { .name = "set",
@@ -5207,6 +5256,42 @@ parse_vc_action_set_meta(struct context *ctx, const struct token *token,return len; } +/** Parse MAP action. */ +static int +parse_vc_action_map (struct context *ctx,const struct token *token, +const char *str,unsigned int len, +void *buf,unsigned int size) +{ +struct buffer *out = buf; +struct rte_flow_action *action; +struct action_map_data *action_map_data; +int ret; + + ret =parse_vc (ctx, token, str, len, buf, size); +if (ret <0 ) +return ret; +/* Nothing else to do if there is no buffer. */ +if (!out) +return ret; +if (!out->args.vc.actions_n) +return -1 ; + action = &out->args.vc.actions[out->args.vc.actions_n -1 ]; +/* Point to selected object. */ + ctx->object = out->args.vc.data; + ctx->objmask =NULL ; +/* Set up default configuration. */ + action_map_data = ctx->object; + *action_map_data = (struct action_map_data ){ + .conf = (struct rte_flow_action_map ){ + .flowtype =0 , + .pctype =0 + }, + }; + + action->conf = &action_map_data->conf; +return ret; +} +/** Parse tokens for destroy command. */ static int parse_destroy(struct context *ctx, const struct token *token,
doc/guides/testpmd_app_ug/testpmd_funcs.rst +27 -0
@@ -4281,6 +4281,8 @@ This section lists supported actions and their attributes, if any. - ``dscp_value {unsigned}``: The new DSCP value to be set +- ``map``: map Packet Classification (PC) type to flow type. + Destroying flow rules ~~~~~~~~~~~~~~~~~~~~~
@@ -4936,6 +4938,31 @@ if seid is set):: testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 1 seid is 1 / end actions queue index 3 / end +Sample PCTYPE mapping rules +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The following sequence of commands is required for pctype mapping:: + + testpmd> port stop 0 + testpmd> flow create 0 ingress pattern end actions map pctype 15 flowtype 27 / + end + testpmd> show port 0 pctype mapping + pctype: 15 -> flowtype: 27 + + testpmd> port start 0 + testpmd> flow create 0 ingress pattern end actions rss types end queues 0 1 2 + 3 end / end + testpmd> flow create 0 ingress pattern eth / ipv4 / esp / end actions rss + types esp end queues end / end + + testpmd> flow list 0 + ID Group Prio Attr Rule + 0 0 0 i-- => MAP + 1 0 0 i-- => RSS + 2 0 0 i-- ETH IPV4 ESP => RSS + testpmd> set verbose 1 + testpmd> start + BPF Functions --------------
Signature · 1 line
2.7.4
PATCH 5/8 net/i40e: add map filter
In reply to Bernard IremongerIn i40e_ethdev.h add the following:
struct i40e_map_filter
struct i40e_rte_flow_map_conf
--- drivers/net/i40e/i40e_ethdev.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/net/i40e/i40e_ethdev.h +24 -0
@@ -762,6 +762,10 @@ struct i40e_rss_pattern_info {uint64_t types; }; +struct i40e_map_pattern_info { +uint8_t action_flag; +}; +/* Tunnel filter number HW supports */ #define I40E_MAX_TUNNEL_FILTER_NUM 400
@@ -992,6 +996,19 @@ struct i40e_rss_filter {struct i40e_rte_flow_rss_conf rss_filter_info; }; +struct i40e_rte_flow_map_conf { +struct rte_flow_action_map conf;/**< MAP parameters. */ +bool valid;/* Check if it's valid */ +}; + +TAILQ_HEAD (i40e_map_conf_list, i40e_map_filter); + +/* MAP filter list structure */ +struct i40e_map_filter { +TAILQ_ENTRY (i40e_map_filter) next; +struct i40e_rte_flow_map_conf map_filter_info; +}; +struct i40e_vf_msg_cfg {/* maximal VF message during a statistic period */ uint32_t max_msg;
@@ -1085,6 +1102,8 @@ struct i40e_pf {uint16_t switch_domain_id;struct i40e_vf_msg_cfg vf_msg_cfg; +struct i40e_rte_flow_map_conf map_info;/* MAP info */ +struct i40e_map_conf_list map_config_list;/* MAP rule list */ };enum pending_msg {
@@ -1219,6 +1238,7 @@ union i40e_filter_t {struct rte_eth_tunnel_filter_conf tunnel_filter;struct i40e_tunnel_filter_conf consistent_tunnel_filter;struct i40e_rte_flow_rss_conf rss_conf; +struct i40e_rte_flow_map_conf map_conf; }; typedef int (*parse_filter_t)(struct rte_eth_dev *dev,
@@ -1365,6 +1385,10 @@ int i40e_config_rss_filter(struct i40e_pf *pf, struct i40e_rte_flow_rss_conf *conf, bool add);int i40e_vf_representor_init (struct rte_eth_dev *ethdev,void *init_params);int i40e_vf_representor_uninit (struct rte_eth_dev *ethdev); +int i40e_map_conf_init (struct i40e_rte_flow_map_conf *out, +const struct rte_flow_action_map *in); +int i40e_config_map_filter (struct i40e_pf *pf, +struct i40e_rte_flow_map_conf *conf,bool add);#define I40E_DEV_TO_PCI (eth_dev) \ RTE_DEV_TO_PCI((eth_dev)->device)
Signature · 1 line
2.7.4
PATCH 6/8 net/i40e: add map functions
In reply to Bernard Iremongeradd i40e_map_conf_init()
add i40e_config_map_filter()
initialize map_config_list in pf
call rte_pmd_i40e_flow_type_mapping_update()
--- drivers/net/i40e/i40e_ethdev.c | 56 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)
drivers/net/i40e/i40e_ethdev.c +56 -0
@@ -1660,6 +1660,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)/* initialize RSS rule list */ TAILQ_INIT (&pf->rss_config_list); +/* initialize MAP rule list */ +TAILQ_INIT (&pf->map_config_list); +/* initialize Traffic Manager configuration */ i40e_tm_conf_init (dev);
@@ -13411,6 +13414,59 @@ i40e_config_rss_filter(struct i40e_pf *pf,return 0 ; } +int +i40e_map_conf_init (struct i40e_rte_flow_map_conf *out, +const struct rte_flow_action_map *in) +{ +int ret =0 ; + +if ((in->pctype >=I40E_FILTER_PCTYPE_MAX ) || + (in->flowtype >=I40E_FLOW_TYPE_MAX )) + ret =EINVAL ; +else + out->conf = (struct rte_flow_action_map ){ + .pctype = in->pctype, + .flowtype = in->flowtype, + }; +return ret; +} + +int +i40e_config_map_filter (struct i40e_pf *pf, +struct i40e_rte_flow_map_conf *map_conf,bool add) +{ +struct i40e_rte_flow_map_conf *map_info = &pf->map_info; +struct rte_flow_action_map update_conf = map_info->conf; +struct rte_pmd_i40e_flow_type_mapping type_map; +int ret; + +if (add) { + update_conf.flowtype = map_conf->conf.flowtype; + update_conf.pctype = map_conf->conf.pctype; + + type_map.flow_type = map_conf->conf.flowtype; + type_map.pctype = (1ULL << map_conf->conf.pctype); + ret =rte_pmd_i40e_flow_type_mapping_update ( + pf->dev_data->port_id, &type_map,1 ,0 ); +if (ret) +return ret; + +/* Update MAP info in pf */ +if (i40e_map_conf_init (map_info, &update_conf)) +return -EINVAL ; + + }else { +if (!map_conf->valid) +return 0 ; + + map_info->conf.flowtype =0 ; + map_info->conf.pctype =0 ; + map_info->valid = false; + } + +return 0 ; +} +RTE_INIT (i40e_init_log) { i40e_logtype_init =rte_log_register ("pmd.net.i40e.init" );
Signature · 1 line
2.7.4
PATCH 7/8 net/i40e: parse map pattern and action
In reply to Bernard IremongerParse the map pattern and action in i40e_flow.c
Add the following functions:i40e_flow_parse_map_pattern()i40e_flow_parse_map_action()i40e_parse_map_filter()i40e_config_map_filter_set()i40e_config_map_filter_del()
--- drivers/net/i40e/i40e_flow.c | 196 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+)
drivers/net/i40e/i40e_flow.c +196 -0
@@ -4996,6 +4996,185 @@ i40e_config_rss_filter_del(struct rte_eth_dev *dev, }static int +i40e_flow_parse_map_pattern(__rte_unused struct rte_eth_dev *dev, +const struct rte_flow_item *pattern, +struct i40e_map_pattern_info *p_info, +struct rte_flow_error *error) +{ +const struct rte_flow_item *item = pattern; +enum rte_flow_item_type item_type; +struct rte_flow_item *items; +uint32_t item_num =0 ;/* non-void item number of pattern*/ +uint32_t i =0 ; + +if (item->type ==RTE_FLOW_ITEM_TYPE_END ) { + p_info->action_flag =1 ; +return 0 ; + } + +/* Convert pattern to item types */ +while ((pattern + i)->type !=RTE_FLOW_ITEM_TYPE_END ) { +if ((pattern + i)->type !=RTE_FLOW_ITEM_TYPE_VOID ) + item_num++; + i++; + } + item_num++; + + items =rte_zmalloc ("i40e_pattern" , + item_num *sizeof (struct rte_flow_item ),0 ); +if (!items) { +rte_flow_error_set (error,ENOMEM ,RTE_FLOW_ERROR_TYPE_ITEM_NUM , +NULL ,"No memory for PMD internal items." ); +return -ENOMEM ; + } + +i40e_pattern_skip_void_item (items, pattern); + +rte_free (items); + +for (; item->type !=RTE_FLOW_ITEM_TYPE_END ; item++) { +if (item->last) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Not supported" ); +return -rte_errno; + } + item_type = item->type; +switch (item_type) { +case RTE_FLOW_ITEM_TYPE_ETH : + p_info->action_flag =1 ; +break ; + +default : +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"item not supported" ); +return -rte_errno; + } + } + +return 0 ; +} + +static int +i40e_flow_parse_map_action(__rte_unused struct rte_eth_dev *dev, +const struct rte_flow_action *actions, +struct i40e_map_pattern_info *p_info, +struct rte_flow_error *error, +union i40e_filter_t *filter) +{ +const struct rte_flow_action *act; +const struct rte_flow_action_map *map; +struct i40e_rte_flow_map_conf *map_conf = &filter->map_conf; +uint32_t index =0 ; + +NEXT_ITEM_OF_ACTION (act, actions, index); + +/** +* check if the first not void action is MAP. +*/ +if ((act->type !=RTE_FLOW_ACTION_TYPE_MAP ) || + (p_info->action_flag ==0 )) { +memset (map_conf,0 ,sizeof (struct i40e_rte_flow_map_conf )); +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ACTION , + act,"Not supported action." ); +return -rte_errno; + } + + map = act->conf; + +if (i40e_map_conf_init (map_conf, map)) +return rte_flow_error_set + (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ACTION , act, +"MAP context initialization failure" ); + + map_conf->valid = true; + +return 0 ; +} + +static int +i40e_parse_map_filter (struct rte_eth_dev *dev, +const struct rte_flow_attr *attr, +const struct rte_flow_item pattern[], +const struct rte_flow_action actions[], +union i40e_filter_t *filter, +struct rte_flow_error *error) +{ +struct i40e_map_pattern_info p_info; +int ret; + +memset (&p_info,0 ,sizeof (struct i40e_map_pattern_info )); + + ret =i40e_flow_parse_map_pattern (dev, pattern, &p_info, error); +if (ret) +return ret; + + ret =i40e_flow_parse_map_action (dev, actions, &p_info, error, filter); +if (ret) +return ret; + + ret =i40e_flow_parse_attr (attr, error); +if (ret) +return ret; + + cons_filter_type =RTE_ETH_FILTER_MAP ; + +return 0 ; +} + +static int +i40e_config_map_filter_set (struct rte_eth_dev *dev, +struct i40e_rte_flow_map_conf *conf) +{ +struct i40e_pf *pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); +struct i40e_map_filter *map_filter; +int ret; + + ret =i40e_config_map_filter (pf, conf,1 ); +if (ret) +return ret; + + map_filter =rte_zmalloc ("i40e_map_filter" ,sizeof (*map_filter),0 ); +if (map_filter ==NULL ) { +PMD_DRV_LOG (ERR ,"Failed to alloc memory." ); +return -ENOMEM ; + } + map_filter->map_filter_info = *conf; + +/* the rule newly created is always valid +* the existing rule covered by new rule will be set invalid +*/ + map_filter->map_filter_info.valid = true; + +TAILQ_INSERT_TAIL (&pf->map_config_list, map_filter, next); + +return 0 ; +} + +static int +i40e_config_map_filter_del (struct rte_eth_dev *dev, +struct i40e_rte_flow_map_conf *conf) +{ +struct i40e_pf *pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); +struct i40e_map_filter *map_filter; +void *temp; + +i40e_config_map_filter (pf, conf,0 ); + + TAILQ_FOREACH_SAFE(map_filter, &pf->map_config_list, next, temp) { +if (!memcmp (&map_filter->map_filter_info, conf, +sizeof (struct rte_flow_action_map ))) { +TAILQ_REMOVE (&pf->map_config_list, map_filter, next); +rte_free (map_filter); + } + } +return 0 ; +} + +static int i40e_flow_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, const struct rte_flow_item pattern[],
@@ -5041,6 +5220,12 @@ i40e_flow_validate(struct rte_eth_dev *dev,return ret; } +if ((actions + i)->type ==RTE_FLOW_ACTION_TYPE_MAP ) { + ret =i40e_parse_map_filter (dev, attr, pattern, + actions, &cons_filter, error); +return ret; + } + i =0 ;/* Get the non-void item number of pattern */ while ((pattern + i)->type !=RTE_FLOW_ITEM_TYPE_END ) {
@@ -5137,6 +5322,13 @@ i40e_flow_create(struct rte_eth_dev *dev, flow->rule =TAILQ_LAST (&pf->rss_config_list, i40e_rss_conf_list);break ; +case RTE_ETH_FILTER_MAP : + ret =i40e_config_map_filter_set (dev, &cons_filter.map_conf); +if (ret) + goto free_flow; + flow->rule =TAILQ_LAST (&pf->map_config_list, + i40e_map_conf_list); +break ;default : goto free_flow; }
@@ -5184,6 +5376,10 @@ i40e_flow_destroy(struct rte_eth_dev *dev, ret =i40e_config_rss_filter_del (dev, &((struct i40e_rss_filter *)flow->rule)->rss_filter_info);break ; +case RTE_ETH_FILTER_MAP : + ret =i40e_config_map_filter_del (dev, + &((struct i40e_map_filter *)flow->rule)->map_filter_info); +break ;default :PMD_DRV_LOG (WARNING ,"Filter type (%d) not supported" , filter_type);
Signature · 1 line
2.7.4
PATCH 8/8 doc: release note
In reply to Bernard Iremonger--- doc/guides/rel_notes/release_20_08.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
doc/guides/rel_notes/release_20_08.rst +18 -0
@@ -56,6 +56,24 @@ New Features Also, make sure to start the actual text at the margin. ========================================================= +* **Added a map action to the rte_flow API.** + + Added a map action to map Packet Classification (PC) types to flow types + + * Added new action: ``RTE_FLOW_ACTION_MAP`` + * Added new type: ``RTE_FLOW_ITEM_TYPE_PCTYPE`` + * Added new type: ``RTE_FLOW_ITEM_TYPE_FLOWTYPE`` + +* **Updated Intel i40e driver.** + + Updated i40e PMD with new features and improvements, including: + + * added support for the rte_flow map action + +* **Updated the testpmd application.** + + Added support for the rte_flow map action to the testpmd application. + Removed Items -------------
Signature · 1 line
2.7.4
Hi Bernard,
Can you please explain more what is the pctype, the flow type, What is the general idea beyond this patch set?
How will the application uses it?
is it only for i40?
Thanks,
Ori
Quoted 39 lines
-----Original Message-----
From: Bernard Iremonger <[email protected]>
Sent: Wednesday, June 3, 2020 5:20 PM
To: [email protected]; [email protected]; [email protected]; [email protected]; Ori Kam <[email protected]>
Cc: Bernard Iremonger <[email protected]>
Subject: [PATCH 0/8] add flow action mapAdd map action to
rte_flowAPI to map a Packet Classification type (pctype) to a flowtype for the i40e PMD.This feature requires changes to be made to the
rte_flowcode inlibrte_ethdev, testpmd and the i40e PMD.Bernard Iremonger (8):
librte_ethdev: add new flow types and action
librte_ethdev: add map filter type
librte_ethdev: add map action
app/testpmd: parse map actions
net/i40e: add map filter
net/i40e: add map functions
net/i40e: parse map pattern and action
doc: release noteapp/test-pmd/cmdline_flow.c | 85 ++++++++++++ doc/guides/prog_guide/rte_flow.rst | 55 ++++++++ doc/guides/rel_notes/release_20_08.rst | 18 +++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 27 ++++ drivers/net/i40e/i40e_ethdev.c | 56 ++++++++ drivers/net/i40e/i40e_ethdev.h | 24 ++++ drivers/net/i40e/i40e_flow.c | 196 ++++++++++++++++++++++++++++ lib/librte_ethdev/rte_eth_ctrl.h | 1 + lib/librte_ethdev/rte_flow.c | 14 ++ lib/librte_ethdev/rte_flow.h | 78 +++++++++++ 10 files changed, 554 insertions(+)--
2.7.4
Hi Ori,
This patchset is intended to add support in the rte_flow API for the Dynamic Device Personalization (DDP) feature on the Intel i40e PMD by adding a map action.
pctype means Packet Classification type. flowtype is the index into the pctype table on the i40e.
The map action is intended to insert the specified pctype into the pctype table at index specified by the flowtype.
At present the DDP feature uses the following commands in testpmd:
/* map pctype 15 to flowtype 27 */
# testpmd> port config 0 pctype mapping update 15 27
# testpmd> show port 0 pctype mapping
pctype: 15 -> flowtype: 27
In future the application will create the following rule:
# testpmd> flow create 0 ingress pattern end actions map pctype 15 flowtype 27 / end # testpmd> show port 0 pctype mapping
pctype: 15 -> flowtype: 27
Regards,
Bernard.
Quoted 58 lines
-----Original Message-----
From: Ori Kam <[email protected]>
Sent: Thursday, June 4, 2020 7:06 AM
To: Iremonger, Bernard <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Subject: RE: [PATCH 0/8] add flow action mapHi Bernard,
Can you please explain more what is the pctype, the flow type, What is the general idea beyond this patch set?
How will the application uses it?
is it only for i40?Thanks,
OriQuoted 25 lines
-----Original Message-----
From: Bernard Iremonger <[email protected]>
Sent: Wednesday, June 3, 2020 5:20 PM
To: [email protected]; [email protected]; [email protected]; [email protected]; Ori Kam <[email protected]>
Cc: Bernard Iremonger <[email protected]>
Subject: [PATCH 0/8] add flow action mapAdd map action to
rte_flowAPI to map a Packet Classification type (pctype) to a flowtype for the i40e PMD.This feature requires changes to be made to the
rte_flowcode inlibrte_ethdev, testpmd and the i40e PMD.Bernard Iremonger (8):
librte_ethdev: add new flow types and action
librte_ethdev: add map filter type
librte_ethdev: add map action
app/testpmd: parse map actions
net/i40e: add map filter
net/i40e: add map functions
net/i40e: parse map pattern and action
doc: release noteQuoted 7 lines
app/test-pmd/cmdline_flow.c | 85 ++++++++++++ doc/guides/prog_guide/rte_flow.rst | 55 ++++++++ doc/guides/rel_notes/release_20_08.rst | 18 +++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 27 ++++ drivers/net/i40e/i40e_ethdev.c | 56 ++++++++ drivers/net/i40e/i40e_ethdev.h | 24 ++++ drivers/net/i40e/i40e_flow.c | 196++++++++++++++++++++++++++++
Quoted 7 lines
lib/librte_ethdev/rte_eth_ctrl.h | 1 + lib/librte_ethdev/rte_flow.c | 14 ++ lib/librte_ethdev/rte_flow.h | 78 +++++++++++ 10 files changed, 554 insertions(+)--
2.7.4
(reordered replies to avoid top-post)
04/06/2020 13:21, Iremonger, Bernard:
Quoted 40 lines
From: Ori Kam <[email protected]>
Quoted 18 lines
From: Bernard Iremonger <[email protected]>
Quoted 7 lines
Add map action to
rte_flowAPI to map a Packet Classification type (pctype) to a flowtype for the i40e PMD.This feature requires changes to be made to the
rte_flowcode inlibrte_ethdev, testpmd and the i40e PMD.Quoted 9 lines
Bernard Iremonger (8):
librte_ethdev: add new flow types and action
librte_ethdev: add map filter type
librte_ethdev: add map action
app/testpmd: parse map actions
net/i40e: add map filter
net/i40e: add map functions
net/i40e: parse map pattern and action
doc: release noteQuoted 4 lines
Can you please explain more what is the pctype, the flow type, What is the general idea beyond this patch set?
How will the application uses it?
is it only for i40?This patchset is intended to add support in the
rte_flowAPI for the Dynamic Device Personalization (DDP) feature on the Intel i40e PMD by adding a map action.pctype means Packet Classification type. flowtype is the index into the pctype table on the i40e.
The map action is intended to insert the specified pctype into the pctype table at index specified by the flowtype.
At present the DDP feature uses the following commands in testpmd:
/* map pctype 15 to flowtype 27 */
# testpmd> port config 0 pctype mapping update 15 27
# testpmd> show port 0 pctype mapping
pctype: 15 -> flowtype: 27
Quoted 4 lines
In future the application will create the following rule:
# testpmd> flow create 0 ingress pattern end actions map pctype 15 flowtype 27 / end # testpmd> show port 0 pctype mapping
pctype: 15 -> flowtype: 27
This usage looks really Intel-specific.
If the application has to consider the Intel-specific ids, then it is not generic.
Having some HW specific API makes no sense in the generic ethdev API. Sorry I must say NACK.
Could this code be in drivers/net/i40e/rte_pmd_i40e.h ?