Skip to content

Commit

Permalink
Update MACsec SA PN counter to support SAI API 1.8 (sonic-net#1818)
Browse files Browse the repository at this point in the history
What I did
Rename XPN attributes from SAI_MACSEC_SA_ATTR_MINIMUM_XPN and SAI_MACSEC_SA_ATTR_XPN to SAI_MACSEC_SA_ATTR_CURRENT_XPN

Why I did it
Due to opencomputeproject/SAI#1169 that refactors the attributes about XPN, a new attributes SAI_MACSEC_SA_ATTR_CURRENT_XPN for both ingress and egress was introduced for reading the Packet number. So move the original attributes to the new one.

Signed-off-by: Ze Gan <[email protected]>
  • Loading branch information
Pterosaur authored Jul 15, 2021
1 parent 64e33b3 commit 5d97b05
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions orchagent/macsecorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,9 @@ constexpr bool DEFAULT_ENABLE_ENCRYPT = true;
constexpr bool DEFAULT_SCI_IN_SECTAG = false;
constexpr sai_macsec_cipher_suite_t DEFAULT_CIPHER_SUITE = SAI_MACSEC_CIPHER_SUITE_GCM_AES_128;

static const std::vector<std::string> macsec_egress_sa_attrs =
static const std::vector<std::string> macsec_sa_attrs =
{
"SAI_MACSEC_SA_ATTR_XPN",
};

static const std::vector<std::string> macsec_ingress_sa_attrs =
{
"SAI_MACSEC_SA_ATTR_MINIMUM_XPN",
"SAI_MACSEC_SA_ATTR_CURRENT_XPN",
};

template <typename T, typename... Args>
Expand Down Expand Up @@ -1743,16 +1738,15 @@ task_process_status MACsecOrch::createMACsecSA(
sc->m_sa_ids.erase(an);
});

installCounter(CounterType::MACSEC_SA_ATTR, port_sci_an, sc->m_sa_ids[an], macsec_sa_attrs);
std::vector<FieldValueTuple> fvVector;
fvVector.emplace_back("state", "ok");
if (direction == SAI_MACSEC_DIRECTION_EGRESS)
{
installCounter(CounterType::MACSEC_SA_ATTR, port_sci_an, sc->m_sa_ids[an], macsec_egress_sa_attrs);
m_state_macsec_egress_sa.set(swss::join('|', port_name, sci, an), fvVector);
}
else
{
installCounter(CounterType::MACSEC_SA_ATTR, port_sci_an, sc->m_sa_ids[an], macsec_ingress_sa_attrs);
m_state_macsec_ingress_sa.set(swss::join('|', port_name, sci, an), fvVector);
}

Expand Down

0 comments on commit 5d97b05

Please sign in to comment.