-
Notifications
You must be signed in to change notification settings - Fork 6
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
Program nexthop table as a ternary match. #59
Conversation
Earlier, nexthop table was exact match, due to LAG addition, nexthop table is moved to WCM block, ternary match. Changes in krnlmon is made to program nexthop table as ternary match Signed-off-by: Sandeep N <[email protected]>
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.
Changes looks good to me.
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.
LGTM
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.
This change is already part of the LAG PR.
#54
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.
LGTM
tdi_key_field_set_value_and_mask()
is an existing function, so this change should be backward compatible with older versions of the SDE.
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.
Afterthought: the commit comment says, "nexthop table is moved to WCM block, ternary match." Does this mean that this change is dependent on a change in the P4 program?
If so, and assuming that tdi_key_field_set_value_and_mask()
doesn't take care of this internally, we have a design issue: tight coupling between implementation details of a specific P4 program and the Kernel Monitor source code.
What will happen if there's a mismatch? Will the user receive a comprehensible error message? If so, how will they receive it?
yes, this change is added in LAG PR as well. But we have an HSDES for LNW feature, because of overlay ping failure. |
Yes Derek, since there is a change in p4 program, where nexthop table has been moved to WCM block from SEM block (exact match). If user tries to program a ternary match type with TDI API other than the one used in the PR, we will see an TDI error which comes back to krnlmon and entry doesnt get programmed. |
@n-sandeep
|
You are right Derek, with the current TDI API mechanism, we cannot have a backward compatability as the match type in p4 program and TDI API are tightly coupled. When match type changes, we need to modify/use new TDI API to program the entry. Atleast P4CP doesn't have control over this, how do we achieve backward compatability ? |
In a nutshell, Kernel Monitor should be configurable, just like the pipeline. The quick-and-dirty approach is to introduce a new C header file that #defines symbols specifying compile-time conditionals. You'd have to edit the file and rebuild krnlmon to apply the change, but at least it wouldn't be baked in. Next step up would be introduce a configuration file that is read at startup time (or injected via gRPC) and used to set run-time conditionals. We could include an appropriate configuration file in the same directory as the P4 program. Better still would be to use annotations in the P4 program to specify the appropriate metadata. |
Yes Derek, annotations will come as part of next releases. we can see if such backward compatability achieveed with annotations. |
switchapi/es2k/switch_pd_routing.c
Outdated
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.
In the short term:
- Add
#define NEXTHOP_TABLE_TERNARY_MATCH 1
at the top of this file. - Instead of replacing the code outright, change it to something like this:
#if NEXTHOP_TABLE_TERNARY_MATCH
// new p4 program
status = tdi_key_field_set_value_and_mask(key_hdl, field_id,
(api_nexthop_pd_info->nexthop_handle &
~(SWITCH_HANDLE_TYPE_NHOP <<
SWITCH_HANDLE_TYPE_SHIFT)), 0xFFFF);
#else
// legacy p4 program
status = tdi_key_field_set_value(key_hdl, field_id,
(api_nexthop_pd_info->nexthop_handle &
~(SWITCH_HANDLE_TYPE_NHOP <<
SWITCH_HANDLE_TYPE_SHIFT)));
#endif
- Provide a Git commit comment saying flat-out that this commit is a breaking change. Recap the problem (a change in the P4 program [because...]), say what you changed, and state briefly what the side effects of the change are.
- Advertise the fact that there's a breaking change. For starters, I'd add a *Breaking Changes to the top-level krnlmon README.md file. Say what was done and what the user should do about it. Make the change part of this commit.
- We'll want to add a Breaking Changes notice to networking-recipe as well, when we update the submodule reference.
Since there is a change in p4 program, where nexthop table has been moved to WCM block from SEM block (exact match). TDI provides seperate API's for each block. Since Ternary/WCM needs a MASK to be populated we need to use a newer API which can take mask as a parameter. This change introduces a MACRO, which defines ternary match MACRO enablement. If user wants to pick older p4 program, then user need to modify this MACRO value to 0 and re-build infrap4d to be compatible with older Exact match type for nexthop table. Signed-off-by: Sandeep N <[email protected]>
3d7aff0
to
4751c74
Compare
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.
LGTM
See comment regarding the text to go in the commit comment and the text to go into the README file.
@@ -1,2 +1,15 @@ | |||
# ipdk-io/krnlmon | |||
The Kernel Monitor receives RFC 3549 messages from the Linux Kernel over a Netlink socket when changes are made to the kernel networking data structures. | |||
|
|||
## Breaking changes | |||
|
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.
Reworded for use in this context.
Do we need to say which P4 program?
Reword comment
The P4 program has been modified to move the NextHop table from the SEM block (exact match) to the WCM block (ternary match). This requires a corresponding change in the Kernel Monitor. This is a breaking change. Newer versions of krnlmon are incompatible with older versions of the P4 program. Signed-off-by: Sandeep N <[email protected]> Co-authored-by: Derek G Foster <[email protected]>
Earlier, nexthop table was exact match, due to LAG addition, nexthop table is moved to WCM block, ternary match. Changes in krnlmon is made to program nexthop table as ternary match