Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions fboss/agent/hw/sai/switch/SaiUdfManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -181,6 +183,10 @@ std::pair<uint16_t, uint16_t> 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<uint16_t>(kMaskAny), static_cast<uint16_t>(kMaskAny));
}
return std::make_pair(0, kMaskDontCare);
case cfg::UdfMatchL3Type::UDF_L3_PKT_TYPE_IPV4:
return std::make_pair(
Expand Down
5 changes: 5 additions & 0 deletions fboss/agent/hw/switch_asics/HwAsic.h
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,11 @@ class HwAsic {
std::optional<HwAsic::FabricNodeRole> 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;
Expand Down
4 changes: 4 additions & 0 deletions fboss/agent/hw/switch_asics/TomahawkUltra1Asic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions fboss/agent/hw/switch_asics/TomahawkUltra1Asic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading