Skip to content
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

Unnessesary config / ram alloc: num_physical_ports #461

Closed
illishar opened this issue Feb 2, 2022 · 1 comment
Closed

Unnessesary config / ram alloc: num_physical_ports #461

illishar opened this issue Feb 2, 2022 · 1 comment

Comments

@illishar
Copy link

illishar commented Feb 2, 2022

The allocated user config variable "num_physical_ports" is unnecessary.
Info and functionality regarding the number of physical ports, does not change at runtime in any sane scenario. (As far as I know.) And the stack has no feature or functionality to modify this at runtime.
It makes good sense, to make this kind of option, into a compile time constant. (Which it also was, until some time ago.) All the sample apps, currently needs code like this:

pnet_cfg.num_physical_ports = PNET_MAX_PHYSICAL_PORTS;

Besides allocating unnecessary global memory, this also muddies the "option api", gives unnecessary user config code and prevents the compiler from making optimizations.

The fix is simple. Just replace all references of num_physical_ports with the PNET_MAX_PHYSICAL_PORTS.

This issue, is somewhat related to the issues:
#316
#259

@pyhys
Copy link
Collaborator

pyhys commented Feb 23, 2022

The ability to be able to adjust a compile time setting PNET_MAX_PHYSICAL_PORTS, and to use num_physical_ports is actually a customer request. They would like to ship a single compiled version of the library, and it should be useful for several applications (using different number of ports).

I agree that this complicates the API somewhat. I will update the API documentation in a future release

@pyhys pyhys closed this as completed Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants