separate diag_log_umts to diag_log_wcdma

Qualcomm differentiates between WCDMA (the access stratum) and UMTS (the
non access stratum).  Let's reflect that here.  As an added bonus, we
get working NAS protocol traces.
This commit is contained in:
Harald Welte 2017-01-07 21:21:35 +01:00
parent a32c769bb7
commit 5fa552cbd3
6 changed files with 65 additions and 16 deletions

View File

@ -2,7 +2,7 @@ CPPFLAGS ?= -g -O0 -Wall `pkg-config --cflags libosmocore` `pkg-config --cflags
LIBS ?= `pkg-config --libs libosmocore` `pkg-config --libs qmi-glib`
all: osmo-qcdiag-log
MODS_LOG = gprs_rlc.o gprs_mac.o diag_gsm.o diag_log.o diag_log_gsm.o diag_log_gprs.o diag_log_umts.o diag_log_qmi.o diag_dpl.o
MODS_LOG = gprs_rlc.o gprs_mac.o diag_gsm.o diag_log.o diag_log_gsm.o diag_log_gprs.o diag_log_wcdma.o diag_log_umts.o diag_log_qmi.o diag_dpl.o
osmo-qcdiag-log: diagchar_hdlc.o diag_io.o osmo-qcdiag-log.o diag_msg.o protocol.o diag_cmd.o $(MODS_LOG)
$(CC) $(CPPFLAGS) -o $@ $^ $(LIBS)

View File

@ -169,6 +169,10 @@ static void handle_rlc_rel(struct log_hdr *lh, struct msgb *msg)
printf("RLC-%cL-RELEASE { tfi=%u, cause=%u }\n", ud, rli->tfi, rli->cause);
}
static void handle_gmm_ota_msg(struct log_hdr *lh, struct msgb *msg)
{
printf("GMM-OTA-MESSAGE { FIXME }\n");
}
static const struct diag_log_dispatch_tbl log_tbl[] = {
{ GSM(LOG_GPRS_LLC_ME_INFO_C), handle_llc_me_info },
@ -186,6 +190,7 @@ static const struct diag_log_dispatch_tbl log_tbl[] = {
{ GSM(LOG_GPRS_MAC_UL_TBF_RELEASE_C), handle_mac_ul_tbf_rel },
{ GSM(LOG_GPRS_RLC_UL_STATS_C), handle_rlc_ul_stats },
{ GSM(LOG_GPRS_RLC_DL_STATS_C), handle_rlc_dl_stats },
{ GSM(LOG_GPRS_SM_GMM_OTA_MESSAGE_C), handle_gmm_ota_msg },
};
static __attribute__((constructor)) void on_dso_load_gprs(void)

View File

@ -1,25 +1,18 @@
#include <stdio.h>
#include "diag_log.h"
#include "protocol/diag_log_gsm.h"
#include "protocol/diag_log_wcdma.h"
#include "protocol/diag_log_umts.h"
static void handle_rrc_sig_msg(struct log_hdr *lh, struct msgb *msg)
static void handle_nas_msg(struct log_hdr *lh, struct msgb *msg)
{
struct diag_umts_rrc_msg *rrm = (struct diag_umts_rrc_msg *) msgb_data(msg);
struct diag_umts_nas_ota_msg *nas = (struct diag_umts_nas_ota_msg *) msgb_data(msg);
printf("RRC: %u %u %u: %s\n", rrm->chan_type, rrm->rb_id, rrm->length,
osmo_hexdump(msgb_data(msg), rrm->length));
}
static void handle_gmm_ota_msg(struct log_hdr *lh, struct msgb *msg)
{
/* FIXME */
printf("NAS: %cL %u: %s\n", nas->direction ? 'U':'D', nas->msg_length,
osmo_hexdump(msgb_data(msg), nas->msg_length));
}
static const struct diag_log_dispatch_tbl log_tbl[] = {
{ UMTS(LOG_WCDMA_SIGNALING_MSG_C), handle_rrc_sig_msg },
{ UMTS(LOG_GPRS_SM_GMM_OTA_MESSAGE_C), handle_gmm_ota_msg },
{ UMTS(LOG_UMTS_NAS_OTA_MESSAGE_LOG_PACKET_C), handle_nas_msg },
};
static __attribute__((constructor)) void on_dso_load_umts(void)

22
src/diag_log_wcdma.c Normal file
View File

@ -0,0 +1,22 @@
#include <stdio.h>
#include "diag_log.h"
#include "protocol/diag_log_gsm.h"
#include "protocol/diag_log_wcdma.h"
static void handle_rrc_sig_msg(struct log_hdr *lh, struct msgb *msg)
{
struct diag_umts_rrc_msg *rrm = (struct diag_umts_rrc_msg *) msgb_data(msg);
printf("RRC: %u %u %u: %s\n", rrm->chan_type, rrm->rb_id, rrm->length,
osmo_hexdump(msgb_data(msg), rrm->length));
}
static const struct diag_log_dispatch_tbl log_tbl[] = {
{ WCDMA(LOG_WCDMA_SIGNALING_MSG_C), handle_rrc_sig_msg },
};
static __attribute__((constructor)) void on_dso_load_umts(void)
{
diag_log_reg_dispatch(log_tbl, ARRAY_SIZE(log_tbl));
}

View File

@ -0,0 +1,29 @@
#pragma once
#include <stdint.h>
#define UMTS(x) (0x7000 + x)
enum diag_log_code_umts {
LOG_UMTS_NAS_GMM_STATE_LOG_PACKET_C = 0x130,
LOG_UMTS_NAS_MM_STATE_LOG_PACKET_C = 0x131,
LOG_UMTS_NAS_REG_LOG_PACKET_C = 0x132,
LOG_UMTS_CS_CALL_SETUP_INFO_LOG_PACKET_C = 0x133,
LOG_UMTS_PS_CALL_INFO_LOG_PACKET_C = 0x134,
LOG_UMTS_MM_INFO_LOG_PACKET_C = 0x135,
LOG_UMTS_NAS_PS_CONNECTION_QOS_LOG_PACKET_C = 0x136,
LOG_UMTS_NAS_CS_CONNECTION_BC_LOG_PACKET_C = 0x137,
LOG_UMTS_NAS_UE_DYNAMIC_ID_LOG_PACKET_C = 0x138,
LOG_UMTS_NAS_UE_STATIC_ID_LOG_PACKET_C = 0x139,
LOG_UMTS_NAS_OTA_MESSAGE_LOG_PACKET_C = 0x13a,
LOG_UMTS_NAS_CFA_MESSAGE_LOG_PACKET_C = 0xa3b,
LOG_UMTS_NAS_ERROR_MESSAGE_LOG_PACKET_C = 0x13c,
LOG_UMTS_CS_CALL_RELEASE_INFO_LOG_PACKET_C = 0x13d,
LOG_UMTS_CS_CALL_CHANGE_INFO_LOG_PACKET_C = 0x13e,
};
struct diag_umts_nas_ota_msg {
uint8_t direction;
uint32_t msg_length;
uint8_t data[0];
} __attribute__((packed));

View File

@ -2,9 +2,9 @@
#include <stdint.h>
#define UMTS(x) (0x4000 + x)
#define WCDMA(x) (0x4000 + x)
enum diag_log_code_umts {
enum diag_log_code_wcdma {
LOG_WCDMA_RRC_STATES_C = 0x125,
LOG_WCDMA_RRC_PROTOCOL_ERRORS_C = 0x126,
LOG_WCDMA_CELL_ID_C = 0x127,