summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-05-20 00:08:22 +0200
committerHarald Welte <laforge@gnumonks.org>2011-06-21 19:47:34 +0200
commita2f615e522907f45398973d31225f9c5d379914d (patch)
tree3ff931ba98afc9ebc7c24e7e7b8cd6e5f8e06eb1
parent5bbea93772d3e490f0419aa22f33edac96af81c7 (diff)
remove 'osmocom_ms' from struct lapdm_enetity
and replace it with more general l1_ctx nad l3_ctx.
-rw-r--r--src/host/layer23/include/osmocom/bb/common/lapdm.h4
-rw-r--r--src/host/layer23/src/common/lapdm.c17
2 files changed, 11 insertions, 10 deletions
diff --git a/src/host/layer23/include/osmocom/bb/common/lapdm.h b/src/host/layer23/include/osmocom/bb/common/lapdm.h
index b502ffd8..b610564c 100644
--- a/src/host/layer23/include/osmocom/bb/common/lapdm.h
+++ b/src/host/layer23/include/osmocom/bb/common/lapdm.h
@@ -66,7 +66,9 @@ struct lapdm_entity {
struct lapdm_datalink datalink[_NR_DL_SAPI];
int last_tx_dequeue; /* last entity that was dequeued */
int tx_pending; /* currently a pending frame not confirmed by L1 */
- struct osmocom_ms *ms;
+
+ void *l1_ctx; /* context for layer1 instance */
+ void *l3_ctx; /* context for layer3 instance */
};
const char *get_rsl_name(int value);
diff --git a/src/host/layer23/src/common/lapdm.c b/src/host/layer23/src/common/lapdm.c
index 974c34c3..a2a9d5ff 100644
--- a/src/host/layer23/src/common/lapdm.c
+++ b/src/host/layer23/src/common/lapdm.c
@@ -193,7 +193,8 @@ void lapdm_init(struct lapdm_entity *le, struct osmocom_ms *ms)
for (i = 0; i < ARRAY_SIZE(le->datalink); i++)
lapdm_dl_init(&le->datalink[i], le);
- le->ms = ms;
+ le->l1_ctx = ms;
+ le->l3_ctx = ms;
}
static void lapdm_dl_flush_send(struct lapdm_datalink *dl)
@@ -285,7 +286,6 @@ static int tx_ph_data_enqueue(struct lapdm_datalink *dl, struct msgb *msg,
uint8_t chan_nr, uint8_t link_id, uint8_t n201)
{
struct lapdm_entity *le = dl->entity;
- struct osmocom_ms *ms = le->ms;
/* if there is a pending message, queue it */
if (le->tx_pending) {
@@ -299,7 +299,7 @@ static int tx_ph_data_enqueue(struct lapdm_datalink *dl, struct msgb *msg,
/* send the frame now */
le->tx_pending = 0; /* disabled flow control */
lapdm_pad_msgb(msg, n201);
- return l1ctl_tx_data_req(ms, msg, chan_nr, link_id);
+ return l1ctl_tx_data_req(le->l1_ctx, msg, chan_nr, link_id);
}
/* get next frame from the tx queue. because the ms has multiple datalinks,
@@ -307,7 +307,6 @@ static int tx_ph_data_enqueue(struct lapdm_datalink *dl, struct msgb *msg,
*/
int l2_ph_data_conf(struct msgb *msg, struct lapdm_entity *le)
{
- struct osmocom_ms *ms = le->ms;
struct lapdm_datalink *dl;
int last = le->last_tx_dequeue;
int i = last, n = ARRAY_SIZE(le->datalink);
@@ -346,7 +345,7 @@ int l2_ph_data_conf(struct msgb *msg, struct lapdm_entity *le)
/* Pad the frame, we can transmit now */
le->tx_pending = 1;
lapdm_pad_msgb(msg, n201);
- return l1ctl_tx_data_req(ms, msg, chan_nr, link_id);
+ return l1ctl_tx_data_req(le->l1_ctx, msg, chan_nr, link_id);
}
/* Create RSLms various RSLms messages */
@@ -357,7 +356,7 @@ static int send_rslms_rll_l3(uint8_t msg_type, struct lapdm_msg_ctx *mctx,
rsl_rll_push_l3(msg, msg_type, mctx->chan_nr, mctx->link_id, 1);
/* send off the RSLms message to L3 */
- return rslms_sendmsg(msg, mctx->dl->entity->ms);
+ return rslms_sendmsg(msg, mctx->dl->entity->l3_ctx);
}
/* Take a B4 format message from L1 and create RSLms UNIT DATA IND */
@@ -379,7 +378,7 @@ static int send_rslms_rll_l3_ui(struct lapdm_msg_ctx *mctx, struct msgb *msg)
rllh->data[2] = RSL_IE_MS_POWER;
rllh->data[3] = mctx->tx_power_ind;
- return rslms_sendmsg(msg, mctx->dl->entity->ms);
+ return rslms_sendmsg(msg, mctx->dl->entity->l3_ctx);
}
static int send_rll_simple(uint8_t msg_type, struct lapdm_msg_ctx *mctx)
@@ -389,7 +388,7 @@ static int send_rll_simple(uint8_t msg_type, struct lapdm_msg_ctx *mctx)
msg = rsl_rll_simple(msg_type, mctx->chan_nr, mctx->link_id, 1);
/* send off the RSLms message to L3 */
- return rslms_sendmsg(msg, mctx->dl->entity->ms);
+ return rslms_sendmsg(msg, mctx->dl->entity->l3_ctx);
}
static int rsl_rll_error(uint8_t cause, struct lapdm_msg_ctx *mctx)
@@ -404,7 +403,7 @@ static int rsl_rll_error(uint8_t cause, struct lapdm_msg_ctx *mctx)
tlv[0] = RSL_IE_RLM_CAUSE;
tlv[1] = 1;
tlv[2] = cause;
- return rslms_sendmsg(msg, mctx->dl->entity->ms);
+ return rslms_sendmsg(msg, mctx->dl->entity->l3_ctx);
}
static int check_length_ind(struct lapdm_msg_ctx *mctx, uint8_t length_ind)