[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dcb4e008-1f2a-4a29-bc91-5a29183b687a@ovn.org>
Date: Mon, 8 Apr 2024 22:28:40 +0200
From: Ilya Maximets <i.maximets@....org>
To: Adrian Moreno <amorenoz@...hat.com>, netdev@...r.kernel.org
Cc: i.maximets@....org, jiri@...nulli.us, xiyou.wangcong@...il.com,
cmi@...dia.com, yotam.gi@...il.com, aconole@...hat.com, echaudro@...hat.com,
horms@...nel.org
Subject: Re: [RFC net-next v2 3/5] net: psample: add user cookie
On 4/8/24 21:28, Adrian Moreno wrote:
>
>
> On 4/8/24 15:19, Ilya Maximets wrote:
>> [copying my previous reply since this version actually has netdev@ in Cc]
>>
>> On 4/8/24 14:57, Adrian Moreno wrote:
>>> Add a user cookie to the sample metadata so that sample emitters can
>>> provide more contextual information to samples.
>>>
>>> If present, send the user cookie in a new attribute:
>>> PSAMPLE_ATTR_USER_COOKIE.
>>>
>>> Signed-off-by: Adrian Moreno <amorenoz@...hat.com>
>>> ---
>>> include/net/psample.h | 2 ++
>>> include/uapi/linux/psample.h | 1 +
>>> net/psample/psample.c | 12 +++++++++++-
>>> 3 files changed, 14 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/include/net/psample.h b/include/net/psample.h
>>> index 0509d2d6be67..2503ab3c92a5 100644
>>> --- a/include/net/psample.h
>>> +++ b/include/net/psample.h
>>> @@ -25,6 +25,8 @@ struct psample_metadata {
>>> out_tc_occ_valid:1,
>>> latency_valid:1,
>>> unused:5;
>>> + u8 *user_cookie;
>>
>> The code doesn't take ownership of this data. It should probably
>> be a const pointer in this case.
>>
>> This should also allow us to avoid a double copy first to the
>> psample_metadata and then to netlink skb, as users will know that
>> it is a const pointer and so they can hand the data directly.
>>
>
> Yep. You're right.
>
>
>>> + u32 user_cookie_len;
BTW, u32 looks a little strange here and by extension in tc and OVS
as well. We can't push move than 64K through netlink, AFAIK, so
u16 should be plenty here. In practice, I hope, we'll not go over
u8 though.
Best regards, Ilya Maximets.
Powered by blists - more mailing lists