Skip to content

Commit 24b9f19

Browse files
author
yonatanp
committed
fixed linkage problem after moving globals to struct, and also insertion counter is inced only after real insertion
1 parent 60dabe9 commit 24b9f19

File tree

7 files changed

+9
-22
lines changed

7 files changed

+9
-22
lines changed

cfgmgr/intfmgrd.cpp

+1-7
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,7 @@ using namespace swss;
2323
* Once Orch class refactoring is done, these global variables
2424
* should be removed from here.
2525
*/
26-
int gBatchSize = 0;
27-
bool gSwssRecord = false;
28-
bool gLogRotate = false;
29-
ofstream gRecordOfs;
30-
string gRecordFile;
31-
/* Global database mutex */
32-
mutex gDbMutex;
26+
global_config_t g;
3327

3428
int main(int argc, char **argv)
3529
{

cfgmgr/vlanmgr.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ using namespace swss;
1717
#define MAX_MTU 9100
1818
#define VLAN_HLEN 4
1919

20-
extern MacAddress gMacAddress;
20+
extern global_config_t g;
2121

2222
VlanMgr::VlanMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const vector<string> &tableNames) :
2323
Orch(cfgDb, tableNames),
@@ -73,7 +73,7 @@ bool VlanMgr::addHostVlan(int vlan_id)
7373
EXEC_WITH_ERROR_THROW(cmd.str(), res);
7474

7575
cmd.str("");
76-
cmd << IP_CMD << " link set " << VLAN_PREFIX << vlan_id << " address " << gMacAddress.to_string();
76+
cmd << IP_CMD << " link set " << VLAN_PREFIX << vlan_id << " address " << g.macAddress.to_string();
7777
EXEC_WITH_ERROR_THROW(cmd.str(), res);
7878

7979
// Bring up vlan port by default
@@ -176,7 +176,7 @@ bool VlanMgr::removeHostVlanMember(int vlan_id, const string &port_alias)
176176

177177
bool VlanMgr::isVlanMacOk()
178178
{
179-
return !!gMacAddress;
179+
return !!g.macAddress;
180180
}
181181

182182
void VlanMgr::doVlanTask(Consumer &consumer)

cfgmgr/vlanmgrd.cpp

+2-10
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ using namespace swss;
2020
/* select() function timeout retry time, in millisecond */
2121
#define SELECT_TIMEOUT 1000
2222

23-
MacAddress gMacAddress;
24-
2523
/*
2624
* Following global variables are defined here for the purpose of
2725
* using existing Orch class which is to be refactored soon to
@@ -30,13 +28,7 @@ MacAddress gMacAddress;
3028
* Once Orch class refactoring is done, these global variables
3129
* should be removed from here.
3230
*/
33-
int gBatchSize = 0;
34-
bool gSwssRecord = false;
35-
bool gLogRotate = false;
36-
ofstream gRecordOfs;
37-
string gRecordFile;
38-
/* Global database mutex */
39-
mutex gDbMutex;
31+
global_config_t g;
4032

4133
int main(int argc, char **argv)
4234
{
@@ -68,7 +60,7 @@ int main(int argc, char **argv)
6860
if ( it == ovalues.end() ) {
6961
throw runtime_error("couldn't find MAC address of the device from config DB");
7062
}
71-
gMacAddress = MacAddress(it->second);
63+
g.macAddress = MacAddress(it->second);
7264

7365
VlanMgr vlanmgr(&cfgDb, &appDb, &stateDb, cfg_vlan_tables);
7466

orchagent/bmt_cache_inserter.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -526,10 +526,11 @@ int bmt_cache_inserter(void)
526526
SWSS_LOG_NOTICE("[inserter] flow insertion, was seen %d times in the window",it_pkt.second.second);
527527
if (!g.pauseCacheInsertion) {
528528
sai_status_t status = bmt_cache_insert_vhost_entry(it_pkt.first.second, it_pkt.second.first, it_pkt.first.first);
529-
g.cacheInsertCount++;
530529
SWSS_LOG_NOTICE("[inserter] [recv] bmt_cache_insert_vhost_entry. status = %d",status);
531530
if (status != SAI_STATUS_SUCCESS)
532531
SWSS_LOG_ERROR("[inserter] can't add entry to vhost table");
532+
else
533+
g.cacheInsertCount++;
533534
}
534535
} else {
535536
SWSS_LOG_NOTICE("[inserter] skipping flow insertion, was seen %d times in the window",it_pkt.second.second);

orchagent/bmt_debug/bmt_debug

48.9 KB
Binary file not shown.

orchagent/orch.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "tokenize.h"
1111
#include "logger.h"
1212
#include "consumerstatetable.h"
13-
#include "bmt_common.h"
1413

1514
using namespace swss;
1615

orchagent/orch.h

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ extern "C" {
1515
#include "consumerstatetable.h"
1616
#include "notificationconsumer.h"
1717
#include "selectabletimer.h"
18+
#include "bmt_common.h"
1819

1920
using namespace std;
2021
using namespace swss;

0 commit comments

Comments
 (0)