Jamal Hadi Salim wrote: > > Sorry - didnt read every detail of this thread so i may > be missing something. > > On 2019-10-22 12:54 p.m., John Fastabend wrote: > > Toshiaki Makita wrote: > >> On 2019/10/19 0:22, John Fastabend wrote: > >>> Toshiaki Makita wrote: > >>>> This is a PoC for an idea to offload flow, i.e. TC flower and nftables, > >>>> to XDP. > >>>> > > > > > I don't know who this "someone" is that wants to use XDP through TC > > flower or nftables transparently. TC at least is not known for a > > great uapi. > > > The uapi is netlink. You may be talking about lack of a friendly > application library that abstracts out concepts? Correct, sorry was not entirely precise. I've written tooling on top of the netlink API to do what is needed and it worked out just fine. I think it would be interesting (in this context of flower vs XDP vs u32, etc.) to build a flow API that abstracts tc vs XDP away and leverages the correct lower level mechanics as needed. Easier said than done of course. > > > It seems to me that it would be a relatively small project > > to write a uapi that ran on top of a canned XDP program to add > > flow rules. This could match tc cli if you wanted but why not take > > the opportunity to write a UAPI that does flow management well. > > > > Disagreement: > Unfortunately legacy utilities and apps cant just be magically wished > away. There's a lot of value in transparently making them work with > new infrastructure. My usual exaggerated pitch: 1000 books have been > written on this stuff, 100K people have RH certificates which entitle > them to be "experts"; dinasour kernels exist in data centres and > (/giggle) "enteprise". You cant just ignore all that. But flower itself is not so old. > > Summary: there is value in what Toshiaki is doing. > > I am disappointed that given a flexible canvas like XDP, we are still > going after something like flower... if someone was using u32 as the > abstraction it will justify it a lot more in my mind. > Tying it to OVS as well is not doing it justice. William Tu worked on doing OVS natively in XDP at one point and could provide more input on the pain points. But seems easier to just modify OVS vs adding kernel shim code to take tc to xdp IMO. > > Agreement: > Having said that I dont think that flower/OVS should be the interface > that XDP should be aware of. Neither do i agree that kernel "real > estate" should belong to Oneway(TM) of doing things (we are still stuck > with netfilter planting the columbus flag on all networking hooks). > Let 1000 flowers bloom. > So: couldnt Toshiaki's requirement be met with writting a user space > daemon that trampolines flower to "XDP format" flow transforms? That way > in the future someone could add a u32->XDP format flow definition and we > are not doomed to forever just use flower. A user space daemon I agree would work. > > >> To some extent yes, but not completely. Flow insertion from userspace > >> triggered by datapath upcall is necessary regardless of whether we use > >> TC or not. > > > > Right but these are latency involved with OVS architecture not > > kernel implementation artifacts. Actually what would be an interesting > > metric would be to see latency of a native xdp implementation. > > > > I don't think we should add another implementation to the kernel > > that is worse than what we have. > > > > > > xdp_flow TC ovs kmod > > -------- -------- -------- > > 22ms 6ms 0.6ms > > > > TC is already order of magnitude off it seems :( > > > > > > If ovs_kmod is .6ms why am I going to use something that is 6ms or > > 22ms. > > I am speculating having not read Toshiaki's code. > The obvious case for the layering is for policy management. > As you go upwards hw->xdp->tc->userspace->remote control > your policies get richer and the resolved policies pushed down > are more resolved. I am guessing the numbers we see above are > for that first packet which is used as a control packet. > An automonous system like this is of course susceptible to > attacks. Agree but still first packets happen and introducing latency spikes when we have a better solution around should be avoided. > > The workaround would be to preload the rules, but even then > you will need to deal with resource constraints. Comparison > would be like hierarchies of cache to RAM: L1/2/3 before RAM. > To illustrate: Very limited fastest L1 (aka NIC offload), > Limited faster L2 (XDP algorithms), L3 being tc and RAM being > the user space resolution. Of course. > > >I expect a native xdp implementation using a hash map to be > > inline with ovs kmod if not better. > > Hashes are good for datapath use cases but not when you consider > a holistic access where you have to worry about control aspect. Whats the "right" data structure? We can build it in XDP if its useful/generic. tc flower doesn't implement the saem data structures as ovs kmod as far as I know. Thanks! > > cheers, > jamal