aboutsummaryrefslogtreecommitdiffstats
path: root/include/rdma/ib_verbs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/rdma/ib_verbs.h')
-rw-r--r--include/rdma/ib_verbs.h84
1 files changed, 60 insertions, 24 deletions
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index fd84cda5ed7c..73b2387e3f74 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -63,6 +63,7 @@
63#include <linux/uaccess.h> 63#include <linux/uaccess.h>
64#include <linux/cgroup_rdma.h> 64#include <linux/cgroup_rdma.h>
65#include <uapi/rdma/ib_user_verbs.h> 65#include <uapi/rdma/ib_user_verbs.h>
66#include <rdma/restrack.h>
66 67
67#define IB_FW_VERSION_NAME_MAX ETHTOOL_FWVERS_LEN 68#define IB_FW_VERSION_NAME_MAX ETHTOOL_FWVERS_LEN
68 69
@@ -300,11 +301,6 @@ struct ib_tm_caps {
300 u32 max_sge; 301 u32 max_sge;
301}; 302};
302 303
303enum ib_cq_creation_flags {
304 IB_CQ_FLAGS_TIMESTAMP_COMPLETION = 1 << 0,
305 IB_CQ_FLAGS_IGNORE_OVERRUN = 1 << 1,
306};
307
308struct ib_cq_init_attr { 304struct ib_cq_init_attr {
309 unsigned int cqe; 305 unsigned int cqe;
310 int comp_vector; 306 int comp_vector;
@@ -878,6 +874,7 @@ struct ib_mr_status {
878__attribute_const__ enum ib_rate mult_to_ib_rate(int mult); 874__attribute_const__ enum ib_rate mult_to_ib_rate(int mult);
879 875
880enum rdma_ah_attr_type { 876enum rdma_ah_attr_type {
877 RDMA_AH_ATTR_TYPE_UNDEFINED,
881 RDMA_AH_ATTR_TYPE_IB, 878 RDMA_AH_ATTR_TYPE_IB,
882 RDMA_AH_ATTR_TYPE_ROCE, 879 RDMA_AH_ATTR_TYPE_ROCE,
883 RDMA_AH_ATTR_TYPE_OPA, 880 RDMA_AH_ATTR_TYPE_OPA,
@@ -983,9 +980,9 @@ struct ib_wc {
983 u32 invalidate_rkey; 980 u32 invalidate_rkey;
984 } ex; 981 } ex;
985 u32 src_qp; 982 u32 src_qp;
983 u32 slid;
986 int wc_flags; 984 int wc_flags;
987 u16 pkey_index; 985 u16 pkey_index;
988 u32 slid;
989 u8 sl; 986 u8 sl;
990 u8 dlid_path_bits; 987 u8 dlid_path_bits;
991 u8 port_num; /* valid only for DR SMPs on switches */ 988 u8 port_num; /* valid only for DR SMPs on switches */
@@ -1082,6 +1079,7 @@ enum ib_qp_type {
1082 IB_QPT_XRC_INI = 9, 1079 IB_QPT_XRC_INI = 9,
1083 IB_QPT_XRC_TGT, 1080 IB_QPT_XRC_TGT,
1084 IB_QPT_MAX, 1081 IB_QPT_MAX,
1082 IB_QPT_DRIVER = 0xFF,
1085 /* Reserve a range for qp types internal to the low level driver. 1083 /* Reserve a range for qp types internal to the low level driver.
1086 * These qp types will not be visible at the IB core layer, so the 1084 * These qp types will not be visible at the IB core layer, so the
1087 * IB_QPT_MAX usages should not be affected in the core layer 1085 * IB_QPT_MAX usages should not be affected in the core layer
@@ -1529,6 +1527,7 @@ struct ib_pd {
1529 * Implementation details of the RDMA core, don't use in drivers: 1527 * Implementation details of the RDMA core, don't use in drivers:
1530 */ 1528 */
1531 struct ib_mr *__internal_mr; 1529 struct ib_mr *__internal_mr;
1530 struct rdma_restrack_entry res;
1532}; 1531};
1533 1532
1534struct ib_xrcd { 1533struct ib_xrcd {
@@ -1538,6 +1537,10 @@ struct ib_xrcd {
1538 1537
1539 struct mutex tgt_qp_mutex; 1538 struct mutex tgt_qp_mutex;
1540 struct list_head tgt_qp_list; 1539 struct list_head tgt_qp_list;
1540 /*
1541 * Implementation details of the RDMA core, don't use in drivers:
1542 */
1543 struct rdma_restrack_entry res;
1541}; 1544};
1542 1545
1543struct ib_ah { 1546struct ib_ah {
@@ -1569,6 +1572,10 @@ struct ib_cq {
1569 struct irq_poll iop; 1572 struct irq_poll iop;
1570 struct work_struct work; 1573 struct work_struct work;
1571 }; 1574 };
1575 /*
1576 * Implementation details of the RDMA core, don't use in drivers:
1577 */
1578 struct rdma_restrack_entry res;
1572}; 1579};
1573 1580
1574struct ib_srq { 1581struct ib_srq {
@@ -1745,6 +1752,11 @@ struct ib_qp {
1745 struct ib_rwq_ind_table *rwq_ind_tbl; 1752 struct ib_rwq_ind_table *rwq_ind_tbl;
1746 struct ib_qp_security *qp_sec; 1753 struct ib_qp_security *qp_sec;
1747 u8 port; 1754 u8 port;
1755
1756 /*
1757 * Implementation details of the RDMA core, don't use in drivers:
1758 */
1759 struct rdma_restrack_entry res;
1748}; 1760};
1749 1761
1750struct ib_mr { 1762struct ib_mr {
@@ -2351,6 +2363,10 @@ struct ib_device {
2351#endif 2363#endif
2352 2364
2353 u32 index; 2365 u32 index;
2366 /*
2367 * Implementation details of the RDMA core, don't use in drivers
2368 */
2369 struct rdma_restrack_root res;
2354 2370
2355 /** 2371 /**
2356 * The following mandatory functions are used only at device 2372 * The following mandatory functions are used only at device
@@ -2836,8 +2852,7 @@ int ib_modify_port(struct ib_device *device,
2836 struct ib_port_modify *port_modify); 2852 struct ib_port_modify *port_modify);
2837 2853
2838int ib_find_gid(struct ib_device *device, union ib_gid *gid, 2854int ib_find_gid(struct ib_device *device, union ib_gid *gid,
2839 enum ib_gid_type gid_type, struct net_device *ndev, 2855 struct net_device *ndev, u8 *port_num, u16 *index);
2840 u8 *port_num, u16 *index);
2841 2856
2842int ib_find_pkey(struct ib_device *device, 2857int ib_find_pkey(struct ib_device *device,
2843 u8 port_num, u16 pkey, u16 *index); 2858 u8 port_num, u16 pkey, u16 *index);
@@ -2858,7 +2873,7 @@ enum ib_pd_flags {
2858struct ib_pd *__ib_alloc_pd(struct ib_device *device, unsigned int flags, 2873struct ib_pd *__ib_alloc_pd(struct ib_device *device, unsigned int flags,
2859 const char *caller); 2874 const char *caller);
2860#define ib_alloc_pd(device, flags) \ 2875#define ib_alloc_pd(device, flags) \
2861 __ib_alloc_pd((device), (flags), __func__) 2876 __ib_alloc_pd((device), (flags), KBUILD_MODNAME)
2862void ib_dealloc_pd(struct ib_pd *pd); 2877void ib_dealloc_pd(struct ib_pd *pd);
2863 2878
2864/** 2879/**
@@ -2905,7 +2920,7 @@ int ib_get_gids_from_rdma_hdr(const union rdma_network_hdr *hdr,
2905int ib_get_rdma_header_version(const union rdma_network_hdr *hdr); 2920int ib_get_rdma_header_version(const union rdma_network_hdr *hdr);
2906 2921
2907/** 2922/**
2908 * ib_init_ah_from_wc - Initializes address handle attributes from a 2923 * ib_init_ah_attr_from_wc - Initializes address handle attributes from a
2909 * work completion. 2924 * work completion.
2910 * @device: Device on which the received message arrived. 2925 * @device: Device on which the received message arrived.
2911 * @port_num: Port on which the received message arrived. 2926 * @port_num: Port on which the received message arrived.
@@ -2915,9 +2930,9 @@ int ib_get_rdma_header_version(const union rdma_network_hdr *hdr);
2915 * @ah_attr: Returned attributes that can be used when creating an address 2930 * @ah_attr: Returned attributes that can be used when creating an address
2916 * handle for replying to the message. 2931 * handle for replying to the message.
2917 */ 2932 */
2918int ib_init_ah_from_wc(struct ib_device *device, u8 port_num, 2933int ib_init_ah_attr_from_wc(struct ib_device *device, u8 port_num,
2919 const struct ib_wc *wc, const struct ib_grh *grh, 2934 const struct ib_wc *wc, const struct ib_grh *grh,
2920 struct rdma_ah_attr *ah_attr); 2935 struct rdma_ah_attr *ah_attr);
2921 2936
2922/** 2937/**
2923 * ib_create_ah_from_wc - Creates an address handle associated with the 2938 * ib_create_ah_from_wc - Creates an address handle associated with the
@@ -3135,8 +3150,12 @@ static inline int ib_post_recv(struct ib_qp *qp,
3135 return qp->device->post_recv(qp, recv_wr, bad_recv_wr); 3150 return qp->device->post_recv(qp, recv_wr, bad_recv_wr);
3136} 3151}
3137 3152
3138struct ib_cq *ib_alloc_cq(struct ib_device *dev, void *private, 3153struct ib_cq *__ib_alloc_cq(struct ib_device *dev, void *private,
3139 int nr_cqe, int comp_vector, enum ib_poll_context poll_ctx); 3154 int nr_cqe, int comp_vector,
3155 enum ib_poll_context poll_ctx, const char *caller);
3156#define ib_alloc_cq(device, priv, nr_cqe, comp_vect, poll_ctx) \
3157 __ib_alloc_cq((device), (priv), (nr_cqe), (comp_vect), (poll_ctx), KBUILD_MODNAME)
3158
3140void ib_free_cq(struct ib_cq *cq); 3159void ib_free_cq(struct ib_cq *cq);
3141int ib_process_cq_direct(struct ib_cq *cq, int budget); 3160int ib_process_cq_direct(struct ib_cq *cq, int budget);
3142 3161
@@ -3560,8 +3579,11 @@ int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid);
3560/** 3579/**
3561 * ib_alloc_xrcd - Allocates an XRC domain. 3580 * ib_alloc_xrcd - Allocates an XRC domain.
3562 * @device: The device on which to allocate the XRC domain. 3581 * @device: The device on which to allocate the XRC domain.
3582 * @caller: Module name for kernel consumers
3563 */ 3583 */
3564struct ib_xrcd *ib_alloc_xrcd(struct ib_device *device); 3584struct ib_xrcd *__ib_alloc_xrcd(struct ib_device *device, const char *caller);
3585#define ib_alloc_xrcd(device) \
3586 __ib_alloc_xrcd((device), KBUILD_MODNAME)
3565 3587
3566/** 3588/**
3567 * ib_dealloc_xrcd - Deallocates an XRC domain. 3589 * ib_dealloc_xrcd - Deallocates an XRC domain.
@@ -3789,18 +3811,24 @@ static inline void rdma_ah_set_grh(struct rdma_ah_attr *attr,
3789 grh->traffic_class = traffic_class; 3811 grh->traffic_class = traffic_class;
3790} 3812}
3791 3813
3792/*Get AH type */ 3814/**
3815 * rdma_ah_find_type - Return address handle type.
3816 *
3817 * @dev: Device to be checked
3818 * @port_num: Port number
3819 */
3793static inline enum rdma_ah_attr_type rdma_ah_find_type(struct ib_device *dev, 3820static inline enum rdma_ah_attr_type rdma_ah_find_type(struct ib_device *dev,
3794 u32 port_num) 3821 u8 port_num)
3795{ 3822{
3796 if ((rdma_protocol_roce(dev, port_num)) || 3823 if (rdma_protocol_roce(dev, port_num))
3797 (rdma_protocol_iwarp(dev, port_num)))
3798 return RDMA_AH_ATTR_TYPE_ROCE; 3824 return RDMA_AH_ATTR_TYPE_ROCE;
3799 else if ((rdma_protocol_ib(dev, port_num)) && 3825 if (rdma_protocol_ib(dev, port_num)) {
3800 (rdma_cap_opa_ah(dev, port_num))) 3826 if (rdma_cap_opa_ah(dev, port_num))
3801 return RDMA_AH_ATTR_TYPE_OPA; 3827 return RDMA_AH_ATTR_TYPE_OPA;
3802 else
3803 return RDMA_AH_ATTR_TYPE_IB; 3828 return RDMA_AH_ATTR_TYPE_IB;
3829 }
3830
3831 return RDMA_AH_ATTR_TYPE_UNDEFINED;
3804} 3832}
3805 3833
3806/** 3834/**
@@ -3850,4 +3878,12 @@ ib_get_vector_affinity(struct ib_device *device, int comp_vector)
3850 3878
3851} 3879}
3852 3880
3881/**
3882 * rdma_roce_rescan_device - Rescan all of the network devices in the system
3883 * and add their gids, as needed, to the relevant RoCE devices.
3884 *
3885 * @device: the rdma device
3886 */
3887void rdma_roce_rescan_device(struct ib_device *ibdev);
3888
3853#endif /* IB_VERBS_H */ 3889#endif /* IB_VERBS_H */