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.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c
index 45753dcba571..26def664cb83 100644
--- a/drivers/scsi/bfa/bfad_bsg.c
+++ b/drivers/scsi/bfa/bfad_bsg.c
@@ -1977,6 +1977,52 @@ bfad_iocmd_porglog_ctl(struct bfad_s *bfad, void *cmd)
1977 return 0; 1977 return 0;
1978} 1978}
1979 1979
1980int
1981bfad_iocmd_fcpim_cfg_profile(struct bfad_s *bfad, void *cmd, unsigned int v_cmd)
1982{
1983 struct bfa_bsg_fcpim_profile_s *iocmd =
1984 (struct bfa_bsg_fcpim_profile_s *)cmd;
1985 struct timeval tv;
1986 unsigned long flags;
1987
1988 do_gettimeofday(&tv);
1989 spin_lock_irqsave(&bfad->bfad_lock, flags);
1990 if (v_cmd == IOCMD_FCPIM_PROFILE_ON)
1991 iocmd->status = bfa_fcpim_profile_on(&bfad->bfa, tv.tv_sec);
1992 else if (v_cmd == IOCMD_FCPIM_PROFILE_OFF)
1993 iocmd->status = bfa_fcpim_profile_off(&bfad->bfa);
1994 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
1995
1996 return 0;
1997}
1998
1999static int
2000bfad_iocmd_itnim_get_ioprofile(struct bfad_s *bfad, void *cmd)
2001{
2002 struct bfa_bsg_itnim_ioprofile_s *iocmd =
2003 (struct bfa_bsg_itnim_ioprofile_s *)cmd;
2004 struct bfa_fcs_lport_s *fcs_port;
2005 struct bfa_fcs_itnim_s *itnim;
2006 unsigned long flags;
2007
2008 spin_lock_irqsave(&bfad->bfad_lock, flags);
2009 fcs_port = bfa_fcs_lookup_port(&bfad->bfa_fcs,
2010 iocmd->vf_id, iocmd->lpwwn);
2011 if (!fcs_port)
2012 iocmd->status = BFA_STATUS_UNKNOWN_LWWN;
2013 else {
2014 itnim = bfa_fcs_itnim_lookup(fcs_port, iocmd->rpwwn);
2015 if (itnim == NULL)
2016 iocmd->status = BFA_STATUS_UNKNOWN_RWWN;
2017 else
2018 iocmd->status = bfa_itnim_get_ioprofile(
2019 bfa_fcs_itnim_get_halitn(itnim),
2020 &iocmd->ioprofile);
2021 }
2022 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
2023 return 0;
2024}
2025
1980static int 2026static int
1981bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd, 2027bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd,
1982 unsigned int payload_len) 2028 unsigned int payload_len)
@@ -2238,6 +2284,13 @@ bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd,
2238 case IOCMD_DEBUG_PORTLOG_CTL: 2284 case IOCMD_DEBUG_PORTLOG_CTL:
2239 rc = bfad_iocmd_porglog_ctl(bfad, iocmd); 2285 rc = bfad_iocmd_porglog_ctl(bfad, iocmd);
2240 break; 2286 break;
2287 case IOCMD_FCPIM_PROFILE_ON:
2288 case IOCMD_FCPIM_PROFILE_OFF:
2289 rc = bfad_iocmd_fcpim_cfg_profile(bfad, iocmd, cmd);
2290 break;
2291 case IOCMD_ITNIM_GET_IOPROFILE:
2292 rc = bfad_iocmd_itnim_get_ioprofile(bfad, iocmd);
2293 break;
2241 default: 2294 default:
2242 rc = -EINVAL; 2295 rc = -EINVAL;
2243 break; 2296 break;