Skip to content

Commit

Permalink
[portsorch] query SAI_HOSTIF_ATTR_QUEUE switch capability once
Browse files Browse the repository at this point in the history
Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
  • Loading branch information
stepanblyschak committed Aug 21, 2024
1 parent 29cea04 commit b6942a9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
34 changes: 11 additions & 23 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,15 @@ PortsOrch::PortsOrch(DBConnector *db, DBConnector *stateDb, vector<table_name_wi
}
}

if (gSwitchOrch->querySwitchCapability(SAI_OBJECT_TYPE_HOSTIF, SAI_HOSTIF_ATTR_QUEUE))
{
m_supportsHostIfTxQueue = true;
}
else
{
SWSS_LOG_WARN("Hostif queue attribute not supported");
}

// Query whether SAI supports Host Tx Signal and Host Tx Notification

sai_attr_capability_t capability;
Expand Down Expand Up @@ -3278,17 +3287,7 @@ bool PortsOrch::createVlanHostIntf(Port& vl, string hostif_name)
attr.value.chardata[SAI_HOSTIF_NAME_SIZE - 1] = '\0';
attrs.push_back(attr);

bool set_hostif_tx_queue = false;
if (gSwitchOrch->querySwitchCapability(SAI_OBJECT_TYPE_HOSTIF, SAI_HOSTIF_ATTR_QUEUE))
{
set_hostif_tx_queue = true;
}
else
{
SWSS_LOG_WARN("Hostif queue attribute not supported");
}

if (set_hostif_tx_queue)
if (m_supportsHostIfTxQueue)
{
attr.id = SAI_HOSTIF_ATTR_QUEUE;
attr.value.u32 = DEFAULT_HOSTIF_TX_QUEUE;
Expand Down Expand Up @@ -5934,17 +5933,7 @@ bool PortsOrch::addHostIntfs(Port &port, string alias, sai_object_id_t &host_int
attr.value.chardata[SAI_HOSTIF_NAME_SIZE - 1] = '\0';
attrs.push_back(attr);

bool set_hostif_tx_queue = false;
if (gSwitchOrch->querySwitchCapability(SAI_OBJECT_TYPE_HOSTIF, SAI_HOSTIF_ATTR_QUEUE))
{
set_hostif_tx_queue = true;
}
else
{
SWSS_LOG_WARN("Hostif queue attribute not supported");
}

if (set_hostif_tx_queue)
if (m_supportsHostIfTxQueue)
{
attr.id = SAI_HOSTIF_ATTR_QUEUE;
attr.value.u32 = DEFAULT_HOSTIF_TX_QUEUE;
Expand Down Expand Up @@ -9891,4 +9880,3 @@ void PortsOrch::doTask(swss::SelectableTimer &timer)
m_port_state_poller->stop();
}
}

1 change: 1 addition & 0 deletions orchagent/portsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ class PortsOrch : public Orch, public Subject
bool oper_fec_sup = false;
bool saiHwTxSignalSupported = false;
bool saiTxReadyNotifySupported = false;
bool m_supportsHostIfTxQueue = false;

swss::SelectableTimer *m_port_state_poller = nullptr;

Expand Down

0 comments on commit b6942a9

Please sign in to comment.