Skip to content

Commit

Permalink
Add MaxSwitchId extension attribute
Browse files Browse the repository at this point in the history
Summary: As titled.

Reviewed By: shri-khare

Differential Revision: D67054742

fbshipit-source-id: 251417efbf0ca13147b1d91351ac210ddee2e3b1
  • Loading branch information
Jasmeet Bagga authored and facebook-github-bot committed Dec 11, 2024
1 parent 067dfdb commit 95f8a9b
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fboss/agent/hw/sai/api/SwitchApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,14 @@ struct SaiSwitchTraits {
sai_uint32_t,
AttributeShelPeriodicInterval,
SaiIntDefault<sai_uint32_t>>;

struct AttributeMaxSwitchId {
std::optional<sai_attr_id_t> operator()();
};
using MaxSwitchId = SaiExtensionAttribute<
sai_uint32_t,
AttributeMaxSwitchId,
SaiIntDefault<sai_uint32_t>>;
};
using AdapterKey = SwitchSaiId;
using AdapterHostKey = std::monostate;
Expand Down
8 changes: 8 additions & 0 deletions fboss/agent/hw/sai/api/bcm/SwitchApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,4 +525,12 @@ SaiSwitchTraits::Attributes::AttributeFirmwareLogFile::operator()() {
return std::nullopt;
}

std::optional<sai_attr_id_t>
SaiSwitchTraits::Attributes::AttributeMaxSwitchId::operator()() {
#if defined(BRCM_SAI_SDK_DNX) && defined(BRCM_SAI_SDK_GTE_12_0)
return SAI_SWITCH_ATTR_MAX_SWITCH_ID;
#endif
return std::nullopt;
}

} // namespace facebook::fboss
4 changes: 4 additions & 0 deletions fboss/agent/hw/sai/api/fake/FakeSaiExtensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,4 +591,8 @@ SaiSwitchTraits::Attributes::AttributeFirmwareLogFile::operator()() {
return SAI_SWITCH_ATTR_FIRMWARE_LOG_FILE;
}

std::optional<sai_attr_id_t>
SaiSwitchTraits::Attributes::AttributeMaxSwitchId::operator()() {
return SAI_SWITCH_ATTR_MAX_SWITCH_ID;
}
} // namespace facebook::fboss
1 change: 1 addition & 0 deletions fboss/agent/hw/sai/api/fake/saifakeextensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ typedef enum _sai_switch_extensions_attr_t {
SAI_SWITCH_ATTR_SHEL_PERIODIC_INTERVAL,
SAI_SWITCH_ATTR_FIRMWARE_CORE_TO_USE,
SAI_SWITCH_ATTR_FIRMWARE_LOG_FILE,
SAI_SWITCH_ATTR_MAX_SWITCH_ID,
} sai_switch_extensions_attr_t;

typedef enum _sai_tam_event_extensions_attr_t {
Expand Down
4 changes: 4 additions & 0 deletions fboss/agent/hw/sai/api/oss/SwitchApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,4 +274,8 @@ SaiSwitchTraits::Attributes::AttributeFirmwareLogFile::operator()() {
return std::nullopt;
}

std::optional<sai_attr_id_t>
SaiSwitchTraits::Attributes::AttributeMaxSwitchId::operator()() {
return std::nullopt;
}
} // namespace facebook::fboss
4 changes: 4 additions & 0 deletions fboss/agent/hw/sai/api/tajo/SwitchApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,4 +296,8 @@ SaiSwitchTraits::Attributes::AttributeFirmwareLogFile::operator()() {
return std::nullopt;
}

std::optional<sai_attr_id_t>
SaiSwitchTraits::Attributes::AttributeMaxSwitchId::operator()() {
return std::nullopt;
}
} // namespace facebook::fboss

0 comments on commit 95f8a9b

Please sign in to comment.