@@ -187,61 +187,63 @@ void findBridgeVlanForPortVlan(
187
187
188
188
sai_deserialize_object_id (it->first , bpid);
189
189
190
- sai_attribute_t attr ;
190
+ sai_attribute_t attrs[ 2 ] ;
191
191
192
- attr.id = SAI_BRIDGE_PORT_ATTR_PORT_ID;
192
+ attrs[0 ].id = SAI_BRIDGE_PORT_ATTR_PORT_ID;
193
+ attrs[1 ].id = SAI_BRIDGE_PORT_ATTR_TYPE;
193
194
194
- sai_status_t status = vs_generic_get (SAI_OBJECT_TYPE_BRIDGE_PORT, bpid, 1 , &attr );
195
+ sai_status_t status = vs_generic_get (SAI_OBJECT_TYPE_BRIDGE_PORT, bpid, sizeof (attrs)/ sizeof (attrs[ 0 ]), attrs );
195
196
196
197
if (status != SAI_STATUS_SUCCESS)
197
198
{
198
199
continue ;
199
200
}
200
201
201
- if (port_id != attr .value .oid )
202
+ if (port_id != attrs[ 0 ] .value .oid )
202
203
{
203
204
// this is not expected port
204
205
continue ;
205
206
}
206
207
207
208
bridge_port_id = bpid;
208
209
209
- // XXX: need to also check the vlan_id match if the bridge port type is subport
210
+ // get the 1D bridge id if the bridge port type is subport
211
+ auto bp_type = attrs[1 ].value .s32 ;
210
212
211
- SWSS_LOG_DEBUG (" found bridge port %s for port %s " ,
213
+ SWSS_LOG_DEBUG (" found bridge port %s of type %d " ,
212
214
sai_serialize_object_id (bridge_port_id).c_str (),
213
- sai_serialize_object_id (port_id).c_str ());
214
-
215
- attr.id = SAI_BRIDGE_PORT_ATTR_BRIDGE_ID;
215
+ bp_type);
216
216
217
- status = vs_generic_get (SAI_OBJECT_TYPE_BRIDGE_PORT, bridge_port_id, 1 , &attr);
218
-
219
- if (status != SAI_STATUS_SUCCESS)
217
+ if (bp_type == SAI_BRIDGE_PORT_TYPE_SUB_PORT)
220
218
{
221
- break ;
222
- }
219
+ sai_attribute_t attr ;
220
+ attr. id = SAI_BRIDGE_PORT_ATTR_BRIDGE_ID;
223
221
224
- bridge_id = attr. value . oid ;
222
+ status = vs_generic_get (SAI_OBJECT_TYPE_BRIDGE_PORT, bridge_port_id, 1 , & attr) ;
225
223
226
- SWSS_LOG_DEBUG (" found bridge %s for port %s" ,
227
- sai_serialize_object_id (bridge_id).c_str (),
228
- sai_serialize_object_id (port_id).c_str ());
224
+ if (status != SAI_STATUS_SUCCESS)
225
+ {
226
+ break ;
227
+ }
229
228
230
- attr. id = SAI_BRIDGE_ATTR_TYPE ;
229
+ bridge_id = attr. value . oid ;
231
230
232
- status = vs_generic_get (SAI_OBJECT_TYPE_BRIDGE, bridge_id, 1 , &attr);
231
+ SWSS_LOG_DEBUG (" found bridge %s for port %s" ,
232
+ sai_serialize_object_id (bridge_id).c_str (),
233
+ sai_serialize_object_id (port_id).c_str ());
233
234
234
- if (status != SAI_STATUS_SUCCESS)
235
- {
236
- break ;
237
- }
235
+ attr.id = SAI_BRIDGE_ATTR_TYPE;
238
236
239
- SWSS_LOG_DEBUG (" bridge %s type is %d" ,
240
- sai_serialize_object_id (bridge_id).c_str (),
241
- attr.value .s32 );
237
+ status = vs_generic_get (SAI_OBJECT_TYPE_BRIDGE, bridge_id, 1 , &attr);
242
238
243
- if (attr.value .s32 == SAI_BRIDGE_TYPE_1D)
244
- {
239
+ if (status != SAI_STATUS_SUCCESS)
240
+ {
241
+ break ;
242
+ }
243
+
244
+ SWSS_LOG_DEBUG (" bridge %s type is %d" ,
245
+ sai_serialize_object_id (bridge_id).c_str (),
246
+ attr.value .s32 );
245
247
bv_id = bridge_id;
246
248
}
247
249
else
@@ -256,6 +258,7 @@ void findBridgeVlanForPortVlan(
256
258
257
259
sai_deserialize_object_id (it2->first , vlan_oid);
258
260
261
+ sai_attribute_t attr;
259
262
attr.id = SAI_VLAN_ATTR_VLAN_ID;
260
263
261
264
status = vs_generic_get (SAI_OBJECT_TYPE_VLAN, vlan_oid, 1 , &attr);
0 commit comments