From: Ido Schimmel <idosch@nvidia.com>
To: Ujjal Roy <royujjal@gmail.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Nikolay Aleksandrov <razor@blackwall.org>,
David Ahern <dsahern@kernel.org>, Shuah Khan <shuah@kernel.org>,
Andy Roulin <aroulin@nvidia.com>, Yong Wang <yongwang@nvidia.com>,
Petr Machata <petrm@nvidia.com>, Ujjal Roy <ujjal@alumnux.com>,
bridge@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net-next v2 3/5] ipv4: igmp: encode multicast exponential fields
Date: Wed, 1 Apr 2026 10:27:11 +0300 [thread overview]
Message-ID: <20260401072711.GC1725933@shredder> (raw)
In-Reply-To: <20260330191611.16929-4-royujjal@gmail.com>
On Mon, Mar 30, 2026 at 07:16:09PM +0000, Ujjal Roy wrote:
> In IGMP, QQIC and MRC fields are not currently encoded
s/currently/correctly/ ?
> when generating query packets. Since the receiver of the
> query interprets these fields using the IGMPv3 floating-
> point decoding logic, any raw interval value that exceeds
> the linear threshold is currently parsed incorrectly as
> an exponential value, leading to an incorrect interval
> calculation.
>
> Encode and assign the corresponding protocol fields during
> query generation. Introduce the logic to dynamically
> calculate the exponent and mantissa using bit-scan (fls).
> This ensures QQIC and MRC fields (8-bit) are properly
> encoded when transmitting query packets with intervals
> that exceed their respective linear threshold value of
> 128 (for QQI/MRT).
>
> RFC 3376: if QQIC/MRC >= 128, the QQIC/MRC field represents
> a floating-point value as follows:
> 0 1 2 3 4 5 6 7
> +-+-+-+-+-+-+-+-+
> |1| exp | mant |
> +-+-+-+-+-+-+-+-+
>
> Signed-off-by: Ujjal Roy <royujjal@gmail.com>
[...]
> +static inline u8 igmpv3_exp_field_encode(unsigned long value)
> +{
> + u8 mc_exp, mc_man;
> +
> + /* RFC3376: QQIC/MRC < 128 is literal */
> + if (value < IGMPV3_EXP_MIN_THRESHOLD)
> + return (u8)value;
return value;
> +
> + /* Saturate at max representable (mant = 0xF, exp = 7) -> 31744 */
> + if (value >= IGMPV3_EXP_MAX_THRESHOLD)
> + return 0xFF;
> +
> + mc_exp = (u8)(fls(value) - 8);
> + mc_man = (u8)((value >> (mc_exp + 3)) & 0x0F);
Drop the casts?
Same in other places throughout the patchset.
> +
> + return 0x80 | (mc_exp << 4) | mc_man;
> +}
next prev parent reply other threads:[~2026-04-01 7:27 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-26 15:07 [PATCH 0/4] net: bridge: mcast: add multicast exponential field encoding Ujjal Roy
2026-03-26 15:07 ` [PATCH 1/4] ipv4: igmp: get rid of IGMPV3_{QQIC,MRC} and simplify calculation Ujjal Roy
2026-03-26 15:07 ` [PATCH 2/4] ipv6: mld: rename mldv2_mrc() and add mldv2_qqi() Ujjal Roy
2026-03-27 15:49 ` kernel test robot
2026-03-26 15:07 ` [PATCH 3/4] ipv4: igmp: encode multicast exponential fields Ujjal Roy
2026-03-27 12:19 ` Nikolay Aleksandrov
2026-03-30 19:16 ` [PATCH net-next v2 0/5] net: bridge: mcast: add multicast exponential field encoding Ujjal Roy
2026-03-30 19:16 ` [PATCH net-next v2 1/5] ipv4: igmp: get rid of IGMPV3_{QQIC,MRC} and simplify calculation Ujjal Roy
2026-04-01 7:25 ` Ido Schimmel
2026-03-30 19:16 ` [PATCH net-next v2 2/5] ipv6: mld: rename mldv2_mrc() and add mldv2_qqi() Ujjal Roy
2026-04-01 7:26 ` Ido Schimmel
2026-03-30 19:16 ` [PATCH net-next v2 3/5] ipv4: igmp: encode multicast exponential fields Ujjal Roy
2026-04-01 7:27 ` Ido Schimmel [this message]
2026-03-30 19:16 ` [PATCH net-next v2 4/5] ipv6: mld: " Ujjal Roy
2026-04-01 7:29 ` Ido Schimmel
2026-03-30 19:16 ` [PATCH net-next v2 5/5] selftests: net: bridge: add tests for igmpv3 MRC and QQIC validation Ujjal Roy
2026-03-31 14:13 ` Ido Schimmel
2026-04-03 7:50 ` Ujjal Roy
2026-04-03 10:19 ` Ido Schimmel
2026-04-03 10:31 ` Ujjal Roy
2026-03-30 19:39 ` [PATCH net-next v2 0/5] net: bridge: mcast: add multicast exponential field encoding Ujjal Roy
2026-03-31 14:16 ` Ido Schimmel
2026-04-04 17:25 ` Ujjal Roy
2026-03-26 15:07 ` [PATCH 4/4] ipv6: mld: encode multicast exponential fields Ujjal Roy
2026-03-27 6:41 ` [PATCH 0/4] net: bridge: mcast: add multicast exponential field encoding Nikolay Aleksandrov
2026-03-27 11:31 ` Nikolay Aleksandrov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260401072711.GC1725933@shredder \
--to=idosch@nvidia.com \
--cc=aroulin@nvidia.com \
--cc=bridge@lists.linux.dev \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=razor@blackwall.org \
--cc=royujjal@gmail.com \
--cc=shuah@kernel.org \
--cc=ujjal@alumnux.com \
--cc=yongwang@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.