app/testpmd: Moved cmdline_flow to librte_cmdline
PATCH 1/3 app/testpmd: Moved cmdline_flow to librte_cmdline
--- app/test-pmd/Makefile | 1 - app/test-pmd/cmdline_flow.c | 2959 ------------------------------------- app/test-pmd/config.c | 541 +------ app/test-pmd/testpmd.h | 91 +- lib/Makefile | 4 +- lib/librte_cmdline/Makefile | 3 +- lib/librte_cmdline/cmdline.h | 2 +- lib/librte_cmdline/cmdline_flow.c | 1790 ++++++++++++++++++++++ lib/librte_cmdline/cmdline_flow.h | 1852 +++++++++++++++++++++++ lib/librte_ether/rte_flow.c | 18 +- lib/librte_ether/rte_flow.h | 24 + 11 files changed, 3675 insertions(+), 3610 deletions(-) delete mode 100644 app/test-pmd/cmdline_flow.c create mode 100644 lib/librte_cmdline/cmdline_flow.c create mode 100644 lib/librte_cmdline/cmdline_flow.h
app/test-pmd/Makefile +0 -1
@@ -19,7 +19,6 @@ CFLAGS += $(WERROR_FLAGS) SRCS-y := testpmd.c SRCS-y += parameters.c SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline.c -SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_flow.c SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_mtr.c SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_tm.c SRCS-y += config.c
app/test-pmd/cmdline_flow.c deleted +0 -2959
2,959 lines not on this page · raw message
app/test-pmd/config.c +1 -540
34 lines not on this page · raw message
app/test-pmd/testpmd.h +1 -90
91 lines not on this page · raw message
lib/librte_cmdline/cmdline_flow.c new file +1790 -0
1,790 lines not on this page · raw message
lib/librte_cmdline/cmdline_flow.h new file +1852 -0
1,852 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.7.4
Part of the diff is not shown here. View the raw message.
PATCH 2/3 app/testpmd: Added new line and parenthesized macros
--- lib/librte_cmdline/cmdline_flow.h | 2 +- lib/librte_ether/rte_flow.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
lib/librte_cmdline/cmdline_flow.h +1 -1
@@ -1849,4 +1849,4 @@ static const struct token token_list[] = { }#endif -#endif /* _CMDLINE_FLOW_H_ */ +#endif /* _CMDLINE_FLOW_H_ */
lib/librte_ether/rte_flow.h +2 -2
@@ -854,7 +854,7 @@ struct rte_flow_item {/** Generate flow_item[] entry. */ #define MK_FLOW_ITEM (t, s) \ - [RTE_FLOW_ITEM_TYPE_ ## t] = { \ + [(RTE_FLOW_ITEM_TYPE_ ## t)] = { \ .name = # t, \ .size = s, \ }
@@ -1167,7 +1167,7 @@ struct rte_flow_action {/** Generate flow_action[] entry. */ #define MK_FLOW_ACTION (t, s) \ - [RTE_FLOW_ACTION_TYPE_ ## t] = { \ + [(RTE_FLOW_ACTION_TYPE_ ## t)] = { \ .name = # t, \ .size = s, \ }
Signature · 1 line
2.7.4
PATCH 3/3 lib/cmdline: Cross platform fixes for cmdline_flow
In reply to Georgios Katsikas--- app/test-pmd/Makefile | 2 + app/test-pmd/cmdline.c | 4 + app/test-pmd/testpmd.h | 14 - lib/librte_cmdline/Makefile | 3 + lib/librte_cmdline/cmdline_flow.c | 555 ++++++-------------------------- lib/librte_cmdline/cmdline_flow.h | 653 +++++++++++++++++++++++++++++++------- lib/librte_ether/rte_flow.c | 4 +- lib/librte_ether/rte_flow.h | 10 - 8 files changed, 640 insertions(+), 605 deletions(-)
app/test-pmd/Makefile +2 -0
@@ -38,6 +38,8 @@ endif ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +LDLIBS += -lrte_cmdline + ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y) LDLIBS += -lrte_pmd_bond endif
app/test-pmd/cmdline.c +4 -0
@@ -10921,7 +10921,11 @@ cmdline_parse_inst_t cmd_set_flow_director_flex_payload = { };/* Generic flow interface command. */ +#ifdef RTE_BUILD_SHARED_LIB +cmdline_parse_inst_t cmd_flow; +#else extern cmdline_parse_inst_t cmd_flow; +#endif /* *** Classification Filters Control *** */ /* *** Get symmetric hash enable per port *** */
app/test-pmd/testpmd.h +0 -14
@@ -498,20 +498,6 @@ void port_reg_bit_field_set(portid_t port_id, uint32_t reg_off, uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value);void port_reg_display (portid_t port_id,uint32_t reg_off);void port_reg_set (portid_t port_id,uint32_t reg_off,uint32_t value); -int port_flow_validate (portid_t port_id, -const struct rte_flow_attr *attr, -const struct rte_flow_item *pattern, -const struct rte_flow_action *actions); -int port_flow_create (portid_t port_id, -const struct rte_flow_attr *attr, -const struct rte_flow_item *pattern, -const struct rte_flow_action *actions); -int port_flow_destroy (portid_t port_id,uint32_t n,const uint32_t *rule); -int port_flow_flush (portid_t port_id); -int port_flow_query (portid_t port_id,uint32_t rule, -enum rte_flow_action_type action); -void port_flow_list (portid_t port_id,uint32_t n,const uint32_t *group); -int port_flow_isolate (portid_t port_id,int set);void rx_ring_desc_display (portid_t port_id,queueid_t rxq_id,uint16_t rxd_id);void tx_ring_desc_display (portid_t port_id,queueid_t txq_id,uint16_t txd_id);
lib/librte_cmdline/Makefile +3 -0
@@ -28,6 +28,9 @@ SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_parse_portlist.c CFLAGS += -D_GNU_SOURCE LDLIBS += -lrte_eal +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +LDLIBS += -lrte_ethdev +endif # install includes INCS := cmdline.h cmdline_parse.h cmdline_parse_num.h cmdline_parse_ipaddr.h
lib/librte_cmdline/cmdline_flow.c +95 -460
795 lines not on this page · raw message
lib/librte_cmdline/cmdline_flow.h +534 -119
1,178 lines not on this page · raw message
lib/librte_ether/rte_flow.c +2 -2
@@ -249,7 +249,7 @@ rte_flow_error_set(struct rte_flow_error *error, }/** Compute storage space needed by item specification. */ -void +static void flow_item_spec_size (const struct rte_flow_item *item,size_t *size,size_t *pad) {
@@ -277,7 +277,7 @@ flow_item_spec_size(const struct rte_flow_item *item, }/** Compute storage space needed by action configuration. */ -void +static void flow_action_conf_size (const struct rte_flow_action *action,size_t *size,size_t *pad) {
lib/librte_ether/rte_flow.h +0 -10
@@ -1180,16 +1180,6 @@ struct rte_flow_action {*/ struct rte_flow ; -/** Compute storage space needed by item specification. */ -void -flow_item_spec_size (const struct rte_flow_item *item, -size_t *size,size_t *pad); - -/** Compute storage space needed by action configuration. */ -void -flow_action_conf_size (const struct rte_flow_action *action, -size_t *size,size_t *pad); -/** * Verbose error types. *
Signature · 1 line
2.7.4
Hi,
Quoted 9 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Georgios Katsikas
Sent: Saturday, January 13, 2018 5:01 AM
To: [email protected]
Cc: [email protected]; Georgios Katsikas <[email protected]>
Subject: [dpdk-dev] [PATCH 1/3] app/testpmd: Movedcmdline_flowtolibrte_cmdlineSigned-off-by Georgios Katsikas <[email protected]>
Looks like a good idea to move this code to the lib. cc Adrien the author of this file, app/test-pmd/cmdline_flow.c.
Hi Georgios,
Quoted 10 lines · Wenzhuo
Hi,
Quoted 8 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Georgios Katsikas
Sent: Saturday, January 13, 2018 5:01 AM
To: [email protected]
Cc: [email protected]; Georgios Katsikas <[email protected]>
Subject: [dpdk-dev] [PATCH 1/3] app/testpmd: Movedcmdline_flowtolibrte_cmdline
Quoted 3 lines
Quoted 1 line
Signed-off-by Georgios Katsikas <[email protected]>Looks like a good idea to move this code to the lib. cc Adrien the author of this file,
app/test-pmd/cmdline_flow.c.
If the command line parsing of rte_flow is something that has some chances to be shared among multiple applications, I agree it makes sense to move it in a library.
However, my opinion is that it would be better to have a specific library for it, like librte_flow_cmdline, because I'm not sure that people linking with librte_cmdline always want to pull the rte_flow parsing code.
Hi Lu, Oliver,
Thanks for your feedback!
You have a point here, flow commands are only a subset of the parser. Do you want me to create this new library and send another patch? I guess I have to use librte_cmdline as a template/example for creating the librte_flow_cmdline library.
Best regards,
Georgios
Quoted 27 lines · Olivier Matz
Hi Georgios,
Quoted 10 lines · Wenzhuo
Hi,
Quoted 8 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Georgios Katsikas
Sent: Saturday, January 13, 2018 5:01 AM
To: [email protected]
Cc: [email protected]; Georgios Katsikas <[email protected]>
Subject: [dpdk-dev] [PATCH 1/3] app/testpmd: Movedcmdline_flowtolibrte_cmdlineQuoted 3 lines
Quoted 1 line
Signed-off-by Georgios Katsikas <[email protected]>Looks like a good idea to move this code to the lib. cc Adrien the author of this file,
app/test-pmd/cmdline_flow.c.If the command line parsing of
rte_flowis something that has some chances to be shared among multiple applications, I agree it makes sense to move it in a library.However, my opinion is that it would be better to have a specific library for it, like
librte_flow_cmdline, because I'm not sure that people linking withlibrte_cmdlinealways want to pull therte_flowparsing code.
Hi,
Quoted 30 lines · Olivier Matz
Quoted 17 lines · On Tue, Jan 16, 2018 at 08:45:32AM +0000, [email protected] wrote:
Hi Georgios,
Quoted 10 lines · Wenzhuo
Hi,
Quoted 8 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Georgios Katsikas
Sent: Saturday, January 13, 2018 5:01 AM
To: [email protected]
Cc: [email protected]; Georgios Katsikas <[email protected]>
Subject: [dpdk-dev] [PATCH 1/3] app/testpmd: Movedcmdline_flowtolibrte_cmdlineQuoted 3 lines
Quoted 1 line
Signed-off-by Georgios Katsikas <[email protected]>Looks like a good idea to move this code to the lib. cc Adrien the author of this file,
app/test-pmd/cmdline_flow.c.Quoted 10 lines
If the command line parsing of
rte_flowis something that has some chances to be shared among multiple applications, I agree it makes sense to move it in a library.However, my opinion is that it would be better to have a specific library for it, like
librte_flow_cmdline, because I'm not sure that people linking withlibrte_cmdlinealways want to pull therte_flowparsing code.
Quoted 5 lines
Hi Lu, Oliver,
Thanks for your feedback!
You have a point here, flow commands are only a subset of the parser. Do you want me to create this new library and send another patch?
Let's first wait for Adrien's feedback, he can have counter-arguments.
Quoted 2 lines
I guess I have to use
librte_cmdlineas a template/example for creating thelibrte_flow_cmdlinelibrary.
It can be used as an example for Makefile and .map file.
Hi Olivier, George, thanks for following up on that,
Quoted 31 lines · Olivier Matz
Hi,
Quoted 29 lines · Olivier Matz
Quoted 26 lines · On Tue, Jan 16, 2018 at 08:45:32AM +0000, [email protected] wrote:
Hi Georgios,
Quoted 10 lines · Wenzhuo
Hi,
Quoted 8 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Georgios Katsikas
Sent: Saturday, January 13, 2018 5:01 AM
To: [email protected]
Cc: [email protected]; Georgios Katsikas <[email protected]>
Subject: [dpdk-dev] [PATCH 1/3] app/testpmd: Movedcmdline_flowtolibrte_cmdlineQuoted 3 lines
Quoted 1 line
Signed-off-by Georgios Katsikas <[email protected]>Looks like a good idea to move this code to the lib. cc Adrien the author of this file,
app/test-pmd/cmdline_flow.c.If the command line parsing of
rte_flowis something that has some chances to be shared among multiple applications, I agree it makes sense to move it in a library.However, my opinion is that it would be better to have a specific library for it, like
librte_flow_cmdline, because I'm not sure that people linking withlibrte_cmdlinealways want to pull therte_flowparsing code.
Why not a .config option to enable its build, instead of a separate library?
Quoted 13 lines
Quoted 6 lines
Quoted 1 line
Hi Lu, Oliver,
Thanks for your feedback!
You have a point here, flow commands are only a subset of the parser. Do you want me to create this new library and send another patch?Let's first wait for Adrien's feedback, he can have counter-arguments.
Quoted 2 lines
I guess I have to use
librte_cmdlineas a template/example for creating thelibrte_flow_cmdlinelibrary.It can be used as an example for
Makefileand .map file.
Signature · 2 lines
Gaëtan Rivet 6WIND
George,
I missed the original RFC thread [1][2] (you should have used it as a cover letter for this series BTW) please see below.
Quoted 30 lines · Olivier Matz
Hi,
Quoted 28 lines · Olivier Matz
Quoted 25 lines · On Tue, Jan 16, 2018 at 08:45:32AM +0000, [email protected] wrote:
Hi Georgios,
Quoted 10 lines · Wenzhuo
Hi,
Quoted 8 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Georgios Katsikas
Sent: Saturday, January 13, 2018 5:01 AM
To: [email protected]
Cc: [email protected]; Georgios Katsikas <[email protected]>
Subject: [dpdk-dev] [PATCH 1/3] app/testpmd: Movedcmdline_flowtolibrte_cmdlineQuoted 3 lines
Quoted 1 line
Signed-off-by Georgios Katsikas <[email protected]>Looks like a good idea to move this code to the lib. cc Adrien the author of this file,
app/test-pmd/cmdline_flow.c.If the command line parsing of
rte_flowis something that has some chances to be shared among multiple applications, I agree it makes sense to move it in a library.However, my opinion is that it would be better to have a specific library for it, like
librte_flow_cmdline, because I'm not sure that people linking withlibrte_cmdlinealways want to pull therte_flowparsing code.
In my opinion the entire flow command parser has nothing to do outside testpmd, it's way too specific, even if another application finds it useful.
Code duplication being a bad thing, your application could as well compile or even #include app/test-pmd/cmdline_flow.c directly (not pretty, I know) since it would have the same internal layout as testpmd. Testpmd's Makefile could be modified to spit it out as a separate library if needed.
What could make more sense would be to extract the parser engine for librte_cmdline's dynamic tokens (e.g. struct context, struct arg, struct token) and possibly various generic helpers (e.g. parse_string, parse_mac_addr), but not enum index nor token_list[] and friends which define the layout of testpmd's flow command.
This would enable other flow-like commands without duplicating the engine every time, however I'm still not sure if making it available outside testpmd is a good idea. Extracting and making it fully generic will require a considerable amount of work.
Quoted 6 lines
Quoted 5 lines
Hi Lu, Oliver,
Thanks for your feedback!
You have a point here, flow commands are only a subset of the parser. Do you want me to create this new library and send another patch?
Quoted 6 lines
Let's first wait for Adrien's feedback, he can have counter-arguments.
Quoted 2 lines
I guess I have to use
librte_cmdlineas a template/example for creating thelibrte_flow_cmdlinelibrary.It can be used as an example for
Makefileand .map file.
I'm not opposed to the idea of exporting the parser engine after making it properly generic, but please reconsider. Testpmd is an application made to validate PMD functionality. The flow command implementation, as neat as it is, remains a complex wrapper on top of the cmdline_parse API which wasn't originally designed for dynamic tokens. Its syntax may evolve without warning if deemed necessary. Making it public will subject it to exported API/ABI constraints and likely impede future evolution.
Assuming your application is not dragging testpmd's legacy, I think it would be wiser to re-implement a simpler flow command look-alike on top of a more suitable command-line handling library if you like its syntax.
[1] http://dpdk.org/ml/archives/dev/2018-January/086872.html
[2] Message-ID: CAN9HtFDz+imqbCKfs6a0NE0W7iF8C+-KiNB0nCRywimspjfEDg@mail.gmail.com
Signature · 2 lines
Adrien Mazarguil 6WIND
Hi Adrien,
Thanks for your insights and sorry for omitting the cover letter (this is my first patch in DPDK).
I understand your concerns. The reason I proposed this patch is to facilitate a more high level vendor agnostic API for configuring and monitoring DPDK-based NICs.
To avoid just copying thousands of lines of code into my application, do you think it is feasible to move at least the components (struct context, struct arg, struct token and the parse_* helpers) you mentioned and restructure testpmd in a way that allows applications to re-use all of its parsing features?
I could give it a try and come back with a new patch, otherwise I am perfectly ok if you want to do it instead.
Best regards,
Georgios
Quoted 96 lines · Adrien Mazarguil
George,
I missed the original RFC thread [1][2] (you should have used it as a cover letter for this series BTW) please see below.
Quoted 3 lines · Olivier Matz
Hi,
Quoted 1 line
On Tue, Jan 16, 2018 at 9:40 AM Olivier Matz <[email protected]>
Quoted 9 lines · wrote:
Quoted 9 lines · On Tue, Jan 16, 2018 at 08:45:32AM +0000, [email protected] wrote:
Quoted 7 lines
Hi Georgios,
Quoted 4 lines · Wenzhuo
Hi,
Quoted 2 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of GeorgiosKatsikas
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Sent: Saturday, January 13, 2018 5:01 AM
To: [email protected]
Cc: [email protected]; Georgios Katsikas <[email protected]>
Subject: [dpdk-dev] [PATCH 1/3] app/testpmd: Movedcmdline_flowto
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
librte_cmdlineSigned-off-by Georgios Katsikas <[email protected]>Looks like a good idea to move this code to the lib. cc Adrien the author of this file,
app/test-pmd/cmdline_flow.c.If the command line parsing of
rte_flowis something that has some chances to be shared among multiple applications, I agree it makessense
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
to move it in a library.
However, my opinion is that it would be better to have a specific library for it, like
librte_flow_cmdline, because I'm not sure that people linking withlibrte_cmdlinealways want to pull therte_flowparsing code.In my opinion the entire flow command parser has nothing to do outside testpmd, it's way too specific, even if another application finds it useful.
Code duplication being a bad thing, your application could as well compile or even #include
app/test-pmd/cmdline_flow.cdirectly (not pretty, I know) since it would have the same internal layout as testpmd. Testpmd'sMakefilecould be modified to spit it out as a separate library if needed.What could make more sense would be to extract the parser engine for librte_cmdline's dynamic tokens (e.g. struct context, struct arg, struct token) and possibly various generic helpers (e.g.
parse_string,parse_mac_addr), but not enum index nor token_list[] and friends which define the layout of testpmd's flow command.This would enable other flow-like commands without duplicating the engine every time, however I'm still not sure if making it available outside testpmd is a good idea. Extracting and making it fully generic will require a considerable amount of work.
Quoted 9 lines
Quoted 5 lines
Hi Lu, Oliver,
Thanks for your feedback!
You have a point here, flow commands are only a subset of the parser. Do you want me to create this new library and send another patch?Let's first wait for Adrien's feedback, he can have counter-arguments.
Quoted 1 line
I guess I have to use
librte_cmdlineas a template/example forcreating the
Quoted 3 lines
Quoted 1 line
librte_flow_cmdlinelibrary.It can be used as an example for
Makefileand .map file.I'm not opposed to the idea of exporting the parser engine after making it properly generic, but please reconsider. Testpmd is an application made to validate PMD functionality. The flow command implementation, as neat as it is, remains a complex wrapper on top of the
cmdline_parseAPI which wasn't originally designed for dynamic tokens. Its syntax may evolve without warning if deemed necessary. Making it public will subject it to exported API/ABI constraints and likely impede future evolution.Assuming your application is not dragging testpmd's legacy, I think it would
be wiser to re-implement a simpler flow command look-alike on top of a more suitable command-line handling library if you like its syntax.[1] http://dpdk.org/ml/archives/dev/2018-January/086872.html
[2] Message-ID: CAN9HtFDz+imqbCKfs6a0NE0W7iF8C+-KiNB0nCRywimspjfEDg@mail. gmail.com--
Adrien Mazarguil
6WIND
Signature · 6 lines
Georgios Katsikas Industrial Ph.D. Student Network Intelligence Group Decision, Networks, and Analytics (DNA) Lab RISE SICS E-Mail: [email protected]
Quoted 4 lines · On Tue, Jan 16, 2018 at 03:54:57PM +0100, [email protected] wrote:
Hi Adrien,
Thanks for your insights and sorry for omitting the cover letter (this is my first patch in DPDK).
No problem, don't worry about that. Remember to put as much context as close as possible to the related changes. The commit log of a patch is in fact a more appropriate place since a cover letter is simply a summary of a subsequent series and is discarded once applied.
Quoted 9 lines
I understand your concerns. The reason I proposed this patch is to facilitate a more high level vendor agnostic API for configuring and monitoring DPDK-based NICs.
To avoid just copying thousands of lines of code into my application, do you think it is feasible to move at least the components (struct context, struct arg, struct token and the parse_* helpers) you mentioned and restructure testpmd in a way that allows applications to re-use all of its parsing features?
Yes I think it's feasible, although at the cost of great effort because you'd need to untangle engine code from parser code to expose the former, the flow command being a mix of both. Proper APIs must be devised for that, hence my question: is it really worth the trouble?
Other contributors already asked me how they could reuse the flow command parser to implement similar testpmd commands without copy/pasting the entire file, so I'm already convinced separating at least the engine part makes sense at the testpmd level. Moving it to librte_cmdline for external applications seems more complex though.
Quoted 2 lines
I could give it a try and come back with a new patch, otherwise I am perfectly ok if you want to do it instead.
While I'd certainly like to do it (at least at the testpmd level), it's unlikely to happen anytime soon due to other priorities.
Feel free to take care of it if you're motivated enough, just keep in mind right now I don't think this should be exposed as a public API. I can change my mind if you manage to make it generic enough.
Quoted 109 lines
Quoted 96 lines · Adrien Mazarguil
George,
I missed the original RFC thread [1][2] (you should have used it as a cover letter for this series BTW) please see below.
Quoted 3 lines · Olivier Matz
Hi,
Quoted 1 line
On Tue, Jan 16, 2018 at 9:40 AM Olivier Matz <[email protected]>
Quoted 9 lines · wrote:
Quoted 9 lines · On Tue, Jan 16, 2018 at 08:45:32AM +0000, [email protected] wrote:
Quoted 7 lines
Hi Georgios,
Quoted 4 lines · Wenzhuo
Hi,
Quoted 2 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of GeorgiosKatsikas
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Sent: Saturday, January 13, 2018 5:01 AM
To: [email protected]
Cc: [email protected]; Georgios Katsikas <[email protected]>
Subject: [dpdk-dev] [PATCH 1/3] app/testpmd: Movedcmdline_flowto
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
librte_cmdlineSigned-off-by Georgios Katsikas <[email protected]>Looks like a good idea to move this code to the lib. cc Adrien the author of this file,
app/test-pmd/cmdline_flow.c.If the command line parsing of
rte_flowis something that has some chances to be shared among multiple applications, I agree it makessense
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
to move it in a library.
However, my opinion is that it would be better to have a specific library for it, like
librte_flow_cmdline, because I'm not sure that people linking withlibrte_cmdlinealways want to pull therte_flowparsing code.In my opinion the entire flow command parser has nothing to do outside testpmd, it's way too specific, even if another application finds it useful.
Code duplication being a bad thing, your application could as well compile or even #include
app/test-pmd/cmdline_flow.cdirectly (not pretty, I know) since it would have the same internal layout as testpmd. Testpmd'sMakefilecould be modified to spit it out as a separate library if needed.What could make more sense would be to extract the parser engine for librte_cmdline's dynamic tokens (e.g. struct context, struct arg, struct token) and possibly various generic helpers (e.g.
parse_string,parse_mac_addr), but not enum index nor token_list[] and friends which define the layout of testpmd's flow command.This would enable other flow-like commands without duplicating the engine every time, however I'm still not sure if making it available outside testpmd is a good idea. Extracting and making it fully generic will require a considerable amount of work.
Quoted 9 lines
Quoted 5 lines
Hi Lu, Oliver,
Thanks for your feedback!
You have a point here, flow commands are only a subset of the parser. Do you want me to create this new library and send another patch?Let's first wait for Adrien's feedback, he can have counter-arguments.
Quoted 1 line
I guess I have to use
librte_cmdlineas a template/example forcreating the
Quoted 3 lines
Quoted 1 line
librte_flow_cmdlinelibrary.It can be used as an example for
Makefileand .map file.I'm not opposed to the idea of exporting the parser engine after making it properly generic, but please reconsider. Testpmd is an application made to validate PMD functionality. The flow command implementation, as neat as it is, remains a complex wrapper on top of the
cmdline_parseAPI which wasn't originally designed for dynamic tokens. Its syntax may evolve without warning if deemed necessary. Making it public will subject it to exported API/ABI constraints and likely impede future evolution.Assuming your application is not dragging testpmd's legacy, I think it would
be wiser to re-implement a simpler flow command look-alike on top of a more suitable command-line handling library if you like its syntax.[1] http://dpdk.org/ml/archives/dev/2018-January/086872.html
[2] Message-ID: CAN9HtFDz+imqbCKfs6a0NE0W7iF8C+-KiNB0nCRywimspjfEDg@mail. gmail.com--
Adrien Mazarguil
6WINDSignature · 6 lines
Georgios Katsikas Industrial Ph.D. Student Network Intelligence Group Decision, Networks, and Analytics (DNA) Lab RISE SICS E-Mail: [email protected]
Signature · 2 lines
Adrien Mazarguil 6WIND
Hi again,
I decided to simplify things for now, hence sent a new minimal patch only for testpmd (not librte_cmdline), which allows external applications to compile against it without errors.
Thanks again for you time,
Georgios
Quoted 155 lines · Adrien Mazarguil
Quoted 4 lines · On Tue, Jan 16, 2018 at 03:54:57PM +0100, [email protected] wrote:
Hi Adrien,
Thanks for your insights and sorry for omitting the cover letter (this is my first patch in DPDK).
No problem, don't worry about that. Remember to put as much context as close as possible to the related changes. The commit log of a patch is in fact a more appropriate place since a cover letter is simply a summary of a subsequent series and is discarded once applied.
Quoted 9 lines
I understand your concerns. The reason I proposed this patch is to facilitate a more high level vendor agnostic API for configuring and monitoring DPDK-based NICs.
To avoid just copying thousands of lines of code into my application, do you think it is feasible to move at least the components (struct context, struct arg, struct token and the parse_* helpers) you mentioned and restructure testpmd in a way that allows applications to re-use all of its parsing features?
Yes I think it's feasible, although at the cost of great effort because you'd need to untangle engine code from parser code to expose the former, the flow command being a mix of both. Proper APIs must be devised for that, hence my question: is it really worth the trouble?
Other contributors already asked me how they could reuse the flow command parser to implement similar testpmd commands without copy/pasting the entire file, so I'm already convinced separating at least the engine part makes sense at the testpmd level. Moving it to
librte_cmdlinefor external applications seems more complex though.Quoted 2 lines
I could give it a try and come back with a new patch, otherwise I am perfectly ok if you want to do it instead.
While I'd certainly like to do it (at least at the testpmd level), it's unlikely to happen anytime soon due to other priorities.
Feel free to take care of it if you're motivated enough, just keep in mind right now I don't think this should be exposed as a public API. I can change my mind if you manage to make it generic enough.
Quoted 102 lines
Quoted 88 lines · Adrien Mazarguil
George,
I missed the original RFC thread [1][2] (you should have used it as a cover letter for this series BTW) please see below.
Quoted 3 lines · Olivier Matz
Hi,
Quoted 1 line
On Tue, Jan 16, 2018 at 9:40 AM Olivier Matz <[email protected]>
Quoted 9 lines · wrote:
Quoted 9 lines · On Tue, Jan 16, 2018 at 08:45:32AM +0000, [email protected] wrote:
Quoted 7 lines
Hi Georgios,
Quoted 4 lines · Wenzhuo
Hi,
Quoted 2 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of GeorgiosKatsikas
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Sent: Saturday, January 13, 2018 5:01 AM
To: [email protected]
Cc: [email protected]; Georgios Katsikas <[email protected]>
Subject: [dpdk-dev] [PATCH 1/3] app/testpmd: Movedcmdline_flowto
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
librte_cmdlineSigned-off-by Georgios Katsikas <[email protected]>Looks like a good idea to move this code to the lib. cc Adrien the author of this file,
app/test-pmd/cmdline_flow.c.If the command line parsing of
rte_flowis something that has some chances to be shared among multiple applications, I agree it makessense
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
to move it in a library.
However, my opinion is that it would be better to have a specific library for it, like
librte_flow_cmdline, because I'm not sure that people linking withlibrte_cmdlinealways want to pull therte_flowparsing code.In my opinion the entire flow command parser has nothing to do outside testpmd, it's way too specific, even if another application finds it useful.
Code duplication being a bad thing, your application could as well compile or even #include
app/test-pmd/cmdline_flow.cdirectly (not pretty, I know) since it would have the same internal layout as testpmd. Testpmd'sMakefilecould be modified to spit it out as a separate library if needed.What could make more sense would be to extract the parser engine for librte_cmdline's dynamic tokens (e.g. struct context, struct arg, struct token) and possibly various generic helpers (e.g.
parse_string,parse_mac_addr), but not enum index nor token_list[] and friends which define the layout of testpmd's flow command.This would enable other flow-like commands without duplicating the engine every time, however I'm still not sure if making it available outside testpmd is a good idea. Extracting and making it fully generic will require a considerable amount of work.
Quoted 9 lines
Quoted 5 lines
Hi Lu, Oliver,
Thanks for your feedback!
You have a point here, flow commands are only a subset of the parser. Do you want me to create this new library and send another patch?Let's first wait for Adrien's feedback, he can have counter-arguments.
Quoted 1 line
I guess I have to use
librte_cmdlineas a template/example forcreating the
Quoted 3 lines
Quoted 1 line
librte_flow_cmdlinelibrary.It can be used as an example for
Makefileand .map file.I'm not opposed to the idea of exporting the parser engine after making it properly generic, but please reconsider. Testpmd is an application made to validate PMD functionality. The flow command implementation, as neat as it is, remains a complex wrapper on top of the
cmdline_parseAPI which wasn't originally designed for dynamic tokens. Its syntax may evolve without warning if deemed necessary. Making it public will subject it to exported API/ABI constraints and likely impede future evolution.Assuming your application is not dragging testpmd's legacy, I think it would
be wiser to re-implement a simpler flow command look-alike on top of a more suitable command-line handling library if you like its syntax.Quoted 8 lines
[1] http://dpdk.org/ml/archives/dev/2018-January/086872.html
[2] Message-ID: CAN9HtFDz+imqbCKfs6a0NE0W7iF8C+-KiNB0nCRywimspjfEDg@mail. gmail.com--
Adrien Mazarguil
6WINDQuoted 7 lines
--
Georgios Katsikas
Industrial Ph.D. Student
Network Intelligence Group
Decision, Networks, and Analytics (DNA) Lab
RISE SICS
E-Mail: [email protected]--
Adrien Mazarguil
6WIND
Signature · 6 lines
Georgios Katsikas Industrial Ph.D. Student Network Intelligence Group Decision, Networks, and Analytics (DNA) Lab RISE SICS E-Mail: [email protected]