From bd70ec635054d3e5e0e904fb71afe7d09634a310 Mon Sep 17 00:00:00 2001 From: Chaithanya Garrepalli Date: Mon, 29 Jun 2020 13:12:09 +0530 Subject: [PATCH] qcacmn: Rearrange fields in dp_tx_desc to avoid padding Current dp_tx_desc structure size is 136 bytes, re-arranged the fields to fit in exactly 128 bytes to align with number of descriptor per page and page offset bit maps Also add a compilation assert on tx desc size Change-Id: Ifcb18a9da637cb71c0427b56ad4054d2206ddfbb --- dp/wifi3.0/dp_tx_desc.h | 15 +++++++++++++++ dp/wifi3.0/dp_types.h | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/dp/wifi3.0/dp_tx_desc.h b/dp/wifi3.0/dp_tx_desc.h index ced9d08bfb..39ddfd9727 100644 --- a/dp/wifi3.0/dp_tx_desc.h +++ b/dp/wifi3.0/dp_tx_desc.h @@ -37,6 +37,21 @@ #define DP_TX_DESC_ID_OFFSET_MASK 0x00001F #define DP_TX_DESC_ID_OFFSET_OS 0 +/** + * Compilation assert on tx desc size + * + * if assert is hit please update POOL_MASK, + * PAGE_MASK according to updated size + * + * for current PAGE mask allowed size range of tx_desc + * is between 128 and 256 + */ +QDF_COMPILE_TIME_ASSERT(dp_tx_desc_size, + ((sizeof(struct dp_tx_desc_s)) <= + (PAGE_SIZE >> DP_TX_DESC_ID_PAGE_OS)) && + ((sizeof(struct dp_tx_desc_s)) > + (PAGE_SIZE >> (DP_TX_DESC_ID_PAGE_OS + 1)))); + #ifdef QCA_LL_TX_FLOW_CONTROL_V2 #define TX_DESC_LOCK_CREATE(lock) #define TX_DESC_LOCK_DESTROY(lock) diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index 6a3316053e..559daa484d 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -386,8 +386,8 @@ struct dp_tx_desc_s { qdf_nbuf_t nbuf; uint16_t length; uint16_t flags; - qdf_dma_addr_t dma_addr; uint32_t id; + qdf_dma_addr_t dma_addr; struct dp_vdev *vdev; struct dp_pdev *pdev; uint8_t tx_encap_type;