On Wed, 20 Jan 2021 11:14:37 +0200 Ido Schimmel wrote: > On Tue, Jan 19, 2021 at 02:22:55PM -0800, Jakub Kicinski wrote: > > On Sun, 17 Jan 2021 10:02:18 +0200 Ido Schimmel wrote: > > > From: Ido Schimmel <ido...@nvidia.com> > > > > > > The RED qdisc currently supports two qevents: "early_drop" and "mark". The > > > filters added to the block bound to the "early_drop" qevent are executed > > > on > > > packets for which the RED algorithm decides that they should be > > > early-dropped. The "mark" filters are similarly executed on ECT packets > > > that are marked as ECN-CE (Congestion Encountered). > > > > > > A previous patchset has offloaded "early_drop" filters on Spectrum-2 and > > > later, provided that the classifier used is "matchall", that the action > > > used is either "trap" or "mirred", and a handful or further limitations. > > > > For early_drop trap or mirred makes obvious sense, no explanation > > needed. > > > > But for marked as a user I'd like to see a _copy_ of the packet, > > while the original continues on its marry way to the destination. > > I'd venture to say that e.g. for a DCTCP deployment mark+trap is > > unusable, at least for tracing, because it distorts the operation > > by effectively dropping instead of marking. > > > > Am I reading this right? > > You get a copy of the packet as otherwise it will create a lot of > problems (like you wrote).
Hm, so am I missing some background on semantics on TC_ACT_TRAP? Or perhaps you use a different action code? AFAICT the code in the kernel is: struct sk_buff *tcf_qevent_handle(... case TC_ACT_STOLEN: case TC_ACT_QUEUED: case TC_ACT_TRAP: __qdisc_drop(skb, to_free); *ret = __NET_XMIT_STOLEN; return NULL; Having TRAP mean DROP makes sense for filters, but in case of qevents shouldn't they be a no-op? Looking at sch_red looks like TRAP being a no-op would actually give us the expected behavior. > > If that is the case and you really want to keep the mark+trap > > functionality - I feel like at least better documentation is needed. > > The current two liner should also be rewritten, quoting from patch 1: > > > > > * - ``ecn_mark`` > > > - ``drop`` > > > - Traps ECN-capable packets that were marked with CE (Congestion > > > Encountered) code point by RED algorithm instead of being dropped > > > > That needs to say that the trap is for datagrams trapped by a qevent. > > Otherwise "Traps ... instead of being dropped" is too much of a > > thought-shortcut, marked packets are not dropped. > > > > (I'd also think that trap is better documented next to early_drop, > > let's look at it from the reader's perspective) > > How about: > > "Traps a copy of ECN-capable packets that were marked with CE I think "Traps copies" or "Traps the copy of .. packet"? I'm not a native speaker but there seems to be a grammatical mix here. > (Congestion Encountered) code point by RED algorithm instead of being > dropped. The trap is enabled by attaching a filter with action 'trap' to ... instead of those copies being dropped. > the 'mark' qevent of the RED qdisc." > > In addition, this output: > > $ devlink trap show pci/0000:06:00.0 trap ecn_mark > pci/0000:06:00.0: > name ecn_mark type drop generic true action trap group buffer_drops > > Can be converted to: > > $ devlink trap show pci/0000:06:00.0 trap ecn_mark > pci/0000:06:00.0: > name ecn_mark type drop generic true action mirror group buffer_drops > > "mirror: The packet is forwarded by the underlying device and a copy is sent > to > the CPU." > > In this case the action is static and you cannot change it. Oh yes, that's nice, I thought mirror in traps means mirror to another port. Are there already traps which implement the mirroring / trapping a clone? Quick grep yields nothing of substance.