Skip to content

Commit

Permalink
Merge branch 'master' into acl_table_type
Browse files Browse the repository at this point in the history
  • Loading branch information
stepanblyschak authored Nov 19, 2021
2 parents e2b1d3e + 797dab4 commit 9b08a82
Show file tree
Hide file tree
Showing 50 changed files with 5,901 additions and 730 deletions.
5 changes: 4 additions & 1 deletion cfgmgr/buffer_check_headroom_mellanox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ end
-- Initialize the accumulative size with 4096
-- This is to absorb the possible deviation
local accumulative_size = 4096
-- Egress mirror size: 2 * maximum MTU (10k)
local egress_mirror_size = 20*1024

local appl_db = "0"
local state_db = "6"
Expand Down Expand Up @@ -56,8 +58,9 @@ local pipeline_latency = tonumber(redis.call('HGET', asic_keys[1], 'pipeline_lat
if is_port_with_8lanes(lanes) then
-- The pipeline latency should be adjusted accordingly for ports with 2 buffer units
pipeline_latency = pipeline_latency * 2 - 1
egress_mirror_size = egress_mirror_size * 2
end
accumulative_size = accumulative_size + 2 * pipeline_latency * 1024
accumulative_size = accumulative_size + 2 * pipeline_latency * 1024 + egress_mirror_size

-- Fetch all keys in BUFFER_PG according to the port
redis.call('SELECT', appl_db)
Expand Down
25 changes: 24 additions & 1 deletion cfgmgr/buffer_headroom_mellanox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,23 @@ local state_db = "6"

local ret = {}

-- pause quanta should be taken for each operating speed is defined in IEEE 802.3 31B.3.7
-- the key of table pause_quanta_per_speed is operating speed at Mb/s
-- the value of table pause_quanta_per_speed is the number of pause_quanta
local pause_quanta_per_speed = {}
pause_quanta_per_speed[400000] = 905
pause_quanta_per_speed[200000] = 453
pause_quanta_per_speed[100000] = 394
pause_quanta_per_speed[50000] = 147
pause_quanta_per_speed[40000] = 118
pause_quanta_per_speed[25000] = 80
pause_quanta_per_speed[10000] = 67
pause_quanta_per_speed[1000] = 2
pause_quanta_per_speed[100] = 1

-- Get pause_quanta from the pause_quanta_per_speed table
local pause_quanta = pause_quanta_per_speed[port_speed]

if gearbox_delay == nil then
gearbox_delay = 0
end
Expand All @@ -55,7 +72,8 @@ for i = 1, #asic_table_content, 2 do
if asic_table_content[i] == "mac_phy_delay" then
mac_phy_delay = tonumber(asic_table_content[i+1]) * 1024
end
if asic_table_content[i] == "peer_response_time" then
-- If failed to get pause_quanta from the table, then use the default peer_response_time stored in state_db
if asic_table_content[i] == "peer_response_time" and pause_quanta == nil then
peer_response_time = tonumber(asic_table_content[i+1]) * 1024
end
end
Expand Down Expand Up @@ -124,6 +142,11 @@ else
bytes_on_gearbox = port_speed * gearbox_delay / (8 * 1024)
end

-- If successfully get pause_quanta from the table, then calculate peer_response_time from it
if pause_quanta ~= nil then
peer_response_time = (pause_quanta) * 512 / 8
end

bytes_on_cable = 2 * cable_length * port_speed * 1000000000 / speed_of_light / (8 * 1024)
propagation_delay = port_mtu + bytes_on_cable + 2 * bytes_on_gearbox + mac_phy_delay + peer_response_time

Expand Down
5 changes: 4 additions & 1 deletion cfgmgr/macsecmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,10 +547,13 @@ bool MACsecMgr::isPortStateOk(const std::string & port_name)

std::vector<FieldValueTuple> temp;
std::string state;
std::string oper_status;

if (m_statePortTable.get(port_name, temp)
&& get_value(temp, "state", state)
&& state == "ok")
&& state == "ok"
&& get_value(temp, "netdev_oper_status", oper_status)
&& oper_status == "up")
{
SWSS_LOG_DEBUG("Port '%s' is ready", port_name.c_str());
return true;
Expand Down
2 changes: 2 additions & 0 deletions doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,8 @@ name as object key and member list as attribute.
"pfc_enable": "3,4",
"pfc_to_queue_map": "AZURE",
"dscp_to_tc_map": "AZURE",
"dscp_to_fc_map": "AZURE",
"exp_to_fc_map": "AZURE",
"scheduler": "scheduler.port"
}
}
Expand Down
74 changes: 74 additions & 0 deletions doc/swss-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ and reflects the LAG ports into the redis under: `LAG_TABLE:<team0>:port`
blackhole = BIT ; Set to 1 if this route is a blackhole (or null0)
weight = weight_list ; List of weights.
nexthop_group = string ; index within the NEXTHOP_GROUP_TABLE, used instead of nexthop and intf fields
segment = string ; SRV6 segment name
seg_src = string ; ipv6 address for SRV6 tunnel source

