Johannes Berg 1261fefa64 wifi: iwlwifi: refactor RX tracing
When there's not going to be any data in the data event, we
don't need to add it at all (unlike the TX version, it has
no data at all.)

Also combine the tracing into a separate inline so we only
call iwl_rx_trace_len() once, which also simplifies things,
and lets us have a single place to later add other checks.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231207044813.13325a4848d2.Ic9e7d794fc4aebfe5ac5136b539ee62789f210f3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-12-12 10:36:59 +01:00

37 lines
1.1 KiB
C

// SPDX-License-Identifier: GPL-2.0-only
/******************************************************************************
*
* Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved.
* Copyright (C) 2018, 2023 Intel Corporation
*****************************************************************************/
#include <linux/module.h>
/* sparse doesn't like tracepoint macros */
#ifndef __CHECKER__
#include "iwl-trans.h"
#define CREATE_TRACE_POINTS
#ifdef CONFIG_CC_IS_GCC
#pragma GCC diagnostic ignored "-Wsuggest-attribute=format"
#endif
#include "iwl-devtrace.h"
EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_ucode_event);
EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_ucode_cont_event);
EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_ucode_wrap_event);
#else
#include "iwl-devtrace.h"
#endif /* __CHECKER__ */
void __trace_iwlwifi_dev_rx(struct iwl_trans *trans, void *pkt, size_t len)
{
size_t hdr_offset = 0, trace_len;
trace_len = iwl_rx_trace_len(trans, pkt, len, &hdr_offset);
trace_iwlwifi_dev_rx(trans->dev, pkt, len, trace_len, hdr_offset);
if (trace_len < len)
trace_iwlwifi_dev_rx_data(trans->dev, pkt, len, trace_len);
}