From: Jan Hoffmann Date: Fri, 12 Jul 2024 13:49:53 +0000 (+0200) Subject: ltq-vdsl-vr11-app: perform orderly shutdown on exit X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=cf6d52f45af1245560995d3d09c19fad1c7bfeab;p=openwrt%2Fstaging%2Fansuel.git ltq-vdsl-vr11-app: perform orderly shutdown on exit Try to do a clean disconnection via L3 request before the connection is stopped. Because this might take up to 6 seconds (the driver does 3 attempts with a timeout of 2 seconds each), a termination timeout needs to be defined in the init script. Signed-off-by: Jan Hoffmann --- diff --git a/package/network/config/ltq-vdsl-vr11-app/Makefile b/package/network/config/ltq-vdsl-vr11-app/Makefile index e56e90f996..f1782db285 100644 --- a/package/network/config/ltq-vdsl-vr11-app/Makefile +++ b/package/network/config/ltq-vdsl-vr11-app/Makefile @@ -9,7 +9,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=ltq-vdsl-vr11-app PKG_VERSION:=4.23.1 -PKG_RELEASE:=4 +PKG_RELEASE:=5 PKG_BASE_NAME:=dsl_cpe_control UGW_VERSION=8.5.2.10 diff --git a/package/network/config/ltq-vdsl-vr11-app/files/dsl_control b/package/network/config/ltq-vdsl-vr11-app/files/dsl_control index d960a77261..8d85cfd5fb 100644 --- a/package/network/config/ltq-vdsl-vr11-app/files/dsl_control +++ b/package/network/config/ltq-vdsl-vr11-app/files/dsl_control @@ -254,6 +254,7 @@ start_service() { ${mode} \ ${tc_layer} \ $autoboot + procd_set_param term_timeout 10 procd_close_instance } diff --git a/package/network/config/ltq-vdsl-vr11-app/patches/201-orderly-shutdown.patch b/package/network/config/ltq-vdsl-vr11-app/patches/201-orderly-shutdown.patch new file mode 100644 index 0000000000..eabeaaedcb --- /dev/null +++ b/package/network/config/ltq-vdsl-vr11-app/patches/201-orderly-shutdown.patch @@ -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) diff --git a/package/network/config/ltq-vdsl-vr11-app/patches/300-ubus.patch b/package/network/config/ltq-vdsl-vr11-app/patches/300-ubus.patch index 1fe1eac1e8..0f2007cdba 100644 --- a/package/network/config/ltq-vdsl-vr11-app/patches/300-ubus.patch +++ b/package/network/config/ltq-vdsl-vr11-app/patches/300-ubus.patch @@ -10,7 +10,7 @@ DSL_char_t *g_sFirmwareName1 = DSL_NULL; DSL_FirmwareFeatures_t g_nFwFeatures1 = {DSL_FW_XDSLMODE_CLEANED, DSL_FW_XDSLFEATURE_CLEANED, DSL_FW_XDSLFEATURE_CLEANED}; -@@ -7839,6 +7842,8 @@ DSL_int_t dsl_cpe_daemon ( +@@ -7882,6 +7885,8 @@ DSL_int_t dsl_cpe_daemon ( #endif /* defined(INCLUDE_DSL_JSON_PARSING) && (INCLUDE_DSL_JSON_PARSING == 1) */ #endif /* RTEMS*/ @@ -19,7 +19,7 @@ /* Open DSL_CPE_MAX_DSL_ENTITIES devices*/ for (nDevice = 0; nDevice < DSL_CPE_DSL_ENTITIES; nDevice++) { -@@ -8375,6 +8380,7 @@ DSL_int_t dsl_cpe_daemon ( +@@ -8420,6 +8425,7 @@ DSL_int_t dsl_cpe_daemon ( #endif /* INCLUDE_DSL_CPE_CLI_SUPPORT */ DSL_CPE_CONTROL_EXIT: