summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas.Eversberg <jolly@eversberg.eu>2011-11-06 20:43:08 +0100
committerHarald Welte <laforge@gnumonks.org>2011-11-12 23:23:36 +0100
commitcbed32796578db7522c1821bdb06d3c1d596ca40 (patch)
tree647d67385dd53d818c067e1e0407bc7b9a6d2588
parent5ac44784b6d725ef34f851d6124190fa848cfe27 (diff)
gsm/lapdm: Set N201 depending on the frame type
This is part of a set of commit to fix LAPDm to handle datalink connection on ACCH (SAPI 3) This is required to transfer SMS on SACCH of TCH/f or SDCCH/8 (4). Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rw-r--r--src/gsm/lapdm.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gsm/lapdm.c b/src/gsm/lapdm.c
index f17560c..7e4b038 100644
--- a/src/gsm/lapdm.c
+++ b/src/gsm/lapdm.c
@@ -531,7 +531,7 @@ static int l2_ph_data_ind(struct msgb *msg, struct lapdm_entity *le,
} else {
mctx.lapdm_fmt = LAPDm_FMT_B;
LOGP(DLLAPD, LOGL_INFO, "fmt=B\n");
- n201 = 20; // FIXME: select correct size by chan.
+ n201 = N201_AB_SDCCH;
sapi = (msg->l2h[0] >> 2) & 7;
}
}
@@ -743,7 +743,7 @@ static int rslms_rx_rll_est_req(struct msgb *msg, struct lapdm_datalink *dl)
uint8_t sapi = rllh->link_id & 7;
struct tlv_parsed tv;
uint8_t length;
- int n201 = 20; //FIXME
+ uint8_t n201 = (rllh->link_id & 0x40) ? N201_AB_SACCH : N201_AB_SDCCH;
struct osmo_dlsap_prim dp;
/* Set LAPDm context for established connection */
@@ -771,9 +771,9 @@ static int rslms_rx_rll_est_req(struct msgb *msg, struct lapdm_datalink *dl)
}
/* check if the layer3 message length exceeds N201 */
- if (length + 3 > 21) { /* FIXME: do we know the channel N201? */
+ if (length > n201) {
LOGP(DLLAPD, LOGL_ERROR, "frame too large: %d > N201(%d) "
- "(discarding)\n", length + 3, 21);
+ "(discarding)\n", length, n201);
msgb_free(msg);
return send_rll_simple(RSL_MT_REL_IND, &dl->mctx);
}
@@ -908,7 +908,7 @@ static int rslms_rx_rll_res_req(struct msgb *msg, struct lapdm_datalink *dl)
uint8_t sapi = rllh->link_id & 7;
struct tlv_parsed tv;
uint8_t length;
- uint8_t n201 = 20; //FIXME
+ uint8_t n201 = (rllh->link_id & 0x40) ? N201_AB_SACCH : N201_AB_SDCCH;
struct osmo_dlsap_prim dp;
/* Set LAPDm context for established connection */