diff options
author | Krishna Gudipati <kgudipat@brocade.com> | 2012-09-21 20:26:07 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-10-07 06:17:27 -0400 |
commit | e353546e447feb838db2d1b23bac23cb90755993 (patch) | |
tree | f2762c0aedd4bb0ef4ebdca889c782b180ecdddc /drivers/scsi/bfa/bfad_bsg.c | |
parent | 1306e31d417df05c25053c5632b26d1c1b22d1ed (diff) |
[SCSI] bfa: Add diagnostic port (D-Port) support
- Introduced support for D-Port which is a new port mode during which
link level diagnostics can be run.
- Provided mechanism to dynamically configure D-Port and initiate diagnostic
tests to isolate any link level issues.
- In D-Port mode, the HBA port does not participate in fabric or login to the
remote device or run data traffic.
- Diagnostic tests include running various loopback tests in conjunction with
the attached device.
Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/bfa/bfad_bsg.c')
-rw-r--r-- | drivers/scsi/bfa/bfad_bsg.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c index 8ddd7e8be977..69b1ba9e58f6 100644 --- a/drivers/scsi/bfa/bfad_bsg.c +++ b/drivers/scsi/bfa/bfad_bsg.c | |||
@@ -1747,6 +1747,52 @@ bfad_iocmd_diag_lb_stat(struct bfad_s *bfad, void *cmd) | |||
1747 | } | 1747 | } |
1748 | 1748 | ||
1749 | int | 1749 | int |
1750 | bfad_iocmd_diag_cfg_dport(struct bfad_s *bfad, unsigned int cmd, void *pcmd) | ||
1751 | { | ||
1752 | struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)pcmd; | ||
1753 | unsigned long flags; | ||
1754 | struct bfad_hal_comp fcomp; | ||
1755 | |||
1756 | init_completion(&fcomp.comp); | ||
1757 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
1758 | if (cmd == IOCMD_DIAG_DPORT_ENABLE) | ||
1759 | iocmd->status = bfa_dport_enable(&bfad->bfa, | ||
1760 | bfad_hcb_comp, &fcomp); | ||
1761 | else if (cmd == IOCMD_DIAG_DPORT_DISABLE) | ||
1762 | iocmd->status = bfa_dport_disable(&bfad->bfa, | ||
1763 | bfad_hcb_comp, &fcomp); | ||
1764 | else { | ||
1765 | bfa_trc(bfad, 0); | ||
1766 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
1767 | return -EINVAL; | ||
1768 | } | ||
1769 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
1770 | |||
1771 | if (iocmd->status != BFA_STATUS_OK) | ||
1772 | bfa_trc(bfad, iocmd->status); | ||
1773 | else { | ||
1774 | wait_for_completion(&fcomp.comp); | ||
1775 | iocmd->status = fcomp.status; | ||
1776 | } | ||
1777 | |||
1778 | return 0; | ||
1779 | } | ||
1780 | |||
1781 | int | ||
1782 | bfad_iocmd_diag_dport_get_state(struct bfad_s *bfad, void *pcmd) | ||
1783 | { | ||
1784 | struct bfa_bsg_diag_dport_get_state_s *iocmd = | ||
1785 | (struct bfa_bsg_diag_dport_get_state_s *)pcmd; | ||
1786 | unsigned long flags; | ||
1787 | |||
1788 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
1789 | iocmd->status = bfa_dport_get_state(&bfad->bfa, &iocmd->state); | ||
1790 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
1791 | |||
1792 | return 0; | ||
1793 | } | ||
1794 | |||
1795 | int | ||
1750 | bfad_iocmd_phy_get_attr(struct bfad_s *bfad, void *cmd) | 1796 | bfad_iocmd_phy_get_attr(struct bfad_s *bfad, void *cmd) |
1751 | { | 1797 | { |
1752 | struct bfa_bsg_phy_attr_s *iocmd = | 1798 | struct bfa_bsg_phy_attr_s *iocmd = |
@@ -2172,6 +2218,9 @@ bfad_iocmd_cfg_trunk(struct bfad_s *bfad, void *cmd, unsigned int v_cmd) | |||
2172 | 2218 | ||
2173 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 2219 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
2174 | 2220 | ||
2221 | if (bfa_fcport_is_dport(&bfad->bfa)) | ||
2222 | return BFA_STATUS_DPORT_ERR; | ||
2223 | |||
2175 | if ((fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) || | 2224 | if ((fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) || |
2176 | (fcport->topology == BFA_PORT_TOPOLOGY_LOOP)) | 2225 | (fcport->topology == BFA_PORT_TOPOLOGY_LOOP)) |
2177 | iocmd->status = BFA_STATUS_TOPOLOGY_LOOP; | 2226 | iocmd->status = BFA_STATUS_TOPOLOGY_LOOP; |
@@ -2702,6 +2751,13 @@ bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd, | |||
2702 | case IOCMD_DIAG_LB_STAT: | 2751 | case IOCMD_DIAG_LB_STAT: |
2703 | rc = bfad_iocmd_diag_lb_stat(bfad, iocmd); | 2752 | rc = bfad_iocmd_diag_lb_stat(bfad, iocmd); |
2704 | break; | 2753 | break; |
2754 | case IOCMD_DIAG_DPORT_ENABLE: | ||
2755 | case IOCMD_DIAG_DPORT_DISABLE: | ||
2756 | rc = bfad_iocmd_diag_cfg_dport(bfad, cmd, iocmd); | ||
2757 | break; | ||
2758 | case IOCMD_DIAG_DPORT_GET_STATE: | ||
2759 | rc = bfad_iocmd_diag_dport_get_state(bfad, iocmd); | ||
2760 | break; | ||
2705 | case IOCMD_PHY_GET_ATTR: | 2761 | case IOCMD_PHY_GET_ATTR: |
2706 | rc = bfad_iocmd_phy_get_attr(bfad, iocmd); | 2762 | rc = bfad_iocmd_phy_get_attr(bfad, iocmd); |
2707 | break; | 2763 | break; |