aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa/bfad_bsg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/bfa/bfad_bsg.c')
-rw-r--r--drivers/scsi/bfa/bfad_bsg.c96
1 files changed, 96 insertions, 0 deletions
diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c
index 5ae591b062b3..fcfe0ae7fd31 100644
--- a/drivers/scsi/bfa/bfad_bsg.c
+++ b/drivers/scsi/bfa/bfad_bsg.c
@@ -979,6 +979,93 @@ out:
979 return 0; 979 return 0;
980} 980}
981 981
982int
983bfad_iocmd_cee_attr(struct bfad_s *bfad, void *cmd, unsigned int payload_len)
984{
985 struct bfa_bsg_cee_attr_s *iocmd =
986 (struct bfa_bsg_cee_attr_s *)cmd;
987 void *iocmd_bufptr;
988 struct bfad_hal_comp cee_comp;
989 unsigned long flags;
990
991 if (bfad_chk_iocmd_sz(payload_len,
992 sizeof(struct bfa_bsg_cee_attr_s),
993 sizeof(struct bfa_cee_attr_s)) != BFA_STATUS_OK) {
994 iocmd->status = BFA_STATUS_VERSION_FAIL;
995 return 0;
996 }
997
998 iocmd_bufptr = (char *)iocmd + sizeof(struct bfa_bsg_cee_attr_s);
999
1000 cee_comp.status = 0;
1001 init_completion(&cee_comp.comp);
1002 mutex_lock(&bfad_mutex);
1003 spin_lock_irqsave(&bfad->bfad_lock, flags);
1004 iocmd->status = bfa_cee_get_attr(&bfad->bfa.modules.cee, iocmd_bufptr,
1005 bfad_hcb_comp, &cee_comp);
1006 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
1007 if (iocmd->status != BFA_STATUS_OK) {
1008 mutex_unlock(&bfad_mutex);
1009 bfa_trc(bfad, 0x5555);
1010 goto out;
1011 }
1012 wait_for_completion(&cee_comp.comp);
1013 mutex_unlock(&bfad_mutex);
1014out:
1015 return 0;
1016}
1017
1018int
1019bfad_iocmd_cee_get_stats(struct bfad_s *bfad, void *cmd,
1020 unsigned int payload_len)
1021{
1022 struct bfa_bsg_cee_stats_s *iocmd =
1023 (struct bfa_bsg_cee_stats_s *)cmd;
1024 void *iocmd_bufptr;
1025 struct bfad_hal_comp cee_comp;
1026 unsigned long flags;
1027
1028 if (bfad_chk_iocmd_sz(payload_len,
1029 sizeof(struct bfa_bsg_cee_stats_s),
1030 sizeof(struct bfa_cee_stats_s)) != BFA_STATUS_OK) {
1031 iocmd->status = BFA_STATUS_VERSION_FAIL;
1032 return 0;
1033 }
1034
1035 iocmd_bufptr = (char *)iocmd + sizeof(struct bfa_bsg_cee_stats_s);
1036
1037 cee_comp.status = 0;
1038 init_completion(&cee_comp.comp);
1039 mutex_lock(&bfad_mutex);
1040 spin_lock_irqsave(&bfad->bfad_lock, flags);
1041 iocmd->status = bfa_cee_get_stats(&bfad->bfa.modules.cee, iocmd_bufptr,
1042 bfad_hcb_comp, &cee_comp);
1043 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
1044 if (iocmd->status != BFA_STATUS_OK) {
1045 mutex_unlock(&bfad_mutex);
1046 bfa_trc(bfad, 0x5555);
1047 goto out;
1048 }
1049 wait_for_completion(&cee_comp.comp);
1050 mutex_unlock(&bfad_mutex);
1051out:
1052 return 0;
1053}
1054
1055int
1056bfad_iocmd_cee_reset_stats(struct bfad_s *bfad, void *cmd)
1057{
1058 struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd;
1059 unsigned long flags;
1060
1061 spin_lock_irqsave(&bfad->bfad_lock, flags);
1062 iocmd->status = bfa_cee_reset_stats(&bfad->bfa.modules.cee, NULL, NULL);
1063 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
1064 if (iocmd->status != BFA_STATUS_OK)
1065 bfa_trc(bfad, 0x5555);
1066 return 0;
1067}
1068
982static int 1069static int
983bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd, 1070bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd,
984 unsigned int payload_len) 1071 unsigned int payload_len)
@@ -1098,6 +1185,15 @@ bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd,
1098 case IOCMD_FAA_QUERY: 1185 case IOCMD_FAA_QUERY:
1099 rc = bfad_iocmd_faa_query(bfad, iocmd); 1186 rc = bfad_iocmd_faa_query(bfad, iocmd);
1100 break; 1187 break;
1188 case IOCMD_CEE_GET_ATTR:
1189 rc = bfad_iocmd_cee_attr(bfad, iocmd, payload_len);
1190 break;
1191 case IOCMD_CEE_GET_STATS:
1192 rc = bfad_iocmd_cee_get_stats(bfad, iocmd, payload_len);
1193 break;
1194 case IOCMD_CEE_RESET_STATS:
1195 rc = bfad_iocmd_cee_reset_stats(bfad, iocmd);
1196 break;
1101 default: 1197 default:
1102 rc = EINVAL; 1198 rc = EINVAL;
1103 break; 1199 break;