Skip verifying h/w info for Not-In-Use interface

When a domain interface state is changed, hardware information is
verified to ensure the interface is OK to enter into the new state.

However, when an interface is entering into Not-In-Use state, it should
be always OK no matter what the h/w interface state is. Especially when
the interface is back on lo, in which case getting hardware information
will fail. This prevents moving interface to Not-In-Use state.

This change skip verifying h/w state if state of an interface is changed
to Not-In-Use.

This fix will also skip checking h/w information for lo interface and
always returns enabled = true.

Closes-Bug: 1898629

Signed-off-by: Bin Qian <bin.qian@windriver.com>
Change-Id: I709708bce622f52bf84fc3fec749f204cfeee533
This commit is contained in:
Bin Qian 2020-10-07 10:24:45 -04:00
parent 568a77f366
commit e8af161b16
2 changed files with 15 additions and 7 deletions

View File

@ -232,6 +232,11 @@ SmErrorT sm_hw_get_if_state( const char if_name[], bool* enabled )
struct ifreq if_data;
SmHwThreadInfoT* thread_info;
if(strcmp(if_name, "lo") == 0)
{
*enabled = true;
return SM_OKAY;
}
thread_info = sm_hw_find_thread_info();
if( NULL == thread_info )
{

View File

@ -63,17 +63,20 @@ SmErrorT sm_service_domain_interface_unknown_state_event_handler(
SmServiceDomainInterfaceT* interface, SmServiceDomainInterfaceEventT event,
void* event_data[] )
{
bool enabled;
bool enabled = false;
SmErrorT error;
char reason_text[SM_LOG_REASON_TEXT_MAX_CHAR] = {0};
error = sm_hw_get_if_state( interface->interface_name, &enabled );
if( SM_OKAY != error )
if (SM_SERVICE_DOMAIN_INTERFACE_EVENT_NOT_IN_USE != event)
{
DPRINTFE( "Failed to audit hardware state of interface (%s), "
"error=%s", interface->interface_name,
sm_error_str( error ) );
return( error );
error = sm_hw_get_if_state( interface->interface_name, &enabled );
if( SM_OKAY != error )
{
DPRINTFE( "Failed to audit hardware state of interface (%s), "
"error=%s", interface->interface_name,
sm_error_str( error ) );
return( error );
}
}
switch( event )