[dpdk-dev,v4,7/7] app/testpmd: add CLIs for E-tag operation
Commit Message
Add the CLIs to support the E-tag operation.
1, Offloading of E-tag insertion and stripping.
2, Forwarding the E-tag packets to pools based on the GRP and E-CID_base.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/cmdline.c | 378 ++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 26 ++
2 files changed, 404 insertions(+)
Comments
Hi Wenzhuo,
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Thursday, February 18, 2016 10:46 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v4 7/7] app/testpmd: add CLIs for E-tag
> operation
>
> Add the CLIs to support the E-tag operation.
> 1, Offloading of E-tag insertion and stripping.
> 2, Forwarding the E-tag packets to pools based on the GRP and E-CID_base.
>
> Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> ---
> app/test-pmd/cmdline.c | 378
> ++++++++++++++++++++++++++++
> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 26 ++
> 2 files changed, 404 insertions(+)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 24a3169..02868f3 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -502,6 +502,27 @@ static void cmd_help_long_parsed(void
> *parsed_result,
> "set link-down port (port_id)\n"
> " Set link down for a port.\n\n"
>
> + "E-tag set insertion on port-tag-id (value)"
> + " port (port_id) vf (vf_id)\n"
> + " Enable E-tag insertion for a VF on a port\n\n"
> +
> + "E-tag set insertion off port (port_id) vf (vf_id)\n"
> + " Disable E-tag insertion for a VF on a port\n\n"
> +
> + "E-tag set stripping (on|off) port (port_id)\n"
> + " Enable/disable E-tag stripping on a port\n\n"
> +
> + "E-tag set forwarding (on|off) port (port_id)\n"
> + " Enable/disable E-tag based forwarding"
> + " on a port\n\n"
> +
> + "E-tag set filter add e-tag-id (value) dst-pool"
> + " (pool_id) port (port_id)\n"
> + " Add an E-tag forwarding filter on a port\n\n"
> +
> + "E-tag set filter del e-tag-id (value) port (port_id)\n"
> + " Delete an E-tag forwarding filter on a port\n\n"
> +
> , list_pkt_forwarding_modes()
> );
> }
> @@ -9895,6 +9916,357 @@ cmdline_parse_inst_t
> cmd_config_l2_tunnel_en_dis_specific = {
> },
> };
>
> +/* E-tag configuration */
> +
> +/* Common result structure for all E-tag configuration */
> +struct cmd_config_e_tag_result {
> + cmdline_fixed_string_t e_tag;
> + cmdline_fixed_string_t set;
> + cmdline_fixed_string_t insertion;
> + cmdline_fixed_string_t stripping;
> + cmdline_fixed_string_t forwarding;
> + cmdline_fixed_string_t filter;
> + cmdline_fixed_string_t add;
> + cmdline_fixed_string_t del;
> + cmdline_fixed_string_t on;
> + cmdline_fixed_string_t off;
> + cmdline_fixed_string_t on_off;
> + cmdline_fixed_string_t port_tag_id;
> + uint32_t port_tag_id_val;
> + cmdline_fixed_string_t e_tag_id;
> + uint16_t e_tag_id_val;
> + cmdline_fixed_string_t dst_pool;
> + uint8_t dst_pool_val;
> + cmdline_fixed_string_t port;
> + uint8_t port_id;
> + cmdline_fixed_string_t vf;
> + uint8_t vf_id;
> +};
> +
> +/* Common CLI fields for all E-tag configuration */
> +cmdline_parse_token_string_t cmd_config_e_tag_e_tag =
> + TOKEN_STRING_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + e_tag, "E-tag");
> +cmdline_parse_token_string_t cmd_config_e_tag_set =
> + TOKEN_STRING_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + set, "set");
> +cmdline_parse_token_string_t cmd_config_e_tag_insertion =
> + TOKEN_STRING_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + insertion, "insertion");
> +cmdline_parse_token_string_t cmd_config_e_tag_stripping =
> + TOKEN_STRING_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + stripping, "stripping");
> +cmdline_parse_token_string_t cmd_config_e_tag_forwarding =
> + TOKEN_STRING_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + forwarding, "forwarding");
> +cmdline_parse_token_string_t cmd_config_e_tag_filter =
> + TOKEN_STRING_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + filter, "filter");
> +cmdline_parse_token_string_t cmd_config_e_tag_add =
> + TOKEN_STRING_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + add, "add");
> +cmdline_parse_token_string_t cmd_config_e_tag_del =
> + TOKEN_STRING_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + del, "del");
> +cmdline_parse_token_string_t cmd_config_e_tag_on =
> + TOKEN_STRING_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + on, "on");
> +cmdline_parse_token_string_t cmd_config_e_tag_off =
> + TOKEN_STRING_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + off, "off");
> +cmdline_parse_token_string_t cmd_config_e_tag_on_off =
> + TOKEN_STRING_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + on_off, "on#off");
> +cmdline_parse_token_string_t cmd_config_e_tag_port_tag_id =
> + TOKEN_STRING_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + port_tag_id, "port-tag-id");
> +cmdline_parse_token_num_t cmd_config_e_tag_port_tag_id_val =
> + TOKEN_NUM_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + port_tag_id_val, UINT32);
> +cmdline_parse_token_string_t cmd_config_e_tag_e_tag_id =
> + TOKEN_STRING_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + e_tag_id, "e-tag-id");
> +cmdline_parse_token_num_t cmd_config_e_tag_e_tag_id_val =
> + TOKEN_NUM_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + e_tag_id_val, UINT16);
> +cmdline_parse_token_string_t cmd_config_e_tag_dst_pool =
> + TOKEN_STRING_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + dst_pool, "dst-pool");
> +cmdline_parse_token_num_t cmd_config_e_tag_dst_pool_val =
> + TOKEN_NUM_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + dst_pool_val, UINT8);
> +cmdline_parse_token_string_t cmd_config_e_tag_port =
> + TOKEN_STRING_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + port, "port");
> +cmdline_parse_token_num_t cmd_config_e_tag_port_id =
> + TOKEN_NUM_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + port_id, UINT8);
> +cmdline_parse_token_string_t cmd_config_e_tag_vf =
> + TOKEN_STRING_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + vf, "vf");
> +cmdline_parse_token_num_t cmd_config_e_tag_vf_id =
> + TOKEN_NUM_INITIALIZER
> + (struct cmd_config_e_tag_result,
> + vf_id, UINT8);
> +
> +/* E-tag insertion configuration */
> +static void
> +cmd_config_e_tag_insertion_en_parsed(
> + void *parsed_result,
> + __attribute__((unused)) struct cmdline *cl,
> + __attribute__((unused)) void *data)
> +{
> + struct cmd_config_e_tag_result *res =
> + parsed_result;
> + struct rte_eth_l2_tunnel entry;
> +
> + if (port_id_is_invalid(res->port_id, ENABLED_WARN))
> + return;
> +
> + entry.l2_tunnel_type = RTE_L2_TUNNEL_TYPE_E_TAG;
> + entry.tunnel_id = res->port_tag_id_val;
> + rte_eth_dev_l2_tunnel_insertion_enable(res->port_id,
> + &entry,
> + res->vf_id);
several space in above 2 lines, better to replace to Tab
> +}
> +
> +static void
> +cmd_config_e_tag_insertion_dis_parsed(
> + void *parsed_result,
> + __attribute__((unused)) struct cmdline *cl,
> + __attribute__((unused)) void *data)
> +{
> + struct cmd_config_e_tag_result *res =
> + parsed_result;
> +
> + if (port_id_is_invalid(res->port_id, ENABLED_WARN))
> + return;
> +
> + rte_eth_dev_l2_tunnel_insertion_disable(res->port_id,
> +
> RTE_L2_TUNNEL_TYPE_E_TAG,
> + res->vf_id);
> +}
> +
> +cmdline_parse_inst_t cmd_config_e_tag_insertion_en = {
> + .f = cmd_config_e_tag_insertion_en_parsed,
> + .data = NULL,
> + .help_str = "E-tag insertion enable",
> + .tokens = {
> + (void *)&cmd_config_e_tag_e_tag,
> + (void *)&cmd_config_e_tag_set,
> + (void *)&cmd_config_e_tag_insertion,
> + (void *)&cmd_config_e_tag_on,
> + (void *)&cmd_config_e_tag_port_tag_id,
> + (void *)&cmd_config_e_tag_port_tag_id_val,
> + (void *)&cmd_config_e_tag_port,
> + (void *)&cmd_config_e_tag_port_id,
> + (void *)&cmd_config_e_tag_vf,
> + (void *)&cmd_config_e_tag_vf_id,
> + NULL,
> + },
> +};
> +
> +cmdline_parse_inst_t cmd_config_e_tag_insertion_dis = {
> + .f = cmd_config_e_tag_insertion_dis_parsed,
> + .data = NULL,
> + .help_str = "E-tag insertion disable",
> + .tokens = {
> + (void *)&cmd_config_e_tag_e_tag,
> + (void *)&cmd_config_e_tag_set,
> + (void *)&cmd_config_e_tag_insertion,
> + (void *)&cmd_config_e_tag_off,
> + (void *)&cmd_config_e_tag_port,
> + (void *)&cmd_config_e_tag_port_id,
> + (void *)&cmd_config_e_tag_vf,
> + (void *)&cmd_config_e_tag_vf_id,
> + NULL,
> + },
> +};
> +
> +/* E-tag stripping configuration */
> +static void
> +cmd_config_e_tag_stripping_parsed(
> + void *parsed_result,
> + __attribute__((unused)) struct cmdline *cl,
> + __attribute__((unused)) void *data)
> +{
> + struct cmd_config_e_tag_result *res =
> + parsed_result;
> +
> + if (port_id_is_invalid(res->port_id, ENABLED_WARN))
> + return;
> +
> + if (!strcmp(res->on_off, "on"))
> + rte_eth_dev_l2_tunnel_stripping_enable
> + (res->port_id,
> + RTE_L2_TUNNEL_TYPE_E_TAG);
> + else
> + rte_eth_dev_l2_tunnel_stripping_disable
> + (res->port_id,
> + RTE_L2_TUNNEL_TYPE_E_TAG);
> +}
> +
> +cmdline_parse_inst_t cmd_config_e_tag_stripping_en_dis = {
> + .f = cmd_config_e_tag_stripping_parsed,
> + .data = NULL,
> + .help_str = "E-tag stripping enable/disable",
> + .tokens = {
> + (void *)&cmd_config_e_tag_e_tag,
> + (void *)&cmd_config_e_tag_set,
> + (void *)&cmd_config_e_tag_stripping,
> + (void *)&cmd_config_e_tag_on_off,
> + (void *)&cmd_config_e_tag_port,
> + (void *)&cmd_config_e_tag_port_id,
> + NULL,
> + },
> +};
> +
> +/* E-tag forwarding configuration */
> +static void
> +cmd_config_e_tag_forwarding_parsed(
> + void *parsed_result,
> + __attribute__((unused)) struct cmdline *cl,
> + __attribute__((unused)) void *data)
> +{
> + struct cmd_config_e_tag_result *res =
> + parsed_result;
> +
> + if (port_id_is_invalid(res->port_id, ENABLED_WARN))
> + return;
> +
> + if (!strcmp(res->on_off, "on"))
> + rte_eth_dev_l2_tunnel_forwarding_enable
> + (res->port_id,
> + RTE_L2_TUNNEL_TYPE_E_TAG);
> + else
> + rte_eth_dev_l2_tunnel_forwarding_disable
> + (res->port_id,
> + RTE_L2_TUNNEL_TYPE_E_TAG);
> +}
> +
> +cmdline_parse_inst_t cmd_config_e_tag_forwarding_en_dis = {
> + .f = cmd_config_e_tag_forwarding_parsed,
> + .data = NULL,
> + .help_str = "E-tag forwarding enable/disable",
> + .tokens = {
> + (void *)&cmd_config_e_tag_e_tag,
> + (void *)&cmd_config_e_tag_set,
> + (void *)&cmd_config_e_tag_forwarding,
> + (void *)&cmd_config_e_tag_on_off,
> + (void *)&cmd_config_e_tag_port,
> + (void *)&cmd_config_e_tag_port_id,
> + NULL,
> + },
> +};
> +
> +/* E-tag filter configuration */
> +static void
> +cmd_config_e_tag_filter_add_parsed(
> + void *parsed_result,
> + __attribute__((unused)) struct cmdline *cl,
> + __attribute__((unused)) void *data)
> +{
> + struct cmd_config_e_tag_result *res =
> + parsed_result;
> + struct rte_eth_l2_tunnel entry;
> +
> + if (port_id_is_invalid(res->port_id, ENABLED_WARN))
> + return;
> +
> + if (res->e_tag_id_val > 0x3fff) {
> + printf("e-tag-id must be less than 0x3fff.\n");
How about e-tag-id == 0x3fff? Error message seems to not allow, but the program actually does.
> + return;
> + }
> +
> + entry.l2_tunnel_type = RTE_L2_TUNNEL_TYPE_E_TAG;
> + entry.tunnel_id = res->e_tag_id_val;
> +
> + rte_eth_dev_l2_tunnel_filter_add(res->port_id,
> + &entry,
> + res->dst_pool_val);
> +}
> +
> +cmdline_parse_inst_t cmd_config_e_tag_filter_add = {
> + .f = cmd_config_e_tag_filter_add_parsed,
> + .data = NULL,
> + .help_str = "E-tag filter add",
> + .tokens = {
> + (void *)&cmd_config_e_tag_e_tag,
> + (void *)&cmd_config_e_tag_set,
> + (void *)&cmd_config_e_tag_filter,
> + (void *)&cmd_config_e_tag_add,
> + (void *)&cmd_config_e_tag_e_tag_id,
> + (void *)&cmd_config_e_tag_e_tag_id_val,
> + (void *)&cmd_config_e_tag_dst_pool,
> + (void *)&cmd_config_e_tag_dst_pool_val,
> + (void *)&cmd_config_e_tag_port,
> + (void *)&cmd_config_e_tag_port_id,
> + NULL,
> + },
> +};
> +
> +static void
> +cmd_config_e_tag_filter_del_parsed(
> + void *parsed_result,
> + __attribute__((unused)) struct cmdline *cl,
> + __attribute__((unused)) void *data)
> +{
> + struct cmd_config_e_tag_result *res =
> + parsed_result;
> + struct rte_eth_l2_tunnel entry;
> +
> + if (port_id_is_invalid(res->port_id, ENABLED_WARN))
> + return;
> +
> + if (res->e_tag_id_val > 0x3fff) {
> + printf("e-tag-id must be less than 0x3fff.\n");
> + return;
> + }
> +
> + entry.l2_tunnel_type = RTE_L2_TUNNEL_TYPE_E_TAG;
> + entry.tunnel_id = res->e_tag_id_val;
> +
> + rte_eth_dev_l2_tunnel_filter_del(res->port_id,
> + &entry);
> +}
> +
> +cmdline_parse_inst_t cmd_config_e_tag_filter_del = {
> + .f = cmd_config_e_tag_filter_del_parsed,
> + .data = NULL,
> + .help_str = "E-tag filter delete",
> + .tokens = {
> + (void *)&cmd_config_e_tag_e_tag,
> + (void *)&cmd_config_e_tag_set,
> + (void *)&cmd_config_e_tag_filter,
> + (void *)&cmd_config_e_tag_del,
> + (void *)&cmd_config_e_tag_e_tag_id,
> + (void *)&cmd_config_e_tag_e_tag_id_val,
> + (void *)&cmd_config_e_tag_port,
> + (void *)&cmd_config_e_tag_port_id,
> + NULL,
> + },
> +};
> +
> /*
> **********************************************************
> ********************** */
>
> /* list of instructions */
> @@ -10040,6 +10412,12 @@ cmdline_parse_ctx_t main_ctx[] = {
> (cmdline_parse_inst_t *)&cmd_config_l2_tunnel_eth_type_specific,
> (cmdline_parse_inst_t *)&cmd_config_l2_tunnel_en_dis_all,
> (cmdline_parse_inst_t *)&cmd_config_l2_tunnel_en_dis_specific,
> + (cmdline_parse_inst_t *)&cmd_config_e_tag_insertion_en,
> + (cmdline_parse_inst_t *)&cmd_config_e_tag_insertion_dis,
> + (cmdline_parse_inst_t *)&cmd_config_e_tag_stripping_en_dis,
> + (cmdline_parse_inst_t *)&cmd_config_e_tag_forwarding_en_dis,
> + (cmdline_parse_inst_t *)&cmd_config_e_tag_filter_add,
> + (cmdline_parse_inst_t *)&cmd_config_e_tag_filter_del,
> NULL,
> };
>
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index 5471ebe..e116d98 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -917,6 +917,32 @@ Set link down for a port::
>
> testpmd> set link-down port (port id)
>
> +E-tag set
> +~~~~~~~~~
> +
> +Enable E-tag insertion for a VF on a port::
> +
> + testpmd> E-tag set insertion on port-tag-id (value) port (port_id) vf (vf_id)
> +
> +Disable E-tag insertion for a VF on a port::
> +
> + testpmd> E-tag set insertion off port (port_id) vf (vf_id)
> +
> +Enable/disable E-tag stripping on a port::
> +
> + testpmd> E-tag set stripping (on|off) port (port_id)
> +
> +Enable/disable E-tag based forwarding on a port::
> +
> + testpmd> E-tag set forwarding (on|off) port (port_id)
> +
> +Add an E-tag forwarding filter on a port::
> +
> + testpmd> E-tag set filter add e-tag-id (value) dst-pool (pool_id) port
> (port_id)
> +
> +Delete an E-tag forwarding filter on a port::
> + testpmd> E-tag set filter del e-tag-id (value) port (port_id)
> +
>
> Port Functions
> --------------
> --
> 1.9.3
Hi Shaopeng,
> -----Original Message-----
> From: He, Shaopeng
> Sent: Friday, March 4, 2016 9:46 AM
> To: Lu, Wenzhuo; dev@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v4 7/7] app/testpmd: add CLIs for E-tag
> operation
>
> Hi Wenzhuo,
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > Sent: Thursday, February 18, 2016 10:46 AM
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH v4 7/7] app/testpmd: add CLIs for E-tag
> > operation
> >
> > Add the CLIs to support the E-tag operation.
> > 1, Offloading of E-tag insertion and stripping.
> > 2, Forwarding the E-tag packets to pools based on the GRP and E-CID_base.
> >
> > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> > ---
> > app/test-pmd/cmdline.c | 378
> > ++++++++++++++++++++++++++++
> > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 26 ++
> > 2 files changed, 404 insertions(+)
> >
> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> > 24a3169..02868f3 100644
> > --- a/app/test-pmd/cmdline.c
> > +++ b/app/test-pmd/cmdline.c
> > @@ -502,6 +502,27 @@ static void cmd_help_long_parsed(void
> > *parsed_result,
> > "set link-down port (port_id)\n"
> > " Set link down for a port.\n\n"
> >
> > + "E-tag set insertion on port-tag-id (value)"
> > + " port (port_id) vf (vf_id)\n"
> > + " Enable E-tag insertion for a VF on a port\n\n"
> > +
> > + "E-tag set insertion off port (port_id) vf (vf_id)\n"
> > + " Disable E-tag insertion for a VF on a port\n\n"
> > +
> > + "E-tag set stripping (on|off) port (port_id)\n"
> > + " Enable/disable E-tag stripping on a port\n\n"
> > +
> > + "E-tag set forwarding (on|off) port (port_id)\n"
> > + " Enable/disable E-tag based forwarding"
> > + " on a port\n\n"
> > +
> > + "E-tag set filter add e-tag-id (value) dst-pool"
> > + " (pool_id) port (port_id)\n"
> > + " Add an E-tag forwarding filter on a port\n\n"
> > +
> > + "E-tag set filter del e-tag-id (value) port (port_id)\n"
> > + " Delete an E-tag forwarding filter on a port\n\n"
> > +
> > , list_pkt_forwarding_modes()
> > );
> > }
> > @@ -9895,6 +9916,357 @@ cmdline_parse_inst_t
> > cmd_config_l2_tunnel_en_dis_specific = {
> > },
> > };
> >
> > +/* E-tag configuration */
> > +
> > +/* Common result structure for all E-tag configuration */ struct
> > +cmd_config_e_tag_result {
> > + cmdline_fixed_string_t e_tag;
> > + cmdline_fixed_string_t set;
> > + cmdline_fixed_string_t insertion;
> > + cmdline_fixed_string_t stripping;
> > + cmdline_fixed_string_t forwarding;
> > + cmdline_fixed_string_t filter;
> > + cmdline_fixed_string_t add;
> > + cmdline_fixed_string_t del;
> > + cmdline_fixed_string_t on;
> > + cmdline_fixed_string_t off;
> > + cmdline_fixed_string_t on_off;
> > + cmdline_fixed_string_t port_tag_id;
> > + uint32_t port_tag_id_val;
> > + cmdline_fixed_string_t e_tag_id;
> > + uint16_t e_tag_id_val;
> > + cmdline_fixed_string_t dst_pool;
> > + uint8_t dst_pool_val;
> > + cmdline_fixed_string_t port;
> > + uint8_t port_id;
> > + cmdline_fixed_string_t vf;
> > + uint8_t vf_id;
> > +};
> > +
> > +/* Common CLI fields for all E-tag configuration */
> > +cmdline_parse_token_string_t cmd_config_e_tag_e_tag =
> > + TOKEN_STRING_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + e_tag, "E-tag");
> > +cmdline_parse_token_string_t cmd_config_e_tag_set =
> > + TOKEN_STRING_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + set, "set");
> > +cmdline_parse_token_string_t cmd_config_e_tag_insertion =
> > + TOKEN_STRING_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + insertion, "insertion");
> > +cmdline_parse_token_string_t cmd_config_e_tag_stripping =
> > + TOKEN_STRING_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + stripping, "stripping");
> > +cmdline_parse_token_string_t cmd_config_e_tag_forwarding =
> > + TOKEN_STRING_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + forwarding, "forwarding");
> > +cmdline_parse_token_string_t cmd_config_e_tag_filter =
> > + TOKEN_STRING_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + filter, "filter");
> > +cmdline_parse_token_string_t cmd_config_e_tag_add =
> > + TOKEN_STRING_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + add, "add");
> > +cmdline_parse_token_string_t cmd_config_e_tag_del =
> > + TOKEN_STRING_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + del, "del");
> > +cmdline_parse_token_string_t cmd_config_e_tag_on =
> > + TOKEN_STRING_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + on, "on");
> > +cmdline_parse_token_string_t cmd_config_e_tag_off =
> > + TOKEN_STRING_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + off, "off");
> > +cmdline_parse_token_string_t cmd_config_e_tag_on_off =
> > + TOKEN_STRING_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + on_off, "on#off");
> > +cmdline_parse_token_string_t cmd_config_e_tag_port_tag_id =
> > + TOKEN_STRING_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + port_tag_id, "port-tag-id");
> > +cmdline_parse_token_num_t cmd_config_e_tag_port_tag_id_val =
> > + TOKEN_NUM_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + port_tag_id_val, UINT32);
> > +cmdline_parse_token_string_t cmd_config_e_tag_e_tag_id =
> > + TOKEN_STRING_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + e_tag_id, "e-tag-id");
> > +cmdline_parse_token_num_t cmd_config_e_tag_e_tag_id_val =
> > + TOKEN_NUM_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + e_tag_id_val, UINT16);
> > +cmdline_parse_token_string_t cmd_config_e_tag_dst_pool =
> > + TOKEN_STRING_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + dst_pool, "dst-pool");
> > +cmdline_parse_token_num_t cmd_config_e_tag_dst_pool_val =
> > + TOKEN_NUM_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + dst_pool_val, UINT8);
> > +cmdline_parse_token_string_t cmd_config_e_tag_port =
> > + TOKEN_STRING_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + port, "port");
> > +cmdline_parse_token_num_t cmd_config_e_tag_port_id =
> > + TOKEN_NUM_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + port_id, UINT8);
> > +cmdline_parse_token_string_t cmd_config_e_tag_vf =
> > + TOKEN_STRING_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + vf, "vf");
> > +cmdline_parse_token_num_t cmd_config_e_tag_vf_id =
> > + TOKEN_NUM_INITIALIZER
> > + (struct cmd_config_e_tag_result,
> > + vf_id, UINT8);
> > +
> > +/* E-tag insertion configuration */
> > +static void
> > +cmd_config_e_tag_insertion_en_parsed(
> > + void *parsed_result,
> > + __attribute__((unused)) struct cmdline *cl,
> > + __attribute__((unused)) void *data)
> > +{
> > + struct cmd_config_e_tag_result *res =
> > + parsed_result;
> > + struct rte_eth_l2_tunnel entry;
> > +
> > + if (port_id_is_invalid(res->port_id, ENABLED_WARN))
> > + return;
> > +
> > + entry.l2_tunnel_type = RTE_L2_TUNNEL_TYPE_E_TAG;
> > + entry.tunnel_id = res->port_tag_id_val;
> > + rte_eth_dev_l2_tunnel_insertion_enable(res->port_id,
> > + &entry,
> > + res->vf_id);
>
> several space in above 2 lines, better to replace to Tab
O, I'll change it. Thanks.
>
> > +}
> > +
> > +static void
> > +cmd_config_e_tag_insertion_dis_parsed(
> > + void *parsed_result,
> > + __attribute__((unused)) struct cmdline *cl,
> > + __attribute__((unused)) void *data)
> > +{
> > + struct cmd_config_e_tag_result *res =
> > + parsed_result;
> > +
> > + if (port_id_is_invalid(res->port_id, ENABLED_WARN))
> > + return;
> > +
> > + rte_eth_dev_l2_tunnel_insertion_disable(res->port_id,
> > +
> > RTE_L2_TUNNEL_TYPE_E_TAG,
> > + res->vf_id);
> > +}
> > +
> > +cmdline_parse_inst_t cmd_config_e_tag_insertion_en = {
> > + .f = cmd_config_e_tag_insertion_en_parsed,
> > + .data = NULL,
> > + .help_str = "E-tag insertion enable",
> > + .tokens = {
> > + (void *)&cmd_config_e_tag_e_tag,
> > + (void *)&cmd_config_e_tag_set,
> > + (void *)&cmd_config_e_tag_insertion,
> > + (void *)&cmd_config_e_tag_on,
> > + (void *)&cmd_config_e_tag_port_tag_id,
> > + (void *)&cmd_config_e_tag_port_tag_id_val,
> > + (void *)&cmd_config_e_tag_port,
> > + (void *)&cmd_config_e_tag_port_id,
> > + (void *)&cmd_config_e_tag_vf,
> > + (void *)&cmd_config_e_tag_vf_id,
> > + NULL,
> > + },
> > +};
> > +
> > +cmdline_parse_inst_t cmd_config_e_tag_insertion_dis = {
> > + .f = cmd_config_e_tag_insertion_dis_parsed,
> > + .data = NULL,
> > + .help_str = "E-tag insertion disable",
> > + .tokens = {
> > + (void *)&cmd_config_e_tag_e_tag,
> > + (void *)&cmd_config_e_tag_set,
> > + (void *)&cmd_config_e_tag_insertion,
> > + (void *)&cmd_config_e_tag_off,
> > + (void *)&cmd_config_e_tag_port,
> > + (void *)&cmd_config_e_tag_port_id,
> > + (void *)&cmd_config_e_tag_vf,
> > + (void *)&cmd_config_e_tag_vf_id,
> > + NULL,
> > + },
> > +};
> > +
> > +/* E-tag stripping configuration */
> > +static void
> > +cmd_config_e_tag_stripping_parsed(
> > + void *parsed_result,
> > + __attribute__((unused)) struct cmdline *cl,
> > + __attribute__((unused)) void *data)
> > +{
> > + struct cmd_config_e_tag_result *res =
> > + parsed_result;
> > +
> > + if (port_id_is_invalid(res->port_id, ENABLED_WARN))
> > + return;
> > +
> > + if (!strcmp(res->on_off, "on"))
> > + rte_eth_dev_l2_tunnel_stripping_enable
> > + (res->port_id,
> > + RTE_L2_TUNNEL_TYPE_E_TAG);
> > + else
> > + rte_eth_dev_l2_tunnel_stripping_disable
> > + (res->port_id,
> > + RTE_L2_TUNNEL_TYPE_E_TAG);
> > +}
> > +
> > +cmdline_parse_inst_t cmd_config_e_tag_stripping_en_dis = {
> > + .f = cmd_config_e_tag_stripping_parsed,
> > + .data = NULL,
> > + .help_str = "E-tag stripping enable/disable",
> > + .tokens = {
> > + (void *)&cmd_config_e_tag_e_tag,
> > + (void *)&cmd_config_e_tag_set,
> > + (void *)&cmd_config_e_tag_stripping,
> > + (void *)&cmd_config_e_tag_on_off,
> > + (void *)&cmd_config_e_tag_port,
> > + (void *)&cmd_config_e_tag_port_id,
> > + NULL,
> > + },
> > +};
> > +
> > +/* E-tag forwarding configuration */
> > +static void
> > +cmd_config_e_tag_forwarding_parsed(
> > + void *parsed_result,
> > + __attribute__((unused)) struct cmdline *cl,
> > + __attribute__((unused)) void *data)
> > +{
> > + struct cmd_config_e_tag_result *res =
> > + parsed_result;
> > +
> > + if (port_id_is_invalid(res->port_id, ENABLED_WARN))
> > + return;
> > +
> > + if (!strcmp(res->on_off, "on"))
> > + rte_eth_dev_l2_tunnel_forwarding_enable
> > + (res->port_id,
> > + RTE_L2_TUNNEL_TYPE_E_TAG);
> > + else
> > + rte_eth_dev_l2_tunnel_forwarding_disable
> > + (res->port_id,
> > + RTE_L2_TUNNEL_TYPE_E_TAG);
> > +}
> > +
> > +cmdline_parse_inst_t cmd_config_e_tag_forwarding_en_dis = {
> > + .f = cmd_config_e_tag_forwarding_parsed,
> > + .data = NULL,
> > + .help_str = "E-tag forwarding enable/disable",
> > + .tokens = {
> > + (void *)&cmd_config_e_tag_e_tag,
> > + (void *)&cmd_config_e_tag_set,
> > + (void *)&cmd_config_e_tag_forwarding,
> > + (void *)&cmd_config_e_tag_on_off,
> > + (void *)&cmd_config_e_tag_port,
> > + (void *)&cmd_config_e_tag_port_id,
> > + NULL,
> > + },
> > +};
> > +
> > +/* E-tag filter configuration */
> > +static void
> > +cmd_config_e_tag_filter_add_parsed(
> > + void *parsed_result,
> > + __attribute__((unused)) struct cmdline *cl,
> > + __attribute__((unused)) void *data)
> > +{
> > + struct cmd_config_e_tag_result *res =
> > + parsed_result;
> > + struct rte_eth_l2_tunnel entry;
> > +
> > + if (port_id_is_invalid(res->port_id, ENABLED_WARN))
> > + return;
> > +
> > + if (res->e_tag_id_val > 0x3fff) {
> > + printf("e-tag-id must be less than 0x3fff.\n");
>
> How about e-tag-id == 0x3fff? Error message seems to not allow, but the
> program actually does.
O, the print is not accurate. Will correct it, thanks.
>
> > + return;
> > + }
> > +
> > + entry.l2_tunnel_type = RTE_L2_TUNNEL_TYPE_E_TAG;
> > + entry.tunnel_id = res->e_tag_id_val;
> > +
> > + rte_eth_dev_l2_tunnel_filter_add(res->port_id,
> > + &entry,
> > + res->dst_pool_val);
> > +}
> > +
> > +cmdline_parse_inst_t cmd_config_e_tag_filter_add = {
> > + .f = cmd_config_e_tag_filter_add_parsed,
> > + .data = NULL,
> > + .help_str = "E-tag filter add",
> > + .tokens = {
> > + (void *)&cmd_config_e_tag_e_tag,
> > + (void *)&cmd_config_e_tag_set,
> > + (void *)&cmd_config_e_tag_filter,
> > + (void *)&cmd_config_e_tag_add,
> > + (void *)&cmd_config_e_tag_e_tag_id,
> > + (void *)&cmd_config_e_tag_e_tag_id_val,
> > + (void *)&cmd_config_e_tag_dst_pool,
> > + (void *)&cmd_config_e_tag_dst_pool_val,
> > + (void *)&cmd_config_e_tag_port,
> > + (void *)&cmd_config_e_tag_port_id,
> > + NULL,
> > + },
> > +};
> > +
> > +static void
> > +cmd_config_e_tag_filter_del_parsed(
> > + void *parsed_result,
> > + __attribute__((unused)) struct cmdline *cl,
> > + __attribute__((unused)) void *data)
> > +{
> > + struct cmd_config_e_tag_result *res =
> > + parsed_result;
> > + struct rte_eth_l2_tunnel entry;
> > +
> > + if (port_id_is_invalid(res->port_id, ENABLED_WARN))
> > + return;
> > +
> > + if (res->e_tag_id_val > 0x3fff) {
> > + printf("e-tag-id must be less than 0x3fff.\n");
> > + return;
> > + }
> > +
> > + entry.l2_tunnel_type = RTE_L2_TUNNEL_TYPE_E_TAG;
> > + entry.tunnel_id = res->e_tag_id_val;
> > +
> > + rte_eth_dev_l2_tunnel_filter_del(res->port_id,
> > + &entry);
> > +}
> > +
> > +cmdline_parse_inst_t cmd_config_e_tag_filter_del = {
> > + .f = cmd_config_e_tag_filter_del_parsed,
> > + .data = NULL,
> > + .help_str = "E-tag filter delete",
> > + .tokens = {
> > + (void *)&cmd_config_e_tag_e_tag,
> > + (void *)&cmd_config_e_tag_set,
> > + (void *)&cmd_config_e_tag_filter,
> > + (void *)&cmd_config_e_tag_del,
> > + (void *)&cmd_config_e_tag_e_tag_id,
> > + (void *)&cmd_config_e_tag_e_tag_id_val,
> > + (void *)&cmd_config_e_tag_port,
> > + (void *)&cmd_config_e_tag_port_id,
> > + NULL,
> > + },
> > +};
> > +
> > /*
> > **********************************************************
> > ********************** */
> >
> > /* list of instructions */
> > @@ -10040,6 +10412,12 @@ cmdline_parse_ctx_t main_ctx[] = {
> > (cmdline_parse_inst_t *)&cmd_config_l2_tunnel_eth_type_specific,
> > (cmdline_parse_inst_t *)&cmd_config_l2_tunnel_en_dis_all,
> > (cmdline_parse_inst_t *)&cmd_config_l2_tunnel_en_dis_specific,
> > + (cmdline_parse_inst_t *)&cmd_config_e_tag_insertion_en,
> > + (cmdline_parse_inst_t *)&cmd_config_e_tag_insertion_dis,
> > + (cmdline_parse_inst_t *)&cmd_config_e_tag_stripping_en_dis,
> > + (cmdline_parse_inst_t *)&cmd_config_e_tag_forwarding_en_dis,
> > + (cmdline_parse_inst_t *)&cmd_config_e_tag_filter_add,
> > + (cmdline_parse_inst_t *)&cmd_config_e_tag_filter_del,
> > NULL,
> > };
> >
> > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > index 5471ebe..e116d98 100644
> > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > @@ -917,6 +917,32 @@ Set link down for a port::
> >
> > testpmd> set link-down port (port id)
> >
> > +E-tag set
> > +~~~~~~~~~
> > +
> > +Enable E-tag insertion for a VF on a port::
> > +
> > + testpmd> E-tag set insertion on port-tag-id (value) port (port_id)
> > + vf (vf_id)
> > +
> > +Disable E-tag insertion for a VF on a port::
> > +
> > + testpmd> E-tag set insertion off port (port_id) vf (vf_id)
> > +
> > +Enable/disable E-tag stripping on a port::
> > +
> > + testpmd> E-tag set stripping (on|off) port (port_id)
> > +
> > +Enable/disable E-tag based forwarding on a port::
> > +
> > + testpmd> E-tag set forwarding (on|off) port (port_id)
> > +
> > +Add an E-tag forwarding filter on a port::
> > +
> > + testpmd> E-tag set filter add e-tag-id (value) dst-pool (pool_id)
> > + port
> > (port_id)
> > +
> > +Delete an E-tag forwarding filter on a port::
> > + testpmd> E-tag set filter del e-tag-id (value) port (port_id)
> > +
> >
> > Port Functions
> > --------------
> > --
> > 1.9.3
@@ -502,6 +502,27 @@ static void cmd_help_long_parsed(void *parsed_result,
"set link-down port (port_id)\n"
" Set link down for a port.\n\n"
+ "E-tag set insertion on port-tag-id (value)"
+ " port (port_id) vf (vf_id)\n"
+ " Enable E-tag insertion for a VF on a port\n\n"
+
+ "E-tag set insertion off port (port_id) vf (vf_id)\n"
+ " Disable E-tag insertion for a VF on a port\n\n"
+
+ "E-tag set stripping (on|off) port (port_id)\n"
+ " Enable/disable E-tag stripping on a port\n\n"
+
+ "E-tag set forwarding (on|off) port (port_id)\n"
+ " Enable/disable E-tag based forwarding"
+ " on a port\n\n"
+
+ "E-tag set filter add e-tag-id (value) dst-pool"
+ " (pool_id) port (port_id)\n"
+ " Add an E-tag forwarding filter on a port\n\n"
+
+ "E-tag set filter del e-tag-id (value) port (port_id)\n"
+ " Delete an E-tag forwarding filter on a port\n\n"
+
, list_pkt_forwarding_modes()
);
}
@@ -9895,6 +9916,357 @@ cmdline_parse_inst_t cmd_config_l2_tunnel_en_dis_specific = {
},
};
+/* E-tag configuration */
+
+/* Common result structure for all E-tag configuration */
+struct cmd_config_e_tag_result {
+ cmdline_fixed_string_t e_tag;
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t insertion;
+ cmdline_fixed_string_t stripping;
+ cmdline_fixed_string_t forwarding;
+ cmdline_fixed_string_t filter;
+ cmdline_fixed_string_t add;
+ cmdline_fixed_string_t del;
+ cmdline_fixed_string_t on;
+ cmdline_fixed_string_t off;
+ cmdline_fixed_string_t on_off;
+ cmdline_fixed_string_t port_tag_id;
+ uint32_t port_tag_id_val;
+ cmdline_fixed_string_t e_tag_id;
+ uint16_t e_tag_id_val;
+ cmdline_fixed_string_t dst_pool;
+ uint8_t dst_pool_val;
+ cmdline_fixed_string_t port;
+ uint8_t port_id;
+ cmdline_fixed_string_t vf;
+ uint8_t vf_id;
+};
+
+/* Common CLI fields for all E-tag configuration */
+cmdline_parse_token_string_t cmd_config_e_tag_e_tag =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ e_tag, "E-tag");
+cmdline_parse_token_string_t cmd_config_e_tag_set =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ set, "set");
+cmdline_parse_token_string_t cmd_config_e_tag_insertion =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ insertion, "insertion");
+cmdline_parse_token_string_t cmd_config_e_tag_stripping =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ stripping, "stripping");
+cmdline_parse_token_string_t cmd_config_e_tag_forwarding =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ forwarding, "forwarding");
+cmdline_parse_token_string_t cmd_config_e_tag_filter =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ filter, "filter");
+cmdline_parse_token_string_t cmd_config_e_tag_add =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ add, "add");
+cmdline_parse_token_string_t cmd_config_e_tag_del =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ del, "del");
+cmdline_parse_token_string_t cmd_config_e_tag_on =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ on, "on");
+cmdline_parse_token_string_t cmd_config_e_tag_off =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ off, "off");
+cmdline_parse_token_string_t cmd_config_e_tag_on_off =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ on_off, "on#off");
+cmdline_parse_token_string_t cmd_config_e_tag_port_tag_id =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ port_tag_id, "port-tag-id");
+cmdline_parse_token_num_t cmd_config_e_tag_port_tag_id_val =
+ TOKEN_NUM_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ port_tag_id_val, UINT32);
+cmdline_parse_token_string_t cmd_config_e_tag_e_tag_id =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ e_tag_id, "e-tag-id");
+cmdline_parse_token_num_t cmd_config_e_tag_e_tag_id_val =
+ TOKEN_NUM_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ e_tag_id_val, UINT16);
+cmdline_parse_token_string_t cmd_config_e_tag_dst_pool =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ dst_pool, "dst-pool");
+cmdline_parse_token_num_t cmd_config_e_tag_dst_pool_val =
+ TOKEN_NUM_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ dst_pool_val, UINT8);
+cmdline_parse_token_string_t cmd_config_e_tag_port =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ port, "port");
+cmdline_parse_token_num_t cmd_config_e_tag_port_id =
+ TOKEN_NUM_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ port_id, UINT8);
+cmdline_parse_token_string_t cmd_config_e_tag_vf =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ vf, "vf");
+cmdline_parse_token_num_t cmd_config_e_tag_vf_id =
+ TOKEN_NUM_INITIALIZER
+ (struct cmd_config_e_tag_result,
+ vf_id, UINT8);
+
+/* E-tag insertion configuration */
+static void
+cmd_config_e_tag_insertion_en_parsed(
+ void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_config_e_tag_result *res =
+ parsed_result;
+ struct rte_eth_l2_tunnel entry;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ entry.l2_tunnel_type = RTE_L2_TUNNEL_TYPE_E_TAG;
+ entry.tunnel_id = res->port_tag_id_val;
+ rte_eth_dev_l2_tunnel_insertion_enable(res->port_id,
+ &entry,
+ res->vf_id);
+}
+
+static void
+cmd_config_e_tag_insertion_dis_parsed(
+ void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_config_e_tag_result *res =
+ parsed_result;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ rte_eth_dev_l2_tunnel_insertion_disable(res->port_id,
+ RTE_L2_TUNNEL_TYPE_E_TAG,
+ res->vf_id);
+}
+
+cmdline_parse_inst_t cmd_config_e_tag_insertion_en = {
+ .f = cmd_config_e_tag_insertion_en_parsed,
+ .data = NULL,
+ .help_str = "E-tag insertion enable",
+ .tokens = {
+ (void *)&cmd_config_e_tag_e_tag,
+ (void *)&cmd_config_e_tag_set,
+ (void *)&cmd_config_e_tag_insertion,
+ (void *)&cmd_config_e_tag_on,
+ (void *)&cmd_config_e_tag_port_tag_id,
+ (void *)&cmd_config_e_tag_port_tag_id_val,
+ (void *)&cmd_config_e_tag_port,
+ (void *)&cmd_config_e_tag_port_id,
+ (void *)&cmd_config_e_tag_vf,
+ (void *)&cmd_config_e_tag_vf_id,
+ NULL,
+ },
+};
+
+cmdline_parse_inst_t cmd_config_e_tag_insertion_dis = {
+ .f = cmd_config_e_tag_insertion_dis_parsed,
+ .data = NULL,
+ .help_str = "E-tag insertion disable",
+ .tokens = {
+ (void *)&cmd_config_e_tag_e_tag,
+ (void *)&cmd_config_e_tag_set,
+ (void *)&cmd_config_e_tag_insertion,
+ (void *)&cmd_config_e_tag_off,
+ (void *)&cmd_config_e_tag_port,
+ (void *)&cmd_config_e_tag_port_id,
+ (void *)&cmd_config_e_tag_vf,
+ (void *)&cmd_config_e_tag_vf_id,
+ NULL,
+ },
+};
+
+/* E-tag stripping configuration */
+static void
+cmd_config_e_tag_stripping_parsed(
+ void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_config_e_tag_result *res =
+ parsed_result;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ if (!strcmp(res->on_off, "on"))
+ rte_eth_dev_l2_tunnel_stripping_enable
+ (res->port_id,
+ RTE_L2_TUNNEL_TYPE_E_TAG);
+ else
+ rte_eth_dev_l2_tunnel_stripping_disable
+ (res->port_id,
+ RTE_L2_TUNNEL_TYPE_E_TAG);
+}
+
+cmdline_parse_inst_t cmd_config_e_tag_stripping_en_dis = {
+ .f = cmd_config_e_tag_stripping_parsed,
+ .data = NULL,
+ .help_str = "E-tag stripping enable/disable",
+ .tokens = {
+ (void *)&cmd_config_e_tag_e_tag,
+ (void *)&cmd_config_e_tag_set,
+ (void *)&cmd_config_e_tag_stripping,
+ (void *)&cmd_config_e_tag_on_off,
+ (void *)&cmd_config_e_tag_port,
+ (void *)&cmd_config_e_tag_port_id,
+ NULL,
+ },
+};
+
+/* E-tag forwarding configuration */
+static void
+cmd_config_e_tag_forwarding_parsed(
+ void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_config_e_tag_result *res =
+ parsed_result;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ if (!strcmp(res->on_off, "on"))
+ rte_eth_dev_l2_tunnel_forwarding_enable
+ (res->port_id,
+ RTE_L2_TUNNEL_TYPE_E_TAG);
+ else
+ rte_eth_dev_l2_tunnel_forwarding_disable
+ (res->port_id,
+ RTE_L2_TUNNEL_TYPE_E_TAG);
+}
+
+cmdline_parse_inst_t cmd_config_e_tag_forwarding_en_dis = {
+ .f = cmd_config_e_tag_forwarding_parsed,
+ .data = NULL,
+ .help_str = "E-tag forwarding enable/disable",
+ .tokens = {
+ (void *)&cmd_config_e_tag_e_tag,
+ (void *)&cmd_config_e_tag_set,
+ (void *)&cmd_config_e_tag_forwarding,
+ (void *)&cmd_config_e_tag_on_off,
+ (void *)&cmd_config_e_tag_port,
+ (void *)&cmd_config_e_tag_port_id,
+ NULL,
+ },
+};
+
+/* E-tag filter configuration */
+static void
+cmd_config_e_tag_filter_add_parsed(
+ void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_config_e_tag_result *res =
+ parsed_result;
+ struct rte_eth_l2_tunnel entry;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ if (res->e_tag_id_val > 0x3fff) {
+ printf("e-tag-id must be less than 0x3fff.\n");
+ return;
+ }
+
+ entry.l2_tunnel_type = RTE_L2_TUNNEL_TYPE_E_TAG;
+ entry.tunnel_id = res->e_tag_id_val;
+
+ rte_eth_dev_l2_tunnel_filter_add(res->port_id,
+ &entry,
+ res->dst_pool_val);
+}
+
+cmdline_parse_inst_t cmd_config_e_tag_filter_add = {
+ .f = cmd_config_e_tag_filter_add_parsed,
+ .data = NULL,
+ .help_str = "E-tag filter add",
+ .tokens = {
+ (void *)&cmd_config_e_tag_e_tag,
+ (void *)&cmd_config_e_tag_set,
+ (void *)&cmd_config_e_tag_filter,
+ (void *)&cmd_config_e_tag_add,
+ (void *)&cmd_config_e_tag_e_tag_id,
+ (void *)&cmd_config_e_tag_e_tag_id_val,
+ (void *)&cmd_config_e_tag_dst_pool,
+ (void *)&cmd_config_e_tag_dst_pool_val,
+ (void *)&cmd_config_e_tag_port,
+ (void *)&cmd_config_e_tag_port_id,
+ NULL,
+ },
+};
+
+static void
+cmd_config_e_tag_filter_del_parsed(
+ void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_config_e_tag_result *res =
+ parsed_result;
+ struct rte_eth_l2_tunnel entry;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ if (res->e_tag_id_val > 0x3fff) {
+ printf("e-tag-id must be less than 0x3fff.\n");
+ return;
+ }
+
+ entry.l2_tunnel_type = RTE_L2_TUNNEL_TYPE_E_TAG;
+ entry.tunnel_id = res->e_tag_id_val;
+
+ rte_eth_dev_l2_tunnel_filter_del(res->port_id,
+ &entry);
+}
+
+cmdline_parse_inst_t cmd_config_e_tag_filter_del = {
+ .f = cmd_config_e_tag_filter_del_parsed,
+ .data = NULL,
+ .help_str = "E-tag filter delete",
+ .tokens = {
+ (void *)&cmd_config_e_tag_e_tag,
+ (void *)&cmd_config_e_tag_set,
+ (void *)&cmd_config_e_tag_filter,
+ (void *)&cmd_config_e_tag_del,
+ (void *)&cmd_config_e_tag_e_tag_id,
+ (void *)&cmd_config_e_tag_e_tag_id_val,
+ (void *)&cmd_config_e_tag_port,
+ (void *)&cmd_config_e_tag_port_id,
+ NULL,
+ },
+};
+
/* ******************************************************************************** */
/* list of instructions */
@@ -10040,6 +10412,12 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_config_l2_tunnel_eth_type_specific,
(cmdline_parse_inst_t *)&cmd_config_l2_tunnel_en_dis_all,
(cmdline_parse_inst_t *)&cmd_config_l2_tunnel_en_dis_specific,
+ (cmdline_parse_inst_t *)&cmd_config_e_tag_insertion_en,
+ (cmdline_parse_inst_t *)&cmd_config_e_tag_insertion_dis,
+ (cmdline_parse_inst_t *)&cmd_config_e_tag_stripping_en_dis,
+ (cmdline_parse_inst_t *)&cmd_config_e_tag_forwarding_en_dis,
+ (cmdline_parse_inst_t *)&cmd_config_e_tag_filter_add,
+ (cmdline_parse_inst_t *)&cmd_config_e_tag_filter_del,
NULL,
};
@@ -917,6 +917,32 @@ Set link down for a port::
testpmd> set link-down port (port id)
+E-tag set
+~~~~~~~~~
+
+Enable E-tag insertion for a VF on a port::
+
+ testpmd> E-tag set insertion on port-tag-id (value) port (port_id) vf (vf_id)
+
+Disable E-tag insertion for a VF on a port::
+
+ testpmd> E-tag set insertion off port (port_id) vf (vf_id)
+
+Enable/disable E-tag stripping on a port::
+
+ testpmd> E-tag set stripping (on|off) port (port_id)
+
+Enable/disable E-tag based forwarding on a port::
+
+ testpmd> E-tag set forwarding (on|off) port (port_id)
+
+Add an E-tag forwarding filter on a port::
+
+ testpmd> E-tag set filter add e-tag-id (value) dst-pool (pool_id) port (port_id)
+
+Delete an E-tag forwarding filter on a port::
+ testpmd> E-tag set filter del e-tag-id (value) port (port_id)
+
Port Functions
--------------