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.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c
index f782ee4b8868..55a9180b0a39 100644
--- a/drivers/scsi/bfa/bfad_bsg.c
+++ b/drivers/scsi/bfa/bfad_bsg.c
@@ -2181,6 +2181,53 @@ out:
2181 return 0; 2181 return 0;
2182} 2182}
2183 2183
2184int
2185bfad_iocmd_cfg_trunk(struct bfad_s *bfad, void *cmd, unsigned int v_cmd)
2186{
2187 struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd;
2188 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(&bfad->bfa);
2189 struct bfa_fcport_trunk_s *trunk = &fcport->trunk;
2190 unsigned long flags;
2191
2192 spin_lock_irqsave(&bfad->bfad_lock, flags);
2193
2194 if (v_cmd == IOCMD_TRUNK_ENABLE) {
2195 trunk->attr.state = BFA_TRUNK_OFFLINE;
2196 bfa_fcport_disable(&bfad->bfa);
2197 fcport->cfg.trunked = BFA_TRUE;
2198 } else if (v_cmd == IOCMD_TRUNK_DISABLE) {
2199 trunk->attr.state = BFA_TRUNK_DISABLED;
2200 bfa_fcport_disable(&bfad->bfa);
2201 fcport->cfg.trunked = BFA_FALSE;
2202 }
2203
2204 if (!bfa_fcport_is_disabled(&bfad->bfa))
2205 bfa_fcport_enable(&bfad->bfa);
2206
2207 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
2208
2209 iocmd->status = BFA_STATUS_OK;
2210 return 0;
2211}
2212
2213int
2214bfad_iocmd_trunk_get_attr(struct bfad_s *bfad, void *cmd)
2215{
2216 struct bfa_bsg_trunk_attr_s *iocmd = (struct bfa_bsg_trunk_attr_s *)cmd;
2217 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(&bfad->bfa);
2218 struct bfa_fcport_trunk_s *trunk = &fcport->trunk;
2219 unsigned long flags;
2220
2221 spin_lock_irqsave(&bfad->bfad_lock, flags);
2222 memcpy((void *)&iocmd->attr, (void *)&trunk->attr,
2223 sizeof(struct bfa_trunk_attr_s));
2224 iocmd->attr.port_id = bfa_lps_get_base_pid(&bfad->bfa);
2225 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
2226
2227 iocmd->status = BFA_STATUS_OK;
2228 return 0;
2229}
2230
2184static int 2231static int
2185bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd, 2232bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd,
2186 unsigned int payload_len) 2233 unsigned int payload_len)
@@ -2470,6 +2517,13 @@ bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd,
2470 case IOCMD_ETHBOOT_QUERY: 2517 case IOCMD_ETHBOOT_QUERY:
2471 rc = bfad_iocmd_ethboot_query(bfad, iocmd); 2518 rc = bfad_iocmd_ethboot_query(bfad, iocmd);
2472 break; 2519 break;
2520 case IOCMD_TRUNK_ENABLE:
2521 case IOCMD_TRUNK_DISABLE:
2522 rc = bfad_iocmd_cfg_trunk(bfad, iocmd, cmd);
2523 break;
2524 case IOCMD_TRUNK_GET_ATTR:
2525 rc = bfad_iocmd_trunk_get_attr(bfad, iocmd);
2526 break;
2473 default: 2527 default:
2474 rc = -EINVAL; 2528 rc = -EINVAL;
2475 break; 2529 break;