@@ -318,25 +318,25 @@ onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value)
318318 case ONLP_SFP_CONTROL_TX_DISABLE :
319319 case ONLP_SFP_CONTROL_TX_DISABLE_CHANNEL : {
320320 VALIDATE (port );
321- if ( port >= 0 && port < 4 ) {
322- present = onlp_sfpi_is_present ( port );
323- if ( present == 1 ) {
321+ present = onlp_sfpi_is_present ( port );
322+ if ( present == 1 ) {
323+ if ( port >= 0 && port < 4 ) {
324324 /* txdis valid bit(bit0-bit3), xxxx 1111 */
325325 value = value & 0xf ;
326326
327327 onlp_sfpi_dev_writeb (port , PORT_EEPROM_DEVADDR , QSFP_EEPROM_OFFSET_TXDIS , value );
328328
329329 return ONLP_STATUS_OK ;
330-
331330 } else {
332- return ONLP_STATUS_E_INTERNAL ;
331+ if (onlp_file_write_int (value , MODULE_TXDISABLE_FORMAT , port + 1 ) < 0 ) {
332+ AIM_LOG_ERROR ("Unable to set tx_disable status to port(%d)\r\n" , port );
333+ return ONLP_STATUS_E_INTERNAL ;
334+ }
335+ return ONLP_STATUS_OK ;
333336 }
334337 } else {
335- if (onlp_file_write_int (value , MODULE_TXDISABLE_FORMAT , port + 1 ) < 0 ) {
336- AIM_LOG_ERROR ("Unable to set tx_disable status to port(%d)\r\n" , port );
337- return ONLP_STATUS_E_INTERNAL ;
338- }
339- return ONLP_STATUS_OK ;
338+ AIM_LOG_ERROR ("No transceiver is present in port(%d)\r\n" , port );
339+ return ONLP_STATUS_E_INTERNAL ;
340340 }
341341 }
342342 case ONLP_SFP_CONTROL_RESET_STATE : {
@@ -400,24 +400,24 @@ onlp_sfpi_control_get(int port, onlp_sfp_control_t control, int* value)
400400 case ONLP_SFP_CONTROL_TX_DISABLE :
401401 case ONLP_SFP_CONTROL_TX_DISABLE_CHANNEL : {
402402 VALIDATE (port );
403- if ( port >= 0 && port < 4 ) {
404- present = onlp_sfpi_is_present ( port );
405- if ( present == 1 ) {
403+ present = onlp_sfpi_is_present ( port );
404+ if ( present == 1 ) {
405+ if ( port >= 0 && port < 4 ) {
406406 tx_dis = onlp_sfpi_dev_readb (port , PORT_EEPROM_DEVADDR , QSFP_EEPROM_OFFSET_TXDIS );
407407
408408 * value = tx_dis ;
409409
410410 return ONLP_STATUS_OK ;
411-
412411 } else {
413- return ONLP_STATUS_E_INTERNAL ;
412+ if (onlp_file_read_int (value , MODULE_TXDISABLE_FORMAT , port + 1 ) < 0 ) {
413+ AIM_LOG_ERROR ("Unable to read tx_disabled status from port(%d)\r\n" , port );
414+ return ONLP_STATUS_E_INTERNAL ;
415+ }
416+ return ONLP_STATUS_OK ;
414417 }
415418 } else {
416- if (onlp_file_read_int (value , MODULE_TXDISABLE_FORMAT , port + 1 ) < 0 ) {
417- AIM_LOG_ERROR ("Unable to read tx_disabled status from port(%d)\r\n" , port );
418- return ONLP_STATUS_E_INTERNAL ;
419- }
420- return ONLP_STATUS_OK ;
419+ AIM_LOG_ERROR ("No transceiver is present in port(%d)\r\n" , port );
420+ return ONLP_STATUS_E_INTERNAL ;
421421 }
422422 }
423423 case ONLP_SFP_CONTROL_RESET_STATE : {
0 commit comments