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

host-device: Add support for DPDK device #490

Merged
merged 3 commits into from
Jan 20, 2021

Conversation

pperiyasamy
Copy link
Contributor

This commit would make host-device plugin as a placeholder
for DPDK device when applications wants to attach it with
a pod container through network attachment definition.

Signed-off-by: Periyasamy Palanisamy [email protected]

@matthewdupre
Copy link
Member

Is there a reason you can't just use the noop plugin instead? (https://github.com/containernetworking/cni/tree/master/plugins/test/noop)

@pperiyasamy
Copy link
Contributor Author

pperiyasamy commented May 28, 2020

Is there a reason you can't just use the noop plugin instead?

@matthewdupre yes, we (@JanScheurich) were also looking for such "dummy" CNI plugin for this purpose. Thanks for pointing it out.

@bboreham
Copy link
Contributor

bboreham commented Jun 3, 2020

@pperiyasamy should this PR be closed then?

@JanScheurich
Copy link

JanScheurich commented Jun 3, 2020 via email

@@ -43,6 +43,8 @@ const (
sysBusPCI = "/sys/bus/pci/devices"
)

var userspaceDrivers = []string{"vfio-pci", "uio_pci_generic", "igb_uio"}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit ignorant of DPDK; is there no more generic way to detect it than a hard-coded list of names?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAIK, this is the way to find the dpdk device as per the driver bound to it (https://doc.dpdk.org/guides/linux_gsg/linux_drivers.html)

if isDpdkMode {
result := current.Result{
CNIVersion: current.ImplementedSpecVersion,
Interfaces: []*current.Interface{
Copy link
Member

Choose a reason for hiding this comment

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

Arguably Interfaces should be empty; given that the interface doesn't exist...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, now handling the error returned from hasDpdkDriver method, hope that suffices.

Copy link
Member

Choose a reason for hiding this comment

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

Not exactly. AIUI, DPDK doesn't actually create an interface (that would show up in ip link), right? So, we shouldn't return it in Result. Instead, we should just return an empty result.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah! yes, good find. now changed it to return empty result for dpdk device.

@@ -91,6 +93,23 @@ func cmdAdd(args *skel.CmdArgs) error {
}
defer containerNs.Close()

var result *current.Result
Copy link
Member

Choose a reason for hiding this comment

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

There's no need to add this here; you initialize a new result on line 100 with the :=

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've just moved this variable here from line no. 104 (in existing code), Now updated :=, thanks.

@squeed
Copy link
Member

squeed commented Jun 10, 2020

Also, please add a note to the plugin's README documenting this behavior.

@pperiyasamy
Copy link
Contributor Author

Also, please add a note to the plugin's README documenting this behavior.

Yes, added now.

@dcbw
Copy link
Member

dcbw commented Aug 26, 2020

/lgtm

@pperiyasamy
Copy link
Contributor Author

@dcbw is this good to merge now ?

@martinkennelly
Copy link

@dcbw Any update on this patch? Thanks Dan.

This commit would make host-device plugin as a placeholder
for DPDK device when applications wants to attach it with
a pod container through network attachment definition.

Signed-off-by: Periyasamy Palanisamy <[email protected]>
Signed-off-by: Periyasamy Palanisamy <[email protected]>
Signed-off-by: Periyasamy Palanisamy <[email protected]>
@pperiyasamy
Copy link
Contributor Author

@martinkennelly Thanks for following it up, just rebased the PR to resolve conflicts for README.md. Let me raise another PR separately for README.md changes in cni.dev repo.

@martinkennelly
Copy link

CC @squeed @mccv1r0

@adpempx
Copy link

adpempx commented Jan 15, 2021

Guys,

could you please merge this MR?

This is mandatory use case for DPDK people with SRIOV environment in VMs.

Thanks

@bboreham bboreham changed the title Add support for DPDK device host-device: Add support for DPDK device Jan 16, 2021
@adpempx
Copy link

adpempx commented Jan 17, 2021

Hi @bboreham,

thanks for you approval.
I also verified this change in my environment:

  • Intel X710 configured with SR-IOV in VM in ESXi
  • DPDK by using userspace driver: igb_uio

and everything works without any issue.

Could you please let us know when your amazing Team will merge this MR in master branch?
Are you planning a new release with this code change?

Thanks

@prem-b
Copy link

prem-b commented Jan 18, 2021

Hello Team,
Any plan, by when this shall be available?

Thanks

@bboreham
Copy link
Contributor

I would like @squeed to take one more look since he had a lot of comments earlier.

@jellonek
Copy link
Member

It would be nice to have at least test case which would describe such use type with explanation why in a particular case this plugin should work basically as a no-op.

@squeed squeed merged commit d41acb8 into containernetworking:master Jan 20, 2021
@pperiyasamy
Copy link
Contributor Author

Thanks for merging the fix. can you also merge its readme ?

@lynic
Copy link

lynic commented Jan 29, 2021

Is there any plan to support IPAM for DPDK interface in host-device cni? like k8snetworkplumbingwg/sriov-cni#142

mansikulkarni96 pushed a commit to mansikulkarni96/plugins that referenced this pull request Apr 18, 2022
This commit would make host-device plugin as a placeholder
for DPDK device when applications wants to attach it with
a pod container through network attachment definition.

Signed-off-by: Periyasamy Palanisamy <[email protected]>
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.