2 * Copyright 2014 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 "wq_enet_desc.h"
24 #include "snic_fwint.h"
25 #include "vnic_cq_fw.h"
28 snic_icmnd_init(struct snic_host_req
*req
, u32 cmnd_id
, u32 host_id
, u64 ctx
,
29 u16 flags
, u64 tgt_id
, u8
*lun
, u8
*scsi_cdb
, u8 cdb_len
,
30 u32 data_len
, u16 sg_cnt
, ulong sgl_addr
,
31 dma_addr_t sns_addr_pa
, u32 sense_len
)
33 snic_io_hdr_enc(&req
->hdr
, SNIC_REQ_ICMND
, 0, cmnd_id
, host_id
, sg_cnt
,
36 req
->u
.icmnd
.flags
= cpu_to_le16(flags
);
37 req
->u
.icmnd
.tgt_id
= cpu_to_le64(tgt_id
);
38 memcpy(&req
->u
.icmnd
.lun_id
, lun
, LUN_ADDR_LEN
);
39 req
->u
.icmnd
.cdb_len
= cdb_len
;
40 memset(req
->u
.icmnd
.cdb
, 0, SNIC_CDB_LEN
);
41 memcpy(req
->u
.icmnd
.cdb
, scsi_cdb
, cdb_len
);
42 req
->u
.icmnd
.data_len
= cpu_to_le32(data_len
);
43 req
->u
.icmnd
.sg_addr
= cpu_to_le64(sgl_addr
);
44 req
->u
.icmnd
.sense_len
= cpu_to_le32(sense_len
);
45 req
->u
.icmnd
.sense_addr
= cpu_to_le64(sns_addr_pa
);
49 snic_itmf_init(struct snic_host_req
*req
, u32 cmnd_id
, u32 host_id
, ulong ctx
,
50 u16 flags
, u32 req_id
, u64 tgt_id
, u8
*lun
, u8 tm_type
)
52 snic_io_hdr_enc(&req
->hdr
, SNIC_REQ_ITMF
, 0, cmnd_id
, host_id
, 0, ctx
);
54 req
->u
.itmf
.tm_type
= tm_type
;
55 req
->u
.itmf
.flags
= cpu_to_le16(flags
);
56 /* req_id valid only in abort, clear task */
57 req
->u
.itmf
.req_id
= cpu_to_le32(req_id
);
58 req
->u
.itmf
.tgt_id
= cpu_to_le64(tgt_id
);
59 memcpy(&req
->u
.itmf
.lun_id
, lun
, LUN_ADDR_LEN
);
63 snic_queue_wq_eth_desc(struct vnic_wq
*wq
,
68 unsigned int vlan_tag
,
71 struct wq_enet_desc
*desc
= svnic_wq_next_desc(wq
);
73 wq_enet_desc_enc(desc
,
74 (u64
)dma_addr
| VNIC_PADDR_TARGET
,
76 0, /* mss_or_csum_offset */
86 svnic_wq_post(wq
, os_buf
, dma_addr
, len
, 1, 1);
91 int snic_get_vnic_config(struct snic
*);
92 int snic_alloc_vnic_res(struct snic
*);
93 void snic_free_vnic_res(struct snic
*);
94 void snic_get_res_counts(struct snic
*);
95 void snic_log_q_error(struct snic
*);
96 int snic_get_vnic_resources_size(struct snic
*);
97 #endif /* __SNIC_RES_H */