Skip to content

Commit

Permalink
link fec is now an optional setting (#6992)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nieuwejaar authored Nov 14, 2024
1 parent 845e4ff commit 33bbad3
Show file tree
Hide file tree
Showing 30 changed files with 73 additions and 58 deletions.
2 changes: 1 addition & 1 deletion common/src/api/external/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2514,7 +2514,7 @@ pub struct SwitchPortLinkConfig {
pub mtu: u16,

/// The forward error correction mode of the link.
pub fec: LinkFec,
pub fec: Option<LinkFec>,

/// The configured speed of the link.
pub speed: LinkSpeed,
Expand Down
2 changes: 1 addition & 1 deletion common/src/api/internal/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ pub struct PortConfigV2 {
/// Port speed.
pub uplink_port_speed: PortSpeed,
/// Port forward error correction type.
pub uplink_port_fec: PortFec,
pub uplink_port_fec: Option<PortFec>,
/// BGP peers on this port
pub bgp_peers: Vec<BgpPeerConfig>,
/// Whether or not to set autonegotiation
Expand Down
2 changes: 1 addition & 1 deletion nexus/db-model/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ table! {
port_settings_id -> Uuid,
link_name -> Text,
mtu -> Int4,
fec -> crate::SwitchLinkFecEnum,
fec -> Nullable<crate::SwitchLinkFecEnum>,
speed -> crate::SwitchLinkSpeedEnum,
autoneg -> Bool,
lldp_link_config_id -> Nullable<Uuid>,
Expand Down
6 changes: 3 additions & 3 deletions nexus/db-model/src/switch_port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ pub struct SwitchPortLinkConfig {
pub lldp_link_config_id: Option<Uuid>,
pub link_name: String,
pub mtu: SqlU16,
pub fec: SwitchLinkFec,
pub fec: Option<SwitchLinkFec>,
pub speed: SwitchLinkSpeed,
pub autoneg: bool,
pub tx_eq_config_id: Option<Uuid>,
Expand All @@ -398,7 +398,7 @@ impl SwitchPortLinkConfig {
lldp_link_config_id: Uuid,
link_name: String,
mtu: u16,
fec: SwitchLinkFec,
fec: Option<SwitchLinkFec>,
speed: SwitchLinkSpeed,
autoneg: bool,
tx_eq_config_id: Option<Uuid>,
Expand All @@ -424,7 +424,7 @@ impl Into<external::SwitchPortLinkConfig> for SwitchPortLinkConfig {
tx_eq_config_id: self.tx_eq_config_id,
link_name: self.link_name.clone(),
mtu: self.mtu.into(),
fec: self.fec.into(),
fec: self.fec.map(|fec| fec.into()),
speed: self.speed.into(),
autoneg: self.autoneg,
}
Expand Down
2 changes: 1 addition & 1 deletion nexus/db-queries/src/db/datastore/switch_port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@ async fn do_switch_port_settings_create(
lldp_config_id,
link_name.clone(),
c.mtu,
c.fec.into(),
c.fec.map(|fec| fec.into()),
c.speed.into(),
c.autoneg,
tx_eq_config_id,
Expand Down
4 changes: 2 additions & 2 deletions nexus/src/app/background/tasks/networking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ pub(crate) fn api_to_dpd_port_settings(
lane: Some(LinkId(0)),
kr: false,
tx_eq: tx_eq.clone(),
fec: match l.fec {
fec: l.fec.map(|fec| match fec {
SwitchLinkFec::Firecode => PortFec::Firecode,
SwitchLinkFec::Rs => PortFec::Rs,
SwitchLinkFec::None => PortFec::None,
},
}),
speed: match l.speed {
SwitchLinkSpeed::Speed0G => PortSpeed::Speed0G,
SwitchLinkSpeed::Speed1G => PortSpeed::Speed1G,
Expand Down
7 changes: 3 additions & 4 deletions nexus/src/app/background/tasks/sync_switch_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use internal_dns_types::names::ServiceName;
use ipnetwork::IpNetwork;
use nexus_db_model::{
AddressLotBlock, BgpConfig, BootstoreConfig, LoopbackAddress,
SwitchLinkFec, SwitchLinkSpeed, INFRA_LOT, NETWORK_KEY,
SwitchLinkSpeed, INFRA_LOT, NETWORK_KEY,
};
use uuid::Uuid;

Expand Down Expand Up @@ -1002,9 +1002,8 @@ impl BackgroundTask for SwitchPortSettingsManager {
uplink_port_fec: info
.links
.get(0) //TODO https://github.com/oxidecomputer/omicron/issues/3062
.map(|l| l.fec)
.unwrap_or(SwitchLinkFec::None)
.into(),
.map(|l| l.fec.map(|fec| fec.into()))
.unwrap_or(None),
uplink_port_speed: info
.links
.get(0) //TODO https://github.com/oxidecomputer/omicron/issues/3062
Expand Down
2 changes: 1 addition & 1 deletion nexus/src/app/rack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ impl super::Nexus {
let link = LinkConfigCreate {
//TODO https://github.com/oxidecomputer/omicron/issues/2274
mtu: 1500,
fec: uplink_config.uplink_port_fec.into(),
fec: uplink_config.uplink_port_fec.map(|fec| fec.into()),
speed: uplink_config.uplink_port_speed.into(),
autoneg: uplink_config.autoneg,
lldp,
Expand Down
2 changes: 1 addition & 1 deletion nexus/tests/integration_tests/switch_port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ async fn test_port_settings_basic_crud(ctx: &ControlPlaneTestContext) {
system_description: Some("System description".into()),
management_ip: None,
},
fec: LinkFec::None,
fec: Some(LinkFec::None),
speed: LinkSpeed::Speed100G,
autoneg: false,
tx_eq: None,
Expand Down
2 changes: 1 addition & 1 deletion nexus/types/src/external_api/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1716,7 +1716,7 @@ pub struct LinkConfigCreate {
pub lldp: LldpLinkConfigCreate,

/// The forward error correction mode of the link.
pub fec: LinkFec,
pub fec: Option<LinkFec>,

/// The speed of the link.
pub speed: LinkSpeed,
Expand Down
2 changes: 1 addition & 1 deletion openapi/bootstrap-agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@
]
},
"uplink_port_fec": {
"nullable": true,
"description": "Port forward error correction type.",
"allOf": [
{
Expand All @@ -888,7 +889,6 @@
"port",
"routes",
"switch",
"uplink_port_fec",
"uplink_port_speed"
]
},
Expand Down
2 changes: 1 addition & 1 deletion openapi/nexus-internal.json
Original file line number Diff line number Diff line change
Expand Up @@ -4687,6 +4687,7 @@
]
},
"uplink_port_fec": {
"nullable": true,
"description": "Port forward error correction type.",
"allOf": [
{
Expand All @@ -4709,7 +4710,6 @@
"port",
"routes",
"switch",
"uplink_port_fec",
"uplink_port_speed"
]
},
Expand Down
4 changes: 2 additions & 2 deletions openapi/nexus.json
Original file line number Diff line number Diff line change
Expand Up @@ -17166,6 +17166,7 @@
"type": "boolean"
},
"fec": {
"nullable": true,
"description": "The forward error correction mode of the link.",
"allOf": [
{
Expand Down Expand Up @@ -17207,7 +17208,6 @@
},
"required": [
"autoneg",
"fec",
"lldp",
"mtu",
"speed"
Expand Down Expand Up @@ -20410,6 +20410,7 @@
"type": "boolean"
},
"fec": {
"nullable": true,
"description": "The forward error correction mode of the link.",
"allOf": [
{
Expand Down Expand Up @@ -20455,7 +20456,6 @@
},
"required": [
"autoneg",
"fec",
"link_name",
"mtu",
"port_settings_id",
Expand Down
2 changes: 1 addition & 1 deletion openapi/sled-agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -4686,6 +4686,7 @@
]
},
"uplink_port_fec": {
"nullable": true,
"description": "Port forward error correction type.",
"allOf": [
{
Expand All @@ -4708,7 +4709,6 @@
"port",
"routes",
"switch",
"uplink_port_fec",
"uplink_port_speed"
]
},
Expand Down
8 changes: 6 additions & 2 deletions openapi/wicketd.json
Original file line number Diff line number Diff line change
Expand Up @@ -6676,7 +6676,12 @@
]
},
"uplink_port_fec": {
"$ref": "#/components/schemas/PortFec"
"nullable": true,
"allOf": [
{
"$ref": "#/components/schemas/PortFec"
}
]
},
"uplink_port_speed": {
"$ref": "#/components/schemas/PortSpeed"
Expand All @@ -6686,7 +6691,6 @@
"addresses",
"autoneg",
"routes",
"uplink_port_fec",
"uplink_port_speed"
],
"additionalProperties": false
Expand Down
12 changes: 6 additions & 6 deletions package-manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -719,8 +719,8 @@ only_for_targets.image = "standard"
# the other `source.*` keys.
source.type = "prebuilt"
source.repo = "dendrite"
source.commit = "5b1d590426971e481d927d3978e918ec25f3ad21"
source.sha256 = "b2662975bd704edfa393549d90c42c8f363037d630cab66cd9d6891bdb64f470"
source.commit = "8290b412c867438997c8bbb3b1fa75ed23ff250f"
source.sha256 = "d79b764d198777f7356e2338164a9afefff316899c87b0e9bf33254b26f063db"
output.type = "zone"
output.intermediate_only = true

Expand All @@ -746,8 +746,8 @@ only_for_targets.image = "standard"
# the other `source.*` keys.
source.type = "prebuilt"
source.repo = "dendrite"
source.commit = "5b1d590426971e481d927d3978e918ec25f3ad21"
source.sha256 = "7dee2af3126b35c6b7e0e22cb45c3e47f5ea8a6d98b991304c0d3e08bc341437"
source.commit = "8290b412c867438997c8bbb3b1fa75ed23ff250f"
source.sha256 = "2f3ccf810dadd6d340a1bef03952f7b43a994a8cb47aa5513ae7b8e3402b524f"
output.type = "zone"
output.intermediate_only = true

Expand All @@ -766,8 +766,8 @@ only_for_targets.image = "standard"
# the other `source.*` keys.
source.type = "prebuilt"
source.repo = "dendrite"
source.commit = "5b1d590426971e481d927d3978e918ec25f3ad21"
source.sha256 = "1310877ed0a0f2fb8b764f2c7b4b45c31200c6b899e9ae8ae1e548c9ab6c8bbf"
source.commit = "8290b412c867438997c8bbb3b1fa75ed23ff250f"
source.sha256 = "cc0753ddbaf73e883f0ce9fa6a8865356a6510400b4a5a6d27fcc8b7a14b5b05"
output.type = "zone"
output.intermediate_only = true

Expand Down
6 changes: 4 additions & 2 deletions schema/rss-sled-plan.json
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,6 @@
"port",
"routes",
"switch",
"uplink_port_fec",
"uplink_port_speed"
],
"properties": {
Expand Down Expand Up @@ -764,9 +763,12 @@
},
"uplink_port_fec": {
"description": "Port forward error correction type.",
"allOf": [
"anyOf": [
{
"$ref": "#/definitions/PortFec"
},
{
"type": "null"
}
]
},
Expand Down
4 changes: 2 additions & 2 deletions sled-agent/src/bootstrap/early_networking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ impl<'a> EarlyNetworkSetup<'a> {
params: LinkCreate {
autoneg: port_config.autoneg,
kr: false, //NOTE: kr does not apply to user configurable links.
fec: convert_fec(&port_config.uplink_port_fec),
fec: port_config.uplink_port_fec.map(convert_fec),
speed: convert_speed(&port_config.uplink_port_speed),
lane: Some(LinkId(0)),
tx_eq: port_config.tx_eq.map(|x| TxEq {
Expand Down Expand Up @@ -783,7 +783,7 @@ fn convert_speed(speed: &PortSpeed) -> dpd_client::types::PortSpeed {
}
}

fn convert_fec(fec: &PortFec) -> dpd_client::types::PortFec {
fn convert_fec(fec: PortFec) -> dpd_client::types::PortFec {
match fec {
PortFec::Firecode => dpd_client::types::PortFec::Firecode,
PortFec::None => dpd_client::types::PortFec::None,
Expand Down
4 changes: 3 additions & 1 deletion sled-agent/src/rack_setup/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,9 @@ impl ServiceInner {
.collect(),
switch: config.switch.into(),
uplink_port_speed: config.uplink_port_speed.into(),
uplink_port_fec: config.uplink_port_fec.into(),
uplink_port_fec: config
.uplink_port_fec
.map(|fec| fec.into()),
autoneg: config.autoneg,
bgp_peers: config
.bgp_peers
Expand Down
2 changes: 1 addition & 1 deletion sled-agent/tests/integration_tests/early_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ fn current_config_example() -> (&'static str, EarlyNetworkConfig) {
switch: SwitchLocation::Switch0,
port: "foo".to_owned(),
uplink_port_speed: PortSpeed::Speed200G,
uplink_port_fec: PortFec::Firecode,
uplink_port_fec: Some(PortFec::Firecode),
bgp_peers: vec![BgpPeerConfig {
asn: 65000,
port: "bar".to_owned(),
Expand Down
8 changes: 4 additions & 4 deletions sled-agent/types/src/early_networking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ pub mod back_compat {
switch: v1.switch,
port: v1.port,
uplink_port_speed: v1.uplink_port_speed,
uplink_port_fec: v1.uplink_port_fec,
uplink_port_fec: Some(v1.uplink_port_fec),
bgp_peers: v1.bgp_peers.clone(),
autoneg: v1.autoneg,
lldp: None,
Expand Down Expand Up @@ -344,7 +344,7 @@ pub mod back_compat {
switch: value.switch,
port: value.uplink_port,
uplink_port_speed: value.uplink_port_speed,
uplink_port_fec: value.uplink_port_fec,
uplink_port_fec: Some(value.uplink_port_fec),
bgp_peers: vec![],
autoneg: false,
lldp: None,
Expand Down Expand Up @@ -518,7 +518,7 @@ mod tests {
switch: uplink.switch,
port: uplink.uplink_port,
uplink_port_speed: uplink.uplink_port_speed,
uplink_port_fec: uplink.uplink_port_fec,
uplink_port_fec: Some(uplink.uplink_port_fec),
autoneg: false,
bgp_peers: vec![],
lldp: None,
Expand Down Expand Up @@ -601,7 +601,7 @@ mod tests {
switch: port.switch,
port: port.port,
uplink_port_speed: port.uplink_port_speed,
uplink_port_fec: port.uplink_port_fec,
uplink_port_fec: Some(port.uplink_port_fec),
autoneg: false,
bgp_peers: vec![],
lldp: None,
Expand Down
4 changes: 2 additions & 2 deletions tools/dendrite_openapi_version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
COMMIT="5b1d590426971e481d927d3978e918ec25f3ad21"
SHA2="bcddcd4d600f5cb9bd73754125b4263312fcabadd2a521d44355633a796c8a71"
COMMIT="8290b412c867438997c8bbb3b1fa75ed23ff250f"
SHA2="c381b2ac42fbd68b9230e111cb96beecf90abde10cdc15f02c88d61781c8adb8"
6 changes: 3 additions & 3 deletions tools/dendrite_stub_checksums
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CIDL_SHA256_ILLUMOS="b2662975bd704edfa393549d90c42c8f363037d630cab66cd9d6891bdb64f470"
CIDL_SHA256_LINUX_DPD="10d356231ec5357788c5d01da14bc393be4c79dd5df45c142398ef5674e733fb"
CIDL_SHA256_LINUX_SWADM="1e6cc87d1820a4647c171479a0c0a587a892078e49e8e7485769a33e62516f40"
CIDL_SHA256_ILLUMOS="d79b764d198777f7356e2338164a9afefff316899c87b0e9bf33254b26f063db"
CIDL_SHA256_LINUX_DPD="d8b8e4acb2c523b112775361b69f5c8ee2f5c6b1747bb800e6546392ef83b02b"
CIDL_SHA256_LINUX_SWADM="28e4ecd3e73b6674b2afbaff6ae940f3f6c8e2ca0ef7f43175a895dbad553814"
4 changes: 2 additions & 2 deletions wicket-common/src/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ impl ExampleRackSetupData {
}],
bgp_peers: switch0_port0_bgp_peers,
uplink_port_speed: PortSpeed::Speed400G,
uplink_port_fec: PortFec::Firecode,
uplink_port_fec: Some(PortFec::Firecode),
lldp: switch0_port0_lldp,
tx_eq,
autoneg: true,
Expand All @@ -230,7 +230,7 @@ impl ExampleRackSetupData {
}],
bgp_peers: switch1_port0_bgp_peers,
uplink_port_speed: PortSpeed::Speed400G,
uplink_port_fec: PortFec::Firecode,
uplink_port_fec: None,
lldp: switch1_port0_lldp,
tx_eq,
autoneg: true,
Expand Down
2 changes: 1 addition & 1 deletion wicket-common/src/rack_setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ pub struct UserSpecifiedPortConfig {
pub routes: Vec<RouteConfig>,
pub addresses: Vec<UplinkAddressConfig>,
pub uplink_port_speed: PortSpeed,
pub uplink_port_fec: PortFec,
pub uplink_port_fec: Option<PortFec>,
pub autoneg: bool,
#[serde(default)]
pub bgp_peers: Vec<UserSpecifiedBgpPeerConfig>,
Expand Down
Loading

0 comments on commit 33bbad3

Please sign in to comment.