Skip to content

net: bridge: mcast: support exponential field encoding

Ujjal Roy bridge linux-kselftest lkml netdev 6 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest5 patches 1 replyApplied 5/5
  2. v55 patches 5 repliesSuperseded
  3. v45 patches 6 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v35 patches10 repliesSuperseded
v25 patches11 repliesSuperseded
v14 patches3 repliesSuperseded

Changes in v6 from the cover letter

- Added Reviewed-by: Nikolay Aleksandrov <[email protected]>
- Previous thread can be found here:
https://lore.kernel.org/all/[email protected]/

Patches in v6 All 5 applied

#Subject and filesSizeRepliesApplied
1/5ipv4: igmp: get rid of IGMPV3_{QQIC,MRC} and simplify calculationinclude/linux/igmp.h net/bridge/br_multicast.c net/ipv4/igmp.c+76 -120 repliesApplied
2/5ipv6: mld: rename mldv2_mrc() and add mldv2_qqi()include/net/mld.h net/bridge/br_multicast.c net/ipv6/mcast.c+61 -260 repliesApplied
3/5ipv4: igmp: encode multicast exponential fieldsinclude/linux/igmp.h net/bridge/br_multicast.c+93 -80 repliesApplied
4/5ipv6: mld: encode multicast exponential fieldsinclude/net/mld.h net/bridge/br_multicast.c+121 -20 repliesApplied
5/5selftests: net: bridge: add MRC and QQIC field encoding teststools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh+132 -80 repliesApplied

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchNikolay AleksandrovIdo Schimmel
1/5R-b R-b
2/5R-b R-b
3/5R-b R-b
4/5R-b R-b
5/5R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH net-next v6 0/5] net: bridge: mcast: support exponential field encoding

Description:
This series addresses a mismatch in how multicast query intervals and response codes are handled across IPv4 (IGMPv3) and IPv6 (MLDv2). While decoding logic currently exists, the corresponding encoding logic is missing during query packet generation. This leads to incorrect intervals being transmitted when values exceed their linear thresholds.

The patches introduce a unified floating-point encoding approach based on RFC3376 and RFC3810, ensuring that large intervals are correctly represented in QQIC and MRC fields using the exponent-mantissa format.

Key Changes:
* ipv4: igmp: get rid of IGMPV3_{QQIC,MRC} and simplify calculation Removes legacy macros in favor of a cleaner, unified calculation for retrieving intervals from encoded fields, improving code maintainability.

* ipv6: mld: rename mldv2_mrc() and add mldv2_qqi() Standardizes MLDv2 terminology by renaming mldv2_mrc() to mldv2_mrd() (Maximum Response Delay) and introducing a new API mldv2_qqi for QQI calculation, improving code readability.

* ipv4: igmp: encode multicast exponential fields Introduces 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).

* ipv6: mld: encode multicast exponential fields Applies similar encoding logic for MLDv2. This ensures QQIC (8-bit) and MRC (16-bit) fields are properly encoded when transmitting query packets with intervals that exceed their respective linear thresholds (128 for QQI; 32768 for MRD).

* selftests: net: bridge: add MRC and QQIC field encoding tests Updates bridge selftests to validate both linear and non-linear (exponential) encoding for MRC and QQIC fields, ensuring protocol compliance across IGMPv3 and MLDv2.

Impact:
These changes ensure that multicast queriers and listeners stay synchronized on timing intervals, preventing protocol timeouts or premature group membership expiration caused by incorrectly formatted packet headers.

Test results:
Giving results only from modified API vlmc_query_intvl_test() and vlmc_query_response_intvl_test() of the script bridge_vlan_mcast.sh.

Using old Linux code, here is the result:

    - TEST: Vlan multicast snooping enable                                [ OK ]
    - TEST: Vlan mcast_query_interval global option default value         [ OK ]
    - TEST: Number of tagged IGMPv2 general query                         [ OK ]
    - TEST: IGMPv3 QQIC linear value 60(s)                                [ OK ]
    - TEST: MLDv2 QQIC linear value 60(s)                                 [ OK ]
    - TEST: IGMPv3 QQIC non linear value 160(s)                           [FAIL]

