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 check for validating ports #205

Merged
merged 24 commits into from
Apr 23, 2020
Merged

Conversation

rohit-mp
Copy link
Contributor

@rohit-mp rohit-mp commented Apr 9, 2020

Added a simple check in onvm/go.sh to validate the given port mask.

Closes #139

Summary:

Usage:

This PR includes
Resolves issues 👍
Breaking API changes
Internal API changes
Usability improvements
Bug fixes 👍
New functionality
New NF/onvm_mgr args
Changes to starting NFs
Dependency updates
Web stats updates

Merging notes:

  • Dependencies: None

TODO before merging :

  • PR is ready for review

Test Plan:

Review:

@kevindweb

(optional) Subscribers: << @-mention people who probably care about these changes >>

koolzz and others added 6 commits June 4, 2019 14:45
This PR releases OpenNetVM v19.05
This PR adds the following bug fix to the master branch:
[Bug Fix] Fix Typo in Console Stats Header (sdnfv#142)
[Bug Fix] Fix Stats Header in Release Notes (sdnfv#145)
This PR releases OpenNetVM v19.07
This PR adds the a few bugfixes and features, this is not a full release.
@onvm
Copy link

onvm commented Apr 9, 2020

In response to PR creation

CI Message

Your results will arrive shortly

onvm
onvm previously approved these changes Apr 9, 2020
Copy link

@onvm onvm left a comment

Choose a reason for hiding this comment

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

In response to PR creation

CI Message

Run successful see results:
✔️ PR submitted to develop branch
✔️ Linter passed

@rohit-mp
Copy link
Contributor Author

rohit-mp commented Apr 9, 2020

The script stops the user only when they specify a port value which is greater than the number of NICs bound. Additionally, gives a warning when the port value of 0 is used.
I tested this against 0, 1, 2 port values.

Does this look good? Let me know if any changes are required.

@rohit-mp
Copy link
Contributor Author

rohit-mp commented Apr 9, 2020

I seem to have incorrectly based my branch off of master instead of develop. I'll create another PR if that's an issue.

@kevindweb kevindweb linked an issue Apr 9, 2020 that may be closed by this pull request
@kevindweb
Copy link
Contributor

Thanks for making this so quickly. ONVM_NIC_PCI is not always filled. In scripts/setup_environment.sh, we check if that variable is empty, and request user response, but we don't actually set the variable. There's also the case that I don't set the NIC in setup, but I do it manually while testing through DPDK (which I've done many times). In those cases as well, we can't ensure the user has them set just through that variable.

@rohit-mp
Copy link
Contributor Author

rohit-mp commented Apr 9, 2020

Ah forgot about that. I could modify it to check through all network devices instead of just those in the variable but that doesn't seem elegant. Do you have anything in mind?

@kevindweb
Copy link
Contributor

Here is a command I think would work

./dpdk-devbind.py --status-dev net | sed '/Network devices using kernel driver/q'

This will only output the interfaces bound to dpdk, and stops outputting when we get to the kernel drivers. We can just grep to find a specific device, or count how many devices are bound.

@rohit-mp
Copy link
Contributor Author

rohit-mp commented Apr 9, 2020

That's neat. Modifying the same to just count the number of times 'drv' appears would give us our required output.

./dpdk-devbind.py --status-dev net | sed '/Network devices using kernel driver/q' | grep -c "drv"

This should now give the number of network devices using dpdk compatible driver and can be directly compared with the portmask given. Does that sound good?

@dennisafa dennisafa mentioned this pull request Apr 10, 2020
3 tasks
@rohit-mp
Copy link
Contributor Author

Sorry for the delay. I've updated the checking condition. I hope the messages displayed are fine.

@kevindweb
Copy link
Contributor

Thanks for updating. dpdk_drivers is probably unnecessary now. Can you make sure your tabs/spaces are correct (lines 64 and 65 specifically)? Also, we are trying to use [[ over [ single brace conditions in the future.

@rohit-mp
Copy link
Contributor Author

Thanks for pointing that out. I'll remove dpdk_drivers.
I'm not sure why the tabs were misaligned (looks proper in vim). Replaced tabs by spaces now.

Should I update [ to [[ in other parts of the script as well?

@kevindweb
Copy link
Contributor

I would leave other parts of the script. It's not horrible, we just want to do it for the future updates, and to reduce the amount of testing you should just update your code if you can.

@kevindweb
Copy link
Contributor

Looks good, I will have to update CI before we test this, because CI runs go.sh without the correct number of ports I think.

@rohit-mp
Copy link
Contributor Author

Okay. Thanks for immediate responses!

@kevindweb
Copy link
Contributor

Let's try this @onvm

@onvm
Copy link

onvm commented Apr 14, 2020

Let's try this @onvm

CI Message

Your results will arrive shortly

@rohit-mp
Copy link
Contributor Author

Does this look good?

onvm/onvm_nflib/onvm_common.h Outdated Show resolved Hide resolved
onvm/onvm_nflib/onvm_common.h Outdated Show resolved Hide resolved
@rohit-mp
Copy link
Contributor Author

I've also updated the function name to make it more readable. I'd used onvm_macaddr_get before to make it similar to rte_eth_macaddr_get.

rte_eth_macaddr_get(port_id, mac_addr);
return 0;
} else {
onvm_get_fake_macaddr(mac_addr);
Copy link
Member

Choose a reason for hiding this comment

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

I think that we can remove this part of the function. My idea is that onvm_get_macaddr is just checking for a valid port and fetching the macaddr for that port on success, return -1 otherwise. I don't think we should call onvm_get_fake_macaddr here. We should modify the NF's to decide whether or not they need a fake mac addr on their own.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh okay got it. So, speed_tester and scaling should use onvm_get_fake_macaddr? But they do take in a dst MAC in which case it would be good to try to get a real address for the source but can settle for a fake address. Or do we go along the lines that if a fake address is sufficient, then we needn't bother to fetch the real address?

Copy link
Contributor Author

@rohit-mp rohit-mp Apr 18, 2020

Choose a reason for hiding this comment

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

I think the qn is whether returning the fake MAC address is an extra burden to be vary of. Otherwise, the return value denotes the status and the user can decide what to do with the address they received. Let me know what you guys think. I hope I'm not missing something.

Copy link
Contributor

@kevindweb kevindweb left a comment

Choose a reason for hiding this comment

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

Dennis' comment and mine too, after that I think it looks good otherwise.

examples/speed_tester/speed_tester.c Outdated Show resolved Hide resolved
@kevindweb
Copy link
Contributor

Hate to be that guy again but can you remove the speed_tester port extern line? I'll test and approve once you do.

Co-Authored-By: Kevin Deems <kevin8deems@gmail.com>
@rohit-mp
Copy link
Contributor Author

Nothing to say for missing that a third time 😅

Copy link
Member

@dennisafa dennisafa left a comment

Choose a reason for hiding this comment

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

looking good, just a few small fixes and should be good to merge

examples/scaling_example/scaling.c Outdated Show resolved Hide resolved
onvm/onvm_nflib/onvm_common.h Outdated Show resolved Hide resolved
Copy link
Member

@dennisafa dennisafa 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, thanks Rohit.

@rohit-mp
Copy link
Contributor Author

Thanks for the careful reviews!

Copy link
Contributor

@kevindweb kevindweb left a comment

Choose a reason for hiding this comment

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

Just tested with multiple speed_tester, load_generator, and scaling on shared core mode as well as without. The port check on go.sh works well, tested on two different machines with and without NICs bound. Thanks for getting these changes updated so quickly, great work!

@kevindweb
Copy link
Contributor

@onvm sanity check?

@onvm
Copy link

onvm commented Apr 20, 2020

@onvm sanity check?

CI Message

Your results will arrive shortly

Copy link

@onvm onvm left a comment

Choose a reason for hiding this comment

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

@onvm sanity check?

CI Message

Run successful see results:
Test took: 5 minutes, 42 seconds
✔️ PR submitted to develop branch
✔️ Pktgen performance check passed
✔️ Speed Test performance check passed
✔️ Linter passed

[Results from nimbnode23]

  • Median TX pps for Pktgen: 7729371
    Performance rating - 100.38% (compared to 7700000 average)

  • Median TX pps for Speed Tester: 42215643
    Performance rating - 100.51% (compared to 42000000 average)

Copy link
Contributor

@pcodes pcodes left a comment

Choose a reason for hiding this comment

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

Also tested the new changes, looks good!

@kevindweb kevindweb added the ready-for-gatekeeper 🚪 PRs that have been approved and are ready for a final review/merge label Apr 22, 2020
@dennisafa dennisafa merged commit 3858c27 into sdnfv:develop Apr 23, 2020
@@ -52,6 +52,13 @@ then
usage
fi

ports_detected=$("$RTE_SDK"/usertools/dpdk-devbind.py --status-dev net | sed '/Network devices using kernel driver/q' | grep -c "drv")
if [[ $ports_detected -lt $ports ]]
Copy link
Contributor

Choose a reason for hiding this comment

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

@rohit-mp @kevindweb I think this might be a bug since $ports represents the port mask while $ports_detected is the number of network devices using DPDK-compatible driver. Please correct me if I am wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you are right. Sorry for the mistake on my part. This bug is being tracked in issue #228 at the moment.

@rohit-mp rohit-mp deleted the 139_validate_ports branch August 18, 2020 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix 🐛 ready-for-gatekeeper 🚪 PRs that have been approved and are ready for a final review/merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid Port Prints when running with no ports enabled
8 participants