On 11/28/23 13:37, Jesper Dangaard Brouer wrote:
Hi Daniel,
I'm trying to understand why skb_metadata_differs() needed to block GRO ?
I was looking at XDP storing information in metadata area that also
survives into SKBs layer. E.g. the RX timestamp.
Then I noticed that GRO code (gro_list_prepare) will not allow
aggregating if metadata isn't the same in all packets via
skb_metadata_differs(). Is this really needed?
Can we lift/remove this limitation?
(Answering myself)
I understand/see now, that when an SKB gets GRO aggregated, I will
"lose" access to the metadata information and only have access to the
metadata in the "first" SKB.
Thus, GRO layer still needs this check and it cannot know if the info
was important or not.
I wonder if there is a BPF hook, prior to GRO step, that could allow me
to extract variable metadata and zero it out before GRO step.
E.g. if I want to store a timestamp, then it will differ per packet.
--Jesper
Git history says it dates back to the original commit that added meta
pointer de8f3a83b0a0 ("bpf: add meta pointer for direct access") (author
Daniel).
diff --git a/net/core/gro.c b/net/core/gro.c
index 0759277dc14e..7fb6a6a24288 100644
--- a/net/core/gro.c
+++ b/net/core/gro.c
@@ -341,7 +341,7 @@ static void gro_list_prepare(const struct list_head
*head,
diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev;
diffs |= p->vlan_all ^ skb->vlan_all;
- diffs |= skb_metadata_differs(p, skb);
+ diffs |= skb_metadata_differs(p, skb); // Why?
if (maclen == ETH_HLEN)
diffs |= compare_ether_header(skb_mac_header(p),