aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2020-11-03 23:05:43 +0100
committerDaniel Willmann <dwillmann@sysmocom.de>2020-11-06 11:41:16 +0100
commit15c09a81e908d01a80ac0ac0fd4eed980067ae5e (patch)
treeeca770ea5b7477101e399e166b1fa4e06147d781
parentf128654c7f9a584a6bb33454ab70edd0add3e54a (diff)
ns2: Send NSVC representation in NS_AFF_CAUSE_VC_* status indication
NS_AFF_CAUSE_VC_* failure and recovery should indicate the NSVC in question. Use the string representation reported by gprs_ns2_ll_str() for that. NS_AFF_CAUSE_VC_RECOVERY was never sent so do that on unblock as well. Change-Id: Iad6f0dc4565a46868cbbe17c361dcd473006c83d Related: SYS#4998
-rw-r--r--include/osmocom/gprs/gprs_ns2.h1
-rw-r--r--src/gb/gprs_ns2.c13
-rw-r--r--src/gb/gprs_ns2_internal.h1
-rw-r--r--src/gb/gprs_ns2_sns.c4
-rw-r--r--src/gb/gprs_ns2_vc_fsm.c5
5 files changed, 17 insertions, 7 deletions
diff --git a/include/osmocom/gprs/gprs_ns2.h b/include/osmocom/gprs/gprs_ns2.h
index 728ca9f9..c90d4590 100644
--- a/include/osmocom/gprs/gprs_ns2.h
+++ b/include/osmocom/gprs/gprs_ns2.h
@@ -101,6 +101,7 @@ struct osmo_gprs_ns2_prim {
} congestion;
struct {
enum gprs_ns2_affecting_cause cause;
+ char *nsvc;
/* 48.016 5.2.2.6 transfer capability */
int transfer;
/* osmocom specific */
diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index b50daf4c..6ddc58b6 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -363,9 +363,11 @@ int gprs_ns2_recv_prim(struct gprs_ns2_inst *nsi, struct osmo_prim_hdr *oph)
* \param[in] bvci BVCI to which the status relates
* \param[in] cause The cause of the status */
void ns2_prim_status_ind(struct gprs_ns2_nse *nse,
+ struct gprs_ns2_vc *nsvc,
uint16_t bvci,
enum gprs_ns2_affecting_cause cause)
{
+ char nsvc_str[NS2_LL_MAX_STR];
struct osmo_gprs_ns2_prim nsp = {};
nsp.nsei = nse->nsei;
nsp.bvci = bvci;
@@ -373,6 +375,9 @@ void ns2_prim_status_ind(struct gprs_ns2_nse *nse,
nsp.u.status.transfer = -1;
nsp.u.status.first = nse->first;
nsp.u.status.persistent = nse->persistent;
+ if (nsvc)
+ nsp.u.status.nsvc = gprs_ns2_ll_str_buf(nsvc_str, sizeof(nsvc_str), nsvc);
+
osmo_prim_init(&nsp.oph, SAP_NS, PRIM_NS_STATUS,
PRIM_OP_INDICATION, NULL);
nse->nsi->cb(&nsp.oph, nse->nsi->cb_data);
@@ -430,7 +435,7 @@ void gprs_ns2_free_nsvc(struct gprs_ns2_vc *nsvc)
if (!nsvc)
return;
- ns2_prim_status_ind(nsvc->nse, 0, NS_AFF_CAUSE_VC_FAILURE);
+ ns2_prim_status_ind(nsvc->nse, nsvc, 0, NS_AFF_CAUSE_VC_FAILURE);
llist_del(&nsvc->list);
llist_del(&nsvc->blist);
@@ -608,7 +613,7 @@ void gprs_ns2_free_nse(struct gprs_ns2_nse *nse)
gprs_ns2_free_nsvc(nsvc);
}
- ns2_prim_status_ind(nse, 0, NS_AFF_CAUSE_FAILURE);
+ ns2_prim_status_ind(nse, NULL, 0, NS_AFF_CAUSE_FAILURE);
llist_del(&nse->list);
if (nse->bss_sns_fi)
@@ -986,7 +991,7 @@ void ns2_nse_notify_unblocked(struct gprs_ns2_vc *nsvc, bool unblocked)
if (unblocked) {
/* this is the first unblocked NSVC on an unavailable NSE */
nse->alive = true;
- ns2_prim_status_ind(nse, 0, NS_AFF_CAUSE_RECOVERY);
+ ns2_prim_status_ind(nse, NULL, 0, NS_AFF_CAUSE_RECOVERY);
nse->first = false;
return;
}
@@ -1004,7 +1009,7 @@ void ns2_nse_notify_unblocked(struct gprs_ns2_vc *nsvc, bool unblocked)
/* nse became unavailable */
nse->alive = false;
- ns2_prim_status_ind(nse, 0, NS_AFF_CAUSE_FAILURE);
+ ns2_prim_status_ind(nse, NULL, 0, NS_AFF_CAUSE_FAILURE);
}
/*! Create a new GPRS NS instance
diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index b480391c..dee3ab76 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -221,6 +221,7 @@ struct msgb *gprs_ns2_msgb_alloc(void);
void gprs_ns2_sns_dump_vty(struct vty *vty, const struct gprs_ns2_nse *nse, bool stats);
void ns2_prim_status_ind(struct gprs_ns2_nse *nse,
+ struct gprs_ns2_vc *nsvc,
uint16_t bvci,
enum gprs_ns2_affecting_cause cause);
void ns2_nse_notify_alive(struct gprs_ns2_vc *nsvc, bool alive);
diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index b2754f5e..31f8a5f5 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -686,7 +686,7 @@ static void ns2_sns_st_size_onenter(struct osmo_fsm_inst *fi, uint32_t old_state
struct ns2_sns_state *gss = (struct ns2_sns_state *) fi->priv;
if (old_state != GPRS_SNS_ST_UNCONFIGURED)
- ns2_prim_status_ind(gss->nse, 0, NS_AFF_CAUSE_SNS_FAILURE);
+ ns2_prim_status_ind(gss->nse, NULL, 0, NS_AFF_CAUSE_SNS_FAILURE);
if (gss->num_max_ip4_remote > 0)
ns2_tx_sns_size(gss->sns_nsvc, true, gss->num_max_nsvcs, gss->num_max_ip4_remote, -1);
@@ -1126,7 +1126,7 @@ static void ns2_sns_st_configured(struct osmo_fsm_inst *fi, uint32_t event, void
static void ns2_sns_st_configured_onenter(struct osmo_fsm_inst *fi, uint32_t old_state)
{
struct gprs_ns2_nse *nse = nse_inst_from_fi(fi);
- ns2_prim_status_ind(nse, 0, NS_AFF_CAUSE_SNS_CONFIGURED);
+ ns2_prim_status_ind(nse, NULL, 0, NS_AFF_CAUSE_SNS_CONFIGURED);
}
static const struct osmo_fsm_state ns2_sns_bss_states[] = {
diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index 4fa53c19..0d30f129 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -318,8 +318,11 @@ static void gprs_ns2_st_blocked(struct osmo_fsm_inst *fi, uint32_t event, void *
static void gprs_ns2_st_unblocked_on_enter(struct osmo_fsm_inst *fi, uint32_t old_state)
{
struct gprs_ns2_vc_priv *priv = fi->priv;
+ struct gprs_ns2_vc *nsvc = priv->nsvc;
+ struct gprs_ns2_nse *nse = nsvc->nse;
- ns2_nse_notify_unblocked(priv->nsvc, true);
+ ns2_nse_notify_unblocked(nsvc, true);
+ ns2_prim_status_ind(nse, nsvc, 0, NS_AFF_CAUSE_VC_RECOVERY);
}
static void gprs_ns2_st_unblocked(struct osmo_fsm_inst *fi, uint32_t event, void *data)