Skip to content

Commit

Permalink
Revert "Add IPv6 bypass to dash SAI"
Browse files Browse the repository at this point in the history
This reverts commit 44d95c7.
  • Loading branch information
Pterosaur committed Jun 3, 2024
1 parent 44d95c7 commit 52c4dcf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
13 changes: 3 additions & 10 deletions dash-pipeline/SAI/src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ extern "C"
#include <limits>
#include <fstream>
#include <memory>
#include <type_traits>

namespace dash
{
Expand Down Expand Up @@ -240,13 +239,13 @@ namespace dash
int leadingNonZeroBits(const sai_ip6_t& ipv6);

template<typename T>
sai_status_t ipPrefixSetVal(const sai_attribute_value_t &value, T &t, int bits = -1)
void ipPrefixSetVal(const sai_attribute_value_t &value, T &t, int bits = -1)
{
return ipPrefixSetVal(value.ipprefix, t);
ipPrefixSetVal(value.ipprefix, t);
}

template<typename T>
sai_status_t ipPrefixSetVal(const sai_ip_prefix_t &value, T &t, int bits = -1)
void ipPrefixSetVal(const sai_ip_prefix_t &value, T &t, int bits = -1)
{
switch(value.addr_family)
{
Expand All @@ -269,10 +268,6 @@ namespace dash
case SAI_IP_ADDR_FAMILY_IPV6:
{
uint8_t ip[16];
if (std::is_same<T, p4::v1::FieldMatch_LPM>::value) {
// BMv2 cannot support IPv6 LPM with prefix
return SAI_STATUS_NOT_SUPPORTED;
}

std::copy(const_cast<uint8_t*>(&value.addr.ip6[0]), const_cast<uint8_t*>(&value.addr.ip6[0]) + 16, ip);

Expand All @@ -286,8 +281,6 @@ namespace dash
default:
assert(0 && "unrecognzed value.ipaddr.addr_family");
}

return SAI_STATUS_SUCCESS;
}

template<typename T>
Expand Down
15 changes: 3 additions & 12 deletions dash-pipeline/SAI/templates/saiapi.cpp.j2
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,7 @@ static sai_status_t dash_sai_create_{{ table.name }}(
{{key.field}}SetVal(attr_list[i].value, mf_exact, {{key.bitwidth}});
{% elif key.match_type == 'lpm' %}
auto mf_lpm = mf->mutable_lpm();
if ({{key.field}}SetVal(tableEntry->{{ key.name | lower }}, mf_lpm, {{key.bitwidth}}) != SAI_STATUS_SUCCESS) {
DASH_LOG_WARN("Failed to set lpm value for {{key.field}}");
return SAI_STATUS_SUCCESS;
}
{{key.field}}SetVal(attr_list[i].value, mf_lpm, {{key.bitwidth}});
{% elif key.match_type == 'list' %}
// BMv2 doesn't support "list" match type, and we are using "optional" match in v1model as our implementation.
// Hence, here we only take the first item from the list and program it as optional match.
Expand Down Expand Up @@ -405,10 +402,7 @@ static sai_status_t dash_sai_create_{{ table.name }}(
{% endif %}
{% elif key.match_type == 'lpm' %}
auto mf_lpm = mf->mutable_lpm();
if ({{key.field}}SetVal(tableEntry->{{ key.name | lower }}, mf_lpm, {{key.bitwidth}}) != SAI_STATUS_SUCCESS) {
DASH_LOG_WARN("Failed to set lpm value for {{key.field}}");
return SAI_STATUS_SUCCESS;
}
{{key.field}}SetVal(tableEntry->{{ key.name | lower }}, mf_lpm, {{key.bitwidth}});
{% elif key.match_type == 'ternary' %}
auto mf_ternary = mf->mutable_ternary();
{{key.field}}SetVal(tableEntry->{{ key.name | lower }}, mf_ternary, {{key.bitwidth}});
Expand Down Expand Up @@ -589,10 +583,7 @@ static sai_status_t dash_sai_remove_{{ table.name }}(
//{{key.field}}SetVal(tableEntry->{{ key.name | lower }}, mf_exact, {{key.bitwidth}});
{% elif key.match_type == 'lpm' %}
auto mf_lpm = mf->mutable_lpm();
if ({{key.field}}SetVal(tableEntry->{{ key.name | lower }}, mf_lpm, {{key.bitwidth}}) != SAI_STATUS_SUCCESS) {
DASH_LOG_WARN("Failed to set lpm value for {{key.field}}");
return SAI_STATUS_SUCCESS;
}
{{key.field}}SetVal(tableEntry->{{ key.name | lower }}, mf_lpm, {{key.bitwidth}});
{% elif key.match_type == 'ternary' %}
auto mf_ternary = mf->mutable_ternary();
{{key.field}}SetVal(tableEntry->{{ key.name | lower }}, mf_ternary, {{key.bitwidth}});
Expand Down

0 comments on commit 52c4dcf

Please sign in to comment.