Commit 45191236 authored by Krishna Gudipati's avatar Krishna Gudipati Committed by James Bottomley

[SCSI] bfa: Add support to configure trunking on Brocade adapter ports.

- Added logic to enable / disable trunking on Brocade adapter ports.
- Added logic to query trunking info.
Signed-off-by: default avatarKrishna Gudipati <kgudipat@brocade.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent a46bd300
...@@ -2181,6 +2181,53 @@ bfad_iocmd_ethboot_query(struct bfad_s *bfad, void *cmd) ...@@ -2181,6 +2181,53 @@ bfad_iocmd_ethboot_query(struct bfad_s *bfad, void *cmd)
return 0; return 0;
} }
int
bfad_iocmd_cfg_trunk(struct bfad_s *bfad, void *cmd, unsigned int v_cmd)
{
struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd;
struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(&bfad->bfa);
struct bfa_fcport_trunk_s *trunk = &fcport->trunk;
unsigned long flags;
spin_lock_irqsave(&bfad->bfad_lock, flags);
if (v_cmd == IOCMD_TRUNK_ENABLE) {
trunk->attr.state = BFA_TRUNK_OFFLINE;
bfa_fcport_disable(&bfad->bfa);
fcport->cfg.trunked = BFA_TRUE;
} else if (v_cmd == IOCMD_TRUNK_DISABLE) {
trunk->attr.state = BFA_TRUNK_DISABLED;
bfa_fcport_disable(&bfad->bfa);
fcport->cfg.trunked = BFA_FALSE;
}
if (!bfa_fcport_is_disabled(&bfad->bfa))
bfa_fcport_enable(&bfad->bfa);
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
iocmd->status = BFA_STATUS_OK;
return 0;
}
int
bfad_iocmd_trunk_get_attr(struct bfad_s *bfad, void *cmd)
{
struct bfa_bsg_trunk_attr_s *iocmd = (struct bfa_bsg_trunk_attr_s *)cmd;
struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(&bfad->bfa);
struct bfa_fcport_trunk_s *trunk = &fcport->trunk;
unsigned long flags;
spin_lock_irqsave(&bfad->bfad_lock, flags);
memcpy((void *)&iocmd->attr, (void *)&trunk->attr,
sizeof(struct bfa_trunk_attr_s));
iocmd->attr.port_id = bfa_lps_get_base_pid(&bfad->bfa);
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
iocmd->status = BFA_STATUS_OK;
return 0;
}
static int static int
bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd, bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd,
unsigned int payload_len) unsigned int payload_len)
...@@ -2470,6 +2517,13 @@ bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd, ...@@ -2470,6 +2517,13 @@ bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd,
case IOCMD_ETHBOOT_QUERY: case IOCMD_ETHBOOT_QUERY:
rc = bfad_iocmd_ethboot_query(bfad, iocmd); rc = bfad_iocmd_ethboot_query(bfad, iocmd);
break; break;
case IOCMD_TRUNK_ENABLE:
case IOCMD_TRUNK_DISABLE:
rc = bfad_iocmd_cfg_trunk(bfad, iocmd, cmd);
break;
case IOCMD_TRUNK_GET_ATTR:
rc = bfad_iocmd_trunk_get_attr(bfad, iocmd);
break;
default: default:
rc = -EINVAL; rc = -EINVAL;
break; break;
......
...@@ -126,6 +126,9 @@ enum { ...@@ -126,6 +126,9 @@ enum {
IOCMD_PREBOOT_QUERY, IOCMD_PREBOOT_QUERY,
IOCMD_ETHBOOT_CFG, IOCMD_ETHBOOT_CFG,
IOCMD_ETHBOOT_QUERY, IOCMD_ETHBOOT_QUERY,
IOCMD_TRUNK_ENABLE,
IOCMD_TRUNK_DISABLE,
IOCMD_TRUNK_GET_ATTR,
}; };
struct bfa_bsg_gen_s { struct bfa_bsg_gen_s {
...@@ -656,6 +659,13 @@ struct bfa_bsg_ethboot_s { ...@@ -656,6 +659,13 @@ struct bfa_bsg_ethboot_s {
struct bfa_ethboot_cfg_s cfg; struct bfa_ethboot_cfg_s cfg;
}; };
struct bfa_bsg_trunk_attr_s {
bfa_status_t status;
u16 bfad_num;
u16 rsvd;
struct bfa_trunk_attr_s attr;
};
struct bfa_bsg_fcpt_s { struct bfa_bsg_fcpt_s {
bfa_status_t status; bfa_status_t status;
u16 vf_id; u16 vf_id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment