PM / sleep: Asynchronous threads for suspend_noirq
[linux/fpc-iii.git] / drivers / infiniband / hw / usnic / usnic_ib_qp_grp.h
blobb0aafe8db0c35a9d2930e59207a0a01f530b1792
1 /*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
4 * This program is free software; you may redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
11 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
12 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
13 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
14 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
15 * SOFTWARE.
19 #ifndef USNIC_IB_QP_GRP_H_
20 #define USNIC_IB_QP_GRP_H_
22 #include <linux/debugfs.h>
23 #include <rdma/ib_verbs.h>
25 #include "usnic_ib.h"
26 #include "usnic_abi.h"
27 #include "usnic_fwd.h"
28 #include "usnic_vnic.h"
31 * The qp group struct represents all the hw resources needed to present a ib_qp
33 struct usnic_ib_qp_grp {
34 struct ib_qp ibqp;
35 enum ib_qp_state state;
36 int grp_id;
38 struct usnic_fwd_dev *ufdev;
39 struct usnic_ib_ucontext *ctx;
40 struct list_head flows_lst;
42 struct usnic_vnic_res_chunk **res_chunk_list;
44 pid_t owner_pid;
45 struct usnic_ib_vf *vf;
46 struct list_head link;
48 spinlock_t lock;
50 struct kobject kobj;
53 struct usnic_ib_qp_grp_flow {
54 struct usnic_fwd_flow *flow;
55 enum usnic_transport_type trans_type;
56 union {
57 struct {
58 uint16_t port_num;
59 } usnic_roce;
60 struct {
61 struct socket *sock;
62 } udp;
64 struct usnic_ib_qp_grp *qp_grp;
65 struct list_head link;
67 /* Debug FS */
68 struct dentry *dbgfs_dentry;
69 char dentry_name[32];
72 static const struct
73 usnic_vnic_res_spec min_transport_spec[USNIC_TRANSPORT_MAX] = {
74 { /*USNIC_TRANSPORT_UNKNOWN*/
75 .resources = {
76 {.type = USNIC_VNIC_RES_TYPE_EOL, .cnt = 0,},
79 { /*USNIC_TRANSPORT_ROCE_CUSTOM*/
80 .resources = {
81 {.type = USNIC_VNIC_RES_TYPE_WQ, .cnt = 1,},
82 {.type = USNIC_VNIC_RES_TYPE_RQ, .cnt = 1,},
83 {.type = USNIC_VNIC_RES_TYPE_CQ, .cnt = 1,},
84 {.type = USNIC_VNIC_RES_TYPE_EOL, .cnt = 0,},
87 { /*USNIC_TRANSPORT_IPV4_UDP*/
88 .resources = {
89 {.type = USNIC_VNIC_RES_TYPE_WQ, .cnt = 1,},
90 {.type = USNIC_VNIC_RES_TYPE_RQ, .cnt = 1,},
91 {.type = USNIC_VNIC_RES_TYPE_CQ, .cnt = 1,},
92 {.type = USNIC_VNIC_RES_TYPE_EOL, .cnt = 0,},
97 const char *usnic_ib_qp_grp_state_to_string(enum ib_qp_state state);
98 int usnic_ib_qp_grp_dump_hdr(char *buf, int buf_sz);
99 int usnic_ib_qp_grp_dump_rows(void *obj, char *buf, int buf_sz);
100 struct usnic_ib_qp_grp *
101 usnic_ib_qp_grp_create(struct usnic_fwd_dev *ufdev, struct usnic_ib_vf *vf,
102 struct usnic_ib_pd *pd,
103 struct usnic_vnic_res_spec *res_spec,
104 struct usnic_transport_spec *trans_spec);
105 void usnic_ib_qp_grp_destroy(struct usnic_ib_qp_grp *qp_grp);
106 int usnic_ib_qp_grp_modify(struct usnic_ib_qp_grp *qp_grp,
107 enum ib_qp_state new_state,
108 void *data);
109 struct usnic_vnic_res_chunk
110 *usnic_ib_qp_grp_get_chunk(struct usnic_ib_qp_grp *qp_grp,
111 enum usnic_vnic_res_type type);
112 static inline
113 struct usnic_ib_qp_grp *to_uqp_grp(struct ib_qp *ibqp)
115 return container_of(ibqp, struct usnic_ib_qp_grp, ibqp);
117 #endif /* USNIC_IB_QP_GRP_H_ */