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

Add cmd line parser #219

Merged
merged 3 commits into from
Feb 12, 2025
Merged

Add cmd line parser #219

merged 3 commits into from
Feb 12, 2025

Conversation

Fredi-raspall
Copy link
Contributor

@Fredi-raspall Fredi-raspall commented Feb 7, 2025

goal: allow dataplane process to get other params, non-EAL related.

The crate used, clap, allows deriving parser functions automatically and defining default values.
However, that does not seem to work for certain types. We should also decide which args we can default and which ones are mandatory. We could default ALL (and then it would behave as it was, with stuff hardcoded).

We should also decide if we want to call the main proces "dataplane" or gateway?

A next-gen dataplane for next-gen fabric gateway

Usage: dataplane [OPTIONS]

Options:
      --main-lcore <core-id used as main>              [default: 2]
      --lcores <map lcore set to cpu set>              
      --in-memory                                      
      --allow <PCI devices to probe>                   
      --huge-worker-stack <huge pages>                 [default: 8192]
      --socket-mem <socket memory>                     
      --no-telemetry                                   
      --iova-mode <iova mode(va|pa)>                   
      --log-level <loglevel for a specific component>  
  -h, --help                                           Print help
  -V, --version                                        Print version

@Fredi-raspall Fredi-raspall marked this pull request as ready for review February 7, 2025 15:29
@Fredi-raspall Fredi-raspall requested a review from a team as a code owner February 7, 2025 15:29
@Fredi-raspall Fredi-raspall requested review from mvachhar and removed request for a team February 7, 2025 15:29
@Fredi-raspall Fredi-raspall force-pushed the fredi/args branch 2 times, most recently from e057db9 to 70fcfad Compare February 7, 2025 16:13
Copy link
Collaborator

@daniel-noland daniel-noland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I really like this PR.

I had a number of comments, but only two actual concerns.

Address comments or ping me on slack and we can discuss.

NIce work :)

dataplane/src/args.rs Outdated Show resolved Hide resolved
dataplane/src/args.rs Show resolved Hide resolved
dataplane/src/args.rs Outdated Show resolved Hide resolved
dataplane/src/args.rs Show resolved Hide resolved
dataplane/src/args.rs Show resolved Hide resolved
dataplane/src/args.rs Show resolved Hide resolved
dataplane/Cargo.toml Outdated Show resolved Hide resolved
@daniel-noland
Copy link
Collaborator

We should also decide if we want to call the main proces "dataplane" or gateway?

This is a good question.

On thinking about it, I suggest that we convert the dataplane crate into a library and make another (much smaller) crate called gateway which is limited to things like parsing command line parameters and calling dataplane functions.

I am a big believer in thin applications and fat libraries. It makes testing easier, and who knows when we might want to recycle dataplane logic for some other purpose.

@Fredi-raspall
Copy link
Contributor Author

Overall I really like this PR.

I had a number of comments, but only two actual concerns.

Address comments or ping me on slack and we can discuss.

NIce work :)

Thanks ... Fine to discuss if you're around!

@Fredi-raspall
Copy link
Contributor Author

Fredi-raspall commented Feb 7, 2025

@daniel-noland I've pushed some changes and also renamed the crate to "gateway". I have NOT changed the name of the dataplane folder so as not to confuse folks that have outstanding PRs.
I've had to rename the folder too. Otherwise cargo fmt was complaining.
If we want to rename it, better sooner than later. I'm fine with other names btw!

Copy link
Member

@qmonnet qmonnet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the motivation for renaming dataplane to gateway?

[EDIT: Sorry I had missed part of the conversation. I like Daniel's suggestion of a dataplane library + gateway binary, for what it's worth.]

dataplane/Cargo.toml Outdated Show resolved Hide resolved
.. so that the GW dataplane can accept also non-EAL related params.

Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
This commit is to be reverted, but allows starting the dataplane
without any arg, as it was before. Also, printed the config, which
should be replaced by logs.

Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
@mvachhar
Copy link
Contributor

What's the motivation for renaming dataplane to gateway?

[EDIT: Sorry I had missed part of the conversation. I like Daniel's suggestion of a dataplane library + gateway binary, for what it's worth.]

I like the suggestion as well, though this repo is really just the dataplane as the full gateway as FRR, the agent etc. I'm open to a better name for either the dataplane library or gateway binary. We can also have a binary called dataplane and library called dataplane built out of the same crate.

@Fredi-raspall
Copy link
Contributor Author

What's the motivation for renaming dataplane to gateway?
[EDIT: Sorry I had missed part of the conversation. I like Daniel's suggestion of a dataplane library + gateway binary, for what it's worth.]

I like the suggestion as well, though this repo is really just the dataplane as the full gateway as FRR, the agent etc. I'm open to a better name for either the dataplane library or gateway binary. We can also have a binary called dataplane and library called dataplane built out of the same crate.

I think dataplane is a bit unspecific. True, this repo does not contain the whole thing. Happy to rename it in any other way. Else, we can keep on having dataplane library and dataplane binary, altough a different name would make the distinction more explicit and keep generic stuff in the library and specifics in the binary. I can remove those commits from this PR since the original purpose of this PR was another.

Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
@Fredi-raspall
Copy link
Contributor Author

What's the motivation for renaming dataplane to gateway?
[EDIT: Sorry I had missed part of the conversation. I like Daniel's suggestion of a dataplane library + gateway binary, for what it's worth.]

I like the suggestion as well, though this repo is really just the dataplane as the full gateway as FRR, the agent etc. I'm open to a better name for either the dataplane library or gateway binary. We can also have a binary called dataplane and library called dataplane built out of the same crate.

I think dataplane is a bit unspecific. True, this repo does not contain the whole thing. Happy to rename it in any other way. Else, we can keep on having dataplane library and dataplane binary, altough a different name would make the distinction more explicit and keep generic stuff in the library and specifics in the binary. I can remove those commits from this PR since the original purpose of this PR was another.

@mvachhar I've removed the patches that do any rename. There is one outstanding comment from @daniel-noland regarding the logging.

Copy link
Member

@qmonnet qmonnet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you

@qmonnet
Copy link
Member

qmonnet commented Feb 10, 2025

Seems good to merge as far as I can tell. The logging thing can be refined as a follow-up if necessary.

@qmonnet qmonnet dismissed daniel-noland’s stale review February 10, 2025 20:11

Review's comments have been addressed. The remaining discussion about logging can be addressed as a follow-up, if need be.

@daniel-noland
Copy link
Collaborator

I agree. Sorry I was out of action for a bit there. All ahead full!

@Fredi-raspall Fredi-raspall added this pull request to the merge queue Feb 12, 2025
Merged via the queue into main with commit 00990a1 Feb 12, 2025
25 checks passed
@Fredi-raspall Fredi-raspall deleted the fredi/args branch February 12, 2025 08:36
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

Successfully merging this pull request may close these issues.

4 participants