Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
0002 /*
0003  * Copyright(c) 2018 Intel Corporation.
0004  */
0005 
0006 #ifndef _HFI1_FAULT_H
0007 #define _HFI1_FAULT_H
0008 
0009 #include <linux/fault-inject.h>
0010 #include <linux/dcache.h>
0011 #include <linux/bitops.h>
0012 #include <linux/kernel.h>
0013 #include <rdma/rdma_vt.h>
0014 
0015 #include "hfi.h"
0016 
0017 struct hfi1_ibdev;
0018 
0019 #if defined(CONFIG_FAULT_INJECTION) && defined(CONFIG_FAULT_INJECTION_DEBUG_FS)
0020 struct fault {
0021     struct fault_attr attr;
0022     struct dentry *dir;
0023     u64 n_rxfaults[(1U << BITS_PER_BYTE)];
0024     u64 n_txfaults[(1U << BITS_PER_BYTE)];
0025     u64 fault_skip;
0026     u64 skip;
0027     u64 fault_skip_usec;
0028     unsigned long skip_usec;
0029     unsigned long opcodes[(1U << BITS_PER_BYTE) / BITS_PER_LONG];
0030     bool enable;
0031     bool suppress_err;
0032     bool opcode;
0033     u8 direction;
0034 };
0035 
0036 int hfi1_fault_init_debugfs(struct hfi1_ibdev *ibd);
0037 bool hfi1_dbg_should_fault_tx(struct rvt_qp *qp, u32 opcode);
0038 bool hfi1_dbg_should_fault_rx(struct hfi1_packet *packet);
0039 bool hfi1_dbg_fault_suppress_err(struct hfi1_ibdev *ibd);
0040 void hfi1_fault_exit_debugfs(struct hfi1_ibdev *ibd);
0041 
0042 #else
0043 
0044 static inline int hfi1_fault_init_debugfs(struct hfi1_ibdev *ibd)
0045 {
0046     return 0;
0047 }
0048 
0049 static inline bool hfi1_dbg_should_fault_rx(struct hfi1_packet *packet)
0050 {
0051     return false;
0052 }
0053 
0054 static inline bool hfi1_dbg_should_fault_tx(struct rvt_qp *qp,
0055                         u32 opcode)
0056 {
0057     return false;
0058 }
0059 
0060 static inline bool hfi1_dbg_fault_suppress_err(struct hfi1_ibdev *ibd)
0061 {
0062     return false;
0063 }
0064 
0065 static inline void hfi1_fault_exit_debugfs(struct hfi1_ibdev *ibd)
0066 {
0067 }
0068 #endif
0069 #endif /* _HFI1_FAULT_H */