Lines Matching +full:dual +full:- +full:direction
4 * This file is provided under a dual BSD/GPLv2 license. When using or
24 * - Redistributions of source code must retain the above copyright
26 * - Redistributions in binary form must reproduce the above copyright
30 * - Neither the name of Intel Corporation nor the names of its
66 if (*pos >= ARRAY_SIZE(opstats->stats)) in _fault_stats_seq_start()
76 if (*pos >= ARRAY_SIZE(opstats->stats)) in _fault_stats_seq_next()
90 struct hfi1_ibdev *ibd = (struct hfi1_ibdev *)s->private; in _fault_stats_seq_show()
94 for (j = 0; j < dd->first_dyn_alloc_ctxt; j++) { in _fault_stats_seq_show()
97 n_packets += rcd->opstats->stats[i].n_packets; in _fault_stats_seq_show()
98 n_bytes += rcd->opstats->stats[i].n_bytes; in _fault_stats_seq_show()
104 per_cpu_ptr(dd->tx_opstats, j); in _fault_stats_seq_show()
106 n_packets += sp->stats[i].n_packets; in _fault_stats_seq_show()
107 n_bytes += sp->stats[i].n_bytes; in _fault_stats_seq_show()
111 if (!ibd->fault->n_rxfaults[i] && !ibd->fault->n_txfaults[i]) in _fault_stats_seq_show()
116 (unsigned long long)ibd->fault->n_rxfaults[i], in _fault_stats_seq_show()
117 (unsigned long long)ibd->fault->n_txfaults[i]); in _fault_stats_seq_show()
127 file->private_data = inode->i_private; in fault_opcodes_open()
138 struct fault *fault = file->private_data; in fault_opcodes_write()
142 return -ENOMEM; in fault_opcodes_write()
143 copy = min(len, datalen - 1); in fault_opcodes_write()
145 ret = -EFAULT; in fault_opcodes_write()
149 ret = debugfs_file_get(file->f_path.dentry); in fault_opcodes_write()
163 if (token[0] == '-') { in fault_opcodes_write()
167 dash = strchr(token, '-'); in fault_opcodes_write()
179 if (range_start == range_end && range_start == -1UL) { in fault_opcodes_write()
180 bitmap_zero(fault->opcodes, sizeof(fault->opcodes) * in fault_opcodes_write()
190 clear_bit(i, fault->opcodes); in fault_opcodes_write()
192 set_bit(i, fault->opcodes); in fault_opcodes_write()
199 debugfs_file_put(file->f_path.dentry); in fault_opcodes_write()
212 struct fault *fault = file->private_data; in fault_opcodes_read()
213 size_t bitsize = sizeof(fault->opcodes) * BITS_PER_BYTE; in fault_opcodes_read()
217 return -ENOMEM; in fault_opcodes_read()
218 ret = debugfs_file_get(file->f_path.dentry); in fault_opcodes_read()
221 bit = find_first_bit(fault->opcodes, bitsize); in fault_opcodes_read()
223 zero = find_next_zero_bit(fault->opcodes, bitsize, bit); in fault_opcodes_read()
224 if (zero - 1 != bit) in fault_opcodes_read()
226 datalen - size - 1, in fault_opcodes_read()
227 "0x%lx-0x%lx,", bit, zero - 1); in fault_opcodes_read()
230 datalen - size - 1, "0x%lx,", in fault_opcodes_read()
232 bit = find_next_bit(fault->opcodes, bitsize, zero); in fault_opcodes_read()
234 debugfs_file_put(file->f_path.dentry); in fault_opcodes_read()
235 data[size - 1] = '\n'; in fault_opcodes_read()
253 if (ibd->fault) in hfi1_fault_exit_debugfs()
254 debugfs_remove_recursive(ibd->fault->dir); in hfi1_fault_exit_debugfs()
255 kfree(ibd->fault); in hfi1_fault_exit_debugfs()
256 ibd->fault = NULL; in hfi1_fault_exit_debugfs()
261 struct dentry *parent = ibd->hfi1_ibdev_dbg; in hfi1_fault_init_debugfs()
264 ibd->fault = kzalloc(sizeof(*ibd->fault), GFP_KERNEL); in hfi1_fault_init_debugfs()
265 if (!ibd->fault) in hfi1_fault_init_debugfs()
266 return -ENOMEM; in hfi1_fault_init_debugfs()
268 ibd->fault->attr.interval = 1; in hfi1_fault_init_debugfs()
269 ibd->fault->attr.require_end = ULONG_MAX; in hfi1_fault_init_debugfs()
270 ibd->fault->attr.stacktrace_depth = 32; in hfi1_fault_init_debugfs()
271 ibd->fault->attr.dname = NULL; in hfi1_fault_init_debugfs()
272 ibd->fault->attr.verbose = 0; in hfi1_fault_init_debugfs()
273 ibd->fault->enable = false; in hfi1_fault_init_debugfs()
274 ibd->fault->opcode = false; in hfi1_fault_init_debugfs()
275 ibd->fault->fault_skip = 0; in hfi1_fault_init_debugfs()
276 ibd->fault->skip = 0; in hfi1_fault_init_debugfs()
277 ibd->fault->direction = HFI1_FAULT_DIR_TXRX; in hfi1_fault_init_debugfs()
278 ibd->fault->suppress_err = false; in hfi1_fault_init_debugfs()
279 bitmap_zero(ibd->fault->opcodes, in hfi1_fault_init_debugfs()
280 sizeof(ibd->fault->opcodes) * BITS_PER_BYTE); in hfi1_fault_init_debugfs()
283 fault_create_debugfs_attr("fault", parent, &ibd->fault->attr); in hfi1_fault_init_debugfs()
285 kfree(ibd->fault); in hfi1_fault_init_debugfs()
286 ibd->fault = NULL; in hfi1_fault_init_debugfs()
287 return -ENOENT; in hfi1_fault_init_debugfs()
289 ibd->fault->dir = fault_dir; in hfi1_fault_init_debugfs()
293 debugfs_create_bool("enable", 0600, fault_dir, &ibd->fault->enable); in hfi1_fault_init_debugfs()
295 &ibd->fault->suppress_err); in hfi1_fault_init_debugfs()
297 &ibd->fault->opcode); in hfi1_fault_init_debugfs()
298 debugfs_create_file("opcodes", 0600, fault_dir, ibd->fault, in hfi1_fault_init_debugfs()
301 &ibd->fault->fault_skip); in hfi1_fault_init_debugfs()
303 &ibd->fault->fault_skip_usec); in hfi1_fault_init_debugfs()
304 debugfs_create_u8("direction", 0600, fault_dir, &ibd->fault->direction); in hfi1_fault_init_debugfs()
311 if (ibd->fault) in hfi1_dbg_fault_suppress_err()
312 return ibd->fault->suppress_err; in hfi1_dbg_fault_suppress_err()
317 u8 direction) in __hfi1_should_fault() argument
321 if (!ibd->fault || !ibd->fault->enable) in __hfi1_should_fault()
323 if (!(ibd->fault->direction & direction)) in __hfi1_should_fault()
325 if (ibd->fault->opcode) { in __hfi1_should_fault()
326 if (bitmap_empty(ibd->fault->opcodes, in __hfi1_should_fault()
327 (sizeof(ibd->fault->opcodes) * in __hfi1_should_fault()
330 if (!(test_bit(opcode, ibd->fault->opcodes))) in __hfi1_should_fault()
333 if (ibd->fault->fault_skip_usec && in __hfi1_should_fault()
334 time_before(jiffies, ibd->fault->skip_usec)) in __hfi1_should_fault()
336 if (ibd->fault->fault_skip && ibd->fault->skip) { in __hfi1_should_fault()
337 ibd->fault->skip--; in __hfi1_should_fault()
340 ret = should_fail(&ibd->fault->attr, 1); in __hfi1_should_fault()
342 ibd->fault->skip = ibd->fault->fault_skip; in __hfi1_should_fault()
343 ibd->fault->skip_usec = jiffies + in __hfi1_should_fault()
344 usecs_to_jiffies(ibd->fault->fault_skip_usec); in __hfi1_should_fault()
351 struct hfi1_ibdev *ibd = to_idev(qp->ibqp.device); in hfi1_dbg_should_fault_tx()
355 ibd->fault->n_txfaults[opcode]++; in hfi1_dbg_should_fault_tx()
363 struct hfi1_ibdev *ibd = &packet->rcd->dd->verbs_dev; in hfi1_dbg_should_fault_rx()
365 if (__hfi1_should_fault(ibd, packet->opcode, HFI1_FAULT_DIR_RX)) { in hfi1_dbg_should_fault_rx()
367 ibd->fault->n_rxfaults[packet->opcode]++; in hfi1_dbg_should_fault_rx()