Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] libfc, fcoe, bnx2fc: cleanup fcoe_dev_stats

The libfc is used by fcoe but fcoe agnostic,
and therefore should not have any fcoe references.

So renaming fcoe_dev_stats from libfc as its for fc_stats.
After that libfc is fcoe string free except some strings for
Open-FCoE.org.

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Acked-by : Robert Love <robert.w.love@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Acked-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

authored by

Vasu Dev and committed by
James Bottomley
1bd49b48 e58abb0c

+67 -69
+5 -5
drivers/scsi/bnx2fc/bnx2fc_fcoe.c
··· 286 286 struct fcoe_port *port; 287 287 struct fcoe_hdr *hp; 288 288 struct bnx2fc_rport *tgt; 289 - struct fcoe_dev_stats *stats; 289 + struct fc_stats *stats; 290 290 u8 sof, eof; 291 291 u32 crc; 292 292 unsigned int hlen, tlen, elen; ··· 412 412 } 413 413 414 414 /*update tx stats */ 415 - stats = per_cpu_ptr(lport->dev_stats, get_cpu()); 415 + stats = per_cpu_ptr(lport->stats, get_cpu()); 416 416 stats->TxFrames++; 417 417 stats->TxWords += wlen; 418 418 put_cpu(); ··· 522 522 u32 fr_len; 523 523 struct fc_lport *lport; 524 524 struct fcoe_rcv_info *fr; 525 - struct fcoe_dev_stats *stats; 525 + struct fc_stats *stats; 526 526 struct fc_frame_header *fh; 527 527 struct fcoe_crc_eof crc_eof; 528 528 struct fc_frame *fp; ··· 551 551 skb_pull(skb, sizeof(struct fcoe_hdr)); 552 552 fr_len = skb->len - sizeof(struct fcoe_crc_eof); 553 553 554 - stats = per_cpu_ptr(lport->dev_stats, get_cpu()); 554 + stats = per_cpu_ptr(lport->stats, get_cpu()); 555 555 stats->RxFrames++; 556 556 stats->RxWords += fr_len / FCOE_WORD_TO_BYTE; 557 557 ··· 942 942 FC_PORTTYPE_UNKNOWN; 943 943 mutex_unlock(&lport->lp_mutex); 944 944 fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN; 945 - per_cpu_ptr(lport->dev_stats, 945 + per_cpu_ptr(lport->stats, 946 946 get_cpu())->LinkFailureCount++; 947 947 put_cpu(); 948 948 fcoe_clean_pending_queue(lport);
+2 -2
drivers/scsi/bnx2fc/bnx2fc_io.c
··· 1980 1980 struct bnx2fc_interface *interface = port->priv; 1981 1981 struct bnx2fc_hba *hba = interface->hba; 1982 1982 struct fc_lport *lport = port->lport; 1983 - struct fcoe_dev_stats *stats; 1983 + struct fc_stats *stats; 1984 1984 int task_idx, index; 1985 1985 u16 xid; 1986 1986 ··· 1991 1991 io_req->data_xfer_len = scsi_bufflen(sc_cmd); 1992 1992 sc_cmd->SCp.ptr = (char *)io_req; 1993 1993 1994 - stats = per_cpu_ptr(lport->dev_stats, get_cpu()); 1994 + stats = per_cpu_ptr(lport->stats, get_cpu()); 1995 1995 if (sc_cmd->sc_data_direction == DMA_FROM_DEVICE) { 1996 1996 io_req->io_req_flags = BNX2FC_READ; 1997 1997 stats->InputRequests++;
+9 -9
drivers/scsi/fcoe/fcoe.c
··· 1529 1529 1530 1530 return 0; 1531 1531 err: 1532 - per_cpu_ptr(lport->dev_stats, get_cpu())->ErrorFrames++; 1532 + per_cpu_ptr(lport->stats, get_cpu())->ErrorFrames++; 1533 1533 put_cpu(); 1534 1534 err2: 1535 1535 kfree_skb(skb); ··· 1569 1569 struct ethhdr *eh; 1570 1570 struct fcoe_crc_eof *cp; 1571 1571 struct sk_buff *skb; 1572 - struct fcoe_dev_stats *stats; 1572 + struct fc_stats *stats; 1573 1573 struct fc_frame_header *fh; 1574 1574 unsigned int hlen; /* header length implies the version */ 1575 1575 unsigned int tlen; /* trailer length */ ··· 1680 1680 skb_shinfo(skb)->gso_size = 0; 1681 1681 } 1682 1682 /* update tx stats: regardless if LLD fails */ 1683 - stats = per_cpu_ptr(lport->dev_stats, get_cpu()); 1683 + stats = per_cpu_ptr(lport->stats, get_cpu()); 1684 1684 stats->TxFrames++; 1685 1685 stats->TxWords += wlen; 1686 1686 put_cpu(); ··· 1714 1714 struct fcoe_interface *fcoe; 1715 1715 struct fc_frame_header *fh; 1716 1716 struct sk_buff *skb = (struct sk_buff *)fp; 1717 - struct fcoe_dev_stats *stats; 1717 + struct fc_stats *stats; 1718 1718 1719 1719 /* 1720 1720 * We only check CRC if no offload is available and if it is ··· 1745 1745 return 0; 1746 1746 } 1747 1747 1748 - stats = per_cpu_ptr(lport->dev_stats, get_cpu()); 1748 + stats = per_cpu_ptr(lport->stats, get_cpu()); 1749 1749 stats->InvalidCRCCount++; 1750 1750 if (stats->InvalidCRCCount < 5) 1751 1751 printk(KERN_WARNING "fcoe: dropping frame with CRC error\n"); ··· 1762 1762 u32 fr_len; 1763 1763 struct fc_lport *lport; 1764 1764 struct fcoe_rcv_info *fr; 1765 - struct fcoe_dev_stats *stats; 1765 + struct fc_stats *stats; 1766 1766 struct fcoe_crc_eof crc_eof; 1767 1767 struct fc_frame *fp; 1768 1768 struct fcoe_port *port; ··· 1793 1793 */ 1794 1794 hp = (struct fcoe_hdr *) skb_network_header(skb); 1795 1795 1796 - stats = per_cpu_ptr(lport->dev_stats, get_cpu()); 1796 + stats = per_cpu_ptr(lport->stats, get_cpu()); 1797 1797 if (unlikely(FC_FCOE_DECAPS_VER(hp) != FC_FCOE_VER)) { 1798 1798 if (stats->ErrorFrames < 5) 1799 1799 printk(KERN_WARNING "fcoe: FCoE version " ··· 1970 1970 struct fcoe_ctlr *ctlr; 1971 1971 struct fcoe_interface *fcoe; 1972 1972 struct fcoe_port *port; 1973 - struct fcoe_dev_stats *stats; 1973 + struct fc_stats *stats; 1974 1974 u32 link_possible = 1; 1975 1975 u32 mfs; 1976 1976 int rc = NOTIFY_OK; ··· 2024 2024 if (link_possible && !fcoe_link_ok(lport)) 2025 2025 fcoe_ctlr_link_up(ctlr); 2026 2026 else if (fcoe_ctlr_link_down(ctlr)) { 2027 - stats = per_cpu_ptr(lport->dev_stats, get_cpu()); 2027 + stats = per_cpu_ptr(lport->stats, get_cpu()); 2028 2028 stats->LinkFailureCount++; 2029 2029 put_cpu(); 2030 2030 fcoe_clean_pending_queue(lport);
+6 -7
drivers/scsi/fcoe/fcoe_ctlr.c
··· 788 788 unsigned long deadline; 789 789 unsigned long sel_time = 0; 790 790 struct list_head del_list; 791 - struct fcoe_dev_stats *stats; 791 + struct fc_stats *stats; 792 792 793 793 INIT_LIST_HEAD(&del_list); 794 794 795 - stats = per_cpu_ptr(fip->lp->dev_stats, get_cpu()); 795 + stats = per_cpu_ptr(fip->lp->stats, get_cpu()); 796 796 797 797 list_for_each_entry_safe(fcf, next, &fip->fcfs, list) { 798 798 deadline = fcf->time + fcf->fka_period + fcf->fka_period / 2; ··· 1104 1104 struct fc_frame_header *fh = NULL; 1105 1105 struct fip_desc *desc; 1106 1106 struct fip_encaps *els; 1107 - struct fcoe_dev_stats *stats; 1108 1107 struct fcoe_fcf *sel; 1108 + struct fc_stats *stats; 1109 1109 enum fip_desc_type els_dtype = 0; 1110 1110 u8 els_op; 1111 1111 u8 sub; ··· 1249 1249 fr_dev(fp) = lport; 1250 1250 fr_encaps(fp) = els_dtype; 1251 1251 1252 - stats = per_cpu_ptr(lport->dev_stats, get_cpu()); 1252 + stats = per_cpu_ptr(lport->stats, get_cpu()); 1253 1253 stats->RxFrames++; 1254 1254 stats->RxWords += skb->len / FIP_BPW; 1255 1255 put_cpu(); ··· 1353 1353 ntoh24(vp->fd_fc_id)); 1354 1354 if (vn_port && (vn_port == lport)) { 1355 1355 mutex_lock(&fip->ctlr_mutex); 1356 - per_cpu_ptr(lport->dev_stats, 1356 + per_cpu_ptr(lport->stats, 1357 1357 get_cpu())->VLinkFailureCount++; 1358 1358 put_cpu(); 1359 1359 fcoe_ctlr_reset(fip); ··· 1383 1383 * followed by physical port 1384 1384 */ 1385 1385 mutex_lock(&fip->ctlr_mutex); 1386 - per_cpu_ptr(lport->dev_stats, 1387 - get_cpu())->VLinkFailureCount++; 1386 + per_cpu_ptr(lport->stats, get_cpu())->VLinkFailureCount++; 1388 1387 put_cpu(); 1389 1388 fcoe_ctlr_reset(fip); 1390 1389 mutex_unlock(&fip->ctlr_mutex);
+5 -5
drivers/scsi/fcoe/fcoe_transport.c
··· 89 89 { 90 90 unsigned int cpu; 91 91 u32 lfc, vlfc, mdac; 92 - struct fcoe_dev_stats *devst; 92 + struct fc_stats *stats; 93 93 struct fcoe_fc_els_lesb *lesb; 94 94 struct rtnl_link_stats64 temp; 95 95 ··· 99 99 lesb = (struct fcoe_fc_els_lesb *)fc_lesb; 100 100 memset(lesb, 0, sizeof(*lesb)); 101 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; 102 + stats = per_cpu_ptr(lport->stats, cpu); 103 + lfc += stats->LinkFailureCount; 104 + vlfc += stats->VLinkFailureCount; 105 + mdac += stats->MissDiscAdvCount; 106 106 } 107 107 lesb->lesb_link_fail = htonl(lfc); 108 108 lesb->lesb_vlink_fail = htonl(vlfc);
+2 -2
drivers/scsi/libfc/fc_exch.c
··· 124 124 * for each anchor to determine if that EM should be used. The last 125 125 * anchor in the list will always match to handle any exchanges not 126 126 * handled by other EMs. The non-default EMs would be added to the 127 - * anchor list by HW that provides FCoE offloads. 127 + * anchor list by HW that provides offloads. 128 128 */ 129 129 struct fc_exch_mgr_anchor { 130 130 struct list_head ema_list; ··· 986 986 /* 987 987 * Update sequence_id based on incoming last 988 988 * frame of sequence exchange. This is needed 989 - * for FCoE target where DDP has been used 989 + * for FC target where DDP has been used 990 990 * on target where, stack is indicated only 991 991 * about last frame's (payload _header) header. 992 992 * Whereas "seq_id" which is part of
+4 -4
drivers/scsi/libfc/fc_fcp.c
··· 434 434 { 435 435 struct scsi_cmnd *sc = fsp->cmd; 436 436 struct fc_lport *lport = fsp->lp; 437 - struct fcoe_dev_stats *stats; 437 + struct fc_stats *stats; 438 438 struct fc_frame_header *fh; 439 439 size_t start_offset; 440 440 size_t offset; ··· 496 496 497 497 if (~crc != le32_to_cpu(fr_crc(fp))) { 498 498 crc_err: 499 - stats = per_cpu_ptr(lport->dev_stats, get_cpu()); 499 + stats = per_cpu_ptr(lport->stats, get_cpu()); 500 500 stats->ErrorFrames++; 501 501 /* per cpu count, not total count, but OK for limit */ 502 502 if (stats->InvalidCRCCount++ < FC_MAX_ERROR_CNT) ··· 1786 1786 struct fc_rport_libfc_priv *rpriv; 1787 1787 int rval; 1788 1788 int rc = 0; 1789 - struct fcoe_dev_stats *stats; 1789 + struct fc_stats *stats; 1790 1790 1791 1791 rval = fc_remote_port_chkready(rport); 1792 1792 if (rval) { ··· 1835 1835 /* 1836 1836 * setup the data direction 1837 1837 */ 1838 - stats = per_cpu_ptr(lport->dev_stats, get_cpu()); 1838 + stats = per_cpu_ptr(lport->stats, get_cpu()); 1839 1839 if (sc_cmd->sc_data_direction == DMA_FROM_DEVICE) { 1840 1840 fsp->req_flags = FC_SRB_READ; 1841 1841 stats->InputRequests++;
+1 -1
drivers/scsi/libfc/fc_frame.c
··· 49 49 EXPORT_SYMBOL(fc_frame_crc_check); 50 50 51 51 /* 52 - * Allocate a frame intended to be sent via fcoe_xmit. 52 + * Allocate a frame intended to be sent. 53 53 * Get an sk_buff for the frame and set the length. 54 54 */ 55 55 struct fc_frame *_fc_frame_alloc(size_t len)
+25 -25
drivers/scsi/libfc/fc_lport.c
··· 299 299 */ 300 300 struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *shost) 301 301 { 302 - struct fc_host_statistics *fcoe_stats; 302 + struct fc_host_statistics *fc_stats; 303 303 struct fc_lport *lport = shost_priv(shost); 304 304 struct timespec v0, v1; 305 305 unsigned int cpu; 306 306 u64 fcp_in_bytes = 0; 307 307 u64 fcp_out_bytes = 0; 308 308 309 - fcoe_stats = &lport->host_stats; 310 - memset(fcoe_stats, 0, sizeof(struct fc_host_statistics)); 309 + fc_stats = &lport->host_stats; 310 + memset(fc_stats, 0, sizeof(struct fc_host_statistics)); 311 311 312 312 jiffies_to_timespec(jiffies, &v0); 313 313 jiffies_to_timespec(lport->boot_time, &v1); 314 - fcoe_stats->seconds_since_last_reset = (v0.tv_sec - v1.tv_sec); 314 + fc_stats->seconds_since_last_reset = (v0.tv_sec - v1.tv_sec); 315 315 316 316 for_each_possible_cpu(cpu) { 317 - struct fcoe_dev_stats *stats; 317 + struct fc_stats *stats; 318 318 319 - stats = per_cpu_ptr(lport->dev_stats, cpu); 319 + stats = per_cpu_ptr(lport->stats, cpu); 320 320 321 - fcoe_stats->tx_frames += stats->TxFrames; 322 - fcoe_stats->tx_words += stats->TxWords; 323 - fcoe_stats->rx_frames += stats->RxFrames; 324 - fcoe_stats->rx_words += stats->RxWords; 325 - fcoe_stats->error_frames += stats->ErrorFrames; 326 - fcoe_stats->invalid_crc_count += stats->InvalidCRCCount; 327 - fcoe_stats->fcp_input_requests += stats->InputRequests; 328 - fcoe_stats->fcp_output_requests += stats->OutputRequests; 329 - fcoe_stats->fcp_control_requests += stats->ControlRequests; 321 + fc_stats->tx_frames += stats->TxFrames; 322 + fc_stats->tx_words += stats->TxWords; 323 + fc_stats->rx_frames += stats->RxFrames; 324 + fc_stats->rx_words += stats->RxWords; 325 + fc_stats->error_frames += stats->ErrorFrames; 326 + fc_stats->invalid_crc_count += stats->InvalidCRCCount; 327 + fc_stats->fcp_input_requests += stats->InputRequests; 328 + fc_stats->fcp_output_requests += stats->OutputRequests; 329 + fc_stats->fcp_control_requests += stats->ControlRequests; 330 330 fcp_in_bytes += stats->InputBytes; 331 331 fcp_out_bytes += stats->OutputBytes; 332 - fcoe_stats->link_failure_count += stats->LinkFailureCount; 332 + fc_stats->link_failure_count += stats->LinkFailureCount; 333 333 } 334 - fcoe_stats->fcp_input_megabytes = div_u64(fcp_in_bytes, 1000000); 335 - fcoe_stats->fcp_output_megabytes = div_u64(fcp_out_bytes, 1000000); 336 - fcoe_stats->lip_count = -1; 337 - fcoe_stats->nos_count = -1; 338 - fcoe_stats->loss_of_sync_count = -1; 339 - fcoe_stats->loss_of_signal_count = -1; 340 - fcoe_stats->prim_seq_protocol_err_count = -1; 341 - fcoe_stats->dumped_frames = -1; 342 - return fcoe_stats; 334 + fc_stats->fcp_input_megabytes = div_u64(fcp_in_bytes, 1000000); 335 + fc_stats->fcp_output_megabytes = div_u64(fcp_out_bytes, 1000000); 336 + fc_stats->lip_count = -1; 337 + fc_stats->nos_count = -1; 338 + fc_stats->loss_of_sync_count = -1; 339 + fc_stats->loss_of_signal_count = -1; 340 + fc_stats->prim_seq_protocol_err_count = -1; 341 + fc_stats->dumped_frames = -1; 342 + return fc_stats; 343 343 } 344 344 EXPORT_SYMBOL(fc_get_host_stats); 345 345
+8 -9
include/scsi/libfc.h
··· 224 224 }; 225 225 226 226 /** 227 - * struct fcoe_dev_stats - fcoe stats structure 227 + * struct fc_stats - fc stats structure 228 228 * @SecondsSinceLastReset: Seconds since the last reset 229 229 * @TxFrames: Number of transmitted frames 230 230 * @TxWords: Number of transmitted words ··· 244 244 * @VLinkFailureCount: Number of virtual link failures 245 245 * @MissDiscAdvCount: Number of missing FIP discovery advertisement 246 246 */ 247 - struct fcoe_dev_stats { 247 + struct fc_stats { 248 248 u64 SecondsSinceLastReset; 249 249 u64 TxFrames; 250 250 u64 TxWords; ··· 510 510 int (*ddp_done)(struct fc_lport *, u16); 511 511 /* 512 512 * Sets up the DDP context for a given exchange id on the given 513 - * scatterlist if LLD supports DDP for FCoE target. 513 + * scatterlist if LLD supports DDP for target. 514 514 * 515 515 * STATUS: OPTIONAL 516 516 */ ··· 817 817 * @state: Identifies the state 818 818 * @boot_time: Timestamp indicating when the local port came online 819 819 * @host_stats: SCSI host statistics 820 - * @dev_stats: FCoE device stats (TODO: libfc should not be 821 - * FCoE aware) 820 + * @stats: FC local port stats (TODO separate libfc LLD stats) 822 821 * @retry_count: Number of retries in the current state 823 822 * @port_id: FC Port ID 824 823 * @wwpn: World Wide Port Name ··· 866 867 enum fc_lport_state state; 867 868 unsigned long boot_time; 868 869 struct fc_host_statistics host_stats; 869 - struct fcoe_dev_stats __percpu *dev_stats; 870 + struct fc_stats __percpu *stats; 870 871 u8 retry_count; 871 872 872 873 /* Fabric information */ ··· 979 980 */ 980 981 static inline int fc_lport_init_stats(struct fc_lport *lport) 981 982 { 982 - lport->dev_stats = alloc_percpu(struct fcoe_dev_stats); 983 - if (!lport->dev_stats) 983 + lport->stats = alloc_percpu(struct fc_stats); 984 + if (!lport->stats) 984 985 return -ENOMEM; 985 986 return 0; 986 987 } ··· 991 992 */ 992 993 static inline void fc_lport_free_stats(struct fc_lport *lport) 993 994 { 994 - free_percpu(lport->dev_stats); 995 + free_percpu(lport->stats); 995 996 } 996 997 997 998 /**