diff --git a/fboss/agent/hw/sai/switch/SaiUdfManager.cpp b/fboss/agent/hw/sai/switch/SaiUdfManager.cpp index 375474dae1b8b..6146f4abfe3f8 100644 --- a/fboss/agent/hw/sai/switch/SaiUdfManager.cpp +++ b/fboss/agent/hw/sai/switch/SaiUdfManager.cpp @@ -10,8 +10,10 @@ #include "fboss/agent/hw/sai/switch/SaiUdfManager.h" #include "fboss/agent/hw/sai/store/SaiStore.h" +#include "fboss/agent/hw/switch_asics/HwAsic.h" #include "fboss/agent/packet/Ethertype.h" #include "fboss/agent/packet/IPProto.h" +#include "fboss/agent/platforms/sai/SaiPlatform.h" namespace facebook::fboss { @@ -181,6 +183,10 @@ std::pair SaiUdfManager::cfgL3MatchTypeToSai( cfg::UdfMatchL3Type cfgType) const { switch (cfgType) { case cfg::UdfMatchL3Type::UDF_L3_PKT_TYPE_ANY: + if (platform_->getAsic()->useAllOnesForUdfL2TypeAny()) { + return std::make_pair( + static_cast(kMaskAny), static_cast(kMaskAny)); + } return std::make_pair(0, kMaskDontCare); case cfg::UdfMatchL3Type::UDF_L3_PKT_TYPE_IPV4: return std::make_pair( diff --git a/fboss/agent/hw/switch_asics/HwAsic.h b/fboss/agent/hw/switch_asics/HwAsic.h index c35d780f4e16a..b668dec0d064c 100644 --- a/fboss/agent/hw/switch_asics/HwAsic.h +++ b/fboss/agent/hw/switch_asics/HwAsic.h @@ -604,6 +604,11 @@ class HwAsic { std::optional fabricNodeRole); virtual bool isSupported(Feature) const = 0; + // Some SAI implementations encode an ANY UDF L2 type match with all-ones + // data and mask instead of the standard don't-care value and mask. + virtual bool useAllOnesForUdfL2TypeAny() const { + return false; + } virtual cfg::AsicType getAsicType() const = 0; std::string getAsicTypeStr() const; virtual AsicVendor getAsicVendor() const = 0; diff --git a/fboss/agent/hw/switch_asics/TomahawkUltra1Asic.cpp b/fboss/agent/hw/switch_asics/TomahawkUltra1Asic.cpp index 95cfa45b88214..ecad20fb154f3 100644 --- a/fboss/agent/hw/switch_asics/TomahawkUltra1Asic.cpp +++ b/fboss/agent/hw/switch_asics/TomahawkUltra1Asic.cpp @@ -5,6 +5,10 @@ namespace facebook::fboss { +bool TomahawkUltra1Asic::useAllOnesForUdfL2TypeAny() const { + return true; +} + bool TomahawkUltra1Asic::isSupported(Feature feature) const { switch (feature) { case HwAsic::Feature::SPAN: diff --git a/fboss/agent/hw/switch_asics/TomahawkUltra1Asic.h b/fboss/agent/hw/switch_asics/TomahawkUltra1Asic.h index bf0b618a8561e..1615af774409f 100644 --- a/fboss/agent/hw/switch_asics/TomahawkUltra1Asic.h +++ b/fboss/agent/hw/switch_asics/TomahawkUltra1Asic.h @@ -10,6 +10,7 @@ class TomahawkUltra1Asic : public BroadcomXgsAsic { public: using BroadcomXgsAsic::BroadcomXgsAsic; bool isSupported(Feature) const override; + bool useAllOnesForUdfL2TypeAny() const override; cfg::AsicType getAsicType() const override { return cfg::AsicType::ASIC_TYPE_TOMAHAWKULTRA1; }