diff options
| author | Yun Park <yunp@codeaurora.org> | 2016-11-09 10:21:38 -0800 |
|---|---|---|
| committer | qcabuildsw <qcabuildsw@localhost> | 2016-12-05 20:09:13 -0800 |
| commit | 9ef91177a32d3be764d96c47ed232c35116db05e (patch) | |
| tree | 9b564550780ee4e1ee0f24ce73383edd9d1fef85 /qdf/linux/src | |
| parent | 35d186f80c0ff0523d9f0e9c2dfdaa6cc1ffd6e2 (diff) | |
qcacmn: IPA uC: Round down Tx/Rx buffer count to nearest power of two
qcacld-2.0 to qcacmn propagation
In certain situation, allocated Tx buffer count could be an arbitrary
number, so not power of two. This could violate F/W ring buffer count
requirement. If allocated Tx buffer count is not power of two, round
down it to the nearest power of two.
The same change is also applicable for INI parameters IpaUcTxBufCount
and IpaUcRxIndRingCount.
Change-Id: I7c119886a669c79adbc7bd9b2c1c1d93de41cf72
CRs-Fixed: 973723
Diffstat (limited to 'qdf/linux/src')
| -rw-r--r-- | qdf/linux/src/i_qdf_util.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/qdf/linux/src/i_qdf_util.h b/qdf/linux/src/i_qdf_util.h index c66193e39286..fbd2e8433f93 100644 --- a/qdf/linux/src/i_qdf_util.h +++ b/qdf/linux/src/i_qdf_util.h @@ -320,5 +320,21 @@ uint32_t __qdf_get_upper_32_bits(__qdf_dma_addr_t addr) return upper_32_bits(addr); } +/** + * __qdf_rounddown_pow_of_two() - Round down to nearest power of two + * @n: number to be tested + * + * Test if the input number is power of two, and return the nearest power of two + * + * Return: number rounded down to the nearest power of two + */ +static inline +unsigned long __qdf_rounddown_pow_of_two(unsigned long n) +{ + if (is_power_of_2(n)) + return n; /* already a power of 2 */ + + return __rounddown_pow_of_two(n); +} #endif /*_I_QDF_UTIL_H*/ |
