Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Marvell Fibre Channel HBA Driver
0004  * Copyright (C)  2018-     Marvell
0005  *
0006  */
0007 #ifndef __QLA_EDIF_BSG_H
0008 #define __QLA_EDIF_BSG_H
0009 
0010 #define EDIF_VERSION1 1
0011 
0012 /* BSG Vendor specific commands */
0013 #define ELS_MAX_PAYLOAD     2112
0014 #ifndef WWN_SIZE
0015 #define WWN_SIZE        8
0016 #endif
0017 #define VND_CMD_APP_RESERVED_SIZE   28
0018 #define VND_CMD_PAD_SIZE                3
0019 enum auth_els_sub_cmd {
0020     SEND_ELS = 0,
0021     SEND_ELS_REPLY,
0022     PULL_ELS,
0023 };
0024 
0025 struct extra_auth_els {
0026     enum auth_els_sub_cmd sub_cmd;
0027     uint32_t        extra_rx_xchg_address;
0028     uint8_t         extra_control_flags;
0029 #define BSG_CTL_FLAG_INIT       0
0030 #define BSG_CTL_FLAG_LS_ACC     1
0031 #define BSG_CTL_FLAG_LS_RJT     2
0032 #define BSG_CTL_FLAG_TRM        3
0033     uint8_t     version;
0034     uint8_t     pad[2];
0035     uint8_t     reserved[VND_CMD_APP_RESERVED_SIZE];
0036 } __packed;
0037 
0038 struct qla_bsg_auth_els_request {
0039     struct fc_bsg_request r;
0040     struct extra_auth_els e;
0041 };
0042 
0043 struct qla_bsg_auth_els_reply {
0044     struct fc_bsg_reply r;
0045     uint32_t rx_xchg_address;
0046     uint8_t version;
0047     uint8_t pad[VND_CMD_PAD_SIZE];
0048     uint8_t reserved[VND_CMD_APP_RESERVED_SIZE];
0049 };
0050 
0051 struct app_id {
0052     int     app_vid;
0053     uint8_t     version;
0054     uint8_t     pad[VND_CMD_PAD_SIZE];
0055     uint8_t     reserved[VND_CMD_APP_RESERVED_SIZE];
0056 } __packed;
0057 
0058 struct app_start_reply {
0059     uint32_t    host_support_edif;
0060     uint32_t    edif_enode_active;
0061     uint32_t    edif_edb_active;
0062     uint8_t     version;
0063     uint8_t     pad[VND_CMD_PAD_SIZE];
0064     uint8_t     reserved[VND_CMD_APP_RESERVED_SIZE];
0065 } __packed;
0066 
0067 struct app_start {
0068     struct app_id   app_info;
0069     uint8_t         app_start_flags;
0070     uint8_t     version;
0071     uint8_t     pad[2];
0072     uint8_t     reserved[VND_CMD_APP_RESERVED_SIZE];
0073 } __packed;
0074 
0075 struct app_stop {
0076     struct app_id   app_info;
0077     uint8_t     version;
0078     uint8_t     pad[VND_CMD_PAD_SIZE];
0079     uint8_t     reserved[VND_CMD_APP_RESERVED_SIZE];
0080 } __packed;
0081 
0082 struct app_plogi_reply {
0083     uint32_t    prli_status;
0084     uint8_t     version;
0085     uint8_t     pad[VND_CMD_PAD_SIZE];
0086     uint8_t     reserved[VND_CMD_APP_RESERVED_SIZE];
0087 } __packed;
0088 
0089 struct app_pinfo_req {
0090     struct app_id app_info;
0091     uint8_t  num_ports;
0092     port_id_t remote_pid;
0093     uint8_t     version;
0094     uint8_t     pad[VND_CMD_PAD_SIZE];
0095     uint8_t     reserved[VND_CMD_APP_RESERVED_SIZE];
0096 } __packed;
0097 
0098 struct app_pinfo {
0099     port_id_t remote_pid;
0100     uint8_t remote_wwpn[WWN_SIZE];
0101     uint8_t remote_type;
0102 #define VND_CMD_RTYPE_UNKNOWN       0
0103 #define VND_CMD_RTYPE_TARGET        1
0104 #define VND_CMD_RTYPE_INITIATOR     2
0105     uint8_t remote_state;
0106     uint8_t auth_state;
0107     uint8_t version;
0108     uint8_t pad[VND_CMD_PAD_SIZE];
0109     uint8_t reserved[VND_CMD_APP_RESERVED_SIZE];
0110 } __packed;
0111 
0112 /* AUTH States */
0113 #define VND_CMD_AUTH_STATE_UNDEF    0
0114 #define VND_CMD_AUTH_STATE_SESSION_SHUTDOWN 1
0115 #define VND_CMD_AUTH_STATE_NEEDED   2
0116 #define VND_CMD_AUTH_STATE_ELS_RCVD 3
0117 #define VND_CMD_AUTH_STATE_SAUPDATE_COMPL 4
0118 
0119 struct app_pinfo_reply {
0120     uint8_t     port_count;
0121     uint8_t     version;
0122     uint8_t     pad[VND_CMD_PAD_SIZE];
0123     uint8_t     reserved[VND_CMD_APP_RESERVED_SIZE];
0124     struct app_pinfo ports[];
0125 } __packed;
0126 
0127 struct app_sinfo_req {
0128     struct app_id   app_info;
0129     uint8_t     num_ports;
0130     uint8_t     version;
0131     uint8_t     pad[VND_CMD_PAD_SIZE];
0132     uint8_t     reserved[VND_CMD_APP_RESERVED_SIZE];
0133 } __packed;
0134 
0135 struct app_sinfo {
0136     uint8_t remote_wwpn[WWN_SIZE];
0137     int64_t rekey_count;
0138     uint8_t rekey_mode;
0139     int64_t tx_bytes;
0140     int64_t rx_bytes;
0141 } __packed;
0142 
0143 struct app_stats_reply {
0144     uint8_t     elem_count;
0145     uint8_t     version;
0146     uint8_t     pad[VND_CMD_PAD_SIZE];
0147     uint8_t     reserved[VND_CMD_APP_RESERVED_SIZE];
0148     struct app_sinfo elem[];
0149 } __packed;
0150 
0151 struct qla_sa_update_frame {
0152     struct app_id   app_info;
0153     uint16_t    flags;
0154 #define SAU_FLG_INV     0x01    /* delete key */
0155 #define SAU_FLG_TX      0x02    /* 1=tx, 0 = rx */
0156 #define SAU_FLG_FORCE_DELETE    0x08
0157 #define SAU_FLG_GMAC_MODE   0x20    /*
0158                      * GMAC mode is cleartext for the IO
0159                      * (i.e. NULL encryption)
0160                      */
0161 #define SAU_FLG_KEY128          0x40
0162 #define SAU_FLG_KEY256          0x80
0163     uint16_t        fast_sa_index:10,
0164             reserved:6;
0165     uint32_t    salt;
0166     uint32_t    spi;
0167     uint8_t     sa_key[32];
0168     uint8_t     node_name[WWN_SIZE];
0169     uint8_t     port_name[WWN_SIZE];
0170     port_id_t   port_id;
0171     uint8_t     version;
0172     uint8_t     pad[VND_CMD_PAD_SIZE];
0173     uint8_t     reserved2[VND_CMD_APP_RESERVED_SIZE];
0174 } __packed;
0175 
0176 #define QL_VND_SC_UNDEF     0
0177 #define QL_VND_SC_SA_UPDATE 1
0178 #define QL_VND_SC_APP_START 2
0179 #define QL_VND_SC_APP_STOP  3
0180 #define QL_VND_SC_AUTH_OK   4
0181 #define QL_VND_SC_AUTH_FAIL 5
0182 #define QL_VND_SC_REKEY_CONFIG  6
0183 #define QL_VND_SC_GET_FCINFO    7
0184 #define QL_VND_SC_GET_STATS 8
0185 #define QL_VND_SC_AEN_COMPLETE  9
0186 #define QL_VND_SC_READ_DBELL    10
0187 
0188 /*
0189  * bsg caller to provide empty buffer for doorbell events.
0190  *
0191  * sg_io_v4.din_xferp  = empty buffer for door bell events
0192  * sg_io_v4.dout_xferp = struct edif_read_dbell *buf
0193  */
0194 struct edif_read_dbell {
0195     struct app_id app_info;
0196     uint8_t version;
0197     uint8_t pad[VND_CMD_PAD_SIZE];
0198     uint8_t reserved[VND_CMD_APP_RESERVED_SIZE];
0199 };
0200 
0201 
0202 /* Application interface data structure for rtn data */
0203 #define EXT_DEF_EVENT_DATA_SIZE 64
0204 struct edif_app_dbell {
0205     uint32_t    event_code;
0206     uint32_t    event_data_size;
0207     union  {
0208         port_id_t   port_id;
0209         uint8_t     event_data[EXT_DEF_EVENT_DATA_SIZE];
0210     };
0211 } __packed;
0212 
0213 struct edif_sa_update_aen {
0214     port_id_t port_id;
0215     uint32_t key_type;  /* Tx (1) or RX (2) */
0216     uint32_t status;    /* 0 succes,  1 failed, 2 timeout , 3 error */
0217     uint8_t version;
0218     uint8_t pad[VND_CMD_PAD_SIZE];
0219     uint8_t reserved[VND_CMD_APP_RESERVED_SIZE];
0220 } __packed;
0221 
0222 #define QL_VND_SA_STAT_SUCCESS  0
0223 #define QL_VND_SA_STAT_FAILED   1
0224 #define QL_VND_SA_STAT_TIMEOUT  2
0225 #define QL_VND_SA_STAT_ERROR    3
0226 
0227 #define QL_VND_RX_SA_KEY    1
0228 #define QL_VND_TX_SA_KEY    2
0229 
0230 /* App defines for plogi auth'd ok and plogi auth bad requests */
0231 struct auth_complete_cmd {
0232     struct app_id app_info;
0233 #define PL_TYPE_WWPN    1
0234 #define PL_TYPE_DID     2
0235     uint32_t    type;
0236     union {
0237         uint8_t  wwpn[WWN_SIZE];
0238         port_id_t d_id;
0239     } u;
0240     uint8_t version;
0241     uint8_t pad[VND_CMD_PAD_SIZE];
0242     uint8_t reserved[VND_CMD_APP_RESERVED_SIZE];
0243 } __packed;
0244 
0245 struct aen_complete_cmd {
0246     struct app_id app_info;
0247     port_id_t   port_id;
0248     uint32_t    event_code;
0249     uint8_t     version;
0250     uint8_t     pad[VND_CMD_PAD_SIZE];
0251     uint8_t     reserved[VND_CMD_APP_RESERVED_SIZE];
0252 } __packed;
0253 
0254 #define RX_DELAY_DELETE_TIMEOUT 20
0255 
0256 #define FCH_EVT_VENDOR_UNIQUE_VPORT_DOWN  1
0257 
0258 #endif  /* QLA_EDIF_BSG_H */