-
Notifications
You must be signed in to change notification settings - Fork 29
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
SRv6 support #141
base: main
Are you sure you want to change the base?
SRv6 support #141
Conversation
saivpp/src/SwitchStateBaseRoute.cpp
Outdated
if (isLoopback == false && is_ip_nbr_active() == true) | ||
{ | ||
attr.id = SAI_ROUTE_ENTRY_ATTR_NEXT_HOP_ID; | ||
CHECK_STATUS(get(SAI_OBJECT_TYPE_ROUTE_ENTRY, serializedObjectId, 1, &attr)); |
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.
srv6 route can't be over loopback interface so it is safe to move it to the if clause, where it is already getting route_entry object.
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.
Updated
saivpp/src/SwitchStateBaseRoute.cpp
Outdated
nh_oid = attr.value.oid; | ||
|
||
attr.id = SAI_NEXT_HOP_ATTR_TYPE; | ||
CHECK_STATUS(get(SAI_OBJECT_TYPE_NEXT_HOP, nh_oid, 1, &attr)); |
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.
nexthop can be null and we don't want it to error out.
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.
Fixed
saivpp/src/SwitchStateBaseSRv6.cpp
Outdated
|
||
using namespace saivpp; | ||
|
||
sai_status_t TunnelManager::fill_next_hop( |
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.
Since it is an implementation of TunnelManager, maybe rename it to TunnelManagerSRv6? You can even create a new class if there is no commonality with existing code.
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.
Done
saivpp/src/SwitchStateBaseSRv6.cpp
Outdated
return status; | ||
} | ||
|
||
sai_status_t TunnelManager::add_sidlist( |
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.
add_sidlist and create_sidlist (same for del_sidlist and remove_sidlist) are too similar. It is easy to confuse between them. Maybe create_sidlist_internal?
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.
Done
saivpp/src/SwitchStateBaseSRv6.cpp
Outdated
std::string hwif_name; | ||
|
||
attr.id = SAI_NEXT_HOP_ATTR_TYPE; | ||
CHECK_STATUS(m_switch_db->get(SAI_OBJECT_TYPE_NEXT_HOP, next_hop_oid, 1, &attr)); |
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.
Please change to get_linked_object from SaiObjectDB. You can follow
auto tunnel_obj = tunnel_nh_obj->get_linked_object(SAI_OBJECT_TYPE_TUNNEL, SAI_NEXT_HOP_ATTR_TUNNEL_ID); |
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.
Done
saivpp/src/SwitchStateBaseSRv6.cpp
Outdated
return SAI_STATUS_FAILURE; | ||
} | ||
attr.id = SAI_NEXT_HOP_ATTR_IP; | ||
if(m_switch_db->get(SAI_OBJECT_TYPE_NEXT_HOP, next_hop_oid, 1, &attr) == SAI_STATUS_SUCCESS) |
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.
Use get_mandatory_attr from SaiObject
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.
Updated
saivpp/src/vppxlate/SaiVppXlate.c
Outdated
|
||
S (mp); | ||
|
||
W (ret); |
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.
Please use WR. W can return earlier if there is unsolicited event.
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.
Done
saivpp/src/vppxlate/SaiVppXlate.c
Outdated
|
||
S (mp); | ||
|
||
W (ret); |
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.
Change to WR
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.
Done
@@ -507,6 +528,25 @@ static bool vpp_to_vl_api_ip_addr(vl_api_address_t *vpp_addr, vpp_ip_addr_t *ipa | |||
return ret; | |||
} | |||
|
|||
static bool vpp_to_vl_api_ip6_address(vl_api_ip6_address_t *vpp_addr, vpp_ip_addr_t *ipaddr) |
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.
There is already vpp_to_vl_api_ip_addr. The only difference it supports IPv4 address. But there is too much overlap between them. You can call that function then check if it is ipv6. Too many specialized functions add maintenance cost
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 was added due to different VPP API datatype; vl_api_ip6_address_t compared to vl_api_address_t. Can use vpp_to_vl_api_ip_addr but may require an additional copy
saivpp/src/vppxlate/SaiVppXlate.c
Outdated
@@ -3197,3 +3296,252 @@ static int vpp_bfd_udp_enable_multihop () | |||
|
|||
return ret; | |||
} | |||
|
|||
static u8 translate_behavior(u32 behavior) |
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.
nit: the name is a little bit too generic. Maybe translate_sr_behavior?
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.
Done
/azp run |
Pull request contains merge conflicts. |
/azp run |
No pipelines are associated with this pull request. |
Overview:
These changes add support for SRv6 in sonic-vpp platform. Supported mysid behaviors: uN, uA, DT6, DT4. SRv6 policy and steering also supported.
Changes:
Created SwitchStateBaseSRv6.cpp to handle SRv6 SAI calls, and added the relevant functions to SaiVppXlate.c to translate into VPP API calls. Calls to SwitchStateBaseSRv6.cpp functions added to SwitchStateBase.cpp and SwitchStateBaseRoute.cpp for when SRv6 objects are received.