2 * This file is part of the Chelsio FCoE driver for Linux.
4 * Copyright (c) 2009-2010 Chelsio Communications, Inc. All rights reserved.
6 * This software is available to you under a choice of one of two
7 * licenses. You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file
9 * COPYING in the main directory of this source tree, or the
10 * OpenIB.org BSD license below:
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
16 * - Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
20 * - Redistributions in binary form must reproduce the above
21 * copyright notice, this list of conditions and the following
22 * disclaimer in the documentation and/or other materials
23 * provided with the distribution.
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35 #ifndef _T4FW_API_STOR_H_
36 #define _T4FW_API_STOR_H_
39 /******************************************************************************
40 * R E T U R N V A L U E S
41 ********************************/
43 enum fw_fcoe_link_sub_op
{
49 enum fw_fcoe_link_status
{
59 enum rport_type_fcoe
{
60 FLOGI_VFPORT
= 0x1, /* 0xfffffe */
61 FDISC_VFPORT
= 0x2, /* 0xfffffe */
62 NS_VNPORT
= 0x3, /* 0xfffffc */
63 REG_FC4_VNPORT
= 0x4, /* any FC4 type VN_PORT */
64 REG_VNPORT
= 0x5, /* 0xfffxxx - non FC4 port in switch */
65 FDMI_VNPORT
= 0x6, /* 0xfffffa */
66 FAB_CTLR_VNPORT
= 0x7, /* 0xfffffd */
69 enum event_cause_fcoe
{
70 PLOGI_ACC_RCVD
= 0x01,
71 PLOGI_RJT_RCVD
= 0x02,
80 CLR_VIRT_LNK_RCVD
= 0x0b,
81 FLOGI_ACC_RCVD
= 0x0c,
82 FLOGI_RJT_RCVD
= 0x0d,
83 FDISC_ACC_RCVD
= 0x0e,
84 FDISC_RJT_RCVD
= 0x0f,
85 FLOGI_TMO_MAX_RETRY
= 0x10,
86 IMPL_LOGO_ADISC_ACC
= 0x11,
87 IMPL_LOGO_ADISC_RJT
= 0x12,
88 IMPL_LOGO_ADISC_CNFLT
= 0x13,
93 ADISC_RJT_RCVD
= 0x18,
95 PROTO_ERR_IMPL_LOGO
= 0x1a,
105 enum fw_wr_stor_opcodes
{
107 FW_FCOE_ELS_CT_WR
= 0x30,
108 FW_SCSI_WRITE_WR
= 0x31,
109 FW_SCSI_READ_WR
= 0x32,
110 FW_SCSI_CMD_WR
= 0x33,
111 FW_SCSI_ABRT_CLS_WR
= 0x34,
115 __be32 op_to_immdlen
;
116 __be32 alloc_to_len16
;
122 __be32 flags_to_assoc_flowid
;
124 struct fcoe_rdev_entry
{
133 u8 rd_xfer_rdy_to_rport_type
;
135 u8 org_proc_assoc_to_acc_rsp_code
;
143 struct iscsi_rdev_entry
{
154 __be16 first_brst_len
;
157 __be16 def_time2wait
;
159 __be16 nop_out_intrvl
;
171 #define FW_RDEV_WR_FLOWID_GET(x) (((x) >> 8) & 0xfffff)
172 #define FW_RDEV_WR_ASSOC_FLOWID_GET(x) (((x) >> 0) & 0xfffff)
173 #define FW_RDEV_WR_RPORT_TYPE_GET(x) (((x) >> 0) & 0x1f)
174 #define FW_RDEV_WR_NPIV_GET(x) (((x) >> 6) & 0x1)
175 #define FW_RDEV_WR_CLASS_GET(x) (((x) >> 4) & 0x3)
176 #define FW_RDEV_WR_TASK_RETRY_ID_GET(x) (((x) >> 5) & 0x1)
177 #define FW_RDEV_WR_RETRY_GET(x) (((x) >> 4) & 0x1)
178 #define FW_RDEV_WR_CONF_CMPL_GET(x) (((x) >> 3) & 0x1)
179 #define FW_RDEV_WR_INI_GET(x) (((x) >> 1) & 0x1)
180 #define FW_RDEV_WR_TGT_GET(x) (((x) >> 0) & 0x1)
182 struct fw_fcoe_els_ct_wr
{
201 #define FW_FCOE_ELS_CT_WR_OPCODE(x) ((x) << 24)
202 #define FW_FCOE_ELS_CT_WR_OPCODE_GET(x) (((x) >> 24) & 0xff)
203 #define FW_FCOE_ELS_CT_WR_IMMDLEN(x) ((x) << 0)
204 #define FW_FCOE_ELS_CT_WR_IMMDLEN_GET(x) (((x) >> 0) & 0xff)
205 #define FW_FCOE_ELS_CT_WR_SP(x) ((x) << 0)
207 struct fw_scsi_write_wr
{
214 union fw_scsi_write_priv
{
215 struct fcoe_write_priv
{
220 struct iscsi_write_priv
{
231 #define FW_SCSI_WRITE_WR_IMMDLEN(x) ((x) << 0)
233 struct fw_scsi_read_wr
{
240 union fw_scsi_read_priv
{
241 struct fcoe_read_priv
{
246 struct iscsi_read_priv
{
257 #define FW_SCSI_READ_WR_IMMDLEN(x) ((x) << 0)
259 struct fw_scsi_cmd_wr
{
266 union fw_scsi_cmd_priv
{
267 struct fcoe_cmd_priv
{
272 struct iscsi_cmd_priv
{
282 #define FW_SCSI_CMD_WR_IMMDLEN(x) ((x) << 0)
287 struct fw_scsi_abrt_cls_wr
{
293 u8 sub_opcode_to_chk_all_io
;
298 #define FW_SCSI_ABRT_CLS_WR_SUB_OPCODE(x) ((x) << 2)
299 #define FW_SCSI_ABRT_CLS_WR_SUB_OPCODE_GET(x) (((x) >> 2) & 0x3f)
300 #define FW_SCSI_ABRT_CLS_WR_CHK_ALL_IO(x) ((x) << 0)
302 enum fw_cmd_stor_opcodes
{
303 FW_FCOE_RES_INFO_CMD
= 0x31,
304 FW_FCOE_LINK_CMD
= 0x32,
305 FW_FCOE_VNP_CMD
= 0x33,
306 FW_FCOE_SPARAMS_CMD
= 0x35,
307 FW_FCOE_STATS_CMD
= 0x37,
308 FW_FCOE_FCF_CMD
= 0x38,
311 struct fw_fcoe_res_info_cmd
{
328 struct fw_fcoe_link_cmd
{
331 __be32 sub_opcode_fcfi
;
345 #define FW_FCOE_LINK_CMD_PORTID(x) ((x) << 0)
346 #define FW_FCOE_LINK_CMD_PORTID_GET(x) (((x) >> 0) & 0xf)
347 #define FW_FCOE_LINK_CMD_SUB_OPCODE(x) ((x) << 24U)
348 #define FW_FCOE_LINK_CMD_FCFI(x) ((x) << 0)
349 #define FW_FCOE_LINK_CMD_FCFI_GET(x) (((x) >> 0) & 0xffffff)
350 #define FW_FCOE_LINK_CMD_VNPI_GET(x) (((x) >> 0) & 0xfffff)
352 struct fw_fcoe_vnp_cmd
{
354 __be32 alloc_to_len16
;
355 __be32 gen_wwn_to_vnpi
;
361 u8 cmn_srv_parms
[16];
365 #define FW_FCOE_VNP_CMD_FCFI(x) ((x) << 0)
366 #define FW_FCOE_VNP_CMD_ALLOC (1U << 31)
367 #define FW_FCOE_VNP_CMD_FREE (1U << 30)
368 #define FW_FCOE_VNP_CMD_MODIFY (1U << 29)
369 #define FW_FCOE_VNP_CMD_GEN_WWN (1U << 22)
370 #define FW_FCOE_VNP_CMD_VFID_EN (1U << 20)
371 #define FW_FCOE_VNP_CMD_VNPI(x) ((x) << 0)
372 #define FW_FCOE_VNP_CMD_VNPI_GET(x) (((x) >> 0) & 0xfffff)
374 struct fw_fcoe_sparams_cmd
{
381 u8 cmn_srv_parms
[16];
382 u8 cls_srv_parms
[16];
385 #define FW_FCOE_SPARAMS_CMD_PORTID(x) ((x) << 0)
387 struct fw_fcoe_stats_cmd
{
389 __be32 free_to_len16
;
390 union fw_fcoe_stats
{
391 struct fw_fcoe_stats_ctl
{
403 struct fw_fcoe_port_stats
{
404 __be64 tx_bcast_bytes
;
405 __be64 tx_bcast_frames
;
406 __be64 tx_mcast_bytes
;
407 __be64 tx_mcast_frames
;
408 __be64 tx_ucast_bytes
;
409 __be64 tx_ucast_frames
;
410 __be64 tx_drop_frames
;
411 __be64 tx_offload_bytes
;
412 __be64 tx_offload_frames
;
413 __be64 rx_bcast_bytes
;
414 __be64 rx_bcast_frames
;
415 __be64 rx_mcast_bytes
;
416 __be64 rx_mcast_frames
;
417 __be64 rx_ucast_bytes
;
418 __be64 rx_ucast_frames
;
419 __be64 rx_err_frames
;
421 struct fw_fcoe_fcf_stats
{
425 __be64 mcast_adv_rcvd
;
426 __be16 ucast_adv_rcvd
;
444 struct fw_fcoe_pcb_stats
{
450 __be32 unsol_els_rcvd
;
451 __be64 unsol_cmd_rcvd
;
452 __be16 implicit_logo
;
453 __be16 flogi_inv_sparm
;
454 __be16 fdisc_inv_sparm
;
461 struct fw_fcoe_scb_stats
{
466 __be32 host_abrt_req
;
467 __be32 adap_auto_abrt
;
468 __be32 adap_abrt_rsp
;
471 __be16 ssn_not_rdy_ios
;
474 __be16 rx_data_fr_err
;
485 __be64 unsol_cmd_rcvd
;
486 __be32 plogi_req_rcvd
;
487 __be32 prli_req_rcvd
;
488 __be16 logo_req_rcvd
;
489 __be16 prlo_req_rcvd
;
490 __be16 plogi_rjt_rcvd
;
491 __be16 prli_rjt_rcvd
;
492 __be32 adisc_req_rcvd
;
495 __be32 unsol_els_rcvd
;
505 #define FW_FCOE_STATS_CMD_FLOWID(x) ((x) << 0)
506 #define FW_FCOE_STATS_CMD_FREE (1U << 30)
507 #define FW_FCOE_STATS_CMD_NSTATS(x) ((x) << 4)
508 #define FW_FCOE_STATS_CMD_PORT(x) ((x) << 0)
509 #define FW_FCOE_STATS_CMD_PORT_VALID (1U << 7)
510 #define FW_FCOE_STATS_CMD_IX(x) ((x) << 0)
512 struct fw_fcoe_fcf_cmd
{
520 __be16 max_fcoe_size
;
531 #define FW_FCOE_FCF_CMD_FCFI(x) ((x) << 0)
532 #define FW_FCOE_FCF_CMD_FCFI_GET(x) (((x) >> 0) & 0xfffff)
533 #define FW_FCOE_FCF_CMD_PRIORITY_GET(x) (((x) >> 0) & 0xff)
534 #define FW_FCOE_FCF_CMD_FPMA_GET(x) (((x) >> 6) & 0x1)
535 #define FW_FCOE_FCF_CMD_SPMA_GET(x) (((x) >> 5) & 0x1)
536 #define FW_FCOE_FCF_CMD_LOGIN_GET(x) (((x) >> 4) & 0x1)
537 #define FW_FCOE_FCF_CMD_PORTID_GET(x) (((x) >> 0) & 0xf)
539 #endif /* _T4FW_API_STOR_H_ */