Reinette Chatre | bb5d2db | 2010-01-15 13:42:59 -0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
Emmanuel Grumbach | 51368bf | 2013-12-30 13:15:54 +0200 | [diff] [blame] | 3 | * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved. |
Reinette Chatre | bb5d2db | 2010-01-15 13:42:59 -0800 | [diff] [blame] | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of version 2 of the GNU General Public License as |
| 7 | * published by the Free Software Foundation. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 12 | * more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along with |
| 15 | * this program; if not, write to the Free Software Foundation, Inc., |
| 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA |
| 17 | * |
| 18 | * The full GNU General Public License is included in this distribution in the |
| 19 | * file called LICENSE. |
| 20 | * |
| 21 | * Contact Information: |
Emmanuel Grumbach | cb2f827 | 2015-11-17 15:39:56 +0200 | [diff] [blame] | 22 | * Intel Linux Wireless <linuxwifi@intel.com> |
Reinette Chatre | bb5d2db | 2010-01-15 13:42:59 -0800 | [diff] [blame] | 23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
| 24 | * |
| 25 | *****************************************************************************/ |
| 26 | |
Steven Rostedt (Red Hat) | c5ef935 | 2015-04-07 11:25:14 -0400 | [diff] [blame] | 27 | #ifndef __IWLWIFI_DEVICE_TRACE |
Johannes Berg | f042c2e | 2012-09-05 22:34:44 +0200 | [diff] [blame] | 28 | #include <linux/skbuff.h> |
| 29 | #include <linux/ieee80211.h> |
| 30 | #include <net/cfg80211.h> |
| 31 | #include "iwl-trans.h" |
| 32 | #if !defined(__IWLWIFI_DEVICE_TRACE) |
| 33 | static inline bool iwl_trace_data(struct sk_buff *skb) |
| 34 | { |
| 35 | struct ieee80211_hdr *hdr = (void *)skb->data; |
Johannes Berg | af61a16 | 2013-07-02 18:09:12 +0200 | [diff] [blame] | 36 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
Johannes Berg | f042c2e | 2012-09-05 22:34:44 +0200 | [diff] [blame] | 37 | |
Johannes Berg | af61a16 | 2013-07-02 18:09:12 +0200 | [diff] [blame] | 38 | if (!ieee80211_is_data(hdr->frame_control)) |
| 39 | return false; |
| 40 | return !(info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO); |
Johannes Berg | f042c2e | 2012-09-05 22:34:44 +0200 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | static inline size_t iwl_rx_trace_len(const struct iwl_trans *trans, |
| 44 | void *rxbuf, size_t len) |
| 45 | { |
| 46 | struct iwl_cmd_header *cmd = (void *)((u8 *)rxbuf + sizeof(__le32)); |
| 47 | struct ieee80211_hdr *hdr; |
| 48 | |
| 49 | if (cmd->cmd != trans->rx_mpdu_cmd) |
| 50 | return len; |
| 51 | |
| 52 | hdr = (void *)((u8 *)cmd + sizeof(struct iwl_cmd_header) + |
| 53 | trans->rx_mpdu_cmd_hdr_size); |
| 54 | if (!ieee80211_is_data(hdr->frame_control)) |
| 55 | return len; |
| 56 | /* maybe try to identify EAPOL frames? */ |
| 57 | return sizeof(__le32) + sizeof(*cmd) + trans->rx_mpdu_cmd_hdr_size + |
| 58 | ieee80211_hdrlen(hdr->frame_control); |
| 59 | } |
| 60 | #endif |
| 61 | |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 62 | #define __IWLWIFI_DEVICE_TRACE |
| 63 | |
| 64 | #include <linux/tracepoint.h> |
Johannes Berg | 1023fdc | 2012-05-15 12:16:34 +0200 | [diff] [blame] | 65 | #include <linux/device.h> |
Johannes Berg | 45eab7c | 2012-09-05 00:33:53 +0200 | [diff] [blame] | 66 | #include "iwl-trans.h" |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 67 | |
Emmanuel Grumbach | 83ed901 | 2011-08-25 23:11:14 -0700 | [diff] [blame] | 68 | |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 69 | #if !defined(CONFIG_IWLWIFI_DEVICE_TRACING) || defined(__CHECKER__) |
| 70 | #undef TRACE_EVENT |
| 71 | #define TRACE_EVENT(name, proto, ...) \ |
| 72 | static inline void trace_ ## name(proto) {} |
Johannes Berg | 2655e31 | 2012-01-31 21:08:37 -0800 | [diff] [blame] | 73 | #undef DECLARE_EVENT_CLASS |
| 74 | #define DECLARE_EVENT_CLASS(...) |
| 75 | #undef DEFINE_EVENT |
| 76 | #define DEFINE_EVENT(evt_class, name, proto, ...) \ |
| 77 | static inline void trace_ ## name(proto) {} |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 78 | #endif |
| 79 | |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 80 | #define DEV_ENTRY __string(dev, dev_name(dev)) |
| 81 | #define DEV_ASSIGN __assign_str(dev, dev_name(dev)) |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 82 | |
Steven Rostedt (Red Hat) | c5ef935 | 2015-04-07 11:25:14 -0400 | [diff] [blame] | 83 | #include "iwl-devtrace-io.h" |
| 84 | #include "iwl-devtrace-ucode.h" |
| 85 | #include "iwl-devtrace-msg.h" |
| 86 | #include "iwl-devtrace-data.h" |
| 87 | #include "iwl-devtrace-iwlwifi.h" |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 88 | |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 89 | #endif /* __IWLWIFI_DEVICE_TRACE */ |