Skip to content

Commit 114f276

Browse files
[docker-sonic-vs]: More changes to support DPU-2P HWKSU (#15695)
Why I did it port_config.ini and hwsku.json are needed to generate the default config switch_type needs to be "dpu" to spawn the right set of processes during dvs initialization and to make sure that DASH APIs can be handled properly Work item tracking Microsoft ADO 24375371: How I did it Use the same hwsku.json and port_config.ini for DPU-2P as the ones used for Nvidia-MBF2H536C SKU in nvidia-sonic sonic-buildimage repo. Set switch_type to "dpu" in DEVICE_METADATA configuration to make sure DASH specific APIs are handled properly Signed-off-by: Prabhat Aravind <[email protected]>
1 parent 75a1fd9 commit 114f276

File tree

7 files changed

+34
-12
lines changed

7 files changed

+34
-12
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"interfaces": {
3+
"Ethernet0": {
4+
"default_brkout_mode": "1x100G"
5+
},
6+
"Ethernet4": {
7+
"default_brkout_mode": "1x100G"
8+
}
9+
}
10+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# name lanes alias index
2+
Ethernet0 0,1,2,3 etp1 1
3+
Ethernet4 4,5,6,7 etp2 2

device/virtual/x86_64-kvm_x86_64-r0/NPU/sai_npu.profile renamed to device/virtual/x86_64-kvm_x86_64-r0/DPU-2P/sai_dpu_2p.profile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_NPU
1+
SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_DPU_SIMU_2P
22
SAI_VS_HOSTIF_USE_TAP_DEVICE=true
33
SAI_VS_INTERFACE_LANE_MAP_FILE=/usr/share/sonic/hwsku/lanemap.ini
44
SAI_VS_CORE_PORT_INDEX_MAP_FILE=/usr/share/sonic/hwsku/coreportindexmap.ini

platform/vs/docker-sonic-vs/Dockerfile.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ COPY ["zero_profiles.json", "/etc/sonic"]
147147
COPY ["buffermgrd.sh", "/usr/bin/"]
148148

149149
COPY ["platform.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/"]
150-
COPY ["platform-npu-2p.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/"]
150+
COPY ["platform-dpu-2p.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/"]
151151
COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/Force10-S6000/"]
152152
COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/"]
153153
COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/Mellanox-SN2700/"]

platform/vs/docker-sonic-vs/init_cfg.json.j2

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,20 @@
22
"DEVICE_METADATA": {
33
"localhost": {
44
"mac": "{{ system_mac }}",
5+
"switch_type": "{{ switch_type }}",
56
"buffer_model": "traditional"
67
}
78
},
8-
{% set features = ["swss", "bgp", "teamd", "nat", "database", "lldp", "dhcp_relay", "macsec"] %}
9+
{% if switch_type != "dpu" %}
10+
{% set features = ({"swss": "enabled", "bgp": "enabled", "teamd": "enabled", "nat": "enabled", "database": "enabled", "lldp": "enabled", "dhcp_relay": "enabled", "macsec": "enabled"}) %}
11+
{% else %}
12+
{% set features = ({"swss": "enabled", "bgp": "enabled", "teamd": "disabled", "nat": "disabled", "database": "enabled", "lldp": "enabled", "dhcp_relay": "disabled", "macsec": "disabled"}) %}
13+
{% endif %}
914
"FEATURE": {
10-
{% for feature in features %}
15+
{% for feature, state in features.items() %}
1116
"{{ feature }}": {
12-
"state": "enabled"
17+
"state": "{{ state }}"
1318
}{% if not loop.last %},{% endif %}
1419
{% endfor %}
1520
}
1621
}
17-
File renamed without changes.

platform/vs/docker-sonic-vs/start.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
ln -sf /usr/share/sonic/device/$PLATFORM /usr/share/sonic/platform
99
ln -sf /usr/share/sonic/device/$PLATFORM/$HWSKU /usr/share/sonic/hwsku
1010

