Skip to content

Commit ab09bce

Browse files
committed
"asic_config_v3" - Add minipack3bta platform and its variants
Implements `asic_config_v3` design. In this PR, add platform configurations for `minipack3bta`.
1 parent 24aba38 commit ab09bce

3 files changed

Lines changed: 65 additions & 13 deletions

File tree

‎fboss/lib/asic_config_v3/generators/broadcom_xgs_generator.py‎

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from typing import Any
66

77
import yaml
8+
89
from fboss.lib.asic_config_v3.base_generator import BaseAsicConfigGenerator, MODULE_DIR
910
from fboss.lib.platform_mapping_v2.gen import read_all_vendor_data
1011
from fboss.lib.platform_mapping_v2.platform_mapping_v2 import PlatformMappingParser
@@ -19,10 +20,7 @@ class BroadcomXgsGenerator(BaseAsicConfigGenerator):
1920
ASIC_FAMILY: str = "xgs"
2021

2122
def __init__(
22-
self,
23-
platform_name: str,
24-
variant: str,
25-
platform_config: dict[str, Any],
23+
self, platform_name: str, variant: str, platform_config: dict[str, Any]
2624
) -> None:
2725
super().__init__(platform_name, variant, platform_config)
2826

@@ -37,10 +35,14 @@ def __init__(
3735
self.num_ports_per_core: int = self.platform_config.get("num_ports_per_core", 2)
3836
self.mmu_size: int = self.asic_config.get("mmu_size", 9416)
3937

40-
# Compute lanes_per_port from ASIC port_architecture and platform num_ports_per_core
38+
# lanes_per_port is derived from the ASIC port architecture unless the
39+
# platform wires only a subset of chip lanes per port and overrides it
40+
# explicitly via num_lanes_per_port.
4141
port_arch = self.asic_config.get("port_architecture", {})
4242
num_lanes_per_core = port_arch.get("num_lanes_per_core", 8)
43-
self.lanes_per_port: int = num_lanes_per_core // self.num_ports_per_core
43+
self.lanes_per_port: int = self.platform_config.get(
44+
"num_lanes_per_port", num_lanes_per_core // self.num_ports_per_core
45+
)
4446

4547
@property
4648
def output_extension(self) -> str:
@@ -238,6 +240,10 @@ def _get_logical_port_to_physical_port_mapping(self) -> list[list[int]]:
238240
* ``lp_offset_simple``: when true, compute the per-port logical-port
239241
offset as ``i * lanes_per_port`` on all cores rather than using
240242
the default even / odd conditional.
243+
* ``special_core_offset_apply_all``: special-case compat flag. When
244+
true, apply the +1 core offset to every core rather than only
245+
cores 0 and 1, to reproduce a platform's pre-existing linear-stride
246+
mapping. The offset is only physically meaningful on cores 0/1.
241247
"""
242248
port_arch = self.asic_config.get("port_architecture", {})
243249
port_mapping_overrides = self.variant_config.get("port_mapping_overrides", {})
@@ -254,12 +260,15 @@ def _get_logical_port_to_physical_port_mapping(self) -> list[list[int]]:
254260
lanes_per_core = port_arch.get("num_lanes_per_core", 8)
255261
lp_start_step_offset = port_mapping_overrides.get("lp_start_step_offset", 1)
256262
lp_offset_simple = port_mapping_overrides.get("lp_offset_simple", False)
263+
special_core_offset_apply_all = port_mapping_overrides.get(
264+
"special_core_offset_apply_all", False
265+
)
257266

258267
logical_to_physical_port_mapping = []
259268
cores = self._get_core_range()
260269

261270
for core_num in cores:
262-
core_offset = 1 if core_num <= 1 else 0
271+
core_offset = 1 if (special_core_offset_apply_all or core_num <= 1) else 0
263272
lp_start_offset = 0 if core_num % 2 == 0 else lp_on_even_core
264273
lp_start = (
265274
(core_num // 2) * (lp_per_dp + lp_start_step_offset)
@@ -407,10 +416,7 @@ def _generate_port_config(self, mgmt_port: bool = False) -> None:
407416
port_ranges_str = ", ".join(port_ranges)
408417
pc_key = (f"PORT_ID: [{port_ranges_str}]",)
409418

410-
self.values["PORT"][pc_key] = (
411-
f"MTU: {self.mmu_size}",
412-
"MTU_CHECK: 1",
413-
)
419+
self.values["PORT"][pc_key] = (f"MTU: {self.mmu_size}", "MTU_CHECK: 1")
414420

415421
def _generate_device_config_overrides(self) -> None:
416422
"""Apply device config overrides from variant config."""
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"platform_name": "minipack3bta",
3+
"vendor": "broadcom",
4+
"asic": "tomahawk5",
5+
"num_ports_per_core": 1,
6+
"num_lanes_per_port": 4,
7+
"defaults": {
8+
"asic_config_params": {
9+
"config_type": "YAML_CONFIG",
10+
"exact_match": false,
11+
"mmu_lossless": false,
12+
"config_gen_type": "DEFAULT"
13+
},
14+
"port_config": {
15+
"default_speed": 400000,
16+
"speed_to_fec": {
17+
"100000": "PC_FEC_RS544",
18+
"400000": "PC_FEC_RS544_2XN"
19+
}
20+
},
21+
"cpu_port": {
22+
"speed": 10000,
23+
"num_lanes": 1
24+
},
25+
"mgmt_port": {
26+
"enabled": false
27+
},
28+
"port_mapping_overrides": {
29+
"num_logical_ports_per_datapath": 8,
30+
"lp_start_step_offset": 0,
31+
"num_lp_ports_on_even_core": 4,
32+
"special_core_offset_apply_all": true
33+
},
34+
"features": {
35+
"generate_dlb_config": true,
36+
"generate_autoload_board_settings": true
37+
},
38+
"ctr_eflex_config": {
39+
"CTR_ING_EFLEX_OPERMODE_PIPEUNIQUE": 1,
40+
"CTR_EGR_EFLEX_OPERMODE_PIPEUNIQUE": 1
41+
}
42+
},
43+
"variants": {
44+
"internal": {}
45+
}
46+
}

‎fboss/lib/asic_config_v3/schemas/platform_config.schema.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@
170170
"type": "boolean",
171171
"description": "When true, computes the per-port logical-port offset as i * lanes_per_port on all cores rather than using the default even / odd conditional."
172172
},
173-
"core_offset_apply_all": {
173+
"special_core_offset_apply_all": {
174174
"type": "boolean",
175-
"description": "When true, applies the +1 core offset to every core rather than only cores 0 and 1. Required for platforms with a linear-stride port layout."
175+
"description": "Special-case compat flag: when true, applies the +1 core offset to every core rather than only cores 0 and 1, to reproduce a platform's pre-existing linear-stride mapping. Only physically meaningful on cores 0/1."
176176
}
177177
}
178178
},

0 commit comments

Comments
 (0)