Skip to content

Commit

Permalink
Merge branch 'master' into SAI_DBG_GEN_DUMP_support
Browse files Browse the repository at this point in the history
  • Loading branch information
aviramd committed Sep 26, 2024
2 parents 17e7551 + 3c230d2 commit 11b9450
Show file tree
Hide file tree
Showing 37 changed files with 2,018 additions and 801 deletions.
2 changes: 1 addition & 1 deletion .azure-pipelines/test-docker-sonic-vs-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ jobs:
fi
all_tests=$(ls test_*.py | xargs)
all_tests="${all_tests} p4rt"
all_tests="${all_tests} p4rt dash"
if [ -n '${{ parameters.run_tests_pattern }}' ]; then
all_tests=" $(ls ${{ parameters.run_tests_pattern }} | xargs) "
Expand Down
7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,10 @@
# Chassis
/orchagent/fabricportsorch* @abdosi @judyjoseph
/tests/test_virtual_chassis.py @abdosi @judyjoseph

# Vnet Orch
/orchagent/vnet* @siqbal1986

# Acl Orch
/orchagent/acl* @siqbal1986

17 changes: 13 additions & 4 deletions cfgmgr/buffer_headroom_mellanox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ for i = 1, #asic_table_content, 2 do
end
end

local kb_on_tile = 0
if asic_keys[1]:sub(-1) == '4' or asic_keys[1]:sub(-1) == '5' then
-- Calculate kB on tile for Spectrum-4 and Spectrum-5
-- The last digit of ASIC table key (with the name convention of "MELLANOX-SPECTRUM-N") represents the generation of the ASIC.
kb_on_tile = port_speed / 1000 * 120 / 8
end

-- Fetch lossless traffic info from CONFIG_DB
redis.call('SELECT', config_db)
local lossless_traffic_keys = redis.call('KEYS', 'LOSSLESS_TRAFFIC_PATTERN*')
Expand Down Expand Up @@ -123,7 +130,7 @@ local speed_overhead

-- Adjustment for 8-lane port
if is_8lane ~= nil and is_8lane then
pipeline_latency = pipeline_latency * 2 - 1024
pipeline_latency = pipeline_latency * 2
speed_overhead = port_mtu
else
speed_overhead = 0
Expand All @@ -134,8 +141,10 @@ if cell_size > 2 * minimal_packet_size then
else
worst_case_factor = (2 * cell_size) / (1 + cell_size)
end
worst_case_factor = math.ceil(worst_case_factor)

cell_occupancy = (100 - small_packet_percentage + small_packet_percentage * worst_case_factor) / 100
local small_packet_percentage_by_byte = 100 * minimal_packet_size / ((small_packet_percentage * minimal_packet_size + (100 - small_packet_percentage) * lossless_mtu) / 100)
cell_occupancy = (100 - small_packet_percentage_by_byte + small_packet_percentage_by_byte * worst_case_factor) / 100

if (gearbox_delay == 0) then
bytes_on_gearbox = 0
Expand All @@ -148,8 +157,8 @@ 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
bytes_on_cable = 2 * cable_length * port_speed * 1000000000 / speed_of_light / (8 * 1000)
propagation_delay = port_mtu + bytes_on_cable + 2 * bytes_on_gearbox + mac_phy_delay + peer_response_time + kb_on_tile

-- Calculate the xoff and xon and then round up at 1024 bytes
xoff_value = lossless_mtu + propagation_delay * cell_occupancy
Expand Down
6 changes: 5 additions & 1 deletion cfgmgr/teammgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,15 @@ bool TeamMgr::checkPortIffUp(const string &port)
if (fd == -1 || ioctl(fd, SIOCGIFFLAGS, &ifr) == -1)
{
SWSS_LOG_ERROR("Failed to get port %s flags", port.c_str());
if (fd != -1)
{
close(fd);
}
return false;
}

SWSS_LOG_INFO("Get port %s flags %i", port.c_str(), ifr.ifr_flags);

close(fd);
return ifr.ifr_flags & IFF_UP;
}

Expand Down
24 changes: 23 additions & 1 deletion orchagent/aclorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ static acl_packet_action_lookup_t aclPacketActionLookup =
{
{ PACKET_ACTION_FORWARD, SAI_PACKET_ACTION_FORWARD },
{ PACKET_ACTION_DROP, SAI_PACKET_ACTION_DROP },
{ PACKET_ACTION_COPY, SAI_PACKET_ACTION_COPY },
};

static acl_dtel_flow_op_type_lookup_t aclDTelFlowOpTypeLookup =
Expand Down Expand Up @@ -2023,6 +2024,23 @@ bool AclRuleMirror::validate()
return true;
}

bool AclRuleMirror::createCounter()
{
SWSS_LOG_ENTER();

bool state = false;

m_pMirrorOrch->getSessionStatus(m_sessionName, state);

// If the mirror session is active, create the ACL counter
if(state)
{
return AclRule::createCounter();
}

return true;
}

