xref: /openbmc/linux/drivers/infiniband/sw/rdmavt/vt.h (revision 234489ac)
1 /* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
2 /*
3  * Copyright(c) 2016 Intel Corporation.
4  */
5 
6 #ifndef DEF_RDMAVT_H
7 #define DEF_RDMAVT_H
8 
9 #include <rdma/rdma_vt.h>
10 #include <linux/pci.h>
11 #include "pd.h"
12 #include "qp.h"
13 #include "ah.h"
14 #include "mr.h"
15 #include "srq.h"
16 #include "mcast.h"
17 #include "mmap.h"
18 #include "cq.h"
19 #include "mad.h"
20 
21 #define rvt_pr_info(rdi, fmt, ...) \
22 	__rvt_pr_info(rdi->driver_f.get_pci_dev(rdi), \
23 		      rvt_get_ibdev_name(rdi), \
24 		      fmt, \
25 		      ##__VA_ARGS__)
26 
27 #define rvt_pr_warn(rdi, fmt, ...) \
28 	__rvt_pr_warn(rdi->driver_f.get_pci_dev(rdi), \
29 		      rvt_get_ibdev_name(rdi), \
30 		      fmt, \
31 		      ##__VA_ARGS__)
32 
33 #define rvt_pr_err(rdi, fmt, ...) \
34 	__rvt_pr_err(rdi->driver_f.get_pci_dev(rdi), \
35 		     rvt_get_ibdev_name(rdi), \
36 		     fmt, \
37 		     ##__VA_ARGS__)
38 
39 #define rvt_pr_err_ratelimited(rdi, fmt, ...) \
40 	__rvt_pr_err_ratelimited((rdi)->driver_f.get_pci_dev(rdi), \
41 				 rvt_get_ibdev_name(rdi), \
42 				 fmt, \
43 				 ##__VA_ARGS__)
44 
45 #define __rvt_pr_info(pdev, name, fmt, ...) \
46 	dev_info(&pdev->dev, "%s: " fmt, name, ##__VA_ARGS__)
47 
48 #define __rvt_pr_warn(pdev, name, fmt, ...) \
49 	dev_warn(&pdev->dev, "%s: " fmt, name, ##__VA_ARGS__)
50 
51 #define __rvt_pr_err(pdev, name, fmt, ...) \
52 	dev_err(&pdev->dev, "%s: " fmt, name, ##__VA_ARGS__)
53 
54 #define __rvt_pr_err_ratelimited(pdev, name, fmt, ...) \
55 	dev_err_ratelimited(&(pdev)->dev, "%s: " fmt, name, ##__VA_ARGS__)
56 
57 static inline u32 ibport_num_to_idx(struct ib_device *ibdev, u32 port_num)
58 {
59 	return port_num - 1; /* IB ports start at 1 our arrays at 0 */
60 }
61 
62 #endif          /* DEF_RDMAVT_H */
63