2 * This file is part of the Chelsio FCoE driver for Linux.
4 * Copyright (c) 2008-2012 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 #include <linux/kernel.h>
36 #include <linux/string.h>
37 #include <linux/delay.h>
38 #include <linux/module.h>
39 #include <linux/init.h>
40 #include <linux/pci.h>
42 #include <linux/jiffies.h>
43 #include <scsi/fc/fc_fs.h>
45 #include "csio_init.h"
48 csio_vport_set_state(struct csio_lnode
*ln
);
51 * csio_reg_rnode - Register a remote port with FC transport.
52 * @rn: Rnode representing remote port.
54 * Call fc_remote_port_add() to register this remote port with FC transport.
55 * If remote port is Initiator OR Target OR both, change the role appropriately.
59 csio_reg_rnode(struct csio_rnode
*rn
)
61 struct csio_lnode
*ln
= csio_rnode_to_lnode(rn
);
62 struct Scsi_Host
*shost
= csio_ln_to_shost(ln
);
63 struct fc_rport_identifiers ids
;
64 struct fc_rport
*rport
;
65 struct csio_service_parms
*sp
;
67 ids
.node_name
= wwn_to_u64(csio_rn_wwnn(rn
));
68 ids
.port_name
= wwn_to_u64(csio_rn_wwpn(rn
));
69 ids
.port_id
= rn
->nport_id
;
70 ids
.roles
= FC_RPORT_ROLE_UNKNOWN
;
72 if (rn
->role
& CSIO_RNFR_INITIATOR
|| rn
->role
& CSIO_RNFR_TARGET
) {
74 CSIO_ASSERT(rport
!= NULL
);
78 rn
->rport
= fc_remote_port_add(shost
, 0, &ids
);
80 csio_ln_err(ln
, "Failed to register rport = 0x%x.\n",
87 spin_lock_irq(shost
->host_lock
);
88 *((struct csio_rnode
**)rport
->dd_data
) = rn
;
89 spin_unlock_irq(shost
->host_lock
);
92 rport
->maxframe_size
= ntohs(sp
->csp
.sp_bb_data
);
93 if (ntohs(sp
->clsp
[2].cp_class
) & FC_CPC_VALID
)
94 rport
->supported_classes
= FC_COS_CLASS3
;
96 rport
->supported_classes
= FC_COS_UNSPECIFIED
;
98 if (rn
->role
& CSIO_RNFR_INITIATOR
)
99 ids
.roles
|= FC_RPORT_ROLE_FCP_INITIATOR
;
100 if (rn
->role
& CSIO_RNFR_TARGET
)
101 ids
.roles
|= FC_RPORT_ROLE_FCP_TARGET
;
103 if (ids
.roles
!= FC_RPORT_ROLE_UNKNOWN
)
104 fc_remote_port_rolechg(rport
, ids
.roles
);
106 rn
->scsi_id
= rport
->scsi_target_id
;
108 csio_ln_dbg(ln
, "Remote port x%x role 0x%x registered\n",
109 rn
->nport_id
, ids
.roles
);
113 * csio_unreg_rnode - Unregister a remote port with FC transport.
114 * @rn: Rnode representing remote port.
116 * Call fc_remote_port_delete() to unregister this remote port with FC
121 csio_unreg_rnode(struct csio_rnode
*rn
)
123 struct csio_lnode
*ln
= csio_rnode_to_lnode(rn
);
124 struct fc_rport
*rport
= rn
->rport
;
126 rn
->role
&= ~(CSIO_RNFR_INITIATOR
| CSIO_RNFR_TARGET
);
127 fc_remote_port_delete(rport
);
128 ln
->num_reg_rnodes
--;
130 csio_ln_dbg(ln
, "Remote port x%x un-registered\n", rn
->nport_id
);
134 * csio_lnode_async_event - Async events from local port.
135 * @ln: lnode representing local port.
137 * Async events from local node that FC transport/SCSI ML
138 * should be made aware of (Eg: RSCN).
141 csio_lnode_async_event(struct csio_lnode
*ln
, enum csio_ln_fc_evt fc_evt
)
144 case CSIO_LN_FC_RSCN
:
145 /* Get payload of rscn from ln */
146 /* For each RSCN entry */
148 * fc_host_post_event(shost,
149 * fc_get_event_number(),
154 case CSIO_LN_FC_LINKUP
:
155 /* send fc_host_post_event */
156 /* set vport state */
157 if (csio_is_npiv_ln(ln
))
158 csio_vport_set_state(ln
);
161 case CSIO_LN_FC_LINKDOWN
:
162 /* send fc_host_post_event */
163 /* set vport state */
164 if (csio_is_npiv_ln(ln
))
165 csio_vport_set_state(ln
);
168 case CSIO_LN_FC_ATTRIB_UPDATE
:
169 csio_fchost_attr_init(ln
);
177 * csio_fchost_attr_init - Initialize FC transport attributes
182 csio_fchost_attr_init(struct csio_lnode
*ln
)
184 struct Scsi_Host
*shost
= csio_ln_to_shost(ln
);
186 fc_host_node_name(shost
) = wwn_to_u64(csio_ln_wwnn(ln
));
187 fc_host_port_name(shost
) = wwn_to_u64(csio_ln_wwpn(ln
));
189 fc_host_supported_classes(shost
) = FC_COS_CLASS3
;
190 fc_host_max_npiv_vports(shost
) =
191 (csio_lnode_to_hw(ln
))->fres_info
.max_vnps
;
192 fc_host_supported_speeds(shost
) = FC_PORTSPEED_10GBIT
|
195 fc_host_maxframe_size(shost
) = ntohs(ln
->ln_sparm
.csp
.sp_bb_data
);
196 memset(fc_host_supported_fc4s(shost
), 0,
197 sizeof(fc_host_supported_fc4s(shost
)));
198 fc_host_supported_fc4s(shost
)[7] = 1;
200 memset(fc_host_active_fc4s(shost
), 0,
201 sizeof(fc_host_active_fc4s(shost
)));
202 fc_host_active_fc4s(shost
)[7] = 1;
206 * csio_get_host_port_id - sysfs entries for nport_id is
207 * populated/cached from this function
210 csio_get_host_port_id(struct Scsi_Host
*shost
)
212 struct csio_lnode
*ln
= shost_priv(shost
);
213 struct csio_hw
*hw
= csio_lnode_to_hw(ln
);
215 spin_lock_irq(&hw
->lock
);
216 fc_host_port_id(shost
) = ln
->nport_id
;
217 spin_unlock_irq(&hw
->lock
);
221 * csio_get_port_type - Return FC local port type.
226 csio_get_host_port_type(struct Scsi_Host
*shost
)
228 struct csio_lnode
*ln
= shost_priv(shost
);
229 struct csio_hw
*hw
= csio_lnode_to_hw(ln
);
231 spin_lock_irq(&hw
->lock
);
232 if (csio_is_npiv_ln(ln
))
233 fc_host_port_type(shost
) = FC_PORTTYPE_NPIV
;
235 fc_host_port_type(shost
) = FC_PORTTYPE_NPORT
;
236 spin_unlock_irq(&hw
->lock
);
240 * csio_get_port_state - Return FC local port state.
245 csio_get_host_port_state(struct Scsi_Host
*shost
)
247 struct csio_lnode
*ln
= shost_priv(shost
);
248 struct csio_hw
*hw
= csio_lnode_to_hw(ln
);
251 spin_lock_irq(&hw
->lock
);
253 csio_lnode_state_to_str(ln
, state
);
254 if (!strcmp(state
, "READY"))
255 fc_host_port_state(shost
) = FC_PORTSTATE_ONLINE
;
256 else if (!strcmp(state
, "OFFLINE"))
257 fc_host_port_state(shost
) = FC_PORTSTATE_LINKDOWN
;
259 fc_host_port_state(shost
) = FC_PORTSTATE_UNKNOWN
;
261 spin_unlock_irq(&hw
->lock
);
265 * csio_get_host_speed - Return link speed to FC transport.
270 csio_get_host_speed(struct Scsi_Host
*shost
)
272 struct csio_lnode
*ln
= shost_priv(shost
);
273 struct csio_hw
*hw
= csio_lnode_to_hw(ln
);
275 spin_lock_irq(&hw
->lock
);
276 switch (hw
->pport
[ln
->portid
].link_speed
) {
277 case FW_PORT_CAP_SPEED_1G
:
278 fc_host_speed(shost
) = FC_PORTSPEED_1GBIT
;
280 case FW_PORT_CAP_SPEED_10G
:
281 fc_host_speed(shost
) = FC_PORTSPEED_10GBIT
;
284 fc_host_speed(shost
) = FC_PORTSPEED_UNKNOWN
;
287 spin_unlock_irq(&hw
->lock
);
291 * csio_get_host_fabric_name - Return fabric name
296 csio_get_host_fabric_name(struct Scsi_Host
*shost
)
298 struct csio_lnode
*ln
= shost_priv(shost
);
299 struct csio_rnode
*rn
= NULL
;
300 struct csio_hw
*hw
= csio_lnode_to_hw(ln
);
302 spin_lock_irq(&hw
->lock
);
303 rn
= csio_rnode_lookup_portid(ln
, FC_FID_FLOGI
);
305 fc_host_fabric_name(shost
) = wwn_to_u64(csio_rn_wwnn(rn
));
307 fc_host_fabric_name(shost
) = 0;
308 spin_unlock_irq(&hw
->lock
);
312 * csio_get_host_speed - Return FC transport statistics.
316 static struct fc_host_statistics
*
317 csio_get_stats(struct Scsi_Host
*shost
)
319 struct csio_lnode
*ln
= shost_priv(shost
);
320 struct csio_hw
*hw
= csio_lnode_to_hw(ln
);
321 struct fc_host_statistics
*fhs
= &ln
->fch_stats
;
322 struct fw_fcoe_port_stats fcoe_port_stats
;
325 memset(&fcoe_port_stats
, 0, sizeof(struct fw_fcoe_port_stats
));
326 csio_get_phy_port_stats(hw
, ln
->portid
, &fcoe_port_stats
);
328 fhs
->tx_frames
+= (be64_to_cpu(fcoe_port_stats
.tx_bcast_frames
) +
329 be64_to_cpu(fcoe_port_stats
.tx_mcast_frames
) +
330 be64_to_cpu(fcoe_port_stats
.tx_ucast_frames
) +
331 be64_to_cpu(fcoe_port_stats
.tx_offload_frames
));
332 fhs
->tx_words
+= (be64_to_cpu(fcoe_port_stats
.tx_bcast_bytes
) +
333 be64_to_cpu(fcoe_port_stats
.tx_mcast_bytes
) +
334 be64_to_cpu(fcoe_port_stats
.tx_ucast_bytes
) +
335 be64_to_cpu(fcoe_port_stats
.tx_offload_bytes
)) /
337 fhs
->rx_frames
+= (be64_to_cpu(fcoe_port_stats
.rx_bcast_frames
) +
338 be64_to_cpu(fcoe_port_stats
.rx_mcast_frames
) +
339 be64_to_cpu(fcoe_port_stats
.rx_ucast_frames
));
340 fhs
->rx_words
+= (be64_to_cpu(fcoe_port_stats
.rx_bcast_bytes
) +
341 be64_to_cpu(fcoe_port_stats
.rx_mcast_bytes
) +
342 be64_to_cpu(fcoe_port_stats
.rx_ucast_bytes
)) /
344 fhs
->error_frames
+= be64_to_cpu(fcoe_port_stats
.rx_err_frames
);
345 fhs
->fcp_input_requests
+= ln
->stats
.n_input_requests
;
346 fhs
->fcp_output_requests
+= ln
->stats
.n_output_requests
;
347 fhs
->fcp_control_requests
+= ln
->stats
.n_control_requests
;
348 fhs
->fcp_input_megabytes
+= ln
->stats
.n_input_bytes
>> 20;
349 fhs
->fcp_output_megabytes
+= ln
->stats
.n_output_bytes
>> 20;
350 fhs
->link_failure_count
= ln
->stats
.n_link_down
;
351 /* Reset stats for the device */
352 seconds
= jiffies_to_msecs(jiffies
) - hw
->stats
.n_reset_start
;
353 do_div(seconds
, 1000);
354 fhs
->seconds_since_last_reset
= seconds
;
360 * csio_set_rport_loss_tmo - Set the rport dev loss timeout
362 * @timeout: new value for dev loss tmo.
364 * If timeout is non zero set the dev_loss_tmo to timeout, else set
365 * dev_loss_tmo to one.
368 csio_set_rport_loss_tmo(struct fc_rport
*rport
, uint32_t timeout
)
371 rport
->dev_loss_tmo
= timeout
;
373 rport
->dev_loss_tmo
= 1;
377 csio_vport_set_state(struct csio_lnode
*ln
)
379 struct fc_vport
*fc_vport
= ln
->fc_vport
;
380 struct csio_lnode
*pln
= ln
->pln
;
383 /* Set fc vport state based on phyiscal lnode */
384 csio_lnode_state_to_str(pln
, state
);
385 if (strcmp(state
, "READY")) {
386 fc_vport_set_state(fc_vport
, FC_VPORT_LINKDOWN
);
390 if (!(pln
->flags
& CSIO_LNF_NPIVSUPP
)) {
391 fc_vport_set_state(fc_vport
, FC_VPORT_NO_FABRIC_SUPP
);
395 /* Set fc vport state based on virtual lnode */
396 csio_lnode_state_to_str(ln
, state
);
397 if (strcmp(state
, "READY")) {
398 fc_vport_set_state(fc_vport
, FC_VPORT_LINKDOWN
);
401 fc_vport_set_state(fc_vport
, FC_VPORT_ACTIVE
);
405 csio_fcoe_alloc_vnp(struct csio_hw
*hw
, struct csio_lnode
*ln
)
407 struct csio_lnode
*pln
;
409 struct fw_fcoe_vnp_cmd
*rsp
;
413 /* Issue VNP cmd to alloc vport */
414 /* Allocate Mbox request */
415 spin_lock_irq(&hw
->lock
);
416 mbp
= mempool_alloc(hw
->mb_mempool
, GFP_ATOMIC
);
418 CSIO_INC_STATS(hw
, n_err_nomem
);
424 ln
->fcf_flowid
= pln
->fcf_flowid
;
425 ln
->portid
= pln
->portid
;
427 csio_fcoe_vnp_alloc_init_mb(ln
, mbp
, CSIO_MB_DEFAULT_TMO
,
428 pln
->fcf_flowid
, pln
->vnp_flowid
, 0,
429 csio_ln_wwnn(ln
), csio_ln_wwpn(ln
), NULL
);
431 for (retry
= 0; retry
< 3; retry
++) {
432 /* FW is expected to complete vnp cmd in immediate mode
433 * without much delay.
434 * Otherwise, there will be increase in IO latency since HW
435 * lock is held till completion of vnp mbox cmd.
437 ret
= csio_mb_issue(hw
, mbp
);
441 /* Retry if mbox returns busy */
442 spin_unlock_irq(&hw
->lock
);
444 spin_lock_irq(&hw
->lock
);
448 csio_ln_err(ln
, "Failed to issue mbox FCoE VNP command\n");
452 /* Process Mbox response of VNP command */
453 rsp
= (struct fw_fcoe_vnp_cmd
*)(mbp
->mb
);
454 if (FW_CMD_RETVAL_G(ntohl(rsp
->alloc_to_len16
)) != FW_SUCCESS
) {
455 csio_ln_err(ln
, "FCOE VNP ALLOC cmd returned 0x%x!\n",
456 FW_CMD_RETVAL_G(ntohl(rsp
->alloc_to_len16
)));
461 ln
->vnp_flowid
= FW_FCOE_VNP_CMD_VNPI_GET(
462 ntohl(rsp
->gen_wwn_to_vnpi
));
463 memcpy(csio_ln_wwnn(ln
), rsp
->vnport_wwnn
, 8);
464 memcpy(csio_ln_wwpn(ln
), rsp
->vnport_wwpn
, 8);
466 csio_ln_dbg(ln
, "FCOE VNPI: 0x%x\n", ln
->vnp_flowid
);
467 csio_ln_dbg(ln
, "\tWWNN: %x%x%x%x%x%x%x%x\n",
468 ln
->ln_sparm
.wwnn
[0], ln
->ln_sparm
.wwnn
[1],
469 ln
->ln_sparm
.wwnn
[2], ln
->ln_sparm
.wwnn
[3],
470 ln
->ln_sparm
.wwnn
[4], ln
->ln_sparm
.wwnn
[5],
471 ln
->ln_sparm
.wwnn
[6], ln
->ln_sparm
.wwnn
[7]);
472 csio_ln_dbg(ln
, "\tWWPN: %x%x%x%x%x%x%x%x\n",
473 ln
->ln_sparm
.wwpn
[0], ln
->ln_sparm
.wwpn
[1],
474 ln
->ln_sparm
.wwpn
[2], ln
->ln_sparm
.wwpn
[3],
475 ln
->ln_sparm
.wwpn
[4], ln
->ln_sparm
.wwpn
[5],
476 ln
->ln_sparm
.wwpn
[6], ln
->ln_sparm
.wwpn
[7]);
479 mempool_free(mbp
, hw
->mb_mempool
);
481 spin_unlock_irq(&hw
->lock
);
486 csio_fcoe_free_vnp(struct csio_hw
*hw
, struct csio_lnode
*ln
)
488 struct csio_lnode
*pln
;
490 struct fw_fcoe_vnp_cmd
*rsp
;
494 /* Issue VNP cmd to free vport */
495 /* Allocate Mbox request */
497 spin_lock_irq(&hw
->lock
);
498 mbp
= mempool_alloc(hw
->mb_mempool
, GFP_ATOMIC
);
500 CSIO_INC_STATS(hw
, n_err_nomem
);
507 csio_fcoe_vnp_free_init_mb(ln
, mbp
, CSIO_MB_DEFAULT_TMO
,
508 ln
->fcf_flowid
, ln
->vnp_flowid
,
511 for (retry
= 0; retry
< 3; retry
++) {
512 ret
= csio_mb_issue(hw
, mbp
);
516 /* Retry if mbox returns busy */
517 spin_unlock_irq(&hw
->lock
);
519 spin_lock_irq(&hw
->lock
);
523 csio_ln_err(ln
, "Failed to issue mbox FCoE VNP command\n");
527 /* Process Mbox response of VNP command */
528 rsp
= (struct fw_fcoe_vnp_cmd
*)(mbp
->mb
);
529 if (FW_CMD_RETVAL_G(ntohl(rsp
->alloc_to_len16
)) != FW_SUCCESS
) {
530 csio_ln_err(ln
, "FCOE VNP FREE cmd returned 0x%x!\n",
531 FW_CMD_RETVAL_G(ntohl(rsp
->alloc_to_len16
)));
536 mempool_free(mbp
, hw
->mb_mempool
);
538 spin_unlock_irq(&hw
->lock
);
543 csio_vport_create(struct fc_vport
*fc_vport
, bool disable
)
545 struct Scsi_Host
*shost
= fc_vport
->shost
;
546 struct csio_lnode
*pln
= shost_priv(shost
);
547 struct csio_lnode
*ln
= NULL
;
548 struct csio_hw
*hw
= csio_lnode_to_hw(pln
);
552 ln
= csio_shost_init(hw
, &fc_vport
->dev
, false, pln
);
556 if (fc_vport
->node_name
!= 0) {
557 u64_to_wwn(fc_vport
->node_name
, wwn
);
559 if (!CSIO_VALID_WWN(wwn
)) {
561 "vport create failed. Invalid wwnn\n");
564 memcpy(csio_ln_wwnn(ln
), wwn
, 8);
567 if (fc_vport
->port_name
!= 0) {
568 u64_to_wwn(fc_vport
->port_name
, wwn
);
570 if (!CSIO_VALID_WWN(wwn
)) {
572 "vport create failed. Invalid wwpn\n");
576 if (csio_lnode_lookup_by_wwpn(hw
, wwn
)) {
578 "vport create failed. wwpn already exists\n");
581 memcpy(csio_ln_wwpn(ln
), wwn
, 8);
584 fc_vport_set_state(fc_vport
, FC_VPORT_INITIALIZING
);
586 if (csio_fcoe_alloc_vnp(hw
, ln
))
589 *(struct csio_lnode
**)fc_vport
->dd_data
= ln
;
590 ln
->fc_vport
= fc_vport
;
591 if (!fc_vport
->node_name
)
592 fc_vport
->node_name
= wwn_to_u64(csio_ln_wwnn(ln
));
593 if (!fc_vport
->port_name
)
594 fc_vport
->port_name
= wwn_to_u64(csio_ln_wwpn(ln
));
595 csio_fchost_attr_init(ln
);
605 csio_vport_delete(struct fc_vport
*fc_vport
)
607 struct csio_lnode
*ln
= *(struct csio_lnode
**)fc_vport
->dd_data
;
608 struct Scsi_Host
*shost
= csio_ln_to_shost(ln
);
609 struct csio_hw
*hw
= csio_lnode_to_hw(ln
);
612 spin_lock_irq(&hw
->lock
);
613 rmv
= csio_is_hw_removing(hw
);
614 spin_unlock_irq(&hw
->lock
);
621 /* Quiesce ios and send remove event to lnode */
622 scsi_block_requests(shost
);
623 spin_lock_irq(&hw
->lock
);
624 csio_scsim_cleanup_io_lnode(csio_hw_to_scsim(hw
), ln
);
625 csio_lnode_close(ln
);
626 spin_unlock_irq(&hw
->lock
);
627 scsi_unblock_requests(shost
);
630 if (fc_vport
->vport_state
!= FC_VPORT_DISABLED
)
631 csio_fcoe_free_vnp(hw
, ln
);
638 csio_vport_disable(struct fc_vport
*fc_vport
, bool disable
)
640 struct csio_lnode
*ln
= *(struct csio_lnode
**)fc_vport
->dd_data
;
641 struct Scsi_Host
*shost
= csio_ln_to_shost(ln
);
642 struct csio_hw
*hw
= csio_lnode_to_hw(ln
);
646 /* Quiesce ios and send stop event to lnode */
647 scsi_block_requests(shost
);
648 spin_lock_irq(&hw
->lock
);
649 csio_scsim_cleanup_io_lnode(csio_hw_to_scsim(hw
), ln
);
651 spin_unlock_irq(&hw
->lock
);
652 scsi_unblock_requests(shost
);
655 csio_fcoe_free_vnp(hw
, ln
);
656 fc_vport_set_state(fc_vport
, FC_VPORT_DISABLED
);
657 csio_ln_err(ln
, "vport disabled\n");
661 fc_vport_set_state(fc_vport
, FC_VPORT_INITIALIZING
);
662 if (csio_fcoe_alloc_vnp(hw
, ln
)) {
663 csio_ln_err(ln
, "vport enabled failed.\n");
666 csio_ln_err(ln
, "vport enabled\n");
672 csio_dev_loss_tmo_callbk(struct fc_rport
*rport
)
674 struct csio_rnode
*rn
;
676 struct csio_lnode
*ln
;
678 rn
= *((struct csio_rnode
**)rport
->dd_data
);
679 ln
= csio_rnode_to_lnode(rn
);
680 hw
= csio_lnode_to_hw(ln
);
682 spin_lock_irq(&hw
->lock
);
684 /* return if driver is being removed or same rnode comes back online */
685 if (csio_is_hw_removing(hw
) || csio_is_rnode_ready(rn
))
688 csio_ln_dbg(ln
, "devloss timeout on rnode:%p portid:x%x flowid:x%x\n",
689 rn
, rn
->nport_id
, csio_rn_flowid(rn
));
691 CSIO_INC_STATS(ln
, n_dev_loss_tmo
);
694 * enqueue devloss event to event worker thread to serialize all
697 if (csio_enqueue_evt(hw
, CSIO_EVT_DEV_LOSS
, &rn
, sizeof(rn
))) {
698 CSIO_INC_STATS(hw
, n_evt_drop
);
702 if (!(hw
->flags
& CSIO_HWF_FWEVT_PENDING
)) {
703 hw
->flags
|= CSIO_HWF_FWEVT_PENDING
;
704 spin_unlock_irq(&hw
->lock
);
705 schedule_work(&hw
->evtq_work
);
710 spin_unlock_irq(&hw
->lock
);
713 /* FC transport functions template - Physical port */
714 struct fc_function_template csio_fc_transport_funcs
= {
715 .show_host_node_name
= 1,
716 .show_host_port_name
= 1,
717 .show_host_supported_classes
= 1,
718 .show_host_supported_fc4s
= 1,
719 .show_host_maxframe_size
= 1,
721 .get_host_port_id
= csio_get_host_port_id
,
722 .show_host_port_id
= 1,
724 .get_host_port_type
= csio_get_host_port_type
,
725 .show_host_port_type
= 1,
727 .get_host_port_state
= csio_get_host_port_state
,
728 .show_host_port_state
= 1,
730 .show_host_active_fc4s
= 1,
731 .get_host_speed
= csio_get_host_speed
,
732 .show_host_speed
= 1,
733 .get_host_fabric_name
= csio_get_host_fabric_name
,
734 .show_host_fabric_name
= 1,
736 .get_fc_host_stats
= csio_get_stats
,
738 .dd_fcrport_size
= sizeof(struct csio_rnode
*),
739 .show_rport_maxframe_size
= 1,
740 .show_rport_supported_classes
= 1,
742 .set_rport_dev_loss_tmo
= csio_set_rport_loss_tmo
,
743 .show_rport_dev_loss_tmo
= 1,
745 .show_starget_port_id
= 1,
746 .show_starget_node_name
= 1,
747 .show_starget_port_name
= 1,
749 .dev_loss_tmo_callbk
= csio_dev_loss_tmo_callbk
,
750 .dd_fcvport_size
= sizeof(struct csio_lnode
*),
752 .vport_create
= csio_vport_create
,
753 .vport_disable
= csio_vport_disable
,
754 .vport_delete
= csio_vport_delete
,
757 /* FC transport functions template - Virtual port */
758 struct fc_function_template csio_fc_transport_vport_funcs
= {
759 .show_host_node_name
= 1,
760 .show_host_port_name
= 1,
761 .show_host_supported_classes
= 1,
762 .show_host_supported_fc4s
= 1,
763 .show_host_maxframe_size
= 1,
765 .get_host_port_id
= csio_get_host_port_id
,
766 .show_host_port_id
= 1,
768 .get_host_port_type
= csio_get_host_port_type
,
769 .show_host_port_type
= 1,
771 .get_host_port_state
= csio_get_host_port_state
,
772 .show_host_port_state
= 1,
773 .show_host_active_fc4s
= 1,
775 .get_host_speed
= csio_get_host_speed
,
776 .show_host_speed
= 1,
778 .get_host_fabric_name
= csio_get_host_fabric_name
,
779 .show_host_fabric_name
= 1,
781 .get_fc_host_stats
= csio_get_stats
,
783 .dd_fcrport_size
= sizeof(struct csio_rnode
*),
784 .show_rport_maxframe_size
= 1,
785 .show_rport_supported_classes
= 1,
787 .set_rport_dev_loss_tmo
= csio_set_rport_loss_tmo
,
788 .show_rport_dev_loss_tmo
= 1,
790 .show_starget_port_id
= 1,
791 .show_starget_node_name
= 1,
792 .show_starget_port_name
= 1,
794 .dev_loss_tmo_callbk
= csio_dev_loss_tmo_callbk
,