@@ -11,11 +11,9 @@
void rtw_fw_c2h_cmd_handle_ext(struct rtw_dev *rtwdev, struct sk_buff *skb)
{
struct rtw_c2h_cmd *c2h;
- u32 pkt_offset;
u8 sub_cmd_id;
- pkt_offset = *((u32 *)skb->cb);
- c2h = (struct rtw_c2h_cmd *)(skb->data + pkt_offset);
+ c2h = get_c2h_from_skb(skb);
sub_cmd_id = c2h->payload[0];
switch (sub_cmd_id) {
@@ -199,6 +199,14 @@ static inline void rtw_h2c_pkt_set_header(u8 *h2c_pkt, u8 sub_id)
#define SET_RA_INFO_RA_MASK3(h2c_pkt, value) \
le32p_replace_bits((__le32 *)(h2c_pkt) + 0x01, value, GENMASK(31, 24))
+static inline struct rtw_c2h_cmd *get_c2h_from_skb(struct sk_buff *skb)
+{
+ u32 pkt_offset;
+
+ pkt_offset = *((u32 *)skb->cb);
+ return (struct rtw_c2h_cmd *)(skb->data + pkt_offset);
+}
+
void rtw_fw_c2h_cmd_handle(struct rtw_dev *rtwdev, struct sk_buff *skb);
void rtw_fw_send_general_info(struct rtw_dev *rtwdev,
struct rtw_general_info *info);
@@ -199,12 +199,10 @@ void rtw_tx_report_handle(struct rtw_dev *rtwdev, struct sk_buff *skb)
struct rtw_c2h_cmd *c2h;
struct sk_buff *cur, *tmp;
unsigned long flags;
- u32 pkt_offset;
u8 sn, st;
u8 *n;
- pkt_offset = *((u32 *)skb->cb);
- c2h = (struct rtw_c2h_cmd *)(skb->data + pkt_offset);
+ c2h = get_c2h_from_skb(skb);
sn = GET_CCX_REPORT_SEQNUM(c2h->payload);
st = GET_CCX_REPORT_STATUS(c2h->payload);