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
22 #include <linux/iommu.h>
23 #include <linux/netdevice.h>
25 #include <rdma/ib_verbs.h>
29 #include "usnic_abi.h"
30 #include "usnic_vnic.h"
32 #define USNIC_IB_PORT_CNT 1
33 #define USNIC_IB_NUM_COMP_VECTORS 1
35 extern unsigned int usnic_ib_share_vf
;
37 struct usnic_ib_ucontext
{
38 struct ib_ucontext ibucontext
;
39 /* Protected by usnic_ib_dev->usdev_lock */
40 struct list_head qp_grp_list
;
41 struct list_head link
;
46 struct usnic_uiom_pd
*umem_pd
;
51 struct usnic_uiom_reg
*umem
;
55 struct ib_device ib_dev
;
57 struct net_device
*netdev
;
58 struct usnic_fwd_dev
*ufdev
;
59 struct list_head ib_dev_link
;
60 struct list_head vf_dev_list
;
61 struct list_head ctx_list
;
62 struct mutex usdev_lock
;
64 /* provisioning information */
66 unsigned int vf_res_cnt
[USNIC_VNIC_RES_TYPE_MAX
];
68 /* sysfs vars for QPN reporting */
69 struct kobject
*qpn_kobj
;
73 struct usnic_ib_dev
*pf
;
75 struct usnic_vnic
*vnic
;
76 unsigned int qp_grp_ref_cnt
;
77 struct usnic_ib_pd
*pd
;
78 struct list_head link
;
82 struct usnic_ib_dev
*to_usdev(struct ib_device
*ibdev
)
84 return container_of(ibdev
, struct usnic_ib_dev
, ib_dev
);
88 struct usnic_ib_ucontext
*to_ucontext(struct ib_ucontext
*ibucontext
)
90 return container_of(ibucontext
, struct usnic_ib_ucontext
, ibucontext
);
94 struct usnic_ib_pd
*to_upd(struct ib_pd
*ibpd
)
96 return container_of(ibpd
, struct usnic_ib_pd
, ibpd
);
100 struct usnic_ib_ucontext
*to_uucontext(struct ib_ucontext
*ibucontext
)
102 return container_of(ibucontext
, struct usnic_ib_ucontext
, ibucontext
);
106 struct usnic_ib_mr
*to_umr(struct ib_mr
*ibmr
)
108 return container_of(ibmr
, struct usnic_ib_mr
, ibmr
);
110 void usnic_ib_log_vf(struct usnic_ib_vf
*vf
);
112 #define UPDATE_PTR_LEFT(N, P, L) \
118 #endif /* USNIC_IB_H_ */