Skip to content

Commit 3350d98

Browse files
Krishna GudipatiJames Bottomley
authored andcommitted
[SCSI] bfa: Added support to query PHY.
- Added PHY sub-module. - Implemented interface to obtain stats and to read/update the fw from the PHY module. Signed-off-by: Krishna Gudipati <kgudipat@brocade.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
1 parent 3d7fc66 commit 3350d98

9 files changed

Lines changed: 867 additions & 0 deletions

File tree

‎drivers/scsi/bfa/bfa_core.c‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,16 @@ bfa_com_diag_attach(struct bfa_s *bfa)
154154
bfa_diag_memclaim(diag, diag_dma->kva_curp, diag_dma->dma_curp);
155155
}
156156

157+
static void
158+
bfa_com_phy_attach(struct bfa_s *bfa, bfa_boolean_t mincfg)
159+
{
160+
struct bfa_phy_s *phy = BFA_PHY(bfa);
161+
struct bfa_mem_dma_s *phy_dma = BFA_MEM_PHY_DMA(bfa);
162+
163+
bfa_phy_attach(phy, &bfa->ioc, bfa, bfa->trcmod, mincfg);
164+
bfa_phy_memclaim(phy, phy_dma->kva_curp, phy_dma->dma_curp, mincfg);
165+
}
166+
157167
/*
158168
* BFA IOC FC related definitions
159169
*/
@@ -1395,6 +1405,7 @@ bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg, struct bfa_meminfo_s *meminfo,
13951405
struct bfa_mem_dma_s *sfp_dma = BFA_MEM_SFP_DMA(bfa);
13961406
struct bfa_mem_dma_s *flash_dma = BFA_MEM_FLASH_DMA(bfa);
13971407
struct bfa_mem_dma_s *diag_dma = BFA_MEM_DIAG_DMA(bfa);
1408+
struct bfa_mem_dma_s *phy_dma = BFA_MEM_PHY_DMA(bfa);
13981409

13991410
WARN_ON((cfg == NULL) || (meminfo == NULL));
14001411

@@ -1417,6 +1428,8 @@ bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg, struct bfa_meminfo_s *meminfo,
14171428
bfa_mem_dma_setup(meminfo, flash_dma,
14181429
bfa_flash_meminfo(cfg->drvcfg.min_cfg));
14191430
bfa_mem_dma_setup(meminfo, diag_dma, bfa_diag_meminfo());
1431+
bfa_mem_dma_setup(meminfo, phy_dma,
1432+
bfa_phy_meminfo(cfg->drvcfg.min_cfg));
14201433
}
14211434

14221435
/*
@@ -1488,6 +1501,7 @@ bfa_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
14881501
bfa_com_sfp_attach(bfa);
14891502
bfa_com_flash_attach(bfa, cfg->drvcfg.min_cfg);
14901503
bfa_com_diag_attach(bfa);
1504+
bfa_com_phy_attach(bfa, cfg->drvcfg.min_cfg);
14911505
}
14921506

14931507
/*

‎drivers/scsi/bfa/bfa_defs.h‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ enum bfa_status {
170170
BFA_STATUS_TRUNK_DISABLED = 165, /* Trunking is disabled on
171171
* the adapter */
172172
BFA_STATUS_IOPROFILE_OFF = 175, /* IO profile OFF */
173+
BFA_STATUS_PHY_NOT_PRESENT = 183, /* PHY module not present */
173174
BFA_STATUS_FEATURE_NOT_SUPPORTED = 192, /* Feature not supported */
174175
BFA_STATUS_FAA_ENABLED = 197, /* FAA is already enabled */
175176
BFA_STATUS_FAA_DISABLED = 198, /* FAA is already disabled */
@@ -939,6 +940,42 @@ struct bfa_diag_loopback_s {
939940
u8 rsvd[2];
940941
};
941942

943+
/*
944+
* PHY module specific
945+
*/
946+
enum bfa_phy_status_e {
947+
BFA_PHY_STATUS_GOOD = 0, /* phy is good */
948+
BFA_PHY_STATUS_NOT_PRESENT = 1, /* phy does not exist */
949+
BFA_PHY_STATUS_BAD = 2, /* phy is bad */
950+
};
951+
952+
/*
953+
* phy attributes for phy query
954+
*/
955+
struct bfa_phy_attr_s {
956+
u32 status; /* phy present/absent status */
957+
u32 length; /* firmware length */
958+
u32 fw_ver; /* firmware version */
959+
u32 an_status; /* AN status */
960+
u32 pma_pmd_status; /* PMA/PMD link status */
961+
u32 pma_pmd_signal; /* PMA/PMD signal detect */
962+
u32 pcs_status; /* PCS link status */
963+
};
964+
965+
/*
966+
* phy stats
967+
*/
968+
struct bfa_phy_stats_s {
969+
u32 status; /* phy stats status */
970+
u32 link_breaks; /* Num of link breaks after linkup */
971+
u32 pma_pmd_fault; /* NPMA/PMD fault */
972+
u32 pcs_fault; /* PCS fault */
973+
u32 speed_neg; /* Num of speed negotiation */
974+
u32 tx_eq_training; /* Num of TX EQ training */
975+
u32 tx_eq_timeout; /* Num of TX EQ timeout */
976+
u32 crc_error; /* Num of CRC errors */
977+
};
978+
942979
#pragma pack()
943980

944981
#endif /* __BFA_DEFS_H__ */

0 commit comments

Comments
 (0)