- Wrong QQIC in generated IGMPv3 general queries
- TEST: MLDv2 QQIC non linear value 160(s) [FAIL]
- Wrong QQIC in generated MLDv2 general queries
- TEST: Vlan mcast_query_response_interval global option default value [ OK ]
- TEST: IGMPv3 MRC linear value of 60(x0.1s) [ OK ]
- TEST: MLDv2 MRC linear value of 24000(ms) [ OK ]
- TEST: IGMPv3 MRC non linear value of 240(x0.1s) [FAIL]
- Wrong MRC in generated IGMPv3 general queries
- TEST: MLDv2 MRC non linear value of 48000(ms) [FAIL]
- Wrong MRC in generated MLDv2 general queries

Linux code with this patchset, here is the result:

    * TEST: Vlan multicast snooping enable                                [ OK ]
    * TEST: Vlan mcast_query_interval global option default value         [ OK ]
    * TEST: Number of tagged IGMPv2 general query                         [ OK ]
    * TEST: IGMPv3 QQIC linear value 60(s)                                [ OK ]
    * TEST: MLDv2 QQIC linear value 60(s)                                 [ OK ]
    * TEST: IGMPv3 QQIC non linear value 160(s)                           [ OK ]
    * TEST: MLDv2 QQIC non linear value 160(s)                            [ OK ]

* TEST: Vlan mcast_query_response_interval global option default value [ OK ]
* TEST: IGMPv3 MRC linear value of 60(x0.1s) [ OK ]
* TEST: MLDv2 MRC linear value of 24000(ms) [ OK ]
* TEST: IGMPv3 MRC non linear value of 240(x0.1s) [ OK ]
* TEST: MLDv2 MRC non linear value of 48000(ms) [ OK ]

v6:
- Added Reviewed-by: Nikolay Aleksandrov <[email protected]>
- Previous thread can be found here:
https://lore.kernel.org/all/[email protected]/

v5:
- Added 'Reviewed-by:' as requested
- Modified script to fix AND logic in classifiers and updated comments
- Passed expected value as argument rather than hard coding in script
- Added minor comments for macros

v4:
- Removed binary application and related codes for selftests
- Decided hard coded match based on extra arguments for selftests
- Ran shellcheck on modified selftests code and fixed
- Updated comments on patch[1,2,3,4] as per review
- Added 'Reviewed-by:' as requested on patch4

v3:
- Updated the series title for better clarity; old one is here
https://lore.kernel.org/all/[email protected]/
- Added key changes section for new selftests patch
- Updated netdev style comments and addressed review comments
- Fixed MLDv2 MRC conversion logic during query generation
- Mentioned intervals in units wherever applicable
- Dropped type casting and fixed indentations

v2:
- Retargeted the series to net-next as suggested
- Fixed a compilation warning in the MLD rename change
- Kept reverse xmas tree order in IGMP exponential encoding change
- Added bridge selftests to validate IGMPv3 Query MRC and QQIC handling

Ujjal Roy (5):
ipv4: igmp: get rid of IGMPV3_{QQIC,MRC} and simplify calculation
ipv6: mld: rename mldv2_mrc() and add mldv2_qqi()
ipv4: igmp: encode multicast exponential fields
ipv6: mld: encode multicast exponential fields
selftests: net: bridge: add MRC and QQIC field encoding tests

 include/linux/igmp.h                          | 167 +++++++++++++++-
 include/net/mld.h                             | 185 +++++++++++++++++-
 net/bridge/br_multicast.c                     |  22 +--
 net/ipv4/igmp.c                               |   6 +-
 net/ipv6/mcast.c                              |  19 +-
 .../net/forwarding/bridge_vlan_mcast.sh       | 140 ++++++++++++-
 6 files changed, 483 insertions(+), 56 deletions(-)

base-commit: 0f19519fdd22bc0f5429377da3a52327c5eee166

Signature · 1 line
2.43.0