[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9bb827bfc79345d02a063650990de68ce2386ddb.camel@redhat.com>
Date: Thu, 29 Feb 2024 16:09:31 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Jamal Hadi Salim <jhs@...atatu.com>, netdev@...r.kernel.org
Cc: deb.chatterjee@...el.com, anjali.singhai@...el.com,
namrata.limaye@...el.com, tom@...anda.io, mleitner@...hat.com,
Mahesh.Shirshyad@....com, Vipin.Jain@....com, tomasz.osinski@...el.com,
jiri@...nulli.us, xiyou.wangcong@...il.com, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, vladbu@...dia.com, horms@...nel.org,
khalidm@...dia.com, toke@...hat.com, daniel@...earbox.net,
victor@...atatu.com, pctammela@...atatu.com, bpf@...r.kernel.org
Subject: Re: [PATCH net-next v12 06/15] p4tc: add P4 data types
On Sun, 2024-02-25 at 11:54 -0500, Jamal Hadi Salim wrote:
> Introduce abstraction that represents P4 data types.
> This also introduces the Kconfig and Makefile which later patches use.
> Numeric types could be little, host or big endian definitions. The abstraction
> also supports defining:
>
> a) bitstrings using P4 annotations that look like "bit<X>" where X
> is the number of bits defined in a type
>
> b) bitslices such that one can define in P4 as bit<8>[0-3] and
> bit<16>[4-9]. A 4-bit slice from bits 0-3 and a 6-bit slice from bits
> 4-9 respectively.
>
> c) speacialized types like dev (which stands for a netdev), key, etc
>
> Each type has a bitsize, a name (for debugging purposes), an ID and
> methods/ops. The P4 types will be used by externs, dynamic actions, packet
> headers and other parts of P4TC.
>
> Each type has four ops:
>
> - validate_p4t: Which validates if a given value of a specific type
> meets valid boundary conditions.
>
> - create_bitops: Which, given a bitsize, bitstart and bitend allocates and
> returns a mask and a shift value. For example, if we have type
> bit<8>[3-3] meaning bitstart = 3 and bitend = 3, we'll create a mask
> which would only give us the fourth bit of a bit8 value, that is, 0x08.
> Since we are interested in the fourth bit, the bit shift value will be 3.
> This is also useful if an "irregular" bitsize is used, for example,
> bit24. In that case bitstart = 0 and bitend = 23. Shift will be 0 and
> the mask will be 0xFFFFFF00 if the machine is big endian.
>
> - host_read : Which reads the value of a given type and transforms it to
> host order (if needed)
>
> - host_write : Which writes a provided host order value and transforms it
> to the type's native order (if needed)
The type has a 'print' op, but I can't easily find where such op is
used and its role?!?
Thanks,
Paolo
Powered by blists - more mailing lists