1 /* 2 * Copyright (c) 2020 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /** 21 * @file cdp_txrx_hist_struct.h 22 * @brief Define the host data path histogram data types 23 */ 24 #ifndef _CDP_TXRX_HIST_STRUCT_H_ 25 #define _CDP_TXRX_HIST_STRUCT_H_ 26 27 /* 28 * cdp_hist_bucket_index : Histogram Bucket 29 * @CDP_HIST_BUCKET_0: Bucket Index 0 30 * @CDP_HIST_BUCKET_1: Bucket Index 1 31 * @CDP_HIST_BUCKET_2: Bucket Index 2 32 * @CDP_HIST_BUCKET_3: Bucket Index 3 33 * @CDP_HIST_BUCKET_4: Bucket Index 4 34 * @CDP_HIST_BUCKET_5: Bucket Index 5 35 * @CDP_HIST_BUCKET_6: Bucket Index 6 36 * @CDP_HIST_BUCKET_7: Bucket Index 7 37 * @CDP_HIST_BUCKET_8: Bucket Index 8 38 * @CDP_HIST_BUCKET_9: Bucket Index 9 39 * @CDP_HIST_BUCKET_10: Bucket Index 10 40 * @CDP_HIST_BUCKET_11: Bucket Index 11 41 * @CDP_HIST_BUCKET_12: Bucket Index 12 42 */ 43 enum cdp_hist_bucket_index { 44 CDP_HIST_BUCKET_0, 45 CDP_HIST_BUCKET_1, 46 CDP_HIST_BUCKET_2, 47 CDP_HIST_BUCKET_3, 48 CDP_HIST_BUCKET_4, 49 CDP_HIST_BUCKET_5, 50 CDP_HIST_BUCKET_6, 51 CDP_HIST_BUCKET_7, 52 CDP_HIST_BUCKET_8, 53 CDP_HIST_BUCKET_9, 54 CDP_HIST_BUCKET_10, 55 CDP_HIST_BUCKET_11, 56 CDP_HIST_BUCKET_12, 57 CDP_HIST_BUCKET_MAX, 58 }; 59 60 /* 61 * cdp_hist_types: Histogram Types 62 * @CDP_HIST_TYPE_SW_ENQEUE_DELAY: From stack to HW enqueue delay 63 * @CDP_HIST_TYPE_HW_COMP_DELAY: From HW enqueue to completion delay 64 * @CDP_HIST_TYPE_REAP_STACK: Rx HW reap to stack deliver delay 65 * @CDP_HIST_TYPE_HW_TX_COMP_DELAY: Tx completion delay based on the timestamp 66 * provided by HW 67 * @CDP_HIST_TYPE_DELAY_PERCENTILE: Tx completion delay based on the perctile 68 */ 69 enum cdp_hist_types { 70 CDP_HIST_TYPE_SW_ENQEUE_DELAY, 71 CDP_HIST_TYPE_HW_COMP_DELAY, 72 CDP_HIST_TYPE_REAP_STACK, 73 CDP_HIST_TYPE_HW_TX_COMP_DELAY, 74 CDP_HIST_TYPE_DELAY_PERCENTILE, 75 CDP_HIST_TYPE_MAX, 76 }; 77 78 /* 79 * cdp_hist_bucket: Histogram Bucket 80 * @hist_type: Histogram type 81 * @freq: Frequency 82 */ 83 struct cdp_hist_bucket { 84 enum cdp_hist_types hist_type; 85 uint64_t freq[CDP_HIST_BUCKET_MAX]; 86 }; 87 88 /* 89 * cdp_hist_stats : Histogram of a stats type 90 * @hist: Frequency distribution 91 * @max: Max frequency 92 * @min: Minimum frequency 93 * @avg: Average frequency 94 */ 95 struct cdp_hist_stats { 96 struct cdp_hist_bucket hist; 97 int max; 98 int min; 99 int avg; 100 }; 101 #endif /* _CDP_TXRX_HIST_STRUCT_H_ */ 102