iwlwifi: add 80211 hdr offset to trace data
Every rx mpdu cmd is built from cmd_hdr | 80211_hdr. The problem is that the size of cmd_hdr changes with API changes and we don't know where the 80211_hdr starts. By adding the size of cmd_hdr dynamically, we can ensure that we always know how to parse mpdu frames, without dependending on the API changes. Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
This commit is contained in:
parent
b6fe27575a
commit
38bd7e58cf
|
@ -2,6 +2,7 @@
|
|||
*
|
||||
* Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved.
|
||||
* Copyright(c) 2015 Intel Deutschland GmbH
|
||||
* Copyright(c) 2018 Intel Corporation
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
|
@ -12,10 +13,6 @@
|
|||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
|
@ -76,12 +73,11 @@ TRACE_EVENT(iwlwifi_dev_rx_data,
|
|||
TP_ARGS(dev, trans, rxbuf, len),
|
||||
TP_STRUCT__entry(
|
||||
DEV_ENTRY
|
||||
|
||||
__dynamic_array(u8, data,
|
||||
len - iwl_rx_trace_len(trans, rxbuf, len))
|
||||
len - iwl_rx_trace_len(trans, rxbuf, len, NULL))
|
||||
),
|
||||
TP_fast_assign(
|
||||
size_t offs = iwl_rx_trace_len(trans, rxbuf, len);
|
||||
size_t offs = iwl_rx_trace_len(trans, rxbuf, len, NULL);
|
||||
DEV_ASSIGN;
|
||||
if (offs < len)
|
||||
memcpy(__get_dynamic_array(data),
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved.
|
||||
* Copyright(c) 2015 Intel Mobile Communications GmbH
|
||||
* Copyright(c) 2016 - 2017 Intel Deutschland GmbH
|
||||
* Copyright(c) 2018 Intel Corporation
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
|
@ -13,10 +14,6 @@
|
|||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
|
@ -75,13 +72,18 @@ TRACE_EVENT(iwlwifi_dev_rx,
|
|||
TP_STRUCT__entry(
|
||||
DEV_ENTRY
|
||||
__field(u16, cmd)
|
||||
__dynamic_array(u8, rxbuf, iwl_rx_trace_len(trans, pkt, len))
|
||||
__field(u8, hdr_offset)
|
||||
__dynamic_array(u8, rxbuf,
|
||||
iwl_rx_trace_len(trans, pkt, len, NULL))
|
||||
),
|
||||
TP_fast_assign(
|
||||
size_t hdr_offset = 0;
|
||||
|
||||
DEV_ASSIGN;
|
||||
__entry->cmd = WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd);
|
||||
memcpy(__get_dynamic_array(rxbuf), pkt,
|
||||
iwl_rx_trace_len(trans, pkt, len));
|
||||
iwl_rx_trace_len(trans, pkt, len, &hdr_offset));
|
||||
__entry->hdr_offset = hdr_offset;
|
||||
),
|
||||
TP_printk("[%s] RX cmd %#.2x",
|
||||
__get_str(dev), __entry->cmd)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved.
|
||||
* Copyright(C) 2016 Intel Deutschland GmbH
|
||||
* Copyright(C) 2016 Intel Deutschland GmbH
|
||||
* Copyright(c) 2018 Intel Corporation
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
|
@ -12,10 +13,6 @@
|
|||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
|
@ -60,16 +57,23 @@ static inline bool iwl_trace_data(struct sk_buff *skb)
|
|||
}
|
||||
|
||||
static inline size_t iwl_rx_trace_len(const struct iwl_trans *trans,
|
||||
void *rxbuf, size_t len)
|
||||
void *rxbuf, size_t len,
|
||||
size_t *out_hdr_offset)
|
||||
{
|
||||
struct iwl_cmd_header *cmd = (void *)((u8 *)rxbuf + sizeof(__le32));
|
||||
struct ieee80211_hdr *hdr;
|
||||
struct ieee80211_hdr *hdr = NULL;
|
||||
size_t hdr_offset;
|
||||
|
||||
if (cmd->cmd != trans->rx_mpdu_cmd)
|
||||
return len;
|
||||
|
||||
hdr = (void *)((u8 *)cmd + sizeof(struct iwl_cmd_header) +
|
||||
trans->rx_mpdu_cmd_hdr_size);
|
||||
hdr_offset = sizeof(struct iwl_cmd_header) +
|
||||
trans->rx_mpdu_cmd_hdr_size;
|
||||
|
||||
if (out_hdr_offset)
|
||||
*out_hdr_offset = hdr_offset;
|
||||
|
||||
hdr = (void *)((u8 *)cmd + hdr_offset);
|
||||
if (!ieee80211_is_data(hdr->frame_control))
|
||||
return len;
|
||||
/* maybe try to identify EAPOL frames? */
|
||||
|
|
Loading…
Reference in New Issue