diff options
author | Yi Zou <yi.zou@intel.com> | 2009-11-20 17:55:19 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-12-04 13:01:58 -0500 |
commit | b84056bf68404a5fe06b452ea9790b9927e793a6 (patch) | |
tree | 67e9129cd1cf94465f6845ee8f378c856b27bd04 /drivers/scsi | |
parent | b21a0c397eea722ff84bbeaf5e6e732a06b69896 (diff) |
[SCSI] fcoe, libfc: add get_lesb() to allow LLD to fill the link error status block (LESB)
Add a member function pointer as get_lesb to libfc_function_template so LLD
can fill the LESB based on its own statistics. For fcoe, it fills the LESB
as a fcoe_fc_els_lesb struct according to FC-BB-5.
Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/fcoe/fcoe.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index 32298ed60614..a30ffaa1222c 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c | |||
@@ -111,6 +111,8 @@ static struct fc_seq *fcoe_elsct_send(struct fc_lport *, | |||
111 | void *, u32 timeout); | 111 | void *, u32 timeout); |
112 | static void fcoe_recv_frame(struct sk_buff *skb); | 112 | static void fcoe_recv_frame(struct sk_buff *skb); |
113 | 113 | ||
114 | static void fcoe_get_lesb(struct fc_lport *, struct fc_els_lesb *); | ||
115 | |||
114 | module_param_call(create, fcoe_create, NULL, NULL, S_IWUSR); | 116 | module_param_call(create, fcoe_create, NULL, NULL, S_IWUSR); |
115 | __MODULE_PARM_TYPE(create, "string"); | 117 | __MODULE_PARM_TYPE(create, "string"); |
116 | MODULE_PARM_DESC(create, "Create fcoe fcoe using net device passed in."); | 118 | MODULE_PARM_DESC(create, "Create fcoe fcoe using net device passed in."); |
@@ -141,6 +143,7 @@ static struct libfc_function_template fcoe_libfc_fcn_templ = { | |||
141 | .ddp_setup = fcoe_ddp_setup, | 143 | .ddp_setup = fcoe_ddp_setup, |
142 | .ddp_done = fcoe_ddp_done, | 144 | .ddp_done = fcoe_ddp_done, |
143 | .elsct_send = fcoe_elsct_send, | 145 | .elsct_send = fcoe_elsct_send, |
146 | .get_lesb = fcoe_get_lesb, | ||
144 | }; | 147 | }; |
145 | 148 | ||
146 | struct fc_function_template fcoe_transport_function = { | 149 | struct fc_function_template fcoe_transport_function = { |
@@ -2455,3 +2458,34 @@ static void fcoe_set_vport_symbolic_name(struct fc_vport *vport) | |||
2455 | lport->tt.elsct_send(lport, FC_FID_DIR_SERV, fp, FC_NS_RSPN_ID, | 2458 | lport->tt.elsct_send(lport, FC_FID_DIR_SERV, fp, FC_NS_RSPN_ID, |
2456 | NULL, NULL, 3 * lport->r_a_tov); | 2459 | NULL, NULL, 3 * lport->r_a_tov); |
2457 | } | 2460 | } |
2461 | |||
2462 | /** | ||
2463 | * fcoe_get_lesb() - Fill the FCoE Link Error Status Block | ||
2464 | * @lport: the local port | ||
2465 | * @fc_lesb: the link error status block | ||
2466 | */ | ||
2467 | static void fcoe_get_lesb(struct fc_lport *lport, | ||
2468 | struct fc_els_lesb *fc_lesb) | ||
2469 | { | ||
2470 | unsigned int cpu; | ||
2471 | u32 lfc, vlfc, mdac; | ||
2472 | struct fcoe_dev_stats *devst; | ||
2473 | struct fcoe_fc_els_lesb *lesb; | ||
2474 | struct net_device *netdev = fcoe_netdev(lport); | ||
2475 | |||
2476 | lfc = 0; | ||
2477 | vlfc = 0; | ||
2478 | mdac = 0; | ||
2479 | lesb = (struct fcoe_fc_els_lesb *)fc_lesb; | ||
2480 | memset(lesb, 0, sizeof(*lesb)); | ||
2481 | for_each_possible_cpu(cpu) { | ||
2482 | devst = per_cpu_ptr(lport->dev_stats, cpu); | ||
2483 | lfc += devst->LinkFailureCount; | ||
2484 | vlfc += devst->VLinkFailureCount; | ||
2485 | mdac += devst->MissDiscAdvCount; | ||
2486 | } | ||
2487 | lesb->lesb_link_fail = htonl(lfc); | ||
2488 | lesb->lesb_vlink_fail = htonl(vlfc); | ||
2489 | lesb->lesb_miss_fka = htonl(mdac); | ||
2490 | lesb->lesb_fcs_error = htonl(dev_get_stats(netdev)->rx_crc_errors); | ||
2491 | } | ||