tc and bpf questions

"Brian G. Merrell" <[email protected]> Tue, 09 Mar 2021 02:43:41 +0000
Newsgroups org.kernel.vger.lartc
Message-ID <[email protected]>
Hi,

I have a couple of questions related to using bpf programs with tc.
Apologies in advance because I am brand new to tc.

1. I've noticed that a lot of user space tools that orchestrate bpf
   programs rely on bpf_tail_call to chain bpf programs together.
   However, I see that tc has its own chaining mechanism. Is there any
   downside to using tc's chaining mechanism instead of bpf_tail_calls?
   
   For some context, I'm working on one such user space orchestration
   tool, and I would prefer that the bpf programs themselves don't need
   to have the logic to do the chaining.

2. Sorry if this question is really naive, but I'm having trouble
   finding documentation about tc chaining in general:

   How does chain modification work? Say I have a chain of three BPF
   programs handling traffic: A->B->C, and I want to reorder them to
   A->C->B. What would be the proper way to do that, and could it be
   done (nearly) atomically? My guess is that I would be able to build
   up a new class or qdisc that's not taking traffic, then add my bpf
   programs in the new order, and then replace my original class or
   qdisc with the new one. I wouldn't exactly know how to do that, but
   am I even close?

Thanks so much for any advice; I think it will really help me get my
bearings here.

-Brian