This source file includes following definitions.
- fnic_queue_wq_desc
- fnic_queue_wq_eth_desc
- fnic_queue_wq_copy_desc_icmnd_16
- fnic_queue_wq_copy_desc_itmf
- fnic_queue_wq_copy_desc_flogi_reg
- fnic_queue_wq_copy_desc_fip_reg
- fnic_queue_wq_copy_desc_fw_reset
- fnic_queue_wq_copy_desc_lunmap
- fnic_queue_rq_desc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #ifndef _FNIC_RES_H_
19 #define _FNIC_RES_H_
20
21 #include "wq_enet_desc.h"
22 #include "rq_enet_desc.h"
23 #include "vnic_wq.h"
24 #include "vnic_rq.h"
25 #include "fnic_io.h"
26 #include "fcpio.h"
27 #include "vnic_wq_copy.h"
28 #include "vnic_cq_copy.h"
29
30 static inline void fnic_queue_wq_desc(struct vnic_wq *wq,
31 void *os_buf, dma_addr_t dma_addr,
32 unsigned int len, unsigned int fc_eof,
33 int vlan_tag_insert,
34 unsigned int vlan_tag,
35 int cq_entry, int sop, int eop)
36 {
37 struct wq_enet_desc *desc = vnic_wq_next_desc(wq);
38
39 wq_enet_desc_enc(desc,
40 (u64)dma_addr | VNIC_PADDR_TARGET,
41 (u16)len,
42 0,
43 (u16)fc_eof,
44 0,
45 (u8)eop, (u8)cq_entry,
46 1,
47 (u8)vlan_tag_insert,
48 (u16)vlan_tag,
49 0 );
50
51 vnic_wq_post(wq, os_buf, dma_addr, len, sop, eop);
52 }
53
54 static inline void fnic_queue_wq_eth_desc(struct vnic_wq *wq,
55 void *os_buf, dma_addr_t dma_addr,
56 unsigned int len,
57 int vlan_tag_insert,
58 unsigned int vlan_tag,
59 int cq_entry)
60 {
61 struct wq_enet_desc *desc = vnic_wq_next_desc(wq);
62
63 wq_enet_desc_enc(desc,
64 (u64)dma_addr | VNIC_PADDR_TARGET,
65 (u16)len,
66 0,
67 0,
68 0,
69 1,
70 (u8)cq_entry,
71 0,
72 (u8)vlan_tag_insert,
73 (u16)vlan_tag,
74 0 );
75
76 vnic_wq_post(wq, os_buf, dma_addr, len, 1, 1);
77 }
78
79 static inline void fnic_queue_wq_copy_desc_icmnd_16(struct vnic_wq_copy *wq,
80 u32 req_id,
81 u32 lunmap_id, u8 spl_flags,
82 u32 sgl_cnt, u32 sense_len,
83 u64 sgl_addr, u64 sns_addr,
84 u8 crn, u8 pri_ta,
85 u8 flags, u8 *scsi_cdb,
86 u8 cdb_len,
87 u32 data_len, u8 *lun,
88 u32 d_id, u16 mss,
89 u32 ratov, u32 edtov)
90 {
91 struct fcpio_host_req *desc = vnic_wq_copy_next_desc(wq);
92
93 desc->hdr.type = FCPIO_ICMND_16;
94 desc->hdr.status = 0;
95 desc->hdr._resvd = 0;
96 desc->hdr.tag.u.req_id = req_id;
97
98 desc->u.icmnd_16.lunmap_id = lunmap_id;
99 desc->u.icmnd_16.special_req_flags = spl_flags;
100 desc->u.icmnd_16._resvd0[0] = 0;
101 desc->u.icmnd_16._resvd0[1] = 0;
102 desc->u.icmnd_16._resvd0[2] = 0;
103 desc->u.icmnd_16.sgl_cnt = sgl_cnt;
104 desc->u.icmnd_16.sense_len = sense_len;
105 desc->u.icmnd_16.sgl_addr = sgl_addr;
106 desc->u.icmnd_16.sense_addr = sns_addr;
107 desc->u.icmnd_16.crn = crn;
108 desc->u.icmnd_16.pri_ta = pri_ta;
109 desc->u.icmnd_16._resvd1 = 0;
110 desc->u.icmnd_16.flags = flags;
111 memset(desc->u.icmnd_16.scsi_cdb, 0, CDB_16);
112 memcpy(desc->u.icmnd_16.scsi_cdb, scsi_cdb, cdb_len);
113 desc->u.icmnd_16.data_len = data_len;
114 memcpy(desc->u.icmnd_16.lun, lun, LUN_ADDRESS);
115 desc->u.icmnd_16._resvd2 = 0;
116 hton24(desc->u.icmnd_16.d_id, d_id);
117 desc->u.icmnd_16.mss = mss;
118 desc->u.icmnd_16.r_a_tov = ratov;
119 desc->u.icmnd_16.e_d_tov = edtov;
120
121 vnic_wq_copy_post(wq);
122 }
123
124 static inline void fnic_queue_wq_copy_desc_itmf(struct vnic_wq_copy *wq,
125 u32 req_id, u32 lunmap_id,
126 u32 tm_req, u32 tm_id, u8 *lun,
127 u32 d_id, u32 r_a_tov,
128 u32 e_d_tov)
129 {
130 struct fcpio_host_req *desc = vnic_wq_copy_next_desc(wq);
131
132 desc->hdr.type = FCPIO_ITMF;
133 desc->hdr.status = 0;
134 desc->hdr._resvd = 0;
135 desc->hdr.tag.u.req_id = req_id;
136
137 desc->u.itmf.lunmap_id = lunmap_id;
138 desc->u.itmf.tm_req = tm_req;
139 desc->u.itmf.t_tag = tm_id;
140 desc->u.itmf._resvd = 0;
141 memcpy(desc->u.itmf.lun, lun, LUN_ADDRESS);
142 desc->u.itmf._resvd1 = 0;
143 hton24(desc->u.itmf.d_id, d_id);
144 desc->u.itmf.r_a_tov = r_a_tov;
145 desc->u.itmf.e_d_tov = e_d_tov;
146
147 vnic_wq_copy_post(wq);
148 }
149
150 static inline void fnic_queue_wq_copy_desc_flogi_reg(struct vnic_wq_copy *wq,
151 u32 req_id, u8 format,
152 u32 s_id, u8 *gw_mac)
153 {
154 struct fcpio_host_req *desc = vnic_wq_copy_next_desc(wq);
155
156 desc->hdr.type = FCPIO_FLOGI_REG;
157 desc->hdr.status = 0;
158 desc->hdr._resvd = 0;
159 desc->hdr.tag.u.req_id = req_id;
160
161 desc->u.flogi_reg.format = format;
162 desc->u.flogi_reg._resvd = 0;
163 hton24(desc->u.flogi_reg.s_id, s_id);
164 memcpy(desc->u.flogi_reg.gateway_mac, gw_mac, ETH_ALEN);
165
166 vnic_wq_copy_post(wq);
167 }
168
169 static inline void fnic_queue_wq_copy_desc_fip_reg(struct vnic_wq_copy *wq,
170 u32 req_id, u32 s_id,
171 u8 *fcf_mac, u8 *ha_mac,
172 u32 r_a_tov, u32 e_d_tov)
173 {
174 struct fcpio_host_req *desc = vnic_wq_copy_next_desc(wq);
175
176 desc->hdr.type = FCPIO_FLOGI_FIP_REG;
177 desc->hdr.status = 0;
178 desc->hdr._resvd = 0;
179 desc->hdr.tag.u.req_id = req_id;
180
181 desc->u.flogi_fip_reg._resvd0 = 0;
182 hton24(desc->u.flogi_fip_reg.s_id, s_id);
183 memcpy(desc->u.flogi_fip_reg.fcf_mac, fcf_mac, ETH_ALEN);
184 desc->u.flogi_fip_reg._resvd1 = 0;
185 desc->u.flogi_fip_reg.r_a_tov = r_a_tov;
186 desc->u.flogi_fip_reg.e_d_tov = e_d_tov;
187 memcpy(desc->u.flogi_fip_reg.ha_mac, ha_mac, ETH_ALEN);
188 desc->u.flogi_fip_reg._resvd2 = 0;
189
190 vnic_wq_copy_post(wq);
191 }
192
193 static inline void fnic_queue_wq_copy_desc_fw_reset(struct vnic_wq_copy *wq,
194 u32 req_id)
195 {
196 struct fcpio_host_req *desc = vnic_wq_copy_next_desc(wq);
197
198 desc->hdr.type = FCPIO_RESET;
199 desc->hdr.status = 0;
200 desc->hdr._resvd = 0;
201 desc->hdr.tag.u.req_id = req_id;
202
203 vnic_wq_copy_post(wq);
204 }
205
206 static inline void fnic_queue_wq_copy_desc_lunmap(struct vnic_wq_copy *wq,
207 u32 req_id, u64 lunmap_addr,
208 u32 lunmap_len)
209 {
210 struct fcpio_host_req *desc = vnic_wq_copy_next_desc(wq);
211
212 desc->hdr.type = FCPIO_LUNMAP_REQ;
213 desc->hdr.status = 0;
214 desc->hdr._resvd = 0;
215 desc->hdr.tag.u.req_id = req_id;
216
217 desc->u.lunmap_req.addr = lunmap_addr;
218 desc->u.lunmap_req.len = lunmap_len;
219
220 vnic_wq_copy_post(wq);
221 }
222
223 static inline void fnic_queue_rq_desc(struct vnic_rq *rq,
224 void *os_buf, dma_addr_t dma_addr,
225 u16 len)
226 {
227 struct rq_enet_desc *desc = vnic_rq_next_desc(rq);
228
229 rq_enet_desc_enc(desc,
230 (u64)dma_addr | VNIC_PADDR_TARGET,
231 RQ_ENET_TYPE_ONLY_SOP,
232 (u16)len);
233
234 vnic_rq_post(rq, os_buf, 0, dma_addr, len);
235 }
236
237
238 struct fnic;
239
240 int fnic_get_vnic_config(struct fnic *);
241 int fnic_alloc_vnic_resources(struct fnic *);
242 void fnic_free_vnic_resources(struct fnic *);
243 void fnic_get_res_counts(struct fnic *);
244 int fnic_set_nic_config(struct fnic *fnic, u8 rss_default_cpu,
245 u8 rss_hash_type, u8 rss_hash_bits, u8 rss_base_cpu,
246 u8 rss_enable, u8 tso_ipid_split_en,
247 u8 ig_vlan_strip_en);
248
249 #endif