11+
SWITCH_TYPE=switch
1112
PLATFORM_CONF=platform.json
12-
if [[ $HWSKU == "NPU-2P" ]]; then
13-
PLATFORM_CONF=platform-npu-2p.json
13+
if [[ $HWSKU == "DPU-2P" ]]; then
14+
SWITCH_TYPE=dpu
15+
PLATFORM_CONF=platform-dpu-2p.json
1416
fi
1517

1618
pushd /usr/share/sonic/hwsku
@@ -38,7 +40,7 @@ mkdir -p /var/run/redis/sonic-db
3840
cp /etc/default/sonic-db/database_config.json /var/run/redis/sonic-db/
3941

4042
SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}')
41-
sonic-cfggen -t /usr/share/sonic/templates/init_cfg.json.j2 -a "{\"system_mac\": \"$SYSTEM_MAC_ADDRESS\"}" > /etc/sonic/init_cfg.json
43+
sonic-cfggen -t /usr/share/sonic/templates/init_cfg.json.j2 -a "{\"system_mac\": \"$SYSTEM_MAC_ADDRESS\", \"switch_type\": \"$SWITCH_TYPE\"}" > /etc/sonic/init_cfg.json
4244

4345
if [[ -f /usr/share/sonic/virtual_chassis/default_config.json ]]; then
4446
sonic-cfggen -j /etc/sonic/init_cfg.json -j /usr/share/sonic/virtual_chassis/default_config.json --print-data > /tmp/init_cfg.json
@@ -52,22 +54,25 @@ else
5254
# generate and merge buffers configuration into config file
5355
if [ -f /usr/share/sonic/hwsku/buffers.json.j2 ]; then
5456
sonic-cfggen -k $HWSKU -p /usr/share/sonic/device/$PLATFORM/$PLATFORM_CONF -t /usr/share/sonic/hwsku/buffers.json.j2 > /tmp/buffers.json
57+
buffers_cmd="-j /tmp/buffers.json"
5558
fi
5659
if [ -f /usr/share/sonic/hwsku/qos.json.j2 ]; then
5760
sonic-cfggen -j /etc/sonic/init_cfg.json -t /usr/share/sonic/hwsku/qos.json.j2 > /tmp/qos.json
61+
qos_cmd="-j /tmp/qos.json"
5862
fi
5963

6064
sonic-cfggen -p /usr/share/sonic/device/$PLATFORM/$PLATFORM_CONF -k $HWSKU --print-data > /tmp/ports.json
6165
# change admin_status from up to down; Test cases dependent
6266
sed -i "s/up/down/g" /tmp/ports.json
63-
sonic-cfggen -j /etc/sonic/init_cfg.json -j /tmp/buffers.json -j /tmp/qos.json -j /tmp/ports.json --print-data > /etc/sonic/config_db.json
67+
sonic-cfggen -j /etc/sonic/init_cfg.json $buffers_cmd $qos_cmd -j /tmp/ports.json --print-data > /etc/sonic/config_db.json
6468
fi
69+
6570
sonic-cfggen -t /usr/share/sonic/templates/copp_cfg.j2 > /etc/sonic/copp_cfg.json
6671

6772
if [ "$HWSKU" == "Mellanox-SN2700" ]; then
6873
cp /usr/share/sonic/hwsku/sai_mlnx.profile /usr/share/sonic/hwsku/sai.profile
69-
elif [ "$HWSKU" == "NPU" ]; then
70-
cp /usr/share/sonic/hwsku/sai_npu.profile /usr/share/sonic/hwsku/sai.profile
74+
elif [ "$HWSKU" == "DPU-2P" ]; then
75+
cp /usr/share/sonic/hwsku/sai_dpu_2p.profile /usr/share/sonic/hwsku/sai.profile
7176
fi
7277

7378
mkdir -p /etc/swss/config.d/

0 commit comments

Comments
 (0)