From e4bd23b40040f9d178938d4f35b08022f971fe5d Mon Sep 17 00:00:00 2001 From: Vivek Date: Thu, 30 Aug 2018 14:35:24 +0530 Subject: [PATCH] qcacmn: Add API to get max size of the list The list APIs only provides the current size of the list. In certain cases, to be able to decide if the queue is full we can compare the current size with the max size of the list and not attempt to add to the list at all. Change-Id: Ic0844ae9fccd8bcc9603d31c41692680966e1753 CRs-Fixed:2304508 --- qdf/inc/qdf_list.h | 12 +++++++++++- qdf/linux/src/i_qdf_list.h | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/qdf/inc/qdf_list.h b/qdf/inc/qdf_list.h index a57d423ae6..2b214968a2 100644 --- a/qdf/inc/qdf_list.h +++ b/qdf/inc/qdf_list.h @@ -137,7 +137,17 @@ static inline void qdf_list_destroy(qdf_list_t *list) */ static inline uint32_t qdf_list_size(qdf_list_t *list) { - return list->count; + return __qdf_list_size(list); +} + +/** + * qdf_list_max_size() - gives the max size of the list + * @list: object of list + * Return: max size of the list + */ +static inline uint32_t qdf_list_max_size(qdf_list_t *list) +{ + return __qdf_list_max_size(list); } QDF_STATUS qdf_list_insert_back(qdf_list_t *list, qdf_list_node_t *node); diff --git a/qdf/linux/src/i_qdf_list.h b/qdf/linux/src/i_qdf_list.h index 1a20615088..254817aa2a 100644 --- a/qdf/linux/src/i_qdf_list.h +++ b/qdf/linux/src/i_qdf_list.h @@ -51,6 +51,26 @@ static inline void __qdf_list_create(__qdf_list_t *list, uint32_t max_size) list->max_size = max_size; } +/** + * __qdf_list_size() - gives the size of the list + * @list: object of list + * Return: size of the list + */ +static inline uint32_t __qdf_list_size(__qdf_list_t *list) +{ + return list->count; +} + +/** + * __qdf_list_max_size() - gives the max size of the list + * @list: object of list + * Return: max size of the list + */ +static inline uint32_t __qdf_list_max_size(__qdf_list_t *list) +{ + return list->max_size; +} + #define __QDF_LIST_ANCHOR(list) ((list).anchor) #define __QDF_LIST_NODE_INIT(prev_node, next_node) \