Re: [RFC PATCH bpf-next v1 2/3] net: assign enum to skb->tstamp_type to distinguish between tstamp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 4/10/2024 8:35 AM, Willem de Bruijn wrote:
> Abhishek Chauhan wrote:
>> As we are renaming the mono_delivery_time to tstamp_type, it makes
>> sense to start assigning tstamp_type based out if enum defined as
>> part of this commit
>>
>> Earlier we used bool arg flag to check if the tstamp is mono in
>> function skb_set_delivery_time, Now the signature of the functions
>> accepts enum to distinguish between mono and real time.
>>
>> Link: https://lore.kernel.org/netdev/bc037db4-58bb-4861-ac31-a361a93841d3@xxxxxxxxx/
>> Signed-off-by: Abhishek Chauhan <quic_abchauha@xxxxxxxxxxx>
>> ---
>>  include/linux/skbuff.h                     | 13 +++++++++----
>>  net/bridge/netfilter/nf_conntrack_bridge.c |  2 +-
>>  net/core/dev.c                             |  2 +-
>>  net/core/filter.c                          |  4 ++--
>>  net/ipv4/ip_output.c                       |  2 +-
>>  net/ipv4/tcp_output.c                      | 14 +++++++-------
>>  net/ipv6/ip6_output.c                      |  2 +-
>>  net/ipv6/tcp_ipv6.c                        |  2 +-
>>  net/sched/act_bpf.c                        |  2 +-
>>  net/sched/cls_bpf.c                        |  2 +-
>>  10 files changed, 25 insertions(+), 20 deletions(-)
>>
>> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
>> index 8210d699d8e9..6160185f0fe0 100644
>> --- a/include/linux/skbuff.h
>> +++ b/include/linux/skbuff.h
>> @@ -701,6 +701,11 @@ typedef unsigned int sk_buff_data_t;
>>  #else
>>  typedef unsigned char *sk_buff_data_t;
>>  #endif
>> +
>>
>>
>> +enum skb_tstamp_type {
>> +	SKB_TSTAMP_TYPE_RX_REAL = 0,    /* A RX (receive) time in real */
>> +	SKB_TSTAMP_TYPE_TX_MONO = 1,    /* A TX (delivery) time in mono */
>> +};
> 
> I'd drop the RX_/TX_. This is just a version of clockid_t, compressed
> to minimize space taken in sk_buff. Simpler to keep to the CLOCK_..
> types. Where a clock was set (TX vs RX) is not relevant to the code
> that later references skb->tstamp.
> 
Make sense. tstamp can be either mono, real , tai ... etc . Directionality doesnt matter
Let me check this and update. 

>>  static inline void skb_set_delivery_time(struct sk_buff *skb, ktime_t kt,
>> -					 bool mono)
>> +					enum skb_tstamp_type tstamp_type)
>>  {
>>  	skb->tstamp = kt;
>> -	skb->tstamp_type = kt && mono;
>> +	skb->tstamp_type = kt && tstamp_type;
> 
> Already introduce a switch here?
> 
I will introduce a switch here based on tstamp_type passed. 

> 




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux