On Sun, Jul 28, 2013 at 10:01:04PM +0200, Holger Hans Peter Freyther wrote:

>         /* Even if there is no P-TMSI allocated, the MS will switch from
>          * foreign TLLI to local TLLI */
>         ctx->tlli_new = gprs_tmsi2tlli(ctx->p_tmsi, TLLI_LOCAL);
> 
>         /* Inform LLC layer about new TLLI but keep old active */
>         gprs_llgmm_assign(ctx->llme, ctx->tlli, ctx->tlli_new,
>                           GPRS_ALGO_GEA0, NULL);
> 
> 
> So this tlli_new does not appear to be used at all and I don't see how/where
> we would use/create the OLD_TLLI IE? Is it implemented?


Okay, this appears to be incomplete. We would need to put dup.tlli in the
gprs_llc.c code if we want to send a TLLI (but then the PCU doesn't appear
to be bale to look-up the old tbf based on the IE_TLLI).

We do have:

  struct sgsn_mm_ctx {
        tlli;
        tlli_new;
        
        struct gprs_llc_llme {
                tlli;
                old_tlli;
        }
  }


1.) During the attach msgb_tlli(msg) will be the foriegn tlli
2.) We will generate a tlli_new based on the reported tmsi...
3.) We will llgm_assign the tlli_new and tlli. 
4.) msgb_tlli(msg) will still point to the foreign tlli
5.) We send a Identity Request
6.) gprs_llc will not provide a dup.tlli
7.) bssgp_tx_dl_ud will use msgb_tlli(msg) and not put a IE_TLLI


Do you have some documentation/brain-dump on how tlli/tlli_new, tlli
and old_tlli interact with each other? E.g. at which point should the
tlli_new be used?

In terms of a patch (which is likely to break the PCU as it does
not support the old tlli):

1.) Use tlli_foreign2local in the look-up.
2.) Sent the tlli_old if it is not UNASSIGNED and if it is
    different to the msgb_tlli(msg). I would also like to assert
    that msgb_tlli(msg) is not equal to mmctx->llme->tlli/old_tlli.
3.) Use the newly assigned tlli as the default.

I would like to apply the last hunk first as it is solving creating
a LLME on the fly on the TX path and instead re-uses the one created
when receiving the first message.


diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index f7a5cde..eaf9ecd 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -760,6 +760,7 @@ static int gsm48_rx_gmm_att_req(struct sgsn_mm_ctx *ctx, 
struct msgb *msg,
        /* Inform LLC layer about new TLLI but keep old active */
        gprs_llgmm_assign(ctx->llme, ctx->tlli, ctx->tlli_new,
                          GPRS_ALGO_GEA0, NULL);
+       ctx->tlli = ctx->llme->tlli;
 
        DEBUGPC(DMM, "\n");
        return gsm48_gmm_authorize(ctx, GMM_T3350_MODE_ATT);
@@ -989,6 +990,7 @@ static int gsm48_rx_gmm_ra_upd_req(struct sgsn_mm_ctx 
*mmctx, struct msgb *msg,
        /* Inform LLC layer about new TLLI but keep old active */
        gprs_llgmm_assign(mmctx->llme, mmctx->tlli, mmctx->tlli_new,
                          GPRS_ALGO_GEA0, NULL);
+       mmctx->tlli = mmctx->llme->tlli;
 
        /* Look at PDP Context Status IE and see if MS's view of
         * activated/deactivated NSAPIs agrees with our view */
diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c
index 8af5367..ee99d16 100644
--- a/openbsc/src/gprs/gprs_llc.c
+++ b/openbsc/src/gprs/gprs_llc.c
@@ -48,6 +48,9 @@ static int _bssgp_tx_dl_ud(struct msgb *msg, struct 
sgsn_mm_ctx *mmctx)
         * not yet have a MMC context (e.g. XID negotiation of primarly
         * LLC connection fro GMM sapi). */
        if (mmctx) {
+               if (msgb_tlli(msg) != mmctx->llme->old_tlli
+                       && mmctx->llme->old_tlli != 0xffffffff)
+                       dup.tlli = &mmctx->llme->old_tlli;
                dup.imsi = mmctx->imsi;
                dup.drx_parms = mmctx->drx_parms;
                dup.ms_ra_cap.len = mmctx->ms_radio_access_capa.len;
@@ -154,7 +157,7 @@ static struct gprs_llc_lle *lle_by_tlli_sapi(uint32_t tlli, 
uint8_t sapi)
        tlli = tlli_foreign2local(tlli);
 
        llist_for_each_entry(llme, &gprs_llc_llmes, list) {
-               if (llme->tlli == tlli || llme->old_tlli == tlli)
+               if (llme->tlli == tlli || tlli_foreign2local(llme->old_tlli) == 
tlli)
                        return &llme->lle[sapi];
        }
        return NULL;

Reply via email to