On Sat, Sep 26, 2020 at 09:18:15PM +0300, Vladimir Oltean wrote: > On Sat, Sep 26, 2020 at 08:05:45PM +0200, Andrew Lunn wrote: > > Given spectra and meltdown etc, jumping through a pointer is expensive > > and we try to avoid it on the hot path. Given most of the taggers are > > going to use the generic version, maybe add a test here, is > > ops->flow_dissect the generic version, and if so, call it directly, > > rather than go through the pointer. Or only set ops->flow_dissect if > > the generic version cannot be used. > > Agree about the motivation to eliminate an indirect call if possible. > > The situation is as follows: > - Some taggers are before DMAC or before EtherType. These are the vast > majority, and dsa_tag_generic_flow_dissect works well for them. We can > keep the .flow_dissect callback as an override, but if this is absent, > then the flow dissector can call dsa_tag_generic_flow_dissect > directly. > - Some taggers use tail tags. These don't need any massaging at all. But > we need to tell the flow dissector to not call > dsa_tag_generic_flow_dissect if it doesn't find a function pointer. > I'm thinking about adding another "bool tail_tag" in struct > dsa_device_ops, for this purpose and not only*. > *Usually tunnel interfaces need to set dev->needed_headroom for the > memory allocator. But DSA doesn't request that, and needs to check > manually in the xmit function if the headroom is large enough to push > a tag. BUT! tail tags don't need dev->needed_headroom, they need > dev->needed_tailroom, I think. So I was thinking about adding this > bool anyway, to distinguish between these 2 cases. > > What do you think?
Sounds good. Andrew