ipdk-io / ipdk

Infrastructure Programmer Development Kit (IPDK) is an open source, vendor agnostic framework of drivers and APIs for infrastructure offload and management that runs on a CPU, IPU, DPU or switch.
Apache License 2.0
183 stars 68 forks source link

P4-OVS does not create vhost-user sockets if P4-pipeline is already created #124

Open mestery opened 2 years ago

mestery commented 2 years ago

The way the existing demo works is that you have to use gnmi-cli to create the ports before you load the P4 pipeline into P4-OVS. However, what I'd like to do is create the P4 pipeline first (using both ovs_pipeline_builder and ovs-p4ctl and then using gnmi-cli to create the vhost-user ports. When I do this, P4-OVs fails to create the vhost-user ports.

Can someone explain the ordering oddness here?

mestery commented 2 years ago

Hi @Namrata-intel would you know who might understand this issue? Thanks!

vsureshkumarp commented 2 years ago

@mestery, P4 DPDK PIPELINE expects the port and pipeline configuration in the following sequence

  1. Create PIPELINE (By default P4 SDE will take care of this)
  2. Created ports and assigned them to the pipeline. (This happens when user triggers gnm-cli commands)
  3. Load Target binary
  4. Enable pipeline P4 SDE performs Steps 3 and 4 as part of ovs-p4ctl set-pipe command processing sequence.
mestery commented 2 years ago

Thanks for the info @vsureshkumarp! So, in terms of CLI commands, here is my understanding of how things work and the specific order in which they work:

  1. Start P4-OVS
  2. Create ports using gnmi-cli
  3. Run ovs_pipeline_builder to build the pipelines
  4. Launch VMs using the vhost-user ports created above
  5. Run ovs-p4ctl set-pipe
  6. Run ovs-p4ctl add-entry for each port

What I'd like to do instead is as follows:

  1. Start P4-OVS
  2. Run ovs_pipeline_builder to build the pipelines
  3. Run ovs-p4ctl set-pipe
  4. Create ports using gnmi-cli
  5. Run ovs-p4ctl add-entry for each port
  6. Launch VMs using the vhost-user ports created above

If I am integrating IPDK with an orchestrator of some kind, the hook to create ports will be used when the VM (or container) is launched, and at that time I want to create the vhost-user socket and add the pipeline entry. And when deleting the VM/container, at that time I want to remove the port from the pipeline and delete the vhost-user socket.

det-intel commented 2 years ago

This issue may be exposing a more fundamental concern about ordering dependencies for P4-OVS. The previous comments indicate that it may be required that ports be instantiated before the P4 pipeline be built and plumbed. Can we clarify if this is the case?

If so, this could be a problem in many environments. In hardware, for example, reconfiguring the speed of a port may change the port numbering. We should not require rebuilding or reinstalling the P4 program just because the speed of a port is changed. Similarly, in a virtual environment, the network connections to VMs or containers will be dynamic and shouldn't require changes to the running P4 pipeline.

If needed, we could split this issue into a low level one for investigating the specifics of vhost-user sockets and a higher one for deploying P4 pipelines via P4-OVS in general.

Namrata-intel commented 2 years ago

That is why have the patch for hotplug that we are working on on OVS github. That way we can create and hotplug ports into the VMs and the pipeline after VMs are up. Some of the dependencies will go away once we do that. After that goes in you could program your ports after you set your pipeline. The plan is to have the flexibility eventually.

mestery commented 2 years ago

@Namrata-intel Can someone push that patch out to P4-OVS so we can make use of it here? And also, it's not clear to me if we still need to track the higher level discussion which @det-intel brought up below:

This issue may be exposing a more fundamental concern about ordering dependencies for P4-OVS. The previous comments indicate that it may be required that ports be instantiated before the P4 pipeline be built and plumbed. Can we clarify if this is the case?

namratalimaye commented 2 years ago

https://github.com/ipdk-io/ovs/pull/21 - this is the patch. Still in works by @nupuruttarwar as it needs some code to be added to p4-dpdk-target opensource as well. I agree with @det-intel and we need to add the flexibility.