Message ID | 20210526171640.9722-1-justin.iurman@uliege.be |
---|---|
Headers | show |
Series | Support for the IOAM Pre-allocated Trace with IPv6 | expand |
On Wed, 26 May 2021 19:16:39 +0200 Justin Iurman wrote: > Add support for the IOAM inline insertion (only for the host-to-host use case) > which is per-route configured with lightweight tunnels. The target is iproute2 > and the patch is ready. It will be posted as soon as this patchset is merged. > Here is an overview: > > $ ip -6 ro ad fc00::1/128 encap ioam6 trace type 0x800000 ns 1 size 12 dev eth0 > > This example configures an IOAM Pre-allocated Trace option attached to the > fc00::1/128 prefix. The IOAM namespace (ns) is 1, the size of the pre-allocated > trace data block is 12 octets (size) and only the first IOAM data (bit 0: > hop_limit + node id) is included in the trace (type) represented as a bitfield. > > The reason why the in-transit (IPv6-in-IPv6 encapsulation) use case is not > implemented is explained on the patchset cover. > > Signed-off-by: Justin Iurman <justin.iurman@uliege.be> Please address the warnings from checkpatch --strict on this patches. For all patches please make sure you don't use static inline in C files, and let the compiler decide what to inline by itself. > + if (trace->type.bit0) trace->nodelen += sizeof(__be32) / 4; > + if (trace->type.bit1) trace->nodelen += sizeof(__be32) / 4; > + if (trace->type.bit2) trace->nodelen += sizeof(__be32) / 4; > + if (trace->type.bit3) trace->nodelen += sizeof(__be32) / 4; > + if (trace->type.bit4) trace->nodelen += sizeof(__be32) / 4; > + if (trace->type.bit5) trace->nodelen += sizeof(__be32) / 4; > + if (trace->type.bit6) trace->nodelen += sizeof(__be32) / 4; > + if (trace->type.bit7) trace->nodelen += sizeof(__be32) / 4; > + if (trace->type.bit8) trace->nodelen += sizeof(__be64) / 4; > + if (trace->type.bit9) trace->nodelen += sizeof(__be64) / 4; > + if (trace->type.bit10) trace->nodelen += sizeof(__be64) / 4; > + if (trace->type.bit11) trace->nodelen += sizeof(__be32) / 4; Seems simpler to do: nodelen += hweight16(field & MASK1) * (sizeof(__be32) / 4); nodelen += hweight16(field & MASK2) * (sizeof(__be64) / 4);
On Wed, 26 May 2021 17:34:02 -0700 Jakub Kicinski wrote:
> Please address the warnings from checkpatch --strict on this patches.
I meant to say "this patch", the warnings in patch 1 seem to be related
to unnamed bitfields, those can be ignored.
> On Wed, 26 May 2021 19:16:39 +0200 Justin Iurman wrote: >> Add support for the IOAM inline insertion (only for the host-to-host use case) >> which is per-route configured with lightweight tunnels. The target is iproute2 >> and the patch is ready. It will be posted as soon as this patchset is merged. >> Here is an overview: >> >> $ ip -6 ro ad fc00::1/128 encap ioam6 trace type 0x800000 ns 1 size 12 dev eth0 >> >> This example configures an IOAM Pre-allocated Trace option attached to the >> fc00::1/128 prefix. The IOAM namespace (ns) is 1, the size of the pre-allocated >> trace data block is 12 octets (size) and only the first IOAM data (bit 0: >> hop_limit + node id) is included in the trace (type) represented as a bitfield. >> >> The reason why the in-transit (IPv6-in-IPv6 encapsulation) use case is not >> implemented is explained on the patchset cover. >> >> Signed-off-by: Justin Iurman <justin.iurman@uliege.be> > > Please address the warnings from checkpatch --strict on this patches. My mistake, I'll do that. > For all patches please make sure you don't use static inline in C > files, and let the compiler decide what to inline by itself. Will do as well. >> + if (trace->type.bit0) trace->nodelen += sizeof(__be32) / 4; >> + if (trace->type.bit1) trace->nodelen += sizeof(__be32) / 4; >> + if (trace->type.bit2) trace->nodelen += sizeof(__be32) / 4; >> + if (trace->type.bit3) trace->nodelen += sizeof(__be32) / 4; >> + if (trace->type.bit4) trace->nodelen += sizeof(__be32) / 4; >> + if (trace->type.bit5) trace->nodelen += sizeof(__be32) / 4; >> + if (trace->type.bit6) trace->nodelen += sizeof(__be32) / 4; >> + if (trace->type.bit7) trace->nodelen += sizeof(__be32) / 4; >> + if (trace->type.bit8) trace->nodelen += sizeof(__be64) / 4; >> + if (trace->type.bit9) trace->nodelen += sizeof(__be64) / 4; >> + if (trace->type.bit10) trace->nodelen += sizeof(__be64) / 4; >> + if (trace->type.bit11) trace->nodelen += sizeof(__be32) / 4; > > Seems simpler to do: > > nodelen += hweight16(field & MASK1) * (sizeof(__be32) / 4); > nodelen += hweight16(field & MASK2) * (sizeof(__be64) / 4); Indeed, I didn't know this macro. Will post a rev ASAP. Thanks Jakub for the feedback, I appreciate. Justin