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

CPU queues on vslib #732

Merged
merged 1 commit into from
Dec 18, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions vslib/inc/SwitchBCM56850.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ namespace saivs

protected:

virtual sai_status_t create_cpu_qos_queues(
_In_ sai_object_id_t port_id) override;

virtual sai_status_t create_qos_queues_per_port(
_In_ sai_object_id_t port_id) override;

Expand Down
3 changes: 3 additions & 0 deletions vslib/inc/SwitchStateBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ namespace saivs

protected: // TODO should be pure

virtual sai_status_t create_cpu_qos_queues(
_In_ sai_object_id_t port_id);

virtual sai_status_t create_qos_queues_per_port(
_In_ sai_object_id_t port_id);

Expand Down
52 changes: 52 additions & 0 deletions vslib/src/SwitchBCM56850.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,56 @@ sai_status_t SwitchBCM56850::create_qos_queues_per_port(
return SAI_STATUS_SUCCESS;
}

sai_status_t SwitchBCM56850::create_cpu_qos_queues(
_In_ sai_object_id_t port_id)
{
SWSS_LOG_ENTER();

sai_attribute_t attr;

// CPU queues are of type multicast queues
const uint32_t port_qos_queues_count = 32;

std::vector<sai_object_id_t> queues;

for (uint32_t i = 0; i < port_qos_queues_count; ++i)
{
sai_object_id_t queue_id;

CHECK_STATUS(create(SAI_OBJECT_TYPE_QUEUE, &queue_id, m_switch_id, 0, NULL));

queues.push_back(queue_id);

attr.id = SAI_QUEUE_ATTR_TYPE;
attr.value.s32 = SAI_QUEUE_TYPE_MULTICAST;

CHECK_STATUS(set(SAI_OBJECT_TYPE_QUEUE, queue_id, &attr));

attr.id = SAI_QUEUE_ATTR_INDEX;
attr.value.u8 = (uint8_t)i;

CHECK_STATUS(set(SAI_OBJECT_TYPE_QUEUE, queue_id, &attr));

attr.id = SAI_QUEUE_ATTR_PORT;
attr.value.oid = port_id;

CHECK_STATUS(set(SAI_OBJECT_TYPE_QUEUE, queue_id, &attr));
}

attr.id = SAI_PORT_ATTR_QOS_NUMBER_OF_QUEUES;
attr.value.u32 = port_qos_queues_count;

CHECK_STATUS(set(SAI_OBJECT_TYPE_PORT, port_id, &attr));

attr.id = SAI_PORT_ATTR_QOS_QUEUE_LIST;
attr.value.objlist.count = port_qos_queues_count;
attr.value.objlist.list = queues.data();

CHECK_STATUS(set(SAI_OBJECT_TYPE_PORT, port_id, &attr));

return SAI_STATUS_SUCCESS;
}

sai_status_t SwitchBCM56850::create_qos_queues()
{
SWSS_LOG_ENTER();
Expand All @@ -91,6 +141,8 @@ sai_status_t SwitchBCM56850::create_qos_queues()
CHECK_STATUS(create_qos_queues_per_port(port_id));
}

CHECK_STATUS(create_cpu_qos_queues(m_cpu_port_id));

return SAI_STATUS_SUCCESS;
}

Expand Down
11 changes: 11 additions & 0 deletions vslib/src/SwitchStateBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1350,6 +1350,16 @@ sai_status_t SwitchStateBase::set_acl_capabilities()
return set(SAI_OBJECT_TYPE_SWITCH, m_switch_id, &attr);
}

sai_status_t SwitchStateBase::create_cpu_qos_queues(
_In_ sai_object_id_t port_id)
{
SWSS_LOG_ENTER();

SWSS_LOG_ERROR("implement in child class");

return SAI_STATUS_NOT_IMPLEMENTED;
}

sai_status_t SwitchStateBase::create_qos_queues_per_port(
_In_ sai_object_id_t port_id)
{
Expand Down Expand Up @@ -1486,6 +1496,7 @@ sai_status_t SwitchStateBase::create_port_dependencies(
// attributes are not required since they will be set outside this function

CHECK_STATUS(create_ingress_priority_groups_per_port(port_id));
CHECK_STATUS(create_cpu_qos_queues(port_id));
CHECK_STATUS(create_qos_queues_per_port(port_id));
CHECK_STATUS(create_scheduler_groups_per_port(port_id));

Expand Down