Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

IB: common handling for marshalling parameters to/from userspace

Provide common handling for marshalling data between userspace clients
and kernel InfiniBand drivers.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>

authored by

Sean Hefty and committed by
Roland Dreier
6a9af2e1 4e56ea79

+328 -218
+2 -1
drivers/infiniband/core/Makefile
··· 16 16 17 17 ib_ucm-y := ucm.o 18 18 19 - ib_uverbs-y := uverbs_main.o uverbs_cmd.o uverbs_mem.o 19 + ib_uverbs-y := uverbs_main.o uverbs_cmd.o uverbs_mem.o \ 20 + uverbs_marshall.o
+14 -117
drivers/infiniband/core/ucm.c
··· 30 30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 31 * SOFTWARE. 32 32 * 33 - * $Id: ucm.c 2594 2005-06-13 19:46:02Z libor $ 33 + * $Id: ucm.c 4311 2005-12-05 18:42:01Z sean.hefty $ 34 34 */ 35 35 36 36 #include <linux/completion.h> ··· 50 50 51 51 #include <rdma/ib_cm.h> 52 52 #include <rdma/ib_user_cm.h> 53 + #include <rdma/ib_marshall.h> 53 54 54 55 MODULE_AUTHOR("Libor Michalek"); 55 56 MODULE_DESCRIPTION("InfiniBand userspace Connection Manager access"); ··· 206 205 return NULL; 207 206 } 208 207 209 - static void ib_ucm_event_path_get(struct ib_ucm_path_rec *upath, 210 - struct ib_sa_path_rec *kpath) 211 - { 212 - if (!kpath || !upath) 213 - return; 214 - 215 - memcpy(upath->dgid, kpath->dgid.raw, sizeof *upath->dgid); 216 - memcpy(upath->sgid, kpath->sgid.raw, sizeof *upath->sgid); 217 - 218 - upath->dlid = kpath->dlid; 219 - upath->slid = kpath->slid; 220 - upath->raw_traffic = kpath->raw_traffic; 221 - upath->flow_label = kpath->flow_label; 222 - upath->hop_limit = kpath->hop_limit; 223 - upath->traffic_class = kpath->traffic_class; 224 - upath->reversible = kpath->reversible; 225 - upath->numb_path = kpath->numb_path; 226 - upath->pkey = kpath->pkey; 227 - upath->sl = kpath->sl; 228 - upath->mtu_selector = kpath->mtu_selector; 229 - upath->mtu = kpath->mtu; 230 - upath->rate_selector = kpath->rate_selector; 231 - upath->rate = kpath->rate; 232 - upath->packet_life_time = kpath->packet_life_time; 233 - upath->preference = kpath->preference; 234 - 235 - upath->packet_life_time_selector = 236 - kpath->packet_life_time_selector; 237 - } 238 - 239 208 static void ib_ucm_event_req_get(struct ib_ucm_req_event_resp *ureq, 240 209 struct ib_cm_req_event_param *kreq) 241 210 { ··· 224 253 ureq->srq = kreq->srq; 225 254 ureq->port = kreq->port; 226 255 227 - ib_ucm_event_path_get(&ureq->primary_path, kreq->primary_path); 228 - ib_ucm_event_path_get(&ureq->alternate_path, kreq->alternate_path); 256 + ib_copy_path_rec_to_user(&ureq->primary_path, kreq->primary_path); 257 + if (kreq->alternate_path) 258 + ib_copy_path_rec_to_user(&ureq->alternate_path, 259 + kreq->alternate_path); 229 260 } 230 261 231 262 static void ib_ucm_event_rep_get(struct ib_ucm_rep_event_resp *urep, ··· 297 324 info = evt->param.rej_rcvd.ari; 298 325 break; 299 326 case IB_CM_LAP_RECEIVED: 300 - ib_ucm_event_path_get(&uvt->resp.u.lap_resp.path, 301 - evt->param.lap_rcvd.alternate_path); 327 + ib_copy_path_rec_to_user(&uvt->resp.u.lap_resp.path, 328 + evt->param.lap_rcvd.alternate_path); 302 329 uvt->data_len = IB_CM_LAP_PRIVATE_DATA_SIZE; 303 330 uvt->resp.present = IB_UCM_PRES_ALTERNATE; 304 331 break; ··· 610 637 return result; 611 638 } 612 639 613 - static void ib_ucm_copy_ah_attr(struct ib_ucm_ah_attr *dest_attr, 614 - struct ib_ah_attr *src_attr) 615 - { 616 - memcpy(dest_attr->grh_dgid, src_attr->grh.dgid.raw, 617 - sizeof src_attr->grh.dgid); 618 - dest_attr->grh_flow_label = src_attr->grh.flow_label; 619 - dest_attr->grh_sgid_index = src_attr->grh.sgid_index; 620 - dest_attr->grh_hop_limit = src_attr->grh.hop_limit; 621 - dest_attr->grh_traffic_class = src_attr->grh.traffic_class; 622 - 623 - dest_attr->dlid = src_attr->dlid; 624 - dest_attr->sl = src_attr->sl; 625 - dest_attr->src_path_bits = src_attr->src_path_bits; 626 - dest_attr->static_rate = src_attr->static_rate; 627 - dest_attr->is_global = (src_attr->ah_flags & IB_AH_GRH); 628 - dest_attr->port_num = src_attr->port_num; 629 - } 630 - 631 - static void ib_ucm_copy_qp_attr(struct ib_ucm_init_qp_attr_resp *dest_attr, 632 - struct ib_qp_attr *src_attr) 633 - { 634 - dest_attr->cur_qp_state = src_attr->cur_qp_state; 635 - dest_attr->path_mtu = src_attr->path_mtu; 636 - dest_attr->path_mig_state = src_attr->path_mig_state; 637 - dest_attr->qkey = src_attr->qkey; 638 - dest_attr->rq_psn = src_attr->rq_psn; 639 - dest_attr->sq_psn = src_attr->sq_psn; 640 - dest_attr->dest_qp_num = src_attr->dest_qp_num; 641 - dest_attr->qp_access_flags = src_attr->qp_access_flags; 642 - 643 - dest_attr->max_send_wr = src_attr->cap.max_send_wr; 644 - dest_attr->max_recv_wr = src_attr->cap.max_recv_wr; 645 - dest_attr->max_send_sge = src_attr->cap.max_send_sge; 646 - dest_attr->max_recv_sge = src_attr->cap.max_recv_sge; 647 - dest_attr->max_inline_data = src_attr->cap.max_inline_data; 648 - 649 - ib_ucm_copy_ah_attr(&dest_attr->ah_attr, &src_attr->ah_attr); 650 - ib_ucm_copy_ah_attr(&dest_attr->alt_ah_attr, &src_attr->alt_ah_attr); 651 - 652 - dest_attr->pkey_index = src_attr->pkey_index; 653 - dest_attr->alt_pkey_index = src_attr->alt_pkey_index; 654 - dest_attr->en_sqd_async_notify = src_attr->en_sqd_async_notify; 655 - dest_attr->sq_draining = src_attr->sq_draining; 656 - dest_attr->max_rd_atomic = src_attr->max_rd_atomic; 657 - dest_attr->max_dest_rd_atomic = src_attr->max_dest_rd_atomic; 658 - dest_attr->min_rnr_timer = src_attr->min_rnr_timer; 659 - dest_attr->port_num = src_attr->port_num; 660 - dest_attr->timeout = src_attr->timeout; 661 - dest_attr->retry_cnt = src_attr->retry_cnt; 662 - dest_attr->rnr_retry = src_attr->rnr_retry; 663 - dest_attr->alt_port_num = src_attr->alt_port_num; 664 - dest_attr->alt_timeout = src_attr->alt_timeout; 665 - } 666 - 667 640 static ssize_t ib_ucm_init_qp_attr(struct ib_ucm_file *file, 668 641 const char __user *inbuf, 669 642 int in_len, int out_len) 670 643 { 671 - struct ib_ucm_init_qp_attr_resp resp; 644 + struct ib_uverbs_qp_attr resp; 672 645 struct ib_ucm_init_qp_attr cmd; 673 646 struct ib_ucm_context *ctx; 674 647 struct ib_qp_attr qp_attr; ··· 637 718 if (result) 638 719 goto out; 639 720 640 - ib_ucm_copy_qp_attr(&resp, &qp_attr); 721 + ib_copy_qp_attr_to_user(&resp, &qp_attr); 641 722 642 723 if (copy_to_user((void __user *)(unsigned long)cmd.response, 643 724 &resp, sizeof(resp))) ··· 712 793 713 794 static int ib_ucm_path_get(struct ib_sa_path_rec **path, u64 src) 714 795 { 715 - struct ib_ucm_path_rec ucm_path; 796 + struct ib_user_path_rec upath; 716 797 struct ib_sa_path_rec *sa_path; 717 798 718 799 *path = NULL; ··· 724 805 if (!sa_path) 725 806 return -ENOMEM; 726 807 727 - if (copy_from_user(&ucm_path, (void __user *)(unsigned long)src, 728 - sizeof(ucm_path))) { 808 + if (copy_from_user(&upath, (void __user *)(unsigned long)src, 809 + sizeof(upath))) { 729 810 730 811 kfree(sa_path); 731 812 return -EFAULT; 732 813 } 733 814 734 - memcpy(sa_path->dgid.raw, ucm_path.dgid, sizeof sa_path->dgid); 735 - memcpy(sa_path->sgid.raw, ucm_path.sgid, sizeof sa_path->sgid); 736 - 737 - sa_path->dlid = ucm_path.dlid; 738 - sa_path->slid = ucm_path.slid; 739 - sa_path->raw_traffic = ucm_path.raw_traffic; 740 - sa_path->flow_label = ucm_path.flow_label; 741 - sa_path->hop_limit = ucm_path.hop_limit; 742 - sa_path->traffic_class = ucm_path.traffic_class; 743 - sa_path->reversible = ucm_path.reversible; 744 - sa_path->numb_path = ucm_path.numb_path; 745 - sa_path->pkey = ucm_path.pkey; 746 - sa_path->sl = ucm_path.sl; 747 - sa_path->mtu_selector = ucm_path.mtu_selector; 748 - sa_path->mtu = ucm_path.mtu; 749 - sa_path->rate_selector = ucm_path.rate_selector; 750 - sa_path->rate = ucm_path.rate; 751 - sa_path->packet_life_time = ucm_path.packet_life_time; 752 - sa_path->preference = ucm_path.preference; 753 - 754 - sa_path->packet_life_time_selector = 755 - ucm_path.packet_life_time_selector; 756 - 815 + ib_copy_path_rec_from_user(sa_path, &upath); 757 816 *path = sa_path; 758 817 return 0; 759 818 }
+138
drivers/infiniband/core/uverbs_marshall.c
··· 1 + /* 2 + * Copyright (c) 2005 Intel Corporation. All rights reserved. 3 + * 4 + * This software is available to you under a choice of one of two 5 + * licenses. You may choose to be licensed under the terms of the GNU 6 + * General Public License (GPL) Version 2, available from the file 7 + * COPYING in the main directory of this source tree, or the 8 + * OpenIB.org BSD license below: 9 + * 10 + * Redistribution and use in source and binary forms, with or 11 + * without modification, are permitted provided that the following 12 + * conditions are met: 13 + * 14 + * - Redistributions of source code must retain the above 15 + * copyright notice, this list of conditions and the following 16 + * disclaimer. 17 + * 18 + * - Redistributions in binary form must reproduce the above 19 + * copyright notice, this list of conditions and the following 20 + * disclaimer in the documentation and/or other materials 21 + * provided with the distribution. 22 + * 23 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27 + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28 + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29 + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 + * SOFTWARE. 31 + */ 32 + 33 + #include <rdma/ib_marshall.h> 34 + 35 + static void ib_copy_ah_attr_to_user(struct ib_uverbs_ah_attr *dst, 36 + struct ib_ah_attr *src) 37 + { 38 + memcpy(dst->grh.dgid, src->grh.dgid.raw, sizeof src->grh.dgid); 39 + dst->grh.flow_label = src->grh.flow_label; 40 + dst->grh.sgid_index = src->grh.sgid_index; 41 + dst->grh.hop_limit = src->grh.hop_limit; 42 + dst->grh.traffic_class = src->grh.traffic_class; 43 + dst->dlid = src->dlid; 44 + dst->sl = src->sl; 45 + dst->src_path_bits = src->src_path_bits; 46 + dst->static_rate = src->static_rate; 47 + dst->is_global = src->ah_flags & IB_AH_GRH ? 1 : 0; 48 + dst->port_num = src->port_num; 49 + } 50 + 51 + void ib_copy_qp_attr_to_user(struct ib_uverbs_qp_attr *dst, 52 + struct ib_qp_attr *src) 53 + { 54 + dst->cur_qp_state = src->cur_qp_state; 55 + dst->path_mtu = src->path_mtu; 56 + dst->path_mig_state = src->path_mig_state; 57 + dst->qkey = src->qkey; 58 + dst->rq_psn = src->rq_psn; 59 + dst->sq_psn = src->sq_psn; 60 + dst->dest_qp_num = src->dest_qp_num; 61 + dst->qp_access_flags = src->qp_access_flags; 62 + 63 + dst->max_send_wr = src->cap.max_send_wr; 64 + dst->max_recv_wr = src->cap.max_recv_wr; 65 + dst->max_send_sge = src->cap.max_send_sge; 66 + dst->max_recv_sge = src->cap.max_recv_sge; 67 + dst->max_inline_data = src->cap.max_inline_data; 68 + 69 + ib_copy_ah_attr_to_user(&dst->ah_attr, &src->ah_attr); 70 + ib_copy_ah_attr_to_user(&dst->alt_ah_attr, &src->alt_ah_attr); 71 + 72 + dst->pkey_index = src->pkey_index; 73 + dst->alt_pkey_index = src->alt_pkey_index; 74 + dst->en_sqd_async_notify = src->en_sqd_async_notify; 75 + dst->sq_draining = src->sq_draining; 76 + dst->max_rd_atomic = src->max_rd_atomic; 77 + dst->max_dest_rd_atomic = src->max_dest_rd_atomic; 78 + dst->min_rnr_timer = src->min_rnr_timer; 79 + dst->port_num = src->port_num; 80 + dst->timeout = src->timeout; 81 + dst->retry_cnt = src->retry_cnt; 82 + dst->rnr_retry = src->rnr_retry; 83 + dst->alt_port_num = src->alt_port_num; 84 + dst->alt_timeout = src->alt_timeout; 85 + } 86 + EXPORT_SYMBOL(ib_copy_qp_attr_to_user); 87 + 88 + void ib_copy_path_rec_to_user(struct ib_user_path_rec *dst, 89 + struct ib_sa_path_rec *src) 90 + { 91 + memcpy(dst->dgid, src->dgid.raw, sizeof src->dgid); 92 + memcpy(dst->sgid, src->sgid.raw, sizeof src->sgid); 93 + 94 + dst->dlid = src->dlid; 95 + dst->slid = src->slid; 96 + dst->raw_traffic = src->raw_traffic; 97 + dst->flow_label = src->flow_label; 98 + dst->hop_limit = src->hop_limit; 99 + dst->traffic_class = src->traffic_class; 100 + dst->reversible = src->reversible; 101 + dst->numb_path = src->numb_path; 102 + dst->pkey = src->pkey; 103 + dst->sl = src->sl; 104 + dst->mtu_selector = src->mtu_selector; 105 + dst->mtu = src->mtu; 106 + dst->rate_selector = src->rate_selector; 107 + dst->rate = src->rate; 108 + dst->packet_life_time = src->packet_life_time; 109 + dst->preference = src->preference; 110 + dst->packet_life_time_selector = src->packet_life_time_selector; 111 + } 112 + EXPORT_SYMBOL(ib_copy_path_rec_to_user); 113 + 114 + void ib_copy_path_rec_from_user(struct ib_sa_path_rec *dst, 115 + struct ib_user_path_rec *src) 116 + { 117 + memcpy(dst->dgid.raw, src->dgid, sizeof dst->dgid); 118 + memcpy(dst->sgid.raw, src->sgid, sizeof dst->sgid); 119 + 120 + dst->dlid = src->dlid; 121 + dst->slid = src->slid; 122 + dst->raw_traffic = src->raw_traffic; 123 + dst->flow_label = src->flow_label; 124 + dst->hop_limit = src->hop_limit; 125 + dst->traffic_class = src->traffic_class; 126 + dst->reversible = src->reversible; 127 + dst->numb_path = src->numb_path; 128 + dst->pkey = src->pkey; 129 + dst->sl = src->sl; 130 + dst->mtu_selector = src->mtu_selector; 131 + dst->mtu = src->mtu; 132 + dst->rate_selector = src->rate_selector; 133 + dst->rate = src->rate; 134 + dst->packet_life_time = src->packet_life_time; 135 + dst->preference = src->preference; 136 + dst->packet_life_time_selector = src->packet_life_time_selector; 137 + } 138 + EXPORT_SYMBOL(ib_copy_path_rec_from_user);
+50
include/rdma/ib_marshall.h
··· 1 + /* 2 + * Copyright (c) 2005 Intel Corporation. All rights reserved. 3 + * 4 + * This software is available to you under a choice of one of two 5 + * licenses. You may choose to be licensed under the terms of the GNU 6 + * General Public License (GPL) Version 2, available from the file 7 + * COPYING in the main directory of this source tree, or the 8 + * OpenIB.org BSD license below: 9 + * 10 + * Redistribution and use in source and binary forms, with or 11 + * without modification, are permitted provided that the following 12 + * conditions are met: 13 + * 14 + * - Redistributions of source code must retain the above 15 + * copyright notice, this list of conditions and the following 16 + * disclaimer. 17 + * 18 + * - Redistributions in binary form must reproduce the above 19 + * copyright notice, this list of conditions and the following 20 + * disclaimer in the documentation and/or other materials 21 + * provided with the distribution. 22 + * 23 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27 + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28 + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29 + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 + * SOFTWARE. 31 + */ 32 + 33 + #if !defined(IB_USER_MARSHALL_H) 34 + #define IB_USER_MARSHALL_H 35 + 36 + #include <rdma/ib_verbs.h> 37 + #include <rdma/ib_sa.h> 38 + #include <rdma/ib_user_verbs.h> 39 + #include <rdma/ib_user_sa.h> 40 + 41 + void ib_copy_qp_attr_to_user(struct ib_uverbs_qp_attr *dst, 42 + struct ib_qp_attr *src); 43 + 44 + void ib_copy_path_rec_to_user(struct ib_user_path_rec *dst, 45 + struct ib_sa_path_rec *src); 46 + 47 + void ib_copy_path_rec_from_user(struct ib_sa_path_rec *dst, 48 + struct ib_user_path_rec *src); 49 + 50 + #endif /* IB_USER_MARSHALL_H */
+5 -79
include/rdma/ib_user_cm.h
··· 30 30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 31 * SOFTWARE. 32 32 * 33 - * $Id: ib_user_cm.h 2576 2005-06-09 17:00:30Z libor $ 33 + * $Id: ib_user_cm.h 4019 2005-11-11 00:33:09Z sean.hefty $ 34 34 */ 35 35 36 36 #ifndef IB_USER_CM_H 37 37 #define IB_USER_CM_H 38 38 39 - #include <linux/types.h> 39 + #include <rdma/ib_user_sa.h> 40 40 41 41 #define IB_USER_CM_ABI_VERSION 4 42 42 ··· 110 110 __u32 qp_state; 111 111 }; 112 112 113 - struct ib_ucm_ah_attr { 114 - __u8 grh_dgid[16]; 115 - __u32 grh_flow_label; 116 - __u16 dlid; 117 - __u16 reserved; 118 - __u8 grh_sgid_index; 119 - __u8 grh_hop_limit; 120 - __u8 grh_traffic_class; 121 - __u8 sl; 122 - __u8 src_path_bits; 123 - __u8 static_rate; 124 - __u8 is_global; 125 - __u8 port_num; 126 - }; 127 - 128 - struct ib_ucm_init_qp_attr_resp { 129 - __u32 qp_attr_mask; 130 - __u32 qp_state; 131 - __u32 cur_qp_state; 132 - __u32 path_mtu; 133 - __u32 path_mig_state; 134 - __u32 qkey; 135 - __u32 rq_psn; 136 - __u32 sq_psn; 137 - __u32 dest_qp_num; 138 - __u32 qp_access_flags; 139 - 140 - struct ib_ucm_ah_attr ah_attr; 141 - struct ib_ucm_ah_attr alt_ah_attr; 142 - 143 - /* ib_qp_cap */ 144 - __u32 max_send_wr; 145 - __u32 max_recv_wr; 146 - __u32 max_send_sge; 147 - __u32 max_recv_sge; 148 - __u32 max_inline_data; 149 - 150 - __u16 pkey_index; 151 - __u16 alt_pkey_index; 152 - __u8 en_sqd_async_notify; 153 - __u8 sq_draining; 154 - __u8 max_rd_atomic; 155 - __u8 max_dest_rd_atomic; 156 - __u8 min_rnr_timer; 157 - __u8 port_num; 158 - __u8 timeout; 159 - __u8 retry_cnt; 160 - __u8 rnr_retry; 161 - __u8 alt_port_num; 162 - __u8 alt_timeout; 163 - }; 164 - 165 113 struct ib_ucm_listen { 166 114 __be64 service_id; 167 115 __be64 service_mask; ··· 126 178 __u32 id; 127 179 __u8 len; 128 180 __u8 reserved[3]; 129 - }; 130 - 131 - struct ib_ucm_path_rec { 132 - __u8 dgid[16]; 133 - __u8 sgid[16]; 134 - __be16 dlid; 135 - __be16 slid; 136 - __u32 raw_traffic; 137 - __be32 flow_label; 138 - __u32 reversible; 139 - __u32 mtu; 140 - __be16 pkey; 141 - __u8 hop_limit; 142 - __u8 traffic_class; 143 - __u8 numb_path; 144 - __u8 sl; 145 - __u8 mtu_selector; 146 - __u8 rate_selector; 147 - __u8 rate; 148 - __u8 packet_life_time_selector; 149 - __u8 packet_life_time; 150 - __u8 preference; 151 181 }; 152 182 153 183 struct ib_ucm_req { ··· 230 304 }; 231 305 232 306 struct ib_ucm_req_event_resp { 233 - struct ib_ucm_path_rec primary_path; 234 - struct ib_ucm_path_rec alternate_path; 307 + struct ib_user_path_rec primary_path; 308 + struct ib_user_path_rec alternate_path; 235 309 __be64 remote_ca_guid; 236 310 __u32 remote_qkey; 237 311 __u32 remote_qpn; ··· 275 349 }; 276 350 277 351 struct ib_ucm_lap_event_resp { 278 - struct ib_ucm_path_rec path; 352 + struct ib_user_path_rec path; 279 353 }; 280 354 281 355 struct ib_ucm_apr_event_resp {
+60
include/rdma/ib_user_sa.h
··· 1 + /* 2 + * Copyright (c) 2005 Intel Corporation. All rights reserved. 3 + * 4 + * This software is available to you under a choice of one of two 5 + * licenses. You may choose to be licensed under the terms of the GNU 6 + * General Public License (GPL) Version 2, available from the file 7 + * COPYING in the main directory of this source tree, or the 8 + * OpenIB.org BSD license below: 9 + * 10 + * Redistribution and use in source and binary forms, with or 11 + * without modification, are permitted provided that the following 12 + * conditions are met: 13 + * 14 + * - Redistributions of source code must retain the above 15 + * copyright notice, this list of conditions and the following 16 + * disclaimer. 17 + * 18 + * - Redistributions in binary form must reproduce the above 19 + * copyright notice, this list of conditions and the following 20 + * disclaimer in the documentation and/or other materials 21 + * provided with the distribution. 22 + * 23 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27 + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28 + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29 + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 + * SOFTWARE. 31 + */ 32 + 33 + #ifndef IB_USER_SA_H 34 + #define IB_USER_SA_H 35 + 36 + #include <linux/types.h> 37 + 38 + struct ib_user_path_rec { 39 + __u8 dgid[16]; 40 + __u8 sgid[16]; 41 + __be16 dlid; 42 + __be16 slid; 43 + __u32 raw_traffic; 44 + __be32 flow_label; 45 + __u32 reversible; 46 + __u32 mtu; 47 + __be16 pkey; 48 + __u8 hop_limit; 49 + __u8 traffic_class; 50 + __u8 numb_path; 51 + __u8 sl; 52 + __u8 mtu_selector; 53 + __u8 rate_selector; 54 + __u8 rate; 55 + __u8 packet_life_time_selector; 56 + __u8 packet_life_time; 57 + __u8 preference; 58 + }; 59 + 60 + #endif /* IB_USER_SA_H */
+59 -21
include/rdma/ib_user_verbs.h
··· 32 32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 33 * SOFTWARE. 34 34 * 35 - * $Id: ib_user_verbs.h 2708 2005-06-24 17:27:21Z roland $ 35 + * $Id: ib_user_verbs.h 4019 2005-11-11 00:33:09Z sean.hefty $ 36 36 */ 37 37 38 38 #ifndef IB_USER_VERBS_H ··· 323 323 __u32 async_events_reported; 324 324 }; 325 325 326 + struct ib_uverbs_global_route { 327 + __u8 dgid[16]; 328 + __u32 flow_label; 329 + __u8 sgid_index; 330 + __u8 hop_limit; 331 + __u8 traffic_class; 332 + __u8 reserved; 333 + }; 334 + 335 + struct ib_uverbs_ah_attr { 336 + struct ib_uverbs_global_route grh; 337 + __u16 dlid; 338 + __u8 sl; 339 + __u8 src_path_bits; 340 + __u8 static_rate; 341 + __u8 is_global; 342 + __u8 port_num; 343 + __u8 reserved; 344 + }; 345 + 346 + struct ib_uverbs_qp_attr { 347 + __u32 qp_attr_mask; 348 + __u32 qp_state; 349 + __u32 cur_qp_state; 350 + __u32 path_mtu; 351 + __u32 path_mig_state; 352 + __u32 qkey; 353 + __u32 rq_psn; 354 + __u32 sq_psn; 355 + __u32 dest_qp_num; 356 + __u32 qp_access_flags; 357 + 358 + struct ib_uverbs_ah_attr ah_attr; 359 + struct ib_uverbs_ah_attr alt_ah_attr; 360 + 361 + /* ib_qp_cap */ 362 + __u32 max_send_wr; 363 + __u32 max_recv_wr; 364 + __u32 max_send_sge; 365 + __u32 max_recv_sge; 366 + __u32 max_inline_data; 367 + 368 + __u16 pkey_index; 369 + __u16 alt_pkey_index; 370 + __u8 en_sqd_async_notify; 371 + __u8 sq_draining; 372 + __u8 max_rd_atomic; 373 + __u8 max_dest_rd_atomic; 374 + __u8 min_rnr_timer; 375 + __u8 port_num; 376 + __u8 timeout; 377 + __u8 retry_cnt; 378 + __u8 rnr_retry; 379 + __u8 alt_port_num; 380 + __u8 alt_timeout; 381 + __u8 reserved[5]; 382 + }; 383 + 326 384 struct ib_uverbs_create_qp { 327 385 __u64 response; 328 386 __u64 user_handle; ··· 597 539 598 540 struct ib_uverbs_post_srq_recv_resp { 599 541 __u32 bad_wr; 600 - }; 601 - 602 - struct ib_uverbs_global_route { 603 - __u8 dgid[16]; 604 - __u32 flow_label; 605 - __u8 sgid_index; 606 - __u8 hop_limit; 607 - __u8 traffic_class; 608 - __u8 reserved; 609 - }; 610 - 611 - struct ib_uverbs_ah_attr { 612 - struct ib_uverbs_global_route grh; 613 - __u16 dlid; 614 - __u8 sl; 615 - __u8 src_path_bits; 616 - __u8 static_rate; 617 - __u8 is_global; 618 - __u8 port_num; 619 - __u8 reserved; 620 542 }; 621 543 622 544 struct ib_uverbs_create_ah {