[v4,5/6] net/qede: use common rte bit operation APIs instead
Checks
Commit Message
Remove its own bit operation APIs and use the common one,
this can reduce the code duplication largely.
Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
---
drivers/net/qede/base/bcm_osal.c | 20 --------------------
drivers/net/qede/base/bcm_osal.h | 10 ++++------
2 files changed, 4 insertions(+), 26 deletions(-)
@@ -46,26 +46,6 @@ u32 qede_osal_log2(u32 val)
return log;
}
-inline void qede_set_bit(u32 nr, unsigned long *addr)
-{
- __sync_fetch_and_or(addr, (1UL << nr));
-}
-
-inline void qede_clr_bit(u32 nr, unsigned long *addr)
-{
- __sync_fetch_and_and(addr, ~(1UL << nr));
-}
-
-inline bool qede_test_bit(u32 nr, unsigned long *addr)
-{
- bool res;
-
- rte_mb();
- res = ((*addr) & (1UL << nr)) != 0;
- rte_mb();
- return res;
-}
-
static inline u32 qede_ffb(unsigned long word)
{
unsigned long first_bit;
@@ -8,6 +8,7 @@
#define __BCM_OSAL_H
#include <rte_byteorder.h>
+#include <rte_bitops.h>
#include <rte_spinlock.h>
#include <rte_malloc.h>
#include <rte_atomic.h>
@@ -311,17 +312,14 @@ typedef struct osal_list_t {
#define OSAL_BITS_PER_UL_MASK (OSAL_BITS_PER_UL - 1)
/* Bitops */
-void qede_set_bit(u32, unsigned long *);
#define OSAL_SET_BIT(bit, bitmap) \
- qede_set_bit(bit, bitmap)
+ rte_set_bit64(bit, bitmap)
-void qede_clr_bit(u32, unsigned long *);
#define OSAL_CLEAR_BIT(bit, bitmap) \
- qede_clr_bit(bit, bitmap)
+ rte_clear_bit64(bit, bitmap)
-bool qede_test_bit(u32, unsigned long *);
#define OSAL_TEST_BIT(bit, bitmap) \
- qede_test_bit(bit, bitmap)
+ rte_get_bit64(bit, bitmap)
u32 qede_find_first_bit(unsigned long *, u32);
#define OSAL_FIND_FIRST_BIT(bitmap, length) \