18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci* Copyright(c) 2015 - 2020 Intel Corporation. 38c2ecf20Sopenharmony_ci* 48c2ecf20Sopenharmony_ci* This file is provided under a dual BSD/GPLv2 license. When using or 58c2ecf20Sopenharmony_ci* redistributing this file, you may do so under either license. 68c2ecf20Sopenharmony_ci* 78c2ecf20Sopenharmony_ci* GPL LICENSE SUMMARY 88c2ecf20Sopenharmony_ci* 98c2ecf20Sopenharmony_ci* This program is free software; you can redistribute it and/or modify 108c2ecf20Sopenharmony_ci* it under the terms of version 2 of the GNU General Public License as 118c2ecf20Sopenharmony_ci* published by the Free Software Foundation. 128c2ecf20Sopenharmony_ci* 138c2ecf20Sopenharmony_ci* This program is distributed in the hope that it will be useful, but 148c2ecf20Sopenharmony_ci* WITHOUT ANY WARRANTY; without even the implied warranty of 158c2ecf20Sopenharmony_ci* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 168c2ecf20Sopenharmony_ci* General Public License for more details. 178c2ecf20Sopenharmony_ci* 188c2ecf20Sopenharmony_ci* BSD LICENSE 198c2ecf20Sopenharmony_ci* 208c2ecf20Sopenharmony_ci* Redistribution and use in source and binary forms, with or without 218c2ecf20Sopenharmony_ci* modification, are permitted provided that the following conditions 228c2ecf20Sopenharmony_ci* are met: 238c2ecf20Sopenharmony_ci* 248c2ecf20Sopenharmony_ci* - Redistributions of source code must retain the above copyright 258c2ecf20Sopenharmony_ci* notice, this list of conditions and the following disclaimer. 268c2ecf20Sopenharmony_ci* - Redistributions in binary form must reproduce the above copyright 278c2ecf20Sopenharmony_ci* notice, this list of conditions and the following disclaimer in 288c2ecf20Sopenharmony_ci* the documentation and/or other materials provided with the 298c2ecf20Sopenharmony_ci* distribution. 308c2ecf20Sopenharmony_ci* - Neither the name of Intel Corporation nor the names of its 318c2ecf20Sopenharmony_ci* contributors may be used to endorse or promote products derived 328c2ecf20Sopenharmony_ci* from this software without specific prior written permission. 338c2ecf20Sopenharmony_ci* 348c2ecf20Sopenharmony_ci* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 358c2ecf20Sopenharmony_ci* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 368c2ecf20Sopenharmony_ci* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 378c2ecf20Sopenharmony_ci* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 388c2ecf20Sopenharmony_ci* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 398c2ecf20Sopenharmony_ci* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 408c2ecf20Sopenharmony_ci* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 418c2ecf20Sopenharmony_ci* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 428c2ecf20Sopenharmony_ci* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 438c2ecf20Sopenharmony_ci* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 448c2ecf20Sopenharmony_ci* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 458c2ecf20Sopenharmony_ci* 468c2ecf20Sopenharmony_ci*/ 478c2ecf20Sopenharmony_ci#if !defined(__HFI1_TRACE_CTXTS_H) || defined(TRACE_HEADER_MULTI_READ) 488c2ecf20Sopenharmony_ci#define __HFI1_TRACE_CTXTS_H 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci#include <linux/tracepoint.h> 518c2ecf20Sopenharmony_ci#include <linux/trace_seq.h> 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#include "hfi.h" 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci#undef TRACE_SYSTEM 568c2ecf20Sopenharmony_ci#define TRACE_SYSTEM hfi1_ctxts 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci#define UCTXT_FMT \ 598c2ecf20Sopenharmony_ci "cred:%u, credaddr:0x%llx, piobase:0x%p, rcvhdr_cnt:%u, " \ 608c2ecf20Sopenharmony_ci "rcvbase:0x%llx, rcvegrc:%u, rcvegrb:0x%llx, subctxt_cnt:%u" 618c2ecf20Sopenharmony_ciTRACE_EVENT(hfi1_uctxtdata, 628c2ecf20Sopenharmony_ci TP_PROTO(struct hfi1_devdata *dd, struct hfi1_ctxtdata *uctxt, 638c2ecf20Sopenharmony_ci unsigned int subctxt), 648c2ecf20Sopenharmony_ci TP_ARGS(dd, uctxt, subctxt), 658c2ecf20Sopenharmony_ci TP_STRUCT__entry(DD_DEV_ENTRY(dd) 668c2ecf20Sopenharmony_ci __field(unsigned int, ctxt) 678c2ecf20Sopenharmony_ci __field(unsigned int, subctxt) 688c2ecf20Sopenharmony_ci __field(u32, credits) 698c2ecf20Sopenharmony_ci __field(u64, hw_free) 708c2ecf20Sopenharmony_ci __field(void __iomem *, piobase) 718c2ecf20Sopenharmony_ci __field(u16, rcvhdrq_cnt) 728c2ecf20Sopenharmony_ci __field(u64, rcvhdrq_dma) 738c2ecf20Sopenharmony_ci __field(u32, eager_cnt) 748c2ecf20Sopenharmony_ci __field(u64, rcvegr_dma) 758c2ecf20Sopenharmony_ci __field(unsigned int, subctxt_cnt) 768c2ecf20Sopenharmony_ci ), 778c2ecf20Sopenharmony_ci TP_fast_assign(DD_DEV_ASSIGN(dd); 788c2ecf20Sopenharmony_ci __entry->ctxt = uctxt->ctxt; 798c2ecf20Sopenharmony_ci __entry->subctxt = subctxt; 808c2ecf20Sopenharmony_ci __entry->credits = uctxt->sc->credits; 818c2ecf20Sopenharmony_ci __entry->hw_free = le64_to_cpu(*uctxt->sc->hw_free); 828c2ecf20Sopenharmony_ci __entry->piobase = uctxt->sc->base_addr; 838c2ecf20Sopenharmony_ci __entry->rcvhdrq_cnt = get_hdrq_cnt(uctxt); 848c2ecf20Sopenharmony_ci __entry->rcvhdrq_dma = uctxt->rcvhdrq_dma; 858c2ecf20Sopenharmony_ci __entry->eager_cnt = uctxt->egrbufs.alloced; 868c2ecf20Sopenharmony_ci __entry->rcvegr_dma = uctxt->egrbufs.rcvtids[0].dma; 878c2ecf20Sopenharmony_ci __entry->subctxt_cnt = uctxt->subctxt_cnt; 888c2ecf20Sopenharmony_ci ), 898c2ecf20Sopenharmony_ci TP_printk("[%s] ctxt %u:%u " UCTXT_FMT, 908c2ecf20Sopenharmony_ci __get_str(dev), 918c2ecf20Sopenharmony_ci __entry->ctxt, 928c2ecf20Sopenharmony_ci __entry->subctxt, 938c2ecf20Sopenharmony_ci __entry->credits, 948c2ecf20Sopenharmony_ci __entry->hw_free, 958c2ecf20Sopenharmony_ci __entry->piobase, 968c2ecf20Sopenharmony_ci __entry->rcvhdrq_cnt, 978c2ecf20Sopenharmony_ci __entry->rcvhdrq_dma, 988c2ecf20Sopenharmony_ci __entry->eager_cnt, 998c2ecf20Sopenharmony_ci __entry->rcvegr_dma, 1008c2ecf20Sopenharmony_ci __entry->subctxt_cnt 1018c2ecf20Sopenharmony_ci ) 1028c2ecf20Sopenharmony_ci); 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci#define CINFO_FMT \ 1058c2ecf20Sopenharmony_ci "egrtids:%u, egr_size:%u, hdrq_cnt:%u, hdrq_size:%u, sdma_ring_size:%u" 1068c2ecf20Sopenharmony_ciTRACE_EVENT(hfi1_ctxt_info, 1078c2ecf20Sopenharmony_ci TP_PROTO(struct hfi1_devdata *dd, unsigned int ctxt, 1088c2ecf20Sopenharmony_ci unsigned int subctxt, 1098c2ecf20Sopenharmony_ci struct hfi1_ctxt_info *cinfo), 1108c2ecf20Sopenharmony_ci TP_ARGS(dd, ctxt, subctxt, cinfo), 1118c2ecf20Sopenharmony_ci TP_STRUCT__entry(DD_DEV_ENTRY(dd) 1128c2ecf20Sopenharmony_ci __field(unsigned int, ctxt) 1138c2ecf20Sopenharmony_ci __field(unsigned int, subctxt) 1148c2ecf20Sopenharmony_ci __field(u16, egrtids) 1158c2ecf20Sopenharmony_ci __field(u16, rcvhdrq_cnt) 1168c2ecf20Sopenharmony_ci __field(u16, rcvhdrq_size) 1178c2ecf20Sopenharmony_ci __field(u16, sdma_ring_size) 1188c2ecf20Sopenharmony_ci __field(u32, rcvegr_size) 1198c2ecf20Sopenharmony_ci ), 1208c2ecf20Sopenharmony_ci TP_fast_assign(DD_DEV_ASSIGN(dd); 1218c2ecf20Sopenharmony_ci __entry->ctxt = ctxt; 1228c2ecf20Sopenharmony_ci __entry->subctxt = subctxt; 1238c2ecf20Sopenharmony_ci __entry->egrtids = cinfo->egrtids; 1248c2ecf20Sopenharmony_ci __entry->rcvhdrq_cnt = cinfo->rcvhdrq_cnt; 1258c2ecf20Sopenharmony_ci __entry->rcvhdrq_size = cinfo->rcvhdrq_entsize; 1268c2ecf20Sopenharmony_ci __entry->sdma_ring_size = cinfo->sdma_ring_size; 1278c2ecf20Sopenharmony_ci __entry->rcvegr_size = cinfo->rcvegr_size; 1288c2ecf20Sopenharmony_ci ), 1298c2ecf20Sopenharmony_ci TP_printk("[%s] ctxt %u:%u " CINFO_FMT, 1308c2ecf20Sopenharmony_ci __get_str(dev), 1318c2ecf20Sopenharmony_ci __entry->ctxt, 1328c2ecf20Sopenharmony_ci __entry->subctxt, 1338c2ecf20Sopenharmony_ci __entry->egrtids, 1348c2ecf20Sopenharmony_ci __entry->rcvegr_size, 1358c2ecf20Sopenharmony_ci __entry->rcvhdrq_cnt, 1368c2ecf20Sopenharmony_ci __entry->rcvhdrq_size, 1378c2ecf20Sopenharmony_ci __entry->sdma_ring_size 1388c2ecf20Sopenharmony_ci ) 1398c2ecf20Sopenharmony_ci); 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ciconst char *hfi1_trace_print_rsm_hist(struct trace_seq *p, unsigned int ctxt); 1428c2ecf20Sopenharmony_ciTRACE_EVENT(ctxt_rsm_hist, 1438c2ecf20Sopenharmony_ci TP_PROTO(unsigned int ctxt), 1448c2ecf20Sopenharmony_ci TP_ARGS(ctxt), 1458c2ecf20Sopenharmony_ci TP_STRUCT__entry(__field(unsigned int, ctxt)), 1468c2ecf20Sopenharmony_ci TP_fast_assign(__entry->ctxt = ctxt;), 1478c2ecf20Sopenharmony_ci TP_printk("%s", hfi1_trace_print_rsm_hist(p, __entry->ctxt)) 1488c2ecf20Sopenharmony_ci); 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci#endif /* __HFI1_TRACE_CTXTS_H */ 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci#undef TRACE_INCLUDE_PATH 1538c2ecf20Sopenharmony_ci#undef TRACE_INCLUDE_FILE 1548c2ecf20Sopenharmony_ci#define TRACE_INCLUDE_PATH . 1558c2ecf20Sopenharmony_ci#define TRACE_INCLUDE_FILE trace_ctxts 1568c2ecf20Sopenharmony_ci#include <trace/define_trace.h> 157