diff options
author | Bhanu Prakash Gollapudi <bprakash@broadcom.com> | 2011-10-03 19:45:01 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-10-16 11:38:01 -0400 |
commit | 814740d5f67ae5f205349019bfaae38bcd0c8732 (patch) | |
tree | 4c7de90af617916dc06d44a5b5504775f3ffb211 /drivers/scsi/fcoe/fcoe_transport.c | |
parent | fd8fa9071e49a56cc91f739813ea88f16b7c1240 (diff) |
[SCSI] fcoe,libfcoe: Move common code for fcoe_get_lesb to fcoe_transport
Except for obtaining the netdev from lport, fcoe_get_lesb is the common code
for the LLDs.
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Acked-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/fcoe/fcoe_transport.c')
-rw-r--r-- | drivers/scsi/fcoe/fcoe_transport.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c index 50c8c4a530aa..7264d0d5d737 100644 --- a/drivers/scsi/fcoe/fcoe_transport.c +++ b/drivers/scsi/fcoe/fcoe_transport.c | |||
@@ -83,6 +83,35 @@ static struct notifier_block libfcoe_notifier = { | |||
83 | .notifier_call = libfcoe_device_notification, | 83 | .notifier_call = libfcoe_device_notification, |
84 | }; | 84 | }; |
85 | 85 | ||
86 | void __fcoe_get_lesb(struct fc_lport *lport, | ||
87 | struct fc_els_lesb *fc_lesb, | ||
88 | struct net_device *netdev) | ||
89 | { | ||
90 | unsigned int cpu; | ||
91 | u32 lfc, vlfc, mdac; | ||
92 | struct fcoe_dev_stats *devst; | ||
93 | struct fcoe_fc_els_lesb *lesb; | ||
94 | struct rtnl_link_stats64 temp; | ||
95 | |||
96 | lfc = 0; | ||
97 | vlfc = 0; | ||
98 | mdac = 0; | ||
99 | lesb = (struct fcoe_fc_els_lesb *)fc_lesb; | ||
100 | memset(lesb, 0, sizeof(*lesb)); | ||
101 | for_each_possible_cpu(cpu) { | ||
102 | devst = per_cpu_ptr(lport->dev_stats, cpu); | ||
103 | lfc += devst->LinkFailureCount; | ||
104 | vlfc += devst->VLinkFailureCount; | ||
105 | mdac += devst->MissDiscAdvCount; | ||
106 | } | ||
107 | lesb->lesb_link_fail = htonl(lfc); | ||
108 | lesb->lesb_vlink_fail = htonl(vlfc); | ||
109 | lesb->lesb_miss_fka = htonl(mdac); | ||
110 | lesb->lesb_fcs_error = | ||
111 | htonl(dev_get_stats(netdev, &temp)->rx_crc_errors); | ||
112 | } | ||
113 | EXPORT_SYMBOL_GPL(__fcoe_get_lesb); | ||
114 | |||
86 | void fcoe_wwn_to_str(u64 wwn, char *buf, int len) | 115 | void fcoe_wwn_to_str(u64 wwn, char *buf, int len) |
87 | { | 116 | { |
88 | u8 wwpn[8]; | 117 | u8 wwpn[8]; |