[ovs-dev] attaching ebpf program to openvswitch vport driver

William Tu u9012063 at gmail.com
Tue Dec 17 16:27:00 UTC 2019


On Tue, Dec 17, 2019 at 07:59:42AM -0800, William Tu wrote:
> On Tue, Dec 17, 2019 at 09:14:00AM -0500, Nicolas Bouliane wrote:
> > >
> > >
> > > type of this port?
> > >
> > Internal
> > 
> > We need to have an IP address set on the interface, which is why we use the
> > internal type.
> > 
> > 
> > > Can you share your "ovs-vsctl show"
> > > If meta0 is "type: internal", then it doesn't work.
> > >
> > 
> >         Port "meta0"
> >             Interface "meta0"
> >                 type: internal
> > 
> > >
> > > I think other types, such as system or tunnel port
> > > should work (the xdpgeneric should see packets)
> > >
> > 
> > Is there a fundamental reason why the 'internal' type doesn't work ?
> > Is it something that could be modified at the driver level ?
> > Any pointer to get me started in that direction ?
> > 
> > thanks !
> > Nick
> 
> because internal port is a loopback device, and packet
> does not go through linux tc qdisc. So the attached ebpf
> program through tc does not work.
> Attach XDP program also does not work. 
> 
> see the .send function.
> net/openvswitch/vport-internal_dev.c
> static struct vport_ops ovs_internal_vport_ops = { 
>     .type       = OVS_VPORT_TYPE_INTERNAL,
>     .create     = internal_dev_create,
>     .destroy    = internal_dev_destroy,
>     .send       = internal_dev_recv,
> };
> 
> May I know your use case?
> William

In function internal_dev_recv, currently it calls
netif_rx(skb)
and this skips the generic xdp code path.

I wonder if it's ok to replace netif_rx with
netif_receive_skb(skb)
Then the generic xdp should work.

Regards,
William


More information about the dev mailing list