From 9f08cf1e677ee4b546748204a02b740957fef5eb Mon Sep 17 00:00:00 2001 From: Baorong Liu <96146196+baorliu@users.noreply.github.com> Date: Tue, 7 Mar 2023 09:15:19 -0800 Subject: [PATCH] [bfdorch] add default TOS value for BFD session (#2689) What I did Add default TOS value when create BFD session, default DSCP value is 46, default ECN is 0. The BFD session configuration will override this default value. Why I did it Higher DSCP value is preferred for BFD packet. How I verified it Set different TOS value in BFD session configuration, and create BFD session in DUT. Load the test image with the design change, connect a traffic generator (with BFD protocol support), capture the packet sent out by DUT, check the DSCP and ECN field in the captured packet. --- orchagent/bfdorch.cpp | 11 +++++++++++ tests/test_bfd.py | 13 ++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/orchagent/bfdorch.cpp b/orchagent/bfdorch.cpp index f242645b35..25c6c20cf2 100644 --- a/orchagent/bfdorch.cpp +++ b/orchagent/bfdorch.cpp @@ -14,6 +14,8 @@ using namespace swss; #define BFD_SESSION_DEFAULT_TX_INTERVAL 1000 #define BFD_SESSION_DEFAULT_RX_INTERVAL 1000 #define BFD_SESSION_DEFAULT_DETECT_MULTIPLIER 10 +// TOS: default 6-bit DSCP value 48, default 2-bit ecn value 0. 48<<2 = 192 +#define BFD_SESSION_DEFAULT_TOS 192 #define BFD_SESSION_MILLISECOND_TO_MICROSECOND 1000 #define BFD_SRCPORTINIT 49152 #define BFD_SRCPORTMAX 65536 @@ -243,6 +245,7 @@ bool BfdOrch::create_bfd_session(const string& key, const vector(value); + } else SWSS_LOG_ERROR("Unsupported BFD attribute %s\n", fvField(i).c_str()); } @@ -352,6 +359,10 @@ bool BfdOrch::create_bfd_session(const string& key, const vector