aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc
diff options
context:
space:
mode:
authorRobert Love <robert.w.love@intel.com>2009-03-31 18:51:50 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-04-03 10:22:58 -0400
commit582b45bc577f78b5bfff3db874594ce2d962b846 (patch)
treeb0cfe95b235aeca9b967cba8446db58b8a102533 /drivers/scsi/libfc
parent5e5e92df49d4dfbef9ba981297c7f76d189376ac (diff)
[SCSI] fcoe: Use per-CPU kernel function for dev_stats instead of an array
Remove the hotplug creation of dev_stats, we allocate for all possible CPUs now when we allocate the lport. v2: Durring the 2.6.30 merge window, before these patches were comitted, 'percpu_ptr' was renamed 'per_cpu_ptr'. This latest update updates this patch for the name change. 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@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/libfc')
-rw-r--r--drivers/scsi/libfc/fc_fcp.c8
-rw-r--r--drivers/scsi/libfc/fc_lport.c11
2 files changed, 11 insertions, 8 deletions
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index a5725f3b7ce1..0997e8b1dcea 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -407,10 +407,12 @@ static void fc_fcp_recv_data(struct fc_fcp_pkt *fsp, struct fc_frame *fp)
407 407
408 if (~crc != le32_to_cpu(fr_crc(fp))) { 408 if (~crc != le32_to_cpu(fr_crc(fp))) {
409crc_err: 409crc_err:
410 stats = lp->dev_stats[smp_processor_id()]; 410 stats = fc_lport_get_stats(lp);
411 stats->ErrorFrames++; 411 stats->ErrorFrames++;
412 /* FIXME - per cpu count, not total count! */
412 if (stats->InvalidCRCCount++ < 5) 413 if (stats->InvalidCRCCount++ < 5)
413 FC_DBG("CRC error on data frame\n"); 414 printk(KERN_WARNING "CRC error on data frame for port (%6x)\n",
415 fc_host_port_id(lp->host));
414 /* 416 /*
415 * Assume the frame is total garbage. 417 * Assume the frame is total garbage.
416 * We may have copied it over the good part 418 * We may have copied it over the good part
@@ -1752,7 +1754,7 @@ int fc_queuecommand(struct scsi_cmnd *sc_cmd, void (*done)(struct scsi_cmnd *))
1752 /* 1754 /*
1753 * setup the data direction 1755 * setup the data direction
1754 */ 1756 */
1755 stats = lp->dev_stats[smp_processor_id()]; 1757 stats = fc_lport_get_stats(lp);
1756 if (sc_cmd->sc_data_direction == DMA_FROM_DEVICE) { 1758 if (sc_cmd->sc_data_direction == DMA_FROM_DEVICE) {
1757 fsp->req_flags = FC_SRB_READ; 1759 fsp->req_flags = FC_SRB_READ;
1758 stats->InputRequests++; 1760 stats->InputRequests++;
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 7ef44501ecc6..b8178ef398d7 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -267,10 +267,10 @@ EXPORT_SYMBOL(fc_get_host_speed);
267 267
268struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *shost) 268struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *shost)
269{ 269{
270 int i;
271 struct fc_host_statistics *fcoe_stats; 270 struct fc_host_statistics *fcoe_stats;
272 struct fc_lport *lp = shost_priv(shost); 271 struct fc_lport *lp = shost_priv(shost);
273 struct timespec v0, v1; 272 struct timespec v0, v1;
273 unsigned int cpu;
274 274
275 fcoe_stats = &lp->host_stats; 275 fcoe_stats = &lp->host_stats;
276 memset(fcoe_stats, 0, sizeof(struct fc_host_statistics)); 276 memset(fcoe_stats, 0, sizeof(struct fc_host_statistics));
@@ -279,10 +279,11 @@ struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *shost)
279 jiffies_to_timespec(lp->boot_time, &v1); 279 jiffies_to_timespec(lp->boot_time, &v1);
280 fcoe_stats->seconds_since_last_reset = (v0.tv_sec - v1.tv_sec); 280 fcoe_stats->seconds_since_last_reset = (v0.tv_sec - v1.tv_sec);
281 281
282 for_each_online_cpu(i) { 282 for_each_possible_cpu(cpu) {
283 struct fcoe_dev_stats *stats = lp->dev_stats[i]; 283 struct fcoe_dev_stats *stats;
284 if (stats == NULL) 284
285 continue; 285 stats = per_cpu_ptr(lp->dev_stats, cpu);
286
286 fcoe_stats->tx_frames += stats->TxFrames; 287 fcoe_stats->tx_frames += stats->TxFrames;
287 fcoe_stats->tx_words += stats->TxWords; 288 fcoe_stats->tx_words += stats->TxWords;
288 fcoe_stats->rx_frames += stats->RxFrames; 289 fcoe_stats->rx_frames += stats->RxFrames;