diff --git a/ChangeLog b/ChangeLog index a35f80d94569a88d88b19b44d88d4e87ffa18afc..952380a16e96bcef84498b950945fc5b0f37b6ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,23 @@ NEXT VERSION +V4.20.1.2 - 2018-08-16 +- + +V4.20.1.1 - 2018-08-02 +common: +- (DSLCPE_SW-1151) Using some CLI commands results in CLI interface stuck + +V4.20.1 - 2018-06-28 +common: +- VRX (DSLCPE_SW-1147 ) KlocworkFixes + +V4.20.0 - 2018-05-30 +common: +- VRX (DSLCPE_SW-1068) Extended autoboot script file handling needs to support + dynamic line numbers +- VRX (DSLCPE_SW-1113) Temporary state machine stuck +- VRX (DSLCPE_SW-1125) [DSL_PHY] Power Saving for Disabled DSL Lines in VRX518 + V4.19.3 - 2017-12-06 - diff --git a/build_win32/dsl_cpe_control_version.h b/build_win32/dsl_cpe_control_version.h index 92609abfeba010c1f781ae70484a7aa336834540..8926c84734b8cd8ec36a8a7fc5496412e72daa7e 100644 --- a/build_win32/dsl_cpe_control_version.h +++ b/build_win32/dsl_cpe_control_version.h @@ -5,7 +5,7 @@ #define PACKAGE "dsl_cpe_control" /* Version number of package */ -#define VERSION "4.19.3" +#define VERSION "4.20.1.2" /* Define to the version of this package. */ #define PACKAGE_VERSION VERSION diff --git a/configure b/configure index f5ac853c52f817b076cfe47fb987553236b050f4..319d624aff276e8dbb2b1f953bb4f363ae3a3e6b 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.in Revision: 1.173 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for DSL CPE Control application 4.19.3. +# Generated by GNU Autoconf 2.69 for DSL CPE Control application 4.20.1.2. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -578,8 +578,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='DSL CPE Control application' PACKAGE_TARNAME='dsl_cpe_control' -PACKAGE_VERSION='4.19.3' -PACKAGE_STRING='DSL CPE Control application 4.19.3' +PACKAGE_VERSION='4.20.1.2' +PACKAGE_STRING='DSL CPE Control application 4.20.1.2' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1512,7 +1512,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures DSL CPE Control application 4.19.3 to adapt to many kinds of systems. +\`configure' configures DSL CPE Control application 4.20.1.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1578,7 +1578,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of DSL CPE Control application 4.19.3:";; + short | recursive ) echo "Configuration of DSL CPE Control application 4.20.1.2:";; esac cat <<\_ACEOF @@ -1790,7 +1790,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -DSL CPE Control application configure 4.19.3 +DSL CPE Control application configure 4.20.1.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2096,7 +2096,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by DSL CPE Control application $as_me 4.19.3, which was +It was created by DSL CPE Control application $as_me 4.20.1.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2961,7 +2961,7 @@ fi # Define the identity of the package. PACKAGE='dsl_cpe_control' - VERSION='4.19.3' + VERSION='4.20.1.2' cat >>confdefs.h <<_ACEOF @@ -10422,7 +10422,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by DSL CPE Control application $as_me 4.19.3, which was +This file was extended by DSL CPE Control application $as_me 4.20.1.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -10488,7 +10488,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -DSL CPE Control application config.status 4.19.3 +DSL CPE Control application config.status 4.20.1.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.in b/configure.in index 2c88ea9390c6bc17f2eff21d3833643ff06aa9d6..f0b55a3e4ec69dbd1ad5912b7de0dc420a84400c 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ AC_REVISION($Revision: 1.173 $) -AC_INIT([DSL CPE Control application],[4.19.3],[],[dsl_cpe_control]) +AC_INIT([DSL CPE Control application],[4.20.1.2],[],[dsl_cpe_control]) AC_CONFIG_SRCDIR(src/Makefile.am) AM_INIT_AUTOMAKE([tar-pax]) diff --git a/src/dsl_cpe_bnd_vrx.c b/src/dsl_cpe_bnd_vrx.c index 46148fbeebd1bbbe08953b1e5b8d2211d55f2d10..993559db0b92ea0fa3642602d0d198f35e2a83fd 100644 --- a/src/dsl_cpe_bnd_vrx.c +++ b/src/dsl_cpe_bnd_vrx.c @@ -448,34 +448,81 @@ DSL_Error_t DSL_CPE_BND_SystemInterfaceStatusHandle( DSL_uint_t nDevice) { DSL_Error_t nErrorCode = DSL_SUCCESS; - DSL_uint16_t nRemotePafAvailable = 0; DSL_uint32_t nCurrentLine, nOppositeLine, nLine; DSL_AutobootControl_t nAcs; + DSL_boolean_t bDisableLine = DSL_FALSE; nCurrentLine = nDevice % DSL_CPE_DSL_ENTITIES; nOppositeLine = (nDevice + 1) % DSL_CPE_DSL_ENTITIES; - nErrorCode = DSL_CPE_BND_RemotePafAvailableCheck(fd, &nRemotePafAvailable); +#ifdef INCLUDE_SCRIPT_NOTIFICATION + nErrorCode = DSL_CPE_SetEnv("DSL_BONDING_STATUS", + pBndCtx->lineBondingConfig[nCurrentLine].nRemotePafAvailable ? "ACTIVE" : "INACTIVE"); if (nErrorCode != DSL_SUCCESS) { return nErrorCode; } +#endif -#ifdef INCLUDE_SCRIPT_NOTIFICATION - nErrorCode = DSL_CPE_SetEnv("DSL_BONDING_STATUS", nRemotePafAvailable ? - "ACTIVE" : "INACTIVE"); - if (nErrorCode != DSL_SUCCESS) + if(!pBndCtx->lineBondingConfig[nCurrentLine].nPafLineDisabled && + !pBndCtx->lineBondingConfig[nOppositeLine].nPafLineDisabled) { - return nErrorCode; + /** + * One bonding and one non-bonding lines (CO) are connected to a + * bonding (CPE) board + */ + if(pBndCtx->lineBondingConfig[nCurrentLine].nFullInitReached && + pBndCtx->lineBondingConfig[nCurrentLine].nRemotePafAvailable && + pBndCtx->lineBondingConfig[nOppositeLine].nFullInitReached && + !pBndCtx->lineBondingConfig[nOppositeLine].nRemotePafAvailable) + { + bDisableLine = DSL_TRUE; + nLine = nOppositeLine; + + DSL_CCA_DEBUG(DSL_CCA_DBG_MSG, (DSL_CPE_PREFIX + "BND - Device=%d PAF mismatch #2a (disable #%d)" + DSL_CPE_CRLF, nCurrentLine, nLine)); + } + else if(pBndCtx->lineBondingConfig[nOppositeLine].nFullInitReached && + pBndCtx->lineBondingConfig[nOppositeLine].nRemotePafAvailable && + pBndCtx->lineBondingConfig[nCurrentLine].nFullInitReached && + !pBndCtx->lineBondingConfig[nCurrentLine].nRemotePafAvailable) + { + bDisableLine = DSL_TRUE; + nLine = nCurrentLine; + + DSL_CCA_DEBUG(DSL_CCA_DBG_MSG, (DSL_CPE_PREFIX + "BND - Device=%d PAF mismatch #2b (disable #%d)" + DSL_CPE_CRLF, nCurrentLine, nLine)); + } + /** + * 2 non-bonded CO lines are connected to a bonding (CPE) board + */ + else if(pBndCtx->lineBondingConfig[nCurrentLine].nFullInitReached && + !pBndCtx->lineBondingConfig[nCurrentLine].nRemotePafAvailable) + { + bDisableLine = DSL_TRUE; + nLine = nOppositeLine; + + DSL_CCA_DEBUG(DSL_CCA_DBG_MSG, (DSL_CPE_PREFIX + "BND - Device=%d PAF mismatch #1a (disable #%d)" + DSL_CPE_CRLF, nCurrentLine, nLine)); + } + else if(pBndCtx->lineBondingConfig[nOppositeLine].nFullInitReached && + !pBndCtx->lineBondingConfig[nOppositeLine].nRemotePafAvailable) + { + bDisableLine = DSL_TRUE; + nLine = nCurrentLine; + + DSL_CCA_DEBUG(DSL_CCA_DBG_MSG, (DSL_CPE_PREFIX + "BND - Device=%d PAF mismatch #1b (disable #%d)" + DSL_CPE_CRLF, nCurrentLine, nLine)); + } } -#endif - if (!nRemotePafAvailable && pBndCtx->nPafLineDisabled == -1) + if(bDisableLine) { - /* If paf-not-available line first reach FULL_INIT => disable opposite line */ - /* If paf-available line first reach FULL_INIT => disable current line */ - nLine = (pBndCtx->nPafLineHandled == nOppositeLine) ? nCurrentLine : - nOppositeLine; + pBndCtx->lineBondingConfig[nLine].nPafLineDisabled = 1; memset(&nAcs, 0x0, sizeof(DSL_AutobootControl_t)); nAcs.data.nCommand = DSL_AUTOBOOT_CTRL_DISABLE; @@ -489,20 +536,6 @@ DSL_Error_t DSL_CPE_BND_SystemInterfaceStatusHandle( return DSL_ERROR; } - - /* Mark disabled line num */ - pBndCtx->nPafLineDisabled = nLine; - - /* Clear paf-available line num */ - pBndCtx->nPafLineHandled = -1; - } - else - { - /* Save paf-available line num reach FULL_INIT */ - if (pBndCtx->nPafLineHandled != nCurrentLine) - { - pBndCtx->nPafLineHandled = nCurrentLine; - } } return nErrorCode; @@ -510,7 +543,8 @@ DSL_Error_t DSL_CPE_BND_SystemInterfaceStatusHandle( DSL_Error_t DSL_CPE_BND_LineStateHandle( DSL_CPE_BND_Context_t *pBndCtx, - DSL_int_t fd, DSL_uint_t nDevice, + DSL_int_t fd, + DSL_uint_t nDevice, DSL_LineStateValue_t nLineState, DSL_LineStateValue_t nPrevLineState) { @@ -522,14 +556,43 @@ DSL_Error_t DSL_CPE_BND_LineStateHandle( "BND - Device=%d nLineState=0x%x nPrevLineState=0x%x" DSL_CPE_CRLF, nDevice, nLineState,nPrevLineState)); - if (nLineState == DSL_LINESTATE_SILENT) + nCurrentLine = nDevice % DSL_CPE_DSL_ENTITIES; + nOppositeLine = (nDevice + 1) % DSL_CPE_DSL_ENTITIES; + + if (nLineState == DSL_LINESTATE_FULL_INIT) { - nCurrentLine = nDevice % DSL_CPE_DSL_ENTITIES; - nOppositeLine = (nDevice + 1) % DSL_CPE_DSL_ENTITIES; + pBndCtx->lineBondingConfig[nCurrentLine].nFullInitReached = 1; - /* Try to enable opposite line (if it was previously disabled) */ - if (pBndCtx->nPafLineDisabled == nOppositeLine) + nErrorCode = DSL_CPE_BND_RemotePafAvailableCheck(fd, + (DSL_uint16_t *)&(pBndCtx->lineBondingConfig[nCurrentLine].nRemotePafAvailable)); + if (nErrorCode != DSL_SUCCESS) { + return nErrorCode; + } + + DSL_CCA_DEBUG(DSL_CCA_DBG_ERR, (DSL_CPE_PREFIX + "BND - Device=%d remote PAF is %ssupported" + DSL_CPE_CRLF, nCurrentLine, + pBndCtx->lineBondingConfig[nCurrentLine].nRemotePafAvailable ? "" : "not ")); + } + + /* Link drop condition */ + if ((nLineState == DSL_LINESTATE_EXCEPTION) && + (nPrevLineState >= DSL_LINESTATE_IDLE)) + { + DSL_CCA_DEBUG(DSL_CCA_DBG_MSG, (DSL_CPE_PREFIX + "BND - Device=%d link DROP detected" + DSL_CPE_CRLF, nCurrentLine)); + + pBndCtx->lineBondingConfig[nCurrentLine].nFullInitReached = 0; + pBndCtx->lineBondingConfig[nCurrentLine].nRemotePafAvailable = 0; + + if (pBndCtx->lineBondingConfig[nOppositeLine].nPafLineDisabled) + { + DSL_CCA_DEBUG(DSL_CCA_DBG_MSG, (DSL_CPE_PREFIX + "BND - Device=%d Try to enable opposite line(%d)" + DSL_CPE_CRLF, nCurrentLine, nOppositeLine)); + memset(&nAcs, 0x0, sizeof(DSL_AutobootControl_t)); nAcs.data.nCommand = DSL_AUTOBOOT_CTRL_ENABLE; @@ -543,14 +606,36 @@ DSL_Error_t DSL_CPE_BND_LineStateHandle( return DSL_ERROR; } - /* Clear disabled line num */ - pBndCtx->nPafLineDisabled = -1; + pBndCtx->lineBondingConfig[nOppositeLine].nPafLineDisabled = 0; + } + } - /* Clear current paf-available line num */ - if (pBndCtx->nPafLineHandled == nCurrentLine) + /** + * One bonding line 0 and one non-bonding line 1 connected to the board. + * See: DSLCPE_SW-707 Test B Scenario 2 + */ + if (nLineState == DSL_LINESTATE_SILENT) + { + if (pBndCtx->lineBondingConfig[nOppositeLine].nPafLineDisabled) + { + DSL_CCA_DEBUG(DSL_CCA_DBG_MSG, (DSL_CPE_PREFIX + "BND - Device=%d Try to enable opposite line(%d)" + DSL_CPE_CRLF, nCurrentLine, nOppositeLine)); + + memset(&nAcs, 0x0, sizeof(DSL_AutobootControl_t)); + nAcs.data.nCommand = DSL_AUTOBOOT_CTRL_ENABLE; + + nErrorCode = DSL_CPE_Ioctl(pBndCtx->pCtrlCtx->fd[nOppositeLine], + DSL_FIO_AUTOBOOT_CONTROL_SET, (DSL_int_t) &nAcs); + if ((nErrorCode < 0) || (nAcs.accessCtl.nReturn < DSL_SUCCESS)) { - pBndCtx->nPafLineHandled = -1; + DSL_CCA_DEBUG(DSL_CCA_DBG_ERR, (DSL_CPE_PREFIX + "DSL_FIO_AUTOBOOT_CONTROL_SET ioctl call failed!" DSL_CPE_CRLF)); + + return DSL_ERROR; } + + pBndCtx->lineBondingConfig[nOppositeLine].nPafLineDisabled = 0; } } @@ -736,6 +821,10 @@ DSL_Error_t DSL_CPE_BND_Start( pBndCtx->lineMonitorStateMachine[i].TxDataRate = 0; pBndCtx->lineMonitorStateMachine[i].MsStatus = DSL_BND_SLAVE; + + pBndCtx->lineBondingConfig[i].nFullInitReached = 0; + pBndCtx->lineBondingConfig[i].nRemotePafAvailable = 0; + pBndCtx->lineBondingConfig[i].nPafLineDisabled = 0; } memset(&(pBndCtx->remoteDiscoveryCode), 0x0, 6); diff --git a/src/dsl_cpe_bnd_vrx.h b/src/dsl_cpe_bnd_vrx.h index 44e7283aaa6c966f3ce1fba3eb5318bece0b95a2..7cbf8d743dfb10409c5f54f3fcb9a7e35cfb257d 100644 --- a/src/dsl_cpe_bnd_vrx.h +++ b/src/dsl_cpe_bnd_vrx.h @@ -40,6 +40,43 @@ typedef struct { DSL_CPE_BND_MsStatus_t MsStatus; } DSL_CPE_BND_LineMonitorStateMachine_t; +/* + LineBondingConfiguration +*/ +typedef struct { + /** + Indicates that a line has reached FULL_INIT during link activation handling. + SET : It will be set (to 1) for the current line in case of current line + reaches FULL_INIT line state (0x380). + RESET: It will be (unconditionally) reset (to 0) for the current line in + case of link drop happens on current line. + \note Link drop condition will be detected at its earliest possible + link activation handling state. */ + DSL_boolean_t nFullInitReached; + /** + Indicates that a line received information from CO side that PAF is supported + SET : It will be set (to 1) for the current line if nFullInitReached for + the current line equals 1 and RemotePafAvailableCheck indicates that + the CO supports PAF (bonding) + RESET: It will be (unconditionally) reset (to 0) for the current line in + case of link drop happens on current line. + \note Link drop condition will be detected at its earliest possible + link activation handling state. */ + DSL_boolean_t nRemotePafAvailable; + /** + Indicates that a line was disabled due to PAF configuration mismatch between both lines. + SET : It will be set (to 1) for a line in case of PAF (bonding) mismatch is + detected. Depending on the current line activation process it could + be applied to the current or the opposite line. The line for which + this flag is set will be also disabled. + RESET: It will be (unconditionally) reset (to 0) for the opposite line in + case of linkdrop happens on current line. In case of opposite line is + currently disabled it will be re-activated again. + \note Link drop condition will be detected at its earliest possible + link activation handling state. */ + DSL_boolean_t nPafLineDisabled; +} DSL_CPE_BND_LineBondingConfiguration_t; + /** Bonding Context */ @@ -73,6 +110,7 @@ typedef struct /** Line num was disabled by absent Paf*/ DSL_int8_t nPafLineDisabled; + DSL_CPE_BND_LineBondingConfiguration_t lineBondingConfig[DSL_CPE_MAX_DSL_ENTITIES]; } DSL_CPE_BND_Context_t; /* diff --git a/src/dsl_cpe_cli.c b/src/dsl_cpe_cli.c index 3a156ff92d6ee4d331ec450fb80ddfcf8c288628..7ff6aa1c626b3f1a6d14b7d0f84e70e1fefb2b60 100644 --- a/src/dsl_cpe_cli.c +++ b/src/dsl_cpe_cli.c @@ -35,6 +35,10 @@ #define LOGF_LOG_INFO(...) #endif /* LOGGING_ID */ +#if defined(INCLUDE_DSL_CPE_CLI_SUPPORT) && !defined(INCLUDE_DSL_CPE_CLI_AUTOGEN_SUPPORT) + #include "drv_dsl_cpe_api_ioctl.h" +#endif + #ifdef INCLUDE_DSL_CPE_CLI_SUPPORT #undef DSL_CCA_DBG_BLOCK @@ -582,6 +586,30 @@ DSL_int_t DSL_CPE_CLI_HelpPrint( return 0; } +DSL_boolean_t DSL_CPE_CLI_CheckPowerDown( + DSL_int_t fd, + DSL_CPE_File_t *out) +{ + DSL_boolean_t retVal = DSL_FALSE; + DSL_int_t ret = 0; + DSL_AutobootStatus_t nAutobootStatus; + + memset (&nAutobootStatus, 0, sizeof(DSL_AutobootStatus_t)); + ret = DSL_CPE_Ioctl(fd, DSL_FIO_AUTOBOOT_STATUS_GET, (DSL_int_t)&nAutobootStatus); + + if ((ret < 0) && (nAutobootStatus.accessCtl.nReturn < DSL_SUCCESS)) + { + DSL_CPE_FPrintf (out, "nReturn=%d%s", DSL_CPE_RET_VAL(nAutobootStatus.accessCtl.nReturn)); + } + else if (nAutobootStatus.data.nStatus == DSL_AUTOBOOT_STATUS_SHUTDOWN_PD || + nAutobootStatus.data.nStatus == DSL_AUTOBOOT_STATUS_STOPPED_PD) + { + retVal = DSL_TRUE; + } + + return retVal; +} + /** Execute command. @@ -596,6 +624,8 @@ DSL_int_t DSL_CPE_CLI_CommandExecute( { DSL_CPE_recType rec = {DSL_NULL, DSL_NULL, DSL_NULL, 0, DSL_NULL}; DSL_char_t dummy_arg[10] = ""; + DSL_boolean_t bCallable = DSL_TRUE; + DSL_int_t nQuit = 0; if(cmd == DSL_NULL) { @@ -628,12 +658,29 @@ DSL_int_t DSL_CPE_CLI_CommandExecute( } else { - if (rec.func(fd, arg, out) != 0) + nQuit = strcmp(cmd, "quit"); + + if (DSL_CPE_CLI_CheckPowerDown(fd, out) == DSL_TRUE) + { + if(!(rec.mask & DSL_CPE_MASK_AFTER_POWER_DOWN) && nQuit != 0) + { + bCallable = DSL_FALSE; + } + } + + if (bCallable == DSL_TRUE) + { + if(rec.func(fd, arg, out) != 0) + { + DSL_CPE_CLI_PrintHelp(rec.psHelp, rec.sCmdLong, rec.sCmdShort, rec.mask, rec.printFunc, out); + } + } + else { - DSL_CPE_CLI_PrintHelp(rec.psHelp, rec.sCmdLong, rec.sCmdShort, rec.mask, rec.printFunc, out); + DSL_CPE_FPrintf (out, DSL_CPE_RET DSL_CPE_CRLF, DSL_CPE_RET_VAL(DSL_ERR_NOT_SUPPORTED_IN_CURRENT_AUTOBOOT_STATE)); } - if (strcmp(cmd, "quit") == 0) + if (nQuit == 0) { DSL_CPE_CLI_Cleanup(); /* main() will execute exit */ @@ -764,6 +811,9 @@ DSL_Error_t DSL_CPE_CLI_CommandAdd( if(strstr(name, "g997") != 0) { rec.mask |= DSL_CPE_MASK_G997; + + if(strstr(name, "g997lis") != 0) + rec.mask |= DSL_CPE_MASK_AFTER_POWER_DOWN; } else if(long_name[0] == 'P' && long_name[1] == 'M') { @@ -777,6 +827,18 @@ DSL_Error_t DSL_CPE_CLI_CommandAdd( { rec.mask |= DSL_CPE_MASK_DSM; } + else if( + strstr(name, "esmcs") != 0 || + strstr(name, "lfcg") != 0 || + strstr(name, "lfcs") != 0 || + strstr(name, "fdsg") != 0 || + strstr(name, "acs") != 0 || + strstr(name, "help") != 0 || + strstr(name, "vig") != 0 || + strstr(name, "asg") != 0) + { + rec.mask |= DSL_CPE_MASK_AFTER_POWER_DOWN; + } else { rec.mask |= DSL_CPE_MASK_DEVICE; diff --git a/src/dsl_cpe_cli.h b/src/dsl_cpe_cli.h index 9efca5f5797e5a2372ed3c32992d99ec5332dcec..a726e83143f34355d47a79d0ca03baee31e9d711 100644 --- a/src/dsl_cpe_cli.h +++ b/src/dsl_cpe_cli.h @@ -46,6 +46,8 @@ #define DSL_CPE_MASK_LONG 0x8000 /** Deprecated CLI functions */ #define DSL_CPE_MASK_DEPRECATED 0x10000 +/** Commands available after Power Down mask */ +#define DSL_CPE_MASK_AFTER_POWER_DOWN 0x20000 #define DSL_CPE_CLI_CMD_ADD_COMM(short_name, long_name, pFunc, pHelp) \ DSL_CPE_CLI_CommandAdd(short_name, long_name, pFunc, pHelp, 0x0, NULL) diff --git a/src/dsl_cpe_cli_access.c b/src/dsl_cpe_cli_access.c index e25e115d63c38311809e4cf610f9a3d1997fbac3..b72785ed4621ba6e10b38bb918db4eaeedaf4d16 100644 --- a/src/dsl_cpe_cli_access.c +++ b/src/dsl_cpe_cli_access.c @@ -831,6 +831,7 @@ static const DSL_char_t g_sAcs[] = " disable = 4" DSL_CPE_CRLF " enable = 5" DSL_CPE_CRLF " restart full = 6" DSL_CPE_CRLF + " power down = 7" DSL_CPE_CRLF DSL_CPE_CRLF "Output Parameter" DSL_CPE_CRLF "- DSL_Error_t nReturn" DSL_CPE_CRLF @@ -1170,6 +1171,8 @@ static const DSL_char_t g_sAsg[] = " link activation wait = 5" DSL_CPE_CRLF " restart wait = 6" DSL_CPE_CRLF " disabled = 7" DSL_CPE_CRLF + " shutdown (powering down) = 8" DSL_CPE_CRLF + " stopped (powered down) = 9" DSL_CPE_CRLF "- DSL_FirmwareRequestType_t nFirmwareRequestType" DSL_CPE_CRLF " fw request na = 0" DSL_CPE_CRLF " fw request adsl = 1" DSL_CPE_CRLF @@ -4081,6 +4084,7 @@ static const DSL_char_t g_sG997lisg[] = " LINIT_SUB_S_INTENDED_LOCAL_SHUTDOWN = 8" DSL_CPE_CRLF " LINIT_SUB_TIMEOUT = 9" DSL_CPE_CRLF " LINIT_SUB_S_PP_CLOCK_NEW = 12" DSL_CPE_CRLF + " LINIT_SUB_S_PP_ERB_INIT = 13" DSL_CPE_CRLF DSL_CPE_CRLF ""; #else ""; @@ -12110,7 +12114,7 @@ DSL_CLI_LOCAL DSL_int_t DSL_CPE_CLI_FilterDetectionDataGet( if ((ret < 0) && (pData.accessCtl.nReturn < DSL_SUCCESS)) { - DSL_CPE_FPrintf (out, sFailureReturn, pData.accessCtl.nReturn); + DSL_CPE_FPrintf (out, sFailureReturn, DSL_CPE_RET_VAL(pData.accessCtl.nReturn)); } else { @@ -12163,7 +12167,7 @@ DSL_CLI_LOCAL DSL_int_t DSL_CPE_CLI_HybridSelectionDataGet( if ((ret < 0) && (pData.accessCtl.nReturn < DSL_SUCCESS)) { - DSL_CPE_FPrintf (out, sFailureReturn, pData.accessCtl.nReturn); + DSL_CPE_FPrintf (out, sFailureReturn, DSL_CPE_RET_VAL(pData.accessCtl.nReturn)); } else { diff --git a/src/dsl_cpe_cli_console.c b/src/dsl_cpe_cli_console.c index b2624d6544ffd135d45ff36ee3ecbea300f2f324..fa392dd7f27745b0537382b1232cbeed135f2147 100644 --- a/src/dsl_cpe_cli_console.c +++ b/src/dsl_cpe_cli_console.c @@ -434,8 +434,9 @@ DSL_Error_t DSL_CPE_Handle_Console (DSL_CPE_Console_Context_t * pConsoleContext) if (strlen (pConsoleContext->old_command[pConsoleContext->old_idx])) { - strcpy (pConsoleContext->arg, - pConsoleContext->old_command[pConsoleContext->old_idx]); + strncpy (pConsoleContext->arg, + pConsoleContext->old_command[pConsoleContext->old_idx], + DSL_MAX_COMMAND_LINE_LENGTH); goto ARROW_KEY; } @@ -456,8 +457,9 @@ DSL_Error_t DSL_CPE_Handle_Console (DSL_CPE_Console_Context_t * pConsoleContext) if (pConsoleContext->old_idx >= MAX_OLD_COMMAND) pConsoleContext->old_idx = 0; - strcpy (pConsoleContext->arg, - pConsoleContext->old_command[pConsoleContext->old_idx]); + strncpy (pConsoleContext->arg, + pConsoleContext->old_command[pConsoleContext->old_idx], + DSL_MAX_COMMAND_LINE_LENGTH); goto ARROW_KEY; diff --git a/src/dsl_cpe_cli_vrx.c b/src/dsl_cpe_cli_vrx.c index 08e3d612e1db27a28129c1f09a48b195d4897627..bd614947bdfab1d9dc1e343b3e8613e2c0ea150f 100644 --- a/src/dsl_cpe_cli_vrx.c +++ b/src/dsl_cpe_cli_vrx.c @@ -2818,6 +2818,74 @@ DSL_CLI_LOCAL DSL_int_t DSL_CPE_CLI_G997_RateAdaptationStatusGet( return 0; } +#ifdef INCLUDE_DSL_CONFIG_GET +static const DSL_char_t g_sDig[] = +#ifndef DSL_CPE_DEBUG_DISABLE + "Long Form: %s" DSL_CPE_CRLF + "Short Form: %s" DSL_CPE_CRLF + DSL_CPE_CRLF + "Input Parameter" DSL_CPE_CRLF + "%s" + "Output Parameter" DSL_CPE_CRLF + "- DSL_Error_t nReturn" DSL_CPE_CRLF + "%s" + "- DSL_uint8_t nMaxDeviceNumber" DSL_CPE_CRLF + "- DSL_uint8_t nLinesPerDevice" DSL_CPE_CRLF + "- DSL_uint8_t nChannelsPerLine" DSL_CPE_CRLF + "- DSL_uint8_t nEntitiesEnabled" DSL_CPE_CRLF + DSL_CPE_CRLF ""; +#else + ""; +#endif + +DSL_CLI_LOCAL DSL_int_t DSL_CPE_CLI_DeviceInfoGet( + DSL_int_t fd, + DSL_char_t *pCommands, + DSL_CPE_File_t *out) +{ + DSL_int_t ret = 0, mei_fd; + IOCTL_MEI_devinfo_t pData; + DSL_uint32_t nDevice; + DSL_char_t dev_name[32] = {0}; + + if (DSL_CPE_CLI_CheckParamNumber(pCommands, 0, DSL_CLI_EQUALS) == DSL_FALSE) + { + return -1; + } + + memset(&pData, 0x0, sizeof(IOCTL_MEI_devinfo_t)); + + DSL_CPE_Fd2DevNum(fd, &nDevice); + + sprintf(dev_name, "/dev/mei_cpe/%u", nDevice); + + mei_fd = DSL_CPE_Open(dev_name); + if (mei_fd <= 0) { + DSL_CPE_Close(mei_fd); + DSL_CPE_FPrintf (out, sFailureReturn, DSL_CPE_RET_VAL(mei_fd)); + return 0; + } + + ret = ioctl(mei_fd, FIO_MEI_DRV_DEVINFO_GET, (DSL_int_t)&pData); + if (ret != 0) + { + DSL_CPE_FPrintf (out, sFailureReturn, DSL_CPE_RET_VAL(pData.ictl.retCode)); + } + else + { + DSL_CPE_FPrintf (out, DSL_CPE_RET"nMaxDeviceNumber=%u nLinesPerDevice=%u " + "nChannelsPerLine=%u nEntitiesEnabled=%u" + DSL_CPE_CRLF, DSL_CPE_RET_VAL(ret), + pData.maxDeviceNumber, pData.linesPerDevice, + pData.channelsPerLine, pData.entitiesEnabled); + } + + DSL_CPE_Close(mei_fd); + + return 0; +} +#endif /* INCLUDE_DSL_CONFIG_GET */ + DSL_void_t DSL_CPE_CLI_DeviceCommandsRegister (DSL_void_t) { /* Debug functionalities */ @@ -2891,6 +2959,10 @@ DSL_void_t DSL_CPE_CLI_DeviceCommandsRegister (DSL_void_t) DSL_CPE_CLI_CMD_ADD_DEVICE ("meipocs", "MEI_PllOffsetConfigSet", DSL_CPE_CLI_MEI_PllOffsetConfigSet, g_sMEIPocs); DSL_CPE_CLI_CMD_ADD_DEVICE ("g997rasg", "G997_RateAdaptationStatusGet", DSL_CPE_CLI_G997_RateAdaptationStatusGet, g_sRaSg); + +#ifdef INCLUDE_DSL_CONFIG_GET + DSL_CPE_CLI_CMD_ADD_DEVICE ("dig", "DeviceInfoGet", DSL_CPE_CLI_DeviceInfoGet, g_sDig); +#endif /* INCLUDE_DSL_CONFIG_GET*/ } #endif /* INCLUDE_DSL_CPE_CLI_SUPPORT */ diff --git a/src/dsl_cpe_control.c b/src/dsl_cpe_control.c index 0489589bde9e56b7b68c7ed8bcf80b763039671f..e579125039e2bde56d0def5be5777a0b3c9233d8 100644 --- a/src/dsl_cpe_control.c +++ b/src/dsl_cpe_control.c @@ -2769,6 +2769,7 @@ DSL_Error_t DSL_CPE_ScriptExecute ( DSL_char_t *buf = DSL_NULL; DSL_char_t *args = DSL_NULL; DSL_char_t nLineIdentifiers[3][9] = { "nLine=0", "nLine=1", "nLine=-1" }; + DSL_uint16_t nLineOffset = 0; DSL_char_t *pLine = DSL_NULL; DSL_char_t *str_command = DSL_NULL; DSL_boolean_t bTagFound = DSL_FALSE, @@ -3757,16 +3758,47 @@ DSL_Error_t DSL_CPE_ScriptExecute ( str_command[script_buf->nSize - 1] = '\0'; args = buf + DSL_MIN(strlen(str_command) + 1, script_buf->nSize - 1); + nLineOffset = 0; - if(strncmp(args, nLineIdentifiers[0], strlen(nLineIdentifiers[0])) == 0 || - strncmp(args, nLineIdentifiers[1], strlen(nLineIdentifiers[1])) == 0 || - strncmp(args, nLineIdentifiers[2], strlen(nLineIdentifiers[2])) == 0) + /* for single link remove parameter and it's value */ + if(pContext->bBackwardCompMode) + { + if(strncmp(args, nLineIdentifiers[0], strlen(nLineIdentifiers[0])) == 0) + { + nLineOffset = strlen(nLineIdentifiers[0]); + } + else if(strncmp(args, nLineIdentifiers[1], strlen(nLineIdentifiers[1])) == 0) + { + /* do not process this case + * just indicate that required parameter was found */ + nLineOffset = 1; + } + else if(strncmp(args, nLineIdentifiers[2], strlen(nLineIdentifiers[2])) == 0) + { + nLineOffset = strlen(nLineIdentifiers[2]); + } + } + /* for bonding keep just parameter's value */ + else + { + if(strncmp(args, nLineIdentifiers[0], strlen(nLineIdentifiers[0])) == 0 || + strncmp(args, nLineIdentifiers[1], strlen(nLineIdentifiers[1])) == 0) + { + nLineOffset = strlen(nLineIdentifiers[0]) - 1; + } + else if(strncmp(args, nLineIdentifiers[2], strlen(nLineIdentifiers[2])) == 0) + { + nLineOffset = strlen(nLineIdentifiers[2]) - 2; + } + } + + if(nLineOffset > 1) { /* Check if a CLI command is given */ DSL_CPE_CliDeviceCommandExecute (pContext, nDevice, - str_command, args + (strlen(nLineIdentifiers[0]) - 1), DSL_CPE_STDOUT); + str_command, args + nLineOffset, DSL_CPE_STDOUT); } - else + else if (nLineOffset == 0) { DSL_CPE_FPrintf (DSL_CPE_STDOUT, DSL_CPE_PREFIX "Missing command's required first argument \"nLine=[0|1|-1]\"!" @@ -4866,9 +4898,14 @@ DSL_CPE_STATIC DSL_int_t DSL_CPE_Event_S_LinitFailureHandle( case LINIT_SUB_FAST_LOS: pSubStatus = "LINIT_SUB_FAST_LOS"; break; +#if defined(DSL_VRX_DEVICE_VR11) case LINIT_SUB_S_PP_CLOCK_NEW: pSubStatus = "LINIT_SUB_S_PP_CLOCK_NEW"; break; + case LINIT_SUB_S_PP_ERB_INIT: + pSubStatus = "LINIT_SUB_S_PP_ERB_INIT"; + break; +#endif /* defined(DSL_VRX_DEVICE_VR11) */ default: pSubStatus = "LINIT_SUB_UNKNOWN"; break; diff --git a/src/dsl_cpe_linux.c b/src/dsl_cpe_linux.c index a6e6f8950bb0234609bfae147f99597c884d8d59..d897c110413d82fe7ca00a49c6d236e09d1d93ca 100644 --- a/src/dsl_cpe_linux.c +++ b/src/dsl_cpe_linux.c @@ -1526,6 +1526,11 @@ static void DSL_CPE_NlSendMsg(DSL_char_t* pMsg) /* Fill the netlink message header and data */ pNlMsgHdr = (struct nlmsghdr*) malloc(NLMSG_SPACE(MAX_MSG_SIZE_BYTES)); + if (pNlMsgHdr == NULL) { + close(nSockFd); + return; + } + memset(pNlMsgHdr, 0, NLMSG_SPACE(MAX_MSG_SIZE_BYTES)); pNlMsgHdr->nlmsg_len = MAX_MSG_SIZE_BYTES; pNlMsgHdr->nlmsg_pid = getpid();