PM / sleep: Asynchronous threads for suspend_noirq
[linux/fpc-iii.git] / drivers / infiniband / hw / usnic / usnic_vnic.h
blob14d931a8829dc4616571af436e30fd2b03070825
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_VNIC_H_
20 #define USNIC_VNIC_H_
22 #include <linux/pci.h>
24 #include "vnic_dev.h"
26 /* =USNIC_VNIC_RES_TYPE= =VNIC_RES= =DESC= */
27 #define USNIC_VNIC_RES_TYPES \
28 DEFINE_USNIC_VNIC_RES_AT(EOL, RES_TYPE_EOL, "EOL", 0) \
29 DEFINE_USNIC_VNIC_RES(WQ, RES_TYPE_WQ, "WQ") \
30 DEFINE_USNIC_VNIC_RES(RQ, RES_TYPE_RQ, "RQ") \
31 DEFINE_USNIC_VNIC_RES(CQ, RES_TYPE_CQ, "CQ") \
32 DEFINE_USNIC_VNIC_RES(INTR, RES_TYPE_INTR_CTRL, "INT") \
33 DEFINE_USNIC_VNIC_RES(MAX, RES_TYPE_MAX, "MAX")\
35 #define DEFINE_USNIC_VNIC_RES_AT(usnic_vnic_res_t, vnic_res_type, desc, val) \
36 USNIC_VNIC_RES_TYPE_##usnic_vnic_res_t = val,
37 #define DEFINE_USNIC_VNIC_RES(usnic_vnic_res_t, vnic_res_type, desc) \
38 USNIC_VNIC_RES_TYPE_##usnic_vnic_res_t,
39 enum usnic_vnic_res_type {
40 USNIC_VNIC_RES_TYPES
42 #undef DEFINE_USNIC_VNIC_RES
43 #undef DEFINE_USNIC_VNIC_RES_AT
45 struct usnic_vnic_res {
46 enum usnic_vnic_res_type type;
47 unsigned int vnic_idx;
48 struct usnic_vnic *vnic;
49 void __iomem *ctrl;
50 void *owner;
53 struct usnic_vnic_res_chunk {
54 enum usnic_vnic_res_type type;
55 int cnt;
56 int free_cnt;
57 struct usnic_vnic_res **res;
58 struct usnic_vnic *vnic;
61 struct usnic_vnic_res_desc {
62 enum usnic_vnic_res_type type;
63 uint16_t cnt;
66 struct usnic_vnic_res_spec {
67 struct usnic_vnic_res_desc resources[USNIC_VNIC_RES_TYPE_MAX];
70 const char *usnic_vnic_res_type_to_str(enum usnic_vnic_res_type res_type);
71 const char *usnic_vnic_pci_name(struct usnic_vnic *vnic);
72 int usnic_vnic_dump(struct usnic_vnic *vnic, char *buf, int buf_sz,
73 void *hdr_obj,
74 int (*printtitle)(void *, char*, int),
75 int (*printcols)(char *, int),
76 int (*printrow)(void *, char *, int));
77 void usnic_vnic_res_spec_update(struct usnic_vnic_res_spec *spec,
78 enum usnic_vnic_res_type trgt_type,
79 u16 cnt);
80 int usnic_vnic_res_spec_satisfied(const struct usnic_vnic_res_spec *min_spec,
81 struct usnic_vnic_res_spec *res_spec);
82 int usnic_vnic_spec_dump(char *buf, int buf_sz,
83 struct usnic_vnic_res_spec *res_spec);
84 int usnic_vnic_check_room(struct usnic_vnic *vnic,
85 struct usnic_vnic_res_spec *res_spec);
86 int usnic_vnic_res_cnt(struct usnic_vnic *vnic,
87 enum usnic_vnic_res_type type);
88 int usnic_vnic_res_free_cnt(struct usnic_vnic *vnic,
89 enum usnic_vnic_res_type type);
90 struct usnic_vnic_res_chunk *
91 usnic_vnic_get_resources(struct usnic_vnic *vnic,
92 enum usnic_vnic_res_type type,
93 int cnt,
94 void *owner);
95 void usnic_vnic_put_resources(struct usnic_vnic_res_chunk *chunk);
96 struct pci_dev *usnic_vnic_get_pdev(struct usnic_vnic *vnic);
97 struct vnic_dev_bar *usnic_vnic_get_bar(struct usnic_vnic *vnic,
98 int bar_num);
99 struct usnic_vnic *usnic_vnic_alloc(struct pci_dev *pdev);
100 void usnic_vnic_free(struct usnic_vnic *vnic);
101 u16 usnic_vnic_get_index(struct usnic_vnic *vnic);
103 #endif /*!USNIC_VNIC_H_*/