Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (c) 2005 Voltaire Inc.  All rights reserved.
0003  * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
0004  * Copyright (c) 1999-2005, Mellanox Technologies, Inc. All rights reserved.
0005  * Copyright (c) 2005-2006 Intel Corporation.  All rights reserved.
0006  *
0007  * This software is available to you under a choice of one of two
0008  * licenses.  You may choose to be licensed under the terms of the GNU
0009  * General Public License (GPL) Version 2, available from the file
0010  * COPYING in the main directory of this source tree, or the
0011  * OpenIB.org BSD license below:
0012  *
0013  *     Redistribution and use in source and binary forms, with or
0014  *     without modification, are permitted provided that the following
0015  *     conditions are met:
0016  *
0017  *      - Redistributions of source code must retain the above
0018  *        copyright notice, this list of conditions and the following
0019  *        disclaimer.
0020  *
0021  *      - Redistributions in binary form must reproduce the above
0022  *        copyright notice, this list of conditions and the following
0023  *        disclaimer in the documentation and/or other materials
0024  *        provided with the distribution.
0025  *
0026  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0027  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0028  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0029  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
0030  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
0031  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0032  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
0033  * SOFTWARE.
0034  */
0035 
0036 #ifndef _CMA_PRIV_H
0037 #define _CMA_PRIV_H
0038 
0039 enum rdma_cm_state {
0040     RDMA_CM_IDLE,
0041     RDMA_CM_ADDR_QUERY,
0042     RDMA_CM_ADDR_RESOLVED,
0043     RDMA_CM_ROUTE_QUERY,
0044     RDMA_CM_ROUTE_RESOLVED,
0045     RDMA_CM_CONNECT,
0046     RDMA_CM_DISCONNECT,
0047     RDMA_CM_ADDR_BOUND,
0048     RDMA_CM_LISTEN,
0049     RDMA_CM_DEVICE_REMOVAL,
0050     RDMA_CM_DESTROYING
0051 };
0052 
0053 struct rdma_id_private {
0054     struct rdma_cm_id   id;
0055 
0056     struct rdma_bind_list   *bind_list;
0057     struct hlist_node   node;
0058     union {
0059         struct list_head device_item; /* On cma_device->id_list */
0060         struct list_head listen_any_item; /* On listen_any_list */
0061     };
0062     union {
0063         /* On rdma_id_private->listen_list */
0064         struct list_head listen_item;
0065         struct list_head listen_list;
0066     };
0067     struct list_head        id_list_entry;
0068     struct cma_device   *cma_dev;
0069     struct list_head    mc_list;
0070 
0071     int         internal_id;
0072     enum rdma_cm_state  state;
0073     spinlock_t      lock;
0074     struct mutex        qp_mutex;
0075 
0076     struct completion   comp;
0077     refcount_t refcount;
0078     struct mutex        handler_mutex;
0079 
0080     int         backlog;
0081     int         timeout_ms;
0082     struct ib_sa_query  *query;
0083     int         query_id;
0084     union {
0085         struct ib_cm_id *ib;
0086         struct iw_cm_id *iw;
0087     } cm_id;
0088 
0089     u32         seq_num;
0090     u32         qkey;
0091     u32         qp_num;
0092     u32         options;
0093     u8          srq;
0094     u8          tos;
0095     u8          tos_set:1;
0096     u8                      timeout_set:1;
0097     u8          min_rnr_timer_set:1;
0098     u8          reuseaddr;
0099     u8          afonly;
0100     u8          timeout;
0101     u8          min_rnr_timer;
0102     u8 used_resolve_ip;
0103     enum ib_gid_type    gid_type;
0104 
0105     /*
0106      * Internal to RDMA/core, don't use in the drivers
0107      */
0108     struct rdma_restrack_entry     res;
0109     struct rdma_ucm_ece ece;
0110 };
0111 
0112 #if IS_ENABLED(CONFIG_INFINIBAND_ADDR_TRANS_CONFIGFS)
0113 int cma_configfs_init(void);
0114 void cma_configfs_exit(void);
0115 #else
0116 static inline int cma_configfs_init(void)
0117 {
0118     return 0;
0119 }
0120 
0121 static inline void cma_configfs_exit(void)
0122 {
0123 }
0124 #endif
0125 
0126 void cma_dev_get(struct cma_device *dev);
0127 void cma_dev_put(struct cma_device *dev);
0128 typedef bool (*cma_device_filter)(struct ib_device *, void *);
0129 struct cma_device *cma_enum_devices_by_ibdev(cma_device_filter filter,
0130                          void *cookie);
0131 int cma_get_default_gid_type(struct cma_device *dev, u32 port);
0132 int cma_set_default_gid_type(struct cma_device *dev, u32 port,
0133                  enum ib_gid_type default_gid_type);
0134 int cma_get_default_roce_tos(struct cma_device *dev, u32 port);
0135 int cma_set_default_roce_tos(struct cma_device *dev, u32 port,
0136                  u8 default_roce_tos);
0137 struct ib_device *cma_get_ib_dev(struct cma_device *dev);
0138 
0139 #endif /* _CMA_PRIV_H */