From 445a3a5889178e9bf59f7fb0c446d13d1ae4b164 Mon Sep 17 00:00:00 2001 From: Vivek Date: Tue, 9 Apr 2019 20:24:45 +0530 Subject: [PATCH] qcacmn: Print all elements of serialization history circular buffer In the current implementation, we print the ser history from index 0 to the current index of the ciruclar buffer, so when buffer overflows we print only few recent items. Instead, we should print all the elements in the circular buffer starting from current index to entire length of the circular buffer. This will print all the elements in the circular buffer when it overflows and also takes care of printing required items when buffer is not overflown. Change-Id: I6c54cb34de7a1ba24ee0204004cc9a203173c66b CRs-Fixed: 2430483 --- .../serialization/src/wlan_serialization_debug.c | 16 ++++++++++------ .../src/wlan_serialization_debug_i.h | 5 +++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/umac/cmn_services/serialization/src/wlan_serialization_debug.c b/umac/cmn_services/serialization/src/wlan_serialization_debug.c index 23236396d6a2..6e43592012c7 100644 --- a/umac/cmn_services/serialization/src/wlan_serialization_debug.c +++ b/umac/cmn_services/serialization/src/wlan_serialization_debug.c @@ -117,28 +117,31 @@ static void wlan_ser_print_all_history( uint32_t vdev_id) { uint8_t idx; + uint8_t data_idx; struct ser_history *history_info; struct ser_data *data; history_info = &pdev_queue->history; - if (!history_info->index) - return; - ser_err_no_fl(WLAN_SER_LINE WLAN_SER_LINE); ser_err_no_fl("Queue Commands History"); ser_err_no_fl(WLAN_SER_LINE WLAN_SER_LINE); ser_err_no_fl(WLAN_SER_HISTORY_HEADER); ser_err_no_fl(WLAN_SER_LINE WLAN_SER_LINE); - for (idx = 0; idx < history_info->index; idx++) { - data = &history_info->data[idx]; + for (idx = 0; idx < SER_MAX_HISTORY_CMDS; idx++) { + data_idx = (history_info->index + idx) % SER_MAX_HISTORY_CMDS; + + data = &history_info->data[data_idx]; if (data->ser_reason >= SER_QUEUE_ACTION_MAX) { - ser_err("Invalid Serialization Reason"); + ser_debug("Invalid Serialization Reason"); continue; } + if (!data->data_updated) + continue; + if (for_vdev_queue) { if (vdev_id != data->vdev_id) continue; @@ -243,6 +246,7 @@ void wlan_ser_update_cmd_history( ser_data_info->active_pending = active_queue; ser_data_info->ser_reason = ser_reason; ser_data_info->vdev_id = wlan_vdev_get_id(cmd->vdev); + ser_data_info->data_updated = true; ser_history_info->index++; } diff --git a/umac/cmn_services/serialization/src/wlan_serialization_debug_i.h b/umac/cmn_services/serialization/src/wlan_serialization_debug_i.h index 9705272b4a02..a07d1e02cbbc 100644 --- a/umac/cmn_services/serialization/src/wlan_serialization_debug_i.h +++ b/umac/cmn_services/serialization/src/wlan_serialization_debug_i.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -56,7 +56,8 @@ struct ser_data { is_high_priority:1, add_remove:1, active_pending:1, - ser_reason:6; + data_updated:1, + ser_reason:5; uint16_t vdev_id; };