diff options
| -rw-r--r-- | drivers/infiniband/hw/qib/qib.h | 9 | ||||
| -rw-r--r-- | drivers/infiniband/hw/qib/qib_eeprom.c | 181 | ||||
| -rw-r--r-- | drivers/infiniband/hw/qib/qib_iba6120.c | 2 | ||||
| -rw-r--r-- | drivers/infiniband/hw/qib/qib_iba7220.c | 2 | ||||
| -rw-r--r-- | drivers/infiniband/hw/qib/qib_iba7322.c | 2 | ||||
| -rw-r--r-- | drivers/infiniband/hw/qib/qib_init.c | 1 | ||||
| -rw-r--r-- | drivers/infiniband/hw/qib/qib_sysfs.c | 24 |
7 files changed, 1 insertions, 220 deletions
diff --git a/drivers/infiniband/hw/qib/qib.h b/drivers/infiniband/hw/qib/qib.h index c00ae093b6f8..b218254ee41b 100644 --- a/drivers/infiniband/hw/qib/qib.h +++ b/drivers/infiniband/hw/qib/qib.h | |||
| @@ -1082,12 +1082,6 @@ struct qib_devdata { | |||
| 1082 | /* control high-level access to EEPROM */ | 1082 | /* control high-level access to EEPROM */ |
| 1083 | struct mutex eep_lock; | 1083 | struct mutex eep_lock; |
| 1084 | uint64_t traffic_wds; | 1084 | uint64_t traffic_wds; |
| 1085 | /* active time is kept in seconds, but logged in hours */ | ||
| 1086 | atomic_t active_time; | ||
| 1087 | /* Below are nominal shadow of EEPROM, new since last EEPROM update */ | ||
| 1088 | uint8_t eep_st_errs[QIB_EEP_LOG_CNT]; | ||
| 1089 | uint8_t eep_st_new_errs[QIB_EEP_LOG_CNT]; | ||
| 1090 | uint16_t eep_hrs; | ||
| 1091 | /* | 1085 | /* |
| 1092 | * masks for which bits of errs, hwerrs that cause | 1086 | * masks for which bits of errs, hwerrs that cause |
| 1093 | * each of the counters to increment. | 1087 | * each of the counters to increment. |
| @@ -1309,8 +1303,7 @@ int qib_twsi_blk_rd(struct qib_devdata *dd, int dev, int addr, void *buffer, | |||
| 1309 | int qib_twsi_blk_wr(struct qib_devdata *dd, int dev, int addr, | 1303 | int qib_twsi_blk_wr(struct qib_devdata *dd, int dev, int addr, |
| 1310 | const void *buffer, int len); | 1304 | const void *buffer, int len); |
| 1311 | void qib_get_eeprom_info(struct qib_devdata *); | 1305 | void qib_get_eeprom_info(struct qib_devdata *); |
| 1312 | int qib_update_eeprom_log(struct qib_devdata *dd); | 1306 | #define qib_inc_eeprom_err(dd, eidx, incr) |
| 1313 | void qib_inc_eeprom_err(struct qib_devdata *dd, u32 eidx, u32 incr); | ||
| 1314 | void qib_dump_lookup_output_queue(struct qib_devdata *); | 1307 | void qib_dump_lookup_output_queue(struct qib_devdata *); |
| 1315 | void qib_force_pio_avail_update(struct qib_devdata *); | 1308 | void qib_force_pio_avail_update(struct qib_devdata *); |
| 1316 | void qib_clear_symerror_on_linkup(unsigned long opaque); | 1309 | void qib_clear_symerror_on_linkup(unsigned long opaque); |
diff --git a/drivers/infiniband/hw/qib/qib_eeprom.c b/drivers/infiniband/hw/qib/qib_eeprom.c index 4d5d71aaa2b4..e2280b07df02 100644 --- a/drivers/infiniband/hw/qib/qib_eeprom.c +++ b/drivers/infiniband/hw/qib/qib_eeprom.c | |||
| @@ -267,190 +267,9 @@ void qib_get_eeprom_info(struct qib_devdata *dd) | |||
| 267 | "Board SN %s did not pass functional test: %s\n", | 267 | "Board SN %s did not pass functional test: %s\n", |
| 268 | dd->serial, ifp->if_comment); | 268 | dd->serial, ifp->if_comment); |
| 269 | 269 | ||
| 270 | memcpy(&dd->eep_st_errs, &ifp->if_errcntp, QIB_EEP_LOG_CNT); | ||
| 271 | /* | ||
| 272 | * Power-on (actually "active") hours are kept as little-endian value | ||
| 273 | * in EEPROM, but as seconds in a (possibly as small as 24-bit) | ||
| 274 | * atomic_t while running. | ||
| 275 | */ | ||
| 276 | atomic_set(&dd->active_time, 0); | ||
| 277 | dd->eep_hrs = ifp->if_powerhour[0] | (ifp->if_powerhour[1] << 8); | ||
| 278 | |||
| 279 | done: | 270 | done: |
| 280 | vfree(buf); | 271 | vfree(buf); |
| 281 | 272 | ||
| 282 | bail:; | 273 | bail:; |
| 283 | } | 274 | } |
| 284 | 275 | ||
| 285 | /** | ||
| 286 | * qib_update_eeprom_log - copy active-time and error counters to eeprom | ||
| 287 | * @dd: the qlogic_ib device | ||
| 288 | * | ||
| 289 | * Although the time is kept as seconds in the qib_devdata struct, it is | ||
| 290 | * rounded to hours for re-write, as we have only 16 bits in EEPROM. | ||
| 291 | * First-cut code reads whole (expected) struct qib_flash, modifies, | ||
| 292 | * re-writes. Future direction: read/write only what we need, assuming | ||
| 293 | * that the EEPROM had to have been "good enough" for driver init, and | ||
| 294 | * if not, we aren't making it worse. | ||
| 295 | * | ||
| 296 | */ | ||
| 297 | int qib_update_eeprom_log(struct qib_devdata *dd) | ||
| 298 | { | ||
| 299 | void *buf; | ||
| 300 | struct qib_flash *ifp; | ||
| 301 | int len, hi_water; | ||
| 302 | uint32_t new_time, new_hrs; | ||
| 303 | u8 csum; | ||
| 304 | int ret, idx; | ||
| 305 | unsigned long flags; | ||
| 306 | |||
| 307 | /* first, check if we actually need to do anything. */ | ||
| 308 | ret = 0; | ||
| 309 | for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) { | ||
| 310 | if (dd->eep_st_new_errs[idx]) { | ||
| 311 | ret = 1; | ||
| 312 | break; | ||
| 313 | } | ||
| 314 | } | ||
| 315 | new_time = atomic_read(&dd->active_time); | ||
| 316 | |||
| 317 | if (ret == 0 && new_time < 3600) | ||
| 318 | goto bail; | ||
| 319 | |||
| 320 | /* | ||
| 321 | * The quick-check above determined that there is something worthy | ||
| 322 | * of logging, so get current contents and do a more detailed idea. | ||
| 323 | * read full flash, not just currently used part, since it may have | ||
| 324 | * been written with a newer definition | ||
| 325 | */ | ||
| 326 | len = sizeof(struct qib_flash); | ||
| 327 | buf = vmalloc(len); | ||
| 328 | ret = 1; | ||
| 329 | if (!buf) { | ||
| 330 | qib_dev_err(dd, | ||
| 331 | "Couldn't allocate memory to read %u bytes from eeprom for logging\n", | ||
| 332 | len); | ||
| 333 | goto bail; | ||
| 334 | } | ||
| 335 | |||
| 336 | /* Grab semaphore and read current EEPROM. If we get an | ||
| 337 | * error, let go, but if not, keep it until we finish write. | ||
| 338 | */ | ||
| 339 | ret = mutex_lock_interruptible(&dd->eep_lock); | ||
| 340 | if (ret) { | ||
| 341 | qib_dev_err(dd, "Unable to acquire EEPROM for logging\n"); | ||
| 342 | goto free_bail; | ||
| 343 | } | ||
| 344 | ret = qib_twsi_blk_rd(dd, dd->twsi_eeprom_dev, 0, buf, len); | ||
| 345 | if (ret) { | ||
| 346 | mutex_unlock(&dd->eep_lock); | ||
| 347 | qib_dev_err(dd, "Unable read EEPROM for logging\n"); | ||
| 348 | goto free_bail; | ||
| 349 | } | ||
| 350 | ifp = (struct qib_flash *)buf; | ||
| 351 | |||
| 352 | csum = flash_csum(ifp, 0); | ||
| 353 | if (csum != ifp->if_csum) { | ||
| 354 | mutex_unlock(&dd->eep_lock); | ||
| 355 | qib_dev_err(dd, "EEPROM cks err (0x%02X, S/B 0x%02X)\n", | ||
| 356 | csum, ifp->if_csum); | ||
| 357 | ret = 1; | ||
| 358 | goto free_bail; | ||
| 359 | } | ||
| 360 | hi_water = 0; | ||
| 361 | spin_lock_irqsave(&dd->eep_st_lock, flags); | ||
| 362 | for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) { | ||
| 363 | int new_val = dd->eep_st_new_errs[idx]; | ||
| 364 | if (new_val) { | ||
| 365 | /* | ||
| 366 | * If we have seen any errors, add to EEPROM values | ||
| 367 | * We need to saturate at 0xFF (255) and we also | ||
| 368 | * would need to adjust the checksum if we were | ||
| 369 | * trying to minimize EEPROM traffic | ||
| 370 | * Note that we add to actual current count in EEPROM, | ||
| 371 | * in case it was altered while we were running. | ||
| 372 | */ | ||
| 373 | new_val += ifp->if_errcntp[idx]; | ||
| 374 | if (new_val > 0xFF) | ||
| 375 | new_val = 0xFF; | ||
| 376 | if (ifp->if_errcntp[idx] != new_val) { | ||
| 377 | ifp->if_errcntp[idx] = new_val; | ||
| 378 | hi_water = offsetof(struct qib_flash, | ||
| 379 | if_errcntp) + idx; | ||
| 380 | } | ||
| 381 | /* | ||
| 382 | * update our shadow (used to minimize EEPROM | ||
| 383 | * traffic), to match what we are about to write. | ||
| 384 | */ | ||
| 385 | dd->eep_st_errs[idx] = new_val; | ||
| 386 | dd->eep_st_new_errs[idx] = 0; | ||
| 387 | } | ||
| 388 | } | ||
| 389 | /* | ||
| 390 | * Now update active-time. We would like to round to the nearest hour | ||
| 391 | * but unless atomic_t are sure to be proper signed ints we cannot, | ||
| 392 | * because we need to account for what we "transfer" to EEPROM and | ||
| 393 | * if we log an hour at 31 minutes, then we would need to set | ||
| 394 | * active_time to -29 to accurately count the _next_ hour. | ||
| 395 | */ | ||
| 396 | if (new_time >= 3600) { | ||
| 397 | new_hrs = new_time / 3600; | ||
| 398 | atomic_sub((new_hrs * 3600), &dd->active_time); | ||
| 399 | new_hrs += dd->eep_hrs; | ||
| 400 | if (new_hrs > 0xFFFF) | ||
| 401 | new_hrs = 0xFFFF; | ||
| 402 | dd->eep_hrs = new_hrs; | ||
| 403 | if ((new_hrs & 0xFF) != ifp->if_powerhour[0]) { | ||
| 404 | ifp->if_powerhour[0] = new_hrs & 0xFF; | ||
| 405 | hi_water = offsetof(struct qib_flash, if_powerhour); | ||
| 406 | } | ||
| 407 | if ((new_hrs >> 8) != ifp->if_powerhour[1]) { | ||
| 408 | ifp->if_powerhour[1] = new_hrs >> 8; | ||
| 409 | hi_water = offsetof(struct qib_flash, if_powerhour) + 1; | ||
| 410 | } | ||
| 411 | } | ||
| 412 | /* | ||
| 413 | * There is a tiny possibility that we could somehow fail to write | ||
| 414 | * the EEPROM after updating our shadows, but problems from holding | ||
| 415 | * the spinlock too long are a much bigger issue. | ||
| 416 | */ | ||
| 417 | spin_unlock_irqrestore(&dd->eep_st_lock, flags); | ||
| 418 | if (hi_water) { | ||
| 419 | /* we made some change to the data, uopdate cksum and write */ | ||
| 420 | csum = flash_csum(ifp, 1); | ||
| 421 | ret = eeprom_write_with_enable(dd, 0, buf, hi_water + 1); | ||
| 422 | } | ||
| 423 | mutex_unlock(&dd->eep_lock); | ||
| 424 | if (ret) | ||
| 425 | qib_dev_err(dd, "Failed updating EEPROM\n"); | ||
| 426 | |||
| 427 | free_bail: | ||
| 428 | vfree(buf); | ||
| 429 | bail: | ||
| 430 | return ret; | ||
| 431 | } | ||
| 432 | |||
| 433 | /** | ||
| 434 | * qib_inc_eeprom_err - increment one of the four error counters | ||
| 435 | * that are logged to EEPROM. | ||
| 436 | * @dd: the qlogic_ib device | ||
| 437 | * @eidx: 0..3, the counter to increment | ||
| 438 | * @incr: how much to add | ||
| 439 | * | ||
| 440 | * Each counter is 8-bits, and saturates at 255 (0xFF). They | ||
| 441 | * are copied to the EEPROM (aka flash) whenever qib_update_eeprom_log() | ||
| 442 | * is called, but it can only be called in a context that allows sleep. | ||
| 443 | * This function can be called even at interrupt level. | ||
| 444 | */ | ||
| 445 | void qib_inc_eeprom_err(struct qib_devdata *dd, u32 eidx, u32 incr) | ||
| 446 | { | ||
| 447 | uint new_val; | ||
| 448 | unsigned long flags; | ||
| 449 | |||
| 450 | spin_lock_irqsave(&dd->eep_st_lock, flags); | ||
| 451 | new_val = dd->eep_st_new_errs[eidx] + incr; | ||
| 452 | if (new_val > 255) | ||
| 453 | new_val = 255; | ||
| 454 | dd->eep_st_new_errs[eidx] = new_val; | ||
| 455 | spin_unlock_irqrestore(&dd->eep_st_lock, flags); | ||
| 456 | } | ||
diff --git a/drivers/infiniband/hw/qib/qib_iba6120.c b/drivers/infiniband/hw/qib/qib_iba6120.c index d68266ac7619..f7f49a6c34b0 100644 --- a/drivers/infiniband/hw/qib/qib_iba6120.c +++ b/drivers/infiniband/hw/qib/qib_iba6120.c | |||
| @@ -2681,8 +2681,6 @@ static void qib_get_6120_faststats(unsigned long opaque) | |||
| 2681 | spin_lock_irqsave(&dd->eep_st_lock, flags); | 2681 | spin_lock_irqsave(&dd->eep_st_lock, flags); |
| 2682 | traffic_wds -= dd->traffic_wds; | 2682 | traffic_wds -= dd->traffic_wds; |
| 2683 | dd->traffic_wds += traffic_wds; | 2683 | dd->traffic_wds += traffic_wds; |
| 2684 | if (traffic_wds >= QIB_TRAFFIC_ACTIVE_THRESHOLD) | ||
| 2685 | atomic_add(5, &dd->active_time); /* S/B #define */ | ||
| 2686 | spin_unlock_irqrestore(&dd->eep_st_lock, flags); | 2684 | spin_unlock_irqrestore(&dd->eep_st_lock, flags); |
| 2687 | 2685 | ||
| 2688 | qib_chk_6120_errormask(dd); | 2686 | qib_chk_6120_errormask(dd); |
diff --git a/drivers/infiniband/hw/qib/qib_iba7220.c b/drivers/infiniband/hw/qib/qib_iba7220.c index 7dec89fdc124..f5fa106e1992 100644 --- a/drivers/infiniband/hw/qib/qib_iba7220.c +++ b/drivers/infiniband/hw/qib/qib_iba7220.c | |||
| @@ -3297,8 +3297,6 @@ static void qib_get_7220_faststats(unsigned long opaque) | |||
| 3297 | spin_lock_irqsave(&dd->eep_st_lock, flags); | 3297 | spin_lock_irqsave(&dd->eep_st_lock, flags); |
| 3298 | traffic_wds -= dd->traffic_wds; | 3298 | traffic_wds -= dd->traffic_wds; |
| 3299 | dd->traffic_wds += traffic_wds; | 3299 | dd->traffic_wds += traffic_wds; |
| 3300 | if (traffic_wds >= QIB_TRAFFIC_ACTIVE_THRESHOLD) | ||
| 3301 | atomic_add(5, &dd->active_time); /* S/B #define */ | ||
| 3302 | spin_unlock_irqrestore(&dd->eep_st_lock, flags); | 3300 | spin_unlock_irqrestore(&dd->eep_st_lock, flags); |
| 3303 | done: | 3301 | done: |
| 3304 | mod_timer(&dd->stats_timer, jiffies + HZ * ACTIVITY_TIMER); | 3302 | mod_timer(&dd->stats_timer, jiffies + HZ * ACTIVITY_TIMER); |
diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c index a7eb32517a04..23ca2aca1ad6 100644 --- a/drivers/infiniband/hw/qib/qib_iba7322.c +++ b/drivers/infiniband/hw/qib/qib_iba7322.c | |||
| @@ -5178,8 +5178,6 @@ static void qib_get_7322_faststats(unsigned long opaque) | |||
| 5178 | spin_lock_irqsave(&ppd->dd->eep_st_lock, flags); | 5178 | spin_lock_irqsave(&ppd->dd->eep_st_lock, flags); |
| 5179 | traffic_wds -= ppd->dd->traffic_wds; | 5179 | traffic_wds -= ppd->dd->traffic_wds; |
| 5180 | ppd->dd->traffic_wds += traffic_wds; | 5180 | ppd->dd->traffic_wds += traffic_wds; |
| 5181 | if (traffic_wds >= QIB_TRAFFIC_ACTIVE_THRESHOLD) | ||
| 5182 | atomic_add(ACTIVITY_TIMER, &ppd->dd->active_time); | ||
| 5183 | spin_unlock_irqrestore(&ppd->dd->eep_st_lock, flags); | 5181 | spin_unlock_irqrestore(&ppd->dd->eep_st_lock, flags); |
| 5184 | if (ppd->cpspec->qdr_dfe_on && (ppd->link_speed_active & | 5182 | if (ppd->cpspec->qdr_dfe_on && (ppd->link_speed_active & |
| 5185 | QIB_IB_QDR) && | 5183 | QIB_IB_QDR) && |
diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c index 729da39c49ed..738269b46d83 100644 --- a/drivers/infiniband/hw/qib/qib_init.c +++ b/drivers/infiniband/hw/qib/qib_init.c | |||
| @@ -931,7 +931,6 @@ static void qib_shutdown_device(struct qib_devdata *dd) | |||
| 931 | qib_free_pportdata(ppd); | 931 | qib_free_pportdata(ppd); |
| 932 | } | 932 | } |
| 933 | 933 | ||
| 934 | qib_update_eeprom_log(dd); | ||
| 935 | } | 934 | } |
| 936 | 935 | ||
| 937 | /** | 936 | /** |
diff --git a/drivers/infiniband/hw/qib/qib_sysfs.c b/drivers/infiniband/hw/qib/qib_sysfs.c index 3c8e4e3caca6..b9ccbda7817d 100644 --- a/drivers/infiniband/hw/qib/qib_sysfs.c +++ b/drivers/infiniband/hw/qib/qib_sysfs.c | |||
| @@ -611,28 +611,6 @@ bail: | |||
| 611 | return ret < 0 ? ret : count; | 611 | return ret < 0 ? ret : count; |
| 612 | } | 612 | } |
| 613 | 613 | ||
| 614 | static ssize_t show_logged_errs(struct device *device, | ||
| 615 | struct device_attribute *attr, char *buf) | ||
| 616 | { | ||
| 617 | struct qib_ibdev *dev = | ||
| 618 | container_of(device, struct qib_ibdev, ibdev.dev); | ||
| 619 | struct qib_devdata *dd = dd_from_dev(dev); | ||
| 620 | int idx, count; | ||
| 621 | |||
| 622 | /* force consistency with actual EEPROM */ | ||
| 623 | if (qib_update_eeprom_log(dd) != 0) | ||
| 624 | return -ENXIO; | ||
| 625 | |||
| 626 | count = 0; | ||
| 627 | for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) { | ||
| 628 | count += scnprintf(buf + count, PAGE_SIZE - count, "%d%c", | ||
| 629 | dd->eep_st_errs[idx], | ||
| 630 | idx == (QIB_EEP_LOG_CNT - 1) ? '\n' : ' '); | ||
| 631 | } | ||
| 632 | |||
| 633 | return count; | ||
| 634 | } | ||
| 635 | |||
| 636 | /* | 614 | /* |
| 637 | * Dump tempsense regs. in decimal, to ease shell-scripts. | 615 | * Dump tempsense regs. in decimal, to ease shell-scripts. |
| 638 | */ | 616 | */ |
| @@ -679,7 +657,6 @@ static DEVICE_ATTR(nctxts, S_IRUGO, show_nctxts, NULL); | |||
| 679 | static DEVICE_ATTR(nfreectxts, S_IRUGO, show_nfreectxts, NULL); | 657 | static DEVICE_ATTR(nfreectxts, S_IRUGO, show_nfreectxts, NULL); |
| 680 | static DEVICE_ATTR(serial, S_IRUGO, show_serial, NULL); | 658 | static DEVICE_ATTR(serial, S_IRUGO, show_serial, NULL); |
| 681 | static DEVICE_ATTR(boardversion, S_IRUGO, show_boardversion, NULL); | 659 | static DEVICE_ATTR(boardversion, S_IRUGO, show_boardversion, NULL); |
| 682 | static DEVICE_ATTR(logged_errors, S_IRUGO, show_logged_errs, NULL); | ||
| 683 | static DEVICE_ATTR(tempsense, S_IRUGO, show_tempsense, NULL); | 660 | static DEVICE_ATTR(tempsense, S_IRUGO, show_tempsense, NULL); |
| 684 | static DEVICE_ATTR(localbus_info, S_IRUGO, show_localbus_info, NULL); | 661 | static DEVICE_ATTR(localbus_info, S_IRUGO, show_localbus_info, NULL); |
| 685 | static DEVICE_ATTR(chip_reset, S_IWUSR, NULL, store_chip_reset); | 662 | static DEVICE_ATTR(chip_reset, S_IWUSR, NULL, store_chip_reset); |
| @@ -693,7 +670,6 @@ static struct device_attribute *qib_attributes[] = { | |||
| 693 | &dev_attr_nfreectxts, | 670 | &dev_attr_nfreectxts, |
| 694 | &dev_attr_serial, | 671 | &dev_attr_serial, |
| 695 | &dev_attr_boardversion, | 672 | &dev_attr_boardversion, |
| 696 | &dev_attr_logged_errors, | ||
| 697 | &dev_attr_tempsense, | 673 | &dev_attr_tempsense, |
| 698 | &dev_attr_localbus_info, | 674 | &dev_attr_localbus_info, |
| 699 | &dev_attr_chip_reset, | 675 | &dev_attr_chip_reset, |
