| .. | .. |
|---|
| 52 | 52 | */ |
|---|
| 53 | 53 | int fnic_debugfs_init(void) |
|---|
| 54 | 54 | { |
|---|
| 55 | | - int rc = -1; |
|---|
| 56 | 55 | fnic_trace_debugfs_root = debugfs_create_dir("fnic", NULL); |
|---|
| 57 | | - if (!fnic_trace_debugfs_root) { |
|---|
| 58 | | - printk(KERN_DEBUG "Cannot create debugfs root\n"); |
|---|
| 59 | | - return rc; |
|---|
| 60 | | - } |
|---|
| 61 | | - |
|---|
| 62 | | - if (!fnic_trace_debugfs_root) { |
|---|
| 63 | | - printk(KERN_DEBUG |
|---|
| 64 | | - "fnic root directory doesn't exist in debugfs\n"); |
|---|
| 65 | | - return rc; |
|---|
| 66 | | - } |
|---|
| 67 | 56 | |
|---|
| 68 | 57 | fnic_stats_debugfs_root = debugfs_create_dir("statistics", |
|---|
| 69 | 58 | fnic_trace_debugfs_root); |
|---|
| 70 | | - if (!fnic_stats_debugfs_root) { |
|---|
| 71 | | - printk(KERN_DEBUG "Cannot create Statistics directory\n"); |
|---|
| 72 | | - return rc; |
|---|
| 73 | | - } |
|---|
| 74 | 59 | |
|---|
| 75 | 60 | /* Allocate memory to structure */ |
|---|
| 76 | 61 | fc_trc_flag = (struct fc_trace_flag_type *) |
|---|
| .. | .. |
|---|
| 84 | 69 | fc_trc_flag->fc_clear = 4; |
|---|
| 85 | 70 | } |
|---|
| 86 | 71 | |
|---|
| 87 | | - rc = 0; |
|---|
| 88 | | - return rc; |
|---|
| 72 | + return 0; |
|---|
| 89 | 73 | } |
|---|
| 90 | 74 | |
|---|
| 91 | 75 | /* |
|---|
| .. | .. |
|---|
| 136 | 120 | len = 0; |
|---|
| 137 | 121 | trace_type = (u8 *)filp->private_data; |
|---|
| 138 | 122 | if (*trace_type == fc_trc_flag->fnic_trace) |
|---|
| 139 | | - len = sprintf(buf, "%u\n", fnic_tracing_enabled); |
|---|
| 123 | + len = sprintf(buf, "%d\n", fnic_tracing_enabled); |
|---|
| 140 | 124 | else if (*trace_type == fc_trc_flag->fc_trace) |
|---|
| 141 | | - len = sprintf(buf, "%u\n", fnic_fc_tracing_enabled); |
|---|
| 125 | + len = sprintf(buf, "%d\n", fnic_fc_tracing_enabled); |
|---|
| 142 | 126 | else if (*trace_type == fc_trc_flag->fc_clear) |
|---|
| 143 | | - len = sprintf(buf, "%u\n", fnic_fc_trace_cleared); |
|---|
| 127 | + len = sprintf(buf, "%d\n", fnic_fc_trace_cleared); |
|---|
| 144 | 128 | else |
|---|
| 145 | 129 | pr_err("fnic: Cannot read to any debugfs file\n"); |
|---|
| 146 | 130 | |
|---|
| .. | .. |
|---|
| 356 | 340 | * it will also create file trace_enable to control enable/disable of |
|---|
| 357 | 341 | * trace logging into trace buffer. |
|---|
| 358 | 342 | */ |
|---|
| 359 | | -int fnic_trace_debugfs_init(void) |
|---|
| 343 | +void fnic_trace_debugfs_init(void) |
|---|
| 360 | 344 | { |
|---|
| 361 | | - int rc = -1; |
|---|
| 362 | | - if (!fnic_trace_debugfs_root) { |
|---|
| 363 | | - printk(KERN_DEBUG |
|---|
| 364 | | - "FNIC Debugfs root directory doesn't exist\n"); |
|---|
| 365 | | - return rc; |
|---|
| 366 | | - } |
|---|
| 367 | 345 | fnic_trace_enable = debugfs_create_file("tracing_enable", |
|---|
| 368 | 346 | S_IFREG|S_IRUGO|S_IWUSR, |
|---|
| 369 | 347 | fnic_trace_debugfs_root, |
|---|
| 370 | 348 | &(fc_trc_flag->fnic_trace), |
|---|
| 371 | 349 | &fnic_trace_ctrl_fops); |
|---|
| 372 | 350 | |
|---|
| 373 | | - if (!fnic_trace_enable) { |
|---|
| 374 | | - printk(KERN_DEBUG |
|---|
| 375 | | - "Cannot create trace_enable file under debugfs\n"); |
|---|
| 376 | | - return rc; |
|---|
| 377 | | - } |
|---|
| 378 | | - |
|---|
| 379 | 351 | fnic_trace_debugfs_file = debugfs_create_file("trace", |
|---|
| 380 | 352 | S_IFREG|S_IRUGO|S_IWUSR, |
|---|
| 381 | 353 | fnic_trace_debugfs_root, |
|---|
| 382 | 354 | &(fc_trc_flag->fnic_trace), |
|---|
| 383 | 355 | &fnic_trace_debugfs_fops); |
|---|
| 384 | | - |
|---|
| 385 | | - if (!fnic_trace_debugfs_file) { |
|---|
| 386 | | - printk(KERN_DEBUG |
|---|
| 387 | | - "Cannot create trace file under debugfs\n"); |
|---|
| 388 | | - return rc; |
|---|
| 389 | | - } |
|---|
| 390 | | - rc = 0; |
|---|
| 391 | | - return rc; |
|---|
| 392 | 356 | } |
|---|
| 393 | 357 | |
|---|
| 394 | 358 | /* |
|---|
| .. | .. |
|---|
| 419 | 383 | * trace logging into trace buffer. |
|---|
| 420 | 384 | */ |
|---|
| 421 | 385 | |
|---|
| 422 | | -int fnic_fc_trace_debugfs_init(void) |
|---|
| 386 | +void fnic_fc_trace_debugfs_init(void) |
|---|
| 423 | 387 | { |
|---|
| 424 | | - int rc = -1; |
|---|
| 425 | | - |
|---|
| 426 | | - if (!fnic_trace_debugfs_root) { |
|---|
| 427 | | - pr_err("fnic:Debugfs root directory doesn't exist\n"); |
|---|
| 428 | | - return rc; |
|---|
| 429 | | - } |
|---|
| 430 | | - |
|---|
| 431 | 388 | fnic_fc_trace_enable = debugfs_create_file("fc_trace_enable", |
|---|
| 432 | 389 | S_IFREG|S_IRUGO|S_IWUSR, |
|---|
| 433 | 390 | fnic_trace_debugfs_root, |
|---|
| 434 | 391 | &(fc_trc_flag->fc_trace), |
|---|
| 435 | 392 | &fnic_trace_ctrl_fops); |
|---|
| 436 | 393 | |
|---|
| 437 | | - if (!fnic_fc_trace_enable) { |
|---|
| 438 | | - pr_err("fnic: Failed create fc_trace_enable file\n"); |
|---|
| 439 | | - return rc; |
|---|
| 440 | | - } |
|---|
| 441 | | - |
|---|
| 442 | 394 | fnic_fc_trace_clear = debugfs_create_file("fc_trace_clear", |
|---|
| 443 | 395 | S_IFREG|S_IRUGO|S_IWUSR, |
|---|
| 444 | 396 | fnic_trace_debugfs_root, |
|---|
| 445 | 397 | &(fc_trc_flag->fc_clear), |
|---|
| 446 | 398 | &fnic_trace_ctrl_fops); |
|---|
| 447 | | - |
|---|
| 448 | | - if (!fnic_fc_trace_clear) { |
|---|
| 449 | | - pr_err("fnic: Failed to create fc_trace_enable file\n"); |
|---|
| 450 | | - return rc; |
|---|
| 451 | | - } |
|---|
| 452 | 399 | |
|---|
| 453 | 400 | fnic_fc_rdata_trace_debugfs_file = |
|---|
| 454 | 401 | debugfs_create_file("fc_trace_rdata", |
|---|
| .. | .. |
|---|
| 457 | 404 | &(fc_trc_flag->fc_normal_file), |
|---|
| 458 | 405 | &fnic_trace_debugfs_fops); |
|---|
| 459 | 406 | |
|---|
| 460 | | - if (!fnic_fc_rdata_trace_debugfs_file) { |
|---|
| 461 | | - pr_err("fnic: Failed create fc_rdata_trace file\n"); |
|---|
| 462 | | - return rc; |
|---|
| 463 | | - } |
|---|
| 464 | | - |
|---|
| 465 | 407 | fnic_fc_trace_debugfs_file = |
|---|
| 466 | 408 | debugfs_create_file("fc_trace", |
|---|
| 467 | 409 | S_IFREG|S_IRUGO|S_IWUSR, |
|---|
| 468 | 410 | fnic_trace_debugfs_root, |
|---|
| 469 | 411 | &(fc_trc_flag->fc_row_file), |
|---|
| 470 | 412 | &fnic_trace_debugfs_fops); |
|---|
| 471 | | - |
|---|
| 472 | | - if (!fnic_fc_trace_debugfs_file) { |
|---|
| 473 | | - pr_err("fnic: Failed to create fc_trace file\n"); |
|---|
| 474 | | - return rc; |
|---|
| 475 | | - } |
|---|
| 476 | | - rc = 0; |
|---|
| 477 | | - return rc; |
|---|
| 478 | 413 | } |
|---|
| 479 | 414 | |
|---|
| 480 | 415 | /* |
|---|
| .. | .. |
|---|
| 757 | 692 | * It will create file stats and reset_stats under statistics/host# directory |
|---|
| 758 | 693 | * to log per fnic stats. |
|---|
| 759 | 694 | */ |
|---|
| 760 | | -int fnic_stats_debugfs_init(struct fnic *fnic) |
|---|
| 695 | +void fnic_stats_debugfs_init(struct fnic *fnic) |
|---|
| 761 | 696 | { |
|---|
| 762 | | - int rc = -1; |
|---|
| 763 | 697 | char name[16]; |
|---|
| 764 | 698 | |
|---|
| 765 | 699 | snprintf(name, sizeof(name), "host%d", fnic->lport->host->host_no); |
|---|
| 766 | 700 | |
|---|
| 767 | | - if (!fnic_stats_debugfs_root) { |
|---|
| 768 | | - printk(KERN_DEBUG "fnic_stats root doesn't exist\n"); |
|---|
| 769 | | - return rc; |
|---|
| 770 | | - } |
|---|
| 771 | 701 | fnic->fnic_stats_debugfs_host = debugfs_create_dir(name, |
|---|
| 772 | 702 | fnic_stats_debugfs_root); |
|---|
| 773 | | - if (!fnic->fnic_stats_debugfs_host) { |
|---|
| 774 | | - printk(KERN_DEBUG "Cannot create host directory\n"); |
|---|
| 775 | | - return rc; |
|---|
| 776 | | - } |
|---|
| 777 | 703 | |
|---|
| 778 | 704 | fnic->fnic_stats_debugfs_file = debugfs_create_file("stats", |
|---|
| 779 | 705 | S_IFREG|S_IRUGO|S_IWUSR, |
|---|
| 780 | 706 | fnic->fnic_stats_debugfs_host, |
|---|
| 781 | 707 | fnic, |
|---|
| 782 | 708 | &fnic_stats_debugfs_fops); |
|---|
| 783 | | - if (!fnic->fnic_stats_debugfs_file) { |
|---|
| 784 | | - printk(KERN_DEBUG "Cannot create host stats file\n"); |
|---|
| 785 | | - return rc; |
|---|
| 786 | | - } |
|---|
| 787 | 709 | |
|---|
| 788 | 710 | fnic->fnic_reset_debugfs_file = debugfs_create_file("reset_stats", |
|---|
| 789 | 711 | S_IFREG|S_IRUGO|S_IWUSR, |
|---|
| 790 | 712 | fnic->fnic_stats_debugfs_host, |
|---|
| 791 | 713 | fnic, |
|---|
| 792 | 714 | &fnic_reset_debugfs_fops); |
|---|
| 793 | | - if (!fnic->fnic_reset_debugfs_file) { |
|---|
| 794 | | - printk(KERN_DEBUG "Cannot create host stats file\n"); |
|---|
| 795 | | - return rc; |
|---|
| 796 | | - } |
|---|
| 797 | | - rc = 0; |
|---|
| 798 | | - return rc; |
|---|
| 799 | 715 | } |
|---|
| 800 | 716 | |
|---|
| 801 | 717 | /* |
|---|