2525#define MIRROR_SESSION_DSCP_MIN 0
2626#define MIRROR_SESSION_DSCP_MAX 63
2727
28+ #define MLNX_PLATFORM " mlnx"
29+
2830extern sai_mirror_api_t *sai_mirror_api;
2931extern sai_object_id_t gSwitchId ;
3032
3133using namespace std ::rel_ops;
3234
33- MirrorOrch::MirrorOrch (DBConnector *db, string tableName,
35+ MirrorEntry::MirrorEntry (const string& platform) :
36+ status(false ),
37+ greType(0 ),
38+ dscp(0 ),
39+ ttl(0 ),
40+ queue(0 ),
41+ addVLanTag(false ),
42+ sessionId(0 ),
43+ refCount(0 )
44+ {
45+ nexthopInfo.resolved = false ;
46+ neighborInfo.resolved = false ;
47+
48+ if (platform == MLNX_PLATFORM)
49+ {
50+ greType = 0x6558 ;
51+ queue = 1 ;
52+ }
53+ else
54+ {
55+ greType = 0x88be ;
56+ queue = 0 ;
57+ }
58+
59+ dscp = 8 ;
60+ ttl = 255 ;
61+ }
62+
63+ MirrorOrch::MirrorOrch (TableConnector appDbConnector, TableConnector confDbConnector,
3464 PortsOrch *portOrch, RouteOrch *routeOrch, NeighOrch *neighOrch, FdbOrch *fdbOrch) :
35- Orch(db, tableName ),
65+ Orch(confDbConnector.first, confDbConnector.second ),
3666 m_portsOrch(portOrch),
3767 m_routeOrch(routeOrch),
3868 m_neighOrch(neighOrch),
3969 m_fdbOrch(fdbOrch),
40- m_mirrorTableProducer(db, tableName )
70+ m_mirrorTableProducer(appDbConnector.first, appDbConnector.second )
4171{
4272 m_portsOrch->attach (this );
4373 m_neighOrch->attach (this );
@@ -104,7 +134,7 @@ bool MirrorOrch::getSessionState(const string& name, bool& state)
104134 return false ;
105135 }
106136
107- state = m_syncdMirrors[ name] .status ;
137+ state = m_syncdMirrors. find ( name)-> second .status ;
108138
109139 return true ;
110140}
@@ -118,7 +148,7 @@ bool MirrorOrch::getSessionOid(const string& name, sai_object_id_t& oid)
118148 return false ;
119149 }
120150
121- oid = m_syncdMirrors[ name] .sessionId ;
151+ oid = m_syncdMirrors. find ( name)-> second .sessionId ;
122152
123153 return true ;
124154}
@@ -132,7 +162,7 @@ bool MirrorOrch::increaseRefCount(const string& name)
132162 return false ;
133163 }
134164
135- ++m_syncdMirrors[ name] .refCount ;
165+ ++m_syncdMirrors. find ( name)-> second .refCount ;
136166
137167 return true ;
138168}
@@ -162,7 +192,7 @@ void MirrorOrch::createEntry(const string& key, const vector<FieldValueTuple>& d
162192{
163193 SWSS_LOG_ENTER ();
164194
165- MirrorEntry entry = { } ;
195+ MirrorEntry entry ( getenv ( " platform " )) ;
166196
167197 for (auto i : data)
168198 {
@@ -201,12 +231,6 @@ void MirrorOrch::createEntry(const string& key, const vector<FieldValueTuple>& d
201231 {
202232 entry.queue = to_uint<uint8_t >(fvValue (i));
203233 }
204- else if (fvField (i) == MIRROR_SESSION_STATUS)
205- {
206- // Status update always caused by MirrorOrch and should
207- // not be changed by users. Ignore it.
208- return ;
209- }
210234 else
211235 {
212236 SWSS_LOG_ERROR (" Failed to parse session %s configuration. Unknown attribute %s.\n " , key.c_str (), fvField (i).c_str ());
0 commit comments