diff --git a/source/TR-181/board_sbapi/cosa_ethernet_apis.c b/source/TR-181/board_sbapi/cosa_ethernet_apis.c index 8cc33fa..0eff946 100755 --- a/source/TR-181/board_sbapi/cosa_ethernet_apis.c +++ b/source/TR-181/board_sbapi/cosa_ethernet_apis.c @@ -502,6 +502,7 @@ int _getMac(char* ifName, char* mac){ AnscTraceFlow(("%s...\n", __FUNCTION__)); + CcspTraceDebug(("cosa_ethernet_apis.c - _getMac: name=%s\n", ifName)); /* CID 281903 Copy into fixed size buffer fix */ strncpy (ifr.ifr_name, ifName , sizeof(ifr.ifr_name)-1); @@ -595,24 +596,30 @@ COSA_DML_IF_STATUS getIfStatus(const PUCHAR name, struct ifreq *pIfr) { struct ifreq ifr; int skfd = -1; + AnscTraceFlow(("%s... name %s\n", __FUNCTION__,name)); skfd = socket(AF_INET, SOCK_DGRAM, 0); /* CID: 56442 Argument cannot be negative*/ if(skfd == -1) return COSA_DML_IF_STATUS_Error; + CcspTraceDebug(("cosa_ethernet_apis.c - getIfStatus: name=%s\n", (char*)name)); + /* CID 281944 Copy into fixed size buffer fix */ - strncpy (ifr.ifr_name, (char*)name, sizeof(ifr.ifr_name)-1); + strncpy(ifr.ifr_name, (char*)name, sizeof(ifr.ifr_name)-1); + ifr.ifr_name[sizeof(ifr.ifr_name)-1] = '\0'; if (!isValid((char*)name)) { /* CID 162574 Resource leak */ close(skfd); + CcspTraceDebug(("cosa_ethernet_apis.c - getIfStatus: [1]\n")); return COSA_DML_IF_STATUS_Error; } AnscTraceFlow(("%s...\n", __FUNCTION__)); if (ioctl(skfd, SIOCGIFFLAGS, &ifr) < 0) { if (errno == ENODEV) { close(skfd); + CcspTraceDebug(("cosa_ethernet_apis.c - getIfStatus: [2]\n")); return COSA_DML_IF_STATUS_Error; } @@ -621,9 +628,11 @@ COSA_DML_IF_STATUS getIfStatus(const PUCHAR name, struct ifreq *pIfr) if ( FALSE == getIfAvailability( name ) ) { + CcspTraceDebug(("cosa_ethernet_apis.c - getIfStatus: [3]\n")); return COSA_DML_IF_STATUS_NotPresent; } + CcspTraceDebug(("cosa_ethernet_apis.c - getIfStatus: [4]\n")); return COSA_DML_IF_STATUS_Unknown; } close(skfd); @@ -635,10 +644,12 @@ COSA_DML_IF_STATUS getIfStatus(const PUCHAR name, struct ifreq *pIfr) if ( ifr.ifr_flags & IFF_UP ) { + CcspTraceDebug(("cosa_ethernet_apis.c - getIfStatus: UP\n")); return COSA_DML_IF_STATUS_Up; } else { + CcspTraceDebug(("cosa_ethernet_apis.c - getIfStatus: DOWN\n")); return COSA_DML_IF_STATUS_Down; } } @@ -2082,6 +2093,7 @@ BOOL CosaDmlEthWanLinkStatus() port += CCSP_HAL_ETHSW_EthPort1; /* ETH WAN HALs start from 0 but Ethernet Switch HALs start with 1*/ + CcspTraceDebug(("cosa_ethernet_apis.c - CosaDmlEthWanLinkStatus calling HAL CcspHalEthSwGetPortStatus\n")); status = CcspHalEthSwGetPortStatus(port, &LinkRate, &DuplexMode, &LinkStatus); if ( status == RETURN_OK ) diff --git a/source/TR-181/board_sbapi/eth_hal_interface.c b/source/TR-181/board_sbapi/eth_hal_interface.c index 876b33f..f2b21f7 100644 --- a/source/TR-181/board_sbapi/eth_hal_interface.c +++ b/source/TR-181/board_sbapi/eth_hal_interface.c @@ -390,7 +390,7 @@ void* CcspHalExtSw_AssociatedDeviceMonitorThread( void *arg ) static BOOL isDeleteAllDone = FALSE; -// CcspTraceInfo((" Iteration Start\n") ); + CcspTraceDebug((" Iteration Start, flags: bProcessFurther=%d, isDeleteAllDone=%d\n", bProcessFurther, isDeleteAllDone)); //Get Associated Device Details from HAL. Do nothing if failure case if(-1 == CcspHalExtSw_getAssociatedDevice( &ulTotalEthDeviceCount, &pstRecvEthDevice )) { @@ -398,6 +398,7 @@ void* CcspHalExtSw_AssociatedDeviceMonitorThread( void *arg ) bProcessFurther = FALSE; } + CcspTraceDebug((" Total ethernet count from HAL=%lu, flags: bProcessFurther=%d, isDeleteAllDone=%d\n", ulTotalEthDeviceCount, bProcessFurther, isDeleteAllDone)); if( bProcessFurther ) { /* @@ -439,9 +440,10 @@ void* CcspHalExtSw_AssociatedDeviceMonitorThread( void *arg ) bProcessFurther = FALSE; } + CcspTraceDebug((" Handle notification start, flags: bProcessFurther=%d, isDeleteAllDone=%d\n", bProcessFurther, isDeleteAllDone)); if( bProcessFurther ) { -// CcspTraceInfo((" - Host(+) Loop Start\n") ); + CcspTraceDebug((" - Host(+) Loop Start\n") ); // Reset isDeleteAllDone variable to proceed further from next iteration isDeleteAllDone = FALSE; @@ -469,6 +471,7 @@ void* CcspHalExtSw_AssociatedDeviceMonitorThread( void *arg ) if( 0 == ValidateClient( tmp_mac_id ) ) { //Delete and send notification + CcspTraceDebug((" - Delete host and send notification, mac:%s\n", tmp_mac_id)); CcspHalExtSw_DeleteHost( &pstRecvEthDevice[ iLoopCount ], eth_device_hashArrayList, TRUE ); continue; } @@ -478,16 +481,18 @@ void* CcspHalExtSw_AssociatedDeviceMonitorThread( void *arg ) if ( NULL == CcspHalExtSw_FindHost( &pstRecvEthDevice[ iLoopCount ], eth_device_hashArrayList, NULL ) ) { //Add and send notification + CcspTraceDebug((" - Add host and send notification, mac:%s\n", tmp_mac_id)); CcspHalExtSw_AddHost( &pstRecvEthDevice[ iLoopCount ], eth_device_hashArrayList, TRUE ); } //Add in temp hash list and Don't send notification + CcspTraceDebug((" - Add host tmp list, mac:%s\n", tmp_mac_id)); CcspHalExtSw_AddHost( &pstRecvEthDevice[ iLoopCount ], eth_device_hashArrayTempList, FALSE ); } -// CcspTraceInfo((" - Host(+) Loop End\n") ); + CcspTraceDebug((" - Host(+) Loop End\n")); -// CcspTraceInfo((" - Host(-) Loop Start\n") ); + CcspTraceDebug((" - Host(-) Loop Start\n")); //Disconnection Case for( iLoopCount = 0; iLoopCount< ETH_NODE_HASH_SIZE; iLoopCount++ ) @@ -499,14 +504,16 @@ void* CcspHalExtSw_AssociatedDeviceMonitorThread( void *arg ) ) { //Delete and Need to send notification + CcspTraceDebug((" - Delete and send notification disconnect\n")); CcspHalExtSw_DeleteHost( eth_device_hashArrayList[ iLoopCount ], eth_device_hashArrayList, TRUE ); } } //Delete all hosts from temp hash list + CcspTraceDebug((" - Delete all host tmp list\n")); CcspHalExtSw_DeleteAllHosts( eth_device_hashArrayTempList, FALSE ); -// CcspTraceInfo((" - Host(-) Loop End\n") ); + CcspTraceDebug((" - Host(-) Loop End\n")); } //Free if memory is valid case if( NULL != pstRecvEthDevice ) @@ -516,7 +523,7 @@ void* CcspHalExtSw_AssociatedDeviceMonitorThread( void *arg ) } } -// CcspTraceInfo((" Iteration End\n") ); + CcspTraceDebug((" Iteration End\n")); //Sleep sleep( ETH_POLLING_PERIOD ); diff --git a/source/TR-181/board_sbapi/source-arm/cosa_ethernet_apis_arm.c b/source/TR-181/board_sbapi/source-arm/cosa_ethernet_apis_arm.c index e45c2a6..95f5a4f 100644 --- a/source/TR-181/board_sbapi/source-arm/cosa_ethernet_apis_arm.c +++ b/source/TR-181/board_sbapi/source-arm/cosa_ethernet_apis_arm.c @@ -597,6 +597,8 @@ CosaDmlEthPortGetDinfo return ANSC_STATUS_FAILURE; } + CcspTraceDebug(("cosa_ethernet_apis_arm.c - CosaDmlEthPortGetDinfo: num=%lu,%lu name=%s,%s\n", + ulInstanceNumber, pEthIf->instanceNumber, pEthIf->sInfo->Name, pEthIf->Alias)); pEthIf->control->getDInfo(pEthIf, pInfo); pInfo->LastChange = pEthIf->LastChange; @@ -942,10 +944,12 @@ static int puma6_getSwitchDInfo(PCosaEthInterfaceInfo eth, PCOSA_DML_ETH_PORT_DI } #endif + CcspTraceDebug(("cosa_ethernet_apis_arm.c - puma6_getSwitchDInfo, name=%s\n", (PUCHAR)eth->sInfo->Name)); status = CcspHalEthSwGetPortStatus(port, &LinkRate, &DuplexMode, &LinkStatus); if ( status == RETURN_OK ) { + CcspTraceDebug(("cosa_ethernet_apis_arm.c - puma6_getSwitchDInfo: HAL status=%d\n", LinkStatus)); switch ( LinkStatus ) { case CCSP_HAL_ETHSW_LINK_Up: @@ -1018,6 +1022,7 @@ static int puma6_getSwitchDInfo(PCosaEthInterfaceInfo eth, PCOSA_DML_ETH_PORT_DI } else { + CcspTraceDebug(("cosa_ethernet_apis_arm.c - puma6_getSwitchDInfo: HAL failure\n")); return ANSC_STATUS_FAILURE; } @@ -1131,6 +1136,7 @@ static int getIfStats(PCosaEthInterfaceInfo pEthIf, PCOSA_DML_ETH_STATS pStats) static int getIfDInfo(PCosaEthInterfaceInfo pEthIf, PCOSA_DML_ETH_PORT_DINFO pInfo) { + CcspTraceDebug(("cosa_ethernet_apis_arm.c - getIfDInfo\n")); pInfo->Status = getIfStatus((PUCHAR)pEthIf->sInfo->Name, NULL); return 0; diff --git a/source/TR-181/board_sbapi/source-arm/cosa_ethernet_apis_ext_arm.h b/source/TR-181/board_sbapi/source-arm/cosa_ethernet_apis_ext_arm.h index 7f15fa4..ed6454f 100644 --- a/source/TR-181/board_sbapi/source-arm/cosa_ethernet_apis_ext_arm.h +++ b/source/TR-181/board_sbapi/source-arm/cosa_ethernet_apis_ext_arm.h @@ -45,10 +45,10 @@ #define ETH_4_PORTS #endif -#define SWITCH_PORT_0_NAME "sw_1" -#define SWITCH_PORT_1_NAME "sw_2" -#define SWITCH_PORT_2_NAME "sw_3" -#define SWITCH_PORT_3_NAME "sw_4" +#define SWITCH_PORT_0_NAME "eth0" +#define SWITCH_PORT_1_NAME "eth1" +#define SWITCH_PORT_2_NAME "eth2" +#define SWITCH_PORT_3_NAME "eth3" #if defined (ETH_5_PORTS) || defined (ETH_6_PORTS) || defined (ETH_8_PORTS) || (defined(INTEL_PUMA7) && !defined(_ARRIS_XB6_PRODUCT_REQ_)) #define SWITCH_PORT_4_NAME "sw_5" diff --git a/source/TR-181/middle_layer_src/cosa_ethernet_interface_dml.c b/source/TR-181/middle_layer_src/cosa_ethernet_interface_dml.c index fb9a6de..4f8e69b 100644 --- a/source/TR-181/middle_layer_src/cosa_ethernet_interface_dml.c +++ b/source/TR-181/middle_layer_src/cosa_ethernet_interface_dml.c @@ -308,6 +308,7 @@ Interface_GetParamUlongValue /* check the parameter name and return the corresponding value */ if (strcmp(ParamName, "Status") == 0) { + CcspTraceDebug(("Interface_GetParamUlongValue: Get status case, calling CosaDmlEthPortGetDinfo\n")); /* collect value */ CosaDmlEthPortGetDinfo(NULL, pEthernetPortFull->Cfg.InstanceNumber, &pEthernetPortFull->DynamicInfo);