1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright 2014 Cisco Systems, Inc. All rights reserved. */
8 #include "wq_enet_desc.h"
10 #include "snic_fwint.h"
11 #include "vnic_cq_fw.h"
14 snic_icmnd_init(struct snic_host_req
*req
, u32 cmnd_id
, u32 host_id
, u64 ctx
,
15 u16 flags
, u64 tgt_id
, u8
*lun
, u8
*scsi_cdb
, u8 cdb_len
,
16 u32 data_len
, u16 sg_cnt
, ulong sgl_addr
,
17 dma_addr_t sns_addr_pa
, u32 sense_len
)
19 snic_io_hdr_enc(&req
->hdr
, SNIC_REQ_ICMND
, 0, cmnd_id
, host_id
, sg_cnt
,
22 req
->u
.icmnd
.flags
= cpu_to_le16(flags
);
23 req
->u
.icmnd
.tgt_id
= cpu_to_le64(tgt_id
);
24 memcpy(&req
->u
.icmnd
.lun_id
, lun
, LUN_ADDR_LEN
);
25 req
->u
.icmnd
.cdb_len
= cdb_len
;
26 memset(req
->u
.icmnd
.cdb
, 0, SNIC_CDB_LEN
);
27 memcpy(req
->u
.icmnd
.cdb
, scsi_cdb
, cdb_len
);
28 req
->u
.icmnd
.data_len
= cpu_to_le32(data_len
);
29 req
->u
.icmnd
.sg_addr
= cpu_to_le64(sgl_addr
);
30 req
->u
.icmnd
.sense_len
= cpu_to_le32(sense_len
);
31 req
->u
.icmnd
.sense_addr
= cpu_to_le64(sns_addr_pa
);
35 snic_itmf_init(struct snic_host_req
*req
, u32 cmnd_id
, u32 host_id
, ulong ctx
,
36 u16 flags
, u32 req_id
, u64 tgt_id
, u8
*lun
, u8 tm_type
)
38 snic_io_hdr_enc(&req
->hdr
, SNIC_REQ_ITMF
, 0, cmnd_id
, host_id
, 0, ctx
);
40 req
->u
.itmf
.tm_type
= tm_type
;
41 req
->u
.itmf
.flags
= cpu_to_le16(flags
);
42 /* req_id valid only in abort, clear task */
43 req
->u
.itmf
.req_id
= cpu_to_le32(req_id
);
44 req
->u
.itmf
.tgt_id
= cpu_to_le64(tgt_id
);
45 memcpy(&req
->u
.itmf
.lun_id
, lun
, LUN_ADDR_LEN
);
49 snic_queue_wq_eth_desc(struct vnic_wq
*wq
,
54 unsigned int vlan_tag
,
57 struct wq_enet_desc
*desc
= svnic_wq_next_desc(wq
);
59 wq_enet_desc_enc(desc
,
60 (u64
)dma_addr
| VNIC_PADDR_TARGET
,
62 0, /* mss_or_csum_offset */
72 svnic_wq_post(wq
, os_buf
, dma_addr
, len
, 1, 1);
77 int snic_get_vnic_config(struct snic
*);
78 int snic_alloc_vnic_res(struct snic
*);
79 void snic_free_vnic_res(struct snic
*);
80 void snic_get_res_counts(struct snic
*);
81 void snic_log_q_error(struct snic
*);
82 int snic_get_vnic_resources_size(struct snic
*);
83 #endif /* __SNIC_RES_H */