Lines Matching full:sfp
3627 * SFP module specific
3631 static void bfa_sfp_getdata_send(struct bfa_sfp_s *sfp);
3632 static void bfa_sfp_media_get(struct bfa_sfp_s *sfp);
3633 static bfa_status_t bfa_sfp_speed_valid(struct bfa_sfp_s *sfp,
3637 bfa_cb_sfp_show(struct bfa_sfp_s *sfp) in bfa_cb_sfp_show() argument
3639 bfa_trc(sfp, sfp->lock); in bfa_cb_sfp_show()
3640 if (sfp->cbfn) in bfa_cb_sfp_show()
3641 sfp->cbfn(sfp->cbarg, sfp->status); in bfa_cb_sfp_show()
3642 sfp->lock = 0; in bfa_cb_sfp_show()
3643 sfp->cbfn = NULL; in bfa_cb_sfp_show()
3647 bfa_cb_sfp_state_query(struct bfa_sfp_s *sfp) in bfa_cb_sfp_state_query() argument
3649 bfa_trc(sfp, sfp->portspeed); in bfa_cb_sfp_state_query()
3650 if (sfp->media) { in bfa_cb_sfp_state_query()
3651 bfa_sfp_media_get(sfp); in bfa_cb_sfp_state_query()
3652 if (sfp->state_query_cbfn) in bfa_cb_sfp_state_query()
3653 sfp->state_query_cbfn(sfp->state_query_cbarg, in bfa_cb_sfp_state_query()
3654 sfp->status); in bfa_cb_sfp_state_query()
3655 sfp->media = NULL; in bfa_cb_sfp_state_query()
3658 if (sfp->portspeed) { in bfa_cb_sfp_state_query()
3659 sfp->status = bfa_sfp_speed_valid(sfp, sfp->portspeed); in bfa_cb_sfp_state_query()
3660 if (sfp->state_query_cbfn) in bfa_cb_sfp_state_query()
3661 sfp->state_query_cbfn(sfp->state_query_cbarg, in bfa_cb_sfp_state_query()
3662 sfp->status); in bfa_cb_sfp_state_query()
3663 sfp->portspeed = BFA_PORT_SPEED_UNKNOWN; in bfa_cb_sfp_state_query()
3666 sfp->state_query_lock = 0; in bfa_cb_sfp_state_query()
3667 sfp->state_query_cbfn = NULL; in bfa_cb_sfp_state_query()
3676 struct bfa_sfp_s *sfp = sfp_arg; in bfa_sfp_notify() local
3678 bfa_trc(sfp, event); in bfa_sfp_notify()
3679 bfa_trc(sfp, sfp->lock); in bfa_sfp_notify()
3680 bfa_trc(sfp, sfp->state_query_lock); in bfa_sfp_notify()
3685 if (sfp->lock) { in bfa_sfp_notify()
3686 sfp->status = BFA_STATUS_IOC_FAILURE; in bfa_sfp_notify()
3687 bfa_cb_sfp_show(sfp); in bfa_sfp_notify()
3690 if (sfp->state_query_lock) { in bfa_sfp_notify()
3691 sfp->status = BFA_STATUS_IOC_FAILURE; in bfa_sfp_notify()
3692 bfa_cb_sfp_state_query(sfp); in bfa_sfp_notify()
3702 * SFP's State Change Notification post to AEN
3705 bfa_sfp_scn_aen_post(struct bfa_sfp_s *sfp, struct bfi_sfp_scn_s *rsp) in bfa_sfp_scn_aen_post() argument
3707 struct bfad_s *bfad = (struct bfad_s *)sfp->ioc->bfa->bfad; in bfa_sfp_scn_aen_post()
3711 bfa_trc(sfp, (((u64)rsp->pomlvl) << 16) | (((u64)rsp->sfpid) << 8) | in bfa_sfp_scn_aen_post()
3718 aen_entry->aen_data.port.ioc_type = bfa_ioc_get_type(sfp->ioc); in bfa_sfp_scn_aen_post()
3719 aen_entry->aen_data.port.pwwn = sfp->ioc->attr->pwwn; in bfa_sfp_scn_aen_post()
3720 aen_entry->aen_data.port.mac = bfa_ioc_get_mac(sfp->ioc); in bfa_sfp_scn_aen_post()
3740 bfa_trc(sfp, rsp->event); in bfa_sfp_scn_aen_post()
3745 bfad_im_post_vendor_event(aen_entry, bfad, ++sfp->ioc->ioc_aen_seq, in bfa_sfp_scn_aen_post()
3750 * SFP get data send
3753 bfa_sfp_getdata_send(struct bfa_sfp_s *sfp) in bfa_sfp_getdata_send() argument
3755 struct bfi_sfp_req_s *req = (struct bfi_sfp_req_s *)sfp->mbcmd.msg; in bfa_sfp_getdata_send()
3757 bfa_trc(sfp, req->memtype); in bfa_sfp_getdata_send()
3761 bfa_ioc_portid(sfp->ioc)); in bfa_sfp_getdata_send()
3764 bfa_ioc_mbox_queue(sfp->ioc, &sfp->mbcmd); in bfa_sfp_getdata_send()
3768 * SFP is valid, read sfp data
3771 bfa_sfp_getdata(struct bfa_sfp_s *sfp, enum bfi_sfp_mem_e memtype) in bfa_sfp_getdata() argument
3773 struct bfi_sfp_req_s *req = (struct bfi_sfp_req_s *)sfp->mbcmd.msg; in bfa_sfp_getdata()
3775 WARN_ON(sfp->lock != 0); in bfa_sfp_getdata()
3776 bfa_trc(sfp, sfp->state); in bfa_sfp_getdata()
3778 sfp->lock = 1; in bfa_sfp_getdata()
3779 sfp->memtype = memtype; in bfa_sfp_getdata()
3783 bfa_alen_set(&req->alen, sizeof(struct sfp_mem_s), sfp->dbuf_pa); in bfa_sfp_getdata()
3785 bfa_sfp_getdata_send(sfp); in bfa_sfp_getdata()
3789 * SFP scn handler
3792 bfa_sfp_scn(struct bfa_sfp_s *sfp, struct bfi_mbmsg_s *msg) in bfa_sfp_scn() argument
3798 sfp->state = BFA_SFP_STATE_INSERTED; in bfa_sfp_scn()
3799 sfp->data_valid = 0; in bfa_sfp_scn()
3800 bfa_sfp_scn_aen_post(sfp, rsp); in bfa_sfp_scn()
3803 sfp->state = BFA_SFP_STATE_REMOVED; in bfa_sfp_scn()
3804 sfp->data_valid = 0; in bfa_sfp_scn()
3805 bfa_sfp_scn_aen_post(sfp, rsp); in bfa_sfp_scn()
3808 sfp->state = BFA_SFP_STATE_FAILED; in bfa_sfp_scn()
3809 sfp->data_valid = 0; in bfa_sfp_scn()
3810 bfa_sfp_scn_aen_post(sfp, rsp); in bfa_sfp_scn()
3813 sfp->state = BFA_SFP_STATE_UNSUPPORT; in bfa_sfp_scn()
3814 bfa_sfp_scn_aen_post(sfp, rsp); in bfa_sfp_scn()
3815 if (!sfp->lock) in bfa_sfp_scn()
3816 bfa_sfp_getdata(sfp, BFI_SFP_MEM_ALL); in bfa_sfp_scn()
3819 bfa_sfp_scn_aen_post(sfp, rsp); in bfa_sfp_scn()
3822 sfp->state = BFA_SFP_STATE_VALID; in bfa_sfp_scn()
3823 if (!sfp->lock) in bfa_sfp_scn()
3824 bfa_sfp_getdata(sfp, BFI_SFP_MEM_ALL); in bfa_sfp_scn()
3827 bfa_trc(sfp, rsp->event); in bfa_sfp_scn()
3833 * SFP show complete
3836 bfa_sfp_show_comp(struct bfa_sfp_s *sfp, struct bfi_mbmsg_s *msg) in bfa_sfp_show_comp() argument
3840 if (!sfp->lock) { in bfa_sfp_show_comp()
3844 bfa_trc(sfp, sfp->lock); in bfa_sfp_show_comp()
3848 bfa_trc(sfp, rsp->status); in bfa_sfp_show_comp()
3850 sfp->data_valid = 1; in bfa_sfp_show_comp()
3851 if (sfp->state == BFA_SFP_STATE_VALID) in bfa_sfp_show_comp()
3852 sfp->status = BFA_STATUS_OK; in bfa_sfp_show_comp()
3853 else if (sfp->state == BFA_SFP_STATE_UNSUPPORT) in bfa_sfp_show_comp()
3854 sfp->status = BFA_STATUS_SFP_UNSUPP; in bfa_sfp_show_comp()
3856 bfa_trc(sfp, sfp->state); in bfa_sfp_show_comp()
3858 sfp->data_valid = 0; in bfa_sfp_show_comp()
3859 sfp->status = rsp->status; in bfa_sfp_show_comp()
3860 /* sfpshow shouldn't change sfp state */ in bfa_sfp_show_comp()
3863 bfa_trc(sfp, sfp->memtype); in bfa_sfp_show_comp()
3864 if (sfp->memtype == BFI_SFP_MEM_DIAGEXT) { in bfa_sfp_show_comp()
3865 bfa_trc(sfp, sfp->data_valid); in bfa_sfp_show_comp()
3866 if (sfp->data_valid) { in bfa_sfp_show_comp()
3868 u8 *des = (u8 *)(sfp->sfpmem); in bfa_sfp_show_comp()
3869 memcpy(des, sfp->dbuf_kva, size); in bfa_sfp_show_comp()
3874 bfa_cb_sfp_show(sfp); in bfa_sfp_show_comp()
3876 sfp->lock = 0; in bfa_sfp_show_comp()
3878 bfa_trc(sfp, sfp->state_query_lock); in bfa_sfp_show_comp()
3879 if (sfp->state_query_lock) { in bfa_sfp_show_comp()
3880 sfp->state = rsp->state; in bfa_sfp_show_comp()
3882 bfa_cb_sfp_state_query(sfp); in bfa_sfp_show_comp()
3887 * SFP query fw sfp state
3890 bfa_sfp_state_query(struct bfa_sfp_s *sfp) in bfa_sfp_state_query() argument
3892 struct bfi_sfp_req_s *req = (struct bfi_sfp_req_s *)sfp->mbcmd.msg; in bfa_sfp_state_query()
3895 WARN_ON(sfp->state != BFA_SFP_STATE_INIT); in bfa_sfp_state_query()
3896 WARN_ON(sfp->state_query_lock != 0); in bfa_sfp_state_query()
3897 bfa_trc(sfp, sfp->state); in bfa_sfp_state_query()
3899 sfp->state_query_lock = 1; in bfa_sfp_state_query()
3902 if (!sfp->lock) in bfa_sfp_state_query()
3903 bfa_sfp_getdata(sfp, BFI_SFP_MEM_ALL); in bfa_sfp_state_query()
3907 bfa_sfp_media_get(struct bfa_sfp_s *sfp) in bfa_sfp_media_get() argument
3909 enum bfa_defs_sfp_media_e *media = sfp->media; in bfa_sfp_media_get()
3913 if (sfp->state == BFA_SFP_STATE_UNSUPPORT) in bfa_sfp_media_get()
3915 else if (sfp->state == BFA_SFP_STATE_VALID) { in bfa_sfp_media_get()
3917 struct sfp_mem_s *sfpmem = (struct sfp_mem_s *)sfp->dbuf_kva; in bfa_sfp_media_get()
3922 bfa_trc(sfp, e10g.b); in bfa_sfp_media_get()
3923 bfa_trc(sfp, xmtr_tech); in bfa_sfp_media_get()
3947 bfa_trc(sfp, 0); in bfa_sfp_media_get()
3949 bfa_trc(sfp, sfp->state); in bfa_sfp_media_get()
3953 bfa_sfp_speed_valid(struct bfa_sfp_s *sfp, enum bfa_port_speed portspeed) in bfa_sfp_speed_valid() argument
3955 struct sfp_mem_s *sfpmem = (struct sfp_mem_s *)sfp->dbuf_kva; in bfa_sfp_speed_valid()
3964 bfa_trc(sfp, e10g.b); in bfa_sfp_speed_valid()
3975 bfa_trc(sfp, portspeed); in bfa_sfp_speed_valid()
3976 bfa_trc(sfp, fc3.b); in bfa_sfp_speed_valid()
3977 bfa_trc(sfp, e10g.b); in bfa_sfp_speed_valid()
3983 * SFP hmbox handler
3988 struct bfa_sfp_s *sfp = sfparg; in bfa_sfp_intr() local
3992 bfa_sfp_show_comp(sfp, msg); in bfa_sfp_intr()
3996 bfa_sfp_scn(sfp, msg); in bfa_sfp_intr()
4000 bfa_trc(sfp, msg->mh.msg_id); in bfa_sfp_intr()
4006 * Return DMA memory needed by sfp module.
4015 * Attach virtual and physical memory for SFP.
4018 bfa_sfp_attach(struct bfa_sfp_s *sfp, struct bfa_ioc_s *ioc, void *dev, in bfa_sfp_attach() argument
4021 sfp->dev = dev; in bfa_sfp_attach()
4022 sfp->ioc = ioc; in bfa_sfp_attach()
4023 sfp->trcmod = trcmod; in bfa_sfp_attach()
4025 sfp->cbfn = NULL; in bfa_sfp_attach()
4026 sfp->cbarg = NULL; in bfa_sfp_attach()
4027 sfp->sfpmem = NULL; in bfa_sfp_attach()
4028 sfp->lock = 0; in bfa_sfp_attach()
4029 sfp->data_valid = 0; in bfa_sfp_attach()
4030 sfp->state = BFA_SFP_STATE_INIT; in bfa_sfp_attach()
4031 sfp->state_query_lock = 0; in bfa_sfp_attach()
4032 sfp->state_query_cbfn = NULL; in bfa_sfp_attach()
4033 sfp->state_query_cbarg = NULL; in bfa_sfp_attach()
4034 sfp->media = NULL; in bfa_sfp_attach()
4035 sfp->portspeed = BFA_PORT_SPEED_UNKNOWN; in bfa_sfp_attach()
4036 sfp->is_elb = BFA_FALSE; in bfa_sfp_attach()
4038 bfa_ioc_mbox_regisr(sfp->ioc, BFI_MC_SFP, bfa_sfp_intr, sfp); in bfa_sfp_attach()
4039 bfa_q_qe_init(&sfp->ioc_notify); in bfa_sfp_attach()
4040 bfa_ioc_notify_init(&sfp->ioc_notify, bfa_sfp_notify, sfp); in bfa_sfp_attach()
4041 list_add_tail(&sfp->ioc_notify.qe, &sfp->ioc->notify_q); in bfa_sfp_attach()
4045 * Claim Memory for SFP
4048 bfa_sfp_memclaim(struct bfa_sfp_s *sfp, u8 *dm_kva, u64 dm_pa) in bfa_sfp_memclaim() argument
4050 sfp->dbuf_kva = dm_kva; in bfa_sfp_memclaim()
4051 sfp->dbuf_pa = dm_pa; in bfa_sfp_memclaim()
4052 memset(sfp->dbuf_kva, 0, sizeof(struct sfp_mem_s)); in bfa_sfp_memclaim()
4059 * Show SFP eeprom content
4061 * @param[in] sfp - bfa sfp module
4063 * @param[out] sfpmem - sfp eeprom data
4067 bfa_sfp_show(struct bfa_sfp_s *sfp, struct sfp_mem_s *sfpmem, in bfa_sfp_show() argument
4071 if (!bfa_ioc_is_operational(sfp->ioc)) { in bfa_sfp_show()
4072 bfa_trc(sfp, 0); in bfa_sfp_show()
4076 if (sfp->lock) { in bfa_sfp_show()
4077 bfa_trc(sfp, 0); in bfa_sfp_show()
4081 sfp->cbfn = cbfn; in bfa_sfp_show()
4082 sfp->cbarg = cbarg; in bfa_sfp_show()
4083 sfp->sfpmem = sfpmem; in bfa_sfp_show()
4085 bfa_sfp_getdata(sfp, BFI_SFP_MEM_DIAGEXT); in bfa_sfp_show()
4090 * Return SFP Media type
4092 * @param[in] sfp - bfa sfp module
4098 bfa_sfp_media(struct bfa_sfp_s *sfp, enum bfa_defs_sfp_media_e *media, in bfa_sfp_media() argument
4101 if (!bfa_ioc_is_operational(sfp->ioc)) { in bfa_sfp_media()
4102 bfa_trc(sfp, 0); in bfa_sfp_media()
4106 sfp->media = media; in bfa_sfp_media()
4107 if (sfp->state == BFA_SFP_STATE_INIT) { in bfa_sfp_media()
4108 if (sfp->state_query_lock) { in bfa_sfp_media()
4109 bfa_trc(sfp, 0); in bfa_sfp_media()
4112 sfp->state_query_cbfn = cbfn; in bfa_sfp_media()
4113 sfp->state_query_cbarg = cbarg; in bfa_sfp_media()
4114 bfa_sfp_state_query(sfp); in bfa_sfp_media()
4119 bfa_sfp_media_get(sfp); in bfa_sfp_media()
4124 * Check if user set port speed is allowed by the SFP
4126 * @param[in] sfp - bfa sfp module
4131 bfa_sfp_speed(struct bfa_sfp_s *sfp, enum bfa_port_speed portspeed, in bfa_sfp_speed() argument
4136 if (!bfa_ioc_is_operational(sfp->ioc)) in bfa_sfp_speed()
4140 if (bfa_mfg_is_mezz(sfp->ioc->attr->card_type)) in bfa_sfp_speed()
4143 /* Check SFP state */ in bfa_sfp_speed()
4144 sfp->portspeed = portspeed; in bfa_sfp_speed()
4145 if (sfp->state == BFA_SFP_STATE_INIT) { in bfa_sfp_speed()
4146 if (sfp->state_query_lock) { in bfa_sfp_speed()
4147 bfa_trc(sfp, 0); in bfa_sfp_speed()
4150 sfp->state_query_cbfn = cbfn; in bfa_sfp_speed()
4151 sfp->state_query_cbarg = cbarg; in bfa_sfp_speed()
4152 bfa_sfp_state_query(sfp); in bfa_sfp_speed()
4157 if (sfp->state == BFA_SFP_STATE_REMOVED || in bfa_sfp_speed()
4158 sfp->state == BFA_SFP_STATE_FAILED) { in bfa_sfp_speed()
4159 bfa_trc(sfp, sfp->state); in bfa_sfp_speed()
4163 if (sfp->state == BFA_SFP_STATE_INSERTED) { in bfa_sfp_speed()
4164 bfa_trc(sfp, sfp->state); in bfa_sfp_speed()
4165 return BFA_STATUS_DEVBUSY; /* sfp is reading data */ in bfa_sfp_speed()
4169 if (sfp->is_elb) in bfa_sfp_speed()
4172 return bfa_sfp_speed_valid(sfp, portspeed); in bfa_sfp_speed()