aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2020-10-01 22:56:03 +0200
committerlaforge <laforge@osmocom.org>2020-10-03 07:17:54 +0000
commitbf95f0fb2e63098f95864f3fa1fec1c3bc20091b (patch)
tree49d9c2534fb96566f4c68e9ffa19ff5bec9e1ffd /src
parent477ffb0e72773607dbabe7adf2473818008589c0 (diff)
ns2: refactor ns2_prim_status_ind()
Replace parameters nsi + nsei with a single nse pointer. Change-Id: I35f6381110ba7ba1e013f21120e971362bdff55b
Diffstat (limited to 'src')
-rw-r--r--src/gb/gprs_ns2.c20
-rw-r--r--src/gb/gprs_ns2_internal.h4
-rw-r--r--src/gb/gprs_ns2_sns.c4
3 files changed, 12 insertions, 16 deletions
diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 05d49723..53500d14 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -344,18 +344,18 @@ int gprs_ns2_recv_prim(struct gprs_ns2_inst *nsi, struct osmo_prim_hdr *oph)
* \param[in] nsei NSEI to which the statue relates
* \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_inst *nsi,
- uint16_t nsei, uint16_t bvci,
+void ns2_prim_status_ind(struct gprs_ns2_nse *nse,
+ uint16_t bvci,
enum gprs_ns2_affecting_cause cause)
{
struct osmo_gprs_ns2_prim nsp = {};
- nsp.nsei = nsei;
+ nsp.nsei = nse->nsei;
nsp.bvci = bvci;
nsp.u.status.cause = cause;
nsp.u.status.transfer = -1;
osmo_prim_init(&nsp.oph, SAP_NS, PRIM_NS_STATUS,
PRIM_OP_INDICATION, NULL);
- nsi->cb(&nsp.oph, nsi->cb_data);
+ nse->nsi->cb(&nsp.oph, nse->nsi->cb_data);
}
/*! Allocate a NS-VC within the given bind + NSE.
@@ -410,8 +410,7 @@ void gprs_ns2_free_nsvc(struct gprs_ns2_vc *nsvc)
if (!nsvc)
return;
- ns2_prim_status_ind(nsvc->nse->nsi, nsvc->nse->nsei,
- 0, NS_AFF_CAUSE_VC_FAILURE);
+ ns2_prim_status_ind(nsvc->nse, 0, NS_AFF_CAUSE_VC_FAILURE);
llist_del(&nsvc->list);
llist_del(&nsvc->blist);
@@ -579,8 +578,7 @@ void gprs_ns2_free_nse(struct gprs_ns2_nse *nse)
gprs_ns2_free_nsvc(nsvc);
}
- ns2_prim_status_ind(nse->nsi, nse->nsei,
- 0, NS_AFF_CAUSE_FAILURE);
+ ns2_prim_status_ind(nse, 0, NS_AFF_CAUSE_FAILURE);
llist_del(&nse->list);
if (nse->bss_sns_fi)
@@ -932,8 +930,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->nsi, nse->nsei,
- 0, NS_AFF_CAUSE_RECOVERY);
+ ns2_prim_status_ind(nse, 0, NS_AFF_CAUSE_RECOVERY);
return;
}
@@ -950,8 +947,7 @@ void ns2_nse_notify_unblocked(struct gprs_ns2_vc *nsvc, bool unblocked)
/* nse became unavailable */
nse->alive = false;
- ns2_prim_status_ind(nse->nsi, nse->nsei,
- 0, NS_AFF_CAUSE_FAILURE);
+ ns2_prim_status_ind(nse, 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 15b0bc50..1980ef8c 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -213,8 +213,8 @@ struct gprs_ns2_vc *ns2_vc_alloc(struct gprs_ns2_vc_bind *bind,
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_inst *nsi,
- uint16_t nsei, uint16_t bvci,
+void ns2_prim_status_ind(struct gprs_ns2_nse *nse,
+ 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 753ac4d8..9ffb1525 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -670,7 +670,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->nsi, gss->nse->nsei, 0, NS_AFF_CAUSE_SNS_FAILURE);
+ ns2_prim_status_ind(gss->nse, 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);
@@ -1110,7 +1110,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->nsi, nse->nsei, 0, NS_AFF_CAUSE_SNS_CONFIGURED);
+ ns2_prim_status_ind(nse, 0, NS_AFF_CAUSE_SNS_CONFIGURED);
}
static const struct osmo_fsm_state ns2_sns_bss_states[] = {