bool AclRuleMirror::createRule()
{
SWSS_LOG_ENTER();
Expand Down Expand Up @@ -2152,7 +2170,11 @@ void AclRuleMirror::onUpdate(SubjectType type, void *cntx)
if (update->active)
{
SWSS_LOG_INFO("Activating mirroring ACL %s for session %s", m_id.c_str(), m_sessionName.c_str());
activate();
// During mirror session activation, the newly created counter needs to be registered to the FC.
if(activate() && hasCounter())
{
m_pAclOrch->registerFlexCounter(*this);
}
}
else
{
Expand Down
2 changes: 2 additions & 0 deletions orchagent/aclorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@

#define PACKET_ACTION_FORWARD "FORWARD"
#define PACKET_ACTION_DROP "DROP"
#define PACKET_ACTION_COPY "COPY"
#define PACKET_ACTION_REDIRECT "REDIRECT"
#define PACKET_ACTION_DO_NOT_NAT "DO_NOT_NAT"

Expand Down Expand Up @@ -343,6 +344,7 @@ class AclRuleMirror: public AclRule
AclRuleMirror(AclOrch *m_pAclOrch, MirrorOrch *m_pMirrorOrch, string rule, string table);
bool validateAddAction(string attr_name, string attr_value);
bool validate();
bool createCounter();
bool createRule();
bool removeRule();
void onUpdate(SubjectType, void *) override;
Expand Down
4 changes: 2 additions & 2 deletions orchagent/bulker.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ static inline bool operator==(const sai_pa_validation_entry_t& a, const sai_pa_v
static inline bool operator==(const sai_outbound_routing_entry_t& a, const sai_outbound_routing_entry_t& b)
{
return a.switch_id == b.switch_id
&& a.eni_id == b.eni_id
&& a.outbound_routing_group_id == b.outbound_routing_group_id
&& a.destination == b.destination
;
}
Expand Down Expand Up @@ -257,7 +257,7 @@ namespace std
{
size_t seed = 0;
boost::hash_combine(seed, a.switch_id);
boost::hash_combine(seed, a.eni_id);
boost::hash_combine(seed, a.outbound_routing_group_id);
boost::hash_combine(seed, a.destination);
return seed;
}
Expand Down
27 changes: 22 additions & 5 deletions orchagent/crmorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
#define CRM_EXCEEDED_MSG_MAX 10
#define CRM_ACL_RESOURCE_COUNT 256

using namespace std;
using namespace swss;

extern sai_object_id_t gSwitchId;
extern sai_switch_api_t *sai_switch_api;
extern sai_acl_api_t *sai_acl_api;
extern event_handle_t g_events_handle;

using namespace std;
using namespace swss;

extern string gMySwitchType;

const map<CrmResourceType, string> crmResTypeNameMap =
{
Expand Down Expand Up @@ -808,6 +808,12 @@ bool CrmOrch::getResAvailability(CrmResourceType type, CrmResourceEntry &res)

bool CrmOrch::getDashAclGroupResAvailability(CrmResourceType type, CrmResourceEntry &res)
{
if (gMySwitchType != "dpu")
{
res.resStatus = CrmResourceStatus::CRM_RES_NOT_SUPPORTED;
return false;
}

sai_object_type_t objType = crmResSaiObjAttrMap.at(type);

for (auto &cnt : res.countersMap)
Expand Down Expand Up @@ -872,6 +878,12 @@ void CrmOrch::getResAvailableCounters()
case CrmResourceType::CRM_SRV6_MY_SID_ENTRY:
case CrmResourceType::CRM_MPLS_NEXTHOP:
case CrmResourceType::CRM_SRV6_NEXTHOP:
case CrmResourceType::CRM_TWAMP_ENTRY:
{
getResAvailability(res.first, res.second);
break;
}

case CrmResourceType::CRM_DASH_VNET:
case CrmResourceType::CRM_DASH_ENI:
case CrmResourceType::CRM_DASH_ENI_ETHER_ADDRESS_MAP:
Expand All @@ -885,8 +897,13 @@ void CrmOrch::getResAvailableCounters()
case CrmResourceType::CRM_DASH_IPV6_OUTBOUND_CA_TO_PA:
case CrmResourceType::CRM_DASH_IPV4_ACL_GROUP:
case CrmResourceType::CRM_DASH_IPV6_ACL_GROUP:
case CrmResourceType::CRM_TWAMP_ENTRY:
{
if (gMySwitchType != "dpu")
{
res.second.resStatus = CrmResourceStatus::CRM_RES_NOT_SUPPORTED;
break;
}

getResAvailability(res.first, res.second);
break;
}
Expand Down
Loading

0 comments on commit 11b9450

Please sign in to comment.