1 /******************************************************************************
3 * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved.
4 * Copyright(C) 2016 Intel Deutschland GmbH
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of version 2 of the GNU General Public License as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 * The full GNU General Public License is included in this distribution in the
20 * file called LICENSE.
22 * Contact Information:
23 * Intel Linux Wireless <linuxwifi@intel.com>
24 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
26 *****************************************************************************/
28 #ifndef __IWLWIFI_DEVICE_TRACE
29 #include <linux/skbuff.h>
30 #include <linux/ieee80211.h>
31 #include <net/cfg80211.h>
32 #include "iwl-trans.h"
33 #if !defined(__IWLWIFI_DEVICE_TRACE)
34 static inline bool iwl_trace_data(struct sk_buff
*skb
)
36 struct ieee80211_hdr
*hdr
= (void *)skb
->data
;
37 __le16 fc
= hdr
->frame_control
;
38 int offs
= 24; /* start with normal header length */
40 if (!ieee80211_is_data(fc
))
43 /* Try to determine if the frame is EAPOL. This might have false
44 * positives (if there's no RFC 1042 header and we compare to some
45 * payload instead) but since we're only doing tracing that's not
49 if (ieee80211_has_a4(fc
))
51 if (ieee80211_is_data_qos(fc
))
53 /* don't account for crypto - these are unencrypted */
55 /* also account for the RFC 1042 header, of course */
58 return skb
->len
<= offs
+ 2 ||
59 *(__be16
*)(skb
->data
+ offs
) != cpu_to_be16(ETH_P_PAE
);
62 static inline size_t iwl_rx_trace_len(const struct iwl_trans
*trans
,
63 void *rxbuf
, size_t len
)
65 struct iwl_cmd_header
*cmd
= (void *)((u8
*)rxbuf
+ sizeof(__le32
));
66 struct ieee80211_hdr
*hdr
;
68 if (cmd
->cmd
!= trans
->rx_mpdu_cmd
)
71 hdr
= (void *)((u8
*)cmd
+ sizeof(struct iwl_cmd_header
) +
72 trans
->rx_mpdu_cmd_hdr_size
);
73 if (!ieee80211_is_data(hdr
->frame_control
))
75 /* maybe try to identify EAPOL frames? */
76 return sizeof(__le32
) + sizeof(*cmd
) + trans
->rx_mpdu_cmd_hdr_size
+
77 ieee80211_hdrlen(hdr
->frame_control
);
81 #define __IWLWIFI_DEVICE_TRACE
83 #include <linux/tracepoint.h>
84 #include <linux/device.h>
85 #include "iwl-trans.h"
88 #if !defined(CONFIG_IWLWIFI_DEVICE_TRACING) || defined(__CHECKER__)
90 #define TRACE_EVENT(name, proto, ...) \
91 static inline void trace_ ## name(proto) {}
92 #undef DECLARE_EVENT_CLASS
93 #define DECLARE_EVENT_CLASS(...)
95 #define DEFINE_EVENT(evt_class, name, proto, ...) \
96 static inline void trace_ ## name(proto) {}
99 #define DEV_ENTRY __string(dev, dev_name(dev))
100 #define DEV_ASSIGN __assign_str(dev, dev_name(dev))
102 #include "iwl-devtrace-io.h"
103 #include "iwl-devtrace-ucode.h"
104 #include "iwl-devtrace-msg.h"
105 #include "iwl-devtrace-data.h"
106 #include "iwl-devtrace-iwlwifi.h"
108 #endif /* __IWLWIFI_DEVICE_TRACE */