From Fabrice Bellard:

Add Carrier Id and detailed PHY info to MAC LTE UDP framing dissector

svn path=/trunk/; revision=54370
This commit is contained in:
Pascal Quantin 2013-12-22 21:16:31 +00:00
parent 18f68cae7e
commit 9de6aa8619
3 changed files with 103 additions and 34 deletions

View File

@ -1731,7 +1731,7 @@ static void attach_mac_lte_info(packet_info *pinfo)
p_mac_lte_info = wmem_new0(wmem_file_scope(), struct mac_lte_info);
/* Populate the struct from outhdr values */
p_mac_lte_info->crcStatusValid = crc_fail; /* not set yet */
p_mac_lte_info->crcStatusValid = FALSE; /* not set yet */
p_mac_lte_info->radioType = outhdr_values[i++] + 1;
p_mac_lte_info->rntiType = outhdr_values[i++];
@ -1755,8 +1755,8 @@ static void attach_mac_lte_info(packet_info *pinfo)
if (outhdr_values_found == 10) {
/* CRC only valid for Downlink */
if (p_mac_lte_info->direction == DIRECTION_DOWNLINK) {
p_mac_lte_info->crcStatusValid = crc_success;
p_mac_lte_info->detailed_phy_info.dl_info.crc_status = (mac_lte_crc_status)outhdr_values[i++];
p_mac_lte_info->crcStatusValid = TRUE;
p_mac_lte_info->crcStatus = (mac_lte_crc_status)outhdr_values[i++];
}
else {
i++;
@ -1781,8 +1781,8 @@ static void attach_mac_lte_info(packet_info *pinfo)
p_mac_lte_info->dl_retx = dl_retx_no;
}
p_mac_lte_info->detailed_phy_info.dl_info.resource_block_length = outhdr_values[i++];
p_mac_lte_info->crcStatusValid = crc_success;
p_mac_lte_info->detailed_phy_info.dl_info.crc_status = (mac_lte_crc_status)outhdr_values[i++];
p_mac_lte_info->crcStatusValid = TRUE;
p_mac_lte_info->crcStatus = (mac_lte_crc_status)outhdr_values[i++];
if (outhdr_values_found > 18) {
p_mac_lte_info->detailed_phy_info.dl_info.harq_id = outhdr_values[i++];
p_mac_lte_info->detailed_phy_info.dl_info.ndi = outhdr_values[i++];

View File

@ -94,7 +94,6 @@ static int hf_mac_lte_context_phy_dl_mcs_index = -1;
static int hf_mac_lte_context_phy_dl_redundancy_version_index = -1;
static int hf_mac_lte_context_phy_dl_retx = -1;
static int hf_mac_lte_context_phy_dl_resource_block_length = -1;
static int hf_mac_lte_context_phy_dl_crc_status = -1;
static int hf_mac_lte_context_phy_dl_harq_id = -1;
static int hf_mac_lte_context_phy_dl_ndi = -1;
static int hf_mac_lte_context_phy_dl_tb = -1;
@ -1815,7 +1814,6 @@ gboolean dissect_mac_lte_context_fields(struct mac_lte_info *p_mac_lte_info, tv
p_mac_lte_info->radioType = tvb_get_guint8(tvb, offset++);
p_mac_lte_info->direction = tvb_get_guint8(tvb, offset++);
/* TODO: currently no support for detailed PHY info... */
if (p_mac_lte_info->direction == DIRECTION_UPLINK) {
p_mac_lte_info->detailed_phy_info.ul_info.present = FALSE;
}
@ -1876,7 +1874,7 @@ gboolean dissect_mac_lte_context_fields(struct mac_lte_info *p_mac_lte_info, tv
break;
case MAC_LTE_CRC_STATUS_TAG:
p_mac_lte_info->crcStatusValid = TRUE;
p_mac_lte_info->detailed_phy_info.dl_info.crc_status =
p_mac_lte_info->crcStatus =
(mac_lte_crc_status)tvb_get_guint8(tvb, offset);
offset++;
break;
@ -1890,6 +1888,76 @@ gboolean dissect_mac_lte_context_fields(struct mac_lte_info *p_mac_lte_info, tv
p_mac_lte_info->rach_attempt_number = tvb_get_guint8(tvb, offset);
offset++;
break;
case MAC_LTE_CARRIER_ID_TAG:
p_mac_lte_info->carrierId =
(mac_lte_carrier_id)tvb_get_guint8(tvb, offset);
offset++;
break;
case MAC_LTE_PHY_TAG:
{
gint len, offset1;
len = tvb_get_guint8(tvb, offset++);
offset1 = offset;
if (p_mac_lte_info->direction == DIRECTION_DOWNLINK) {
if (len < 10)
goto next;
p_mac_lte_info->detailed_phy_info.dl_info.present = TRUE;
p_mac_lte_info->detailed_phy_info.dl_info.dci_format =
tvb_get_guint8(tvb, offset);
offset++;
p_mac_lte_info->detailed_phy_info.dl_info.resource_allocation_type =
tvb_get_guint8(tvb, offset);
offset++;
p_mac_lte_info->detailed_phy_info.dl_info.aggregation_level =
tvb_get_guint8(tvb, offset);
offset++;
p_mac_lte_info->detailed_phy_info.dl_info.mcs_index =
tvb_get_guint8(tvb, offset);
offset++;
p_mac_lte_info->detailed_phy_info.dl_info.redundancy_version_index =
tvb_get_guint8(tvb, offset);
offset++;
p_mac_lte_info->detailed_phy_info.dl_info.resource_block_length =
tvb_get_guint8(tvb, offset);
offset++;
p_mac_lte_info->detailed_phy_info.dl_info.harq_id =
tvb_get_guint8(tvb, offset);
offset++;
p_mac_lte_info->detailed_phy_info.dl_info.ndi =
tvb_get_guint8(tvb, offset);
offset++;
p_mac_lte_info->detailed_phy_info.dl_info.transport_block =
tvb_get_guint8(tvb, offset);
offset++;
p_mac_lte_info->dl_retx =
(mac_lte_dl_retx)tvb_get_guint8(tvb, offset);
} else {
if (len < 6)
goto next;
p_mac_lte_info->detailed_phy_info.ul_info.present = TRUE;
p_mac_lte_info->detailed_phy_info.ul_info.modulation_type =
tvb_get_guint8(tvb, offset);
offset++;
p_mac_lte_info->detailed_phy_info.ul_info.tbs_index =
tvb_get_guint8(tvb, offset);
offset++;
p_mac_lte_info->detailed_phy_info.ul_info.resource_block_length =
tvb_get_guint8(tvb, offset);
offset++;
p_mac_lte_info->detailed_phy_info.ul_info.resource_block_start =
tvb_get_guint8(tvb, offset);
offset++;
p_mac_lte_info->detailed_phy_info.ul_info.harq_id =
tvb_get_guint8(tvb, offset);
offset++;
p_mac_lte_info->detailed_phy_info.ul_info.ndi =
tvb_get_guint8(tvb, offset);
}
next:
offset = offset1 + len;
}
break;
case MAC_LTE_PAYLOAD_TAG:
/* Have reached data, so set payload length and get out of loop */
@ -2150,11 +2218,6 @@ static void show_extra_phy_parameters(packet_info *pinfo, tvbuff_t *tvb, proto_t
p_mac_lte_info->detailed_phy_info.dl_info.resource_block_length);
PROTO_ITEM_SET_GENERATED(ti);
ti = proto_tree_add_uint(phy_tree, hf_mac_lte_context_phy_dl_crc_status,
tvb, 0, 0,
p_mac_lte_info->detailed_phy_info.dl_info.crc_status);
PROTO_ITEM_SET_GENERATED(ti);
ti = proto_tree_add_uint(phy_tree, hf_mac_lte_context_phy_dl_harq_id,
tvb, 0, 0,
p_mac_lte_info->detailed_phy_info.dl_info.harq_id);
@ -2176,7 +2239,7 @@ static void show_extra_phy_parameters(packet_info *pinfo, tvbuff_t *tvb, proto_t
write_pdu_label_and_info(phy_ti, NULL,
(global_mac_lte_layer_to_show == ShowPHYLayer) ? pinfo : NULL,
"DL: UEId=%u RNTI=%u DCI_Format=%s Res_Alloc=%u Aggr_Level=%s MCS=%u RV=%u "
"Res_Block_len=%u CRC_status=%s HARQ_id=%u NDI=%u",
"Res_Block_len=%u HARQ_id=%u NDI=%u",
p_mac_lte_info->ueid,
p_mac_lte_info->rnti,
val_to_str_const(p_mac_lte_info->detailed_phy_info.dl_info.dci_format,
@ -2187,8 +2250,6 @@ static void show_extra_phy_parameters(packet_info *pinfo, tvbuff_t *tvb, proto_t
p_mac_lte_info->detailed_phy_info.dl_info.mcs_index,
p_mac_lte_info->detailed_phy_info.dl_info.redundancy_version_index,
p_mac_lte_info->detailed_phy_info.dl_info.resource_block_length,
val_to_str_const(p_mac_lte_info->detailed_phy_info.dl_info.crc_status,
crc_status_vals, "Unknown"),
p_mac_lte_info->detailed_phy_info.dl_info.harq_id,
p_mac_lte_info->detailed_phy_info.dl_info.ndi);
proto_item_append_text(phy_ti, ")");
@ -3388,12 +3449,14 @@ static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree
/* Changes of state caused by events */
if (!pinfo->fd->flags.visited) {
if ((p_mac_lte_info->reTxCount == 0) && (p_mac_lte_info->direction == DIRECTION_UPLINK)) {
mac_lte_drx_new_ulsch_data(p_mac_lte_info->ueid);
if (p_mac_lte_info->direction == DIRECTION_UPLINK) {
if (p_mac_lte_info->reTxCount == 0) {
mac_lte_drx_new_ulsch_data(p_mac_lte_info->ueid);
}
}
else {
/* Downlink */
if ((p_mac_lte_info->crcStatusValid) && (p_mac_lte_info->detailed_phy_info.dl_info.crc_status != crc_success)) {
if ((p_mac_lte_info->crcStatusValid) && (p_mac_lte_info->crcStatus != crc_success)) {
mac_lte_drx_dl_crc_error(p_mac_lte_info->ueid);
}
else if (p_mac_lte_info->reTxCount == 0) {
@ -5211,21 +5274,21 @@ int dissect_mac_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d
if (p_mac_lte_info->crcStatusValid) {
/* Set status */
ti = proto_tree_add_uint(context_tree, hf_mac_lte_context_crc_status,
tvb, 0, 0, p_mac_lte_info->detailed_phy_info.dl_info.crc_status);
tvb, 0, 0, p_mac_lte_info->crcStatus);
PROTO_ITEM_SET_GENERATED(ti);
/* Report non-success */
if (p_mac_lte_info->detailed_phy_info.dl_info.crc_status != crc_success) {
if (p_mac_lte_info->crcStatus != crc_success) {
expert_add_info_format(pinfo, ti, &ei_mac_lte_context_crc_status,
"%s Frame has CRC error problem (%s)",
(p_mac_lte_info->direction == DIRECTION_UPLINK) ? "UL" : "DL",
val_to_str_const(p_mac_lte_info->detailed_phy_info.dl_info.crc_status,
val_to_str_const(p_mac_lte_info->crcStatus,
crc_status_vals,
"Unknown"));
write_pdu_label_and_info(pdu_ti, NULL, pinfo,
"%s: <CRC %s> UEId=%u %s=%u ",
(p_mac_lte_info->direction == DIRECTION_UPLINK) ? "UL" : "DL",
val_to_str_const(p_mac_lte_info->detailed_phy_info.dl_info.crc_status,
val_to_str_const(p_mac_lte_info->crcStatus,
crc_status_vals,
"Unknown"),
p_mac_lte_info->ueid,
@ -5250,7 +5313,7 @@ int dissect_mac_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d
tap_info->isPredefinedData = p_mac_lte_info->isPredefinedData;
tap_info->isPHYRetx = (p_mac_lte_info->reTxCount >= 1);
tap_info->crcStatusValid = p_mac_lte_info->crcStatusValid;
tap_info->crcStatus = p_mac_lte_info->detailed_phy_info.dl_info.crc_status;
tap_info->crcStatus = p_mac_lte_info->crcStatus;
tap_info->direction = p_mac_lte_info->direction;
tap_info->time = pinfo->fd->abs_ts;
@ -5279,7 +5342,7 @@ int dissect_mac_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d
/* IF CRC status failed, just do decode as raw bytes */
if (!global_mac_lte_dissect_crc_failures &&
(p_mac_lte_info->crcStatusValid &&
(p_mac_lte_info->detailed_phy_info.dl_info.crc_status != crc_success))) {
(p_mac_lte_info->crcStatus != crc_success))) {
proto_tree_add_item(mac_lte_tree, hf_mac_lte_raw_pdu, tvb, offset, -1, ENC_NA);
write_pdu_label_and_info(pdu_ti, NULL, pinfo, "Raw data (%u bytes)", tvb_length_remaining(tvb, offset));
@ -5812,12 +5875,6 @@ void proto_register_mac_lte(void)
NULL, HFILL
}
},
{ &hf_mac_lte_context_phy_dl_crc_status,
{ "CRC Status",
"mac-lte.dl-phy.crc-status", FT_UINT8, BASE_DEC, VALS(crc_status_vals), 0x0,
NULL, HFILL
}
},
{ &hf_mac_lte_context_phy_dl_harq_id,
{ "HARQ Id",
"mac-lte.dl-phy.harq-id", FT_UINT8, BASE_DEC, 0, 0x0,

View File

@ -124,15 +124,17 @@ typedef struct mac_lte_info
/* Length of DL PDU or UL grant size in bytes */
guint16 length;
/* UL only. 0=newTx, 1=first-retx, etc */
/* 0=newTx, 1=first-retx, etc */
guint8 reTxCount;
guint8 isPHICHNACK; /* FALSE=PDCCH retx grant, TRUE=PHICH NACK */
/* UL only. Indicates if the R10 extendedBSR-Sizes parameter is set */
gboolean isExtendedBSRSizes;
/* DL only. Status of CRC check */
/* Status of CRC check. For UE it is DL only. For eNodeB it is UL
only. For an analyzer, it is present for both DL and UL. */
gboolean crcStatusValid;
mac_lte_crc_status crcStatus;
/* Carrier ID */
mac_lte_carrier_id carrierId;
@ -161,7 +163,6 @@ typedef struct mac_lte_info
guint8 mcs_index;
guint8 redundancy_version_index;
guint8 resource_block_length;
mac_lte_crc_status crc_status;
guint8 harq_id;
gboolean ndi;
guint8 transport_block; /* 0..1 */
@ -267,6 +268,17 @@ int is_mac_lte_frame_retx(packet_info *pinfo, guint8 direction);
#define MAC_LTE_SEND_PREAMBLE_TAG 0x09
/* 2 bytes, RAPID value (1 byte) followed by RACH attempt number (1 byte) */
#define MAC_LTE_CARRIER_ID_TAG 0x0A
/* 1 byte */
#define MAC_LTE_PHY_TAG 0x0B
/* variable length, length (1 byte) then depending on direction
in UL: modulation type (1 byte), TBS index (1 byte), RB length (1 byte),
RB start (1 byte), HARQ id (1 byte), NDI (1 byte)
in DL: DCI format (1 byte), resource allocation type (1 byte), aggregation level (1 byte),
MCS index (1 byte), redundancy version (1 byte), resource block length (1 byte),
HARQ id (1 byte), NDI (1 byte), TB (1 byte), DL reTx (1 byte) */
/* MAC PDU. Following this tag comes the actual MAC PDU (there is no length, the PDU
continues until the end of the frame) */
#define MAC_LTE_PAYLOAD_TAG 0x01