aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2010-12-15 17:57:33 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-12-21 13:37:20 -0500
commit70f3c073362ef7b5e55c92b83eb2dd9a7fb4e9bf (patch)
treedae363921765b9e61c5304b36a76126f1e8335f9 /drivers/scsi
parentbe858b65cf9701e75bc49ed38c56e5b51ff281cd (diff)
[SCSI] lpfc 8.3.20: Implement the FC and SLI async event handlers
Implement the FC and SLI async event handlers: - Updated MQ_CREATE_EXT mailbox structure to include fc and SLI async events. - Added the SLI trailer code. - Split physical field into type and number to reflect latest SLI spec. - Changed lpfc_acqe_fcoe to lpfc_acqe_fip to reflect latest Spec changes. - Added lpfc_acqe_fc_la structure for FC link attention async events. - Added lpfc_acqe_sli structure for sli async events. - Added lpfc_sli4_async_fc_evt routine to handle fc la async events. - Added lpfc_sli4_async_sli routine to handle sli async events. - Moved LPFC_TRAILER_CODE_FC to be handled by its own handler function. Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com> Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/lpfc/lpfc_hw4.h129
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c199
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c18
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.h4
-rw-r--r--drivers/scsi/lpfc/lpfc_sli4.h4
5 files changed, 283 insertions, 71 deletions
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
index 4e3a11b98299..3821ecbf5a8f 100644
--- a/drivers/scsi/lpfc/lpfc_hw4.h
+++ b/drivers/scsi/lpfc/lpfc_hw4.h
@@ -1134,12 +1134,18 @@ struct lpfc_mbx_mq_create_ext {
1134#define lpfc_mbx_mq_create_ext_async_evt_link_SHIFT LPFC_TRAILER_CODE_LINK 1134#define lpfc_mbx_mq_create_ext_async_evt_link_SHIFT LPFC_TRAILER_CODE_LINK
1135#define lpfc_mbx_mq_create_ext_async_evt_link_MASK 0x00000001 1135#define lpfc_mbx_mq_create_ext_async_evt_link_MASK 0x00000001
1136#define lpfc_mbx_mq_create_ext_async_evt_link_WORD async_evt_bmap 1136#define lpfc_mbx_mq_create_ext_async_evt_link_WORD async_evt_bmap
1137#define lpfc_mbx_mq_create_ext_async_evt_fcfste_SHIFT LPFC_TRAILER_CODE_FCOE 1137#define lpfc_mbx_mq_create_ext_async_evt_fip_SHIFT LPFC_TRAILER_CODE_FCOE
1138#define lpfc_mbx_mq_create_ext_async_evt_fcfste_MASK 0x00000001 1138#define lpfc_mbx_mq_create_ext_async_evt_fip_MASK 0x00000001
1139#define lpfc_mbx_mq_create_ext_async_evt_fcfste_WORD async_evt_bmap 1139#define lpfc_mbx_mq_create_ext_async_evt_fip_WORD async_evt_bmap
1140#define lpfc_mbx_mq_create_ext_async_evt_group5_SHIFT LPFC_TRAILER_CODE_GRP5 1140#define lpfc_mbx_mq_create_ext_async_evt_group5_SHIFT LPFC_TRAILER_CODE_GRP5
1141#define lpfc_mbx_mq_create_ext_async_evt_group5_MASK 0x00000001 1141#define lpfc_mbx_mq_create_ext_async_evt_group5_MASK 0x00000001
1142#define lpfc_mbx_mq_create_ext_async_evt_group5_WORD async_evt_bmap 1142#define lpfc_mbx_mq_create_ext_async_evt_group5_WORD async_evt_bmap
1143#define lpfc_mbx_mq_create_ext_async_evt_fc_SHIFT LPFC_TRAILER_CODE_FC
1144#define lpfc_mbx_mq_create_ext_async_evt_fc_MASK 0x00000001
1145#define lpfc_mbx_mq_create_ext_async_evt_fc_WORD async_evt_bmap
1146#define lpfc_mbx_mq_create_ext_async_evt_sli_SHIFT LPFC_TRAILER_CODE_SLI
1147#define lpfc_mbx_mq_create_ext_async_evt_sli_MASK 0x00000001
1148#define lpfc_mbx_mq_create_ext_async_evt_sli_WORD async_evt_bmap
1143 struct mq_context context; 1149 struct mq_context context;
1144 struct dma_address page[LPFC_MAX_MQ_PAGE]; 1150 struct dma_address page[LPFC_MAX_MQ_PAGE];
1145 } request; 1151 } request;
@@ -1393,7 +1399,7 @@ struct lpfc_mbx_query_fw_cfg {
1393#define lpfc_function_mode_dal_WORD function_mode 1399#define lpfc_function_mode_dal_WORD function_mode
1394#define lpfc_function_mode_lro_SHIFT 9 1400#define lpfc_function_mode_lro_SHIFT 9
1395#define lpfc_function_mode_lro_MASK 0x00000001 1401#define lpfc_function_mode_lro_MASK 0x00000001
1396#define lpfc_function_mode_lro_WORD function_mode9 1402#define lpfc_function_mode_lro_WORD function_mode
1397#define lpfc_function_mode_flex10_SHIFT 10 1403#define lpfc_function_mode_flex10_SHIFT 10
1398#define lpfc_function_mode_flex10_MASK 0x00000001 1404#define lpfc_function_mode_flex10_MASK 0x00000001
1399#define lpfc_function_mode_flex10_WORD function_mode 1405#define lpfc_function_mode_flex10_WORD function_mode
@@ -2162,6 +2168,7 @@ struct lpfc_mcqe {
2162#define LPFC_TRAILER_CODE_DCBX 0x3 2168#define LPFC_TRAILER_CODE_DCBX 0x3
2163#define LPFC_TRAILER_CODE_GRP5 0x5 2169#define LPFC_TRAILER_CODE_GRP5 0x5
2164#define LPFC_TRAILER_CODE_FC 0x10 2170#define LPFC_TRAILER_CODE_FC 0x10
2171#define LPFC_TRAILER_CODE_SLI 0x11
2165}; 2172};
2166 2173
2167struct lpfc_acqe_link { 2174struct lpfc_acqe_link {
@@ -2187,11 +2194,12 @@ struct lpfc_acqe_link {
2187#define LPFC_ASYNC_LINK_STATUS_UP 0x1 2194#define LPFC_ASYNC_LINK_STATUS_UP 0x1
2188#define LPFC_ASYNC_LINK_STATUS_LOGICAL_DOWN 0x2 2195#define LPFC_ASYNC_LINK_STATUS_LOGICAL_DOWN 0x2
2189#define LPFC_ASYNC_LINK_STATUS_LOGICAL_UP 0x3 2196#define LPFC_ASYNC_LINK_STATUS_LOGICAL_UP 0x3
2190#define lpfc_acqe_link_physical_SHIFT 0 2197#define lpfc_acqe_link_type_SHIFT 6
2191#define lpfc_acqe_link_physical_MASK 0x000000FF 2198#define lpfc_acqe_link_type_MASK 0x00000003
2192#define lpfc_acqe_link_physical_WORD word0 2199#define lpfc_acqe_link_type_WORD word0
2193#define LPFC_ASYNC_LINK_PORT_A 0x0 2200#define lpfc_acqe_link_number_SHIFT 0
2194#define LPFC_ASYNC_LINK_PORT_B 0x1 2201#define lpfc_acqe_link_number_MASK 0x0000003F
2202#define lpfc_acqe_link_number_WORD word0
2195 uint32_t word1; 2203 uint32_t word1;
2196#define lpfc_acqe_link_fault_SHIFT 0 2204#define lpfc_acqe_link_fault_SHIFT 0
2197#define lpfc_acqe_link_fault_MASK 0x000000FF 2205#define lpfc_acqe_link_fault_MASK 0x000000FF
@@ -2199,29 +2207,31 @@ struct lpfc_acqe_link {
2199#define LPFC_ASYNC_LINK_FAULT_NONE 0x0 2207#define LPFC_ASYNC_LINK_FAULT_NONE 0x0
2200#define LPFC_ASYNC_LINK_FAULT_LOCAL 0x1 2208#define LPFC_ASYNC_LINK_FAULT_LOCAL 0x1
2201#define LPFC_ASYNC_LINK_FAULT_REMOTE 0x2 2209#define LPFC_ASYNC_LINK_FAULT_REMOTE 0x2
2202#define lpfc_acqe_qos_link_speed_SHIFT 16 2210#define lpfc_acqe_logical_link_speed_SHIFT 16
2203#define lpfc_acqe_qos_link_speed_MASK 0x0000FFFF 2211#define lpfc_acqe_logical_link_speed_MASK 0x0000FFFF
2204#define lpfc_acqe_qos_link_speed_WORD word1 2212#define lpfc_acqe_logical_link_speed_WORD word1
2205 uint32_t event_tag; 2213 uint32_t event_tag;
2206 uint32_t trailer; 2214 uint32_t trailer;
2215#define LPFC_LINK_EVENT_TYPE_PHYSICAL 0x0
2216#define LPFC_LINK_EVENT_TYPE_VIRTUAL 0x1
2207}; 2217};
2208 2218
2209struct lpfc_acqe_fcoe { 2219struct lpfc_acqe_fip {
2210 uint32_t index; 2220 uint32_t index;
2211 uint32_t word1; 2221 uint32_t word1;
2212#define lpfc_acqe_fcoe_fcf_count_SHIFT 0 2222#define lpfc_acqe_fip_fcf_count_SHIFT 0
2213#define lpfc_acqe_fcoe_fcf_count_MASK 0x0000FFFF 2223#define lpfc_acqe_fip_fcf_count_MASK 0x0000FFFF
2214#define lpfc_acqe_fcoe_fcf_count_WORD word1 2224#define lpfc_acqe_fip_fcf_count_WORD word1
2215#define lpfc_acqe_fcoe_event_type_SHIFT 16 2225#define lpfc_acqe_fip_event_type_SHIFT 16
2216#define lpfc_acqe_fcoe_event_type_MASK 0x0000FFFF 2226#define lpfc_acqe_fip_event_type_MASK 0x0000FFFF
2217#define lpfc_acqe_fcoe_event_type_WORD word1 2227#define lpfc_acqe_fip_event_type_WORD word1
2218#define LPFC_FCOE_EVENT_TYPE_NEW_FCF 0x1
2219#define LPFC_FCOE_EVENT_TYPE_FCF_TABLE_FULL 0x2
2220#define LPFC_FCOE_EVENT_TYPE_FCF_DEAD 0x3
2221#define LPFC_FCOE_EVENT_TYPE_CVL 0x4
2222#define LPFC_FCOE_EVENT_TYPE_FCF_PARAM_MOD 0x5
2223 uint32_t event_tag; 2228 uint32_t event_tag;
2224 uint32_t trailer; 2229 uint32_t trailer;
2230#define LPFC_FIP_EVENT_TYPE_NEW_FCF 0x1
2231#define LPFC_FIP_EVENT_TYPE_FCF_TABLE_FULL 0x2
2232#define LPFC_FIP_EVENT_TYPE_FCF_DEAD 0x3
2233#define LPFC_FIP_EVENT_TYPE_CVL 0x4
2234#define LPFC_FIP_EVENT_TYPE_FCF_PARAM_MOD 0x5
2225}; 2235};
2226 2236
2227struct lpfc_acqe_dcbx { 2237struct lpfc_acqe_dcbx {
@@ -2233,9 +2243,12 @@ struct lpfc_acqe_dcbx {
2233 2243
2234struct lpfc_acqe_grp5 { 2244struct lpfc_acqe_grp5 {
2235 uint32_t word0; 2245 uint32_t word0;
2236#define lpfc_acqe_grp5_pport_SHIFT 0 2246#define lpfc_acqe_grp5_type_SHIFT 6
2237#define lpfc_acqe_grp5_pport_MASK 0x000000FF 2247#define lpfc_acqe_grp5_type_MASK 0x00000003
2238#define lpfc_acqe_grp5_pport_WORD word0 2248#define lpfc_acqe_grp5_type_WORD word0
2249#define lpfc_acqe_grp5_number_SHIFT 0
2250#define lpfc_acqe_grp5_number_MASK 0x0000003F
2251#define lpfc_acqe_grp5_number_WORD word0
2239 uint32_t word1; 2252 uint32_t word1;
2240#define lpfc_acqe_grp5_llink_spd_SHIFT 16 2253#define lpfc_acqe_grp5_llink_spd_SHIFT 16
2241#define lpfc_acqe_grp5_llink_spd_MASK 0x0000FFFF 2254#define lpfc_acqe_grp5_llink_spd_MASK 0x0000FFFF
@@ -2244,6 +2257,68 @@ struct lpfc_acqe_grp5 {
2244 uint32_t trailer; 2257 uint32_t trailer;
2245}; 2258};
2246 2259
2260struct lpfc_acqe_fc_la {
2261 uint32_t word0;
2262#define lpfc_acqe_fc_la_speed_SHIFT 24
2263#define lpfc_acqe_fc_la_speed_MASK 0x000000FF
2264#define lpfc_acqe_fc_la_speed_WORD word0
2265#define LPFC_FC_LA_SPEED_UNKOWN 0x0
2266#define LPFC_FC_LA_SPEED_1G 0x1
2267#define LPFC_FC_LA_SPEED_2G 0x2
2268#define LPFC_FC_LA_SPEED_4G 0x4
2269#define LPFC_FC_LA_SPEED_8G 0x8
2270#define LPFC_FC_LA_SPEED_10G 0xA
2271#define LPFC_FC_LA_SPEED_16G 0x10
2272#define lpfc_acqe_fc_la_topology_SHIFT 16
2273#define lpfc_acqe_fc_la_topology_MASK 0x000000FF
2274#define lpfc_acqe_fc_la_topology_WORD word0
2275#define LPFC_FC_LA_TOP_UNKOWN 0x0
2276#define LPFC_FC_LA_TOP_P2P 0x1
2277#define LPFC_FC_LA_TOP_FCAL 0x2
2278#define LPFC_FC_LA_TOP_INTERNAL_LOOP 0x3
2279#define LPFC_FC_LA_TOP_SERDES_LOOP 0x4
2280#define lpfc_acqe_fc_la_att_type_SHIFT 8
2281#define lpfc_acqe_fc_la_att_type_MASK 0x000000FF
2282#define lpfc_acqe_fc_la_att_type_WORD word0
2283#define LPFC_FC_LA_TYPE_LINK_UP 0x1
2284#define LPFC_FC_LA_TYPE_LINK_DOWN 0x2
2285#define LPFC_FC_LA_TYPE_NO_HARD_ALPA 0x3
2286#define lpfc_acqe_fc_la_port_type_SHIFT 6
2287#define lpfc_acqe_fc_la_port_type_MASK 0x00000003
2288#define lpfc_acqe_fc_la_port_type_WORD word0
2289#define LPFC_LINK_TYPE_ETHERNET 0x0
2290#define LPFC_LINK_TYPE_FC 0x1
2291#define lpfc_acqe_fc_la_port_number_SHIFT 0
2292#define lpfc_acqe_fc_la_port_number_MASK 0x0000003F
2293#define lpfc_acqe_fc_la_port_number_WORD word0
2294 uint32_t word1;
2295#define lpfc_acqe_fc_la_llink_spd_SHIFT 16
2296#define lpfc_acqe_fc_la_llink_spd_MASK 0x0000FFFF
2297#define lpfc_acqe_fc_la_llink_spd_WORD word1
2298#define lpfc_acqe_fc_la_fault_SHIFT 0
2299#define lpfc_acqe_fc_la_fault_MASK 0x000000FF
2300#define lpfc_acqe_fc_la_fault_WORD word1
2301#define LPFC_FC_LA_FAULT_NONE 0x0
2302#define LPFC_FC_LA_FAULT_LOCAL 0x1
2303#define LPFC_FC_LA_FAULT_REMOTE 0x2
2304 uint32_t event_tag;
2305 uint32_t trailer;
2306#define LPFC_FC_LA_EVENT_TYPE_FC_LINK 0x1
2307#define LPFC_FC_LA_EVENT_TYPE_SHARED_LINK 0x2
2308};
2309
2310struct lpfc_acqe_sli {
2311 uint32_t event_data1;
2312 uint32_t event_data2;
2313 uint32_t reserved;
2314 uint32_t trailer;
2315#define LPFC_SLI_EVENT_TYPE_PORT_ERROR 0x1
2316#define LPFC_SLI_EVENT_TYPE_OVER_TEMP 0x2
2317#define LPFC_SLI_EVENT_TYPE_NORM_TEMP 0x3
2318#define LPFC_SLI_EVENT_TYPE_NVLOG_POST 0x4
2319#define LPFC_SLI_EVENT_TYPE_DIAG_DUMP 0x5
2320};
2321
2247/* 2322/*
2248 * Define the bootstrap mailbox (bmbx) region used to communicate 2323 * Define the bootstrap mailbox (bmbx) region used to communicate
2249 * mailbox command between the host and port. The mailbox consists 2324 * mailbox command between the host and port. The mailbox consists
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 70ba1895b0a1..311671d3216f 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -3149,11 +3149,11 @@ lpfc_sli4_parse_latt_link_speed(struct lpfc_hba *phba,
3149} 3149}
3150 3150
3151/** 3151/**
3152 * lpfc_sli4_async_link_evt - Process the asynchronous FC or FCoE link event 3152 * lpfc_sli4_async_link_evt - Process the asynchronous FCoE link event
3153 * @phba: pointer to lpfc hba data structure. 3153 * @phba: pointer to lpfc hba data structure.
3154 * @acqe_link: pointer to the async link completion queue entry. 3154 * @acqe_link: pointer to the async link completion queue entry.
3155 * 3155 *
3156 * This routine is to handle the SLI4 asynchronous link event. 3156 * This routine is to handle the SLI4 asynchronous FCoE link event.
3157 **/ 3157 **/
3158static void 3158static void
3159lpfc_sli4_async_link_evt(struct lpfc_hba *phba, 3159lpfc_sli4_async_link_evt(struct lpfc_hba *phba,
@@ -3210,12 +3210,25 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba,
3210 bf_get(lpfc_acqe_link_duplex, acqe_link); 3210 bf_get(lpfc_acqe_link_duplex, acqe_link);
3211 phba->sli4_hba.link_state.status = 3211 phba->sli4_hba.link_state.status =
3212 bf_get(lpfc_acqe_link_status, acqe_link); 3212 bf_get(lpfc_acqe_link_status, acqe_link);
3213 phba->sli4_hba.link_state.physical = 3213 phba->sli4_hba.link_state.type =
3214 bf_get(lpfc_acqe_link_physical, acqe_link); 3214 bf_get(lpfc_acqe_link_type, acqe_link);
3215 phba->sli4_hba.link_state.number =
3216 bf_get(lpfc_acqe_link_number, acqe_link);
3215 phba->sli4_hba.link_state.fault = 3217 phba->sli4_hba.link_state.fault =
3216 bf_get(lpfc_acqe_link_fault, acqe_link); 3218 bf_get(lpfc_acqe_link_fault, acqe_link);
3217 phba->sli4_hba.link_state.logical_speed = 3219 phba->sli4_hba.link_state.logical_speed =
3218 bf_get(lpfc_acqe_qos_link_speed, acqe_link); 3220 bf_get(lpfc_acqe_logical_link_speed, acqe_link);
3221 lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
3222 "2900 Async FCoE Link event - Speed:%dGBit duplex:x%x "
3223 "LA Type:x%x Port Type:%d Port Number:%d Logical "
3224 "speed:%dMbps Fault:%d\n",
3225 phba->sli4_hba.link_state.speed,
3226 phba->sli4_hba.link_state.topology,
3227 phba->sli4_hba.link_state.status,
3228 phba->sli4_hba.link_state.type,
3229 phba->sli4_hba.link_state.number,
3230 phba->sli4_hba.link_state.logical_speed * 10,
3231 phba->sli4_hba.link_state.fault);
3219 /* 3232 /*
3220 * For FC Mode: issue the READ_TOPOLOGY mailbox command to fetch 3233 * For FC Mode: issue the READ_TOPOLOGY mailbox command to fetch
3221 * topology info. Note: Optional for non FC-AL ports. 3234 * topology info. Note: Optional for non FC-AL ports.
@@ -3262,6 +3275,118 @@ out_free_pmb:
3262} 3275}
3263 3276
3264/** 3277/**
3278 * lpfc_sli4_async_fc_evt - Process the asynchronous FC link event
3279 * @phba: pointer to lpfc hba data structure.
3280 * @acqe_fc: pointer to the async fc completion queue entry.
3281 *
3282 * This routine is to handle the SLI4 asynchronous FC event. It will simply log
3283 * that the event was received and then issue a read_topology mailbox command so
3284 * that the rest of the driver will treat it the same as SLI3.
3285 **/
3286static void
3287lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc)
3288{
3289 struct lpfc_dmabuf *mp;
3290 LPFC_MBOXQ_t *pmb;
3291 int rc;
3292
3293 if (bf_get(lpfc_trailer_type, acqe_fc) !=
3294 LPFC_FC_LA_EVENT_TYPE_FC_LINK) {
3295 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
3296 "2895 Non FC link Event detected.(%d)\n",
3297 bf_get(lpfc_trailer_type, acqe_fc));
3298 return;
3299 }
3300 /* Keep the link status for extra SLI4 state machine reference */
3301 phba->sli4_hba.link_state.speed =
3302 bf_get(lpfc_acqe_fc_la_speed, acqe_fc);
3303 phba->sli4_hba.link_state.duplex = LPFC_ASYNC_LINK_DUPLEX_FULL;
3304 phba->sli4_hba.link_state.topology =
3305 bf_get(lpfc_acqe_fc_la_topology, acqe_fc);
3306 phba->sli4_hba.link_state.status =
3307 bf_get(lpfc_acqe_fc_la_att_type, acqe_fc);
3308 phba->sli4_hba.link_state.type =
3309 bf_get(lpfc_acqe_fc_la_port_type, acqe_fc);
3310 phba->sli4_hba.link_state.number =
3311 bf_get(lpfc_acqe_fc_la_port_number, acqe_fc);
3312 phba->sli4_hba.link_state.fault =
3313 bf_get(lpfc_acqe_link_fault, acqe_fc);
3314 phba->sli4_hba.link_state.logical_speed =
3315 bf_get(lpfc_acqe_fc_la_llink_spd, acqe_fc);
3316 lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
3317 "2896 Async FC event - Speed:%dGBaud Topology:x%x "
3318 "LA Type:x%x Port Type:%d Port Number:%d Logical speed:"
3319 "%dMbps Fault:%d\n",
3320 phba->sli4_hba.link_state.speed,
3321 phba->sli4_hba.link_state.topology,
3322 phba->sli4_hba.link_state.status,
3323 phba->sli4_hba.link_state.type,
3324 phba->sli4_hba.link_state.number,
3325 phba->sli4_hba.link_state.logical_speed * 10,
3326 phba->sli4_hba.link_state.fault);
3327 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
3328 if (!pmb) {
3329 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
3330 "2897 The mboxq allocation failed\n");
3331 return;
3332 }
3333 mp = kmalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL);
3334 if (!mp) {
3335 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
3336 "2898 The lpfc_dmabuf allocation failed\n");
3337 goto out_free_pmb;
3338 }
3339 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys);
3340 if (!mp->virt) {
3341 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
3342 "2899 The mbuf allocation failed\n");
3343 goto out_free_dmabuf;
3344 }
3345
3346 /* Cleanup any outstanding ELS commands */
3347 lpfc_els_flush_all_cmd(phba);
3348
3349 /* Block ELS IOCBs until we have done process link event */
3350 phba->sli.ring[LPFC_ELS_RING].flag |= LPFC_STOP_IOCB_EVENT;
3351
3352 /* Update link event statistics */
3353 phba->sli.slistat.link_event++;
3354
3355 /* Create lpfc_handle_latt mailbox command from link ACQE */
3356 lpfc_read_topology(phba, pmb, mp);
3357 pmb->mbox_cmpl = lpfc_mbx_cmpl_read_topology;
3358 pmb->vport = phba->pport;
3359
3360 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
3361 if (rc == MBX_NOT_FINISHED)
3362 goto out_free_dmabuf;
3363 return;
3364
3365out_free_dmabuf:
3366 kfree(mp);
3367out_free_pmb:
3368 mempool_free(pmb, phba->mbox_mem_pool);
3369}
3370
3371/**
3372 * lpfc_sli4_async_sli_evt - Process the asynchronous SLI link event
3373 * @phba: pointer to lpfc hba data structure.
3374 * @acqe_fc: pointer to the async SLI completion queue entry.
3375 *
3376 * This routine is to handle the SLI4 asynchronous SLI events.
3377 **/
3378static void
3379lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli)
3380{
3381 lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
3382 "2901 Async SLI event - Event Data1:x%08x Event Data2:"
3383 "x%08x SLI Event Type:%d",
3384 acqe_sli->event_data1, acqe_sli->event_data2,
3385 bf_get(lpfc_trailer_type, acqe_sli));
3386 return;
3387}
3388
3389/**
3265 * lpfc_sli4_perform_vport_cvl - Perform clear virtual link on a vport 3390 * lpfc_sli4_perform_vport_cvl - Perform clear virtual link on a vport
3266 * @vport: pointer to vport data structure. 3391 * @vport: pointer to vport data structure.
3267 * 3392 *
@@ -3348,9 +3473,9 @@ lpfc_sli4_perform_all_vport_cvl(struct lpfc_hba *phba)
3348 **/ 3473 **/
3349static void 3474static void
3350lpfc_sli4_async_fip_evt(struct lpfc_hba *phba, 3475lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,
3351 struct lpfc_acqe_fcoe *acqe_fcoe) 3476 struct lpfc_acqe_fip *acqe_fip)
3352{ 3477{
3353 uint8_t event_type = bf_get(lpfc_acqe_fcoe_event_type, acqe_fcoe); 3478 uint8_t event_type = bf_get(lpfc_trailer_type, acqe_fip);
3354 int rc; 3479 int rc;
3355 struct lpfc_vport *vport; 3480 struct lpfc_vport *vport;
3356 struct lpfc_nodelist *ndlp; 3481 struct lpfc_nodelist *ndlp;
@@ -3359,25 +3484,25 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,
3359 struct lpfc_vport **vports; 3484 struct lpfc_vport **vports;
3360 int i; 3485 int i;
3361 3486
3362 phba->fc_eventTag = acqe_fcoe->event_tag; 3487 phba->fc_eventTag = acqe_fip->event_tag;
3363 phba->fcoe_eventtag = acqe_fcoe->event_tag; 3488 phba->fcoe_eventtag = acqe_fip->event_tag;
3364 switch (event_type) { 3489 switch (event_type) {
3365 case LPFC_FCOE_EVENT_TYPE_NEW_FCF: 3490 case LPFC_FIP_EVENT_TYPE_NEW_FCF:
3366 case LPFC_FCOE_EVENT_TYPE_FCF_PARAM_MOD: 3491 case LPFC_FIP_EVENT_TYPE_FCF_PARAM_MOD:
3367 if (event_type == LPFC_FCOE_EVENT_TYPE_NEW_FCF) 3492 if (event_type == LPFC_FIP_EVENT_TYPE_NEW_FCF)
3368 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | 3493 lpfc_printf_log(phba, KERN_ERR, LOG_FIP |
3369 LOG_DISCOVERY, 3494 LOG_DISCOVERY,
3370 "2546 New FCF event, evt_tag:x%x, " 3495 "2546 New FCF event, evt_tag:x%x, "
3371 "index:x%x\n", 3496 "index:x%x\n",
3372 acqe_fcoe->event_tag, 3497 acqe_fip->event_tag,
3373 acqe_fcoe->index); 3498 acqe_fip->index);
3374 else 3499 else
3375 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP | 3500 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP |
3376 LOG_DISCOVERY, 3501 LOG_DISCOVERY,
3377 "2788 FCF param modified event, " 3502 "2788 FCF param modified event, "
3378 "evt_tag:x%x, index:x%x\n", 3503 "evt_tag:x%x, index:x%x\n",
3379 acqe_fcoe->event_tag, 3504 acqe_fip->event_tag,
3380 acqe_fcoe->index); 3505 acqe_fip->index);
3381 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { 3506 if (phba->fcf.fcf_flag & FCF_DISCOVERY) {
3382 /* 3507 /*
3383 * During period of FCF discovery, read the FCF 3508 * During period of FCF discovery, read the FCF
@@ -3388,8 +3513,8 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,
3388 LOG_DISCOVERY, 3513 LOG_DISCOVERY,
3389 "2779 Read FCF (x%x) for updating " 3514 "2779 Read FCF (x%x) for updating "
3390 "roundrobin FCF failover bmask\n", 3515 "roundrobin FCF failover bmask\n",
3391 acqe_fcoe->index); 3516 acqe_fip->index);
3392 rc = lpfc_sli4_read_fcf_rec(phba, acqe_fcoe->index); 3517 rc = lpfc_sli4_read_fcf_rec(phba, acqe_fip->index);
3393 } 3518 }
3394 3519
3395 /* If the FCF discovery is in progress, do nothing. */ 3520 /* If the FCF discovery is in progress, do nothing. */
@@ -3415,7 +3540,7 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,
3415 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, 3540 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY,
3416 "2770 Start FCF table scan per async FCF " 3541 "2770 Start FCF table scan per async FCF "
3417 "event, evt_tag:x%x, index:x%x\n", 3542 "event, evt_tag:x%x, index:x%x\n",
3418 acqe_fcoe->event_tag, acqe_fcoe->index); 3543 acqe_fip->event_tag, acqe_fip->index);
3419 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, 3544 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba,
3420 LPFC_FCOE_FCF_GET_FIRST); 3545 LPFC_FCOE_FCF_GET_FIRST);
3421 if (rc) 3546 if (rc)
@@ -3424,17 +3549,17 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,
3424 "command failed (x%x)\n", rc); 3549 "command failed (x%x)\n", rc);
3425 break; 3550 break;
3426 3551
3427 case LPFC_FCOE_EVENT_TYPE_FCF_TABLE_FULL: 3552 case LPFC_FIP_EVENT_TYPE_FCF_TABLE_FULL:
3428 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 3553 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
3429 "2548 FCF Table full count 0x%x tag 0x%x\n", 3554 "2548 FCF Table full count 0x%x tag 0x%x\n",
3430 bf_get(lpfc_acqe_fcoe_fcf_count, acqe_fcoe), 3555 bf_get(lpfc_acqe_fip_fcf_count, acqe_fip),
3431 acqe_fcoe->event_tag); 3556 acqe_fip->event_tag);
3432 break; 3557 break;
3433 3558
3434 case LPFC_FCOE_EVENT_TYPE_FCF_DEAD: 3559 case LPFC_FIP_EVENT_TYPE_FCF_DEAD:
3435 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, 3560 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY,
3436 "2549 FCF (x%x) disconnected from network, " 3561 "2549 FCF (x%x) disconnected from network, "
3437 "tag:x%x\n", acqe_fcoe->index, acqe_fcoe->event_tag); 3562 "tag:x%x\n", acqe_fip->index, acqe_fip->event_tag);
3438 /* 3563 /*
3439 * If we are in the middle of FCF failover process, clear 3564 * If we are in the middle of FCF failover process, clear
3440 * the corresponding FCF bit in the roundrobin bitmap. 3565 * the corresponding FCF bit in the roundrobin bitmap.
@@ -3443,13 +3568,13 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,
3443 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { 3568 if (phba->fcf.fcf_flag & FCF_DISCOVERY) {
3444 spin_unlock_irq(&phba->hbalock); 3569 spin_unlock_irq(&phba->hbalock);
3445 /* Update FLOGI FCF failover eligible FCF bmask */ 3570 /* Update FLOGI FCF failover eligible FCF bmask */
3446 lpfc_sli4_fcf_rr_index_clear(phba, acqe_fcoe->index); 3571 lpfc_sli4_fcf_rr_index_clear(phba, acqe_fip->index);
3447 break; 3572 break;
3448 } 3573 }
3449 spin_unlock_irq(&phba->hbalock); 3574 spin_unlock_irq(&phba->hbalock);
3450 3575
3451 /* If the event is not for currently used fcf do nothing */ 3576 /* If the event is not for currently used fcf do nothing */
3452 if (phba->fcf.current_rec.fcf_indx != acqe_fcoe->index) 3577 if (phba->fcf.current_rec.fcf_indx != acqe_fip->index)
3453 break; 3578 break;
3454 3579
3455 /* 3580 /*
@@ -3466,7 +3591,7 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,
3466 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, 3591 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY,
3467 "2771 Start FCF fast failover process due to " 3592 "2771 Start FCF fast failover process due to "
3468 "FCF DEAD event: evt_tag:x%x, fcf_index:x%x " 3593 "FCF DEAD event: evt_tag:x%x, fcf_index:x%x "
3469 "\n", acqe_fcoe->event_tag, acqe_fcoe->index); 3594 "\n", acqe_fip->event_tag, acqe_fip->index);
3470 rc = lpfc_sli4_redisc_fcf_table(phba); 3595 rc = lpfc_sli4_redisc_fcf_table(phba);
3471 if (rc) { 3596 if (rc) {
3472 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | 3597 lpfc_printf_log(phba, KERN_ERR, LOG_FIP |
@@ -3493,12 +3618,12 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,
3493 lpfc_sli4_perform_all_vport_cvl(phba); 3618 lpfc_sli4_perform_all_vport_cvl(phba);
3494 } 3619 }
3495 break; 3620 break;
3496 case LPFC_FCOE_EVENT_TYPE_CVL: 3621 case LPFC_FIP_EVENT_TYPE_CVL:
3497 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, 3622 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY,
3498 "2718 Clear Virtual Link Received for VPI 0x%x" 3623 "2718 Clear Virtual Link Received for VPI 0x%x"
3499 " tag 0x%x\n", acqe_fcoe->index, acqe_fcoe->event_tag); 3624 " tag 0x%x\n", acqe_fip->index, acqe_fip->event_tag);
3500 vport = lpfc_find_vport_by_vpid(phba, 3625 vport = lpfc_find_vport_by_vpid(phba,
3501 acqe_fcoe->index - phba->vpi_base); 3626 acqe_fip->index - phba->vpi_base);
3502 ndlp = lpfc_sli4_perform_vport_cvl(vport); 3627 ndlp = lpfc_sli4_perform_vport_cvl(vport);
3503 if (!ndlp) 3628 if (!ndlp)
3504 break; 3629 break;
@@ -3549,7 +3674,7 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,
3549 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | 3674 lpfc_printf_log(phba, KERN_INFO, LOG_FIP |
3550 LOG_DISCOVERY, 3675 LOG_DISCOVERY,
3551 "2773 Start FCF failover per CVL, " 3676 "2773 Start FCF failover per CVL, "
3552 "evt_tag:x%x\n", acqe_fcoe->event_tag); 3677 "evt_tag:x%x\n", acqe_fip->event_tag);
3553 rc = lpfc_sli4_redisc_fcf_table(phba); 3678 rc = lpfc_sli4_redisc_fcf_table(phba);
3554 if (rc) { 3679 if (rc) {
3555 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | 3680 lpfc_printf_log(phba, KERN_ERR, LOG_FIP |
@@ -3577,7 +3702,7 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,
3577 default: 3702 default:
3578 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 3703 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
3579 "0288 Unknown FCoE event type 0x%x event tag " 3704 "0288 Unknown FCoE event type 0x%x event tag "
3580 "0x%x\n", event_type, acqe_fcoe->event_tag); 3705 "0x%x\n", event_type, acqe_fip->event_tag);
3581 break; 3706 break;
3582 } 3707 }
3583} 3708}
@@ -3650,13 +3775,11 @@ void lpfc_sli4_async_event_proc(struct lpfc_hba *phba)
3650 /* Process the asynchronous event */ 3775 /* Process the asynchronous event */
3651 switch (bf_get(lpfc_trailer_code, &cq_event->cqe.mcqe_cmpl)) { 3776 switch (bf_get(lpfc_trailer_code, &cq_event->cqe.mcqe_cmpl)) {
3652 case LPFC_TRAILER_CODE_LINK: 3777 case LPFC_TRAILER_CODE_LINK:
3653 case LPFC_TRAILER_CODE_FC:
3654 lpfc_sli4_async_link_evt(phba, 3778 lpfc_sli4_async_link_evt(phba,
3655 &cq_event->cqe.acqe_link); 3779 &cq_event->cqe.acqe_link);
3656 break; 3780 break;
3657 case LPFC_TRAILER_CODE_FCOE: 3781 case LPFC_TRAILER_CODE_FCOE:
3658 lpfc_sli4_async_fip_evt(phba, 3782 lpfc_sli4_async_fip_evt(phba, &cq_event->cqe.acqe_fip);
3659 &cq_event->cqe.acqe_fcoe);
3660 break; 3783 break;
3661 case LPFC_TRAILER_CODE_DCBX: 3784 case LPFC_TRAILER_CODE_DCBX:
3662 lpfc_sli4_async_dcbx_evt(phba, 3785 lpfc_sli4_async_dcbx_evt(phba,
@@ -3666,6 +3789,12 @@ void lpfc_sli4_async_event_proc(struct lpfc_hba *phba)
3666 lpfc_sli4_async_grp5_evt(phba, 3789 lpfc_sli4_async_grp5_evt(phba,
3667 &cq_event->cqe.acqe_grp5); 3790 &cq_event->cqe.acqe_grp5);
3668 break; 3791 break;
3792 case LPFC_TRAILER_CODE_FC:
3793 lpfc_sli4_async_fc_evt(phba, &cq_event->cqe.acqe_fc);
3794 break;
3795 case LPFC_TRAILER_CODE_SLI:
3796 lpfc_sli4_async_sli_evt(phba, &cq_event->cqe.acqe_sli);
3797 break;
3669 default: 3798 default:
3670 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 3799 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
3671 "1804 Invalid asynchrous event code: " 3800 "1804 Invalid asynchrous event code: "
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 7509de2f4566..8df959ea9669 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -10561,16 +10561,20 @@ lpfc_mq_create(struct lpfc_hba *phba, struct lpfc_queue *mq,
10561 length, LPFC_SLI4_MBX_EMBED); 10561 length, LPFC_SLI4_MBX_EMBED);
10562 10562
10563 mq_create_ext = &mbox->u.mqe.un.mq_create_ext; 10563 mq_create_ext = &mbox->u.mqe.un.mq_create_ext;
10564 bf_set(lpfc_mbx_mq_create_ext_num_pages, &mq_create_ext->u.request, 10564 bf_set(lpfc_mbx_mq_create_ext_num_pages,
10565 mq->page_count); 10565 &mq_create_ext->u.request, mq->page_count);
10566 bf_set(lpfc_mbx_mq_create_ext_async_evt_link, &mq_create_ext->u.request, 10566 bf_set(lpfc_mbx_mq_create_ext_async_evt_link,
10567 1); 10567 &mq_create_ext->u.request, 1);
10568 bf_set(lpfc_mbx_mq_create_ext_async_evt_fcfste, 10568 bf_set(lpfc_mbx_mq_create_ext_async_evt_fip,
10569 &mq_create_ext->u.request, 1); 10569 &mq_create_ext->u.request, 1);
10570 bf_set(lpfc_mbx_mq_create_ext_async_evt_group5, 10570 bf_set(lpfc_mbx_mq_create_ext_async_evt_group5,
10571 &mq_create_ext->u.request, 1); 10571 &mq_create_ext->u.request, 1);
10572 bf_set(lpfc_mq_context_cq_id, &mq_create_ext->u.request.context, 10572 bf_set(lpfc_mbx_mq_create_ext_async_evt_fc,
10573 cq->queue_id); 10573 &mq_create_ext->u.request, 1);
10574 bf_set(lpfc_mbx_mq_create_ext_async_evt_sli,
10575 &mq_create_ext->u.request, 1);
10576 bf_set(lpfc_mq_context_cq_id,
10577 &mq_create_ext->u.request.context, cq->queue_id);
10574 bf_set(lpfc_mq_context_valid, &mq_create_ext->u.request.context, 1); 10578 bf_set(lpfc_mq_context_valid, &mq_create_ext->u.request.context, 1);
10575 switch (mq->entry_count) { 10579 switch (mq->entry_count) {
10576 default: 10580 default:
diff --git a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h
index 402a0737076c..453577c21c14 100644
--- a/drivers/scsi/lpfc/lpfc_sli.h
+++ b/drivers/scsi/lpfc/lpfc_sli.h
@@ -34,9 +34,11 @@ struct lpfc_cq_event {
34 union { 34 union {
35 struct lpfc_mcqe mcqe_cmpl; 35 struct lpfc_mcqe mcqe_cmpl;
36 struct lpfc_acqe_link acqe_link; 36 struct lpfc_acqe_link acqe_link;
37 struct lpfc_acqe_fcoe acqe_fcoe; 37 struct lpfc_acqe_fip acqe_fip;
38 struct lpfc_acqe_dcbx acqe_dcbx; 38 struct lpfc_acqe_dcbx acqe_dcbx;
39 struct lpfc_acqe_grp5 acqe_grp5; 39 struct lpfc_acqe_grp5 acqe_grp5;
40 struct lpfc_acqe_fc_la acqe_fc;
41 struct lpfc_acqe_sli acqe_sli;
40 struct lpfc_rcqe rcqe_cmpl; 42 struct lpfc_rcqe rcqe_cmpl;
41 struct sli4_wcqe_xri_aborted wcqe_axri; 43 struct sli4_wcqe_xri_aborted wcqe_axri;
42 struct lpfc_wcqe_complete wcqe_cmpl; 44 struct lpfc_wcqe_complete wcqe_cmpl;
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h
index 8ced5983d3e3..f96eae51d07c 100644
--- a/drivers/scsi/lpfc/lpfc_sli4.h
+++ b/drivers/scsi/lpfc/lpfc_sli4.h
@@ -137,9 +137,11 @@ struct lpfc_sli4_link {
137 uint8_t speed; 137 uint8_t speed;
138 uint8_t duplex; 138 uint8_t duplex;
139 uint8_t status; 139 uint8_t status;
140 uint8_t physical; 140 uint8_t type;
141 uint8_t number;
141 uint8_t fault; 142 uint8_t fault;
142 uint16_t logical_speed; 143 uint16_t logical_speed;
144 uint16_t topology;
143}; 145};
144 146
145struct lpfc_fcf_rec { 147struct lpfc_fcf_rec {