Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added query Enum value capability for vxlan EVPN feature #920

Merged
merged 7 commits into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions vslib/SwitchMLNX2700.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,3 +424,18 @@ sai_status_t SwitchMLNX2700::warm_update_queues()

return SAI_STATUS_SUCCESS;
}

sai_status_t SwitchMLNX2700::queryVxlanTunnelPeerModeCapability(
_Inout_ sai_s32_list_t *enum_values_capability)
{
SWSS_LOG_ENTER();

if (enum_values_capability->count < 1)
{
return SAI_STATUS_BUFFER_OVERFLOW;
}

enum_values_capability->count = 1;
enum_values_capability->list[0] = SAI_TUNNEL_PEER_MODE_P2MP;
return SAI_STATUS_SUCCESS;
}
5 changes: 5 additions & 0 deletions vslib/SwitchMLNX2700.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,10 @@ namespace saivs
_In_ sai_object_id_t bridge_id) override;

virtual sai_status_t warm_update_queues() override;

protected:
virtual sai_status_t queryVxlanTunnelPeerModeCapability(
_Inout_ sai_s32_list_t *enum_values_capability) override;

};
}
31 changes: 31 additions & 0 deletions vslib/SwitchStateBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3296,3 +3296,34 @@ bool SwitchStateBase::dumpObject(

return true;
}

sai_status_t SwitchStateBase::queryVxlanTunnelPeerModeCapability(
_Inout_ sai_s32_list_t *enum_values_capability)
{
SWSS_LOG_ENTER();

if (enum_values_capability->count < 2)
{
return SAI_STATUS_BUFFER_OVERFLOW;
}

enum_values_capability->count = 2;
enum_values_capability->list[0] = SAI_TUNNEL_PEER_MODE_P2MP;
enum_values_capability->list[1] = SAI_TUNNEL_PEER_MODE_P2P;
return SAI_STATUS_SUCCESS;
}

sai_status_t SwitchStateBase::queryAttrEnumValuesCapability(
_In_ sai_object_id_t switch_id,
_In_ sai_object_type_t object_type,
_In_ sai_attr_id_t attr_id,
_Inout_ sai_s32_list_t *enum_values_capability)
{
SWSS_LOG_ENTER();

if (object_type == SAI_OBJECT_TYPE_TUNNEL && attr_id == SAI_TUNNEL_ATTR_PEER_MODE)
{
return queryVxlanTunnelPeerModeCapability(enum_values_capability);
Copy link
Collaborator

Choose a reason for hiding this comment

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

why there is Vxlan in in name here? there is no vxlan object type nor attribute in name, this is just for tunnel

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed

}
return SAI_STATUS_NOT_SUPPORTED;
}
11 changes: 11 additions & 0 deletions vslib/SwitchStateBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,12 @@ namespace saivs
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses);

virtual sai_status_t queryAttrEnumValuesCapability(
_In_ sai_object_id_t switch_id,
_In_ sai_object_type_t object_type,
_In_ sai_attr_id_t attr_id,
_Inout_ sai_s32_list_t *enum_values_capability);

protected:

virtual sai_status_t remove_internal(
Expand Down Expand Up @@ -633,6 +639,11 @@ namespace saivs
constexpr static const int m_maxAclTables = 3;
constexpr static const int m_maxAclTableGroups = 200;

protected:

virtual sai_status_t queryVxlanTunnelPeerModeCapability(
_Inout_ sai_s32_list_t *enum_values_capability);

public: // TODO private

std::set<FdbInfo> m_fdb_info_set;
Expand Down
21 changes: 20 additions & 1 deletion vslib/VirtualSwitchSaiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,27 @@ sai_status_t VirtualSwitchSaiInterface::queryAattributeEnumValuesCapability(

return SAI_STATUS_SUCCESS;
}
else if (object_type == SAI_OBJECT_TYPE_VLAN && (attr_id == SAI_VLAN_ATTR_UNKNOWN_UNICAST_FLOOD_CONTROL_TYPE ||
attr_id == SAI_VLAN_ATTR_UNKNOWN_MULTICAST_FLOOD_CONTROL_TYPE ||
attr_id == SAI_VLAN_ATTR_BROADCAST_FLOOD_CONTROL_TYPE))
{

if (enum_values_capability->count < 4)
{
return SAI_STATUS_BUFFER_OVERFLOW;
}

enum_values_capability->count = 4;
enum_values_capability->list[0] = SAI_VLAN_FLOOD_CONTROL_TYPE_ALL;
enum_values_capability->list[1] = SAI_VLAN_FLOOD_CONTROL_TYPE_NONE;
enum_values_capability->list[2] = SAI_VLAN_FLOOD_CONTROL_TYPE_L2MC_GROUP;
enum_values_capability->list[3] = SAI_VLAN_FLOOD_CONTROL_TYPE_COMBINED;

return SAI_STATUS_SUCCESS;
}
auto ss = m_switchStateMap.at(switch_id);
return ss->queryAttrEnumValuesCapability(switch_id, object_type, attr_id, enum_values_capability);

return SAI_STATUS_NOT_SUPPORTED;
}

sai_status_t VirtualSwitchSaiInterface::getStats(
Expand Down