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
This commit is contained in:
Daniel Willmann 2020-11-03 23:05:43 +01:00
parent f128654c7f
commit 15c09a81e9
5 changed files with 17 additions and 7 deletions

View File

@ -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 */

View File

@ -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

View File

@ -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);

View File

@ -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[] = {

View File

@ -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)