diff options
author | Martin Mathieson <martin.r.mathieson@googlemail.com> | 2013-10-09 22:10:15 +0000 |
---|---|---|
committer | Martin Mathieson <martin.r.mathieson@googlemail.com> | 2013-10-09 22:10:15 +0000 |
commit | 60d0a97524915f0f3bfcdfcdf85fe13d90057f97 (patch) | |
tree | 7bf4ada5f6bbc1f37885ea8490e23cfaa899fca5 /epan/dissectors/packet-mac-lte.c | |
parent | f2f95a49c5d929fd0561c34826857cc8046f3548 (diff) |
Don't update DRX state when preference is turned off
svn path=/trunk/; revision=52482
Diffstat (limited to 'epan/dissectors/packet-mac-lte.c')
-rw-r--r-- | epan/dissectors/packet-mac-lte.c | 167 |
1 files changed, 90 insertions, 77 deletions
diff --git a/epan/dissectors/packet-mac-lte.c b/epan/dissectors/packet-mac-lte.c index 261be92ea8..c20e29eb7d 100644 --- a/epan/dissectors/packet-mac-lte.c +++ b/epan/dissectors/packet-mac-lte.c @@ -1186,8 +1186,8 @@ static GHashTable *mac_lte_sr_request_hash = NULL; /* Config for current cycle/timer state for a configured UE */ -/* Entries inp_state this table are maintained during the first pass - It maps (UEId -> drx_state_t) */ +/* Entries in this table are maintained during the first pass + It maps (UEId -> drx_state_t). */ static GHashTable *mac_lte_drx_ue_state = NULL; typedef struct drx_running_state_t @@ -1213,12 +1213,12 @@ typedef struct drx_running_state_t } drx_running_state_t; -/* TODO: separate out config from state, so that we can show 2 states for each - PDU. One for before the PDU/event, and one after. Only then can show if - we don't think it should have been active at that point... */ +/* Have 2 states for each PDU. One for before the PDU/event, and one after. + Only then can show if we don't think it should have been active at that point... */ typedef struct drx_state_t { - drx_config_t config; - drx_running_state_t running_state; + drx_config_t config; + drx_running_state_t state_before; + drx_running_state_t state_after; } drx_state_t; @@ -1230,14 +1230,14 @@ static GHashTable *mac_lte_drx_frame_result = NULL; static void init_drx_ue_state(drx_state_t *drx_state) { int i; - drx_state->running_state.inShortCycle = FALSE; - drx_state->running_state.onDurationTimer = G_GUINT64_CONSTANT(0); - drx_state->running_state.inactivityTimer = G_GUINT64_CONSTANT(0); + drx_state->state_before.inShortCycle = FALSE; + drx_state->state_before.onDurationTimer = G_GUINT64_CONSTANT(0); + drx_state->state_before.inactivityTimer = G_GUINT64_CONSTANT(0); for (i=0; i < 8; i++) { - drx_state->running_state.RTT[i] = G_GUINT64_CONSTANT(0); - drx_state->running_state.retransmissionTimer[i] = G_GUINT64_CONSTANT(0); + drx_state->state_before.RTT[i] = G_GUINT64_CONSTANT(0); + drx_state->state_before.retransmissionTimer[i] = G_GUINT64_CONSTANT(0); } - drx_state->running_state.shortCycleTimer = G_GUINT64_CONSTANT(0); + drx_state->state_before.shortCycleTimer = G_GUINT64_CONSTANT(0); } typedef enum drx_timer_type_t { @@ -1253,7 +1253,7 @@ static void mac_lte_drx_start_timer(drx_state_t *p_state, drx_timer_type_t timer { /* Get current time in ms */ /* TODO: should this be relative to firstCycleStart to avoid overflowing? */ - guint64 currentTime = (p_state->running_state.currentTime.secs * 1000) + (p_state->running_state.currentTime.nsecs / 1000000); + guint64 currentTime = (p_state->state_before.currentTime.secs * 1000) + (p_state->state_before.currentTime.nsecs / 1000000); guint64 *pTimer; guint16 timerLength; @@ -1261,24 +1261,24 @@ static void mac_lte_drx_start_timer(drx_state_t *p_state, drx_timer_type_t timer /* Get pointer to timer value, and fetch from config how much to add to it */ switch (timer_type) { case drx_onduration_timer: - pTimer = &(p_state->running_state.onDurationTimer); + pTimer = &(p_state->state_before.onDurationTimer); timerLength = p_state->config.onDurationTimer; break; case drx_inactivity_timer: - pTimer = &(p_state->running_state.inactivityTimer); + pTimer = &(p_state->state_before.inactivityTimer); timerLength = p_state->config.inactivityTimer; break; case drx_rtt_timer: - pTimer = &(p_state->running_state.RTT[timer_id]); + pTimer = &(p_state->state_before.RTT[timer_id]); timerLength = 8; break; case drx_retx_timer: - pTimer = &(p_state->running_state.retransmissionTimer[timer_id]); + pTimer = &(p_state->state_before.retransmissionTimer[timer_id]); timerLength = p_state->config.retransmissionTimer; break; case drx_short_cycle_timer: default: - pTimer = &(p_state->running_state.shortCycleTimer); + pTimer = &(p_state->state_before.shortCycleTimer); timerLength = p_state->config.shortCycle * p_state->config.shortCycleTimer; break; } @@ -1293,19 +1293,19 @@ static void mac_lte_drx_stop_timer(drx_state_t *p_state, drx_timer_type_t timer_ /* Set indicated timer value to 0 */ switch (timer_type) { case drx_onduration_timer: - p_state->running_state.onDurationTimer = G_GUINT64_CONSTANT(0); + p_state->state_before.onDurationTimer = G_GUINT64_CONSTANT(0); break; case drx_inactivity_timer: - p_state->running_state.inactivityTimer = G_GUINT64_CONSTANT(0); + p_state->state_before.inactivityTimer = G_GUINT64_CONSTANT(0); break; case drx_rtt_timer: - p_state->running_state.RTT[timer_id] = G_GUINT64_CONSTANT(0); + p_state->state_before.RTT[timer_id] = G_GUINT64_CONSTANT(0); break; case drx_retx_timer: - p_state->running_state.retransmissionTimer[timer_id] = G_GUINT64_CONSTANT(0); + p_state->state_before.retransmissionTimer[timer_id] = G_GUINT64_CONSTANT(0); break; case drx_short_cycle_timer: - p_state->running_state.shortCycleTimer = G_GUINT64_CONSTANT(0); + p_state->state_before.shortCycleTimer = G_GUINT64_CONSTANT(0); break; } } @@ -1316,26 +1316,26 @@ static gboolean mac_lte_drx_has_timer_expired(drx_state_t *p_state, drx_timer_ty { /* Get current time in ms */ /* TODO: should this be relative to firstCycleStart to avoid overflowing? */ - guint64 currentTime = (p_state->running_state.currentTime.secs * 1000) + (p_state->running_state.currentTime.nsecs / 1000000); + guint64 currentTime = (p_state->state_before.currentTime.secs * 1000) + (p_state->state_before.currentTime.nsecs / 1000000); guint64 *pTimer = NULL; /* Get pointer to timer value */ switch (timer_type) { case drx_onduration_timer: - pTimer = &(p_state->running_state.onDurationTimer); + pTimer = &(p_state->state_before.onDurationTimer); break; case drx_inactivity_timer: - pTimer = &(p_state->running_state.inactivityTimer); + pTimer = &(p_state->state_before.inactivityTimer); break; case drx_rtt_timer: - pTimer = &(p_state->running_state.RTT[timer_id]); + pTimer = &(p_state->state_before.RTT[timer_id]); break; case drx_retx_timer: - pTimer = &(p_state->running_state.retransmissionTimer[timer_id]); + pTimer = &(p_state->state_before.retransmissionTimer[timer_id]); break; case drx_short_cycle_timer: - pTimer = &(p_state->running_state.shortCycleTimer); + pTimer = &(p_state->state_before.shortCycleTimer); break; default: @@ -1421,24 +1421,24 @@ static void update_drx_info(packet_info *pinfo, mac_lte_info *p_mac_lte_info) guint16 SF = p_mac_lte_info->subframeNumber; /* Make sure the first time reference has been set */ - if (!ue_state->running_state.firstCycleStartSet) { + if (!ue_state->state_before.firstCycleStartSet) { guint16 subframes = SFN*10 + SF; /* Set firstCycleStart to be the previous SFN=0, SF=0 */ if (pinfo->fd->abs_ts.nsecs > ((subframes % 1000)*1000)) { - ue_state->running_state.firstCycleStart.secs = pinfo->fd->abs_ts.secs - (subframes/1000); - ue_state->running_state.firstCycleStart.nsecs = pinfo->fd->abs_ts.nsecs - (subframes*1000); + ue_state->state_before.firstCycleStart.secs = pinfo->fd->abs_ts.secs - (subframes/1000); + ue_state->state_before.firstCycleStart.nsecs = pinfo->fd->abs_ts.nsecs - (subframes*1000); } else { - ue_state->running_state.firstCycleStart.secs = pinfo->fd->abs_ts.secs - (subframes/1000) - 1; - ue_state->running_state.firstCycleStart.nsecs = 1000000 + pinfo->fd->abs_ts.nsecs - (subframes*1000); + ue_state->state_before.firstCycleStart.secs = pinfo->fd->abs_ts.secs - (subframes/1000) - 1; + ue_state->state_before.firstCycleStart.nsecs = 1000000 + pinfo->fd->abs_ts.nsecs - (subframes*1000); } - ue_state->running_state.firstCycleStartSet = TRUE; + ue_state->state_before.firstCycleStartSet = TRUE; /* Set current time to now */ - ue_state->running_state.currentTime = pinfo->fd->abs_ts; - ue_state->running_state.currentSFN = SFN; - ue_state->running_state.currentSF = SF; + ue_state->state_before.currentTime = pinfo->fd->abs_ts; + ue_state->state_before.currentSFN = SFN; + ue_state->state_before.currentSF = SF; } /* Will loop around these checks, once for each subframe between previous @@ -1449,28 +1449,28 @@ static void update_drx_info(packet_info *pinfo, mac_lte_info *p_mac_lte_info) /* TODO: what to do if there is a huge gap between previous frame and now?? */ /* TODO: add a test that ensures we are still in the correct SFN cycle! */ - while ((ue_state->running_state.currentSFN != SFN) || (ue_state->running_state.currentSF != SF)) { + while ((ue_state->state_before.currentSFN != SFN) || (ue_state->state_before.currentSF != SF)) { /* TODO check for timers that have expired and change state accordingly */ /* See if onDuration timer should be started */ guint16 subframes = SFN*10 + SF; - if (!ue_state->running_state.inShortCycle) { + if (!ue_state->state_before.inShortCycle) { if ((subframes % ue_state->config.longCycle) == ue_state->config.onDurationTimer) { mac_lte_drx_start_timer(ue_state, drx_onduration_timer, 0); - ue_state->running_state.inOnDuration = TRUE; + ue_state->state_before.inOnDuration = TRUE; } } else { if ((subframes % ue_state->config.shortCycle) == (ue_state->config.onDurationTimer % ue_state->config.shortCycle)) { mac_lte_drx_start_timer(ue_state, drx_onduration_timer, 0); - ue_state->running_state.inOnDuration = TRUE; + ue_state->state_before.inOnDuration = TRUE; } } /* See if onDuration has expired */ if (mac_lte_drx_has_timer_expired(ue_state, drx_onduration_timer, 0, &time_until_expires)) { - ue_state->running_state.inOnDuration = FALSE; + ue_state->state_before.inOnDuration = FALSE; } /* Check for HARQ RTT Timer expiring. @@ -1487,29 +1487,29 @@ static void update_drx_info(packet_info *pinfo, mac_lte_info *p_mac_lte_info) /* Inactivity timer expired */ if (mac_lte_drx_has_timer_expired(ue_state, drx_inactivity_timer, 0, &time_until_expires)) { if (ue_state->config.shortCycleConfigured) { - ue_state->running_state.inShortCycle = TRUE; + ue_state->state_before.inShortCycle = TRUE; mac_lte_drx_start_timer(ue_state, drx_short_cycle_timer, 0); } } /* Move subframe along by one */ - if (ue_state->running_state.currentSF == 9) { - ue_state->running_state.currentSF = 0; - if (ue_state->running_state.currentSFN == 1023) { - ue_state->running_state.currentSFN = 0; + if (ue_state->state_before.currentSF == 9) { + ue_state->state_before.currentSF = 0; + if (ue_state->state_before.currentSFN == 1023) { + ue_state->state_before.currentSFN = 0; } else { - ue_state->running_state.currentSFN++; + ue_state->state_before.currentSFN++; } } else { - ue_state->running_state.currentSF++; + ue_state->state_before.currentSF++; } } /* Set current time to now */ - ue_state->running_state.currentTime = pinfo->fd->abs_ts; + ue_state->state_before.currentTime = pinfo->fd->abs_ts; } } @@ -1612,7 +1612,7 @@ static void show_drx_info(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, /* Show cycle information */ - if (!frame_state->running_state.inShortCycle) { + if (!frame_state->state_before.inShortCycle) { /* Show where we are in current long cycle */ guint16 offset_into_long_cycle = ((p_mac_lte_info->sysframeNumber*10) + p_mac_lte_info->subframeNumber) % frame_state->config.longCycle; @@ -1622,11 +1622,11 @@ static void show_drx_info(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, /* Show whether we're inside long cycle on-duration */ ti = proto_tree_add_boolean(drx_state_tree, hf_mac_lte_drx_state_long_cycle_on, tvb, - 0, 0, frame_state->running_state.inOnDuration); + 0, 0, frame_state->state_before.inOnDuration); PROTO_ITEM_SET_GENERATED(ti); proto_item_append_text(drx_state_ti, " (Offset-into-Long=%u, Long-cycle-on=%s)", - offset_into_long_cycle, frame_state->running_state.inOnDuration ? "True" : "False"); + offset_into_long_cycle, frame_state->state_before.inOnDuration ? "True" : "False"); } else { /* Show where we are inside short cycle */ @@ -1639,11 +1639,11 @@ static void show_drx_info(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, /* Show whether we're inside short cycle on-duration */ ti = proto_tree_add_boolean(drx_state_tree, hf_mac_lte_drx_state_short_cycle_on, tvb, - 0, 0, frame_state->running_state.inOnDuration); + 0, 0, frame_state->state_before.inOnDuration); PROTO_ITEM_SET_GENERATED(ti); proto_item_append_text(drx_state_ti, " (Offset-into-Short=%u, Long-cycle-on=%s)", - offset_into_short_cycle, frame_state->running_state.inOnDuration ? "True" : "False"); + offset_into_short_cycle, frame_state->state_before.inOnDuration ? "True" : "False"); } /* TODO: Show which timers are still running and how long they have to go. @@ -3239,36 +3239,35 @@ static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree /* DRX information */ /* Update DRX state of UE */ - if ((p_mac_lte_info->reTxCount == 0) && !pinfo->fd->flags.visited) { + if (global_mac_lte_show_drx) { + if ((p_mac_lte_info->reTxCount == 0) && !pinfo->fd->flags.visited) { - /* Update UE state to this subframe */ - update_drx_info(pinfo, p_mac_lte_info); + /* Update UE state to this subframe (but before this event is processed) */ + update_drx_info(pinfo, p_mac_lte_info); - /* Changes of state caused by events */ - if (p_mac_lte_info->direction == DIRECTION_UPLINK) { - mac_lte_drx_new_ulsch_data(p_mac_lte_info->ueid); - } - else { - /* Downlink */ - if (p_mac_lte_info->crcStatusValid != crc_success) { - mac_lte_drx_dl_crc_error(p_mac_lte_info->ueid); + /* Store 'before' snapshot of UE state for this frame */ + set_drx_info(pinfo, p_mac_lte_info); + + /* Changes of state caused by events */ + if (p_mac_lte_info->direction == DIRECTION_UPLINK) { + mac_lte_drx_new_ulsch_data(p_mac_lte_info->ueid); } else { - mac_lte_drx_new_dlsch_data(p_mac_lte_info->ueid); + /* Downlink */ + if (p_mac_lte_info->crcStatusValid != crc_success) { + mac_lte_drx_dl_crc_error(p_mac_lte_info->ueid); + } + else { + mac_lte_drx_new_dlsch_data(p_mac_lte_info->ueid); + } } } - } - /* Show current DRX state in tree */ - if (global_mac_lte_show_drx) { - if (!pinfo->fd->flags.visited) { - /* Store snapshot of UE state for this frame */ - set_drx_info(pinfo, p_mac_lte_info); - } - /* Show stored DRX info every time */ + /* Show current DRX state in tree as 'before' */ show_drx_info(pinfo, tree, tvb, p_mac_lte_info); } + /* For uplink frames, if this is logged as a resend, look for original tx */ if (direction == DIRECTION_UPLINK) { TrackReportedULHARQResend(pinfo, tvb, offset, tree, p_mac_lte_info, retx_ti); @@ -4125,6 +4124,20 @@ static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree } } +#if 0 + /* Can now store updated DRX info and show its info in the tree */ + /* TODO: add and use 'after' flags to these functions */ + if (global_mac_lte_show_drx) { + if (!pinfo->fd->flags.visited) { + /* Store 'after' snapshot of UE state for this frame */ + set_drx_info(pinfo, p_mac_lte_info); + } + + /* Show current DRX state in tree as 'before' */ + show_drx_info(pinfo, tree, tvb, p_mac_lte_info); + } +#endif + /* There might not be any data, if only headers (plus control data) were logged */ is_truncated = ((tvb_length_remaining(tvb, offset) == 0) && expecting_body_data); truncated_ti = proto_tree_add_uint(tree, hf_mac_lte_sch_header_only, tvb, 0, 0, |