This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
lynxis lazus gerrit-no-reply at lists.osmocom.orglynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/23454 )
Change subject: gprs_ns2: add vty command `nsvc <nsvci> reset`
......................................................................
gprs_ns2: add vty command `nsvc <nsvci> reset`
Change-Id: I436dd0367e83548acfc8f8e36ae4707496a252d9
---
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_vc_fsm.c
M src/gb/gprs_ns2_vty.c
3 files changed, 27 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/54/23454/1
diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index 4883efd..1792979 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -390,6 +390,7 @@
int ns2_vc_is_alive(struct gprs_ns2_vc *nsvc);
int ns2_vc_is_unblocked(struct gprs_ns2_vc *nsvc);
int ns2_vc_block(struct gprs_ns2_vc *nsvc);
+int ns2_vc_reset(struct gprs_ns2_vc *nsvc);
int ns2_vc_unblock(struct gprs_ns2_vc *nsvc);
void ns2_vty_dump_nsvc(struct vty *vty, struct gprs_ns2_vc *nsvc, bool stats);
diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index 548806e..3cc97cb 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -115,6 +115,7 @@
GPRS_NS2_EV_RX_UNITDATA,
GPRS_NS2_EV_REQ_FORCE_UNCONFIGURED, /* called via vty for tests */
+ GPRS_NS2_EV_REQ_OM_RESET, /* vty cmd: reset */
GPRS_NS2_EV_REQ_OM_BLOCK, /* vty cmd: block */
GPRS_NS2_EV_REQ_OM_UNBLOCK, /* vty cmd: unblock*/
};
@@ -132,6 +133,7 @@
{ GPRS_NS2_EV_RX_STATUS, "RX-STATUS" },
{ GPRS_NS2_EV_RX_UNITDATA, "RX-UNITDATA" },
{ GPRS_NS2_EV_REQ_FORCE_UNCONFIGURED, "REQ-FORCE_UNCONFIGURED" },
+ { GPRS_NS2_EV_REQ_OM_RESET, "REQ-O&M-RESET"},
{ GPRS_NS2_EV_REQ_OM_BLOCK, "REQ-O&M-BLOCK"},
{ GPRS_NS2_EV_REQ_OM_UNBLOCK, "REQ-O&M-UNBLOCK"},
{ 0, NULL }
@@ -583,6 +585,15 @@
struct msgb *msg = data;
switch (event) {
+ case GPRS_NS2_EV_REQ_OM_RESET:
+ if (priv->nsvc->mode != GPRS_NS2_VC_MODE_BLOCKRESET)
+ break;
+ /* move the FSM into reset */
+ if (fi->state != GPRS_NS2_ST_RESET) {
+ priv->initiate_reset = true;
+ osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_RESET, nsi->timeout[NS_TOUT_TNS_RESET], NS_TOUT_TNS_RESET);
+ }
+ break;
case GPRS_NS2_EV_RX_RESET:
if (priv->nsvc->mode != GPRS_NS2_VC_MODE_BLOCKRESET)
break;
@@ -682,6 +693,7 @@
S(GPRS_NS2_EV_RX_ALIVE) |
S(GPRS_NS2_EV_RX_ALIVE_ACK) |
S(GPRS_NS2_EV_REQ_FORCE_UNCONFIGURED) |
+ S(GPRS_NS2_EV_REQ_OM_RESET) |
S(GPRS_NS2_EV_REQ_OM_BLOCK) |
S(GPRS_NS2_EV_REQ_OM_UNBLOCK),
.allstate_action = ns2_vc_fsm_allstate_action,
@@ -755,6 +767,14 @@
return osmo_fsm_inst_dispatch(nsvc->fi, GPRS_NS2_EV_REQ_OM_UNBLOCK, NULL);
}
+/*! Reset a NS-VC.
+ * \param nsvc the virtual circuit
+ * \return 0 on success; negative on error */
+int ns2_vc_reset(struct gprs_ns2_vc *nsvc)
+{
+ return osmo_fsm_inst_dispatch(nsvc->fi, GPRS_NS2_EV_REQ_OM_RESET, NULL);
+}
+
/*! entry point for messages from the driver/VL
* \param nsvc virtual circuit on which the message was received
* \param msg message that was received
diff --git a/src/gb/gprs_ns2_vty.c b/src/gb/gprs_ns2_vty.c
index a27a90c..32639c2 100644
--- a/src/gb/gprs_ns2_vty.c
+++ b/src/gb/gprs_ns2_vty.c
@@ -1886,11 +1886,12 @@
}
DEFUN(nsvc_block, nsvc_block_cmd,
- "nsvc <0-65535> (block|unblock)",
+ "nsvc <0-65535> (block|unblock|reset)",
"NS Virtual Connection\n"
NSVCI_STR
"Block a NSVC. As cause code O&M intervention will be used.\n"
- "Unblock a NSVC. As cause code O&M intervention will be used.\n")
+ "Unblock a NSVC. As cause code O&M intervention will be used.\n"
+ "Reset a NSVC. As cause code O&M intervention will be used.\n")
{
struct gprs_ns2_inst *nsi = vty_nsi;
struct gprs_ns2_vc *nsvc;
@@ -1905,8 +1906,10 @@
if (!strcmp(argv[1], "block")) {
ns2_vc_block(nsvc);
- } else {
+ } else if (!strcmp(argv[1], "unblock")) {
ns2_vc_unblock(nsvc);
+ } else {
+ ns2_vc_reset(nsvc);
}
return CMD_SUCCESS;
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/23454
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I436dd0367e83548acfc8f8e36ae4707496a252d9
Gerrit-Change-Number: 23454
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210322/d89e6530/attachment.htm>