mirror of https://gitee.com/openkylin/linux.git
rtlwifi: access skb->data to get C2H data by macro
The format of C2H data is ID(1 byte) + Length(1 byte) + value, and it is more readable to use macros to access C2H data. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
parent
9ae6ed271a
commit
9644032e30
|
@ -2288,10 +2288,10 @@ static void rtl_c2h_content_parsing(struct ieee80211_hw *hw,
|
|||
u8 cmd_id, cmd_seq, cmd_len;
|
||||
u8 *cmd_buf = NULL;
|
||||
|
||||
cmd_id = skb->data[0];
|
||||
cmd_seq = skb->data[1];
|
||||
cmd_len = skb->len - 2;
|
||||
cmd_buf = skb->data + 2;
|
||||
cmd_id = GET_C2H_CMD_ID(skb->data);
|
||||
cmd_seq = GET_C2H_SEQ(skb->data);
|
||||
cmd_len = skb->len - C2H_DATA_OFFSET;
|
||||
cmd_buf = GET_C2H_DATA_PTR(skb->data);
|
||||
|
||||
switch (cmd_id) {
|
||||
case C2H_DBG:
|
||||
|
|
|
@ -177,6 +177,11 @@ enum rtl_c2h_evt_v2 {
|
|||
C2H_V2_CCX_RPT = 0x0F,
|
||||
};
|
||||
|
||||
#define GET_C2H_CMD_ID(c2h) ({u8 *__c2h = c2h; __c2h[0]; })
|
||||
#define GET_C2H_SEQ(c2h) ({u8 *__c2h = c2h; __c2h[1]; })
|
||||
#define C2H_DATA_OFFSET 2
|
||||
#define GET_C2H_DATA_PTR(c2h) ({u8 *__c2h = c2h; &__c2h[C2H_DATA_OFFSET]; })
|
||||
|
||||
#define GET_TX_REPORT_SN_V1(c2h) (c2h[6])
|
||||
#define GET_TX_REPORT_ST_V1(c2h) (c2h[0] & 0xC0)
|
||||
#define GET_TX_REPORT_RETRY_V1(c2h) (c2h[2] & 0x3F)
|
||||
|
|
Loading…
Reference in New Issue