---------------------------------------------

Expand All @@ -192,6 +194,28 @@ and reflects the LAG ports into the redis under: `LAG_TABLE:<team0>:port`
mpls_nh = STRING ; Comma-separated list of MPLS NH info.
weight = weight_list ; List of weights.

---------------------------------------------
### CLASS_BASED_NEXT_HOP_GROUP_TABLE
;Stores a list of groups of one or more next hop groups used for class based forwarding
;Status: Mandatory
key = CLASS_BASED_NEXT_HOP_GROUP_TABLE:string ; arbitrary index for the next hop group
members = NEXT_HOP_GROUP_TABLE.key ; one or more separated by ","
selection_map = FC_TO_NHG_INDEX_MAP_TABLE.key ; the NHG map to use for this CBF NHG

---------------------------------------------
### FC_TO_NHG_INDEX_MAP_TABLE
; FC to Next hop group index map
key = "FC_TO_NHG_INDEX_MAP_TABLE:"name
fc_num = 1*DIGIT ;value
nh_index = 1*DIGIT; index of NH inside NH group

Example:
127.0.0.1:6379> hgetall "FC_TO_NHG_INDEX_MAP_TABLE:AZURE"
1) "0" ;fc_num
2) "0" ;nhg_index
3) "1"
4) "0"

---------------------------------------------
### NEIGH_TABLE
; Stores the neighbors or next hop IP address and output port or
Expand All @@ -203,6 +227,21 @@ and reflects the LAG ports into the redis under: `LAG_TABLE:<team0>:port`
neigh = 12HEXDIG ; mac address of the neighbor
family = "IPv4" / "IPv6" ; address family

---------------------------------------------
### SRV6_SID_LIST_TABLE
; Stores IPV6 prefixes for a SRV6 segment name
key = ROUTE_TABLE:segment ; SRV6 segment name
; field = value
path = STRING ; Comma-separated list of IPV6 prefixes for a SRV6 segment

---------------------------------------------
### SRV6_MY_SID_TABLE
; Stores SRV6 MY_SID table entries and associated actions
key = STRING ; SRV6 MY_SID prefix string
; field = value
action = STRING ; MY_SID actions like "end", "end.dt46"
vrf = STRING ; VRF string for END.DT46 or END.DT4 or END.DT6

---------------------------------------------
### FDB_TABLE

Expand Down Expand Up @@ -304,6 +343,41 @@ and reflects the LAG ports into the redis under: `LAG_TABLE:<team0>:port`
9) "4"
10) "8"

### DSCP_TO_FC_TABLE_NAME
; dscp to FC map
;SAI mapping - qos_map object with SAI_QOS_MAP_ATTR_TYPE == sai_qos_map_type_t::SAI_QOS_MAP_TYPE_DSCP_TO_FORWARDING_CLASS
key = "DSCP_TO_FC_MAP_TABLE:"name
;field value
dscp_value = 1*DIGIT
fc_value = 1*DIGIT

Example:
127.0.0.1:6379> hgetall "DSCP_TO_FC_MAP_TABLE:AZURE"
1) "0" ;dscp
2) "1" ;fc
3) "1"
4) "1"
5) "2"
6) "3"
7)
---------------------------------------------
### EXP_TO_FC_MAP_TABLE
; dscp to FC map
;SAI mapping - qos_map object with SAI_QOS_MAP_ATTR_TYPE == sai_qos_map_type_t::SAI_QOS_MAP_TYPE_MPLS_EXP_TO_FORWARDING_CLASS
key = "EXP_TO_FC_MAP_TABLE:"name
;field value
mpls_exp_value = 1*DIGIT
fc_value = 1*DIGIT

Example:
127.0.0.1:6379> hgetall "EXP_TO_FC_MAP_TABLE:AZURE"
1) "0" ;mpls_exp
2) "1" ;fc
3) "1"
4) "1"
5) "2"
6) "3"

---------------------------------------------
### SCHEDULER_TABLE
; Scheduler table
Expand Down
1 change: 1 addition & 0 deletions lgtm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ extraction:
- swig3.0
- libpython2.7-dev
- libgtest-dev
- libgmock-dev
- dh-exec
- doxygen
- cdbs
Expand Down
113 changes: 113 additions & 0 deletions lib/subintf.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#include <cerrno>
#include <cstring>
#include <array>
#include <net/if.h>
#include "subintf.h"

using namespace swss;

