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

Keep attribute order in bulk mode #1659

Merged
merged 2 commits into from
Mar 8, 2021
Merged

Conversation

shi-su
Copy link
Contributor

@shi-su shi-su commented Mar 3, 2021

What I did
Keep attributes for the same entry in the order that the attributes are set in bulk mode.

Fix sonic-net/sonic-buildimage#6881

Why I did it
Some attributes have a dependency on others in SAI operations (e.g., setting nexthop requires packet action to be forward in route set operation). Without keeping the order of the attributes, the configuration may not be successfully applied to hardware. Therefore, it is necessary to keep the order of attributes in bulk mode.

How I verified it
Verify that sairedis applys SAI_ROUTE_ENTRY_ATTR_PACKET_ACTION before SAI_ROUTE_ENTRY_ATTR_NEXT_HOP_ID when setting default routes.

2021-03-03.06:01:12.003330|S|SAI_OBJECT_TYPE_ROUTE_ENTRY||{"dest":"::/0","switch_id":"oid:0x21000000000000","vr":"oid:0x3000000000022"}|SAI_ROUTE_ENTRY_ATTR_PACKET_ACTION=SAI_PACKET_ACTION_FORWARD||{"dest":"::/0","switch_id":"oid:0x21000000000000","vr":"oid:0x3000000000022"}|SAI_ROUTE_ENTRY_ATTR_NEXT_HOP_ID=oid:0x5000000000687
2021-03-03.06:01:12.945653|S|SAI_OBJECT_TYPE_ROUTE_ENTRY||{"dest":"0.0.0.0/0","switch_id":"oid:0x21000000000000","vr":"oid:0x3000000000022"}|SAI_ROUTE_ENTRY_ATTR_PACKET_ACTION=SAI_PACKET_ACTION_FORWARD||{"dest":"0.0.0.0/0","switch_id":"oid:0x21000000000000","vr":"oid:0x3000000000022"}|SAI_ROUTE_ENTRY_ATTR_NEXT_HOP_ID=oid:0x5000000000683

Details if related

auto it = rc.first;

// If inserted new key, assign the attr
// If found existing key, overwrite the old attr
Copy link
Contributor

@qiluo-msft qiluo-msft Mar 3, 2021

Choose a reason for hiding this comment

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

If found existing key, overwrite the old attr [](start = 11, length = 45)

One advantage or map structure is possible to merge setting operation on the same entry and same attribute. Is it still required? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it does not seem very necessary to merge the operations for the same attribute and the same entry because of the following reasons:

  1. The same entry should not show up more than once in one bulk.
  2. For each route entry, there are two attributes that might be set in bulk mode: PACKET_ACTION and NEXT_HOP_ID, each gets to set only once in the routeorch logic.
  3. For other types of entries (not supported in bulk yet), the to_sync logic should already merge the same attribute for the same entry. It does not seem necessary to do it again in bulk.

@kcudnik
Copy link
Contributor

kcudnik commented Mar 3, 2021

what ? order should not matter at all in any way to any component including SAI

@shi-su
Copy link
Contributor Author

shi-su commented Mar 3, 2021

what ? order should not matter at all in any way to any component including SAI

It is reported in sonic-net/sonic-buildimage#6881 that the hardware has a contract that route action must not be DROP when setting next hops (otherwise it gets ignored). The order matters if this is the case since the action must be set first in this scenario.

@shi-su shi-su marked this pull request as ready for review March 4, 2021 19:41
@lguohan
Copy link
Contributor

lguohan commented Mar 5, 2021

missing unit test?

lguohan
lguohan previously approved these changes Mar 5, 2021
qiluo-msft
qiluo-msft previously approved these changes Mar 5, 2021
@shi-su shi-su dismissed stale reviews from qiluo-msft and lguohan via 5f219aa March 6, 2021 05:26
@shi-su shi-su requested a review from qiluo-msft March 8, 2021 16:57
}
};

TEST_F(BulkerTest, BulkerAttrOrder)
Copy link
Contributor

Choose a reason for hiding this comment

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

BulkerTest [](start = 11, length = 10)

Did this unit test fail old code?

@shi-su shi-su merged commit 9031867 into sonic-net:master Mar 8, 2021
daall pushed a commit that referenced this pull request Mar 10, 2021
Keep attributes for the same entry in the order that the attributes are set in bulk mode. And add a unit test for the scenario in bulker.

Some attributes have a dependency on others in SAI operations (e.g., setting nexthop requires packet action to be forward in route set operation). Without keeping the order of the attributes, the configuration may not be successfully applied to hardware. Therefore, it is necessary to keep the order of attributes in bulk mode.
Junchao-Mellanox pushed a commit to Junchao-Mellanox/sonic-swss that referenced this pull request Mar 25, 2021
Keep attributes for the same entry in the order that the attributes are set in bulk mode. And add a unit test for the scenario in bulker.

Some attributes have a dependency on others in SAI operations (e.g., setting nexthop requires packet action to be forward in route set operation). Without keeping the order of the attributes, the configuration may not be successfully applied to hardware. Therefore, it is necessary to keep the order of attributes in bulk mode.
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-swss that referenced this pull request Oct 5, 2021
Keep attributes for the same entry in the order that the attributes are set in bulk mode. And add a unit test for the scenario in bulker.

Some attributes have a dependency on others in SAI operations (e.g., setting nexthop requires packet action to be forward in route set operation). Without keeping the order of the attributes, the configuration may not be successfully applied to hardware. Therefore, it is necessary to keep the order of attributes in bulk mode.
EdenGri pushed a commit to EdenGri/sonic-swss that referenced this pull request Feb 28, 2022
- What I did
following the change in PR sonic-net/sonic-buildimage#7830, the folder needs to be created when the first time enables the sniffer function.

- How I did it
check whether the path to store the sniffer file is existing or not, if not, create it.

- How to verify it
run command "config platform mlnx sniffer sdk enable", can see sniffer function can be enabled successfully.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default route stays with packet action DROP in hardware
5 participants