@@ -376,6 +376,13 @@ bool RouteOrch::validnexthopinNextHopGroup(const NextHopKey &nexthop, uint32_t&
376
376
nhgm_attrs.push_back (nhgm_attr);
377
377
}
378
378
379
+ if (m_switchOrch->checkOrderedEcmpEnable ())
380
+ {
381
+ nhgm_attr.id = SAI_NEXT_HOP_GROUP_MEMBER_ATTR_SEQUENCE_ID;
382
+ nhgm_attr.value .u32 = nhopgroup->second .nhopgroup_members [nexthop].seq_id ;
383
+ nhgm_attrs.push_back (nhgm_attr);
384
+ }
385
+
379
386
status = sai_next_hop_group_api->create_next_hop_group_member (&nexthop_id, gSwitchId ,
380
387
(uint32_t )nhgm_attrs.size (),
381
388
nhgm_attrs.data ());
@@ -393,7 +400,7 @@ bool RouteOrch::validnexthopinNextHopGroup(const NextHopKey &nexthop, uint32_t&
393
400
394
401
++count;
395
402
gCrmOrch ->incCrmResUsedCounter (CrmResourceType::CRM_NEXTHOP_GROUP_MEMBER);
396
- nhopgroup->second .nhopgroup_members [nexthop] = nexthop_id;
403
+ nhopgroup->second .nhopgroup_members [nexthop]. next_hop_id = nexthop_id;
397
404
}
398
405
399
406
if (!m_fgNhgOrch->validNextHopInNextHopGroup (nexthop))
@@ -421,7 +428,7 @@ bool RouteOrch::invalidnexthopinNextHopGroup(const NextHopKey &nexthop, uint32_t
421
428
continue ;
422
429
}
423
430
424
- nexthop_id = nhopgroup->second .nhopgroup_members [nexthop];
431
+ nexthop_id = nhopgroup->second .nhopgroup_members [nexthop]. next_hop_id ;
425
432
status = sai_next_hop_group_api->remove_next_hop_group_member (nexthop_id);
426
433
427
434
if (status != SAI_STATUS_SUCCESS)
@@ -1241,7 +1248,7 @@ bool RouteOrch::addNextHopGroup(const NextHopGroupKey &nexthops)
1241
1248
vector<sai_attribute_t > nhg_attrs;
1242
1249
1243
1250
nhg_attr.id = SAI_NEXT_HOP_GROUP_ATTR_TYPE;
1244
- nhg_attr.value .s32 = SAI_NEXT_HOP_GROUP_TYPE_ECMP;
1251
+ nhg_attr.value .s32 = m_switchOrch-> checkOrderedEcmpEnable () ? SAI_NEXT_HOP_GROUP_TYPE_DYNAMIC_ORDERED_ECMP : SAI_NEXT_HOP_GROUP_TYPE_ECMP;
1245
1252
nhg_attrs.push_back (nhg_attr);
1246
1253
1247
1254
sai_object_id_t next_hop_group_id;
@@ -1295,6 +1302,13 @@ bool RouteOrch::addNextHopGroup(const NextHopGroupKey &nexthops)
1295
1302
nhgm_attrs.push_back (nhgm_attr);
1296
1303
}
1297
1304
1305
+ if (m_switchOrch->checkOrderedEcmpEnable ())
1306
+ {
1307
+ nhgm_attr.id = SAI_NEXT_HOP_GROUP_MEMBER_ATTR_SEQUENCE_ID;
1308
+ nhgm_attr.value .u32 = ((uint32_t )i) + 1 ; // To make non-zero sequence id
1309
+ nhgm_attrs.push_back (nhgm_attr);
1310
+ }
1311
+
1298
1312
gNextHopGroupMemberBulker .create_entry (&nhgm_ids[i],
1299
1313
(uint32_t )nhgm_attrs.size (),
1300
1314
nhgm_attrs.data ());
@@ -1319,7 +1333,8 @@ bool RouteOrch::addNextHopGroup(const NextHopGroupKey &nexthops)
1319
1333
if (nhopgroup_shared_set.find (nhid) != nhopgroup_shared_set.end ())
1320
1334
{
1321
1335
auto it = nhopgroup_shared_set[nhid].begin ();
1322
- next_hop_group_entry.nhopgroup_members [*it] = nhgm_id;
1336
+ next_hop_group_entry.nhopgroup_members [*it].next_hop_id = nhgm_id;
1337
+ next_hop_group_entry.nhopgroup_members [*it].seq_id = (uint32_t )i + 1 ;
1323
1338
nhopgroup_shared_set[nhid].erase (it);
1324
1339
if (nhopgroup_shared_set[nhid].empty ())
1325
1340
{
@@ -1328,7 +1343,8 @@ bool RouteOrch::addNextHopGroup(const NextHopGroupKey &nexthops)
1328
1343
}
1329
1344
else
1330
1345
{
1331
- next_hop_group_entry.nhopgroup_members [nhopgroup_members_set.find (nhid)->second ] = nhgm_id;
1346
+ next_hop_group_entry.nhopgroup_members [nhopgroup_members_set.find (nhid)->second ].next_hop_id = nhgm_id;
1347
+ next_hop_group_entry.nhopgroup_members [nhopgroup_members_set.find (nhid)->second ].seq_id = ((uint32_t )i) + 1 ;
1332
1348
}
1333
1349
}
1334
1350
@@ -1373,12 +1389,12 @@ bool RouteOrch::removeNextHopGroup(const NextHopGroupKey &nexthops)
1373
1389
if (m_neighOrch->isNextHopFlagSet (nhop->first , NHFLAGS_IFDOWN))
1374
1390
{
1375
1391
SWSS_LOG_WARN (" NHFLAGS_IFDOWN set for next hop group member %s with next_hop_id %" PRIx64,
1376
- nhop->first .to_string ().c_str (), nhop->second );
1392
+ nhop->first .to_string ().c_str (), nhop->second . next_hop_id );
1377
1393
nhop = nhgm.erase (nhop);
1378
1394
continue ;
1379
1395
}
1380
1396
1381
- next_hop_ids.push_back (nhop->second );
1397
+ next_hop_ids.push_back (nhop->second . next_hop_id );
1382
1398
nhop = nhgm.erase (nhop);
1383
1399
}
1384
1400
0 commit comments