Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 261693
b: refs/heads/master
c: c0350bf
h: refs/heads/master
i:
  261691: 2f97b64
v: v3
  • Loading branch information
Krishna Gudipati authored and James Bottomley committed Jul 27, 2011
1 parent d57f2a4 commit 389eba8
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3ec4f2c8bff2568e5a51ba083db2c073321ca2c1
refs/heads/master: c0350bf57445b9e2a4369668127ecc4431472d26
51 changes: 51 additions & 0 deletions trunk/drivers/scsi/bfa/bfad_bsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2349,6 +2349,51 @@ bfad_iocmd_qos_reset_stats(struct bfad_s *bfad, void *cmd)
return 0;
}

int
bfad_iocmd_vf_get_stats(struct bfad_s *bfad, void *cmd)
{
struct bfa_bsg_vf_stats_s *iocmd =
(struct bfa_bsg_vf_stats_s *)cmd;
struct bfa_fcs_fabric_s *fcs_vf;
unsigned long flags;

spin_lock_irqsave(&bfad->bfad_lock, flags);
fcs_vf = bfa_fcs_vf_lookup(&bfad->bfa_fcs, iocmd->vf_id);
if (fcs_vf == NULL) {
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
iocmd->status = BFA_STATUS_UNKNOWN_VFID;
goto out;
}
memcpy((void *)&iocmd->stats, (void *)&fcs_vf->stats,
sizeof(struct bfa_vf_stats_s));
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
iocmd->status = BFA_STATUS_OK;
out:
return 0;
}

int
bfad_iocmd_vf_clr_stats(struct bfad_s *bfad, void *cmd)
{
struct bfa_bsg_vf_reset_stats_s *iocmd =
(struct bfa_bsg_vf_reset_stats_s *)cmd;
struct bfa_fcs_fabric_s *fcs_vf;
unsigned long flags;

spin_lock_irqsave(&bfad->bfad_lock, flags);
fcs_vf = bfa_fcs_vf_lookup(&bfad->bfa_fcs, iocmd->vf_id);
if (fcs_vf == NULL) {
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
iocmd->status = BFA_STATUS_UNKNOWN_VFID;
goto out;
}
memset((void *)&fcs_vf->stats, 0, sizeof(struct bfa_vf_stats_s));
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
iocmd->status = BFA_STATUS_OK;
out:
return 0;
}

static int
bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd,
unsigned int payload_len)
Expand Down Expand Up @@ -2661,6 +2706,12 @@ bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd,
case IOCMD_QOS_RESET_STATS:
rc = bfad_iocmd_qos_reset_stats(bfad, iocmd);
break;
case IOCMD_VF_GET_STATS:
rc = bfad_iocmd_vf_get_stats(bfad, iocmd);
break;
case IOCMD_VF_RESET_STATS:
rc = bfad_iocmd_vf_clr_stats(bfad, iocmd);
break;
default:
rc = -EINVAL;
break;
Expand Down
15 changes: 15 additions & 0 deletions trunk/drivers/scsi/bfa/bfad_bsg.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ enum {
IOCMD_QOS_GET_VC_ATTR,
IOCMD_QOS_GET_STATS,
IOCMD_QOS_RESET_STATS,
IOCMD_VF_GET_STATS,
IOCMD_VF_RESET_STATS,
};

struct bfa_bsg_gen_s {
Expand Down Expand Up @@ -686,6 +688,19 @@ struct bfa_bsg_qos_vc_attr_s {
struct bfa_qos_vc_attr_s attr;
};

struct bfa_bsg_vf_stats_s {
bfa_status_t status;
u16 bfad_num;
u16 vf_id;
struct bfa_vf_stats_s stats;
};

struct bfa_bsg_vf_reset_stats_s {
bfa_status_t status;
u16 bfad_num;
u16 vf_id;
};

struct bfa_bsg_fcpt_s {
bfa_status_t status;
u16 vf_id;
Expand Down

0 comments on commit 389eba8

Please sign in to comment.