Skip to content

[chassis][multi-asic]: Add support for vendor LC ip range for macvlan ip#22008

Merged
yxieca merged 6 commits intosonic-net:masterfrom
anamehra:anamehra/ip_offset
Mar 25, 2025
Merged

[chassis][multi-asic]: Add support for vendor LC ip range for macvlan ip#22008
yxieca merged 6 commits intosonic-net:masterfrom
anamehra:anamehra/ip_offset

Conversation

@anamehra
Copy link
Contributor

@anamehra anamehra commented Mar 12, 2025

Signed-off-by: Anand Mehra anamehra@cisco.com

Why I did it

As per current design, macvlan IP start with an offset of 10 from miplane Ip subnet base ip on a namespace.
In some platforms this may cause conflict if the LC midplane ip for any slot falls in that range. The IP conflict cause midplane traffic loss.

In Cisco Chassis, macvlan IP may conflict with LC midplane IP range. This conflict causes midplane traffic loss for conflicting ip and affects any LC namespace transaction with Supervisor.

To prevent any conflict, Venddor may provide an offset to be used to generate macvlan IP address to prevent any conflict with midplane IP address.

Work item tracking
  • Microsoft ADO (31798758):

How I did it

Added an ip_offset value which Vendor may provide based on their midplane ip range to generate safe IP address for macvlan in namespace.

The lc_ip_offset offset needs to be set in /usr/share/sonic/device//chassisdb.conf file for the LC where an offset is required.

cat chassisdb.conf
chassis_db_address=127.0.0.3
midplane_subnet=127.0.0.0/16
lc_ip_offset=100

How to verify it

After boot, check eth1 IP address in namespaces. The IP addresses should not conflict with any expected LC eth1-midplane IP or any other IP in the system.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305
  • 202405
  • 202411

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

journalctl ouptput from database@0
Mar 10 05:36:43 sonic database.sh[2454102]: + ip link set dev ns-eth1asic0 netns asic0
Mar 10 05:36:43 sonic database.sh[2454102]: + ip netns exec asic0 ip link set ns-eth1asic0 name eth1
Mar 10 05:36:43 sonic database.sh[2454102]: + [[ -n 100 ]]
Mar 10 05:36:43 sonic database.sh[2454102]: + ip_offset=100
Mar 10 05:36:43 sonic database.sh[2454808]: ++ echo 1.0.0.0/16
Mar 10 05:36:43 sonic database.sh[2454809]: ++ awk -F. '{print $1 "." $2}'
Mar 10 05:36:43 sonic database.sh[2454102]: + slot_ip_address=1.0.1.100
Mar 10 05:36:43 sonic database.sh[2454102]: + slot_subnet_mask=16
Mar 10 05:36:43 sonic database.sh[2454102]: + ip netns exec asic0 ip addr add 1.0.1.100/16 dev eth1
Mar 10 05:36:43 sonic database.sh[2454102]: + ip netns exec asic0 ip link set dev eth1 up
Mar 10 05:36:43 sonic database.sh[2454102]: + [[ 1.0.0.0/16 != \1\.\0\.\0\.\0\/\1\6 ]]
Mar 10 05:36:43 sonic database.sh[2454102]: + ebtables_config
Mar 10 05:36:43 sonic database.sh[2454102]: + [[ -n 0 ]]
Mar 10 05:36:43 sonic database.sh[2454102]: + [[ '' != \d\p\u\d\b ]]
Mar 10 05:36:43 sonic database.sh[2454102]: + ip netns exec asic0 ebtables-restore
Mar 10 05:36:43 sonic database.sh[2454102]: + [[ '' != \c\h\a\s\s\i\s\d\b ]]
Mar 10 05:36:43 sonic database.sh[2454102]: + waitForAllInstanceDatabaseConfigJsonFilesReady


