Skip to content

RDKB-65989: Move MAP-T ratio calculation to WanManager from DHCPManager - #142

Open
sivaraj-comcast wants to merge 3 commits into
developfrom
fix/RDKB-65989
Open

RDKB-65989: Move MAP-T ratio calculation to WanManager from DHCPManager#142
sivaraj-comcast wants to merge 3 commits into
developfrom
fix/RDKB-65989

Conversation

@sivaraj-comcast

@sivaraj-comcast sivaraj-comcast commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

RDKB-65989: Move MAP-T ratio calculation to WanManager from DHCPManager

Reason for change: Remove duplicated ratio computation from DHCPManager. DHCPManager now sends ratio=0 in the rbus event; WanManager derives ratio from psidLen as the single authoritative owner.

Test Procedure: Verify "sysevent get mapt_ratio" and Device.MAP.Domain.1.Rule.1.X_RDKCENTRAL-COM_Ratio / Device.DHCPv6.Client.1.X_RDKCENTRAL-COM_RcvOption.MapRatio is correctly set by WanManager after MAPT is configured.
Risks: Low
Priority: P1
Signed-off-by: Sivaraj_Sivalingam@comcast.com

RDKB-65989: Move MAP-T ratio calculation to WanManager from DHCPManager

Reason for change: Remove duplicated ratio computation from DHCPManager.
DHCPManager now sends ratio=0 in the rbus event; WanManager derives ratio
from eaLen/v4Len/psidLen as the single authoritative owner.

Test Procedure:
1. Verify SYSEVENT_MAPT_RATIO and Device.MAP.Domain.1.Rule.1.X_RDKCENTRAL-COM_Ratio / Device.DHCPv6.Client.1.X_RDKCENTRAL-COM_RcvOption.MapRatio  is correctly set by WanManager after MAPT lease.
Risks: Low
Priority: P1
@sivaraj-comcast
sivaraj-comcast requested a review from a team as a code owner August 4, 2026 19:22
Copilot AI review requested due to automatic review settings August 4, 2026 19:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aligns MAP-T ratio ownership with the stated design: DHCPManager stops computing MAP-T ratio during DHCP option parsing, and instead leaves the ratio value unset (effectively 0) so WanManager can derive it from PSID length as the single authoritative source.

Changes:

  • Removed MAP-T ratio calculation from DHCPManager’s MAP option parsing logic.
  • Removed associated MAP-T ratio trace logging from the DHCP parsing path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/DHCPMgrUtils/dhcpmgr_map_apis.c
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 4, 2026 19:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (1)

source/DHCPMgrUtils/dhcpmgr_map_apis.c:209

  • WanManager is expected to derive MAP-T ratio from psidLen, but when the S46 Port Params suboption is absent (bytesLeftOut == 0) this parser never sets a default g_stMapData.PsidLen (it stays 0 from the earlier memset). With this PR also forcing Ratio = 0, downstream components will have neither a ratio nor a reliable psidLen to derive it from. Consider deriving/validating a default PsidLen from EaLen and RuleIPv4PrefixLen per RFC (and still keep Ratio = 0 so DHCPManager is not computing it).
               g_stMapData.Ratio = 0;
               g_stMapData.PsidOffset = 6;
               MAP_LOG_INFO("<<<TRACE>>> bytesLeftOut                   : %u", bytesLeftOut);

Copilot AI review requested due to automatic review settings August 5, 2026 17:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (1)

source/DHCPMgrUtils/dhcpmgr_map_apis.c:462

  • DhcpMgr_MapParseOptResponse no longer sets map->ratio, but the RBUS path still reads mapt->ratio to populate MapRatio (e.g., dhcpmgr_rbus_apis.c:216). That makes the published ratio depend on the caller having zero-initialized the ipc_map_data_t. To keep this API deterministic and aligned with the new design (DHCPManager publishes ratio=0 and WanManager derives the real ratio), explicitly set map->ratio = 0 here.
     map->v4Len = g_stMapData.RuleIPv4PrefixLen;
     map->psidOffset = g_stMapData.PsidOffset;
     map->psidLen = g_stMapData.PsidLen;
     map->psid = g_stMapData.Psid;
     map->iapdPrefixLen = g_stMapData.PdIPv6PrefixLen;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants