Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / infiniband / hw / hfi1 / fault.h
blob51adafe240d77c7a9868300af0de5e1b9970302c
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /*
3 * Copyright(c) 2018 Intel Corporation.
4 */
6 #ifndef _HFI1_FAULT_H
7 #define _HFI1_FAULT_H
9 #include <linux/fault-inject.h>
10 #include <linux/dcache.h>
11 #include <linux/bitops.h>
12 #include <linux/kernel.h>
13 #include <rdma/rdma_vt.h>
15 #include "hfi.h"
17 struct hfi1_ibdev;
19 #if defined(CONFIG_FAULT_INJECTION) && defined(CONFIG_FAULT_INJECTION_DEBUG_FS)
20 struct fault {
21 struct fault_attr attr;
22 struct dentry *dir;
23 u64 n_rxfaults[(1U << BITS_PER_BYTE)];
24 u64 n_txfaults[(1U << BITS_PER_BYTE)];
25 u64 fault_skip;
26 u64 skip;
27 u64 fault_skip_usec;
28 unsigned long skip_usec;
29 unsigned long opcodes[(1U << BITS_PER_BYTE) / BITS_PER_LONG];
30 bool enable;
31 bool suppress_err;
32 bool opcode;
33 u8 direction;
36 int hfi1_fault_init_debugfs(struct hfi1_ibdev *ibd);
37 bool hfi1_dbg_should_fault_tx(struct rvt_qp *qp, u32 opcode);
38 bool hfi1_dbg_should_fault_rx(struct hfi1_packet *packet);
39 bool hfi1_dbg_fault_suppress_err(struct hfi1_ibdev *ibd);
40 void hfi1_fault_exit_debugfs(struct hfi1_ibdev *ibd);
42 #else
44 static inline int hfi1_fault_init_debugfs(struct hfi1_ibdev *ibd)
46 return 0;
49 static inline bool hfi1_dbg_should_fault_rx(struct hfi1_packet *packet)
51 return false;
54 static inline bool hfi1_dbg_should_fault_tx(struct rvt_qp *qp,
55 u32 opcode)
57 return false;
60 static inline bool hfi1_dbg_fault_suppress_err(struct hfi1_ibdev *ibd)
62 return false;
65 static inline void hfi1_fault_exit_debugfs(struct hfi1_ibdev *ibd)
68 #endif
69 #endif /* _HFI1_FAULT_H */