root@sonic:/home/cisco# ip netns exec asic0 ifconfig eth1
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 1.0.0.100  netmask 255.255.0.0  broadcast 0.0.0.0
        RX packets 161  bytes 13091 (12.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 100  bytes 8490 (8.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@sonic:/home/cisco# ip netns exec asic1 ifconfig eth1
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 1.0.0.101  netmask 255.255.0.0  broadcast 0.0.0.0
        RX packets 166  bytes 13417 (13.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 99  bytes 8304 (8.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@sonic:/home/cisco# ip netns exec asic1 sonic-db-cli PING
PONG
root@sonic:/home/cisco# ip netns exec asic0 sonic-db-cli PING
PONG
root@sonic:/home/cisco# ifconfig eth1-midplane
eth1-midplane: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 1.0.0.1  netmask 255.255.0.0  broadcast 1.0.255.255
        RX packets 4855267  bytes 692674212 (660.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6112503  bytes 1094211643 (1.0 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@sonic:/home/cisco# show chassis modules midplane-status 
       Name    IP-Address    Reachability
-----------  ------------  --------------
 LINE-CARD0       1.0.0.1           False
 LINE-CARD1       1.0.0.2            True
 LINE-CARD2       1.0.0.3           False
 LINE-CARD3       1.0.0.4           False
 LINE-CARD4       1.0.0.5           False
 LINE-CARD5       1.0.0.6           False
 LINE-CARD6       1.0.0.7           Fals


@anamehra anamehra requested a review from lguohan as a code owner March 12, 2025 02:02
@anamehra
Copy link
Contributor Author

Hi @abdosi , for your viz. Thanks

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

abdosi
abdosi previously approved these changes Mar 12, 2025
@abdosi abdosi added the P0 Priority of the issue label Mar 12, 2025
@rlhui rlhui requested a review from judyjoseph March 12, 2025 17:14
judyjoseph
judyjoseph previously approved these changes Mar 12, 2025
Copy link
Contributor

@judyjoseph judyjoseph left a comment

Choose a reason for hiding this comment

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

LGTM

@rlhui
Copy link
Contributor

rlhui commented Mar 13, 2025

@anamehra can we please check failure?

@rlhui
Copy link
Contributor

rlhui commented Mar 13, 2025

@abdosi , can we please file ado? thanks.

@anamehra
Copy link
Contributor Author

@yejianquan , for your viz.

@anamehra
Copy link
Contributor Author

@anamehra can we please check failure?

Hi @rlhui , looks like some tests are failing across the board. I see same failure on other PRs as well. Not related to my change.

@yejianquan
Copy link
Contributor

There's a known issue and has been discussed in Elastictest group chat.
Ze will take a look(may be next week)
For this PR, it's safe to be merged no that all other tests passed.
@rlhui could you please force merge it so that we can include in the candidate golden image?

@anamehra anamehra dismissed stale reviews from judyjoseph and abdosi via 9390a76 March 13, 2025 22:39
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@anamehra
Copy link
Contributor Author

PR for 202405 sonic-buildimage-msft
Azure/sonic-buildimage-msft#870

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@wangxin
Copy link
Contributor

wangxin commented Mar 14, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@yejianquan yejianquan left a comment

Choose a reason for hiding this comment

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

LGTM

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@arlakshm
Copy link
Contributor

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@yxieca yxieca merged commit 4a81a69 into sonic-net:master Mar 25, 2025
21 checks passed
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202411: #22125

patrickmacarthur pushed a commit to patrickmacarthur/sonic-buildimage that referenced this pull request Aug 6, 2025
patrickmacarthur pushed a commit to patrickmacarthur/sonic-buildimage that referenced this pull request Aug 6, 2025
[chassis][multi-asic]: Add support for vendor LC ip range for macvlan  ip (sonic-net#22008)

Signed-off-by: Anand Mehra anamehra@cisco.com

Why I did it
As per current design, macvlan IP start with an offset of 10 from miplane Ip subnet base ip on a namespace.
In some platforms this may cause conflict if the LC midplane ip for any slot falls in that range. The IP conflict cause midplane traffic loss.

In Cisco Chassis, macvlan IP may conflict with LC midplane IP range. This conflict causes midplane traffic loss for conflicting ip and affects any LC namespace transaction with Supervisor.

To prevent any conflict, Venddor may provide an offset to be used to generate macvlan IP address to prevent any conflict with midplane IP address.

Work item tracking
Microsoft ADO (31798758):
How I did it
Added an ip_offset value which Vendor may provide based on their midplane ip range to generate safe IP address for macvlan in namespace.

The lc_ip_offset offset needs to be set in /usr/share/sonic/device//chassisdb.conf file for the LC where an offset is required.

cat chassisdb.conf
chassis_db_address=127.0.0.3
midplane_subnet=127.0.0.0/16
lc_ip_offset=100
How to verify it
After boot, check eth1 IP address in namespaces. The IP addresses should not conflict with any expected LC eth1-midplane IP or any other IP in the system.

co-authorized by: jianquanye@microsoft.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status
Status: Done

Development

Successfully merging this pull request may close these issues.

9 participants