@@ -261,6 +261,10 @@ void processFdbInfo(
261
261
}
262
262
}
263
263
264
+ bool getLagFromPort (
265
+ _In_ sai_object_id_t port_id,
266
+ _Inout_ sai_object_id_t & lag_id);
267
+
264
268
void findBridgeVlanForPortVlan (
265
269
_In_ sai_object_id_t port_id,
266
270
_In_ sai_vlan_id_t vlan_id,
@@ -299,6 +303,15 @@ void findBridgeVlanForPortVlan(
299
303
300
304
// iterate via all bridge ports to find match on port id
301
305
306
+ sai_object_id_t lag_id = SAI_NULL_OBJECT_ID;
307
+
308
+ if (getLagFromPort (port_id,lag_id))
309
+ {
310
+ SWSS_LOG_INFO (" got lag %s for port %s" ,
311
+ sai_serialize_object_id (lag_id).c_str (),
312
+ sai_serialize_object_id (port_id).c_str ());
313
+ }
314
+
302
315
bool bv_id_set = false ;
303
316
304
317
for (auto it = objectHash.begin (); it != objectHash.end (); ++it)
@@ -316,10 +329,33 @@ void findBridgeVlanForPortVlan(
316
329
317
330
if (status != SAI_STATUS_SUCCESS)
318
331
{
332
+ SWSS_LOG_WARN (" failed to get attr PORT_ID and TYPE for bridge port %s" ,
333
+ sai_serialize_object_id (bpid).c_str ());
319
334
continue ;
320
335
}
321
336
322
- if (port_id != attrs[0 ].value .oid )
337
+ if (lag_id != SAI_NULL_OBJECT_ID)
338
+ {
339
+ // if port is member of lag, we should check if port_id is that LAG
340
+
341
+ if (port_id == attrs[0 ].value .oid )
342
+ {
343
+ // there should be no case that the same port is lag member and has bridge port object on it
344
+
345
+ SWSS_LOG_ERROR (" port %s is member of lag %s, and also has bridge port created: %s" ,
346
+ sai_serialize_object_id (port_id).c_str (),
347
+ sai_serialize_object_id (lag_id).c_str (),
348
+ sai_serialize_object_id (attrs[0 ].value .oid ).c_str ());
349
+ continue ;
350
+ }
351
+
352
+ if (lag_id != attrs[0 ].value .oid )
353
+ {
354
+ // this is not expected port
355
+ continue ;
356
+ }
357
+ }
358
+ else if (port_id != attrs[0 ].value .oid )
323
359
{
324
360
// this is not expected port
325
361
continue ;
@@ -403,6 +439,7 @@ void findBridgeVlanForPortVlan(
403
439
404
440
if (!bv_id_set)
405
441
{
442
+ // if port is lag member, then we didn't found bridge_port for that lag (expected for rif lag)
406
443
SWSS_LOG_WARN (" failed to find bv_id for vlan %d and port_id %s" ,
407
444
vlan_id,
408
445
sai_serialize_object_id (port_id).c_str ());
@@ -630,6 +667,15 @@ void hostif_info_t::process_packet_for_fdb_event(
630
667
}
631
668
}
632
669
670
+ sai_object_id_t lag_id;
671
+ if (getLagFromPort (portid, lag_id) && isLagOrPortRifBased (lag_id))
672
+ {
673
+ SWSS_LOG_DEBUG (" lag %s is rif based, skip mac learning for port %s" ,
674
+ sai_serialize_object_id (lag_id).c_str (),
675
+ sai_serialize_object_id (portid).c_str ());
676
+ return ;
677
+ }
678
+
633
679
if (isLagOrPortRifBased (portid))
634
680
{
635
681
SWSS_LOG_DEBUG (" port %s is rif based, skip mac learning" ,
@@ -641,7 +687,7 @@ void hostif_info_t::process_packet_for_fdb_event(
641
687
642
688
fdb_info_t fi;
643
689
644
- fi.port_id = portid;
690
+ fi.port_id = (lag_id != SAI_NULL_OBJECT_ID) ? lag_id : portid;
645
691
fi.vlan_id = vlan_id;
646
692
647
693
memcpy (fi.fdb_entry .mac_address , eh->h_source , sizeof (sai_mac_t ));
0 commit comments