From a3ce4814bb6673a314142183e22c0e710cd21292 Mon Sep 17 00:00:00 2001 From: Neil McKee Date: Tue, 28 May 2024 11:05:12 -0700 Subject: [PATCH] mod_sonic map back to sonic port names on counter poll callback --- src/Linux/mod_sonic.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Linux/mod_sonic.c b/src/Linux/mod_sonic.c index 6b235f8..b59e24a 100644 --- a/src/Linux/mod_sonic.c +++ b/src/Linux/mod_sonic.c @@ -1947,13 +1947,15 @@ extern "C" { if(mdata->state < HSP_SONIC_STATE_DISCOVER) return; // this can happen if we lose the redis connection and go back - EVDebug(mod, 1, "pollCounters(adaptor=%s)", adaptor->deviceName); - HSPAdaptorNIO *nio = ADAPTOR_NIO(adaptor); - + + EVDebug(mod, 1, "pollCounters(adaptor=%s, alias=%s)", + adaptor->deviceName, + nio->deviceAlias ?: ""); + if(nio->loopback) return; - + if(nio->bond_master) { // trigger synthesizeBondMetaData accumulateNioCounters(sp, adaptor, NULL, NULL); @@ -1961,6 +1963,10 @@ extern "C" { } HSPSonicPort *prt = getPort(mod, adaptor->deviceName, NO); + if(prt == NULL + && nio->deviceAlias) + prt = getPort(mod, nio->deviceAlias, NO); + if(prt) { // OK to queue 4 requests on the TCP connection, and ordering // is preserved, so can just ask for state-refresh and counters