aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-11-21 13:58:39 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2019-11-21 14:15:10 +0100
commit029a70e493ee1409516466b2d3baf0f5fb8e1310 (patch)
tree92961c92df8d6ea5b310a2c29ef80cc8851117c5 /src
parentde80976d94ca0f38651dcdc6c337d53e7f2ee04a (diff)
Improve logging in gprs_llc.c code
Diffstat (limited to 'src')
-rw-r--r--src/sgsn/gprs_gmm.c4
-rw-r--r--src/sgsn/gprs_llc.c27
2 files changed, 23 insertions, 8 deletions
diff --git a/src/sgsn/gprs_gmm.c b/src/sgsn/gprs_gmm.c
index 17daa7dc..7a097608 100644
--- a/src/sgsn/gprs_gmm.c
+++ b/src/sgsn/gprs_gmm.c
@@ -1625,7 +1625,7 @@ static int gsm48_rx_gmm_ra_upd_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
if (llme) {
/* send a XID reset to re-set all LLC sequence numbers
* in the MS */
- LOGGBP(llme, LOGL_NOTICE, "LLC XID RESET\n");
+ LOGGBP(llme, DMM, LOGL_NOTICE, "LLC XID RESET\n");
gprs_llgmm_reset(llme);
}
/* The MS has to perform GPRS attach */
@@ -1905,7 +1905,7 @@ int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
if (llme && !mmctx &&
gh->msg_type != GSM48_MT_GMM_ATTACH_REQ &&
gh->msg_type != GSM48_MT_GMM_RA_UPD_REQ) {
- LOGGBP(llme, LOGL_NOTICE, "Cannot handle GMM for unknown MM CTX\n");
+ LOGGBP(llme, DMM, LOGL_NOTICE, "Cannot handle GMM for unknown MM CTX\n");
/* 4.7.10 */
if (gh->msg_type == GSM48_MT_GMM_STATUS) {
/* TLLI unassignment */
diff --git a/src/sgsn/gprs_llc.c b/src/sgsn/gprs_llc.c
index 2a27da84..244d22c6 100644
--- a/src/sgsn/gprs_llc.c
+++ b/src/sgsn/gprs_llc.c
@@ -22,6 +22,7 @@
#include <errno.h>
#include <stdint.h>
#include <stdbool.h>
+#include <inttypes.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/linuxlist.h>
@@ -528,7 +529,7 @@ static struct gprs_llc_lle *lle_for_rx_by_tlli_sapi(const uint32_t tlli,
struct gprs_llc_llme *llme;
/* FIXME: don't use the TLLI but the 0xFFFF unassigned? */
llme = llme_alloc(tlli);
- LOGP(DLLC, LOGL_NOTICE, "LLC RX: unknown TLLI 0x%08x, "
+ LOGGBP(llme, DLLC, LOGL_NOTICE, "LLC RX: unknown TLLI 0x%08x, "
"creating LLME on the fly\n", tlli);
lle = &llme->lle[sapi];
return lle;
@@ -1047,6 +1048,10 @@ int gprs_llgmm_assign(struct gprs_llc_llme *llme,
uint32_t old_tlli, uint32_t new_tlli)
{
unsigned int i;
+ bool free = false;
+
+ LOGGBP(llme, DLLC, LOGL_NOTICE, "LLGM Assign pre (%08x => %08x)\n",
+ old_tlli, new_tlli);
if (old_tlli == TLLI_UNASSIGNED && new_tlli != TLLI_UNASSIGNED) {
/* TLLI Assignment 8.3.1 */
@@ -1087,10 +1092,16 @@ int gprs_llgmm_assign(struct gprs_llc_llme *llme,
struct gprs_llc_lle *l = &llme->lle[i];
l->state = GPRS_LLES_UNASSIGNED;
}
- llme_free(llme);
+ free = true;
} else
return -EINVAL;
+ LOGGBP(llme, DLLC, LOGL_NOTICE, "LLGM Assign post (%08x => %08x)\n",
+ old_tlli, new_tlli);
+
+ if (free)
+ llme_free(llme);
+
return 0;
}
@@ -1109,11 +1120,13 @@ int gprs_llgmm_reset(struct gprs_llc_llme *llme)
int xid_bytes_len, rc;
uint8_t *xid;
- LOGP(DLLC, LOGL_NOTICE, "LLGM Reset\n");
+ LOGGBP(llme, DLLC, LOGL_NOTICE, "LLGM Reset\n");
rc = osmo_get_rand_id((uint8_t *) &llme->iov_ui, 4);
if (rc < 0) {
- LOGP(DLLC, LOGL_ERROR, "osmo_get_rand_id() failed for LLC XID reset: %s\n", strerror(-rc));
+ LOGGBP(llme, DLLC, LOGL_ERROR,
+ "osmo_get_rand_id() failed for LLC XID reset: %s\n",
+ strerror(-rc));
return rc;
}
@@ -1144,11 +1157,13 @@ int gprs_llgmm_reset_oldmsg(struct msgb* oldmsg, uint8_t sapi,
int xid_bytes_len, rc;
uint8_t *xid;
- LOGP(DLLC, LOGL_NOTICE, "LLGM Reset\n");
+ LOGGBP(llme, DLLC, LOGL_NOTICE, "LLGM Reset (SAPI=%" PRIu8 ")\n", sapi);
rc = osmo_get_rand_id((uint8_t *) &llme->iov_ui, 4);
if (rc < 0) {
- LOGP(DLLC, LOGL_ERROR, "osmo_get_rand_id() failed for LLC XID reset: %s\n", strerror(-rc));
+ LOGGBP(llme, DLLC, LOGL_ERROR,
+ "osmo_get_rand_id() failed for LLC XID reset: %s\n",
+ strerror(-rc));
return rc;
}