From 0e622b7f933ccb610850160013706e7ec06ce045 Mon Sep 17 00:00:00 2001 From: Prasoon Patel Date: Thu, 5 Dec 2024 01:27:53 -0800 Subject: [PATCH] adding max scale for ndp/arp tables per ASIC Summary: Adding max scale for neighbor tables, NDP and ARP tables per ASIC. when ResourceAccountant check for available resource, it gets max scale per asic and make decision based on that I have created CSP to get max scale from brcm. I will update more ASIC, as I get response. Cisco CLI o/p: ``` S1[Device:0]> show vrf hosts usage ip-version 4 +------------------------------------------------------------+ | Hosts Resources Usage | +---------------+---------------+----------------------------+ | num-neighbors | max-neighbors | resources-usage | +---------------+---------------+----------------------------+ | 0 | 176881 | {'central-exact-match': 0} | +---------------+---------------+----------------------------+ S1[Device:0]> show vrf hosts usage ip-version 6 +------------------------------------------------------------+ | Hosts Resources Usage | +---------------+---------------+----------------------------+ | num-neighbors | max-neighbors | resources-usage | +---------------+---------------+----------------------------+ | 16 | 88465 | {'central-exact-match': 0} | +---------------+---------------+----------------------------+ ``` Reviewed By: shri-khare Differential Revision: D66732093 fbshipit-source-id: cc0658e4eb549cd9ca748948348bc1f8c28922f8 --- fboss/agent/hw/switch_asics/EbroAsic.h | 6 ++++++ fboss/agent/hw/switch_asics/FakeAsic.h | 6 ++++++ fboss/agent/hw/switch_asics/HwAsic.h | 11 +++++++++++ fboss/agent/hw/switch_asics/MockAsic.h | 6 ++++++ fboss/agent/hw/switch_asics/Tomahawk3Asic.h | 7 +++++++ fboss/agent/hw/switch_asics/Tomahawk4Asic.h | 7 +++++++ fboss/agent/hw/switch_asics/TomahawkAsic.h | 6 ++++++ 7 files changed, 49 insertions(+) diff --git a/fboss/agent/hw/switch_asics/EbroAsic.h b/fboss/agent/hw/switch_asics/EbroAsic.h index 153e3d32f2b38..8f7287e61b228 100644 --- a/fboss/agent/hw/switch_asics/EbroAsic.h +++ b/fboss/agent/hw/switch_asics/EbroAsic.h @@ -117,6 +117,12 @@ class EbroAsic : public TajoAsic { // MAX_NEXT_HOP_GROUP_MEMBERS = 32768 return 32768; } + std::optional getMaxNdpTableSize() const override { + return 88465; + } + std::optional getMaxArpTableSize() const override { + return 176881; + } uint32_t getNumCores() const override { return 12; } diff --git a/fboss/agent/hw/switch_asics/FakeAsic.h b/fboss/agent/hw/switch_asics/FakeAsic.h index a4ee75990b795..60044c11adfae 100644 --- a/fboss/agent/hw/switch_asics/FakeAsic.h +++ b/fboss/agent/hw/switch_asics/FakeAsic.h @@ -152,6 +152,12 @@ class FakeAsic : public HwAsic { std::optional getMaxEcmpMembers() const override { return 128; } + std::optional getMaxNdpTableSize() const override { + return 8192; + } + std::optional getMaxArpTableSize() const override { + return 8192; + } AsicVendor getAsicVendor() const override { return HwAsic::AsicVendor::ASIC_VENDOR_FAKE; } diff --git a/fboss/agent/hw/switch_asics/HwAsic.h b/fboss/agent/hw/switch_asics/HwAsic.h index e362e4e178c63..52364c1c968af 100644 --- a/fboss/agent/hw/switch_asics/HwAsic.h +++ b/fboss/agent/hw/switch_asics/HwAsic.h @@ -338,6 +338,17 @@ class HwAsic { return std::nullopt; } + // SAI implementaion doen not support attribute + // SAI_SWITCH_ATTR_L3_NEIGHBOR_TABLE_SIZE yet, so decided to add these + // functions to return max neighbot table size + virtual std::optional getMaxNdpTableSize() const { + return std::nullopt; + } + + virtual std::optional getMaxArpTableSize() const { + return std::nullopt; + } + virtual bool scalingFactorBasedDynamicThresholdSupported() const = 0; virtual int getBufferDynThreshFromScalingFactor( diff --git a/fboss/agent/hw/switch_asics/MockAsic.h b/fboss/agent/hw/switch_asics/MockAsic.h index 29d7ac6a7fb45..87e6f9546100e 100644 --- a/fboss/agent/hw/switch_asics/MockAsic.h +++ b/fboss/agent/hw/switch_asics/MockAsic.h @@ -146,6 +146,12 @@ class MockAsic : public HwAsic { std::optional getMaxDlbEcmpGroups() const override { return 4; } + std::optional getMaxNdpTableSize() const override { + return 8; + } + std::optional getMaxArpTableSize() const override { + return 8; + } AsicVendor getAsicVendor() const override { return HwAsic::AsicVendor::ASIC_VENDOR_MOCK; } diff --git a/fboss/agent/hw/switch_asics/Tomahawk3Asic.h b/fboss/agent/hw/switch_asics/Tomahawk3Asic.h index 69ea1ad76b691..5e876637da3ab 100644 --- a/fboss/agent/hw/switch_asics/Tomahawk3Asic.h +++ b/fboss/agent/hw/switch_asics/Tomahawk3Asic.h @@ -94,6 +94,13 @@ class Tomahawk3Asic : public BroadcomXgsAsic { // Max ACL entries per ACL table return 256; } + std::optional getMaxNdpTableSize() const override { + return 8192; + } + + std::optional getMaxArpTableSize() const override { + return 16384; + } }; } // namespace facebook::fboss diff --git a/fboss/agent/hw/switch_asics/Tomahawk4Asic.h b/fboss/agent/hw/switch_asics/Tomahawk4Asic.h index 2961d09e73948..c2c21ef021bb8 100644 --- a/fboss/agent/hw/switch_asics/Tomahawk4Asic.h +++ b/fboss/agent/hw/switch_asics/Tomahawk4Asic.h @@ -116,6 +116,13 @@ class Tomahawk4Asic : public BroadcomXgsAsic { // Max ACL entries per ACL table return 256; } + std::optional getMaxNdpTableSize() const override { + return 8192; + } + + std::optional getMaxArpTableSize() const override { + return 16384; + } }; } // namespace facebook::fboss diff --git a/fboss/agent/hw/switch_asics/TomahawkAsic.h b/fboss/agent/hw/switch_asics/TomahawkAsic.h index d89aa47baad87..8aa2fc234524e 100644 --- a/fboss/agent/hw/switch_asics/TomahawkAsic.h +++ b/fboss/agent/hw/switch_asics/TomahawkAsic.h @@ -95,6 +95,12 @@ class TomahawkAsic : public BroadcomXgsAsic { // Max ACL entries per ACL table return 256; } + std::optional getMaxNdpTableSize() const override { + return 20476; + } + std::optional getMaxArpTableSize() const override { + return 40944; + } }; } // namespace facebook::fboss