-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH CLOUD-DEV v5] Modular pktio ops #139
[PATCH CLOUD-DEV v5] Modular pktio ops #139
Conversation
|
||
#ifdef ODP_PKTIO_DPDK | ||
enable_link_dpdk_pktio_ops = 1; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel we don't need PKTIO_DPDK anylonger as we now already have it from linux-dpdk. I have sent a PR https://github.com/Linaro/odp/pull/140 with necessary updates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Krishna, as I replied in another email, I suggest an approach that add workable solutions first and after then remove obsolete code.
With PR#140 it looks likes that we removed linux-generic dpdk pktio and lost dpdk pktio at all, now wait for a new design which seems still in discussion.
I'll comment these in your PR as a review suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have the working solution currently in linux-dpdk. Question is, why we still want to have it in linux-generic ?
Note that this PR appears to have broken the linux-dpdk build, as reported by Travis. We can discuss how best to resolve this during tomorrow's call. |
While work on 3rd part of Makefile re-organization, I met a difficulty and very like to share with you, and maybe you have more experience with automake and can help provide suggestions: I'm trying to simplify subsystem and module writers effort to add their code into Makefile infra, I create a Makefile-paths.include, allow writers to do only two steps:
And that's all, I wrote a Makefile-subsystems.include which automatically generate all targets and rules for build the subsystem and modules based on above description. Unfortunately it does not work with automake, the works are pushed: In the branch you will find the platform/linux-generic/Makefile-paths.inc and Makefile-subsystems.inc described above. The reason I figured currently is because automake statically analyze Makefile.am and generate Makefile.in, without run any of the dynamic expansions included in Makefile-subsystems.inc. But what I needed is exactly that. I'll continue back next week, sorry today will not be able to send out internal review. Thanks and best regards, Yi |
|
||
/* Subsystem APIs declarations */ | ||
ODP_SUBSYSTEM_API(pktio_ops, int, open, odp_pktio_t, | ||
pktio_entry_t *, const char *, odp_pool_t); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this going to declare an external function prototype called odp_pktio_ops_open(...)? However the implementation won't exist, right?
I understand we need to define the function types (odp_pktio_ops_open_t) for use in the structure below, but do we need to declare all those function prototypes in this header file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, here we only use the ODP_SUBSYSTEM_API() macro to typedef prototype function pointers and leave the prototype declarations no defines.
I suggest we accept this as is and consider how to handle this kind of tasks more properly in terms of autogen. as described in heyi-arm/pure-interface#6
/* Further initialization per subsystem */ | ||
|
||
#ifdef ODP_PKTIO_DPDK | ||
enable_link_dpdk_pktio_ops = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how and where are these enable_link_*
variables used?
How will this work with dynamically loadable modules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is temporary variables to make sure these modules are linked into ODP library.
Because the Makefiles have not been re-organized to build modules each as real independent module (.a or .so) and either link them with --whole-archive or --no-as-needed flags, this is necessary for current Makefiles.
.init_global = dpdk_pktio_init_global, | ||
.init_local = dpdk_pktio_init_local, | ||
.term = NULL, | ||
static pktio_ops_module_t dpdk_pktio_ops = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we find a solution so these structures are kept as const? If I get this correctly, apart from the linked list embedded in the "base class", there is nothing that should be mutable here, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'm thinking how to achieve this. Can it be later patch improvements.
platform/linux-generic/pktio/pcap.c
Outdated
@@ -51,7 +51,8 @@ static const char pcap_mac[] = {0x02, 0xe9, 0x34, 0x80, 0x73, 0x04}; | |||
|
|||
static int pcapif_stats_reset(pktio_entry_t *pktio_entry); | |||
|
|||
static int _pcapif_parse_devname(pkt_pcap_t *pcap, const char *devname) | |||
static int _pcapif_parse_devname( | |||
pktio_ops_pcap_data_t *pcap, const char *devname) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run out of 80 characters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be better to split it after static int
if that's the problem, or at a parameter boundary. Splitting after the open paren looks odd. For example:
static int _pcapif_parse_devname(pktio_ops_pcap_data_t *pcap,
const char *devname)
would be normal ODP style here.
platform/linux-generic/pktio/pcap.c
Outdated
@@ -163,7 +165,8 @@ static int pcapif_init(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry, | |||
|
|||
static int pcapif_close(pktio_entry_t *pktio_entry) | |||
{ | |||
pkt_pcap_t *pcap = &pktio_entry->s.pkt_pcap; | |||
pktio_ops_pcap_data_t *pcap = | |||
&pktio_entry->ops_data(pcap); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
declaration fins in one line (there are others in this file too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run out of 80 characters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to go anywhere near the 80-char limit so should be fine as a single line.
Part three Makefiles re-organization Read #127 to learn Dmitry's working on build system: no conflict or duplicate works |
6cbf07f
to
55819b6
Compare
55819b6
to
10fed60
Compare
@Bill-Fischofer-Linaro @joseppc @nagarahalli @GBalakrishna This PR has been fixed for both linux-dpdk build and checkpatch issues. |
10fed60
to
4e521e7
Compare
Reviewed-by: Bogdan Pricope bogdan.pricope@linaro.org Push? |
Reviewed-by: Josep Puigdemont josep.puigdemont@linaro.org |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm OK with this PR as long as we don't change interface names as part of it (as noted in comments).
* will remove in Makefile scheme changes. | ||
*/ | ||
int enable_link_dpdk_pktio_ops = 0; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please open an issue so that we don't forget about this "to do". We decided that this is a good use for GitHub issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, created #184
static pktio_ops_module_t loopback_pktio_ops = { | ||
.base = { | ||
.name = "loopback", | ||
.init_local = NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we changing this pktio name? This will cause existing applications that use the "loop" interface to need to change, which seems unnecessary. I'd keep this PR strictly to modularization without any application impact. If we want to change the pktio name that should be a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, will change it back to the original.
/* Temporary variable to enable link this module, | ||
* will remove in Makefile scheme changes. | ||
*/ | ||
int enable_link_loopback_pktio_ops = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As noted, "to dos" should be tracked as issues. These need not be separate issues, as the main purpose is simply to remind us that pktio still has work to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, created #184
* will remove in Makefile scheme changes. | ||
*/ | ||
int enable_link_netmap_pktio_ops = 0; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same "to do" comment here.
platform/linux-generic/pktio/pcap.c
Outdated
@@ -51,7 +51,8 @@ static const char pcap_mac[] = {0x02, 0xe9, 0x34, 0x80, 0x73, 0x04}; | |||
|
|||
static int pcapif_stats_reset(pktio_entry_t *pktio_entry); | |||
|
|||
static int _pcapif_parse_devname(pkt_pcap_t *pcap, const char *devname) | |||
static int _pcapif_parse_devname( | |||
pktio_ops_pcap_data_t *pcap, const char *devname) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be better to split it after static int
if that's the problem, or at a parameter boundary. Splitting after the open paren looks odd. For example:
static int _pcapif_parse_devname(pktio_ops_pcap_data_t *pcap,
const char *devname)
would be normal ODP style here.
/* Temporary variable to enable link this module, | ||
* will remove in Makefile scheme changes. | ||
*/ | ||
int enable_link_socket_pktio_ops = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same "to do" comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, created #184
.term = NULL, | ||
static pktio_ops_module_t socket_mmap_pktio_ops = { | ||
.base = { | ||
.name = "socket mmap", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again you've changed the interface name here from socket_mmap
to socket mmap
. Keep the names unchanged as part of this PR to avoid application impact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix all these.
/* Temporary variable to enable link this module, | ||
* will remove in Makefile scheme changes. | ||
*/ | ||
int enable_link_socket_mmap_pktio_ops = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same "to do" comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, created #184
/* Temporary variable to enable link this module, | ||
* will remove in Makefile scheme changes. | ||
*/ | ||
int enable_link_tap_pktio_ops = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same "to do" comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, created #184
platform/linux-dpdk/pktio/dpdk.c
Outdated
.name = "odp-dpdk", | ||
static pktio_ops_module_t dpdk_pktio_ops = { | ||
.base = { | ||
.name = "dpdk", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not change interface names as part of this PR. Any name changes should be a separate PR where we can access application impact. In the case of DPDK devices this may be appropriate here, but not as part of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, will fix all these.
Static SUBSYSTEM_FOREACH_TEMPLATE constraints the functions to be instantiated in the source files which invoke them, this causes code scatter shoots. Signed-off-by: Yi He <yi.he@linaro.org> Reviewed-by: Brian Brooks <brian.brooks@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Kevin Wang <kevin.wang@arm.com> Reviewed-by: Bogdan Pricope <bogdan.pricope@linaro.org> Reviewed-by: Josep Puigdemont <josep.puigdemont@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
l2fwd_simple_run.sh waits 1 second to allow test application to forward more than 10 packets. It works in case pktios are listed statically and pcap takes precedence over socket pktios. But with dynamically registered pktios the order was not guaranteed and socket pktios may take precedence over pcap pktio, which spent more time in open operation and caused this test failed. Disable the socket pktios since they mistakenly take too long time in open operation, future code refactory should solve the problem thoroughly. Signed-off-by: Yi He <yi.he@linaro.org> Reviewed-by: Brian Brooks <brian.brooks@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Kevin Wang <kevin.wang@arm.com> Reviewed-by: Bogdan Pricope <bogdan.pricope@linaro.org> Reviewed-by: Josep Puigdemont <josep.puigdemont@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Apply modular framework to the pktio ops registration, convert the static array for impls registration into a dynamic and extensible modularization manner. Signed-off-by: Yi He <yi.he@linaro.org> Signed-off-by: Balakrishna Garapati <balakrishna.garapati@linaro.org> Reviewed-by: Brian Brooks <brian.brooks@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Kevin Wang <kevin.wang@arm.com> Reviewed-by: Bogdan Pricope <bogdan.pricope@linaro.org> Reviewed-by: Josep Puigdemont <josep.puigdemont@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Rename the source as loopback.c, move implementation specific data structure into dedicated header file. Signed-off-by: Yi He <yi.he@linaro.org> Signed-off-by: Balakrishna Garapati <balakrishna.garapati@linaro.org> Reviewed-by: Brian Brooks <brian.brooks@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Bogdan Pricope <bogdan.pricope@linaro.org> Reviewed-by: Josep Puigdemont <josep.puigdemont@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Move implementation specific data structure into dedicated header file. Signed-off-by: Yi He <yi.he@linaro.org> Signed-off-by: Balakrishna Garapati <balakrishna.garapati@linaro.org> Reviewed-by: Brian Brooks <brian.brooks@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Bogdan Pricope <bogdan.pricope@linaro.org> Reviewed-by: Josep Puigdemont <josep.puigdemont@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Move implementation specific data structure into dedicated header file. Signed-off-by: Yi He <yi.he@linaro.org> Reviewed-by: Brian Brooks <brian.brooks@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Bogdan Pricope <bogdan.pricope@linaro.org> Reviewed-by: Josep Puigdemont <josep.puigdemont@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Move implementation specific data structure into dedicated header file. Signed-off-by: Yi He <yi.he@linaro.org> Reviewed-by: Brian Brooks <brian.brooks@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Bogdan Pricope <bogdan.pricope@linaro.org> Reviewed-by: Josep Puigdemont <josep.puigdemont@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Rename implementation specific data structure and its dedicated header file to accommodate uniformed name scheme. Signed-off-by: Yi He <yi.he@linaro.org> Signed-off-by: Balakrishna Garapati <balakrishna.garapati@linaro.org> Reviewed-by: Brian Brooks <brian.brooks@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Bogdan Pricope <bogdan.pricope@linaro.org> Reviewed-by: Josep Puigdemont <josep.puigdemont@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Rename implementation specific data structure and its dedicated header file to accommodate uniformed name scheme. Signed-off-by: Yi He <yi.he@linaro.org> Reviewed-by: Brian Brooks <brian.brooks@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Bogdan Pricope <bogdan.pricope@linaro.org> Reviewed-by: Josep Puigdemont <josep.puigdemont@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Rename implementation specific data structure and move its dedicated header file to impl local, decouple it from pktio_entry_t data structure. Signed-off-by: Yi He <yi.he@linaro.org> Signed-off-by: Balakrishna Garapati <balakrishna.garapati@linaro.org> Reviewed-by: Brian Brooks <brian.brooks@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Bogdan Pricope <bogdan.pricope@linaro.org> Reviewed-by: Josep Puigdemont <josep.puigdemont@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
4e521e7
to
e89a0ed
Compare
merged and closed. |
Part one (3 commits): Apply modular framework to the pktio ops subsystem
Part two (7 commits): Minor code re-factory on each pktio ops implementation
Part three Makefiles re-organization