subIntf::subIntf(const std::string &ifName)
{
alias = ifName;
size_t found = alias.find(VLAN_SUB_INTERFACE_SEPARATOR);
if (found != std::string::npos)
{
parentIf = alias.substr(0, found);
if (!parentIf.compare(0, strlen("Eth"), "Eth"))
{
std::string parentIfName;
if (!parentIf.compare(0, strlen("Ethernet"), "Ethernet"))
{
parentIfShortName = "Eth" + parentIf.substr(strlen("Ethernet"));
isCompressed = false;
parentIfName = "Ethernet" + parentIf.substr(strlen("Ethernet"));
}
else
{
parentIfShortName = "Eth" + parentIf.substr(strlen("Eth"));
isCompressed = true;
parentIfName = "Ethernet" + parentIf.substr(strlen("Eth"));
}
parentIf = parentIfName;
subIfIdx = alias.substr(found + 1);
}
else if (!parentIf.compare(0, strlen("Po"), "Po"))
{
if (!parentIf.compare(0, strlen("PortChannel"), "PortChannel"))
{
isCompressed = false;
parentIfShortName = "Po" + parentIf.substr(strlen("PortChannel"));
parentIf = "PortChannel" + parentIf.substr(strlen("PortChannel"));
}
else
{
isCompressed = true;
parentIfShortName = "Po" + parentIf.substr(strlen("Po"));
parentIf = "PortChannel" + parentIf.substr(strlen("Po"));
}
subIfIdx = alias.substr(found + 1);
}
else
{
subIfIdx = "";
}
}
}

bool subIntf::isValid() const
{
if (subIfIdx == "")
{
return false;
}
else if (alias.length() >= IFNAMSIZ)
{
return false;
}

return true;
}

std::string subIntf::parentIntf() const
{
return parentIf;
}

int subIntf::subIntfIdx() const
{
uint16_t id;
try
{
id = static_cast<uint16_t>(stoul(subIfIdx));
}
catch (const std::invalid_argument &e)
{
return -1;
}
catch (const std::out_of_range &e)
{
return -1;
}
return id;
}

std::string subIntf::longName() const
{
if (isValid() == false)
return "";

return (parentIf + VLAN_SUB_INTERFACE_SEPARATOR + subIfIdx);
}

std::string subIntf::shortName() const
{
if (isValid() == false)
return "";

return (parentIfShortName + VLAN_SUB_INTERFACE_SEPARATOR + subIfIdx);
}

bool subIntf::isShortName() const
{
return ((isCompressed == true) ? true : false);
}
23 changes: 23 additions & 0 deletions lib/subintf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once

#define VLAN_SUB_INTERFACE_SEPARATOR "."
namespace swss {
class subIntf
{
public:
subIntf(const std::string &ifName);
bool isValid() const;
std::string parentIntf() const;
int subIntfIdx() const;
std::string longName() const;
std::string shortName() const;
bool isShortName() const;

private:
std::string alias;
std::string subIfIdx;
std::string parentIf;
std::string parentIfShortName;
bool isCompressed = false;
};
}
11 changes: 8 additions & 3 deletions orchagent/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ INCLUDES = -I $(top_srcdir)/lib \
-I $(top_srcdir)/warmrestart \
-I flex_counter \
-I debug_counter \
-I pbh
-I pbh \
-I nhg

CFLAGS_SAI = -I /usr/include/sai

Expand Down Expand Up @@ -40,7 +41,10 @@ orchagent_SOURCES = \
orchdaemon.cpp \
orch.cpp \
notifications.cpp \
nhgorch.cpp \
nhgorch.cpp \
nhgbase.cpp \
cbf/cbfnhgorch.cpp \
cbf/nhgmaporch.cpp \
routeorch.cpp \
mplsrouteorch.cpp \
neighorch.cpp \
Expand Down Expand Up @@ -82,7 +86,8 @@ orchagent_SOURCES = \
muxorch.cpp \
macsecorch.cpp \
lagid.cpp \
bfdorch.cpp
bfdorch.cpp \
srv6orch.cpp

orchagent_SOURCES += flex_counter/flex_counter_manager.cpp flex_counter/flex_counter_stat_manager.cpp
orchagent_SOURCES += debug_counter/debug_counter.cpp debug_counter/drop_counter.cpp
Expand Down
2 changes: 1 addition & 1 deletion orchagent/bufferorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extern sai_buffer_api_t *sai_buffer_api;
extern PortsOrch *gPortsOrch;
extern sai_object_id_t gSwitchId;

#define BUFFER_POOL_WATERMARK_FLEX_STAT_COUNTER_POLL_MSECS "10000"
#define BUFFER_POOL_WATERMARK_FLEX_STAT_COUNTER_POLL_MSECS "60000"


static const vector<sai_buffer_pool_stat_t> bufferPoolWatermarkStatIds =
Expand Down
Loading

0 comments on commit 9b08a82

Please sign in to comment.