Message ID | 20250205163609.3208829-1-aleksander.lobakin@intel.com (mailing list archive) |
---|---|
Headers | show |
Series | bpf: cpumap: enable GRO for XDP_PASS frames | expand |
From: Alexander Lobakin <aleksander.lobakin@intel.com> Date: Wed, 5 Feb 2025 17:36:01 +0100 > Several months ago, I had been looking through my old XDP hints tree[0] > to check whether some patches not directly related to hints can be sent > standalone. Roughly at the same time, Daniel appeared and asked[1] about > GRO for cpumap from that tree. I see "Changes requested" on Patchwork. Which ones? 1/8 regarding gro_node? Nobody proposed a solution which would be as efficient, but avoid using struct_group(), I don't see such as well. I explain in the commitmsgs and cover letter everything. Jakub gave me Acked-by on struct_group() in the v3 thread. Thanks, Olek
On Mon, Feb 10, 2025 at 3:10 PM Alexander Lobakin <aleksander.lobakin@intel.com> wrote: > > From: Alexander Lobakin <aleksander.lobakin@intel.com> > Date: Wed, 5 Feb 2025 17:36:01 +0100 > > > Several months ago, I had been looking through my old XDP hints tree[0] > > to check whether some patches not directly related to hints can be sent > > standalone. Roughly at the same time, Daniel appeared and asked[1] about > > GRO for cpumap from that tree. > > I see "Changes requested" on Patchwork. Which ones? > > 1/8 regarding gro_node? Nobody proposed a solution which would be as > efficient, but avoid using struct_group(), I don't see such as well. > I explain in the commitmsgs and cover letter everything. Jakub gave me > Acked-by on struct_group() in the v3 thread. One of the points of your nice series is to dissociate GRO from NAPI, so defining gro_node inside napi_struct is not appealing. I suggested not putting napi_id in the new structure. If you need to cache a copy in it for "performance/whatever reason", you can cache napi_id, because napi->napi_id is only set once in __napi_hash_add_with_id() gro->napi_id_cache = napi->napi_id;
From: Eric Dumazet <edumazet@google.com> Date: Mon, 10 Feb 2025 16:31:22 +0100 > On Mon, Feb 10, 2025 at 3:10 PM Alexander Lobakin > <aleksander.lobakin@intel.com> wrote: >> >> From: Alexander Lobakin <aleksander.lobakin@intel.com> >> Date: Wed, 5 Feb 2025 17:36:01 +0100 >> >>> Several months ago, I had been looking through my old XDP hints tree[0] >>> to check whether some patches not directly related to hints can be sent >>> standalone. Roughly at the same time, Daniel appeared and asked[1] about >>> GRO for cpumap from that tree. >> >> I see "Changes requested" on Patchwork. Which ones? >> >> 1/8 regarding gro_node? Nobody proposed a solution which would be as >> efficient, but avoid using struct_group(), I don't see such as well. >> I explain in the commitmsgs and cover letter everything. Jakub gave me >> Acked-by on struct_group() in the v3 thread. > > One of the points of your nice series is to dissociate GRO from NAPI, > so defining gro_node inside napi_struct is not appealing. > > I suggested not putting napi_id in the new structure. > > If you need to cache a copy in it for "performance/whatever reason", > you can cache napi_id, because napi->napi_id is only set once > in __napi_hash_add_with_id() > > gro->napi_id_cache = napi->napi_id; This was rejected by Kuba in v2. He didn't like to have napi_id two times within napi_struct (one inside gro_node, one outside). Thanks, Olek
On Mon, 10 Feb 2025 16:31:52 +0100 Alexander Lobakin wrote: > This was rejected by Kuba in v2. > He didn't like to have napi_id two times within napi_struct (one inside > gro_node, one outside). Do you mean: the napi_id in gro sticks out.. https://lore.kernel.org/netdev/20250113130104.5c2c02e0@kernel.org/ ? That's more of a nudge to try harder than a "no". We explored the alternatives, there's no perfect way to layer this. I think Eric's suggestion is probably as clean as we can get.
From: Jakub Kicinski <kuba@kernel.org> Date: Mon, 10 Feb 2025 16:35:29 -0800 > On Mon, 10 Feb 2025 16:31:52 +0100 Alexander Lobakin wrote: >> This was rejected by Kuba in v2. >> He didn't like to have napi_id two times within napi_struct (one inside >> gro_node, one outside). > > Do you mean: > > the napi_id in gro sticks out.. > > https://lore.kernel.org/netdev/20250113130104.5c2c02e0@kernel.org/ ? > > That's more of a nudge to try harder than a "no". We explored > the alternatives, there's no perfect way to layer this. I think > Eric's suggestion is probably as clean as we can get. You mean to cache napi_id in gro_node? Then we get +8 bytes to sizeof(napi_struct) for little reason... Dunno, if you really prefer, I can do it that way. OTOH you gave Acked-by on struct_group(), then Eric appeared and you took your ack back :D Thanks, Olek
From: Alexander Lobakin <aleksander.lobakin@intel.com> Date: Wed, 12 Feb 2025 15:22:55 +0100 > From: Jakub Kicinski <kuba@kernel.org> > Date: Mon, 10 Feb 2025 16:35:29 -0800 > >> On Mon, 10 Feb 2025 16:31:52 +0100 Alexander Lobakin wrote: >>> This was rejected by Kuba in v2. >>> He didn't like to have napi_id two times within napi_struct (one inside >>> gro_node, one outside). >> >> Do you mean: >> >> the napi_id in gro sticks out.. >> >> https://lore.kernel.org/netdev/20250113130104.5c2c02e0@kernel.org/ ? >> >> That's more of a nudge to try harder than a "no". We explored >> the alternatives, there's no perfect way to layer this. I think >> Eric's suggestion is probably as clean as we can get. > > You mean to cache napi_id in gro_node? > > Then we get +8 bytes to sizeof(napi_struct) for little reason... Dunno, > if you really prefer, I can do it that way. Alternative to avoid +8 bytes: struct napi_struct { ... union { struct gro_node gro; struct { u8 pad[offsetof(struct gro_node, napi_id)]; u32 napi_id; }; }; This is effectively the same what struct_group() does, just more ugly. But allows to declare gro_node separately. > > OTOH you gave Acked-by on struct_group(), then Eric appeared and you > took your ack back :D Thanks, Olek
On Wed, 12 Feb 2025 16:55:52 +0100 Alexander Lobakin wrote: > > You mean to cache napi_id in gro_node? > > > > Then we get +8 bytes to sizeof(napi_struct) for little reason... Right but I think the expectation would be that we don't ever touch that on the fast path, right? The "real" napi_id would basically go down below: /* control-path-only fields follow */ 8B of cold data doesn't matter at all. But I haven't checked if we need the napi->napi_id access anywhere hot, do we? > > Dunno, if you really prefer, I can do it that way. > > Alternative to avoid +8 bytes: > > struct napi_struct { > ... > > union { > struct gro_node gro; > struct { > u8 pad[offsetof(struct gro_node, napi_id)]; > u32 napi_id; > }; > }; > > This is effectively the same what struct_group() does, just more ugly. > But allows to declare gro_node separately.
From: Jakub Kicinski <kuba@kernel.org> Date: Wed, 12 Feb 2025 10:29:36 -0800 > On Wed, 12 Feb 2025 16:55:52 +0100 Alexander Lobakin wrote: >>> You mean to cache napi_id in gro_node? >>> >>> Then we get +8 bytes to sizeof(napi_struct) for little reason... > > Right but I think the expectation would be that we don't ever touch > that on the fast path, right? The "real" napi_id would basically > go down below: > > /* control-path-only fields follow */ > > 8B of cold data doesn't matter at all. But I haven't checked if > we need the napi->napi_id access anywhere hot, do we? Hmm, if the "hot" napi_id will be in cached in gro_node, then maybe napi_struct::napi_id could really be in the cold part, let me recheck. > >>> Dunno, if you really prefer, I can do it that way. >> >> Alternative to avoid +8 bytes: >> >> struct napi_struct { >> ... >> >> union { >> struct gro_node gro; >> struct { >> u8 pad[offsetof(struct gro_node, napi_id)]; >> u32 napi_id; >> }; >> }; >> >> This is effectively the same what struct_group() does, just more ugly. >> But allows to declare gro_node separately. Thanks, Olek