xref: /freebsd/sys/ofed/drivers/infiniband/core/iwcm.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1fe267a55SPedro F. Giffuni /*-
2fe267a55SPedro F. Giffuni  * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
3fe267a55SPedro F. Giffuni  *
4aa0a1e58SJeff Roberson  * Copyright (c) 2005 Network Appliance, Inc. All rights reserved.
5aa0a1e58SJeff Roberson  * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved.
6aa0a1e58SJeff Roberson  *
7aa0a1e58SJeff Roberson  * This software is available to you under a choice of one of two
8aa0a1e58SJeff Roberson  * licenses.  You may choose to be licensed under the terms of the GNU
9aa0a1e58SJeff Roberson  * General Public License (GPL) Version 2, available from the file
10aa0a1e58SJeff Roberson  * COPYING in the main directory of this source tree, or the
11aa0a1e58SJeff Roberson  * OpenIB.org BSD license below:
12aa0a1e58SJeff Roberson  *
13aa0a1e58SJeff Roberson  *     Redistribution and use in source and binary forms, with or
14aa0a1e58SJeff Roberson  *     without modification, are permitted provided that the following
15aa0a1e58SJeff Roberson  *     conditions are met:
16aa0a1e58SJeff Roberson  *
17aa0a1e58SJeff Roberson  *      - Redistributions of source code must retain the above
18aa0a1e58SJeff Roberson  *        copyright notice, this list of conditions and the following
19aa0a1e58SJeff Roberson  *        disclaimer.
20aa0a1e58SJeff Roberson  *
21aa0a1e58SJeff Roberson  *      - Redistributions in binary form must reproduce the above
22aa0a1e58SJeff Roberson  *        copyright notice, this list of conditions and the following
23aa0a1e58SJeff Roberson  *        disclaimer in the documentation and/or other materials
24aa0a1e58SJeff Roberson  *        provided with the distribution.
25aa0a1e58SJeff Roberson  *
26aa0a1e58SJeff Roberson  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27aa0a1e58SJeff Roberson  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28aa0a1e58SJeff Roberson  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29aa0a1e58SJeff Roberson  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
30aa0a1e58SJeff Roberson  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
31aa0a1e58SJeff Roberson  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
32aa0a1e58SJeff Roberson  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33aa0a1e58SJeff Roberson  * SOFTWARE.
34aa0a1e58SJeff Roberson  */
35*09938b21SHans Petter Selasky 
36aa0a1e58SJeff Roberson #ifndef IWCM_H
37aa0a1e58SJeff Roberson #define IWCM_H
38aa0a1e58SJeff Roberson 
39aa0a1e58SJeff Roberson enum iw_cm_state {
40aa0a1e58SJeff Roberson 	IW_CM_STATE_IDLE,             /* unbound, inactive */
41aa0a1e58SJeff Roberson 	IW_CM_STATE_LISTEN,           /* listen waiting for connect */
42aa0a1e58SJeff Roberson 	IW_CM_STATE_CONN_RECV,        /* inbound waiting for user accept */
43aa0a1e58SJeff Roberson 	IW_CM_STATE_CONN_SENT,        /* outbound waiting for peer accept */
44aa0a1e58SJeff Roberson 	IW_CM_STATE_ESTABLISHED,      /* established */
45aa0a1e58SJeff Roberson 	IW_CM_STATE_CLOSING,	      /* disconnect */
46aa0a1e58SJeff Roberson 	IW_CM_STATE_DESTROYING        /* object being deleted */
47aa0a1e58SJeff Roberson };
48aa0a1e58SJeff Roberson 
49aa0a1e58SJeff Roberson struct iwcm_id_private {
50aa0a1e58SJeff Roberson 	struct iw_cm_id	id;
51aa0a1e58SJeff Roberson 	enum iw_cm_state state;
52aa0a1e58SJeff Roberson 	unsigned long flags;
53aa0a1e58SJeff Roberson 	struct ib_qp *qp;
54aa0a1e58SJeff Roberson 	struct completion destroy_comp;
55aa0a1e58SJeff Roberson 	wait_queue_head_t connect_wait;
56aa0a1e58SJeff Roberson 	struct list_head work_list;
57aa0a1e58SJeff Roberson 	spinlock_t lock;
58aa0a1e58SJeff Roberson 	atomic_t refcount;
59aa0a1e58SJeff Roberson 	struct list_head work_free_list;
60aa0a1e58SJeff Roberson };
61aa0a1e58SJeff Roberson 
62478d3005SHans Petter Selasky #define IWCM_F_DROP_EVENTS	  1
63aa0a1e58SJeff Roberson #define IWCM_F_CONNECT_WAIT       2
64aa0a1e58SJeff Roberson 
65aa0a1e58SJeff Roberson #endif /* IWCM_H */
66