diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/bfa/bfad_bsg.c | 51 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad_bsg.h | 15 |
2 files changed, 66 insertions, 0 deletions
diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c index 2109ed3769aa..66349bde8dca 100644 --- a/drivers/scsi/bfa/bfad_bsg.c +++ b/drivers/scsi/bfa/bfad_bsg.c | |||
@@ -2349,6 +2349,51 @@ out: | |||
2349 | return 0; | 2349 | return 0; |
2350 | } | 2350 | } |
2351 | 2351 | ||
2352 | int | ||
2353 | bfad_iocmd_vf_get_stats(struct bfad_s *bfad, void *cmd) | ||
2354 | { | ||
2355 | struct bfa_bsg_vf_stats_s *iocmd = | ||
2356 | (struct bfa_bsg_vf_stats_s *)cmd; | ||
2357 | struct bfa_fcs_fabric_s *fcs_vf; | ||
2358 | unsigned long flags; | ||
2359 | |||
2360 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
2361 | fcs_vf = bfa_fcs_vf_lookup(&bfad->bfa_fcs, iocmd->vf_id); | ||
2362 | if (fcs_vf == NULL) { | ||
2363 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
2364 | iocmd->status = BFA_STATUS_UNKNOWN_VFID; | ||
2365 | goto out; | ||
2366 | } | ||
2367 | memcpy((void *)&iocmd->stats, (void *)&fcs_vf->stats, | ||
2368 | sizeof(struct bfa_vf_stats_s)); | ||
2369 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
2370 | iocmd->status = BFA_STATUS_OK; | ||
2371 | out: | ||
2372 | return 0; | ||
2373 | } | ||
2374 | |||
2375 | int | ||
2376 | bfad_iocmd_vf_clr_stats(struct bfad_s *bfad, void *cmd) | ||
2377 | { | ||
2378 | struct bfa_bsg_vf_reset_stats_s *iocmd = | ||
2379 | (struct bfa_bsg_vf_reset_stats_s *)cmd; | ||
2380 | struct bfa_fcs_fabric_s *fcs_vf; | ||
2381 | unsigned long flags; | ||
2382 | |||
2383 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
2384 | fcs_vf = bfa_fcs_vf_lookup(&bfad->bfa_fcs, iocmd->vf_id); | ||
2385 | if (fcs_vf == NULL) { | ||
2386 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
2387 | iocmd->status = BFA_STATUS_UNKNOWN_VFID; | ||
2388 | goto out; | ||
2389 | } | ||
2390 | memset((void *)&fcs_vf->stats, 0, sizeof(struct bfa_vf_stats_s)); | ||
2391 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
2392 | iocmd->status = BFA_STATUS_OK; | ||
2393 | out: | ||
2394 | return 0; | ||
2395 | } | ||
2396 | |||
2352 | static int | 2397 | static int |
2353 | bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd, | 2398 | bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd, |
2354 | unsigned int payload_len) | 2399 | unsigned int payload_len) |
@@ -2661,6 +2706,12 @@ bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd, | |||
2661 | case IOCMD_QOS_RESET_STATS: | 2706 | case IOCMD_QOS_RESET_STATS: |
2662 | rc = bfad_iocmd_qos_reset_stats(bfad, iocmd); | 2707 | rc = bfad_iocmd_qos_reset_stats(bfad, iocmd); |
2663 | break; | 2708 | break; |
2709 | case IOCMD_VF_GET_STATS: | ||
2710 | rc = bfad_iocmd_vf_get_stats(bfad, iocmd); | ||
2711 | break; | ||
2712 | case IOCMD_VF_RESET_STATS: | ||
2713 | rc = bfad_iocmd_vf_clr_stats(bfad, iocmd); | ||
2714 | break; | ||
2664 | default: | 2715 | default: |
2665 | rc = -EINVAL; | 2716 | rc = -EINVAL; |
2666 | break; | 2717 | break; |
diff --git a/drivers/scsi/bfa/bfad_bsg.h b/drivers/scsi/bfa/bfad_bsg.h index 3c0ce22ed47e..1e02652019b3 100644 --- a/drivers/scsi/bfa/bfad_bsg.h +++ b/drivers/scsi/bfa/bfad_bsg.h | |||
@@ -135,6 +135,8 @@ enum { | |||
135 | IOCMD_QOS_GET_VC_ATTR, | 135 | IOCMD_QOS_GET_VC_ATTR, |
136 | IOCMD_QOS_GET_STATS, | 136 | IOCMD_QOS_GET_STATS, |
137 | IOCMD_QOS_RESET_STATS, | 137 | IOCMD_QOS_RESET_STATS, |
138 | IOCMD_VF_GET_STATS, | ||
139 | IOCMD_VF_RESET_STATS, | ||
138 | }; | 140 | }; |
139 | 141 | ||
140 | struct bfa_bsg_gen_s { | 142 | struct bfa_bsg_gen_s { |
@@ -686,6 +688,19 @@ struct bfa_bsg_qos_vc_attr_s { | |||
686 | struct bfa_qos_vc_attr_s attr; | 688 | struct bfa_qos_vc_attr_s attr; |
687 | }; | 689 | }; |
688 | 690 | ||
691 | struct bfa_bsg_vf_stats_s { | ||
692 | bfa_status_t status; | ||
693 | u16 bfad_num; | ||
694 | u16 vf_id; | ||
695 | struct bfa_vf_stats_s stats; | ||
696 | }; | ||
697 | |||
698 | struct bfa_bsg_vf_reset_stats_s { | ||
699 | bfa_status_t status; | ||
700 | u16 bfad_num; | ||
701 | u16 vf_id; | ||
702 | }; | ||
703 | |||
689 | struct bfa_bsg_fcpt_s { | 704 | struct bfa_bsg_fcpt_s { |
690 | bfa_status_t status; | 705 | bfa_status_t status; |
691 | u16 vf_id; | 706 | u16 vf_id; |