@@ -205,36 +205,40 @@ class MlnxSfpd:
205
205
pkt = new_uint8_t_arr (pkt_size )
206
206
recv_info_p = new_sx_receive_info_t_p ()
207
207
pmpe_t = sx_event_pmpe_t ()
208
- logical_port_list = new_sx_port_log_id_t_arr (4 )
209
208
port_attributes_list = new_sx_port_attributes_t_arr (64 )
210
209
port_cnt_p = new_uint32_t_p ()
211
210
uint32_t_p_assign (port_cnt_p ,64 )
212
211
label_port_list = []
213
- status = True
214
212
module_state = 0
215
213
216
214
rc = sx_lib_host_ifc_recv (fd_p , pkt , pkt_size_p , recv_info_p )
217
215
if rc != 0 :
218
216
log_error ("sx_lib_host_ifc_recv exited with error, rc %d" % rc )
219
217
status = False
220
- return status , label_port_list , module_state
221
-
222
- pmpe_t = recv_info_p .event_info .pmpe
223
- port_list_size = pmpe_t .list_size
224
- logical_port_list = pmpe_t .log_port_list
225
- module_state = pmpe_t .module_state
226
-
227
- for i in xrange (port_list_size ):
228
- logical_port = sx_port_log_id_t_arr_getitem (logical_port_list , i )
229
- rc = sx_api_port_device_get (self .handle , 1 , 0 , port_attributes_list , port_cnt_p )
230
- port_cnt = uint32_t_p_value (port_cnt_p )
231
-
232
- for i in xrange (port_cnt ):
233
- port_attributes = sx_port_attributes_t_arr_getitem (port_attributes_list ,i )
234
- if port_attributes .log_port == logical_port :
235
- lable_port = port_attributes .port_mapping .module_port
236
- break
237
- label_port_list .append (lable_port )
218
+ else :
219
+ status = True
220
+ pmpe_t = recv_info_p .event_info .pmpe
221
+ port_list_size = pmpe_t .list_size
222
+ logical_port_list = pmpe_t .log_port_list
223
+ module_state = pmpe_t .module_state
224
+
225
+ for i in xrange (port_list_size ):
226
+ logical_port = sx_port_log_id_t_arr_getitem (logical_port_list , i )
227
+ rc = sx_api_port_device_get (self .handle , 1 , 0 , port_attributes_list , port_cnt_p )
228
+ port_cnt = uint32_t_p_value (port_cnt_p )
229
+
230
+ for i in xrange (port_cnt ):
231
+ port_attributes = sx_port_attributes_t_arr_getitem (port_attributes_list ,i )
232
+ if port_attributes .log_port == logical_port :
233
+ lable_port = port_attributes .port_mapping .module_port
234
+ break
235
+ label_port_list .append (lable_port )
236
+
237
+ delete_uint32_t_p (pkt_size_p )
238
+ delete_uint8_t_arr (pkt )
239
+ delete_sx_receive_info_t_p (recv_info_p )
240
+ delete_sx_port_attributes_t_arr (port_attributes_list )
241
+ delete_uint32_t_p (port_cnt_p )
238
242
239
243
return status , label_port_list , module_state ,
240
244
0 commit comments