Skip to content

Commit 814740d

Browse files
Bhanu Prakash GollapudiJames Bottomley
authored andcommitted
[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>
1 parent fd8fa90 commit 814740d

3 files changed

Lines changed: 32 additions & 20 deletions

File tree

‎drivers/scsi/fcoe/fcoe.c‎

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2541,28 +2541,9 @@ static void fcoe_set_vport_symbolic_name(struct fc_vport *vport)
25412541
static void fcoe_get_lesb(struct fc_lport *lport,
25422542
struct fc_els_lesb *fc_lesb)
25432543
{
2544-
unsigned int cpu;
2545-
u32 lfc, vlfc, mdac;
2546-
struct fcoe_dev_stats *devst;
2547-
struct fcoe_fc_els_lesb *lesb;
2548-
struct rtnl_link_stats64 temp;
25492544
struct net_device *netdev = fcoe_netdev(lport);
25502545

2551-
lfc = 0;
2552-
vlfc = 0;
2553-
mdac = 0;
2554-
lesb = (struct fcoe_fc_els_lesb *)fc_lesb;
2555-
memset(lesb, 0, sizeof(*lesb));
2556-
for_each_possible_cpu(cpu) {
2557-
devst = per_cpu_ptr(lport->dev_stats, cpu);
2558-
lfc += devst->LinkFailureCount;
2559-
vlfc += devst->VLinkFailureCount;
2560-
mdac += devst->MissDiscAdvCount;
2561-
}
2562-
lesb->lesb_link_fail = htonl(lfc);
2563-
lesb->lesb_vlink_fail = htonl(vlfc);
2564-
lesb->lesb_miss_fka = htonl(mdac);
2565-
lesb->lesb_fcs_error = htonl(dev_get_stats(netdev, &temp)->rx_crc_errors);
2546+
__fcoe_get_lesb(lport, fc_lesb, netdev);
25662547
}
25672548

25682549
/**

‎drivers/scsi/fcoe/fcoe_transport.c‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,35 @@ static struct notifier_block libfcoe_notifier = {
8383
.notifier_call = libfcoe_device_notification,
8484
};
8585

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+
86115
void fcoe_wwn_to_str(u64 wwn, char *buf, int len)
87116
{
88117
u8 wwpn[8];

‎include/scsi/libfcoe.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ int fcoe_libfc_config(struct fc_lport *, struct fcoe_ctlr *,
230230
u32 fcoe_fc_crc(struct fc_frame *fp);
231231
int fcoe_start_io(struct sk_buff *skb);
232232
int fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type);
233+
void __fcoe_get_lesb(struct fc_lport *lport, struct fc_els_lesb *fc_lesb,
234+
struct net_device *netdev);
233235
void fcoe_wwn_to_str(u64 wwn, char *buf, int len);
234236
int fcoe_validate_vport_create(struct fc_vport *vport);
235237

0 commit comments

Comments
 (0)