-
Notifications
You must be signed in to change notification settings - Fork 368
Modify sai_create_port to breakout a port for virtual switch #454
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
Merged
lguohan
merged 6 commits into
sonic-net:master
from
chiourung:tmp_vs_create_remove_port
Jun 10, 2019
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1ba2f9e
Use pre match logic to match ACL TABLE (#433)
kcudnik e129937
Modify sai_create_port to breakout a port for virtual switch
chiourung 42c53d7
Modify after review
chiourung 4388c67
Add create_port for MLNX2700
chiourung e0504a1
Add SWSS_LOG_ENTER() for new function
chiourung 82712ee
Modified the coding format
chiourung File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -418,6 +418,42 @@ static sai_status_t create_default_trap_group() | |
| return vs_generic_set(SAI_OBJECT_TYPE_SWITCH, switch_object_id, &attr); | ||
| } | ||
|
|
||
| static sai_status_t create_qos_queues_per_port( | ||
| _In_ sai_object_id_t switch_object_id, | ||
| _In_ sai_object_id_t port_id) | ||
| { | ||
| SWSS_LOG_ENTER(); | ||
|
|
||
| // 10 in and 10 out queues per port | ||
| const uint32_t port_qos_queues_count = 20; | ||
|
|
||
| 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(vs_generic_create(SAI_OBJECT_TYPE_QUEUE, &queue_id, switch_object_id, 0, NULL)); | ||
|
|
||
| queues.push_back(queue_id); | ||
| } | ||
|
|
||
| sai_attribute_t attr; | ||
|
|
||
| attr.id = SAI_PORT_ATTR_QOS_NUMBER_OF_QUEUES; | ||
| attr.value.u32 = port_qos_queues_count; | ||
|
|
||
| CHECK_STATUS(vs_generic_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(vs_generic_set(SAI_OBJECT_TYPE_PORT, port_id, &attr)); | ||
|
|
||
| return SAI_STATUS_SUCCESS; | ||
| } | ||
|
|
||
| static sai_status_t create_qos_queues() | ||
| { | ||
| SWSS_LOG_ENTER(); | ||
|
|
@@ -428,36 +464,46 @@ static sai_status_t create_qos_queues() | |
|
|
||
| sai_object_id_t switch_object_id = ss->getSwitchId(); | ||
|
|
||
| // 10 in and 10 out queues per port | ||
| const uint32_t port_qos_queues_count = 20; | ||
|
|
||
| for (auto &port_id : port_list) | ||
| { | ||
| std::vector<sai_object_id_t> queues; | ||
|
|
||
| for (uint32_t i = 0; i < port_qos_queues_count; ++i) | ||
| { | ||
| sai_object_id_t queue_id; | ||
| create_qos_queues_per_port(switch_object_id, port_id); | ||
| } | ||
|
|
||
| CHECK_STATUS(vs_generic_create(SAI_OBJECT_TYPE_QUEUE, &queue_id, switch_object_id, 0, NULL)); | ||
| return SAI_STATUS_SUCCESS; | ||
| } | ||
|
|
||
| queues.push_back(queue_id); | ||
| } | ||
| static sai_status_t create_ingress_priority_groups_per_port( | ||
| _In_ sai_object_id_t switch_object_id, | ||
| _In_ sai_object_id_t port_id) | ||
| { | ||
| SWSS_LOG_ENTER(); | ||
|
|
||
| sai_attribute_t attr; | ||
| const uint32_t port_pgs_count = 8; | ||
|
|
||
| attr.id = SAI_PORT_ATTR_QOS_NUMBER_OF_QUEUES; | ||
| attr.value.u32 = port_qos_queues_count; | ||
| std::vector<sai_object_id_t> pgs; | ||
|
|
||
| CHECK_STATUS(vs_generic_set(SAI_OBJECT_TYPE_PORT, port_id, &attr)); | ||
| for (uint32_t i = 0; i < port_pgs_count; ++i) | ||
| { | ||
| sai_object_id_t pg_id; | ||
|
|
||
| attr.id = SAI_PORT_ATTR_QOS_QUEUE_LIST; | ||
| attr.value.objlist.count = port_qos_queues_count; | ||
| attr.value.objlist.list = queues.data(); | ||
| CHECK_STATUS(vs_generic_create(SAI_OBJECT_TYPE_INGRESS_PRIORITY_GROUP, &pg_id, switch_object_id, 0, NULL)); | ||
|
|
||
| CHECK_STATUS(vs_generic_set(SAI_OBJECT_TYPE_PORT, port_id, &attr)); | ||
| pgs.push_back(pg_id); | ||
| } | ||
|
|
||
| sai_attribute_t attr; | ||
|
|
||
| attr.id = SAI_PORT_ATTR_NUMBER_OF_INGRESS_PRIORITY_GROUPS; | ||
| attr.value.u32 = port_pgs_count; | ||
|
|
||
| CHECK_STATUS(vs_generic_set(SAI_OBJECT_TYPE_PORT, port_id, &attr)); | ||
|
|
||
| attr.id = SAI_PORT_ATTR_INGRESS_PRIORITY_GROUP_LIST; | ||
| attr.value.objlist.count = port_pgs_count; | ||
| attr.value.objlist.list = pgs.data(); | ||
|
|
||
| CHECK_STATUS(vs_generic_set(SAI_OBJECT_TYPE_PORT, port_id, &attr)); | ||
|
|
||
| return SAI_STATUS_SUCCESS; | ||
| } | ||
|
|
||
|
|
@@ -472,33 +518,9 @@ static sai_status_t create_ingress_priority_groups() | |
| sai_object_id_t switch_object_id = ss->getSwitchId(); | ||
|
|
||
| // | ||
| const uint32_t port_pgs_count = 8; | ||
|
|
||
| for (auto &port_id : port_list) | ||
| { | ||
| std::vector<sai_object_id_t> pgs; | ||
|
|
||
| for (uint32_t i = 0; i < port_pgs_count; ++i) | ||
| { | ||
| sai_object_id_t pg_id; | ||
|
|
||
| CHECK_STATUS(vs_generic_create(SAI_OBJECT_TYPE_INGRESS_PRIORITY_GROUP, &pg_id, switch_object_id, 0, NULL)); | ||
|
|
||
| pgs.push_back(pg_id); | ||
| } | ||
|
|
||
| sai_attribute_t attr; | ||
|
|
||
| attr.id = SAI_PORT_ATTR_NUMBER_OF_INGRESS_PRIORITY_GROUPS; | ||
| attr.value.u32 = port_pgs_count; | ||
|
|
||
| CHECK_STATUS(vs_generic_set(SAI_OBJECT_TYPE_PORT, port_id, &attr)); | ||
|
|
||
| attr.id = SAI_PORT_ATTR_INGRESS_PRIORITY_GROUP_LIST; | ||
| attr.value.objlist.count = port_pgs_count; | ||
| attr.value.objlist.list = pgs.data(); | ||
|
|
||
| CHECK_STATUS(vs_generic_set(SAI_OBJECT_TYPE_PORT, port_id, &attr)); | ||
| create_ingress_priority_groups_per_port(switch_object_id, port_id); | ||
| } | ||
|
|
||
| return SAI_STATUS_SUCCESS; | ||
|
|
@@ -1210,3 +1232,27 @@ sai_status_t refresh_read_only_BCM56850( | |
|
|
||
| return SAI_STATUS_NOT_IMPLEMENTED; | ||
| } | ||
|
|
||
| sai_status_t vs_create_port_BCM56850( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please reuse logic that creates ports in init function, extract that code to separate function and reuse |
||
| _In_ sai_object_id_t port_id, | ||
| _In_ sai_object_id_t switch_id) | ||
| { | ||
| SWSS_LOG_ENTER(); | ||
|
|
||
| sai_attribute_t attr; | ||
|
|
||
| attr.id = SAI_PORT_ATTR_ADMIN_STATE; | ||
| attr.value.booldata = false; /* default admin state is down as defined in SAI */ | ||
|
|
||
| CHECK_STATUS(vs_generic_set(SAI_OBJECT_TYPE_PORT, port_id, &attr)); | ||
|
|
||
| /* create priority groups */ | ||
| create_ingress_priority_groups_per_port(switch_id, port_id); | ||
|
|
||
| /* create qos queues */ | ||
| create_qos_queues_per_port(switch_id, port_id); | ||
|
|
||
| return SAI_STATUS_SUCCESS; | ||
| } | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about mlnx chipset implementation ?