Lines Matching refs:sfp
3630 static void bfa_sfp_getdata_send(struct bfa_sfp_s *sfp);
3631 static void bfa_sfp_media_get(struct bfa_sfp_s *sfp);
3632 static bfa_status_t bfa_sfp_speed_valid(struct bfa_sfp_s *sfp,
3636 bfa_cb_sfp_show(struct bfa_sfp_s *sfp) in bfa_cb_sfp_show() argument
3638 bfa_trc(sfp, sfp->lock); in bfa_cb_sfp_show()
3639 if (sfp->cbfn) in bfa_cb_sfp_show()
3640 sfp->cbfn(sfp->cbarg, sfp->status); in bfa_cb_sfp_show()
3641 sfp->lock = 0; in bfa_cb_sfp_show()
3642 sfp->cbfn = NULL; in bfa_cb_sfp_show()
3646 bfa_cb_sfp_state_query(struct bfa_sfp_s *sfp) in bfa_cb_sfp_state_query() argument
3648 bfa_trc(sfp, sfp->portspeed); in bfa_cb_sfp_state_query()
3649 if (sfp->media) { in bfa_cb_sfp_state_query()
3650 bfa_sfp_media_get(sfp); in bfa_cb_sfp_state_query()
3651 if (sfp->state_query_cbfn) in bfa_cb_sfp_state_query()
3652 sfp->state_query_cbfn(sfp->state_query_cbarg, in bfa_cb_sfp_state_query()
3653 sfp->status); in bfa_cb_sfp_state_query()
3654 sfp->media = NULL; in bfa_cb_sfp_state_query()
3657 if (sfp->portspeed) { in bfa_cb_sfp_state_query()
3658 sfp->status = bfa_sfp_speed_valid(sfp, sfp->portspeed); in bfa_cb_sfp_state_query()
3659 if (sfp->state_query_cbfn) in bfa_cb_sfp_state_query()
3660 sfp->state_query_cbfn(sfp->state_query_cbarg, in bfa_cb_sfp_state_query()
3661 sfp->status); in bfa_cb_sfp_state_query()
3662 sfp->portspeed = BFA_PORT_SPEED_UNKNOWN; in bfa_cb_sfp_state_query()
3665 sfp->state_query_lock = 0; in bfa_cb_sfp_state_query()
3666 sfp->state_query_cbfn = NULL; in bfa_cb_sfp_state_query()
3675 struct bfa_sfp_s *sfp = sfp_arg; in bfa_sfp_notify() local
3677 bfa_trc(sfp, event); in bfa_sfp_notify()
3678 bfa_trc(sfp, sfp->lock); in bfa_sfp_notify()
3679 bfa_trc(sfp, sfp->state_query_lock); in bfa_sfp_notify()
3684 if (sfp->lock) { in bfa_sfp_notify()
3685 sfp->status = BFA_STATUS_IOC_FAILURE; in bfa_sfp_notify()
3686 bfa_cb_sfp_show(sfp); in bfa_sfp_notify()
3689 if (sfp->state_query_lock) { in bfa_sfp_notify()
3690 sfp->status = BFA_STATUS_IOC_FAILURE; in bfa_sfp_notify()
3691 bfa_cb_sfp_state_query(sfp); in bfa_sfp_notify()
3704 bfa_sfp_scn_aen_post(struct bfa_sfp_s *sfp, struct bfi_sfp_scn_s *rsp) in bfa_sfp_scn_aen_post() argument
3706 struct bfad_s *bfad = (struct bfad_s *)sfp->ioc->bfa->bfad; in bfa_sfp_scn_aen_post()
3710 bfa_trc(sfp, (((u64)rsp->pomlvl) << 16) | (((u64)rsp->sfpid) << 8) | in bfa_sfp_scn_aen_post()
3717 aen_entry->aen_data.port.ioc_type = bfa_ioc_get_type(sfp->ioc); in bfa_sfp_scn_aen_post()
3718 aen_entry->aen_data.port.pwwn = sfp->ioc->attr->pwwn; in bfa_sfp_scn_aen_post()
3719 aen_entry->aen_data.port.mac = bfa_ioc_get_mac(sfp->ioc); in bfa_sfp_scn_aen_post()
3739 bfa_trc(sfp, rsp->event); in bfa_sfp_scn_aen_post()
3744 bfad_im_post_vendor_event(aen_entry, bfad, ++sfp->ioc->ioc_aen_seq, in bfa_sfp_scn_aen_post()
3752 bfa_sfp_getdata_send(struct bfa_sfp_s *sfp) in bfa_sfp_getdata_send() argument
3754 struct bfi_sfp_req_s *req = (struct bfi_sfp_req_s *)sfp->mbcmd.msg; in bfa_sfp_getdata_send()
3756 bfa_trc(sfp, req->memtype); in bfa_sfp_getdata_send()
3760 bfa_ioc_portid(sfp->ioc)); in bfa_sfp_getdata_send()
3763 bfa_ioc_mbox_queue(sfp->ioc, &sfp->mbcmd); in bfa_sfp_getdata_send()
3770 bfa_sfp_getdata(struct bfa_sfp_s *sfp, enum bfi_sfp_mem_e memtype) in bfa_sfp_getdata() argument
3772 struct bfi_sfp_req_s *req = (struct bfi_sfp_req_s *)sfp->mbcmd.msg; in bfa_sfp_getdata()
3774 WARN_ON(sfp->lock != 0); in bfa_sfp_getdata()
3775 bfa_trc(sfp, sfp->state); in bfa_sfp_getdata()
3777 sfp->lock = 1; in bfa_sfp_getdata()
3778 sfp->memtype = memtype; in bfa_sfp_getdata()
3782 bfa_alen_set(&req->alen, sizeof(struct sfp_mem_s), sfp->dbuf_pa); in bfa_sfp_getdata()
3784 bfa_sfp_getdata_send(sfp); in bfa_sfp_getdata()
3791 bfa_sfp_scn(struct bfa_sfp_s *sfp, struct bfi_mbmsg_s *msg) in bfa_sfp_scn() argument
3797 sfp->state = BFA_SFP_STATE_INSERTED; in bfa_sfp_scn()
3798 sfp->data_valid = 0; in bfa_sfp_scn()
3799 bfa_sfp_scn_aen_post(sfp, rsp); in bfa_sfp_scn()
3802 sfp->state = BFA_SFP_STATE_REMOVED; in bfa_sfp_scn()
3803 sfp->data_valid = 0; in bfa_sfp_scn()
3804 bfa_sfp_scn_aen_post(sfp, rsp); in bfa_sfp_scn()
3807 sfp->state = BFA_SFP_STATE_FAILED; in bfa_sfp_scn()
3808 sfp->data_valid = 0; in bfa_sfp_scn()
3809 bfa_sfp_scn_aen_post(sfp, rsp); in bfa_sfp_scn()
3812 sfp->state = BFA_SFP_STATE_UNSUPPORT; in bfa_sfp_scn()
3813 bfa_sfp_scn_aen_post(sfp, rsp); in bfa_sfp_scn()
3814 if (!sfp->lock) in bfa_sfp_scn()
3815 bfa_sfp_getdata(sfp, BFI_SFP_MEM_ALL); in bfa_sfp_scn()
3818 bfa_sfp_scn_aen_post(sfp, rsp); in bfa_sfp_scn()
3821 sfp->state = BFA_SFP_STATE_VALID; in bfa_sfp_scn()
3822 if (!sfp->lock) in bfa_sfp_scn()
3823 bfa_sfp_getdata(sfp, BFI_SFP_MEM_ALL); in bfa_sfp_scn()
3826 bfa_trc(sfp, rsp->event); in bfa_sfp_scn()
3835 bfa_sfp_show_comp(struct bfa_sfp_s *sfp, struct bfi_mbmsg_s *msg) in bfa_sfp_show_comp() argument
3839 if (!sfp->lock) { in bfa_sfp_show_comp()
3843 bfa_trc(sfp, sfp->lock); in bfa_sfp_show_comp()
3847 bfa_trc(sfp, rsp->status); in bfa_sfp_show_comp()
3849 sfp->data_valid = 1; in bfa_sfp_show_comp()
3850 if (sfp->state == BFA_SFP_STATE_VALID) in bfa_sfp_show_comp()
3851 sfp->status = BFA_STATUS_OK; in bfa_sfp_show_comp()
3852 else if (sfp->state == BFA_SFP_STATE_UNSUPPORT) in bfa_sfp_show_comp()
3853 sfp->status = BFA_STATUS_SFP_UNSUPP; in bfa_sfp_show_comp()
3855 bfa_trc(sfp, sfp->state); in bfa_sfp_show_comp()
3857 sfp->data_valid = 0; in bfa_sfp_show_comp()
3858 sfp->status = rsp->status; in bfa_sfp_show_comp()
3862 bfa_trc(sfp, sfp->memtype); in bfa_sfp_show_comp()
3863 if (sfp->memtype == BFI_SFP_MEM_DIAGEXT) { in bfa_sfp_show_comp()
3864 bfa_trc(sfp, sfp->data_valid); in bfa_sfp_show_comp()
3865 if (sfp->data_valid) { in bfa_sfp_show_comp()
3867 u8 *des = (u8 *)(sfp->sfpmem); in bfa_sfp_show_comp()
3868 memcpy(des, sfp->dbuf_kva, size); in bfa_sfp_show_comp()
3873 bfa_cb_sfp_show(sfp); in bfa_sfp_show_comp()
3875 sfp->lock = 0; in bfa_sfp_show_comp()
3877 bfa_trc(sfp, sfp->state_query_lock); in bfa_sfp_show_comp()
3878 if (sfp->state_query_lock) { in bfa_sfp_show_comp()
3879 sfp->state = rsp->state; in bfa_sfp_show_comp()
3881 bfa_cb_sfp_state_query(sfp); in bfa_sfp_show_comp()
3889 bfa_sfp_state_query(struct bfa_sfp_s *sfp) in bfa_sfp_state_query() argument
3891 struct bfi_sfp_req_s *req = (struct bfi_sfp_req_s *)sfp->mbcmd.msg; in bfa_sfp_state_query()
3894 WARN_ON(sfp->state != BFA_SFP_STATE_INIT); in bfa_sfp_state_query()
3895 WARN_ON(sfp->state_query_lock != 0); in bfa_sfp_state_query()
3896 bfa_trc(sfp, sfp->state); in bfa_sfp_state_query()
3898 sfp->state_query_lock = 1; in bfa_sfp_state_query()
3901 if (!sfp->lock) in bfa_sfp_state_query()
3902 bfa_sfp_getdata(sfp, BFI_SFP_MEM_ALL); in bfa_sfp_state_query()
3906 bfa_sfp_media_get(struct bfa_sfp_s *sfp) in bfa_sfp_media_get() argument
3908 enum bfa_defs_sfp_media_e *media = sfp->media; in bfa_sfp_media_get()
3912 if (sfp->state == BFA_SFP_STATE_UNSUPPORT) in bfa_sfp_media_get()
3914 else if (sfp->state == BFA_SFP_STATE_VALID) { in bfa_sfp_media_get()
3916 struct sfp_mem_s *sfpmem = (struct sfp_mem_s *)sfp->dbuf_kva; in bfa_sfp_media_get()
3921 bfa_trc(sfp, e10g.b); in bfa_sfp_media_get()
3922 bfa_trc(sfp, xmtr_tech); in bfa_sfp_media_get()
3946 bfa_trc(sfp, 0); in bfa_sfp_media_get()
3948 bfa_trc(sfp, sfp->state); in bfa_sfp_media_get()
3952 bfa_sfp_speed_valid(struct bfa_sfp_s *sfp, enum bfa_port_speed portspeed) in bfa_sfp_speed_valid() argument
3954 struct sfp_mem_s *sfpmem = (struct sfp_mem_s *)sfp->dbuf_kva; in bfa_sfp_speed_valid()
3963 bfa_trc(sfp, e10g.b); in bfa_sfp_speed_valid()
3974 bfa_trc(sfp, portspeed); in bfa_sfp_speed_valid()
3975 bfa_trc(sfp, fc3.b); in bfa_sfp_speed_valid()
3976 bfa_trc(sfp, e10g.b); in bfa_sfp_speed_valid()
3987 struct bfa_sfp_s *sfp = sfparg; in bfa_sfp_intr() local
3991 bfa_sfp_show_comp(sfp, msg); in bfa_sfp_intr()
3995 bfa_sfp_scn(sfp, msg); in bfa_sfp_intr()
3999 bfa_trc(sfp, msg->mh.msg_id); in bfa_sfp_intr()
4017 bfa_sfp_attach(struct bfa_sfp_s *sfp, struct bfa_ioc_s *ioc, void *dev, in bfa_sfp_attach() argument
4020 sfp->dev = dev; in bfa_sfp_attach()
4021 sfp->ioc = ioc; in bfa_sfp_attach()
4022 sfp->trcmod = trcmod; in bfa_sfp_attach()
4024 sfp->cbfn = NULL; in bfa_sfp_attach()
4025 sfp->cbarg = NULL; in bfa_sfp_attach()
4026 sfp->sfpmem = NULL; in bfa_sfp_attach()
4027 sfp->lock = 0; in bfa_sfp_attach()
4028 sfp->data_valid = 0; in bfa_sfp_attach()
4029 sfp->state = BFA_SFP_STATE_INIT; in bfa_sfp_attach()
4030 sfp->state_query_lock = 0; in bfa_sfp_attach()
4031 sfp->state_query_cbfn = NULL; in bfa_sfp_attach()
4032 sfp->state_query_cbarg = NULL; in bfa_sfp_attach()
4033 sfp->media = NULL; in bfa_sfp_attach()
4034 sfp->portspeed = BFA_PORT_SPEED_UNKNOWN; in bfa_sfp_attach()
4035 sfp->is_elb = BFA_FALSE; in bfa_sfp_attach()
4037 bfa_ioc_mbox_regisr(sfp->ioc, BFI_MC_SFP, bfa_sfp_intr, sfp); in bfa_sfp_attach()
4038 bfa_q_qe_init(&sfp->ioc_notify); in bfa_sfp_attach()
4039 bfa_ioc_notify_init(&sfp->ioc_notify, bfa_sfp_notify, sfp); in bfa_sfp_attach()
4040 list_add_tail(&sfp->ioc_notify.qe, &sfp->ioc->notify_q); in bfa_sfp_attach()
4047 bfa_sfp_memclaim(struct bfa_sfp_s *sfp, u8 *dm_kva, u64 dm_pa) in bfa_sfp_memclaim() argument
4049 sfp->dbuf_kva = dm_kva; in bfa_sfp_memclaim()
4050 sfp->dbuf_pa = dm_pa; in bfa_sfp_memclaim()
4051 memset(sfp->dbuf_kva, 0, sizeof(struct sfp_mem_s)); in bfa_sfp_memclaim()
4066 bfa_sfp_show(struct bfa_sfp_s *sfp, struct sfp_mem_s *sfpmem, in bfa_sfp_show() argument
4070 if (!bfa_ioc_is_operational(sfp->ioc)) { in bfa_sfp_show()
4071 bfa_trc(sfp, 0); in bfa_sfp_show()
4075 if (sfp->lock) { in bfa_sfp_show()
4076 bfa_trc(sfp, 0); in bfa_sfp_show()
4080 sfp->cbfn = cbfn; in bfa_sfp_show()
4081 sfp->cbarg = cbarg; in bfa_sfp_show()
4082 sfp->sfpmem = sfpmem; in bfa_sfp_show()
4084 bfa_sfp_getdata(sfp, BFI_SFP_MEM_DIAGEXT); in bfa_sfp_show()
4097 bfa_sfp_media(struct bfa_sfp_s *sfp, enum bfa_defs_sfp_media_e *media, in bfa_sfp_media() argument
4100 if (!bfa_ioc_is_operational(sfp->ioc)) { in bfa_sfp_media()
4101 bfa_trc(sfp, 0); in bfa_sfp_media()
4105 sfp->media = media; in bfa_sfp_media()
4106 if (sfp->state == BFA_SFP_STATE_INIT) { in bfa_sfp_media()
4107 if (sfp->state_query_lock) { in bfa_sfp_media()
4108 bfa_trc(sfp, 0); in bfa_sfp_media()
4111 sfp->state_query_cbfn = cbfn; in bfa_sfp_media()
4112 sfp->state_query_cbarg = cbarg; in bfa_sfp_media()
4113 bfa_sfp_state_query(sfp); in bfa_sfp_media()
4118 bfa_sfp_media_get(sfp); in bfa_sfp_media()
4130 bfa_sfp_speed(struct bfa_sfp_s *sfp, enum bfa_port_speed portspeed, in bfa_sfp_speed() argument
4135 if (!bfa_ioc_is_operational(sfp->ioc)) in bfa_sfp_speed()
4139 if (bfa_mfg_is_mezz(sfp->ioc->attr->card_type)) in bfa_sfp_speed()
4143 sfp->portspeed = portspeed; in bfa_sfp_speed()
4144 if (sfp->state == BFA_SFP_STATE_INIT) { in bfa_sfp_speed()
4145 if (sfp->state_query_lock) { in bfa_sfp_speed()
4146 bfa_trc(sfp, 0); in bfa_sfp_speed()
4149 sfp->state_query_cbfn = cbfn; in bfa_sfp_speed()
4150 sfp->state_query_cbarg = cbarg; in bfa_sfp_speed()
4151 bfa_sfp_state_query(sfp); in bfa_sfp_speed()
4156 if (sfp->state == BFA_SFP_STATE_REMOVED || in bfa_sfp_speed()
4157 sfp->state == BFA_SFP_STATE_FAILED) { in bfa_sfp_speed()
4158 bfa_trc(sfp, sfp->state); in bfa_sfp_speed()
4162 if (sfp->state == BFA_SFP_STATE_INSERTED) { in bfa_sfp_speed()
4163 bfa_trc(sfp, sfp->state); in bfa_sfp_speed()
4168 if (sfp->is_elb) in bfa_sfp_speed()
4171 return bfa_sfp_speed_valid(sfp, portspeed); in bfa_sfp_speed()