* [PATCH 0/5] rtlwifi: rtl8188ee: Replace local TX and RX bit manipulation macros
From: Larry Finger @ 2019-07-31 0:32 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless, pkshih, Larry Finger
These patches are part of a series intended to replace the bit-manipulation
macros used to set and read the various descriptors with a set of inline
routines.
The final patch removes a local configuration variable.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Larry Finger (5):
rtlwifi: rtl8i188ee: Remove unused GET_XXX and SET_XXX descriptor
macros
rtlwifi: rtl88188ee: Replace local bit manipulation macros
rtlwifi: rtl8188ee: Convert macros that set descriptor
rtlwifi: rtl8188ee: Convert inline routines to little-endian words
rtlwifi: rtl8188ee: Remove local configuration variable
.../wireless/realtek/rtlwifi/rtl8188ee/dm.c | 7 +-
.../wireless/realtek/rtlwifi/rtl8188ee/trx.c | 257 ++--
.../wireless/realtek/rtlwifi/rtl8188ee/trx.h | 1046 +++++++++--------
3 files changed, 673 insertions(+), 637 deletions(-)
--
2.22.0
^ permalink raw reply
* [PATCH 1/5] rtlwifi: rtl8188ee: Remove unused GET_XXX and SET_XXX descriptor macros
From: Larry Finger @ 2019-07-31 0:33 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless, pkshih, Larry Finger
In-Reply-To: <20190731003304.14377-1-Larry.Finger@lwfinger.net>
As the first step in converting from macros that get/set information
in the RX and TX descriptors, unused macros are being removed.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
.../wireless/realtek/rtlwifi/rtl8188ee/trx.h | 267 +-----------------
1 file changed, 6 insertions(+), 261 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
index c29d9bfa5bd4..60efabc6f87a 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
@@ -28,31 +28,9 @@
SET_BITS_TO_LE_4BYTE(__pdesc, 27, 1, __val)
#define SET_TX_DESC_LINIP(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc, 28, 1, __val)
-#define SET_TX_DESC_NO_ACM(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc, 29, 1, __val)
-#define SET_TX_DESC_GF(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc, 30, 1, __val)
#define SET_TX_DESC_OWN(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc, 31, 1, __val)
-#define GET_TX_DESC_PKT_SIZE(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 0, 16)
-#define GET_TX_DESC_OFFSET(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 16, 8)
-#define GET_TX_DESC_BMC(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 24, 1)
-#define GET_TX_DESC_HTC(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 25, 1)
-#define GET_TX_DESC_LAST_SEG(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 26, 1)
-#define GET_TX_DESC_FIRST_SEG(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 27, 1)
-#define GET_TX_DESC_LINIP(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 28, 1)
-#define GET_TX_DESC_NO_ACM(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 29, 1)
-#define GET_TX_DESC_GF(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 30, 1)
#define GET_TX_DESC_OWN(__pdesc) \
LE_BITS_TO_4BYTE(__pdesc, 31, 1)
@@ -60,144 +38,39 @@
SET_BITS_TO_LE_4BYTE(__pdesc+4, 0, 6, __val)
#define SET_TX_DESC_QUEUE_SEL(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+4, 8, 5, __val)
-#define SET_TX_DESC_RDG_NAV_EXT(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 13, 1, __val)
-#define SET_TX_DESC_LSIG_TXOP_EN(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 14, 1, __val)
-#define SET_TX_DESC_PIFS(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 15, 1, __val)
#define SET_TX_DESC_RATE_ID(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+4, 16, 4, __val)
#define SET_TX_DESC_NAV_USE_HDR(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+4, 20, 1, __val)
-#define SET_TX_DESC_EN_DESC_ID(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 21, 1, __val)
#define SET_TX_DESC_SEC_TYPE(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+4, 22, 2, __val)
#define SET_TX_DESC_PKT_OFFSET(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+4, 26, 5, __val)
-#define SET_TX_DESC_PADDING_LEN(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 24, 8, __val)
-
-#define GET_TX_DESC_MACID(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 0, 5)
-#define GET_TX_DESC_AGG_ENABLE(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 5, 1)
-#define GET_TX_DESC_AGG_BREAK(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 6, 1)
-#define GET_TX_DESC_RDG_ENABLE(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 7, 1)
-#define GET_TX_DESC_QUEUE_SEL(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 8, 5)
-#define GET_TX_DESC_RDG_NAV_EXT(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 13, 1)
-#define GET_TX_DESC_LSIG_TXOP_EN(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 14, 1)
-#define GET_TX_DESC_PIFS(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 15, 1)
-#define GET_TX_DESC_RATE_ID(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 16, 4)
-#define GET_TX_DESC_NAV_USE_HDR(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 20, 1)
-#define GET_TX_DESC_EN_DESC_ID(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 21, 1)
-#define GET_TX_DESC_SEC_TYPE(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 22, 2)
-#define GET_TX_DESC_PKT_OFFSET(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 24, 8)
-
-#define SET_TX_DESC_RTS_RC(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 0, 6, __val)
-#define SET_TX_DESC_DATA_RC(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 6, 6, __val)
+
#define SET_TX_DESC_AGG_ENABLE(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+8, 12, 1, __val)
#define SET_TX_DESC_RDG_ENABLE(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+8, 13, 1, __val)
-#define SET_TX_DESC_BAR_RTY_TH(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 14, 2, __val)
-#define SET_TX_DESC_AGG_BREAK(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 16, 1, __val)
#define SET_TX_DESC_MORE_FRAG(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+8, 17, 1, __val)
-#define SET_TX_DESC_RAW(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 18, 1, __val)
-#define SET_TX_DESC_CCX(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 19, 1, __val)
#define SET_TX_DESC_AMPDU_DENSITY(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+8, 20, 3, __val)
-#define SET_TX_DESC_BT_INT(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 23, 1, __val)
#define SET_TX_DESC_ANTSEL_A(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+8, 24, 1, __val)
#define SET_TX_DESC_ANTSEL_B(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+8, 25, 1, __val)
-#define SET_TX_DESC_TX_ANT_CCK(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 26, 2, __val)
-#define SET_TX_DESC_TX_ANTL(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 28, 2, __val)
-#define SET_TX_DESC_TX_ANT_HT(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 30, 2, __val)
-
-#define GET_TX_DESC_RTS_RC(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+8, 0, 6)
-#define GET_TX_DESC_DATA_RC(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+8, 6, 6)
-#define GET_TX_DESC_BAR_RTY_TH(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+8, 14, 2)
-#define GET_TX_DESC_MORE_FRAG(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+8, 17, 1)
-#define GET_TX_DESC_RAW(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+8, 18, 1)
-#define GET_TX_DESC_CCX(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+8, 19, 1)
-#define GET_TX_DESC_AMPDU_DENSITY(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+8, 20, 3)
-#define GET_TX_DESC_ANTSEL_A(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+8, 24, 1)
-#define GET_TX_DESC_ANTSEL_B(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+8, 25, 1)
-#define GET_TX_DESC_TX_ANT_CCK(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+8, 26, 2)
-#define GET_TX_DESC_TX_ANTL(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+8, 28, 2)
-#define GET_TX_DESC_TX_ANT_HT(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+8, 30, 2)
-
-#define SET_TX_DESC_NEXT_HEAP_PAGE(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 0, 8, __val)
-#define SET_TX_DESC_TAIL_PAGE(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 8, 8, __val)
+
#define SET_TX_DESC_SEQ(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+12, 16, 12, __val)
-#define SET_TX_DESC_CPU_HANDLE(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 28, 1, __val)
-#define SET_TX_DESC_TAG1(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 29, 1, __val)
-#define SET_TX_DESC_TRIGGER_INT(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 30, 1, __val)
#define SET_TX_DESC_HWSEQ_EN(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+12, 31, 1, __val)
-#define GET_TX_DESC_NEXT_HEAP_PAGE(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+12, 0, 8)
-#define GET_TX_DESC_TAIL_PAGE(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+12, 8, 8)
-#define GET_TX_DESC_SEQ(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+12, 16, 12)
-
#define SET_TX_DESC_RTS_RATE(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+16, 0, 5, __val)
-#define SET_TX_DESC_AP_DCFE(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 5, 1, __val)
#define SET_TX_DESC_QOS(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+16, 6, 1, __val)
-#define SET_TX_DESC_HWSEQ_SSN(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 7, 1, __val)
#define SET_TX_DESC_USE_RATE(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+16, 8, 1, __val)
-#define SET_TX_DESC_DISABLE_RTS_FB(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 9, 1, __val)
#define SET_TX_DESC_DISABLE_FB(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+16, 10, 1, __val)
#define SET_TX_DESC_CTS2SELF(__pdesc, __val) \
@@ -206,20 +79,10 @@
SET_BITS_TO_LE_4BYTE(__pdesc+16, 12, 1, __val)
#define SET_TX_DESC_HW_RTS_ENABLE(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+16, 13, 1, __val)
-#define SET_TX_DESC_PORT_ID(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 14, 1, __val)
-#define SET_TX_DESC_PWR_STATUS(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 15, 3, __val)
-#define SET_TX_DESC_WAIT_DCTS(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 18, 1, __val)
-#define SET_TX_DESC_CTS2AP_EN(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 19, 1, __val)
#define SET_TX_DESC_TX_SUB_CARRIER(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+16, 20, 2, __val)
#define SET_TX_DESC_TX_STBC(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+16, 22, 2, __val)
-#define SET_TX_DESC_DATA_SHORT(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 24, 1, __val)
#define SET_TX_DESC_DATA_BW(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+16, 25, 1, __val)
#define SET_TX_DESC_RTS_SHORT(__pdesc, __val) \
@@ -231,152 +94,34 @@
#define SET_TX_DESC_RTS_STBC(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+16, 30, 2, __val)
-#define GET_TX_DESC_RTS_RATE(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 0, 5)
-#define GET_TX_DESC_AP_DCFE(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 5, 1)
-#define GET_TX_DESC_QOS(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 6, 1)
-#define GET_TX_DESC_HWSEQ_EN(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 7, 1)
-#define GET_TX_DESC_USE_RATE(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 8, 1)
-#define GET_TX_DESC_DISABLE_RTS_FB(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 9, 1)
-#define GET_TX_DESC_DISABLE_FB(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 10, 1)
-#define GET_TX_DESC_CTS2SELF(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 11, 1)
-#define GET_TX_DESC_RTS_ENABLE(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 12, 1)
-#define GET_TX_DESC_HW_RTS_ENABLE(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 13, 1)
-#define GET_TX_DESC_PORT_ID(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 14, 1)
-#define GET_TX_DESC_WAIT_DCTS(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 18, 1)
-#define GET_TX_DESC_CTS2AP_EN(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 19, 1)
-#define GET_TX_DESC_TX_SUB_CARRIER(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 20, 2)
-#define GET_TX_DESC_TX_STBC(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 22, 2)
-#define GET_TX_DESC_DATA_SHORT(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 24, 1)
-#define GET_TX_DESC_DATA_BW(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 25, 1)
-#define GET_TX_DESC_RTS_SHORT(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 26, 1)
-#define GET_TX_DESC_RTS_BW(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 27, 1)
-#define GET_TX_DESC_RTS_SC(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 28, 2)
-#define GET_TX_DESC_RTS_STBC(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 30, 2)
-
#define SET_TX_DESC_TX_RATE(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+20, 0, 6, __val)
#define SET_TX_DESC_DATA_SHORTGI(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+20, 6, 1, __val)
-#define SET_TX_DESC_CCX_TAG(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+20, 7, 1, __val)
#define SET_TX_DESC_DATA_RATE_FB_LIMIT(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+20, 8, 5, __val)
#define SET_TX_DESC_RTS_RATE_FB_LIMIT(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+20, 13, 4, __val)
-#define SET_TX_DESC_RETRY_LIMIT_ENABLE(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+20, 17, 1, __val)
-#define SET_TX_DESC_DATA_RETRY_LIMIT(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+20, 18, 6, __val)
-#define SET_TX_DESC_USB_TXAGG_NUM(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+20, 24, 8, __val)
-
-#define GET_TX_DESC_TX_RATE(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+20, 0, 6)
-#define GET_TX_DESC_DATA_SHORTGI(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+20, 6, 1)
-#define GET_TX_DESC_CCX_TAG(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+20, 7, 1)
-#define GET_TX_DESC_DATA_RATE_FB_LIMIT(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+20, 8, 5)
-#define GET_TX_DESC_RTS_RATE_FB_LIMIT(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+20, 13, 4)
-#define GET_TX_DESC_RETRY_LIMIT_ENABLE(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+20, 17, 1)
-#define GET_TX_DESC_DATA_RETRY_LIMIT(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+20, 18, 6)
-#define GET_TX_DESC_USB_TXAGG_NUM(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+20, 24, 8)
-
-#define SET_TX_DESC_TXAGC_A(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+24, 0, 5, __val)
-#define SET_TX_DESC_TXAGC_B(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+24, 5, 5, __val)
-#define SET_TX_DESC_USE_MAX_LEN(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+24, 10, 1, __val)
+
#define SET_TX_DESC_MAX_AGG_NUM(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+24, 11, 5, __val)
-#define SET_TX_DESC_MCSG1_MAX_LEN(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+24, 16, 4, __val)
-#define SET_TX_DESC_MCSG2_MAX_LEN(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+24, 20, 4, __val)
-#define SET_TX_DESC_MCSG3_MAX_LEN(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+24, 24, 4, __val)
-#define SET_TX_DESC_MCS7_SGI_MAX_LEN(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+24, 28, 4, __val)
-
-#define GET_TX_DESC_TXAGC_A(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+24, 0, 5)
-#define GET_TX_DESC_TXAGC_B(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+24, 5, 5)
-#define GET_TX_DESC_USE_MAX_LEN(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+24, 10, 1)
-#define GET_TX_DESC_MAX_AGG_NUM(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+24, 11, 5)
-#define GET_TX_DESC_MCSG1_MAX_LEN(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+24, 16, 4)
-#define GET_TX_DESC_MCSG2_MAX_LEN(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+24, 20, 4)
-#define GET_TX_DESC_MCSG3_MAX_LEN(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+24, 24, 4)
-#define GET_TX_DESC_MCS7_SGI_MAX_LEN(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+24, 28, 4)
-
-#define SET_TX_DESC_TX_BUFFER_SIZE(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+28, 0, 16, __val)
-#define SET_TX_DESC_SW_OFFSET30(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+28, 16, 8, __val)
-#define SET_TX_DESC_SW_OFFSET31(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+28, 24, 4, __val)
+
#define SET_TX_DESC_ANTSEL_C(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+28, 29, 1, __val)
-#define SET_TX_DESC_NULL_0(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+28, 30, 1, __val)
-#define SET_TX_DESC_NULL_1(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+28, 30, 1, __val)
+#define SET_TX_DESC_TX_BUFFER_SIZE(__pdesc, __val) \
+ SET_BITS_TO_LE_4BYTE(__pdesc+28, 0, 16, __val)
#define GET_TX_DESC_TX_BUFFER_SIZE(__pdesc) \
LE_BITS_TO_4BYTE(__pdesc+28, 0, 16)
#define SET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+32, 0, 32, __val)
-#define SET_TX_DESC_TX_BUFFER_ADDRESS64(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+36, 0, 32, __val)
#define GET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc) \
LE_BITS_TO_4BYTE(__pdesc+32, 0, 32)
-#define GET_TX_DESC_TX_BUFFER_ADDRESS64(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+36, 0, 32)
#define SET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc, __val) \
SET_BITS_TO_LE_4BYTE(__pdesc+40, 0, 32, __val)
-#define SET_TX_DESC_NEXT_DESC_ADDRESS64(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+44, 0, 32, __val)
-
-#define GET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+40, 0, 32)
-#define GET_TX_DESC_NEXT_DESC_ADDRESS64(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+44, 0, 32)
#define GET_RX_DESC_PKT_LEN(__pdesc) \
LE_BITS_TO_4BYTE(__pdesc, 0, 14)
--
2.22.0
^ permalink raw reply related
* [PATCH 2/5] rtlwifi: rtl88188ee: Replace local bit manipulation macros
From: Larry Finger @ 2019-07-31 0:33 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless, pkshih, Larry Finger
In-Reply-To: <20190731003304.14377-1-Larry.Finger@lwfinger.net>
This driver uses a set of local macros to manipulate the RX and TX
descriptors, which are all little-endian quantities. These macros
are replaced by the bitfield macros le32p_replace_bits() and
le32_get_bits(). In several places, the macros operated on an entire
32-bit word. In these cases, a direct read or replacement is used.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
.../wireless/realtek/rtlwifi/rtl8188ee/trx.h | 213 +++++++++---------
1 file changed, 106 insertions(+), 107 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
index 60efabc6f87a..8147e95a4cc6 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
@@ -15,241 +15,240 @@
#define CRCLENGTH 4
#define SET_TX_DESC_PKT_SIZE(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc, 0, 16, __val)
+ le32p_replace_bits((__le32 *)__pdesc, __val, GENMASK(15, 0))
#define SET_TX_DESC_OFFSET(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc, 16, 8, __val)
+ le32p_replace_bits((__le32 *)__pdesc, __val, GENMASK(23, 16))
#define SET_TX_DESC_BMC(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc, 24, 1, __val)
+ le32p_replace_bits((__le32 *)__pdesc, __val, BIT(24))
#define SET_TX_DESC_HTC(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc, 25, 1, __val)
+ le32p_replace_bits((__le32 *)__pdesc, __val, BIT(25))
#define SET_TX_DESC_LAST_SEG(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc, 26, 1, __val)
+ le32p_replace_bits((__le32 *)__pdesc, __val, BIT(26))
#define SET_TX_DESC_FIRST_SEG(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc, 27, 1, __val)
+ le32p_replace_bits((__le32 *)__pdesc, __val, BIT(27))
#define SET_TX_DESC_LINIP(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc, 28, 1, __val)
+ le32p_replace_bits((__le32 *)__pdesc, __val, BIT(28))
#define SET_TX_DESC_OWN(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc, 31, 1, __val)
+ le32p_replace_bits((__le32 *)__pdesc, __val, BIT(31))
#define GET_TX_DESC_OWN(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 31, 1)
+ le32_get_bits(*((__le32 *)__pdesc), BIT(31))
#define SET_TX_DESC_MACID(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 0, 6, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 4), __val, GENMASK(5, 0))
#define SET_TX_DESC_QUEUE_SEL(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 8, 5, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 4), __val, GENMASK(12, 8))
#define SET_TX_DESC_RATE_ID(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 16, 4, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 4), __val, GENMASK(19, 16))
#define SET_TX_DESC_NAV_USE_HDR(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 20, 1, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 4), __val, BIT(20))
#define SET_TX_DESC_SEC_TYPE(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 22, 2, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 4), __val, GENMASK(23, 22))
#define SET_TX_DESC_PKT_OFFSET(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 26, 5, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 4), __val, GENMASK(30, 26))
#define SET_TX_DESC_AGG_ENABLE(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 12, 1, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(12))
#define SET_TX_DESC_RDG_ENABLE(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 13, 1, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(13))
#define SET_TX_DESC_MORE_FRAG(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 17, 1, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(17))
#define SET_TX_DESC_AMPDU_DENSITY(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 20, 3, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 8), __val, GENMASK(22, 20))
#define SET_TX_DESC_ANTSEL_A(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 24, 1, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(24))
#define SET_TX_DESC_ANTSEL_B(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 25, 1, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(25))
#define SET_TX_DESC_SEQ(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 16, 12, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 12), __val, GENMASK(27, 16))
#define SET_TX_DESC_HWSEQ_EN(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 31, 1, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 12), __val, BIT(31))
#define SET_TX_DESC_RTS_RATE(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 0, 5, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, GENMASK(4, 0))
#define SET_TX_DESC_QOS(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 6, 1, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(6))
#define SET_TX_DESC_USE_RATE(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 8, 1, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(8))
#define SET_TX_DESC_DISABLE_FB(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 10, 1, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(10))
#define SET_TX_DESC_CTS2SELF(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 11, 1, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(11))
#define SET_TX_DESC_RTS_ENABLE(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 12, 1, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(12))
#define SET_TX_DESC_HW_RTS_ENABLE(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 13, 1, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(13))
#define SET_TX_DESC_TX_SUB_CARRIER(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 20, 2, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, GENMASK(21, 20))
#define SET_TX_DESC_TX_STBC(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 22, 2, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, GENMASK(23, 22))
#define SET_TX_DESC_DATA_BW(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 25, 1, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(25))
#define SET_TX_DESC_RTS_SHORT(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 26, 1, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(26))
#define SET_TX_DESC_RTS_BW(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 27, 1, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(27))
#define SET_TX_DESC_RTS_SC(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 28, 2, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, GENMASK(29, 28))
#define SET_TX_DESC_RTS_STBC(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 30, 2, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, GENMASK(31, 30))
#define SET_TX_DESC_TX_RATE(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+20, 0, 6, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 20), __val, GENMASK(5, 0))
#define SET_TX_DESC_DATA_SHORTGI(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+20, 6, 1, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 20), __val, BIT(6))
#define SET_TX_DESC_DATA_RATE_FB_LIMIT(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+20, 8, 5, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 20), __val, GENMASK(12, 8))
#define SET_TX_DESC_RTS_RATE_FB_LIMIT(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+20, 13, 4, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 20), __val, GENMASK(16, 13))
#define SET_TX_DESC_MAX_AGG_NUM(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+24, 11, 5, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 24), __val, GENMASK(15, 11))
#define SET_TX_DESC_ANTSEL_C(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+28, 29, 1, __val)
-
+ le32p_replace_bits((__le32 *)(__pdesc + 28), __val, BIT(29))
#define SET_TX_DESC_TX_BUFFER_SIZE(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+28, 0, 16, __val)
+ le32p_replace_bits((__le32 *)(__pdesc + 28), __val, GENMASK(15, 0))
#define GET_TX_DESC_TX_BUFFER_SIZE(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+28, 0, 16)
+ le32_get_bits(*((__le32 *)(__pdesc + 28)), GENMASK(15, 0))
#define SET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+32, 0, 32, __val)
+ *(__le32 *)(__pdesc + 32) = cpu_to_le32(__val)
#define GET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+32, 0, 32)
+ le32_to_cpu(*((__le32 *)(__pdesc + 32)))
#define SET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+40, 0, 32, __val)
+ *(__le32 *)(__pdesc + 40) = cpu_to_le32(__val)
#define GET_RX_DESC_PKT_LEN(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 0, 14)
+ le32_get_bits(*((__le32 *)__pdesc), GENMASK(13, 0))
#define GET_RX_DESC_CRC32(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 14, 1)
+ le32_get_bits(*((__le32 *)__pdesc), BIT(14))
#define GET_RX_DESC_ICV(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 15, 1)
+ le32_get_bits(*((__le32 *)__pdesc), BIT(15))
#define GET_RX_DESC_DRV_INFO_SIZE(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 16, 4)
+ le32_get_bits(*((__le32 *)__pdesc), GENMASK(19, 16))
#define GET_RX_DESC_SECURITY(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 20, 3)
+ le32_get_bits(*((__le32 *)__pdesc), GENMASK(22, 20))
#define GET_RX_DESC_QOS(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 23, 1)
+ le32_get_bits(*((__le32 *)__pdesc), BIT(23))
#define GET_RX_DESC_SHIFT(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 24, 2)
+ le32_get_bits(*((__le32 *)__pdesc), GENMASK(25, 24))
#define GET_RX_DESC_PHYST(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 26, 1)
+ le32_get_bits(*((__le32 *)__pdesc), BIT(26))
#define GET_RX_DESC_SWDEC(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 27, 1)
+ le32_get_bits(*((__le32 *)__pdesc), BIT(27))
#define GET_RX_DESC_LS(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 28, 1)
+ le32_get_bits(*((__le32 *)__pdesc), BIT(28))
#define GET_RX_DESC_FS(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 29, 1)
+ le32_get_bits(*((__le32 *)__pdesc), BIT(29))
#define GET_RX_DESC_EOR(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 30, 1)
+ le32_get_bits(*((__le32 *)__pdesc), BIT(30))
#define GET_RX_DESC_OWN(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc, 31, 1)
+ le32_get_bits(*((__le32 *)__pdesc), BIT(31))
#define SET_RX_DESC_PKT_LEN(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc, 0, 14, __val)
+ le32p_replace_bits((__le32 *)__pdesc, __val, GENMASK(13, 0))
#define SET_RX_DESC_EOR(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc, 30, 1, __val)
+ le32p_replace_bits((__le32 *)__pdesc, __val, BIT(30))
#define SET_RX_DESC_OWN(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc, 31, 1, __val)
+ le32p_replace_bits((__le32 *)__pdesc, __val, BIT(31))
#define GET_RX_DESC_MACID(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 0, 6)
+ le32_get_bits(*((__le32 *)(__pdesc + 4)), GENMASK(5, 0))
#define GET_RX_DESC_PAGGR(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 14, 1)
+ le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(14))
#define GET_RX_DESC_FAGGR(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 15, 1)
+ le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(15))
#define GET_RX_DESC_A1_FIT(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 16, 4)
+ le32_get_bits(*((__le32 *)(__pdesc + 4)), GENMASK(19, 16))
#define GET_RX_DESC_A2_FIT(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 20, 4)
+ le32_get_bits(*((__le32 *)(__pdesc + 4)), GENMASK(23, 20))
#define GET_RX_DESC_PAM(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 24, 1)
+ le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(24))
#define GET_RX_DESC_PWR(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 25, 1)
+ le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(25))
#define GET_RX_DESC_MD(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 26, 1)
+ le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(26))
#define GET_RX_DESC_MF(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 27, 1)
+ le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(27))
#define GET_RX_DESC_TYPE(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 28, 2)
+ le32_get_bits(*((__le32 *)(__pdesc + 4)), GENMASK(29, 28))
#define GET_RX_DESC_MC(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 30, 1)
+ le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(30))
#define GET_RX_DESC_BC(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+4, 31, 1)
+ le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(31))
#define GET_RX_DESC_SEQ(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+8, 0, 12)
+ le32_get_bits(*((__le32 *)(__pdesc + 8)), GENMASK(11, 0))
#define GET_RX_DESC_FRAG(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+8, 12, 4)
+ le32_get_bits(*((__le32 *)(__pdesc + 8)), GENMASK(15, 12))
#define GET_RX_DESC_RXMCS(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+12, 0, 6)
+ le32_get_bits(*((__le32 *)(__pdesc + 12)), GENMASK(5, 0))
#define GET_RX_DESC_RXHT(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+12, 6, 1)
+ le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(6))
#define GET_RX_STATUS_DESC_RX_GF(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+12, 7, 1)
+ le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(7))
#define GET_RX_DESC_SPLCP(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+12, 8, 1)
+ le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(8))
#define GET_RX_DESC_BW(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+12, 9, 1)
+ le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(9))
#define GET_RX_DESC_HTC(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+12, 10, 1)
+ le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(10))
#define GET_RX_STATUS_DESC_EOSP(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+12, 11, 1)
+ le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(11))
#define GET_RX_STATUS_DESC_BSSID_FIT(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+12, 12, 2)
+ le32_get_bits(*((__le32 *)(__pdesc + 12)), GENMASK(13, 12))
#define GET_RX_STATUS_DESC_RPT_SEL(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+12, 14, 2)
+ le32_get_bits(*((__le32 *)(__pdesc + 12)), GENMASK(15, 14))
#define GET_RX_STATUS_DESC_PATTERN_MATCH(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+12, 29, 1)
+ le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(29))
#define GET_RX_STATUS_DESC_UNICAST_MATCH(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+12, 30, 1)
+ le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(30))
#define GET_RX_STATUS_DESC_MAGIC_MATCH(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+12, 31, 1)
+ le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(31))
#define GET_RX_DESC_IV1(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+16, 0, 32)
+ le32_to_cpu(*((__le32 *)(__pdesc + 16)))
#define GET_RX_DESC_TSFL(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+20, 0, 32)
+ le32_to_cpu(*((__le32 *)(__pdesc + 20)))
#define GET_RX_DESC_BUFF_ADDR(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+24, 0, 32)
+ le32_to_cpu(*((__le32 *)(__pdesc + 24)))
#define GET_RX_DESC_BUFF_ADDR64(__pdesc) \
- LE_BITS_TO_4BYTE(__pdesc+28, 0, 32)
+ le32_to_cpu(*((__le32 *)(__pdesc + 28)))
#define SET_RX_DESC_BUFF_ADDR(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+24, 0, 32, __val)
+ *(__le32 *)(__pdesc + 24) = cpu_to_le32(__val)
#define SET_RX_DESC_BUFF_ADDR64(__pdesc, __val) \
- SET_BITS_TO_LE_4BYTE(__pdesc+28, 0, 32, __val)
+ *(__le32 *)(__pdesc + 28) = cpu_to_le32(__val)
/* TX report 2 format in Rx desc*/
#define GET_RX_RPT2_DESC_PKT_LEN(__status) \
- LE_BITS_TO_4BYTE(__status, 0, 9)
+ le32_get_bits(*((__le32 *)__status), GENMASK(8, 0))
#define GET_RX_RPT2_DESC_MACID_VALID_1(__status) \
- LE_BITS_TO_4BYTE(__status+16, 0, 32)
+ le32_to_cpu(*((__le32 *)(__status + 16)))
#define GET_RX_RPT2_DESC_MACID_VALID_2(__status) \
- LE_BITS_TO_4BYTE(__status+20, 0, 32)
+ le32_to_cpu(*((__le32 *)(__status + 20)))
#define SET_EARLYMODE_PKTNUM(__paddr, __value) \
- SET_BITS_TO_LE_4BYTE(__paddr, 0, 4, __value)
+ le32p_replace_bits((__le32 *)__paddr, __value, GENMASK(3, 0))
#define SET_EARLYMODE_LEN0(__paddr, __value) \
- SET_BITS_TO_LE_4BYTE(__paddr, 4, 12, __value)
+ le32p_replace_bits((__le32 *)__paddr, __value, GENMASK(15, 4))
#define SET_EARLYMODE_LEN1(__paddr, __value) \
- SET_BITS_TO_LE_4BYTE(__paddr, 16, 12, __value)
+ le32p_replace_bits((__le32 *)__paddr, __value, GENMASK(27, 16))
#define SET_EARLYMODE_LEN2_1(__paddr, __value) \
- SET_BITS_TO_LE_4BYTE(__paddr, 28, 4, __value)
+ le32p_replace_bits((__le32 *)__paddr, __value, GENMASK(31, 28))
#define SET_EARLYMODE_LEN2_2(__paddr, __value) \
- SET_BITS_TO_LE_4BYTE(__paddr+4, 0, 8, __value)
+ le32p_replace_bits((__le32 *)(__paddr + 4), __value, GENMASK(7, 0))
#define SET_EARLYMODE_LEN3(__paddr, __value) \
- SET_BITS_TO_LE_4BYTE(__paddr+4, 8, 12, __value)
+ le32p_replace_bits((__le32 *)(__paddr + 4), __value, GENMASK(19, 8))
#define SET_EARLYMODE_LEN4(__paddr, __value) \
- SET_BITS_TO_LE_4BYTE(__paddr+4, 20, 12, __value)
+ le32p_replace_bits((__le32 *)(__paddr + 4), __value, GENMASK(31, 20))
#define CLEAR_PCI_TX_DESC_CONTENT(__pdesc, _size) \
do { \
--
2.22.0
^ permalink raw reply related
* [PATCH 5/5] rtlwifi: rtl8188ee: Remove local configuration variable
From: Larry Finger @ 2019-07-31 0:33 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless, pkshih, Larry Finger
In-Reply-To: <20190731003304.14377-1-Larry.Finger@lwfinger.net>
The configuration variable IS_LITTLE_ENDIAN is replaced by the standard
__LITTLE_ENDIAN. In addition, an unused struct is removed.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
.../net/wireless/realtek/rtlwifi/rtl8188ee/trx.h | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
index 4e3682ded89e..bd862732d6ae 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
@@ -560,17 +560,7 @@ static inline void clear_pci_tx_desc_content(__le32 *__pdesc, int _size)
rxmcs == DESC92C_RATE5_5M ||\
rxmcs == DESC92C_RATE11M)
-#define IS_LITTLE_ENDIAN 1
-
-struct phy_rx_agc_info_t {
- #if IS_LITTLE_ENDIAN
- u8 gain:7, trsw:1;
- #else
- u8 trsw:1, gain:7;
- #endif
-};
struct phy_status_rpt {
- struct phy_rx_agc_info_t path_agc[2];
u8 ch_corr[2];
u8 cck_sig_qual_ofdm_pwdb_all;
u8 cck_agc_rpt_ofdm_cfosho_a;
@@ -587,7 +577,7 @@ struct phy_status_rpt {
u8 stream_target_csi[2];
u8 sig_evm;
u8 rsvd_3;
-#if IS_LITTLE_ENDIAN
+#if defined(__LITTLE_ENDIAN)
u8 antsel_rx_keep_2:1; /*ex_intf_flg:1;*/
u8 sgi_en:1;
u8 rxsc:2;
@@ -595,7 +585,7 @@ struct phy_status_rpt {
u8 r_ant_train_en:1;
u8 ant_sel_b:1;
u8 ant_sel:1;
-#else /* _BIG_ENDIAN_ */
+#else /* __BIG_ENDIAN */
u8 ant_sel:1;
u8 ant_sel_b:1;
u8 r_ant_train_en:1;
--
2.22.0
^ permalink raw reply related
* [PATCH 4/5] rtlwifi: rtl8188ee: Convert inline routines to little-endian words
From: Larry Finger @ 2019-07-31 0:33 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless, pkshih, Larry Finger
In-Reply-To: <20190731003304.14377-1-Larry.Finger@lwfinger.net>
In this step, the read/write routines for the descriptors are converted
to use __le32 quantities, thus a lot of casts can be removed. Callback
routines still use the 8-bit arrays, but these are changed within the
specified routine.
The macro that cleared a descriptor has now been converted into an inline
routine.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
.../wireless/realtek/rtlwifi/rtl8188ee/dm.c | 7 +-
.../wireless/realtek/rtlwifi/rtl8188ee/trx.c | 35 +-
.../wireless/realtek/rtlwifi/rtl8188ee/trx.h | 438 +++++++++---------
3 files changed, 243 insertions(+), 237 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c
index 1ba339788d3a..333e355c9281 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c
@@ -1411,12 +1411,13 @@ void rtl88e_dm_set_tx_ant_by_tx_info(struct ieee80211_hw *hw,
struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw));
struct fast_ant_training *pfat_table = &rtldm->fat_table;
+ __le32 *pdesc32 = (__le32 *)pdesc;
if ((rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV) ||
(rtlefuse->antenna_div_type == CG_TRX_SMART_ANTDIV)) {
- set_tx_desc_antsel_a(pdesc, pfat_table->antsel_a[mac_id]);
- set_tx_desc_antsel_b(pdesc, pfat_table->antsel_b[mac_id]);
- set_tx_desc_antsel_c(pdesc, pfat_table->antsel_c[mac_id]);
+ set_tx_desc_antsel_a(pdesc32, pfat_table->antsel_a[mac_id]);
+ set_tx_desc_antsel_b(pdesc32, pfat_table->antsel_b[mac_id]);
+ set_tx_desc_antsel_c(pdesc32, pfat_table->antsel_c[mac_id]);
}
}
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c
index d5be69e72838..aa2e9e88be53 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c
@@ -25,7 +25,7 @@ static u8 _rtl88ee_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue)
}
static void _rtl88ee_query_rxphystatus(struct ieee80211_hw *hw,
- struct rtl_stats *pstatus, u8 *pdesc,
+ struct rtl_stats *pstatus, __le32 *pdesc,
struct rx_fwinfo_88e *p_drvinfo,
bool bpacket_match_bssid,
bool bpacket_toself, bool packet_beacon)
@@ -271,7 +271,7 @@ static void _rtl88ee_smart_antenna(struct ieee80211_hw *hw,
static void _rtl88ee_translate_rx_signal_stuff(struct ieee80211_hw *hw,
struct sk_buff *skb,
struct rtl_stats *pstatus,
- u8 *pdesc,
+ __le32 *pdesc,
struct rx_fwinfo_88e *p_drvinfo)
{
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
@@ -313,8 +313,8 @@ static void _rtl88ee_translate_rx_signal_stuff(struct ieee80211_hw *hw,
rtl_process_phyinfo(hw, tmp_buf, pstatus);
}
-static void _rtl88ee_insert_emcontent(struct rtl_tcb_desc *ptcb_desc,
- u8 *virtualaddress)
+static void rtl88ee_insert_emcontent(struct rtl_tcb_desc *ptcb_desc,
+ __le32 *virtualaddress)
{
u32 dwtmp = 0;
memset(virtualaddress, 0, 8);
@@ -367,12 +367,13 @@ static void _rtl88ee_insert_emcontent(struct rtl_tcb_desc *ptcb_desc,
bool rtl88ee_rx_query_desc(struct ieee80211_hw *hw,
struct rtl_stats *status,
struct ieee80211_rx_status *rx_status,
- u8 *pdesc, struct sk_buff *skb)
+ u8 *pdesc8, struct sk_buff *skb)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rx_fwinfo_88e *p_drvinfo;
struct ieee80211_hdr *hdr;
u8 wake_match;
+ __le32 *pdesc = (__le32 *)pdesc8;
u32 phystatus = get_rx_desc_physt(pdesc);
status->packet_report_type = (u8)get_rx_status_desc_rpt_sel(pdesc);
@@ -473,7 +474,7 @@ bool rtl88ee_rx_query_desc(struct ieee80211_hw *hw,
}
void rtl88ee_tx_fill_desc(struct ieee80211_hw *hw,
- struct ieee80211_hdr *hdr, u8 *pdesc_tx,
+ struct ieee80211_hdr *hdr, u8 *pdesc8,
u8 *txbd, struct ieee80211_tx_info *info,
struct ieee80211_sta *sta,
struct sk_buff *skb,
@@ -484,7 +485,6 @@ void rtl88ee_tx_fill_desc(struct ieee80211_hw *hw,
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
- u8 *pdesc = (u8 *)pdesc_tx;
u16 seq_number;
__le16 fc = hdr->frame_control;
unsigned int buf_len = 0;
@@ -497,6 +497,7 @@ void rtl88ee_tx_fill_desc(struct ieee80211_hw *hw,
dma_addr_t mapping;
u8 bw_40 = 0;
u8 short_gi = 0;
+ __le32 *pdesc = (u32 *)pdesc8;
if (mac->opmode == NL80211_IFTYPE_STATION) {
bw_40 = mac->bw_40;
@@ -521,7 +522,7 @@ void rtl88ee_tx_fill_desc(struct ieee80211_hw *hw,
"DMA mapping error\n");
return;
}
- CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_88e));
+ clear_pci_tx_desc_content(pdesc, sizeof(struct tx_desc_88e));
if (ieee80211_is_nullfunc(fc) || ieee80211_is_ctl(fc)) {
firstseg = true;
lastseg = true;
@@ -535,8 +536,8 @@ void rtl88ee_tx_fill_desc(struct ieee80211_hw *hw,
RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
"Insert 8 byte.pTcb->EMPktNum:%d\n",
ptcb_desc->empkt_num);
- _rtl88ee_insert_emcontent(ptcb_desc,
- (u8 *)(skb->data));
+ rtl88ee_insert_emcontent(ptcb_desc,
+ (__le32 *)(skb->data));
}
} else {
set_tx_desc_offset(pdesc, USB_HWDESC_HEADER_LEN);
@@ -660,17 +661,18 @@ void rtl88ee_tx_fill_desc(struct ieee80211_hw *hw,
set_tx_desc_bmc(pdesc, 1);
}
- rtl88e_dm_set_tx_ant_by_tx_info(hw, pdesc, ptcb_desc->mac_id);
+ rtl88e_dm_set_tx_ant_by_tx_info(hw, pdesc8, ptcb_desc->mac_id);
RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "\n");
}
void rtl88ee_tx_fill_cmddesc(struct ieee80211_hw *hw,
- u8 *pdesc, bool firstseg,
+ u8 *pdesc8, bool firstseg,
bool lastseg, struct sk_buff *skb)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
u8 fw_queue = QSLT_BEACON;
+ __le32 *pdesc = (__le32 *)pdesc8;
dma_addr_t mapping = pci_map_single(rtlpci->pdev,
skb->data, skb->len,
@@ -684,7 +686,7 @@ void rtl88ee_tx_fill_cmddesc(struct ieee80211_hw *hw,
"DMA mapping error\n");
return;
}
- CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE);
+ clear_pci_tx_desc_content(pdesc, TX_DESC_SIZE);
if (firstseg)
set_tx_desc_offset(pdesc, USB_HWDESC_HEADER_LEN);
@@ -726,9 +728,11 @@ void rtl88ee_tx_fill_cmddesc(struct ieee80211_hw *hw,
pdesc, TX_DESC_SIZE);
}
-void rtl88ee_set_desc(struct ieee80211_hw *hw, u8 *pdesc,
+void rtl88ee_set_desc(struct ieee80211_hw *hw, u8 *pdesc8,
bool istx, u8 desc_name, u8 *val)
{
+ __le32 *pdesc = (__le32 *)pdesc8;
+
if (istx == true) {
switch (desc_name) {
case HW_DESC_OWN:
@@ -765,9 +769,10 @@ void rtl88ee_set_desc(struct ieee80211_hw *hw, u8 *pdesc,
}
u64 rtl88ee_get_desc(struct ieee80211_hw *hw,
- u8 *pdesc, bool istx, u8 desc_name)
+ u8 *pdesc8, bool istx, u8 desc_name)
{
u32 ret = 0;
+ __le32 *pdesc = (__le32 *)pdesc8;
if (istx == true) {
switch (desc_name) {
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
index 6b054361ed5d..4e3682ded89e 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
@@ -14,545 +14,545 @@
#define USB_HWDESC_HEADER_LEN 32
#define CRCLENGTH 4
-static inline void set_tx_desc_pkt_size(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_pkt_size(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)__pdesc, __val, GENMASK(15, 0));
+ le32p_replace_bits(__pdesc, __val, GENMASK(15, 0));
}
-static inline void set_tx_desc_offset(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_offset(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)__pdesc, __val, GENMASK(23, 16));
+ le32p_replace_bits(__pdesc, __val, GENMASK(23, 16));
}
-static inline void set_tx_desc_bmc(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_bmc(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)__pdesc, __val, BIT(24));
+ le32p_replace_bits(__pdesc, __val, BIT(24));
}
-static inline void set_tx_desc_htc(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_htc(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)__pdesc, __val, BIT(25));
+ le32p_replace_bits(__pdesc, __val, BIT(25));
}
-static inline void set_tx_desc_last_seg(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_last_seg(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)__pdesc, __val, BIT(26));
+ le32p_replace_bits(__pdesc, __val, BIT(26));
}
-static inline void set_tx_desc_first_seg(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_first_seg(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)__pdesc, __val, BIT(27));
+ le32p_replace_bits(__pdesc, __val, BIT(27));
}
-static inline void set_tx_desc_linip(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_linip(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)__pdesc, __val, BIT(28));
+ le32p_replace_bits(__pdesc, __val, BIT(28));
}
-static inline void set_tx_desc_own(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_own(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)__pdesc, __val, BIT(31));
+ le32p_replace_bits(__pdesc, __val, BIT(31));
}
-static inline int get_tx_desc_own(u8 *__pdesc)
+static inline int get_tx_desc_own(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)__pdesc), BIT(31));
+ return le32_get_bits(*(__pdesc), BIT(31));
}
-static inline void set_tx_desc_macid(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_macid(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 4), __val, GENMASK(5, 0));
+ le32p_replace_bits(__pdesc + 1, __val, GENMASK(5, 0));
}
-static inline void set_tx_desc_queue_sel(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_queue_sel(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 4), __val, GENMASK(12, 8));
+ le32p_replace_bits(__pdesc + 1, __val, GENMASK(12, 8));
}
-static inline void set_tx_desc_rate_id(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_rate_id(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 4), __val, GENMASK(19, 16));
+ le32p_replace_bits(__pdesc + 1, __val, GENMASK(19, 16));
}
-static inline void set_tx_desc_nav_use_hdr(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_nav_use_hdr(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 4), __val, BIT(20));
+ le32p_replace_bits(__pdesc + 1, __val, BIT(20));
}
-static inline void set_tx_desc_sec_type(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_sec_type(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 4), __val, GENMASK(23, 22));
+ le32p_replace_bits(__pdesc + 1, __val, GENMASK(23, 22));
}
-static inline void set_tx_desc_pkt_offset(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_pkt_offset(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 4), __val, GENMASK(30, 26));
+ le32p_replace_bits(__pdesc + 1, __val, GENMASK(30, 26));
}
-static inline void set_tx_desc_agg_enable(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_agg_enable(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(12));
+ le32p_replace_bits(__pdesc + 2, __val, BIT(12));
}
-static inline void set_tx_desc_rdg_enable(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_rdg_enable(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(13));
+ le32p_replace_bits(__pdesc + 2, __val, BIT(13));
}
-static inline void set_tx_desc_more_frag(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_more_frag(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(17));
+ le32p_replace_bits(__pdesc + 2, __val, BIT(17));
}
-static inline void set_tx_desc_ampdu_density(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_ampdu_density(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 8), __val, GENMASK(22, 20));
+ le32p_replace_bits(__pdesc + 2, __val, GENMASK(22, 20));
}
-static inline void set_tx_desc_antsel_a(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_antsel_a(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(24));
+ le32p_replace_bits(__pdesc + 2, __val, BIT(24));
}
-static inline void set_tx_desc_antsel_b(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_antsel_b(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(25));
+ le32p_replace_bits(__pdesc + 2, __val, BIT(25));
}
-static inline void set_tx_desc_seq(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_seq(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 12), __val, GENMASK(27, 16));
+ le32p_replace_bits(__pdesc + 3, __val, GENMASK(27, 16));
}
-static inline void set_tx_desc_hwseq_en(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_hwseq_en(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 12), __val, BIT(31));
+ le32p_replace_bits(__pdesc + 3, __val, BIT(31));
}
-static inline void set_tx_desc_rts_rate(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_rts_rate(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, GENMASK(4, 0));
+ le32p_replace_bits(__pdesc + 4, __val, GENMASK(4, 0));
}
-static inline void set_tx_desc_qos(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_qos(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(6));
+ le32p_replace_bits(__pdesc + 4, __val, BIT(6));
}
-static inline void set_tx_desc_use_rate(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_use_rate(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(8));
+ le32p_replace_bits(__pdesc + 4, __val, BIT(8));
}
-static inline void set_tx_desc_disable_fb(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_disable_fb(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(10));
+ le32p_replace_bits(__pdesc + 4, __val, BIT(10));
}
-static inline void set_tx_desc_cts2self(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_cts2self(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(11));
+ le32p_replace_bits(__pdesc + 4, __val, BIT(11));
}
-static inline void set_tx_desc_rts_enable(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_rts_enable(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(12));
+ le32p_replace_bits(__pdesc + 4, __val, BIT(12));
}
-static inline void set_tx_desc_hw_rts_enable(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_hw_rts_enable(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(13));
+ le32p_replace_bits(__pdesc + 4, __val, BIT(13));
}
-static inline void set_tx_desc_tx_sub_carrier(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_tx_sub_carrier(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, GENMASK(21, 20));
+ le32p_replace_bits(__pdesc + 4, __val, GENMASK(21, 20));
}
-static inline void set_tx_desc_tx_stbc(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_tx_stbc(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, GENMASK(23, 22));
+ le32p_replace_bits(__pdesc + 4, __val, GENMASK(23, 22));
}
-static inline void set_tx_desc_data_bw(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_data_bw(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(25));
+ le32p_replace_bits(__pdesc + 4, __val, BIT(25));
}
-static inline void set_tx_desc_rts_short(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_rts_short(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(26));
+ le32p_replace_bits(__pdesc + 4, __val, BIT(26));
}
-static inline void set_tx_desc_rts_bw(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_rts_bw(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(27));
+ le32p_replace_bits(__pdesc + 4, __val, BIT(27));
}
-static inline void set_tx_desc_rts_sc(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_rts_sc(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, GENMASK(29, 28));
+ le32p_replace_bits(__pdesc + 4, __val, GENMASK(29, 28));
}
-static inline void set_tx_desc_rts_stbc(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_rts_stbc(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, GENMASK(31, 30));
+ le32p_replace_bits(__pdesc + 4, __val, GENMASK(31, 30));
}
-static inline void set_tx_desc_tx_rate(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_tx_rate(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 20), __val, GENMASK(5, 0));
+ le32p_replace_bits(__pdesc + 5, __val, GENMASK(5, 0));
}
-static inline void set_tx_desc_data_shortgi(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_data_shortgi(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 20), __val, BIT(6));
+ le32p_replace_bits(__pdesc + 5, __val, BIT(6));
}
-static inline void set_tx_desc_data_rate_fb_limit(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_data_rate_fb_limit(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 20), __val, GENMASK(12, 8));
+ le32p_replace_bits(__pdesc + 5, __val, GENMASK(12, 8));
}
-static inline void set_tx_desc_rts_rate_fb_limit(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_rts_rate_fb_limit(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 20), __val, GENMASK(16, 13));
+ le32p_replace_bits(__pdesc + 5, __val, GENMASK(16, 13));
}
-static inline void set_tx_desc_max_agg_num(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_max_agg_num(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 24), __val, GENMASK(15, 11));
+ le32p_replace_bits(__pdesc + 6, __val, GENMASK(15, 11));
}
-static inline void set_tx_desc_antsel_c(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_antsel_c(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 28), __val, BIT(29));
+ le32p_replace_bits(__pdesc + 7, __val, BIT(29));
}
-static inline void set_tx_desc_tx_buffer_size(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_tx_buffer_size(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)(__pdesc + 28), __val, GENMASK(15, 0));
+ le32p_replace_bits(__pdesc + 7, __val, GENMASK(15, 0));
}
-static inline int get_tx_desc_tx_buffer_size(u8 *__pdesc)
+static inline int get_tx_desc_tx_buffer_size(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 28)), GENMASK(15, 0));
+ return le32_get_bits(*(__pdesc + 7), GENMASK(15, 0));
}
-static inline void set_tx_desc_tx_buffer_address(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_tx_buffer_address(__le32 *__pdesc, u32 __val)
{
- *(__le32 *)(__pdesc + 32) = cpu_to_le32(__val);
+ *(__pdesc + 8) = cpu_to_le32(__val);
}
-static inline int get_tx_desc_tx_buffer_address(u8 *__pdesc)
+static inline int get_tx_desc_tx_buffer_address(__le32 *__pdesc)
{
- return le32_to_cpu(*((__le32 *)(__pdesc + 32)));
+ return le32_to_cpu(*(__pdesc + 8));
}
-static inline void set_tx_desc_next_desc_address(u8 *__pdesc, u32 __val)
+static inline void set_tx_desc_next_desc_address(__le32 *__pdesc, u32 __val)
{
- *(__le32 *)(__pdesc + 40) = cpu_to_le32(__val);
+ *(__pdesc + 10) = cpu_to_le32(__val);
}
-static inline int get_rx_desc_pkt_len(u8 *__pdesc)
+static inline int get_rx_desc_pkt_len(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)__pdesc), GENMASK(13, 0));
+ return le32_get_bits(*(__pdesc), GENMASK(13, 0));
}
-static inline int get_rx_desc_crc32(u8 *__pdesc)
+static inline int get_rx_desc_crc32(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)__pdesc), BIT(14));
+ return le32_get_bits(*(__pdesc), BIT(14));
}
-static inline int get_rx_desc_icv(u8 *__pdesc)
+static inline int get_rx_desc_icv(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)__pdesc), BIT(15));
+ return le32_get_bits(*(__pdesc), BIT(15));
}
-static inline int get_rx_desc_drv_info_size(u8 *__pdesc)
+static inline int get_rx_desc_drv_info_size(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)__pdesc), GENMASK(19, 16));
+ return le32_get_bits(*(__pdesc), GENMASK(19, 16));
}
-static inline int get_rx_desc_security(u8 *__pdesc)
+static inline int get_rx_desc_security(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)__pdesc), GENMASK(22, 20));
+ return le32_get_bits(*(__pdesc), GENMASK(22, 20));
}
-static inline int get_rx_desc_qos(u8 *__pdesc)
+static inline int get_rx_desc_qos(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)__pdesc), BIT(23));
+ return le32_get_bits(*(__pdesc), BIT(23));
}
-static inline int get_rx_desc_shift(u8 *__pdesc)
+static inline int get_rx_desc_shift(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)__pdesc), GENMASK(25, 24));
+ return le32_get_bits(*(__pdesc), GENMASK(25, 24));
}
-static inline int get_rx_desc_physt(u8 *__pdesc)
+static inline int get_rx_desc_physt(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)__pdesc), BIT(26));
+ return le32_get_bits(*(__pdesc), BIT(26));
}
-static inline int get_rx_desc_swdec(u8 *__pdesc)
+static inline int get_rx_desc_swdec(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)__pdesc), BIT(27));
+ return le32_get_bits(*(__pdesc), BIT(27));
}
-static inline int get_rx_desc_ls(u8 *__pdesc)
+static inline int get_rx_desc_ls(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)__pdesc), BIT(28));
+ return le32_get_bits(*(__pdesc), BIT(28));
}
-static inline int get_rx_desc_fs(u8 *__pdesc)
+static inline int get_rx_desc_fs(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)__pdesc), BIT(29));
+ return le32_get_bits(*(__pdesc), BIT(29));
}
-static inline int get_rx_desc_eor(u8 *__pdesc)
+static inline int get_rx_desc_eor(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)__pdesc), BIT(30));
+ return le32_get_bits(*(__pdesc), BIT(30));
}
-static inline int get_rx_desc_own(u8 *__pdesc)
+static inline int get_rx_desc_own(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)__pdesc), BIT(31));
+ return le32_get_bits(*(__pdesc), BIT(31));
}
-static inline void set_rx_desc_pkt_len(u8 *__pdesc, u32 __val)
+static inline void set_rx_desc_pkt_len(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)__pdesc, __val, GENMASK(13, 0));
+ le32p_replace_bits(__pdesc, __val, GENMASK(13, 0));
}
-static inline void set_rx_desc_eor(u8 *__pdesc, u32 __val)
+static inline void set_rx_desc_eor(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)__pdesc, __val, BIT(30));
+ le32p_replace_bits(__pdesc, __val, BIT(30));
}
-static inline void set_rx_desc_own(u8 *__pdesc, u32 __val)
+static inline void set_rx_desc_own(__le32 *__pdesc, u32 __val)
{
- le32p_replace_bits((__le32 *)__pdesc, __val, BIT(31));
+ le32p_replace_bits(__pdesc, __val, BIT(31));
}
-static inline int get_rx_desc_macid(u8 *__pdesc)
+static inline int get_rx_desc_macid(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 4)), GENMASK(5, 0));
+ return le32_get_bits(*(__pdesc + 1), GENMASK(5, 0));
}
-static inline int get_rx_desc_paggr(u8 *__pdesc)
+static inline int get_rx_desc_paggr(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(14));
+ return le32_get_bits(*(__pdesc + 1), BIT(14));
}
-static inline int get_rx_desc_faggr(u8 *__pdesc)
+static inline int get_rx_desc_faggr(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(15));
+ return le32_get_bits(*(__pdesc + 1), BIT(15));
}
-static inline int get_rx_desc_a1_fit(u8 *__pdesc)
+static inline int get_rx_desc_a1_fit(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 4)), GENMASK(19, 16));
+ return le32_get_bits(*(__pdesc + 1), GENMASK(19, 16));
}
-static inline int get_rx_desc_a2_fit(u8 *__pdesc)
+static inline int get_rx_desc_a2_fit(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 4)), GENMASK(23, 20));
+ return le32_get_bits(*(__pdesc + 1), GENMASK(23, 20));
}
-static inline int get_rx_desc_pam(u8 *__pdesc)
+static inline int get_rx_desc_pam(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(24));
+ return le32_get_bits(*(__pdesc + 1), BIT(24));
}
-static inline int get_rx_desc_pwr(u8 *__pdesc)
+static inline int get_rx_desc_pwr(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(25));
+ return le32_get_bits(*(__pdesc + 1), BIT(25));
}
-static inline int get_rx_desc_md(u8 *__pdesc)
+static inline int get_rx_desc_md(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(26));
+ return le32_get_bits(*(__pdesc + 1), BIT(26));
}
-static inline int get_rx_desc_mf(u8 *__pdesc)
+static inline int get_rx_desc_mf(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(27));
+ return le32_get_bits(*(__pdesc + 1), BIT(27));
}
-static inline int get_rx_desc_type(u8 *__pdesc)
+static inline int get_rx_desc_type(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 4)), GENMASK(29, 28));
+ return le32_get_bits(*(__pdesc + 1), GENMASK(29, 28));
}
-static inline int get_rx_desc_mc(u8 *__pdesc)
+static inline int get_rx_desc_mc(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(30));
+ return le32_get_bits(*(__pdesc + 1), BIT(30));
}
-static inline int get_rx_desc_bc(u8 *__pdesc)
+static inline int get_rx_desc_bc(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(31));
+ return le32_get_bits(*(__pdesc + 1), BIT(31));
}
-static inline int get_rx_desc_seq(u8 *__pdesc)
+static inline int get_rx_desc_seq(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 8)), GENMASK(11, 0));
+ return le32_get_bits(*(__pdesc + 2), GENMASK(11, 0));
}
-static inline int get_rx_desc_frag(u8 *__pdesc)
+static inline int get_rx_desc_frag(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 8)), GENMASK(15, 12));
+ return le32_get_bits(*(__pdesc + 2), GENMASK(15, 12));
}
-static inline int get_rx_desc_rxmcs(u8 *__pdesc)
+static inline int get_rx_desc_rxmcs(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 12)), GENMASK(5, 0));
+ return le32_get_bits(*(__pdesc + 3), GENMASK(5, 0));
}
-static inline int get_rx_desc_rxht(u8 *__pdesc)
+static inline int get_rx_desc_rxht(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(6));
+ return le32_get_bits(*(__pdesc + 3), BIT(6));
}
-static inline int get_rx_status_desc_rx_gf(u8 *__pdesc)
+static inline int get_rx_status_desc_rx_gf(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(7));
+ return le32_get_bits(*(__pdesc + 3), BIT(7));
}
-static inline int get_rx_desc_splcp(u8 *__pdesc)
+static inline int get_rx_desc_splcp(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(8));
+ return le32_get_bits(*(__pdesc + 3), BIT(8));
}
-static inline int get_rx_desc_bw(u8 *__pdesc)
+static inline int get_rx_desc_bw(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(9));
+ return le32_get_bits(*(__pdesc + 3), BIT(9));
}
-static inline int get_rx_desc_htc(u8 *__pdesc)
+static inline int get_rx_desc_htc(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(10));
+ return le32_get_bits(*(__pdesc + 3), BIT(10));
}
-static inline int get_rx_status_desc_eosp(u8 *__pdesc)
+static inline int get_rx_status_desc_eosp(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(11));
+ return le32_get_bits(*(__pdesc + 3), BIT(11));
}
-static inline int get_rx_status_desc_bssid_fit(u8 *__pdesc)
+static inline int get_rx_status_desc_bssid_fit(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 12)), GENMASK(13, 12));
+ return le32_get_bits(*(__pdesc + 3), GENMASK(13, 12));
}
-static inline int get_rx_status_desc_rpt_sel(u8 *__pdesc)
+static inline int get_rx_status_desc_rpt_sel(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 12)), GENMASK(15, 14));
+ return le32_get_bits(*(__pdesc + 3), GENMASK(15, 14));
}
-static inline int get_rx_status_desc_pattern_match(u8 *__pdesc)
+static inline int get_rx_status_desc_pattern_match(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(29));
+ return le32_get_bits(*(__pdesc + 3), BIT(29));
}
-static inline int get_rx_status_desc_unicast_match(u8 *__pdesc)
+static inline int get_rx_status_desc_unicast_match(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(30));
+ return le32_get_bits(*(__pdesc + 3), BIT(30));
}
-static inline int get_rx_status_desc_magic_match(u8 *__pdesc)
+static inline int get_rx_status_desc_magic_match(__le32 *__pdesc)
{
- return le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(31));
+ return le32_get_bits(*(__pdesc + 3), BIT(31));
}
-static inline int get_rx_desc_iv1(u8 *__pdesc)
+static inline int get_rx_desc_iv1(__le32 *__pdesc)
{
- return le32_to_cpu(*((__le32 *)(__pdesc + 16)));
+ return le32_to_cpu(*(__pdesc + 4));
}
-static inline int get_rx_desc_tsfl(u8 *__pdesc)
+static inline int get_rx_desc_tsfl(__le32 *__pdesc)
{
- return le32_to_cpu(*((__le32 *)(__pdesc + 20)));
+ return le32_to_cpu(*(__pdesc + 5));
}
-static inline int get_rx_desc_buff_addr(u8 *__pdesc)
+static inline int get_rx_desc_buff_addr(__le32 *__pdesc)
{
- return le32_to_cpu(*((__le32 *)(__pdesc + 24)));
+ return le32_to_cpu(*(__pdesc + 6));
}
-static inline int get_rx_desc_buff_addr64(u8 *__pdesc)
+static inline int get_rx_desc_buff_addr64(__le32 *__pdesc)
{
- return le32_to_cpu(*((__le32 *)(__pdesc + 28)));
+ return le32_to_cpu(*(__pdesc + 7));
}
-static inline void set_rx_desc_buff_addr(u8 *__pdesc, u32 __val)
+static inline void set_rx_desc_buff_addr(__le32 *__pdesc, u32 __val)
{
- *(__le32 *)(__pdesc + 24) = cpu_to_le32(__val);
+ *(__pdesc + 6) = cpu_to_le32(__val);
}
-static inline void set_rx_desc_buff_addr64(u8 *__pdesc, u32 __val)
+static inline void set_rx_desc_buff_addr64(__le32 *__pdesc, u32 __val)
{
- *(__le32 *)(__pdesc + 28) = cpu_to_le32(__val);
+ *(__pdesc + 7) = cpu_to_le32(__val);
}
/* TX report 2 format in Rx desc*/
-static inline int get_rx_rpt2_desc_pkt_len(u8 *__status)
+static inline int get_rx_rpt2_desc_pkt_len(__le32 *__status)
{
- return le32_get_bits(*((__le32 *)__status), GENMASK(8, 0));
+ return le32_get_bits(*(__status), GENMASK(8, 0));
}
-static inline int get_rx_rpt2_desc_macid_valid_1(u8 *__status)
+static inline int get_rx_rpt2_desc_macid_valid_1(__le32 *__status)
{
- return le32_to_cpu(*((__le32 *)(__status + 16)));
+ return le32_to_cpu(*(__status + 4));
}
-static inline int get_rx_rpt2_desc_macid_valid_2(u8 *__status)
+static inline int get_rx_rpt2_desc_macid_valid_2(__le32 *__status)
{
- return le32_to_cpu(*((__le32 *)(__status + 20)));
+ return le32_to_cpu(*(__status + 5));
}
-static inline void set_earlymode_pktnum(u8 *__paddr, u32 __value)
+static inline void set_earlymode_pktnum(__le32 *__paddr, u32 __value)
{
- le32p_replace_bits((__le32 *)__paddr, __value, GENMASK(3, 0));
+ le32p_replace_bits(__paddr, __value, GENMASK(3, 0));
}
-static inline void set_earlymode_len0(u8 *__paddr, u32 __value)
+static inline void set_earlymode_len0(__le32 *__paddr, u32 __value)
{
- le32p_replace_bits((__le32 *)__paddr, __value, GENMASK(15, 4));
+ le32p_replace_bits(__paddr, __value, GENMASK(15, 4));
}
-static inline void set_earlymode_len1(u8 *__paddr, u32 __value)
+static inline void set_earlymode_len1(__le32 *__paddr, u32 __value)
{
- le32p_replace_bits((__le32 *)__paddr, __value, GENMASK(27, 16));
+ le32p_replace_bits(__paddr, __value, GENMASK(27, 16));
}
-static inline void set_earlymode_len2_1(u8 *__paddr, u32 __value)
+static inline void set_earlymode_len2_1(__le32 *__paddr, u32 __value)
{
- le32p_replace_bits((__le32 *)__paddr, __value, GENMASK(31, 28));
+ le32p_replace_bits(__paddr, __value, GENMASK(31, 28));
}
-static inline void set_earlymode_len2_2(u8 *__paddr, u32 __value)
+static inline void set_earlymode_len2_2(__le32 *__paddr, u32 __value)
{
- le32p_replace_bits((__le32 *)(__paddr + 4), __value, GENMASK(7, 0));
+ le32p_replace_bits(__paddr + 1, __value, GENMASK(7, 0));
}
-static inline void set_earlymode_len3(u8 *__paddr, u32 __value)
+static inline void set_earlymode_len3(__le32 *__paddr, u32 __value)
{
- le32p_replace_bits((__le32 *)(__paddr + 4), __value, GENMASK(19, 8));
+ le32p_replace_bits(__paddr + 1, __value, GENMASK(19, 8));
}
-static inline void set_earlymode_len4(u8 *__paddr, u32 __value)
+static inline void set_earlymode_len4(__le32 *__paddr, u32 __value)
{
- le32p_replace_bits((__le32 *)(__paddr + 4), __value, GENMASK(31, 20));
+ le32p_replace_bits(__paddr + 1, __value, GENMASK(31, 20));
}
-#define CLEAR_PCI_TX_DESC_CONTENT(__pdesc, _size) \
-do { \
- if (_size > TX_DESC_NEXT_DESC_OFFSET) \
- memset(__pdesc, 0, TX_DESC_NEXT_DESC_OFFSET); \
- else \
- memset(__pdesc, 0, _size); \
-} while (0)
+static inline void clear_pci_tx_desc_content(__le32 *__pdesc, int _size)
+{
+ if (_size > TX_DESC_NEXT_DESC_OFFSET)
+ memset(__pdesc, 0, TX_DESC_NEXT_DESC_OFFSET);
+ else
+ memset(__pdesc, 0, _size);
+}
#define RTL8188_RX_HAL_IS_CCK_RATE(rxmcs)\
(rxmcs == DESC92C_RATE1M ||\
--
2.22.0
^ permalink raw reply related
* [PATCH 3/5] rtlwifi: rtl8188ee: Convert macros that set descriptor
From: Larry Finger @ 2019-07-31 0:33 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless, pkshih, Larry Finger
In-Reply-To: <20190731003304.14377-1-Larry.Finger@lwfinger.net>
As a first step in the conversion, the macros that set the RX and TX
descriptors are converted to static inline routines, and the names are
changed from upper to lower case. To minimize the changes in a given
step, the input descriptor information is left as as a byte array
(u8 *), even though it should be a little-endian word array (__le32 *).
That will be changed in the next patch.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
.../wireless/realtek/rtlwifi/rtl8188ee/dm.c | 6 +-
.../wireless/realtek/rtlwifi/rtl8188ee/trx.c | 222 ++---
.../wireless/realtek/rtlwifi/rtl8188ee/trx.h | 760 ++++++++++++------
3 files changed, 642 insertions(+), 346 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c
index 85360353f557..1ba339788d3a 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c
@@ -1414,9 +1414,9 @@ void rtl88e_dm_set_tx_ant_by_tx_info(struct ieee80211_hw *hw,
if ((rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV) ||
(rtlefuse->antenna_div_type == CG_TRX_SMART_ANTDIV)) {
- SET_TX_DESC_ANTSEL_A(pdesc, pfat_table->antsel_a[mac_id]);
- SET_TX_DESC_ANTSEL_B(pdesc, pfat_table->antsel_b[mac_id]);
- SET_TX_DESC_ANTSEL_C(pdesc, pfat_table->antsel_c[mac_id]);
+ set_tx_desc_antsel_a(pdesc, pfat_table->antsel_a[mac_id]);
+ set_tx_desc_antsel_b(pdesc, pfat_table->antsel_b[mac_id]);
+ set_tx_desc_antsel_c(pdesc, pfat_table->antsel_c[mac_id]);
}
}
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c
index 483dc8bdc555..d5be69e72838 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c
@@ -319,7 +319,7 @@ static void _rtl88ee_insert_emcontent(struct rtl_tcb_desc *ptcb_desc,
u32 dwtmp = 0;
memset(virtualaddress, 0, 8);
- SET_EARLYMODE_PKTNUM(virtualaddress, ptcb_desc->empkt_num);
+ set_earlymode_pktnum(virtualaddress, ptcb_desc->empkt_num);
if (ptcb_desc->empkt_num == 1) {
dwtmp = ptcb_desc->empkt_len[0];
} else {
@@ -327,7 +327,7 @@ static void _rtl88ee_insert_emcontent(struct rtl_tcb_desc *ptcb_desc,
dwtmp += ((dwtmp%4) ? (4-dwtmp%4) : 0)+4;
dwtmp += ptcb_desc->empkt_len[1];
}
- SET_EARLYMODE_LEN0(virtualaddress, dwtmp);
+ set_earlymode_len0(virtualaddress, dwtmp);
if (ptcb_desc->empkt_num <= 3) {
dwtmp = ptcb_desc->empkt_len[2];
@@ -336,7 +336,7 @@ static void _rtl88ee_insert_emcontent(struct rtl_tcb_desc *ptcb_desc,
dwtmp += ((dwtmp%4) ? (4-dwtmp%4) : 0)+4;
dwtmp += ptcb_desc->empkt_len[3];
}
- SET_EARLYMODE_LEN1(virtualaddress, dwtmp);
+ set_earlymode_len1(virtualaddress, dwtmp);
if (ptcb_desc->empkt_num <= 5) {
dwtmp = ptcb_desc->empkt_len[4];
} else {
@@ -344,8 +344,8 @@ static void _rtl88ee_insert_emcontent(struct rtl_tcb_desc *ptcb_desc,
dwtmp += ((dwtmp%4) ? (4-dwtmp%4) : 0)+4;
dwtmp += ptcb_desc->empkt_len[5];
}
- SET_EARLYMODE_LEN2_1(virtualaddress, dwtmp & 0xF);
- SET_EARLYMODE_LEN2_2(virtualaddress, dwtmp >> 4);
+ set_earlymode_len2_1(virtualaddress, dwtmp & 0xF);
+ set_earlymode_len2_2(virtualaddress, dwtmp >> 4);
if (ptcb_desc->empkt_num <= 7) {
dwtmp = ptcb_desc->empkt_len[6];
} else {
@@ -353,7 +353,7 @@ static void _rtl88ee_insert_emcontent(struct rtl_tcb_desc *ptcb_desc,
dwtmp += ((dwtmp%4) ? (4-dwtmp%4) : 0)+4;
dwtmp += ptcb_desc->empkt_len[7];
}
- SET_EARLYMODE_LEN3(virtualaddress, dwtmp);
+ set_earlymode_len3(virtualaddress, dwtmp);
if (ptcb_desc->empkt_num <= 9) {
dwtmp = ptcb_desc->empkt_len[8];
} else {
@@ -361,7 +361,7 @@ static void _rtl88ee_insert_emcontent(struct rtl_tcb_desc *ptcb_desc,
dwtmp += ((dwtmp%4) ? (4-dwtmp%4) : 0)+4;
dwtmp += ptcb_desc->empkt_len[9];
}
- SET_EARLYMODE_LEN4(virtualaddress, dwtmp);
+ set_earlymode_len4(virtualaddress, dwtmp);
}
bool rtl88ee_rx_query_desc(struct ieee80211_hw *hw,
@@ -373,38 +373,38 @@ bool rtl88ee_rx_query_desc(struct ieee80211_hw *hw,
struct rx_fwinfo_88e *p_drvinfo;
struct ieee80211_hdr *hdr;
u8 wake_match;
- u32 phystatus = GET_RX_DESC_PHYST(pdesc);
+ u32 phystatus = get_rx_desc_physt(pdesc);
- status->packet_report_type = (u8)GET_RX_STATUS_DESC_RPT_SEL(pdesc);
+ status->packet_report_type = (u8)get_rx_status_desc_rpt_sel(pdesc);
if (status->packet_report_type == TX_REPORT2)
- status->length = (u16)GET_RX_RPT2_DESC_PKT_LEN(pdesc);
+ status->length = (u16)get_rx_rpt2_desc_pkt_len(pdesc);
else
- status->length = (u16)GET_RX_DESC_PKT_LEN(pdesc);
- status->rx_drvinfo_size = (u8)GET_RX_DESC_DRV_INFO_SIZE(pdesc) *
+ status->length = (u16)get_rx_desc_pkt_len(pdesc);
+ status->rx_drvinfo_size = (u8)get_rx_desc_drv_info_size(pdesc) *
RX_DRV_INFO_SIZE_UNIT;
- status->rx_bufshift = (u8)(GET_RX_DESC_SHIFT(pdesc) & 0x03);
- status->icv = (u16)GET_RX_DESC_ICV(pdesc);
- status->crc = (u16)GET_RX_DESC_CRC32(pdesc);
+ status->rx_bufshift = (u8)(get_rx_desc_shift(pdesc) & 0x03);
+ status->icv = (u16)get_rx_desc_icv(pdesc);
+ status->crc = (u16)get_rx_desc_crc32(pdesc);
status->hwerror = (status->crc | status->icv);
- status->decrypted = !GET_RX_DESC_SWDEC(pdesc);
- status->rate = (u8)GET_RX_DESC_RXMCS(pdesc);
- status->shortpreamble = (u16)GET_RX_DESC_SPLCP(pdesc);
- status->isampdu = (bool) (GET_RX_DESC_PAGGR(pdesc) == 1);
- status->isfirst_ampdu = (bool)((GET_RX_DESC_PAGGR(pdesc) == 1) &&
- (GET_RX_DESC_FAGGR(pdesc) == 1));
+ status->decrypted = !get_rx_desc_swdec(pdesc);
+ status->rate = (u8)get_rx_desc_rxmcs(pdesc);
+ status->shortpreamble = (u16)get_rx_desc_splcp(pdesc);
+ status->isampdu = (bool) (get_rx_desc_paggr(pdesc) == 1);
+ status->isfirst_ampdu = (bool)((get_rx_desc_paggr(pdesc) == 1) &&
+ (get_rx_desc_faggr(pdesc) == 1));
if (status->packet_report_type == NORMAL_RX)
- status->timestamp_low = GET_RX_DESC_TSFL(pdesc);
- status->rx_is40mhzpacket = (bool)GET_RX_DESC_BW(pdesc);
- status->is_ht = (bool)GET_RX_DESC_RXHT(pdesc);
+ status->timestamp_low = get_rx_desc_tsfl(pdesc);
+ status->rx_is40mhzpacket = (bool)get_rx_desc_bw(pdesc);
+ status->is_ht = (bool)get_rx_desc_rxht(pdesc);
status->is_cck = RTL8188_RX_HAL_IS_CCK_RATE(status->rate);
- status->macid = GET_RX_DESC_MACID(pdesc);
- if (GET_RX_STATUS_DESC_PATTERN_MATCH(pdesc))
+ status->macid = get_rx_desc_macid(pdesc);
+ if (get_rx_status_desc_pattern_match(pdesc))
wake_match = BIT(2);
- else if (GET_RX_STATUS_DESC_MAGIC_MATCH(pdesc))
+ else if (get_rx_status_desc_magic_match(pdesc))
wake_match = BIT(1);
- else if (GET_RX_STATUS_DESC_UNICAST_MATCH(pdesc))
+ else if (get_rx_status_desc_unicast_match(pdesc))
wake_match = BIT(0);
else
wake_match = 0;
@@ -465,9 +465,9 @@ bool rtl88ee_rx_query_desc(struct ieee80211_hw *hw,
rx_status->signal = status->recvsignalpower + 10;
if (status->packet_report_type == TX_REPORT2) {
status->macid_valid_entry[0] =
- GET_RX_RPT2_DESC_MACID_VALID_1(pdesc);
+ get_rx_rpt2_desc_macid_valid_1(pdesc);
status->macid_valid_entry[1] =
- GET_RX_RPT2_DESC_MACID_VALID_2(pdesc);
+ get_rx_rpt2_desc_macid_valid_2(pdesc);
}
return true;
}
@@ -528,8 +528,8 @@ void rtl88ee_tx_fill_desc(struct ieee80211_hw *hw,
}
if (firstseg) {
if (rtlhal->earlymode_enable) {
- SET_TX_DESC_PKT_OFFSET(pdesc, 1);
- SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN +
+ set_tx_desc_pkt_offset(pdesc, 1);
+ set_tx_desc_offset(pdesc, USB_HWDESC_HEADER_LEN +
EM_HDR_LEN);
if (ptcb_desc->empkt_num) {
RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
@@ -539,59 +539,59 @@ void rtl88ee_tx_fill_desc(struct ieee80211_hw *hw,
(u8 *)(skb->data));
}
} else {
- SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN);
+ set_tx_desc_offset(pdesc, USB_HWDESC_HEADER_LEN);
}
ptcb_desc->use_driver_rate = true;
- SET_TX_DESC_TX_RATE(pdesc, ptcb_desc->hw_rate);
+ set_tx_desc_tx_rate(pdesc, ptcb_desc->hw_rate);
if (ptcb_desc->hw_rate > DESC92C_RATEMCS0)
short_gi = (ptcb_desc->use_shortgi) ? 1 : 0;
else
short_gi = (ptcb_desc->use_shortpreamble) ? 1 : 0;
- SET_TX_DESC_DATA_SHORTGI(pdesc, short_gi);
+ set_tx_desc_data_shortgi(pdesc, short_gi);
if (info->flags & IEEE80211_TX_CTL_AMPDU) {
- SET_TX_DESC_AGG_ENABLE(pdesc, 1);
- SET_TX_DESC_MAX_AGG_NUM(pdesc, 0x14);
+ set_tx_desc_agg_enable(pdesc, 1);
+ set_tx_desc_max_agg_num(pdesc, 0x14);
}
- SET_TX_DESC_SEQ(pdesc, seq_number);
- SET_TX_DESC_RTS_ENABLE(pdesc, ((ptcb_desc->rts_enable &&
+ set_tx_desc_seq(pdesc, seq_number);
+ set_tx_desc_rts_enable(pdesc, ((ptcb_desc->rts_enable &&
!ptcb_desc->cts_enable) ? 1 : 0));
- SET_TX_DESC_HW_RTS_ENABLE(pdesc, 0);
- SET_TX_DESC_CTS2SELF(pdesc, ((ptcb_desc->cts_enable) ? 1 : 0));
- SET_TX_DESC_RTS_STBC(pdesc, ((ptcb_desc->rts_stbc) ? 1 : 0));
-
- SET_TX_DESC_RTS_RATE(pdesc, ptcb_desc->rts_rate);
- SET_TX_DESC_RTS_BW(pdesc, 0);
- SET_TX_DESC_RTS_SC(pdesc, ptcb_desc->rts_sc);
- SET_TX_DESC_RTS_SHORT(pdesc,
+ set_tx_desc_hw_rts_enable(pdesc, 0);
+ set_tx_desc_cts2self(pdesc, ((ptcb_desc->cts_enable) ? 1 : 0));
+ set_tx_desc_rts_stbc(pdesc, ((ptcb_desc->rts_stbc) ? 1 : 0));
+
+ set_tx_desc_rts_rate(pdesc, ptcb_desc->rts_rate);
+ set_tx_desc_rts_bw(pdesc, 0);
+ set_tx_desc_rts_sc(pdesc, ptcb_desc->rts_sc);
+ set_tx_desc_rts_short(pdesc,
((ptcb_desc->rts_rate <= DESC92C_RATE54M) ?
(ptcb_desc->rts_use_shortpreamble ? 1 : 0) :
(ptcb_desc->rts_use_shortgi ? 1 : 0)));
if (ptcb_desc->tx_enable_sw_calc_duration)
- SET_TX_DESC_NAV_USE_HDR(pdesc, 1);
+ set_tx_desc_nav_use_hdr(pdesc, 1);
if (bw_40) {
if (ptcb_desc->packet_bw == HT_CHANNEL_WIDTH_20_40) {
- SET_TX_DESC_DATA_BW(pdesc, 1);
- SET_TX_DESC_TX_SUB_CARRIER(pdesc, 3);
+ set_tx_desc_data_bw(pdesc, 1);
+ set_tx_desc_tx_sub_carrier(pdesc, 3);
} else {
- SET_TX_DESC_DATA_BW(pdesc, 0);
- SET_TX_DESC_TX_SUB_CARRIER(pdesc,
+ set_tx_desc_data_bw(pdesc, 0);
+ set_tx_desc_tx_sub_carrier(pdesc,
mac->cur_40_prime_sc);
}
} else {
- SET_TX_DESC_DATA_BW(pdesc, 0);
- SET_TX_DESC_TX_SUB_CARRIER(pdesc, 0);
+ set_tx_desc_data_bw(pdesc, 0);
+ set_tx_desc_tx_sub_carrier(pdesc, 0);
}
- SET_TX_DESC_LINIP(pdesc, 0);
- SET_TX_DESC_PKT_SIZE(pdesc, (u16)skb_len);
+ set_tx_desc_linip(pdesc, 0);
+ set_tx_desc_pkt_size(pdesc, (u16)skb_len);
if (sta) {
u8 ampdu_density = sta->ht_cap.ampdu_density;
- SET_TX_DESC_AMPDU_DENSITY(pdesc, ampdu_density);
+ set_tx_desc_ampdu_density(pdesc, ampdu_density);
}
if (info->control.hw_key) {
struct ieee80211_key_conf *keyconf;
@@ -601,63 +601,63 @@ void rtl88ee_tx_fill_desc(struct ieee80211_hw *hw,
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
case WLAN_CIPHER_SUITE_TKIP:
- SET_TX_DESC_SEC_TYPE(pdesc, 0x1);
+ set_tx_desc_sec_type(pdesc, 0x1);
break;
case WLAN_CIPHER_SUITE_CCMP:
- SET_TX_DESC_SEC_TYPE(pdesc, 0x3);
+ set_tx_desc_sec_type(pdesc, 0x3);
break;
default:
- SET_TX_DESC_SEC_TYPE(pdesc, 0x0);
+ set_tx_desc_sec_type(pdesc, 0x0);
break;
}
}
- SET_TX_DESC_QUEUE_SEL(pdesc, fw_qsel);
- SET_TX_DESC_DATA_RATE_FB_LIMIT(pdesc, 0x1F);
- SET_TX_DESC_RTS_RATE_FB_LIMIT(pdesc, 0xF);
- SET_TX_DESC_DISABLE_FB(pdesc, ptcb_desc->disable_ratefallback ?
+ set_tx_desc_queue_sel(pdesc, fw_qsel);
+ set_tx_desc_data_rate_fb_limit(pdesc, 0x1F);
+ set_tx_desc_rts_rate_fb_limit(pdesc, 0xF);
+ set_tx_desc_disable_fb(pdesc, ptcb_desc->disable_ratefallback ?
1 : 0);
- SET_TX_DESC_USE_RATE(pdesc, ptcb_desc->use_driver_rate ? 1 : 0);
+ set_tx_desc_use_rate(pdesc, ptcb_desc->use_driver_rate ? 1 : 0);
- /*SET_TX_DESC_PWR_STATUS(pdesc, pwr_status);*/
+ /*set_tx_desc_pwr_status(pdesc, pwr_status);*/
/* Set TxRate and RTSRate in TxDesc */
/* This prevent Tx initial rate of new-coming packets */
/* from being overwritten by retried packet rate.*/
if (!ptcb_desc->use_driver_rate) {
- /*SET_TX_DESC_RTS_RATE(pdesc, 0x08); */
- /* SET_TX_DESC_TX_RATE(pdesc, 0x0b); */
+ /*set_tx_desc_rts_rate(pdesc, 0x08); */
+ /* set_tx_desc_tx_rate(pdesc, 0x0b); */
}
if (ieee80211_is_data_qos(fc)) {
if (mac->rdg_en) {
RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
"Enable RDG function.\n");
- SET_TX_DESC_RDG_ENABLE(pdesc, 1);
- SET_TX_DESC_HTC(pdesc, 1);
+ set_tx_desc_rdg_enable(pdesc, 1);
+ set_tx_desc_htc(pdesc, 1);
}
}
}
- SET_TX_DESC_FIRST_SEG(pdesc, (firstseg ? 1 : 0));
- SET_TX_DESC_LAST_SEG(pdesc, (lastseg ? 1 : 0));
- SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16)buf_len);
- SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, mapping);
+ set_tx_desc_first_seg(pdesc, (firstseg ? 1 : 0));
+ set_tx_desc_last_seg(pdesc, (lastseg ? 1 : 0));
+ set_tx_desc_tx_buffer_size(pdesc, (u16)buf_len);
+ set_tx_desc_tx_buffer_address(pdesc, mapping);
if (rtlpriv->dm.useramask) {
- SET_TX_DESC_RATE_ID(pdesc, ptcb_desc->ratr_index);
- SET_TX_DESC_MACID(pdesc, ptcb_desc->mac_id);
+ set_tx_desc_rate_id(pdesc, ptcb_desc->ratr_index);
+ set_tx_desc_macid(pdesc, ptcb_desc->mac_id);
} else {
- SET_TX_DESC_RATE_ID(pdesc, 0xC + ptcb_desc->ratr_index);
- SET_TX_DESC_MACID(pdesc, ptcb_desc->ratr_index);
+ set_tx_desc_rate_id(pdesc, 0xC + ptcb_desc->ratr_index);
+ set_tx_desc_macid(pdesc, ptcb_desc->ratr_index);
}
if (ieee80211_is_data_qos(fc))
- SET_TX_DESC_QOS(pdesc, 1);
+ set_tx_desc_qos(pdesc, 1);
if (!ieee80211_is_data_qos(fc))
- SET_TX_DESC_HWSEQ_EN(pdesc, 1);
- SET_TX_DESC_MORE_FRAG(pdesc, (lastseg ? 0 : 1));
+ set_tx_desc_hwseq_en(pdesc, 1);
+ set_tx_desc_more_frag(pdesc, (lastseg ? 0 : 1));
if (is_multicast_ether_addr(ieee80211_get_DA(hdr)) ||
is_broadcast_ether_addr(ieee80211_get_DA(hdr))) {
- SET_TX_DESC_BMC(pdesc, 1);
+ set_tx_desc_bmc(pdesc, 1);
}
rtl88e_dm_set_tx_ant_by_tx_info(hw, pdesc, ptcb_desc->mac_id);
@@ -687,39 +687,39 @@ void rtl88ee_tx_fill_cmddesc(struct ieee80211_hw *hw,
CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE);
if (firstseg)
- SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN);
+ set_tx_desc_offset(pdesc, USB_HWDESC_HEADER_LEN);
- SET_TX_DESC_TX_RATE(pdesc, DESC92C_RATE1M);
+ set_tx_desc_tx_rate(pdesc, DESC92C_RATE1M);
- SET_TX_DESC_SEQ(pdesc, 0);
+ set_tx_desc_seq(pdesc, 0);
- SET_TX_DESC_LINIP(pdesc, 0);
+ set_tx_desc_linip(pdesc, 0);
- SET_TX_DESC_QUEUE_SEL(pdesc, fw_queue);
+ set_tx_desc_queue_sel(pdesc, fw_queue);
- SET_TX_DESC_FIRST_SEG(pdesc, 1);
- SET_TX_DESC_LAST_SEG(pdesc, 1);
+ set_tx_desc_first_seg(pdesc, 1);
+ set_tx_desc_last_seg(pdesc, 1);
- SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16)(skb->len));
+ set_tx_desc_tx_buffer_size(pdesc, (u16)(skb->len));
- SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, mapping);
+ set_tx_desc_tx_buffer_address(pdesc, mapping);
- SET_TX_DESC_RATE_ID(pdesc, 7);
- SET_TX_DESC_MACID(pdesc, 0);
+ set_tx_desc_rate_id(pdesc, 7);
+ set_tx_desc_macid(pdesc, 0);
- SET_TX_DESC_OWN(pdesc, 1);
+ set_tx_desc_own(pdesc, 1);
- SET_TX_DESC_PKT_SIZE(pdesc, (u16)(skb->len));
+ set_tx_desc_pkt_size(pdesc, (u16)(skb->len));
- SET_TX_DESC_FIRST_SEG(pdesc, 1);
- SET_TX_DESC_LAST_SEG(pdesc, 1);
+ set_tx_desc_first_seg(pdesc, 1);
+ set_tx_desc_last_seg(pdesc, 1);
- SET_TX_DESC_OFFSET(pdesc, 0x20);
+ set_tx_desc_offset(pdesc, 0x20);
- SET_TX_DESC_USE_RATE(pdesc, 1);
+ set_tx_desc_use_rate(pdesc, 1);
if (!ieee80211_is_data_qos(fc))
- SET_TX_DESC_HWSEQ_EN(pdesc, 1);
+ set_tx_desc_hwseq_en(pdesc, 1);
RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD,
"H2C Tx Cmd Content\n",
@@ -732,10 +732,10 @@ void rtl88ee_set_desc(struct ieee80211_hw *hw, u8 *pdesc,
if (istx == true) {
switch (desc_name) {
case HW_DESC_OWN:
- SET_TX_DESC_OWN(pdesc, 1);
+ set_tx_desc_own(pdesc, 1);
break;
case HW_DESC_TX_NEXTDESC_ADDR:
- SET_TX_DESC_NEXT_DESC_ADDRESS(pdesc, *(u32 *)val);
+ set_tx_desc_next_desc_address(pdesc, *(u32 *)val);
break;
default:
WARN_ONCE(true, "rtl8188ee: ERR txdesc :%d not processed\n",
@@ -745,16 +745,16 @@ void rtl88ee_set_desc(struct ieee80211_hw *hw, u8 *pdesc,
} else {
switch (desc_name) {
case HW_DESC_RXOWN:
- SET_RX_DESC_OWN(pdesc, 1);
+ set_rx_desc_own(pdesc, 1);
break;
case HW_DESC_RXBUFF_ADDR:
- SET_RX_DESC_BUFF_ADDR(pdesc, *(u32 *)val);
+ set_rx_desc_buff_addr(pdesc, *(u32 *)val);
break;
case HW_DESC_RXPKT_LEN:
- SET_RX_DESC_PKT_LEN(pdesc, *(u32 *)val);
+ set_rx_desc_pkt_len(pdesc, *(u32 *)val);
break;
case HW_DESC_RXERO:
- SET_RX_DESC_EOR(pdesc, 1);
+ set_rx_desc_eor(pdesc, 1);
break;
default:
WARN_ONCE(true, "rtl8188ee: ERR rxdesc :%d not processed\n",
@@ -772,10 +772,10 @@ u64 rtl88ee_get_desc(struct ieee80211_hw *hw,
if (istx == true) {
switch (desc_name) {
case HW_DESC_OWN:
- ret = GET_TX_DESC_OWN(pdesc);
+ ret = get_tx_desc_own(pdesc);
break;
case HW_DESC_TXBUFF_ADDR:
- ret = GET_TX_DESC_TX_BUFFER_ADDRESS(pdesc);
+ ret = get_tx_desc_tx_buffer_address(pdesc);
break;
default:
WARN_ONCE(true, "rtl8188ee: ERR txdesc :%d not processed\n",
@@ -785,13 +785,13 @@ u64 rtl88ee_get_desc(struct ieee80211_hw *hw,
} else {
switch (desc_name) {
case HW_DESC_OWN:
- ret = GET_RX_DESC_OWN(pdesc);
+ ret = get_rx_desc_own(pdesc);
break;
case HW_DESC_RXPKT_LEN:
- ret = GET_RX_DESC_PKT_LEN(pdesc);
+ ret = get_rx_desc_pkt_len(pdesc);
break;
case HW_DESC_RXBUFF_ADDR:
- ret = GET_RX_DESC_BUFF_ADDR(pdesc);
+ ret = get_rx_desc_buff_addr(pdesc);
break;
default:
WARN_ONCE(true, "rtl8188ee: ERR rxdesc :%d not processed\n",
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
index 8147e95a4cc6..6b054361ed5d 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
@@ -14,241 +14,537 @@
#define USB_HWDESC_HEADER_LEN 32
#define CRCLENGTH 4
-#define SET_TX_DESC_PKT_SIZE(__pdesc, __val) \
- le32p_replace_bits((__le32 *)__pdesc, __val, GENMASK(15, 0))
-#define SET_TX_DESC_OFFSET(__pdesc, __val) \
- le32p_replace_bits((__le32 *)__pdesc, __val, GENMASK(23, 16))
-#define SET_TX_DESC_BMC(__pdesc, __val) \
- le32p_replace_bits((__le32 *)__pdesc, __val, BIT(24))
-#define SET_TX_DESC_HTC(__pdesc, __val) \
- le32p_replace_bits((__le32 *)__pdesc, __val, BIT(25))
-#define SET_TX_DESC_LAST_SEG(__pdesc, __val) \
- le32p_replace_bits((__le32 *)__pdesc, __val, BIT(26))
-#define SET_TX_DESC_FIRST_SEG(__pdesc, __val) \
- le32p_replace_bits((__le32 *)__pdesc, __val, BIT(27))
-#define SET_TX_DESC_LINIP(__pdesc, __val) \
- le32p_replace_bits((__le32 *)__pdesc, __val, BIT(28))
-#define SET_TX_DESC_OWN(__pdesc, __val) \
- le32p_replace_bits((__le32 *)__pdesc, __val, BIT(31))
-
-#define GET_TX_DESC_OWN(__pdesc) \
- le32_get_bits(*((__le32 *)__pdesc), BIT(31))
-
-#define SET_TX_DESC_MACID(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 4), __val, GENMASK(5, 0))
-#define SET_TX_DESC_QUEUE_SEL(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 4), __val, GENMASK(12, 8))
-#define SET_TX_DESC_RATE_ID(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 4), __val, GENMASK(19, 16))
-#define SET_TX_DESC_NAV_USE_HDR(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 4), __val, BIT(20))
-#define SET_TX_DESC_SEC_TYPE(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 4), __val, GENMASK(23, 22))
-#define SET_TX_DESC_PKT_OFFSET(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 4), __val, GENMASK(30, 26))
-
-#define SET_TX_DESC_AGG_ENABLE(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(12))
-#define SET_TX_DESC_RDG_ENABLE(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(13))
-#define SET_TX_DESC_MORE_FRAG(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(17))
-#define SET_TX_DESC_AMPDU_DENSITY(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 8), __val, GENMASK(22, 20))
-#define SET_TX_DESC_ANTSEL_A(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(24))
-#define SET_TX_DESC_ANTSEL_B(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(25))
-
-#define SET_TX_DESC_SEQ(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 12), __val, GENMASK(27, 16))
-#define SET_TX_DESC_HWSEQ_EN(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 12), __val, BIT(31))
-
-#define SET_TX_DESC_RTS_RATE(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, GENMASK(4, 0))
-#define SET_TX_DESC_QOS(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(6))
-#define SET_TX_DESC_USE_RATE(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(8))
-#define SET_TX_DESC_DISABLE_FB(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(10))
-#define SET_TX_DESC_CTS2SELF(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(11))
-#define SET_TX_DESC_RTS_ENABLE(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(12))
-#define SET_TX_DESC_HW_RTS_ENABLE(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(13))
-#define SET_TX_DESC_TX_SUB_CARRIER(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, GENMASK(21, 20))
-#define SET_TX_DESC_TX_STBC(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, GENMASK(23, 22))
-#define SET_TX_DESC_DATA_BW(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(25))
-#define SET_TX_DESC_RTS_SHORT(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(26))
-#define SET_TX_DESC_RTS_BW(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(27))
-#define SET_TX_DESC_RTS_SC(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, GENMASK(29, 28))
-#define SET_TX_DESC_RTS_STBC(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 16), __val, GENMASK(31, 30))
-
-#define SET_TX_DESC_TX_RATE(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 20), __val, GENMASK(5, 0))
-#define SET_TX_DESC_DATA_SHORTGI(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 20), __val, BIT(6))
-#define SET_TX_DESC_DATA_RATE_FB_LIMIT(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 20), __val, GENMASK(12, 8))
-#define SET_TX_DESC_RTS_RATE_FB_LIMIT(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 20), __val, GENMASK(16, 13))
-
-#define SET_TX_DESC_MAX_AGG_NUM(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 24), __val, GENMASK(15, 11))
-
-#define SET_TX_DESC_ANTSEL_C(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 28), __val, BIT(29))
-#define SET_TX_DESC_TX_BUFFER_SIZE(__pdesc, __val) \
- le32p_replace_bits((__le32 *)(__pdesc + 28), __val, GENMASK(15, 0))
-#define GET_TX_DESC_TX_BUFFER_SIZE(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 28)), GENMASK(15, 0))
-
-#define SET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc, __val) \
- *(__le32 *)(__pdesc + 32) = cpu_to_le32(__val)
-
-#define GET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc) \
- le32_to_cpu(*((__le32 *)(__pdesc + 32)))
-
-#define SET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc, __val) \
- *(__le32 *)(__pdesc + 40) = cpu_to_le32(__val)
-
-#define GET_RX_DESC_PKT_LEN(__pdesc) \
- le32_get_bits(*((__le32 *)__pdesc), GENMASK(13, 0))
-#define GET_RX_DESC_CRC32(__pdesc) \
- le32_get_bits(*((__le32 *)__pdesc), BIT(14))
-#define GET_RX_DESC_ICV(__pdesc) \
- le32_get_bits(*((__le32 *)__pdesc), BIT(15))
-#define GET_RX_DESC_DRV_INFO_SIZE(__pdesc) \
- le32_get_bits(*((__le32 *)__pdesc), GENMASK(19, 16))
-#define GET_RX_DESC_SECURITY(__pdesc) \
- le32_get_bits(*((__le32 *)__pdesc), GENMASK(22, 20))
-#define GET_RX_DESC_QOS(__pdesc) \
- le32_get_bits(*((__le32 *)__pdesc), BIT(23))
-#define GET_RX_DESC_SHIFT(__pdesc) \
- le32_get_bits(*((__le32 *)__pdesc), GENMASK(25, 24))
-#define GET_RX_DESC_PHYST(__pdesc) \
- le32_get_bits(*((__le32 *)__pdesc), BIT(26))
-#define GET_RX_DESC_SWDEC(__pdesc) \
- le32_get_bits(*((__le32 *)__pdesc), BIT(27))
-#define GET_RX_DESC_LS(__pdesc) \
- le32_get_bits(*((__le32 *)__pdesc), BIT(28))
-#define GET_RX_DESC_FS(__pdesc) \
- le32_get_bits(*((__le32 *)__pdesc), BIT(29))
-#define GET_RX_DESC_EOR(__pdesc) \
- le32_get_bits(*((__le32 *)__pdesc), BIT(30))
-#define GET_RX_DESC_OWN(__pdesc) \
- le32_get_bits(*((__le32 *)__pdesc), BIT(31))
-
-#define SET_RX_DESC_PKT_LEN(__pdesc, __val) \
- le32p_replace_bits((__le32 *)__pdesc, __val, GENMASK(13, 0))
-#define SET_RX_DESC_EOR(__pdesc, __val) \
- le32p_replace_bits((__le32 *)__pdesc, __val, BIT(30))
-#define SET_RX_DESC_OWN(__pdesc, __val) \
- le32p_replace_bits((__le32 *)__pdesc, __val, BIT(31))
-
-#define GET_RX_DESC_MACID(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 4)), GENMASK(5, 0))
-#define GET_RX_DESC_PAGGR(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(14))
-#define GET_RX_DESC_FAGGR(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(15))
-#define GET_RX_DESC_A1_FIT(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 4)), GENMASK(19, 16))
-#define GET_RX_DESC_A2_FIT(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 4)), GENMASK(23, 20))
-#define GET_RX_DESC_PAM(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(24))
-#define GET_RX_DESC_PWR(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(25))
-#define GET_RX_DESC_MD(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(26))
-#define GET_RX_DESC_MF(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(27))
-#define GET_RX_DESC_TYPE(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 4)), GENMASK(29, 28))
-#define GET_RX_DESC_MC(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(30))
-#define GET_RX_DESC_BC(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(31))
-#define GET_RX_DESC_SEQ(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 8)), GENMASK(11, 0))
-#define GET_RX_DESC_FRAG(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 8)), GENMASK(15, 12))
-
-#define GET_RX_DESC_RXMCS(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 12)), GENMASK(5, 0))
-#define GET_RX_DESC_RXHT(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(6))
-#define GET_RX_STATUS_DESC_RX_GF(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(7))
-#define GET_RX_DESC_SPLCP(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(8))
-#define GET_RX_DESC_BW(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(9))
-#define GET_RX_DESC_HTC(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(10))
-#define GET_RX_STATUS_DESC_EOSP(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(11))
-#define GET_RX_STATUS_DESC_BSSID_FIT(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 12)), GENMASK(13, 12))
-#define GET_RX_STATUS_DESC_RPT_SEL(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 12)), GENMASK(15, 14))
-
-#define GET_RX_STATUS_DESC_PATTERN_MATCH(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(29))
-#define GET_RX_STATUS_DESC_UNICAST_MATCH(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(30))
-#define GET_RX_STATUS_DESC_MAGIC_MATCH(__pdesc) \
- le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(31))
-
-#define GET_RX_DESC_IV1(__pdesc) \
- le32_to_cpu(*((__le32 *)(__pdesc + 16)))
-#define GET_RX_DESC_TSFL(__pdesc) \
- le32_to_cpu(*((__le32 *)(__pdesc + 20)))
-
-#define GET_RX_DESC_BUFF_ADDR(__pdesc) \
- le32_to_cpu(*((__le32 *)(__pdesc + 24)))
-#define GET_RX_DESC_BUFF_ADDR64(__pdesc) \
- le32_to_cpu(*((__le32 *)(__pdesc + 28)))
-
-#define SET_RX_DESC_BUFF_ADDR(__pdesc, __val) \
- *(__le32 *)(__pdesc + 24) = cpu_to_le32(__val)
-#define SET_RX_DESC_BUFF_ADDR64(__pdesc, __val) \
- *(__le32 *)(__pdesc + 28) = cpu_to_le32(__val)
+static inline void set_tx_desc_pkt_size(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)__pdesc, __val, GENMASK(15, 0));
+}
+
+static inline void set_tx_desc_offset(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)__pdesc, __val, GENMASK(23, 16));
+}
+
+static inline void set_tx_desc_bmc(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)__pdesc, __val, BIT(24));
+}
+
+static inline void set_tx_desc_htc(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)__pdesc, __val, BIT(25));
+}
+
+static inline void set_tx_desc_last_seg(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)__pdesc, __val, BIT(26));
+}
+
+static inline void set_tx_desc_first_seg(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)__pdesc, __val, BIT(27));
+}
+
+static inline void set_tx_desc_linip(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)__pdesc, __val, BIT(28));
+}
+
+static inline void set_tx_desc_own(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)__pdesc, __val, BIT(31));
+}
+
+static inline int get_tx_desc_own(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)__pdesc), BIT(31));
+}
+
+static inline void set_tx_desc_macid(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 4), __val, GENMASK(5, 0));
+}
+
+static inline void set_tx_desc_queue_sel(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 4), __val, GENMASK(12, 8));
+}
+
+static inline void set_tx_desc_rate_id(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 4), __val, GENMASK(19, 16));
+}
+
+static inline void set_tx_desc_nav_use_hdr(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 4), __val, BIT(20));
+}
+
+static inline void set_tx_desc_sec_type(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 4), __val, GENMASK(23, 22));
+}
+
+static inline void set_tx_desc_pkt_offset(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 4), __val, GENMASK(30, 26));
+}
+
+static inline void set_tx_desc_agg_enable(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(12));
+}
+
+static inline void set_tx_desc_rdg_enable(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(13));
+}
+
+static inline void set_tx_desc_more_frag(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(17));
+}
+
+static inline void set_tx_desc_ampdu_density(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 8), __val, GENMASK(22, 20));
+}
+
+static inline void set_tx_desc_antsel_a(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(24));
+}
+
+static inline void set_tx_desc_antsel_b(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(25));
+}
+
+static inline void set_tx_desc_seq(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 12), __val, GENMASK(27, 16));
+}
+
+static inline void set_tx_desc_hwseq_en(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 12), __val, BIT(31));
+}
+
+static inline void set_tx_desc_rts_rate(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, GENMASK(4, 0));
+}
+
+static inline void set_tx_desc_qos(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(6));
+}
+
+static inline void set_tx_desc_use_rate(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(8));
+}
+
+static inline void set_tx_desc_disable_fb(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(10));
+}
+
+static inline void set_tx_desc_cts2self(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(11));
+}
+
+static inline void set_tx_desc_rts_enable(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(12));
+}
+
+static inline void set_tx_desc_hw_rts_enable(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(13));
+}
+
+static inline void set_tx_desc_tx_sub_carrier(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, GENMASK(21, 20));
+}
+
+static inline void set_tx_desc_tx_stbc(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, GENMASK(23, 22));
+}
+
+static inline void set_tx_desc_data_bw(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(25));
+}
+
+static inline void set_tx_desc_rts_short(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(26));
+}
+
+static inline void set_tx_desc_rts_bw(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, BIT(27));
+}
+
+static inline void set_tx_desc_rts_sc(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, GENMASK(29, 28));
+}
+
+static inline void set_tx_desc_rts_stbc(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 16), __val, GENMASK(31, 30));
+}
+
+static inline void set_tx_desc_tx_rate(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 20), __val, GENMASK(5, 0));
+}
+
+static inline void set_tx_desc_data_shortgi(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 20), __val, BIT(6));
+}
+
+static inline void set_tx_desc_data_rate_fb_limit(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 20), __val, GENMASK(12, 8));
+}
+
+static inline void set_tx_desc_rts_rate_fb_limit(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 20), __val, GENMASK(16, 13));
+}
+
+static inline void set_tx_desc_max_agg_num(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 24), __val, GENMASK(15, 11));
+}
+
+static inline void set_tx_desc_antsel_c(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 28), __val, BIT(29));
+}
+
+static inline void set_tx_desc_tx_buffer_size(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)(__pdesc + 28), __val, GENMASK(15, 0));
+}
+
+static inline int get_tx_desc_tx_buffer_size(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 28)), GENMASK(15, 0));
+}
+
+static inline void set_tx_desc_tx_buffer_address(u8 *__pdesc, u32 __val)
+{
+ *(__le32 *)(__pdesc + 32) = cpu_to_le32(__val);
+}
+
+static inline int get_tx_desc_tx_buffer_address(u8 *__pdesc)
+{
+ return le32_to_cpu(*((__le32 *)(__pdesc + 32)));
+}
+
+static inline void set_tx_desc_next_desc_address(u8 *__pdesc, u32 __val)
+{
+ *(__le32 *)(__pdesc + 40) = cpu_to_le32(__val);
+}
+
+static inline int get_rx_desc_pkt_len(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)__pdesc), GENMASK(13, 0));
+}
+
+static inline int get_rx_desc_crc32(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)__pdesc), BIT(14));
+}
+
+static inline int get_rx_desc_icv(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)__pdesc), BIT(15));
+}
+
+static inline int get_rx_desc_drv_info_size(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)__pdesc), GENMASK(19, 16));
+}
+
+static inline int get_rx_desc_security(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)__pdesc), GENMASK(22, 20));
+}
+
+static inline int get_rx_desc_qos(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)__pdesc), BIT(23));
+}
+
+static inline int get_rx_desc_shift(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)__pdesc), GENMASK(25, 24));
+}
+
+static inline int get_rx_desc_physt(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)__pdesc), BIT(26));
+}
+
+static inline int get_rx_desc_swdec(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)__pdesc), BIT(27));
+}
+
+static inline int get_rx_desc_ls(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)__pdesc), BIT(28));
+}
+
+static inline int get_rx_desc_fs(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)__pdesc), BIT(29));
+}
+
+static inline int get_rx_desc_eor(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)__pdesc), BIT(30));
+}
+
+static inline int get_rx_desc_own(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)__pdesc), BIT(31));
+}
+
+static inline void set_rx_desc_pkt_len(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)__pdesc, __val, GENMASK(13, 0));
+}
+
+static inline void set_rx_desc_eor(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)__pdesc, __val, BIT(30));
+}
+
+static inline void set_rx_desc_own(u8 *__pdesc, u32 __val)
+{
+ le32p_replace_bits((__le32 *)__pdesc, __val, BIT(31));
+}
+
+static inline int get_rx_desc_macid(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 4)), GENMASK(5, 0));
+}
+
+static inline int get_rx_desc_paggr(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(14));
+}
+
+static inline int get_rx_desc_faggr(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(15));
+}
+
+static inline int get_rx_desc_a1_fit(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 4)), GENMASK(19, 16));
+}
+
+static inline int get_rx_desc_a2_fit(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 4)), GENMASK(23, 20));
+}
+
+static inline int get_rx_desc_pam(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(24));
+}
+
+static inline int get_rx_desc_pwr(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(25));
+}
+
+static inline int get_rx_desc_md(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(26));
+}
+
+static inline int get_rx_desc_mf(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(27));
+}
+
+static inline int get_rx_desc_type(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 4)), GENMASK(29, 28));
+}
+
+static inline int get_rx_desc_mc(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(30));
+}
+
+static inline int get_rx_desc_bc(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 4)), BIT(31));
+}
+
+static inline int get_rx_desc_seq(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 8)), GENMASK(11, 0));
+}
+
+static inline int get_rx_desc_frag(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 8)), GENMASK(15, 12));
+}
+
+static inline int get_rx_desc_rxmcs(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 12)), GENMASK(5, 0));
+}
+
+static inline int get_rx_desc_rxht(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(6));
+}
+
+static inline int get_rx_status_desc_rx_gf(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(7));
+}
+
+static inline int get_rx_desc_splcp(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(8));
+}
+
+static inline int get_rx_desc_bw(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(9));
+}
+
+static inline int get_rx_desc_htc(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(10));
+}
+
+static inline int get_rx_status_desc_eosp(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(11));
+}
+
+static inline int get_rx_status_desc_bssid_fit(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 12)), GENMASK(13, 12));
+}
+
+static inline int get_rx_status_desc_rpt_sel(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 12)), GENMASK(15, 14));
+}
+
+static inline int get_rx_status_desc_pattern_match(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(29));
+}
+
+static inline int get_rx_status_desc_unicast_match(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(30));
+}
+
+static inline int get_rx_status_desc_magic_match(u8 *__pdesc)
+{
+ return le32_get_bits(*((__le32 *)(__pdesc + 12)), BIT(31));
+}
+
+static inline int get_rx_desc_iv1(u8 *__pdesc)
+{
+ return le32_to_cpu(*((__le32 *)(__pdesc + 16)));
+}
+
+static inline int get_rx_desc_tsfl(u8 *__pdesc)
+{
+ return le32_to_cpu(*((__le32 *)(__pdesc + 20)));
+}
+
+static inline int get_rx_desc_buff_addr(u8 *__pdesc)
+{
+ return le32_to_cpu(*((__le32 *)(__pdesc + 24)));
+}
+
+static inline int get_rx_desc_buff_addr64(u8 *__pdesc)
+{
+ return le32_to_cpu(*((__le32 *)(__pdesc + 28)));
+}
+
+static inline void set_rx_desc_buff_addr(u8 *__pdesc, u32 __val)
+{
+ *(__le32 *)(__pdesc + 24) = cpu_to_le32(__val);
+}
+
+static inline void set_rx_desc_buff_addr64(u8 *__pdesc, u32 __val)
+{
+ *(__le32 *)(__pdesc + 28) = cpu_to_le32(__val);
+}
/* TX report 2 format in Rx desc*/
-#define GET_RX_RPT2_DESC_PKT_LEN(__status) \
- le32_get_bits(*((__le32 *)__status), GENMASK(8, 0))
-#define GET_RX_RPT2_DESC_MACID_VALID_1(__status) \
- le32_to_cpu(*((__le32 *)(__status + 16)))
-#define GET_RX_RPT2_DESC_MACID_VALID_2(__status) \
- le32_to_cpu(*((__le32 *)(__status + 20)))
-
-#define SET_EARLYMODE_PKTNUM(__paddr, __value) \
- le32p_replace_bits((__le32 *)__paddr, __value, GENMASK(3, 0))
-#define SET_EARLYMODE_LEN0(__paddr, __value) \
- le32p_replace_bits((__le32 *)__paddr, __value, GENMASK(15, 4))
-#define SET_EARLYMODE_LEN1(__paddr, __value) \
- le32p_replace_bits((__le32 *)__paddr, __value, GENMASK(27, 16))
-#define SET_EARLYMODE_LEN2_1(__paddr, __value) \
- le32p_replace_bits((__le32 *)__paddr, __value, GENMASK(31, 28))
-#define SET_EARLYMODE_LEN2_2(__paddr, __value) \
- le32p_replace_bits((__le32 *)(__paddr + 4), __value, GENMASK(7, 0))
-#define SET_EARLYMODE_LEN3(__paddr, __value) \
- le32p_replace_bits((__le32 *)(__paddr + 4), __value, GENMASK(19, 8))
-#define SET_EARLYMODE_LEN4(__paddr, __value) \
- le32p_replace_bits((__le32 *)(__paddr + 4), __value, GENMASK(31, 20))
+static inline int get_rx_rpt2_desc_pkt_len(u8 *__status)
+{
+ return le32_get_bits(*((__le32 *)__status), GENMASK(8, 0));
+}
+
+static inline int get_rx_rpt2_desc_macid_valid_1(u8 *__status)
+{
+ return le32_to_cpu(*((__le32 *)(__status + 16)));
+}
+
+static inline int get_rx_rpt2_desc_macid_valid_2(u8 *__status)
+{
+ return le32_to_cpu(*((__le32 *)(__status + 20)));
+}
+
+static inline void set_earlymode_pktnum(u8 *__paddr, u32 __value)
+{
+ le32p_replace_bits((__le32 *)__paddr, __value, GENMASK(3, 0));
+}
+
+static inline void set_earlymode_len0(u8 *__paddr, u32 __value)
+{
+ le32p_replace_bits((__le32 *)__paddr, __value, GENMASK(15, 4));
+}
+
+static inline void set_earlymode_len1(u8 *__paddr, u32 __value)
+{
+ le32p_replace_bits((__le32 *)__paddr, __value, GENMASK(27, 16));
+}
+
+static inline void set_earlymode_len2_1(u8 *__paddr, u32 __value)
+{
+ le32p_replace_bits((__le32 *)__paddr, __value, GENMASK(31, 28));
+}
+
+static inline void set_earlymode_len2_2(u8 *__paddr, u32 __value)
+{
+ le32p_replace_bits((__le32 *)(__paddr + 4), __value, GENMASK(7, 0));
+}
+
+static inline void set_earlymode_len3(u8 *__paddr, u32 __value)
+{
+ le32p_replace_bits((__le32 *)(__paddr + 4), __value, GENMASK(19, 8));
+}
+
+static inline void set_earlymode_len4(u8 *__paddr, u32 __value)
+{
+ le32p_replace_bits((__le32 *)(__paddr + 4), __value, GENMASK(31, 20));
+}
#define CLEAR_PCI_TX_DESC_CONTENT(__pdesc, _size) \
do { \
--
2.22.0
^ permalink raw reply related
* Re: [RFC] mt76: fix tx hung regression on MT7630E
From: Stanislaw Gruszka @ 2019-07-31 8:19 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: linux-wireless, Felix Fietkau, Ryder Lee, Roy Luo
In-Reply-To: <20190730145531.GA3813@localhost.localdomain>
On Tue, Jul 30, 2019 at 04:55:31PM +0200, Lorenzo Bianconi wrote:
> > > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c
> > > > index 467b28379870..622251faa415 100644
> > > > --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c
> > > > +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c
> > > > @@ -170,7 +170,7 @@ static int mt76x02_poll_tx(struct napi_struct *napi, int budget)
> > > > mt76.tx_napi);
> > > > int i;
> > > >
> > > > - mt76x02_mac_poll_tx_status(dev, false);
> > > > + mt76x02_mac_poll_tx_status(dev, true);
> > >
> > > I am not sure if we really need mt76x02_mac_poll_tx_status() here since we run
> > > it in mt76x02_tx_complete_skb() and in mt76x02_tx_tasklet(). Anyway the only
> > > difference doing so is we do not run mt76x02_send_tx_status().
> >
> > I thought this is the problem, but it was my mistake during testing.
> > I tested the above change together with mt76_txq_schedule(dev, txq->ac)
> > change and get wrong impression it fixes the issue. But above change
> > alone does not help.
> >
> > I tried to add some locking to avoid parallel execution of mt76x02_poll_tx()
> > and mt76x02_tx_tasklet(), but it didn't help either. So far only patch
> > originally posted here make the problem gone.
>
> so, in order to be on the same page, if you comment out mt76x02_mac_poll_tx_status()
> in mt76x02_poll_tx() the issue will still occur. The only to 'fix' it is to run
> mt76_txq_schedule_all() in mt76x02_poll_tx(), right?
Yes.
Stanislaw
^ permalink raw reply
* Re: [RFC] mt76: fix tx hung regression on MT7630E
From: Stanislaw Gruszka @ 2019-07-31 8:51 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: linux-wireless, Felix Fietkau, Ryder Lee, Roy Luo
In-Reply-To: <20190731081957.GA4096@redhat.com>
On Wed, Jul 31, 2019 at 10:19:58AM +0200, Stanislaw Gruszka wrote:
> On Tue, Jul 30, 2019 at 04:55:31PM +0200, Lorenzo Bianconi wrote:
> > > > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c
> > > > > index 467b28379870..622251faa415 100644
> > > > > --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c
> > > > > +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c
> > > > > @@ -170,7 +170,7 @@ static int mt76x02_poll_tx(struct napi_struct *napi, int budget)
> > > > > mt76.tx_napi);
> > > > > int i;
> > > > >
> > > > > - mt76x02_mac_poll_tx_status(dev, false);
> > > > > + mt76x02_mac_poll_tx_status(dev, true);
> > > >
> > > > I am not sure if we really need mt76x02_mac_poll_tx_status() here since we run
> > > > it in mt76x02_tx_complete_skb() and in mt76x02_tx_tasklet(). Anyway the only
> > > > difference doing so is we do not run mt76x02_send_tx_status().
> > >
> > > I thought this is the problem, but it was my mistake during testing.
> > > I tested the above change together with mt76_txq_schedule(dev, txq->ac)
> > > change and get wrong impression it fixes the issue. But above change
> > > alone does not help.
> > >
> > > I tried to add some locking to avoid parallel execution of mt76x02_poll_tx()
> > > and mt76x02_tx_tasklet(), but it didn't help either. So far only patch
> > > originally posted here make the problem gone.
> >
> > so, in order to be on the same page, if you comment out mt76x02_mac_poll_tx_status()
> > in mt76x02_poll_tx() the issue will still occur. The only to 'fix' it is to run
> > mt76_txq_schedule_all() in mt76x02_poll_tx(), right?
>
> Yes.
Err, no, I should read more cerfully. It is partiall revert of
41634aa8d6db ("mt76: only schedule txqs from the tx tasklet") :
diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c
index 5397827668b9..fefe0ee52584 100644
--- a/drivers/net/wireless/mediatek/mt76/tx.c
+++ b/drivers/net/wireless/mediatek/mt76/tx.c
@@ -598,7 +598,7 @@ void mt76_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
if (!test_bit(MT76_STATE_RUNNING, &dev->state))
return;
- tasklet_schedule(&dev->tx_tasklet);
+ mt76_txq_schedule(dev, txq->ac);
}
EXPORT_SYMBOL_GPL(mt76_wake_tx_queue);
^ permalink raw reply related
* Re: [PATCH] mac80211: HE STA disassoc due to QOS NULL not sent
From: Johannes Berg @ 2019-07-31 8:54 UTC (permalink / raw)
To: Shay Bar; +Cc: linux-wireless
In-Reply-To: <20190703131848.22879-1-shay.bar@celeno.com>
On Wed, 2019-07-03 at 16:18 +0300, Shay Bar wrote:
> In case of HE AP-STA link, ieee80211_send_nullfunc() will not send the QOS NULL packet to check if AP is still associated.
> In this case, probe_send_count will be non zero and ieee80211_sta_work() will later disassociate the AP.
> (although it didn't really send a test QOS NULL packet).
> Fix is to decrement probe_send_count and not call ieee80211_send_nullfunc() in case of HE link.
>
> Signed-off-by: Shay Bar <shay.bar@celeno.com>
> ---
> Hope I solved all the SMTP server problems and patch is better now :)
Yep, thanks.
> if (ieee80211_hw_check(&sdata->local->hw, REPORTS_TX_ACK_STATUS)) {
> ifmgd->nullfunc_failed = false;
> - ieee80211_send_nullfunc(sdata->local, sdata, false);
> + if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE))
> + ifmgd->probe_send_count--;
> + else
> + ieee80211_send_nullfunc(sdata->local, sdata, false);
Not sure that makes sense though.
Why go through all the motions of doing the counting and all, and the
run_again() etc. when all that will happen is that we'll disconnect
anyway?
johannes
^ permalink raw reply
* Re: [RFC] mt76: fix tx hung regression on MT7630E
From: Lorenzo Bianconi @ 2019-07-31 9:09 UTC (permalink / raw)
To: Stanislaw Gruszka; +Cc: linux-wireless, Felix Fietkau, Ryder Lee, Roy Luo
In-Reply-To: <20190731085147.GB4096@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3253 bytes --]
> On Wed, Jul 31, 2019 at 10:19:58AM +0200, Stanislaw Gruszka wrote:
> > On Tue, Jul 30, 2019 at 04:55:31PM +0200, Lorenzo Bianconi wrote:
> > > > > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c
> > > > > > index 467b28379870..622251faa415 100644
> > > > > > --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c
> > > > > > +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c
> > > > > > @@ -170,7 +170,7 @@ static int mt76x02_poll_tx(struct napi_struct *napi, int budget)
> > > > > > mt76.tx_napi);
> > > > > > int i;
> > > > > >
> > > > > > - mt76x02_mac_poll_tx_status(dev, false);
> > > > > > + mt76x02_mac_poll_tx_status(dev, true);
> > > > >
> > > > > I am not sure if we really need mt76x02_mac_poll_tx_status() here since we run
> > > > > it in mt76x02_tx_complete_skb() and in mt76x02_tx_tasklet(). Anyway the only
> > > > > difference doing so is we do not run mt76x02_send_tx_status().
> > > >
> > > > I thought this is the problem, but it was my mistake during testing.
> > > > I tested the above change together with mt76_txq_schedule(dev, txq->ac)
> > > > change and get wrong impression it fixes the issue. But above change
> > > > alone does not help.
> > > >
> > > > I tried to add some locking to avoid parallel execution of mt76x02_poll_tx()
> > > > and mt76x02_tx_tasklet(), but it didn't help either. So far only patch
> > > > originally posted here make the problem gone.
> > >
> > > so, in order to be on the same page, if you comment out mt76x02_mac_poll_tx_status()
> > > in mt76x02_poll_tx() the issue will still occur. The only to 'fix' it is to run
> > > mt76_txq_schedule_all() in mt76x02_poll_tx(), right?
> >
> > Yes.
>
> Err, no, I should read more cerfully. It is partiall revert of
> 41634aa8d6db ("mt76: only schedule txqs from the tx tasklet") :
>
> diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c
> index 5397827668b9..fefe0ee52584 100644
> --- a/drivers/net/wireless/mediatek/mt76/tx.c
> +++ b/drivers/net/wireless/mediatek/mt76/tx.c
> @@ -598,7 +598,7 @@ void mt76_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
> if (!test_bit(MT76_STATE_RUNNING, &dev->state))
> return;
>
> - tasklet_schedule(&dev->tx_tasklet);
> + mt76_txq_schedule(dev, txq->ac);
> }
> EXPORT_SYMBOL_GPL(mt76_wake_tx_queue);
reviewing the code I think:
- we should not run mt76u_tx_tasklet() from mt76_wake_tx_queue() since we do
not have tx_napi for usb and it will unnecessary go through tx queue checks.
We should probably do in mt76_wake_tx_queue() something like:
if (is_mmio())
tasklet_schedule(&dev->tx_tasklet);
else
mt76_txq_schedule(dev, txq->ac);
Another solution would be add a status_tasklet that just goes through the tx
queues receiving the usb tx completion and it schedules the tx_tasklet
What do you think?
- I guess it does not fix the 76x0e issue but we should just schedule tx queues in
mt76x02_tx_tasklet() (like it is done for mt7603 and mt7615) and move status
processing in mt76x02_poll_tx()
Regards,
Lorenzo
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply
* Re: [PATCHv6 1/9] nl80211: New netlink command for TID specific configuration
From: Johannes Berg @ 2019-07-31 9:19 UTC (permalink / raw)
To: Tamizh chelvam, ath10k; +Cc: linux-wireless
In-Reply-To: <1560835632-17405-2-git-send-email-tamizhr@codeaurora.org>
Hi,
Was waiting for you to address Sergey's feedback, but now that I looked
anyway, I have some of my own. Sorry for the long delay though!
> + * @NL80211_ATTR_TID_CONFIG: TID specific configuration in a
> + * nested attribute with %NL80211_TID_ATTR_* sub-attributes.
Please use NL80211_TID_CONFIG_ATTR_* throughout, also for
> +/* enum nl80211_tid_attr_config - TID specific configuration.
the enum name
> +enum nl80211_tid_attr_config {
> + __NL80211_TID_ATTR_INVALID,
> + NL80211_TID_ATTR_CONFIG_TID,
> + NL80211_TID_ATTR_CONFIG_NOACK,
> +
> + /* keep last */
> + __NL80211_TID_ATTR_CONFIG_AFTER_LAST,
> + NL80211_TID_ATTR_CONFIG_MAX = __NL80211_TID_ATTR_CONFIG_AFTER_LAST - 1
and all the things in it.
Also, as you can see above, the kernel-doc comment isn't formatted
right.
> + nla_for_each_nested(tid, info->attrs[NL80211_ATTR_TID_CONFIG],
> + rem_conf) {
> + ret = nla_parse_nested_deprecated(attrs, NL80211_TID_ATTR_CONFIG_MAX,
> + tid, NULL, NULL);
You shouldn't use _deprecated.
> + ret = parse_tid_conf(rdev, attrs,
> + &tid_config->tid_conf[conf_idx],
> + tid_config->peer);
and yeah, this should compile.
johannes
^ permalink raw reply
* Re: [PATCHv6 2/9] nl80211: Add new netlink attribute for TID speicific retry count
From: Johannes Berg @ 2019-07-31 9:24 UTC (permalink / raw)
To: Tamizh chelvam, ath10k; +Cc: linux-wireless
In-Reply-To: <1560835632-17405-3-git-send-email-tamizhr@codeaurora.org>
^^ there's a typo in the subject
> @@ -3951,6 +3957,7 @@ enum wiphy_flags {
> WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22),
> WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23),
> WIPHY_FLAG_HAS_STATIC_WEP = BIT(24),
> + WIPHY_FLAG_HAS_MAX_DATA_RETRY_COUNT = BIT(25),
This is never used, so that doesn't make sense? You probably want to
advertise the max_data_retry_count value contingent on this flag (*) in
some attribute, so that userspace can also detect the presence/absence
of the flag for the feature?
(*) doesn't really need to be contingent on the flag - could just be
contingent on max_data_retry_count being non-zero and then you don't
need the flag.
> + * @NL80211_ATTR_MAX_RETRY_COUNT: The upper limit for the retry count
> + * configuration that the driver can accept.
> *
> * @NUM_NL80211_ATTR: total number of nl80211_attrs available
> * @NL80211_ATTR_MAX: highest attribute number currently defined
> @@ -2823,6 +2825,7 @@ enum nl80211_attrs {
> NL80211_ATTR_TWT_RESPONDER,
>
> NL80211_ATTR_TID_CONFIG,
> + NL80211_ATTR_MAX_RETRY_COUNT,
You already have the attribute, but again, aren't using it.
> + * @NL80211_EXT_FEATURE_PER_TID_RETRY_CONFIG: Driver supports per TID data retry
> + * count functionality.
> + * @NL80211_EXT_FEATURE_PER_STA_RETRY_CONFIG: Driver supports STA specific
> + * data retry count functionality.
and if you have these you don't need the WIPHY_FLAG anyway?
> + [NL80211_TID_ATTR_CONFIG_RETRY] = { .type = NLA_FLAG },
> + [NL80211_TID_ATTR_CONFIG_RETRY_SHORT] = NLA_POLICY_MIN(NLA_U8, 0),
> + [NL80211_TID_ATTR_CONFIG_RETRY_LONG] = NLA_POLICY_MIN(NLA_U8, 0),
min of 0 doesn't make sense, maybe you meant 1? otherwise just don't set
anything here.
> + "TID specific configuration not "
> + "supported");
This applies to all the patches - please don't break strings across
multiple lines, even if they cross 80 columns. Even checkpatch won't
give you any warning on this.
> + tid_conf->tid_conf_mask |= IEEE80211_TID_CONF_RETRY;
> + if (attrs[NL80211_TID_ATTR_CONFIG_RETRY_SHORT]) {
> + tid_conf->retry_short =
> + nla_get_u8(attrs[NL80211_TID_ATTR_CONFIG_RETRY_SHORT]);
> + if (tid_conf->retry_short >
> + rdev->wiphy.max_data_retry_count)
> + return -EINVAL;
> + } else {
> + tid_conf->retry_short = -1;
> +
I guess you should document that -1 means no changes? Not sure how the
IEEE80211_TID_CONF_RETRY comes in, you're always setting it, so that's
useless - better remove that and document that -1 means no changes?
johannes
^ permalink raw reply
* Re: [PATCHv6 1/9] nl80211: New netlink command for TID specific configuration
From: Johannes Berg @ 2019-07-31 9:25 UTC (permalink / raw)
To: Tamizh chelvam, ath10k; +Cc: linux-wireless
In-Reply-To: <1560835632-17405-2-git-send-email-tamizhr@codeaurora.org>
On Tue, 2019-06-18 at 10:57 +0530, Tamizh chelvam wrote:
>
> /**
> + * enum nl80211_tid_config - TID config state
> + * @NL80211_TID_CONFIG_DEFAULT: Default config for the TID
> + * @NL80211_TID_CONFIG_ENABLE: Enable config for the TID
> + * NL80211_TID_CONFIG_DISABLE: Disable config for the TID
> + */
> +enum nl80211_tid_config {
> + NL80211_TID_CONFIG_DEFAULT,
> + NL80211_TID_CONFIG_ENABLE,
> + NL80211_TID_CONFIG_DISABLE,
> +};
Hmm. Looking at this in more detail in patch 3, I don't understand.
How is DEFAULT different from "attribute not present", i.e. "no
changes"?
johannes
^ permalink raw reply
* Re: [PATCHv6 3/9] nl80211: Add netlink attribute for AMPDU aggregation enable/disable
From: Johannes Berg @ 2019-07-31 9:28 UTC (permalink / raw)
To: Tamizh chelvam, ath10k; +Cc: linux-wireless
In-Reply-To: <1560835632-17405-4-git-send-email-tamizhr@codeaurora.org>
On Tue, 2019-06-18 at 10:57 +0530, Tamizh chelvam wrote:
>
> + if (!wiphy_ext_feature_isset(&rdev->wiphy,
> + NL80211_EXT_FEATURE_PER_TID_AMPDU_CTRL)) {
> + NL_SET_ERR_MSG_ATTR(extack,
> + attrs[NL80211_TID_ATTR_CONFIG_AMPDU_CTRL],
> + "TID specific configuration not "
> + "supported");
> + return -ENOTSUPP;
> + }
> +
> + if (peer && !wiphy_ext_feature_isset(&rdev->wiphy,
> + NL80211_EXT_FEATURE_PER_STA_AMPDU_CTRL)) {
> + NL_SET_ERR_MSG_ATTR(extack,
> + attrs[NL80211_TID_ATTR_CONFIG_AMPDU_CTRL],
> + "peer specfic TID configuration not "
> + "supported");
> + return -ENOTSUPP;
> + }
I think you should probably make this be a function to which you pass
the attribute pointer and feature flags.
err = nl80211_check_tid_config_supported(extack,
attrs[NL80211_TID_ATTR_CONFIG_AMPDU_CTRL],
NL80211_EXT_FEATURE_PER_TID_AMPDU_CTRL,
NL80211_EXT_FEATURE_PER_STA_AMPDU_CTRL);
since you have this code a lot?
johannes
^ permalink raw reply
* Re: [PATCHv6 5/9] nl80211: Add netlink attribute to configure TID specific tx rate
From: Johannes Berg @ 2019-07-31 9:32 UTC (permalink / raw)
To: Tamizh chelvam, ath10k; +Cc: linux-wireless
In-Reply-To: <1560835632-17405-6-git-send-email-tamizhr@codeaurora.org>
> /**
> + * enum nl80211_tx_rate_setting - TX rate configuration type
> + * @NL80211_TX_RATE_AUTOMATIC: automatically determine TX rate
> + * @NL80211_TX_RATE_LIMITED: limit the TX rate by the TX rate parameter
> + * @NL80211_TX_RATE_FIXED: fix TX rate to the TX rate parameter
> + */
> +enum nl80211_tx_rate_setting {
> + NL80211_TX_RATE_AUTOMATIC,
> + NL80211_TX_RATE_LIMITED,
> + NL80211_TX_RATE_FIXED,
> +};
I'm not really quite sure how LIMITED it supposed to work?
I mean, I could imagine all kinds of limits ...
* limit to anything <= the given rate in kbps
* limit to anything with long GI
* limit to NSS <= given NSS
* limit to MCS <= given MCS
etc.
I guess you could find a <= comparison for each dimension of the various
parameters, and then if you don't want that particular one limited you
give the maximum? Still not really clear to me how that should work.
Also, would it be allowed to pass an invalid rate? Like something like
"100Mbps legacy rate" when that's certainly not valid? You have no
validation on this, so for LIMITED that might still seem useful (per my
first bullet point above) but for anything else ... not so much?
johannes
^ permalink raw reply
* Re: [PATCHv6 6/9] mac80211: Add api to support configuring TID specific configuration
From: Johannes Berg @ 2019-07-31 9:34 UTC (permalink / raw)
To: Tamizh chelvam, ath10k; +Cc: linux-wireless
In-Reply-To: <1560835632-17405-7-git-send-email-tamizhr@codeaurora.org>
On Tue, 2019-06-18 at 10:57 +0530, Tamizh chelvam wrote:
>
> @@ -1626,6 +1635,14 @@ struct ieee80211_vif {
>
> bool txqs_stopped[IEEE80211_NUM_ACS];
>
> + int noack[IEEE80211_TID_MAX];
> + int retry_short[IEEE80211_TID_MAX];
> + int retry_long[IEEE80211_TID_MAX];
> + int ampdu[IEEE80211_TID_MAX];
> + u8 rate_ctrl[IEEE80211_TID_MAX];
> + u32 rate_code[IEEE80211_TID_MAX];
> + u8 rtscts[IEEE80211_TID_MAX];
This is quite a bit of data (176 bytes), can we make it up to the driver
to store it if supported, instead?
> @@ -2004,6 +2027,13 @@ struct ieee80211_sta {
>
> struct ieee80211_txq *txq[IEEE80211_NUM_TIDS + 1];
>
> + int noack[IEEE80211_TID_MAX];
> + int retry_short[IEEE80211_TID_MAX];
> + int retry_long[IEEE80211_TID_MAX];
> + int ampdu[IEEE80211_TID_MAX];
> + u8 rate_ctrl[IEEE80211_TID_MAX];
> + u8 rtscts[IEEE80211_TID_MAX];
same here.
> +static int ieee80211_set_tid_config(struct wiphy *wiphy,
> + struct net_device *dev,
> + struct ieee80211_tid_config *tid_conf)
> +{
> + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
> + struct sta_info *sta;
> + int ret;
> +
> + if (!sdata->local->ops->set_tid_config)
> + return -EOPNOTSUPP;
> +
> + if (!tid_conf->peer)
> + return drv_set_tid_config(sdata->local, sdata, NULL, tid_conf);
> +
> + mutex_lock(&sdata->local->sta_mtx);
> +
> + sta = sta_info_get_bss(sdata, tid_conf->peer);
> + if (!sta) {
> + mutex_unlock(&sdata->local->sta_mtx);
> + return -ENOENT;
> + }
> +
> + ret = drv_set_tid_config(sdata->local, sdata, &sta->sta, tid_conf);
> + mutex_unlock(&sdata->local->sta_mtx);
> + return ret;
> +}
and you're not actually using the data anyway?
johannes
^ permalink raw reply
* Re: [PATCH v3 2/3] nl80211: Limit certain commands to interface owner
From: Johannes Berg @ 2019-07-31 9:51 UTC (permalink / raw)
To: Denis Kenzior; +Cc: linux-wireless
In-Reply-To: <20190701153317.27170-2-denkenz@gmail.com>
On Mon, 2019-07-01 at 10:33 -0500, Denis Kenzior wrote:
> If the wdev object has been created (via NEW_INTERFACE) with
> SOCKET_OWNER attribute set, then limit certain commands only to the
> process that created that wdev.
>
> This can be used to make sure no other process on the system interferes
> by sending unwanted scans, action frames or any other funny business.
>
> This patch introduces a new internal flag, and checks that flag in the
> pre_doit hook.
So, looking at this ...
I can't say I'm convinced. You're tagging 35 out of about 106 commands,
and even if a handful of those are new and were added after your patch,
this doesn't really make sense.
NL80211_CMD_LEAVE_IBSS is tagged, but not NL80211_CMD_LEAVE_MESH?
NL80211_CMD_NEW_STATION is tagged, but not NL80211_CMD_NEW_MPATH?
NL80211_CMD_SET_KEY is tagged, but not NL80211_CMD_SET_PMK or
NL80211_CMD_SET_PMKSA?
NL80211_CMD_UPDATE_CONNECT_PARAMS is tagged, but not
NL80211_CMD_UPDATE_OWE_INFO (though this could be patch crossing?)
NL80211_CMD_CONTROL_PORT_FRAME isn't tagged?
NL80211_CMD_SET_QOS_MAP isn't tagged?
It almost feels like you just did a "git grep NL80211_CMD_" on your
code, and then dropped the flag on everything you were using.
And honestly, I think you need a better justification than just
"unwanted scans, action frames or any other funny business".
Also, how's this not just a workaround for some very specific setup
issue you were seeing, where people trying out iwd didn't remove wpa_s
properly (*)? I'm really not convinced that this buys us anything except
in very limited development scenarios - and those are typically the
exact scenarios where you _want_ to be able to do things like that (and
honestly, I'd be pretty pissed off if I couldn't do an "iw wlan0 scan"
just because some tool decided it wanted to have control over things).
(*) also, that would just happen to work for you now with iwd winning
because you claim ownership and wpa_s doesn't, you'd still get the same
complaints "iwd doesn't work" if/when wpa_s *does* start to claim
ownership and you get locked out with a patch like this, so I don't feel
you'd actually win much even in this case.
I'm trying to come up with places where we do something similar, defend
one application running as root against another ... but can't really?
Think about VPN - we don't stop anying from removing or adding IP
addresses that the VPN application didn't intend to use, yet that can
obviously break your connection. You could even run dhcp on it, even if
for (most) VPN protocols that's rather useless.
Overall, I'm not really convinced. The design is rather unclear
(randomly sprinkling magic dust on ~35% of commands), and it's also not
really clear to me what this is intended to actually achieve.
johannes
^ permalink raw reply
* Re: [PATCHv6 1/9] nl80211: New netlink command for TID specific configuration
From: Tamizh chelvam @ 2019-07-31 10:04 UTC (permalink / raw)
To: Sergey Matyukevich; +Cc: johannes, linux-wireless, ath10k
In-Reply-To: <20190711125111.vd4rfixmotyusuai@bars>
On 2019-07-11 18:21, Sergey Matyukevich wrote:
>> Add a new NL command, NL80211_CMD_SET_TID_CONFIG to support
>> data TID specific configuration. This per TID configurations
>> are passed in NL80211_ATTR_TID_CONFIG which is a nested
>> attribute. This patch adds support to configure per TID
>> noack policy through NL80211_TID_ATTR_CONFIG_NOACK attribute.
>> Data TID value for this configuration will be passed through
>> NL80211_TID_ATTR_CONFIG_TID attribute. When the user-space wants
>> this configuration peer specific rather than being applied for
>> all the connected stations, MAC address of the peer can be passed
>> in NL80211_ATTR_MAC attribute. This patch introduced
>> enum ieee80211_tid_conf_mask to notify the driver that which
>> configuration modified.
>> Driver supporting data TID specific noack policy configuration
>> should be advertise through NL80211_EXT_FEATURE_PER_TID_NOACK_CONFIG
>> and supporting per STA data TID noack policy configuration
>> should be advertise through NL80211_EXT_FEATURE_PER_STA_NOACK_CONFIG
>>
>> Signed-off-by: Tamizh chelvam <tamizhr@codeaurora.org>
>
> ...
>
>> +static int parse_tid_conf(struct cfg80211_registered_device *rdev,
>> + struct nlattr *attrs[],
>> + struct ieee80211_tid_cfg *tid_conf,
>> + struct genl_info *info, const u8 *peer)
>> +{
>
> ...
>
>
>> +static int nl80211_set_tid_config(struct sk_buff *skb,
>> + struct genl_info *info)
>> +{
>> + struct cfg80211_registered_device *rdev = info->user_ptr[0];
>> + struct nlattr *attrs[NL80211_TID_ATTR_CONFIG_MAX + 1];
>> + struct net_device *dev = info->user_ptr[1];
>> + struct ieee80211_tid_config *tid_config;
>> + struct nlattr *tid;
>> + int conf_idx = 0, rem_conf;
>> + int ret = -EINVAL;
>> + u32 num_conf = 0;
>> +
>> + if (!info->attrs[NL80211_ATTR_TID_CONFIG])
>> + return -EINVAL;
>> +
>> + if (!rdev->ops->set_tid_config)
>> + return -EOPNOTSUPP;
>> +
>> + nla_for_each_nested(tid, info->attrs[NL80211_ATTR_TID_CONFIG],
>> + rem_conf)
>> + num_conf++;
>> +
>> + tid_config = kzalloc(struct_size(tid_config, tid_conf,
>> num_conf),
>> + GFP_KERNEL);
>> + if (!tid_config)
>> + return -ENOMEM;
>> +
>> + tid_config->n_tid_conf = num_conf;
>> +
>> + if (info->attrs[NL80211_ATTR_MAC])
>> + tid_config->peer =
>> nla_data(info->attrs[NL80211_ATTR_MAC]);
>> +
>> + nla_for_each_nested(tid, info->attrs[NL80211_ATTR_TID_CONFIG],
>> + rem_conf) {
>> + ret = nla_parse_nested_deprecated(attrs,
>> NL80211_TID_ATTR_CONFIG_MAX,
>> + tid, NULL, NULL);
>> +
>> + if (ret)
>> + goto bad_tid_conf;
>> +
>> + if (!attrs[NL80211_TID_ATTR_CONFIG_TID]) {
>> + ret = -EINVAL;
>> + goto bad_tid_conf;
>> + }
>> +
>> + ret = parse_tid_conf(rdev, attrs,
>> + &tid_config->tid_conf[conf_idx],
>> + tid_config->peer);
>
>
> Argument 'info' is missing here from parse_tid_conf. IIUC, appropriate
> fixup is included into patch #5. So it looks like rebase issue. But it
> makes sense to fix it since this issue makes the patch set
> non-bisectable.
>
My bad. Yes, it is missed in the rebase. I will fix that.
Thanks,
Tamizh.
^ permalink raw reply
* Re: [PATCHv6 5/9] nl80211: Add netlink attribute to configure TID specific tx rate
From: Tamizh chelvam @ 2019-07-31 10:08 UTC (permalink / raw)
To: Sergey Matyukevich; +Cc: johannes, linux-wireless, ath10k
In-Reply-To: <20190711125442.unlaqjl5nnqgsbod@bars>
On 2019-07-11 18:24, Sergey Matyukevich wrote:
>> Introduce NL80211_TID_ATTR_CONFIG_TX_RATES in nl80211_tid_attr_config
>> to accept data TID specific TX bitrate configuration
>> through NL80211_CMD_SET_TID_CONFIG command. TID for which the
>> this configuration is to be applied is passed in
>> NL80211_TID_ATTR_CONFIG_TID attribute. TX bitrate mask values passed
>> in NL80211_ATTR_TX_RATES attribute and
>> NL80211_TID_ATTR_CONFIG_TX_RATES
>> attribute will have types of the TX rate should be applied.
>> When the user-space wants this configuration peer specific
>> rather than being applied for all the connected stations,
>> MAC address of the peer can be passed in NL80211_ATTR_MAC attribute.
>>
>> Driver supporting this feature should advertise
>> NL80211_EXT_FEATURE_PER_TID_TX_BITRATE_MASK and supporting per-STA
>> data TID
>> TX bitrate configuration should advertise
>> NL80211_EXT_FEATURE_PER_STA_TX_BITRATE_MASK.
>>
>> Signed-off-by: Tamizh chelvam <tamizhr@codeaurora.org>
>
> ...
>
>> if (info->attrs[NL80211_ATTR_TX_RATES]) {
>> - err = nl80211_parse_tx_bitrate_mask(info,
>> ¶ms.beacon_rate);
>> + err = nl80211_parse_tx_bitrate_mask(info, info->attrs,
>> +
>> NL80211_ATTR_TX_RATES,
>> +
>> ¶ms.beacon_rate);
>> if (err)
>> return err;
>>
>
> Could you please clarify this change of nl80211_parse_tx_bitrate_mask
> arguments.
> Unless I missing something, the appropriate change for
> nl80211_parse_tx_bitrate_mask
> is not included into this patch set.
Yeah. These arguments are missed in the function definition place:( I
will fix this rebase issue in next version.
Thanks,
Tamizh.
^ permalink raw reply
* RE: [PATCH] mac80211: HE STA disassoc due to QOS NULL not sent
From: Shay Bar @ 2019-07-31 10:12 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless@vger.kernel.org
In-Reply-To: <5957aa7cc7dcd1cf24bd81bcdff419a27c7782aa.camel@sipsolutions.net>
Hi Johannes,
Station may receive a beacon from the AP that will rearm the bcn_mon_timer.
If it will not get a beacon within the timeout, it will disconnect.
In my test case, beacon arrived later (within the timeout).
Without this patch, STA (wrongly) kicked out the AP without even sending QOS NULL.
With this patch, STA keeps AP associated and will only disassoc if beacon timeout will pass.
Thanks,
Shay
-----Original Message-----
From: linux-wireless-owner@vger.kernel.org <linux-wireless-owner@vger.kernel.org> On Behalf Of Johannes Berg
Sent: Wednesday, 31 July 2019 11:54
To: Shay Bar <Shay.Bar@celeno.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH] mac80211: HE STA disassoc due to QOS NULL not sent
External Email
On Wed, 2019-07-03 at 16:18 +0300, Shay Bar wrote:
> In case of HE AP-STA link, ieee80211_send_nullfunc() will not send the QOS NULL packet to check if AP is still associated.
> In this case, probe_send_count will be non zero and ieee80211_sta_work() will later disassociate the AP.
> (although it didn't really send a test QOS NULL packet).
> Fix is to decrement probe_send_count and not call ieee80211_send_nullfunc() in case of HE link.
>
> Signed-off-by: Shay Bar <shay.bar@celeno.com>
> ---
> Hope I solved all the SMTP server problems and patch is better now :)
Yep, thanks.
> if (ieee80211_hw_check(&sdata->local->hw, REPORTS_TX_ACK_STATUS)) {
> ifmgd->nullfunc_failed = false;
> - ieee80211_send_nullfunc(sdata->local, sdata, false);
> + if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE))
> + ifmgd->probe_send_count--;
> + else
> + ieee80211_send_nullfunc(sdata->local, sdata, false);
Not sure that makes sense though.
Why go through all the motions of doing the counting and all, and the
run_again() etc. when all that will happen is that we'll disconnect
anyway?
johannes
----------
This email has been scanned for spam and viruses by Proofpoint Essentials. Visit the following link to report this email as spam:
https://eu1.proofpointessentials.com/index01.php?mod_id=11&mod_option=logitem&mail_id=1564563252-6zoAqEa3QRRO&r_address=shay.bar%40celeno.com&report=1
________________________________
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any retransmission, dissemination, copying or other use of, or taking of any action in reliance upon this information is prohibited. If you received this in error, please contact the sender and delete the material from any computer. Nothing contained herein shall be deemed as a representation, warranty or a commitment by Celeno. No warranties are expressed or implied, including, but not limited to, any implied warranties of non-infringement, merchantability and fitness for a particular purpose.
________________________________
^ permalink raw reply
* Re: [PATCHv6 1/9] nl80211: New netlink command for TID specific configuration
From: Tamizh chelvam @ 2019-07-31 10:28 UTC (permalink / raw)
To: Johannes Berg; +Cc: ath10k, linux-wireless
In-Reply-To: <428fec1c2dd6f6d9345323f272eef423a214bc39.camel@sipsolutions.net>
>
>> + * @NL80211_ATTR_TID_CONFIG: TID specific configuration in a
>> + * nested attribute with %NL80211_TID_ATTR_* sub-attributes.
>
> Please use NL80211_TID_CONFIG_ATTR_* throughout, also for
>
>> +/* enum nl80211_tid_attr_config - TID specific configuration.
>
> the enum name
>
>> +enum nl80211_tid_attr_config {
>> + __NL80211_TID_ATTR_INVALID,
>> + NL80211_TID_ATTR_CONFIG_TID,
>> + NL80211_TID_ATTR_CONFIG_NOACK,
>> +
>> + /* keep last */
>> + __NL80211_TID_ATTR_CONFIG_AFTER_LAST,
>> + NL80211_TID_ATTR_CONFIG_MAX = __NL80211_TID_ATTR_CONFIG_AFTER_LAST -
>> 1
>
> and all the things in it.
sure.
> Also, as you can see above, the kernel-doc comment isn't formatted
> right.
>
sure, I will fix it.
>
>> + nla_for_each_nested(tid, info->attrs[NL80211_ATTR_TID_CONFIG],
>> + rem_conf) {
>> + ret = nla_parse_nested_deprecated(attrs,
>> NL80211_TID_ATTR_CONFIG_MAX,
>> + tid, NULL, NULL);
>
> You shouldn't use _deprecated.
>
Okay.
>> + ret = parse_tid_conf(rdev, attrs,
>> + &tid_config->tid_conf[conf_idx],
>> + tid_config->peer);
>
> and yeah, this should compile.
>
My bad. Sorry about this. I will fix this in the next version.
Thanks,
Tamizh.
^ permalink raw reply
* Re: [PATCH] mac80211: HE STA disassoc due to QOS NULL not sent
From: Johannes Berg @ 2019-07-31 10:29 UTC (permalink / raw)
To: Shay Bar; +Cc: linux-wireless@vger.kernel.org
In-Reply-To: <AM5P192MB0226D165AF722EB4E578405CE7DF0@AM5P192MB0226.EURP192.PROD.OUTLOOK.COM>
On Wed, 2019-07-31 at 10:12 +0000, Shay Bar wrote:
> Hi Johannes,
> Station may receive a beacon from the AP that will rearm the bcn_mon_timer.
> If it will not get a beacon within the timeout, it will disconnect.
> In my test case, beacon arrived later (within the timeout).
> Without this patch, STA (wrongly) kicked out the AP without even sending QOS NULL.
> With this patch, STA keeps AP associated and will only disassoc if beacon timeout will pass.
Ah, we still need the timeout, right.
johannes
^ permalink raw reply
* Re: [PATCH v3 2/3] nl80211: Limit certain commands to interface owner
From: Denis Kenzior @ 2019-07-31 10:30 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless
In-Reply-To: <bcb31ffae5b916d319bd25a34432026df61fc6f0.camel@sipsolutions.net>
Hi Johannnes,
On 7/31/19 4:51 AM, Johannes Berg wrote:
> On Mon, 2019-07-01 at 10:33 -0500, Denis Kenzior wrote:
>> If the wdev object has been created (via NEW_INTERFACE) with
>> SOCKET_OWNER attribute set, then limit certain commands only to the
>> process that created that wdev.
>>
>> This can be used to make sure no other process on the system interferes
>> by sending unwanted scans, action frames or any other funny business.
>>
>> This patch introduces a new internal flag, and checks that flag in the
>> pre_doit hook.
>
> So, looking at this ...
>
> I can't say I'm convinced. You're tagging 35 out of about 106 commands,
> and even if a handful of those are new and were added after your patch,
> this doesn't really make sense.
>
> NL80211_CMD_LEAVE_IBSS is tagged, but not NL80211_CMD_LEAVE_MESH?
> NL80211_CMD_NEW_STATION is tagged, but not NL80211_CMD_NEW_MPATH?
> NL80211_CMD_SET_KEY is tagged, but not NL80211_CMD_SET_PMK or
> NL80211_CMD_SET_PMKSA?
> NL80211_CMD_UPDATE_CONNECT_PARAMS is tagged, but not
> NL80211_CMD_UPDATE_OWE_INFO (though this could be patch crossing?)
>
> NL80211_CMD_CONTROL_PORT_FRAME isn't tagged?
So for some of these I was planning to submit a patch to check that the
request comes from the SOCKET_OWNER for the connection itself. E.g. it
makes no sense to accept CONTROL_PORT_FRAME from a process that didn't
issue the CMD_CONNECT. Same applies for some of the offload commands.
But I can include these in this list as well if you prefer.
For others, it was pure ignorance as to what the commands do. E.g. we
haven't looked into Mesh at all. So if you want to suggest which
commands should be included, I'm happy to add these.
>
> NL80211_CMD_SET_QOS_MAP isn't tagged?
>
> It almost feels like you just did a "git grep NL80211_CMD_" on your
> code, and then dropped the flag on everything you were using.
>
> And honestly, I think you need a better justification than just
> "unwanted scans, action frames or any other funny business".
>
We have a limited resource that we are managing in userspace. We can't
just have any random process coming in and messing with that resource.
So either the userspace daemon should do it or the kernel. Right now it
is just pure chaos...
And really, in the end, how is this different from SOCKET_OWNER for
CMD_CONNECT? It is optional in the end, so if you don't want to use it,
don't?
> Also, how's this not just a workaround for some very specific setup
> issue you were seeing, where people trying out iwd didn't remove wpa_s
> properly (*)? I'm really not convinced that this buys us anything except
> in very limited development scenarios - and those are typically the
> exact scenarios where you _want_ to be able to do things like that (and
> honestly, I'd be pretty pissed off if I couldn't do an "iw wlan0 scan"
> just because some tool decided it wanted to have control over things).
I understand where you're coming from, but you're just one user who can
disable this behavior anyway if you really cared. For 99.9% of the
users this is never going to be a problem. And I'd rather cater to the
99%...
>
> (*) also, that would just happen to work for you now with iwd winning
> because you claim ownership and wpa_s doesn't, you'd still get the same
> complaints "iwd doesn't work" if/when wpa_s *does* start to claim
> ownership and you get locked out with a patch like this, so I don't feel
> you'd actually win much even in this case.
>
This is in no way the motivation for this. wpa_s or iwd winning is a
distro/user configuration problem. I don't care about that now.
Besides, this was mostly taken care of by the SOCKET_OWNER set on
CMD_CONNECT...
>
> I'm trying to come up with places where we do something similar, defend
> one application running as root against another ... but can't really?
> Think about VPN - we don't stop anying from removing or adding IP
> addresses that the VPN application didn't intend to use, yet that can
> obviously break your connection. You could even run dhcp on it, even if
> for (most) VPN protocols that's rather useless.
File locking would be one example. Systemd can and does all kinds of
fun stuff (e.g. locking a process out from twiddling rfkill). LSM
modules can do just about everything. I think there are plenty of examples.
But really, a lot of this works just because various processes play
'nice' and stay out of each other's way. Also, as you point out, most
things aren't done because they don't make sense.
But with nl80211 this isn't the case. Many processes would be tempted
to start an operation or get some info out of nl80211 directly. So this
patch tries to narrow down what they can use, e.g. informational-only
commands are fine. Anything that can affect state is not fine.
>
> Overall, I'm not really convinced. The design is rather unclear
> (randomly sprinkling magic dust on ~35% of commands), and it's also not
> really clear to me what this is intended to actually achieve.
>
You may want to refer to the thread between Arend & Marcel (started by
an earlier version of this patchset).
I really don't see how giving the userspace management daemon (which by
definition has exclusive control) a way from locking out a random
process from starting a potentially disruptive operation is
'unconvincing.' As a developer you will hate this of course, and that
is to be expected. But look at it from a user POV.
Regards,
-Denis
^ permalink raw reply
* Re: [PATCH V8] mac80211: add hw 80211 encapsulation offloading support
From: Johannes Berg @ 2019-07-31 11:17 UTC (permalink / raw)
To: John Crispin; +Cc: linux-wireless, Vasanthakumar Thiagarajan
In-Reply-To: <20190730091213.5469-1-john@phrozen.org>
Hi,
Just a few things, mostly questions I guess.
> Certain features wont work and the patch masks these out.
> * monitor interfaces are not supported if any of the vif is in encap mode.
> Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
> Signed-off-by: John Crispin <john@phrozen.org>
>
> Signed-off-by: John Crispin <john@phrozen.org>
heh.
> Changes in V7
> * dont mask out monitor support when encap is available. Instead turn encap
> of if a monitor device is brought up or already present
I think that means the commit log (quoted above) needs an update?
> +/**
> + * ieee80211_tx_status_8023 - transmit status callback for 802.3 frame format
> + *
> + * Call this function for all transmitted data frames after their transmit
> + * completion. This callback should only be called for data frames which
> + * are are using driver's (or hardware's) offload capability of encap/decap
> + * 802.11 frames.
> + *
> + * This function may not be called in IRQ context. Calls to this function
> + * for a single hardware must be synchronized against each other.
I guess also against any other calls in the same tx status family?
> @@ -6408,4 +6432,5 @@ void ieee80211_nan_func_match(struct ieee80211_vif *vif,
> struct cfg80211_nan_match_params *match,
> gfp_t gfp);
>
> +bool ieee80211_set_hw_80211_encap(struct ieee80211_vif *vif, bool enable);
Please add some docs for that, when to call it, etc. Maybe there are
context requirements (can only be called inside add_vif callback) etc?
> +++ b/net/mac80211/cfg.c
> @@ -2425,11 +2425,17 @@ static int ieee80211_set_mcast_rate(struct wiphy *wiphy, struct net_device *dev,
> static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
> {
> struct ieee80211_local *local = wiphy_priv(wiphy);
> + struct ieee80211_sub_if_data *sdata;
> int err;
>
> if (changed & WIPHY_PARAM_FRAG_THRESHOLD) {
> ieee80211_check_fast_xmit_all(local);
>
> + mutex_lock(&local->iflist_mtx);
> + list_for_each_entry(sdata, &local->interfaces, list)
> + ieee80211_set_hw_80211_encap(&sdata->vif, false);
> + mutex_unlock(&local->iflist_mtx);
> +
> err = drv_set_frag_threshold(local, wiphy->frag_threshold);
This isn't clear to me - what if the driver *does* support setting the
fragmentation threshold, and maybe even implements it in offload mode?
Shouldn't the driver then reject it, and then we can turn it off, if it
did?
> +bool ieee80211_is_hw_80211_encap(struct ieee80211_local *local);
Maybe that should be something like ieee80211_using_hw_encap() or
something like that?
But a lot of this talks about *encapsulation*, isn't it relevant for
*decapsulation* as well?
Then again, reading all this, I guess it only covers encapsulation so
far.
> +bool ieee80211_set_hw_80211_encap(struct ieee80211_vif *vif, bool enable)
> +{
> + struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
> + struct ieee80211_local *local = sdata->local;
> + struct ieee80211_sub_if_data *iter;
> + struct ieee80211_key *key;
> +
> + sdata_assert_lock(sdata);
> +
> + mutex_lock_nested(&local->iflist_mtx, 1);
That can't be right. The _nested is just a lockdep annotation, and that
only works for *different* mutexes, but it still deadlocks if you use
the same ... e.g. you'd have to do this when you have
my_object *a, *b;
mutex_lock(&a->mtx);
mutex_lock(&b->mtx);
and you know this is OK, even if both mutexes have the same class (since
those are the same objects), but I can't see how you'd have two
different "local" instances actually nesting here.
> + list_for_each_entry(iter, &local->interfaces, list) {
> + if (vif->type == NL80211_IFTYPE_MONITOR)
> + __ieee80211_set_hw_80211_encap(iter, false);
> + else if (iter->vif.type == NL80211_IFTYPE_MONITOR)
> + enable = 0;
false
> + }
> + mutex_unlock(&local->iflist_mtx);
> +
> + if (enable == sdata->hw_80211_encap)
> + return enable;
> +
> + switch (vif->type) {
> + case NL80211_IFTYPE_STATION:
> + if (sdata->u.mgd.use_4addr)
> + enable = 0;
same here and more instances (also "return 0")
> +bool ieee80211_is_hw_80211_encap(struct ieee80211_local *local)
> +{
> + struct ieee80211_sub_if_data *sdata;
> + bool offloaded = false;
> +
> + rcu_read_lock();
> + mutex_lock(&local->iflist_mtx);
You certainly cannot do that in this order.
> + /* TKIP countermeasures wont work on encap offload mode */
"won't" (or maybe "don't")?
> +++ b/net/mac80211/main.c
> @@ -997,7 +997,9 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
> hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN);
> }
>
> - /* mac80211 always supports monitor */
> + /* mac80211 always supports monitor unless we do 802.11
> + * encapsulation offloading.
> + */
not really true now, I think?
> + if (!sta || IS_ERR(sta)) {
IS_ERR_OR_NULL(), but can it even be NULL?
> + /* TODO: Handle frames requiring wifi tx status to be notified */
it'd be nice to address this, it shouldn't even be that hard?
> + if (WARN_ON(dev->ieee80211_ptr->use_4addr)) {
> + kfree_skb(skb);
> + return NETDEV_TX_OK;
> + }
You have this a lot, but is it even worth it? I mean, the driver ought
to know the interface is in 4-addr mode, and then *it* can decide
whether it supports it in offload or not, rather than mac80211 deciding
for it that it cannot possibly be done?
johannes
^ permalink raw reply
* Re: [PATCH] Revert "mac80211: set NETIF_F_LLTX when using intermediate tx queues"
From: Peter Lebbing @ 2019-07-31 11:29 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless
In-Reply-To: <20190730125412.1446-1-johannes@sipsolutions.net>
On 30/07/2019 14:54, Johannes Berg wrote:
> Revert this for now, it has been reported multiple times that it
> completely breaks connectivity on various devices.
That was quick! Thank you!
Peter.
--
I use the GNU Privacy Guard (GnuPG) in combination with Enigmail.
You can send me encrypted mail if you want some privacy.
My key is available at <http://digitalbrains.com/2012/openpgp-key-peter>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox