iwl-devtrace.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved.
  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:
  22. * Intel Linux Wireless <ilw@linux.intel.com>
  23. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  24. *
  25. *****************************************************************************/
  26. #ifndef __IWLWIFI_DEVICE_TRACE
  27. #include <linux/skbuff.h>
  28. #include <linux/ieee80211.h>
  29. #include <net/cfg80211.h>
  30. #include "iwl-trans.h"
  31. #if !defined(__IWLWIFI_DEVICE_TRACE)
  32. static inline bool iwl_trace_data(struct sk_buff *skb)
  33. {
  34. struct ieee80211_hdr *hdr = (void *)skb->data;
  35. struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  36. if (!ieee80211_is_data(hdr->frame_control))
  37. return false;
  38. return !(info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO);
  39. }
  40. static inline size_t iwl_rx_trace_len(const struct iwl_trans *trans,
  41. void *rxbuf, size_t len)
  42. {
  43. struct iwl_cmd_header *cmd = (void *)((u8 *)rxbuf + sizeof(__le32));
  44. struct ieee80211_hdr *hdr;
  45. if (cmd->cmd != trans->rx_mpdu_cmd)
  46. return len;
  47. hdr = (void *)((u8 *)cmd + sizeof(struct iwl_cmd_header) +
  48. trans->rx_mpdu_cmd_hdr_size);
  49. if (!ieee80211_is_data(hdr->frame_control))
  50. return len;
  51. /* maybe try to identify EAPOL frames? */
  52. return sizeof(__le32) + sizeof(*cmd) + trans->rx_mpdu_cmd_hdr_size +
  53. ieee80211_hdrlen(hdr->frame_control);
  54. }
  55. #endif
  56. #define __IWLWIFI_DEVICE_TRACE
  57. #include <linux/tracepoint.h>
  58. #include <linux/device.h>
  59. #include "iwl-trans.h"
  60. #if !defined(CONFIG_IWLWIFI_DEVICE_TRACING) || defined(__CHECKER__)
  61. #undef TRACE_EVENT
  62. #define TRACE_EVENT(name, proto, ...) \
  63. static inline void trace_ ## name(proto) {}
  64. #undef DECLARE_EVENT_CLASS
  65. #define DECLARE_EVENT_CLASS(...)
  66. #undef DEFINE_EVENT
  67. #define DEFINE_EVENT(evt_class, name, proto, ...) \
  68. static inline void trace_ ## name(proto) {}
  69. #endif
  70. #define DEV_ENTRY __string(dev, dev_name(dev))
  71. #define DEV_ASSIGN __assign_str(dev, dev_name(dev))
  72. #include "iwl-devtrace-io.h"
  73. #include "iwl-devtrace-ucode.h"
  74. #include "iwl-devtrace-msg.h"
  75. #include "iwl-devtrace-data.h"
  76. #include "iwl-devtrace-iwlwifi.h"
  77. #endif /* __IWLWIFI_DEVICE_TRACE */