Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
--- a/src/dsl_cpe_init_cfg.c
|
||||
+++ b/src/dsl_cpe_init_cfg.c
|
||||
@@ -38,7 +38,7 @@ DSL_InitData_t gInitCfgData =
|
||||
DSL_DEV_HS_TONE_GROUP_CLEANED, \
|
||||
DSL_DEV_HS_TONE_GROUP_CLEANED, \
|
||||
DSL_DEV_HS_TONE_GROUP_CLEANED, \
|
||||
- 0x1E116000, 0x37, -1),
|
||||
+ 0x1E116000, 0x3f, -1),
|
||||
DSL_CPE_SIC_SET(DSL_TC_ATM, DSL_EMF_TC_CLEANED, DSL_EMF_TC_CLEANED, DSL_SYSTEMIF_MII, \
|
||||
DSL_TC_EFM, DSL_EMF_TC_CLEANED, DSL_EMF_TC_CLEANED, DSL_SYSTEMIF_MII),
|
||||
DSL_CPE_MAC_CFG_SET(DSL_EFM_SPEED_100, DSL_EFM_DUPLEX_FULL, DSL_EFM_FLOWCTRL_ON, DSL_EFM_AUTONEG_OFF, \
|
||||
@@ -0,0 +1,87 @@
|
||||
--- a/src/dsl_cpe_control.h
|
||||
+++ b/src/dsl_cpe_control.h
|
||||
@@ -13,6 +13,8 @@
|
||||
#ifndef _DSL_CPE_CONTROL_H
|
||||
#define _DSL_CPE_CONTROL_H
|
||||
|
||||
+#include <string.h>
|
||||
+
|
||||
/** \defgroup DSL_CPE_CONTROL Lantiq DSL CPE API Control Application
|
||||
Lists the entire modules to the DSL CPE_API Control Application.
|
||||
@{ */
|
||||
--- a/src/dsl_cpe_safec_wrapper.h
|
||||
+++ b/src/dsl_cpe_safec_wrapper.h
|
||||
@@ -23,7 +23,7 @@
|
||||
#define cpe_control_vsnprintf_s vsnprintf_s
|
||||
|
||||
/* snprintf_s symbol is not exported in SafeC lib */
|
||||
-static int cpe_control_snprintf_s(char *dest,
|
||||
+static inline int cpe_control_snprintf_s(char *dest,
|
||||
size_t dmax,
|
||||
const char *fmt,
|
||||
...)
|
||||
@@ -40,7 +40,7 @@ static int cpe_control_snprintf_s(char *
|
||||
|
||||
#else
|
||||
|
||||
-#warning "Safe C library is not available!"
|
||||
+//#warning "Safe C library is not available!"
|
||||
|
||||
#include <stddef.h> /* size_t */
|
||||
#include <stdarg.h> /* va_list */
|
||||
@@ -55,7 +55,7 @@ static __inline__ size_t safec_wrapper_m
|
||||
#define cpe_control_memset_s(dest, destsz, src, srcsz) memset(dest, src, safec_wrapper_min(destsz,srcsz))
|
||||
#define cpe_control_strncpy_s(dest, destsz, src, srcsz) strncpy(dest, src, safec_wrapper_min(destsz,srcsz))
|
||||
|
||||
-static size_t cpe_control_strnlen_s(const char *str,
|
||||
+static inline size_t cpe_control_strnlen_s(const char *str,
|
||||
size_t smax)
|
||||
{
|
||||
/* preconditions */
|
||||
@@ -74,7 +74,7 @@ static size_t cpe_control_strnlen_s(cons
|
||||
return size;
|
||||
}
|
||||
|
||||
-static char *cpe_control_strtok_s(char *dest,
|
||||
+static inline char *cpe_control_strtok_s(char *dest,
|
||||
size_t *dmax,
|
||||
const char *delim,
|
||||
char **ptr)
|
||||
@@ -123,7 +123,7 @@ static char *cpe_control_strtok_s(char *
|
||||
return pTmp;
|
||||
}
|
||||
|
||||
-static int cpe_control_pipe_strcat_s(char *dest,
|
||||
+static inline int cpe_control_pipe_strcat_s(char *dest,
|
||||
size_t destsz,
|
||||
char *src)
|
||||
{
|
||||
@@ -157,7 +157,7 @@ static int cpe_control_pipe_strcat_s(cha
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int cpe_control_snprintf_s(char *dest,
|
||||
+static inline int cpe_control_snprintf_s(char *dest,
|
||||
size_t dmax,
|
||||
const char *fmt,
|
||||
...)
|
||||
@@ -181,7 +181,7 @@ static int cpe_control_snprintf_s(char *
|
||||
return retVal;
|
||||
}
|
||||
|
||||
-static int cpe_control_vsnprintf_s(char *dest,
|
||||
+static inline int cpe_control_vsnprintf_s(char *dest,
|
||||
size_t dmax,
|
||||
const char *fmt,
|
||||
va_list vlist)
|
||||
--- a/tools/pipe/dsl_cpe_safec_wrapper.h
|
||||
+++ b/tools/pipe/dsl_cpe_safec_wrapper.h
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#else
|
||||
|
||||
-#warning "Safe C library is not available!"
|
||||
+//#warning "Safe C library is not available!"
|
||||
|
||||
#include <stddef.h> /* size_t */
|
||||
static __inline__ size_t safec_wrapper_min(size_t a, size_t b)
|
||||
@@ -0,0 +1,149 @@
|
||||
This enables automatic connection after the control daemon is started,
|
||||
and also changes the way the connection is stopped on termination.
|
||||
|
||||
Using the autoboot restart command (in combination with configuring the
|
||||
state machine to wait) is necessary because the stop command would stop
|
||||
the autoboot thread, and the driver offers no working way to start it
|
||||
again later, short of unloading and reloading the module.
|
||||
|
||||
The disconnection code is also moved to a separate function, so it can
|
||||
be called in other exit code paths than the one for SIGTERM.
|
||||
|
||||
--- a/src/dsl_cpe_init_cfg.c
|
||||
+++ b/src/dsl_cpe_init_cfg.c
|
||||
@@ -27,7 +27,7 @@ DSL_InitData_t gInitCfgData =
|
||||
DSL_CPE_FW2_SET(DSL_NULL, 0x0),
|
||||
DSL_CPE_XTU_SET(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7),
|
||||
DSL_CPE_LINE_INV_NE_SET(DSL_NULL),
|
||||
- DSL_CPE_AUTOBOOT_CTRL_SET(DSL_AUTOBOOT_CTRL_STOP),
|
||||
+ DSL_CPE_AUTOBOOT_CTRL_SET(DSL_AUTOBOOT_CTRL_START),
|
||||
DSL_CPE_AUTOBOOT_CFG_SET(DSL_FALSE, DSL_FALSE, DSL_FALSE),
|
||||
DSL_CPE_TEST_MODE_CTRL_SET(DSL_TESTMODE_DISABLE),
|
||||
DSL_CPE_LINE_ACTIVATE_CTRL_SET(DSL_G997_INHIBIT_LDSF, DSL_G997_INHIBIT_ACSF, DSL_G997_NORMAL_STARTUP),
|
||||
--- a/src/dsl_cpe_control.c
|
||||
+++ b/src/dsl_cpe_control.c
|
||||
@@ -7252,6 +7252,58 @@ static DSL_boolean_t DSL_CPE_DebugAndTes
|
||||
#endif /* defined(DSL_DEBUG_TOOL_INTERFACE) || defined(INCLUDE_DSL_CPE_DTI_SUPPORT) */
|
||||
#endif /* defined(INCLUDE_DSL_JSON_PARSING) && (INCLUDE_DSL_JSON_PARSING == 1) */
|
||||
|
||||
+DSL_CPE_STATIC DSL_void_t DSL_CPE_ShutdownConnection(void)
|
||||
+{
|
||||
+ DSL_Error_t nRet = DSL_SUCCESS;
|
||||
+ DSL_int_t nDevice = 0;
|
||||
+ DSL_AutobootConfig_t sAutobootCfg;
|
||||
+ DSL_AutobootControl_t sAutobootCtl;
|
||||
+
|
||||
+ for (nDevice = 0; nDevice < DSL_CPE_DSL_ENTITIES; ++nDevice)
|
||||
+ {
|
||||
+ g_bWaitBeforeConfigWrite[nDevice] = DSL_TRUE;
|
||||
+ g_bWaitBeforeLinkActivation[nDevice] = DSL_TRUE;
|
||||
+ g_bWaitBeforeRestart[nDevice] = DSL_TRUE;
|
||||
+
|
||||
+ g_bAutoContinueWaitBeforeConfigWrite[nDevice] = DSL_FALSE;
|
||||
+ g_bAutoContinueWaitBeforeLinkActivation[nDevice] = DSL_FALSE;
|
||||
+ g_bAutoContinueWaitBeforeRestart[nDevice] = DSL_FALSE;
|
||||
+
|
||||
+ memset(&sAutobootCfg, 0x0, sizeof(DSL_AutobootConfig_t));
|
||||
+ sAutobootCfg.data.nStateMachineOptions.bWaitBeforeConfigWrite = DSL_TRUE;
|
||||
+ sAutobootCfg.data.nStateMachineOptions.bWaitBeforeLinkActivation = DSL_TRUE;
|
||||
+ sAutobootCfg.data.nStateMachineOptions.bWaitBeforeRestart = DSL_TRUE;
|
||||
+
|
||||
+ nRet = (DSL_Error_t)DSL_CPE_Ioctl(
|
||||
+ DSL_CPE_GetGlobalContext()->fd[nDevice],
|
||||
+ DSL_FIO_AUTOBOOT_CONFIG_SET, (DSL_int_t)&sAutobootCfg);
|
||||
+
|
||||
+ if (nRet < DSL_SUCCESS)
|
||||
+ {
|
||||
+ DSL_CCA_DEBUG(DSL_CCA_DBG_ERR, (DSL_CPE_PREFIX
|
||||
+ "Autoboot configuration for device (%d) failed!, nRet = %d!"
|
||||
+ DSL_CPE_CRLF, nDevice, sAutobootCfg.accessCtl.nReturn));
|
||||
+ }
|
||||
+
|
||||
+ memset(&sAutobootCtl, 0, sizeof(DSL_AutobootControl_t));
|
||||
+ sAutobootCtl.data.nCommand = DSL_AUTOBOOT_CTRL_RESTART;
|
||||
+
|
||||
+ nRet = (DSL_Error_t)DSL_CPE_Ioctl(
|
||||
+ DSL_CPE_GetGlobalContext()->fd[nDevice],
|
||||
+ DSL_FIO_AUTOBOOT_CONTROL_SET, (DSL_int_t)&sAutobootCtl);
|
||||
+
|
||||
+ if (nRet < DSL_SUCCESS)
|
||||
+ {
|
||||
+ DSL_CCA_DEBUG(DSL_CCA_DBG_ERR, (DSL_CPE_PREFIX
|
||||
+ "Autoboot restart for device (%d) failed!, nRet = %d!"
|
||||
+ DSL_CPE_CRLF, nDevice, sAutobootCtl.accessCtl.nReturn));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ DSL_CCA_DEBUG(DSL_CCA_DBG_MSG, (DSL_CPE_PREFIX
|
||||
+ "Connection shutdown finished." DSL_CPE_CRLF));
|
||||
+}
|
||||
+
|
||||
#ifndef RTEMS
|
||||
/**
|
||||
Signal handler.
|
||||
@@ -7327,6 +7379,8 @@ DSL_CPE_STATIC DSL_void_t DSL_CPE_CLI_Q
|
||||
|
||||
DSL_CPE_STATIC DSL_void_t DSL_CPE_Interruption(void)
|
||||
{
|
||||
+ DSL_CPE_ShutdownConnection();
|
||||
+
|
||||
DSL_CPE_DaemonExit();
|
||||
|
||||
#ifdef INCLUDE_DSL_CPE_CLI_SUPPORT
|
||||
@@ -7336,37 +7390,16 @@ DSL_CPE_STATIC DSL_void_t DSL_CPE_Inter
|
||||
|
||||
DSL_CPE_STATIC DSL_void_t DSL_CPE_Termination(void)
|
||||
{
|
||||
- DSL_Error_t nRet = DSL_SUCCESS;
|
||||
- DSL_int_t nDevice = 0;
|
||||
- DSL_AutobootControl_t sAutobootCtl;
|
||||
DSL_CPE_Control_Context_t *pCtrlCtx = DSL_NULL;
|
||||
|
||||
+ DSL_CPE_ShutdownConnection();
|
||||
+
|
||||
pCtrlCtx = DSL_CPE_GetGlobalContext();
|
||||
if (pCtrlCtx != DSL_NULL)
|
||||
{
|
||||
pCtrlCtx->bEvtRun = DSL_FALSE;
|
||||
}
|
||||
|
||||
- for (nDevice = 0; nDevice < DSL_CPE_DSL_ENTITIES; ++nDevice)
|
||||
- {
|
||||
- memset(&sAutobootCtl, 0, sizeof(DSL_AutobootControl_t));
|
||||
- sAutobootCtl.data.nCommand = DSL_AUTOBOOT_CTRL_STOP;
|
||||
-
|
||||
- nRet = (DSL_Error_t)DSL_CPE_Ioctl(
|
||||
- DSL_CPE_GetGlobalContext()->fd[nDevice],
|
||||
- DSL_FIO_AUTOBOOT_CONTROL_SET, (DSL_int_t)&sAutobootCtl);
|
||||
-
|
||||
- if (nRet < DSL_SUCCESS)
|
||||
- {
|
||||
- DSL_CCA_DEBUG(DSL_CCA_DBG_ERR, (DSL_CPE_PREFIX
|
||||
- "Autoboot stop for device (%d) failed!, nRet = %d!"
|
||||
- DSL_CPE_CRLF, nDevice, sAutobootCtl.accessCtl.nReturn));
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- DSL_CCA_DEBUG(DSL_CCA_DBG_MSG, (DSL_CPE_PREFIX
|
||||
- "Autoboot stop executed" DSL_CPE_CRLF));
|
||||
-
|
||||
DSL_CPE_DaemonExit();
|
||||
|
||||
#ifdef INCLUDE_DSL_CPE_CLI_SUPPORT
|
||||
@@ -8551,6 +8584,9 @@ void DSL_CPE_main(void)
|
||||
DSL_CPE_STATIC DSL_Error_t DSL_CPE_Control_Exit (DSL_void_t * pContext)
|
||||
{
|
||||
dummy_console_t *pConsole = pContext;
|
||||
+
|
||||
+ DSL_CPE_ShutdownConnection();
|
||||
+
|
||||
pConsole->bRun = DSL_FALSE;
|
||||
return DSL_SUCCESS;
|
||||
}
|
||||
@@ -8798,4 +8834,4 @@ DSL_CPE_STATIC DSL_Error_t DSL_CPE_Firmw
|
||||
pDecimal));
|
||||
|
||||
return nErrCode;
|
||||
-}
|
||||
\ No newline at end of file
|
||||
+}
|
||||
@@ -0,0 +1,73 @@
|
||||
Try to perform an orderly shutdown via L3 request before the connection
|
||||
is stopped on exit.
|
||||
|
||||
--- a/src/dsl_cpe_control.c
|
||||
+++ b/src/dsl_cpe_control.c
|
||||
@@ -7252,15 +7252,58 @@ static DSL_boolean_t DSL_CPE_DebugAndTes
|
||||
#endif /* defined(DSL_DEBUG_TOOL_INTERFACE) || defined(INCLUDE_DSL_CPE_DTI_SUPPORT) */
|
||||
#endif /* defined(INCLUDE_DSL_JSON_PARSING) && (INCLUDE_DSL_JSON_PARSING == 1) */
|
||||
|
||||
+DSL_CPE_STATIC DSL_void_t DSL_CPE_EnableConnection(void)
|
||||
+{
|
||||
+ DSL_Error_t nRet = DSL_SUCCESS;
|
||||
+ DSL_int_t nDevice = 0;
|
||||
+ DSL_G997_PowerManagementStateForcedTrigger_t sPowerManagementStateForcedTrigger;
|
||||
+
|
||||
+ for (nDevice = 0; nDevice < DSL_CPE_DSL_ENTITIES; ++nDevice)
|
||||
+ {
|
||||
+ memset(&sPowerManagementStateForcedTrigger, 0x0,
|
||||
+ sizeof(DSL_G997_PowerManagementStateForcedTrigger_t));
|
||||
+ sPowerManagementStateForcedTrigger.data.nPowerManagementState = DSL_G997_PMSF_L3_TO_L0;
|
||||
+
|
||||
+ nRet = (DSL_Error_t)DSL_CPE_Ioctl(
|
||||
+ DSL_CPE_GetGlobalContext()->fd[nDevice],
|
||||
+ DSL_FIO_G997_POWER_MANAGEMENT_STATE_FORCED_TRIGGER,
|
||||
+ (DSL_int_t)&sPowerManagementStateForcedTrigger);
|
||||
+
|
||||
+ if (nRet < DSL_SUCCESS)
|
||||
+ {
|
||||
+ DSL_CCA_DEBUG(DSL_CCA_DBG_ERR, (DSL_CPE_PREFIX
|
||||
+ "Transition to L0 state (%d) failed!, nRet = %d!"
|
||||
+ DSL_CPE_CRLF, nDevice, sPowerManagementStateForcedTrigger.accessCtl.nReturn));
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
DSL_CPE_STATIC DSL_void_t DSL_CPE_ShutdownConnection(void)
|
||||
{
|
||||
DSL_Error_t nRet = DSL_SUCCESS;
|
||||
DSL_int_t nDevice = 0;
|
||||
+ DSL_G997_PowerManagementStateForcedTrigger_t sPowerManagementStateForcedTrigger;
|
||||
DSL_AutobootConfig_t sAutobootCfg;
|
||||
DSL_AutobootControl_t sAutobootCtl;
|
||||
|
||||
for (nDevice = 0; nDevice < DSL_CPE_DSL_ENTITIES; ++nDevice)
|
||||
{
|
||||
+ memset(&sPowerManagementStateForcedTrigger, 0x0,
|
||||
+ sizeof(DSL_G997_PowerManagementStateForcedTrigger_t));
|
||||
+ sPowerManagementStateForcedTrigger.data.nPowerManagementState = DSL_G997_PMSF_LX_TO_L3;
|
||||
+
|
||||
+ nRet = (DSL_Error_t)DSL_CPE_Ioctl(
|
||||
+ DSL_CPE_GetGlobalContext()->fd[nDevice],
|
||||
+ DSL_FIO_G997_POWER_MANAGEMENT_STATE_FORCED_TRIGGER,
|
||||
+ (DSL_int_t)&sPowerManagementStateForcedTrigger);
|
||||
+
|
||||
+ if (nRet < DSL_SUCCESS)
|
||||
+ {
|
||||
+ DSL_CCA_DEBUG(DSL_CCA_DBG_ERR, (DSL_CPE_PREFIX
|
||||
+ "Transition to L3 state (%d) failed!, nRet = %d!"
|
||||
+ DSL_CPE_CRLF, nDevice, sPowerManagementStateForcedTrigger.accessCtl.nReturn));
|
||||
+ }
|
||||
+
|
||||
g_bWaitBeforeConfigWrite[nDevice] = DSL_TRUE;
|
||||
g_bWaitBeforeLinkActivation[nDevice] = DSL_TRUE;
|
||||
g_bWaitBeforeRestart[nDevice] = DSL_TRUE;
|
||||
@@ -8318,6 +8361,8 @@ DSL_int_t dsl_cpe_daemon (
|
||||
#endif /* defined(INCLUDE_DSL_JSON_PARSING) && (INCLUDE_DSL_JSON_PARSING == 1) */
|
||||
}
|
||||
|
||||
+ DSL_CPE_EnableConnection();
|
||||
+
|
||||
#ifdef INCLUDE_DSL_CPE_CLI_SUPPORT
|
||||
#ifndef DSL_CPE_REMOVE_PIPE_SUPPORT
|
||||
if (DSL_CPE_Pipe_Init (pCtrlCtx) == DSL_ERROR)
|
||||
@@ -0,0 +1,50 @@
|
||||
--- a/src/dsl_cpe_control.c
|
||||
+++ b/src/dsl_cpe_control.c
|
||||
@@ -221,6 +221,9 @@ extern DSL_Error_t DSL_CPE_Pipe_StaticRe
|
||||
#endif /* INCLUDE_DSL_RESOURCE_STATISTICS*/
|
||||
#endif
|
||||
|
||||
+extern void ubus_init();
|
||||
+extern void ubus_deinit();
|
||||
+
|
||||
DSL_char_t *g_sFirmwareName1 = DSL_NULL;
|
||||
DSL_FirmwareFeatures_t g_nFwFeatures1 = {DSL_FW_XDSLMODE_CLEANED, DSL_FW_XDSLFEATURE_CLEANED,
|
||||
DSL_FW_XDSLFEATURE_CLEANED};
|
||||
@@ -7882,6 +7885,8 @@ DSL_int_t dsl_cpe_daemon (
|
||||
#endif /* defined(INCLUDE_DSL_JSON_PARSING) && (INCLUDE_DSL_JSON_PARSING == 1) */
|
||||
#endif /* RTEMS*/
|
||||
|
||||
+ ubus_init();
|
||||
+
|
||||
/* Open DSL_CPE_MAX_DSL_ENTITIES devices*/
|
||||
for (nDevice = 0; nDevice < DSL_CPE_DSL_ENTITIES; nDevice++)
|
||||
{
|
||||
@@ -8420,6 +8425,7 @@ DSL_int_t dsl_cpe_daemon (
|
||||
#endif /* INCLUDE_DSL_CPE_CLI_SUPPORT */
|
||||
|
||||
DSL_CPE_CONTROL_EXIT:
|
||||
+ ubus_deinit();
|
||||
|
||||
if (INCLUDE_DSL_BONDING)
|
||||
{
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -17,7 +17,7 @@ else
|
||||
dsl_cpe_control_common_ldflags =
|
||||
endif
|
||||
|
||||
-dsl_cpe_control_LDADD = -lpthread -lrt
|
||||
+dsl_cpe_control_LDADD = -lpthread -lrt -lubox -lubus
|
||||
|
||||
if INCLUDE_DSL_CPE_DTI_SUPPORT
|
||||
dsl_cpe_control_LDADD += -ldti_agent
|
||||
@@ -118,7 +118,8 @@ dsl_cpe_control_SOURCES = \
|
||||
dsl_cpe_control.c \
|
||||
dsl_cpe_init_cfg.c \
|
||||
dsl_cpe_linux.c \
|
||||
- dsl_cpe_debug.c
|
||||
+ dsl_cpe_debug.c \
|
||||
+ dsl_cpe_ubus.c
|
||||
|
||||
dsl_cpe_control_SOURCES += \
|
||||
$(dsl_cpe_control_dti_sources)
|
||||
Reference in New Issue
Block a user