Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

wifi: mac80211: refactor chandef tracing macros

We don't need to duplicate the macros, just make a generic
one that gets the name prefix to be used, and use that to
create the others. While at it, add the puncturing bitmap
to the trace and simplify the ternary expressions.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260303152641.ca32d70055f8.I8138a31ceb75715d928d807554288baccc33cd8c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

+38 -56
+38 -56
net/mac80211/trace.h
··· 2 2 /* 3 3 * Portions of this file 4 4 * Copyright(c) 2016-2017 Intel Deutschland GmbH 5 - * Copyright (C) 2018 - 2024 Intel Corporation 5 + * Copyright (C) 2018-2024, 2026 Intel Corporation 6 6 */ 7 7 8 8 #if !defined(__MAC80211_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ) ··· 37 37 #define VIF_PR_FMT " vif:%s(%d%s)" 38 38 #define VIF_PR_ARG __get_str(vif_name), __entry->vif_type, __entry->p2p ? "/p2p" : "" 39 39 40 - #define CHANDEF_ENTRY __field(u32, control_freq) \ 41 - __field(u32, freq_offset) \ 42 - __field(u32, chan_width) \ 43 - __field(u32, center_freq1) \ 44 - __field(u32, freq1_offset) \ 45 - __field(u32, center_freq2) 46 - #define CHANDEF_ASSIGN(c) \ 47 - __entry->control_freq = (c) ? ((c)->chan ? (c)->chan->center_freq : 0) : 0; \ 48 - __entry->freq_offset = (c) ? ((c)->chan ? (c)->chan->freq_offset : 0) : 0; \ 49 - __entry->chan_width = (c) ? (c)->width : 0; \ 50 - __entry->center_freq1 = (c) ? (c)->center_freq1 : 0; \ 51 - __entry->freq1_offset = (c) ? (c)->freq1_offset : 0; \ 52 - __entry->center_freq2 = (c) ? (c)->center_freq2 : 0; 53 - #define CHANDEF_PR_FMT " chandef(%d.%03d MHz,width:%d,center: %d.%03d/%d MHz)" 54 - #define CHANDEF_PR_ARG __entry->control_freq, __entry->freq_offset, __entry->chan_width, \ 55 - __entry->center_freq1, __entry->freq1_offset, __entry->center_freq2 40 + #define __CHANDEF_ENTRY(n) \ 41 + __field(u32, n##control_freq) \ 42 + __field(u32, n##freq_offset) \ 43 + __field(u32, n##chan_width) \ 44 + __field(u32, n##center_freq1) \ 45 + __field(u32, n##freq1_offset) \ 46 + __field(u32, n##center_freq2) \ 47 + __field(u16, n##punctured) 48 + #define __CHANDEF_ASSIGN(n, c) \ 49 + __entry->n##control_freq = (c) && (c)->chan ? \ 50 + (c)->chan->center_freq : 0; \ 51 + __entry->n##freq_offset = (c) && (c)->chan ? \ 52 + (c)->chan->freq_offset : 0; \ 53 + __entry->n##chan_width = (c) ? (c)->width : 0; \ 54 + __entry->n##center_freq1 = (c) ? (c)->center_freq1 : 0; \ 55 + __entry->n##freq1_offset = (c) ? (c)->freq1_offset : 0; \ 56 + __entry->n##center_freq2 = (c) ? (c)->center_freq2 : 0; \ 57 + __entry->n##punctured = (c) ? (c)->punctured : 0; 58 + #define __CHANDEF_PR_FMT(n) \ 59 + " " #n "(%d.%03d MHz,width:%d,center: %d.%03d/%d MHz, punct:0x%x)" 60 + #define __CHANDEF_PR_ARG(n) \ 61 + __entry->n##control_freq, __entry->n##freq_offset, \ 62 + __entry->n##chan_width, __entry->n##center_freq1, \ 63 + __entry->n##freq1_offset, __entry->n##center_freq2, \ 64 + __entry->n##punctured 56 65 57 - #define MIN_CHANDEF_ENTRY \ 58 - __field(u32, min_control_freq) \ 59 - __field(u32, min_freq_offset) \ 60 - __field(u32, min_chan_width) \ 61 - __field(u32, min_center_freq1) \ 62 - __field(u32, min_freq1_offset) \ 63 - __field(u32, min_center_freq2) 66 + #define CHANDEF_ENTRY __CHANDEF_ENTRY() 67 + #define CHANDEF_ASSIGN(c) __CHANDEF_ASSIGN(, c) 68 + #define CHANDEF_PR_FMT __CHANDEF_PR_FMT(chandef) 69 + #define CHANDEF_PR_ARG __CHANDEF_PR_ARG() 64 70 65 - #define MIN_CHANDEF_ASSIGN(c) \ 66 - __entry->min_control_freq = (c)->chan ? (c)->chan->center_freq : 0; \ 67 - __entry->min_freq_offset = (c)->chan ? (c)->chan->freq_offset : 0; \ 68 - __entry->min_chan_width = (c)->width; \ 69 - __entry->min_center_freq1 = (c)->center_freq1; \ 70 - __entry->min_freq1_offset = (c)->freq1_offset; \ 71 - __entry->min_center_freq2 = (c)->center_freq2; 72 - #define MIN_CHANDEF_PR_FMT " mindef(%d.%03d MHz,width:%d,center: %d.%03d/%d MHz)" 73 - #define MIN_CHANDEF_PR_ARG __entry->min_control_freq, __entry->min_freq_offset, \ 74 - __entry->min_chan_width, \ 75 - __entry->min_center_freq1, __entry->min_freq1_offset, \ 76 - __entry->min_center_freq2 71 + #define MIN_CHANDEF_ENTRY __CHANDEF_ENTRY(min) 72 + #define MIN_CHANDEF_ASSIGN(c) __CHANDEF_ASSIGN(min, c) 73 + #define MIN_CHANDEF_PR_FMT __CHANDEF_PR_FMT(mindef) 74 + #define MIN_CHANDEF_PR_ARG __CHANDEF_PR_ARG(min) 77 75 78 - #define AP_CHANDEF_ENTRY \ 79 - __field(u32, ap_control_freq) \ 80 - __field(u32, ap_freq_offset) \ 81 - __field(u32, ap_chan_width) \ 82 - __field(u32, ap_center_freq1) \ 83 - __field(u32, ap_freq1_offset) \ 84 - __field(u32, ap_center_freq2) 85 - 86 - #define AP_CHANDEF_ASSIGN(c) \ 87 - __entry->ap_control_freq = (c)->chan ? (c)->chan->center_freq : 0;\ 88 - __entry->ap_freq_offset = (c)->chan ? (c)->chan->freq_offset : 0;\ 89 - __entry->ap_chan_width = (c)->chan ? (c)->width : 0; \ 90 - __entry->ap_center_freq1 = (c)->chan ? (c)->center_freq1 : 0; \ 91 - __entry->ap_freq1_offset = (c)->chan ? (c)->freq1_offset : 0; \ 92 - __entry->ap_center_freq2 = (c)->chan ? (c)->center_freq2 : 0; 93 - #define AP_CHANDEF_PR_FMT " ap(%d.%03d MHz,width:%d,center: %d.%03d/%d MHz)" 94 - #define AP_CHANDEF_PR_ARG __entry->ap_control_freq, __entry->ap_freq_offset, \ 95 - __entry->ap_chan_width, \ 96 - __entry->ap_center_freq1, __entry->ap_freq1_offset, \ 97 - __entry->ap_center_freq2 76 + #define AP_CHANDEF_ENTRY __CHANDEF_ENTRY(ap) 77 + #define AP_CHANDEF_ASSIGN(c) __CHANDEF_ASSIGN(ap, c) 78 + #define AP_CHANDEF_PR_FMT __CHANDEF_PR_FMT(ap) 79 + #define AP_CHANDEF_PR_ARG __CHANDEF_PR_ARG(ap) 98 80 99 81 #define CHANCTX_ENTRY CHANDEF_ENTRY \ 100 82 MIN_CHANDEF_ENTRY \