Linux Audio

Check our new training course

Loading...
v3.1
  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
 35void 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	memset(&dst->grh.reserved, 0, sizeof(dst->grh.reserved));
 44	dst->dlid 	    	   = src->dlid;
 45	dst->sl   	    	   = src->sl;
 46	dst->src_path_bits 	   = src->src_path_bits;
 47	dst->static_rate   	   = src->static_rate;
 48	dst->is_global             = src->ah_flags & IB_AH_GRH ? 1 : 0;
 49	dst->port_num 	    	   = src->port_num;
 50	dst->reserved 		   = 0;
 51}
 52EXPORT_SYMBOL(ib_copy_ah_attr_to_user);
 53
 54void ib_copy_qp_attr_to_user(struct ib_uverbs_qp_attr *dst,
 55			     struct ib_qp_attr *src)
 56{
 57	dst->qp_state	        = src->qp_state;
 58	dst->cur_qp_state	= src->cur_qp_state;
 59	dst->path_mtu		= src->path_mtu;
 60	dst->path_mig_state	= src->path_mig_state;
 61	dst->qkey		= src->qkey;
 62	dst->rq_psn		= src->rq_psn;
 63	dst->sq_psn		= src->sq_psn;
 64	dst->dest_qp_num	= src->dest_qp_num;
 65	dst->qp_access_flags	= src->qp_access_flags;
 66
 67	dst->max_send_wr	= src->cap.max_send_wr;
 68	dst->max_recv_wr	= src->cap.max_recv_wr;
 69	dst->max_send_sge	= src->cap.max_send_sge;
 70	dst->max_recv_sge	= src->cap.max_recv_sge;
 71	dst->max_inline_data	= src->cap.max_inline_data;
 72
 73	ib_copy_ah_attr_to_user(&dst->ah_attr, &src->ah_attr);
 74	ib_copy_ah_attr_to_user(&dst->alt_ah_attr, &src->alt_ah_attr);
 75
 76	dst->pkey_index		= src->pkey_index;
 77	dst->alt_pkey_index	= src->alt_pkey_index;
 78	dst->en_sqd_async_notify = src->en_sqd_async_notify;
 79	dst->sq_draining	= src->sq_draining;
 80	dst->max_rd_atomic	= src->max_rd_atomic;
 81	dst->max_dest_rd_atomic	= src->max_dest_rd_atomic;
 82	dst->min_rnr_timer	= src->min_rnr_timer;
 83	dst->port_num		= src->port_num;
 84	dst->timeout		= src->timeout;
 85	dst->retry_cnt		= src->retry_cnt;
 86	dst->rnr_retry		= src->rnr_retry;
 87	dst->alt_port_num	= src->alt_port_num;
 88	dst->alt_timeout	= src->alt_timeout;
 89	memset(dst->reserved, 0, sizeof(dst->reserved));
 90}
 91EXPORT_SYMBOL(ib_copy_qp_attr_to_user);
 92
 93void ib_copy_path_rec_to_user(struct ib_user_path_rec *dst,
 94			      struct ib_sa_path_rec *src)
 95{
 96	memcpy(dst->dgid, src->dgid.raw, sizeof src->dgid);
 97	memcpy(dst->sgid, src->sgid.raw, sizeof src->sgid);
 98
 99	dst->dlid		= src->dlid;
100	dst->slid		= src->slid;
101	dst->raw_traffic	= src->raw_traffic;
102	dst->flow_label		= src->flow_label;
103	dst->hop_limit		= src->hop_limit;
104	dst->traffic_class	= src->traffic_class;
105	dst->reversible		= src->reversible;
106	dst->numb_path		= src->numb_path;
107	dst->pkey		= src->pkey;
108	dst->sl			= src->sl;
109	dst->mtu_selector	= src->mtu_selector;
110	dst->mtu		= src->mtu;
111	dst->rate_selector	= src->rate_selector;
112	dst->rate		= src->rate;
113	dst->packet_life_time	= src->packet_life_time;
114	dst->preference		= src->preference;
115	dst->packet_life_time_selector = src->packet_life_time_selector;
116}
117EXPORT_SYMBOL(ib_copy_path_rec_to_user);
118
119void ib_copy_path_rec_from_user(struct ib_sa_path_rec *dst,
120				struct ib_user_path_rec *src)
121{
122	memcpy(dst->dgid.raw, src->dgid, sizeof dst->dgid);
123	memcpy(dst->sgid.raw, src->sgid, sizeof dst->sgid);
124
125	dst->dlid		= src->dlid;
126	dst->slid		= src->slid;
127	dst->raw_traffic	= src->raw_traffic;
128	dst->flow_label		= src->flow_label;
129	dst->hop_limit		= src->hop_limit;
130	dst->traffic_class	= src->traffic_class;
131	dst->reversible		= src->reversible;
132	dst->numb_path		= src->numb_path;
133	dst->pkey		= src->pkey;
134	dst->sl			= src->sl;
135	dst->mtu_selector	= src->mtu_selector;
136	dst->mtu		= src->mtu;
137	dst->rate_selector	= src->rate_selector;
138	dst->rate		= src->rate;
139	dst->packet_life_time	= src->packet_life_time;
140	dst->preference		= src->preference;
141	dst->packet_life_time_selector = src->packet_life_time_selector;
142}
143EXPORT_SYMBOL(ib_copy_path_rec_from_user);
v3.15
  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 <linux/export.h>
 34#include <rdma/ib_marshall.h>
 35
 36void ib_copy_ah_attr_to_user(struct ib_uverbs_ah_attr *dst,
 37			     struct ib_ah_attr *src)
 38{
 39	memcpy(dst->grh.dgid, src->grh.dgid.raw, sizeof src->grh.dgid);
 40	dst->grh.flow_label        = src->grh.flow_label;
 41	dst->grh.sgid_index        = src->grh.sgid_index;
 42	dst->grh.hop_limit         = src->grh.hop_limit;
 43	dst->grh.traffic_class     = src->grh.traffic_class;
 44	memset(&dst->grh.reserved, 0, sizeof(dst->grh.reserved));
 45	dst->dlid 	    	   = src->dlid;
 46	dst->sl   	    	   = src->sl;
 47	dst->src_path_bits 	   = src->src_path_bits;
 48	dst->static_rate   	   = src->static_rate;
 49	dst->is_global             = src->ah_flags & IB_AH_GRH ? 1 : 0;
 50	dst->port_num 	    	   = src->port_num;
 51	dst->reserved 		   = 0;
 52}
 53EXPORT_SYMBOL(ib_copy_ah_attr_to_user);
 54
 55void ib_copy_qp_attr_to_user(struct ib_uverbs_qp_attr *dst,
 56			     struct ib_qp_attr *src)
 57{
 58	dst->qp_state	        = src->qp_state;
 59	dst->cur_qp_state	= src->cur_qp_state;
 60	dst->path_mtu		= src->path_mtu;
 61	dst->path_mig_state	= src->path_mig_state;
 62	dst->qkey		= src->qkey;
 63	dst->rq_psn		= src->rq_psn;
 64	dst->sq_psn		= src->sq_psn;
 65	dst->dest_qp_num	= src->dest_qp_num;
 66	dst->qp_access_flags	= src->qp_access_flags;
 67
 68	dst->max_send_wr	= src->cap.max_send_wr;
 69	dst->max_recv_wr	= src->cap.max_recv_wr;
 70	dst->max_send_sge	= src->cap.max_send_sge;
 71	dst->max_recv_sge	= src->cap.max_recv_sge;
 72	dst->max_inline_data	= src->cap.max_inline_data;
 73
 74	ib_copy_ah_attr_to_user(&dst->ah_attr, &src->ah_attr);
 75	ib_copy_ah_attr_to_user(&dst->alt_ah_attr, &src->alt_ah_attr);
 76
 77	dst->pkey_index		= src->pkey_index;
 78	dst->alt_pkey_index	= src->alt_pkey_index;
 79	dst->en_sqd_async_notify = src->en_sqd_async_notify;
 80	dst->sq_draining	= src->sq_draining;
 81	dst->max_rd_atomic	= src->max_rd_atomic;
 82	dst->max_dest_rd_atomic	= src->max_dest_rd_atomic;
 83	dst->min_rnr_timer	= src->min_rnr_timer;
 84	dst->port_num		= src->port_num;
 85	dst->timeout		= src->timeout;
 86	dst->retry_cnt		= src->retry_cnt;
 87	dst->rnr_retry		= src->rnr_retry;
 88	dst->alt_port_num	= src->alt_port_num;
 89	dst->alt_timeout	= src->alt_timeout;
 90	memset(dst->reserved, 0, sizeof(dst->reserved));
 91}
 92EXPORT_SYMBOL(ib_copy_qp_attr_to_user);
 93
 94void ib_copy_path_rec_to_user(struct ib_user_path_rec *dst,
 95			      struct ib_sa_path_rec *src)
 96{
 97	memcpy(dst->dgid, src->dgid.raw, sizeof src->dgid);
 98	memcpy(dst->sgid, src->sgid.raw, sizeof src->sgid);
 99
100	dst->dlid		= src->dlid;
101	dst->slid		= src->slid;
102	dst->raw_traffic	= src->raw_traffic;
103	dst->flow_label		= src->flow_label;
104	dst->hop_limit		= src->hop_limit;
105	dst->traffic_class	= src->traffic_class;
106	dst->reversible		= src->reversible;
107	dst->numb_path		= src->numb_path;
108	dst->pkey		= src->pkey;
109	dst->sl			= src->sl;
110	dst->mtu_selector	= src->mtu_selector;
111	dst->mtu		= src->mtu;
112	dst->rate_selector	= src->rate_selector;
113	dst->rate		= src->rate;
114	dst->packet_life_time	= src->packet_life_time;
115	dst->preference		= src->preference;
116	dst->packet_life_time_selector = src->packet_life_time_selector;
117}
118EXPORT_SYMBOL(ib_copy_path_rec_to_user);
119
120void ib_copy_path_rec_from_user(struct ib_sa_path_rec *dst,
121				struct ib_user_path_rec *src)
122{
123	memcpy(dst->dgid.raw, src->dgid, sizeof dst->dgid);
124	memcpy(dst->sgid.raw, src->sgid, sizeof dst->sgid);
125
126	dst->dlid		= src->dlid;
127	dst->slid		= src->slid;
128	dst->raw_traffic	= src->raw_traffic;
129	dst->flow_label		= src->flow_label;
130	dst->hop_limit		= src->hop_limit;
131	dst->traffic_class	= src->traffic_class;
132	dst->reversible		= src->reversible;
133	dst->numb_path		= src->numb_path;
134	dst->pkey		= src->pkey;
135	dst->sl			= src->sl;
136	dst->mtu_selector	= src->mtu_selector;
137	dst->mtu		= src->mtu;
138	dst->rate_selector	= src->rate_selector;
139	dst->rate		= src->rate;
140	dst->packet_life_time	= src->packet_life_time;
141	dst->preference		= src->preference;
142	dst->packet_life_time_selector = src->packet_life_time_selector;
143}
144EXPORT_SYMBOL(ib_copy_path_rec_from_user);