static void WCTS_NotifyCallback ( void *data, unsigned event ) { wpt_msg *palMsg; WCTS_ControlBlockType* pWCTSCb = (WCTS_ControlBlockType*) data; /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /*-------------------------------------------------------------------- Sanity check --------------------------------------------------------------------*/ if (WCTS_CB_MAGIC != pWCTSCb->wctsMagic) { WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s: Received unexpected SMD event %u", __func__, event); /* TODO_PRIMA what error recovery options do we have? */ return; } /* Serialize processing in the control thread */ switch (event) { case SMD_EVENT_OPEN: WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO, "%s: received SMD_EVENT_OPEN from SMD", __func__); /* If the prev state was 'remote closed' then it is a Riva 'restart', * subsystem restart re-init */ if (WCTS_STATE_REM_CLOSED == pWCTSCb->wctsState) { WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO, "%s: received SMD_EVENT_OPEN in WCTS_STATE_REM_CLOSED state", __func__); /* call subsystem restart re-init function */ wpalDriverReInit(); return; } palMsg = &pWCTSCb->wctsOpenMsg; break; case SMD_EVENT_DATA: if (WCTS_STATE_REM_CLOSED == pWCTSCb->wctsState) { WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s: received SMD data when the state is remote closed ", __func__); /* we should not be getting any data now */ return; } WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO, "%s: received SMD_EVENT_DATA from SMD", __func__); palMsg = &pWCTSCb->wctsDataMsg; break; case SMD_EVENT_CLOSE: WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO, "%s: received SMD_EVENT_CLOSE from SMD", __func__); /* SMD channel was closed from the remote side, * this would happen only when Riva crashed and SMD is * closing the channel on behalf of Riva */ pWCTSCb->wctsState = WCTS_STATE_REM_CLOSED; WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO, "%s: received SMD_EVENT_CLOSE WLAN driver going down now", __func__); /* subsystem restart: shutdown */ wpalDriverShutdown(); return; case SMD_EVENT_STATUS: WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO, "%s: received SMD_EVENT_STATUS from SMD", __func__); return; case SMD_EVENT_REOPEN_READY: WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s: received SMD_EVENT_REOPEN_READY from SMD", __func__); /* unlike other events which occur when our kernel threads are running, this one is received when the threads are closed and the rmmod thread is waiting. so just unblock that thread */ wpalEventSet(&pWCTSCb->wctsEvent); return; default: WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s: Unexpected event %u received from SMD", __func__, event); return; } /* serialize this event */ wpalPostCtrlMsg(WDI_GET_PAL_CTX(), palMsg); } /*WCTS_NotifyCallback*/
static void WCTS_NotifyCallback ( void *data, unsigned event ) { wpt_msg *palMsg; WCTS_ControlBlockType* pWCTSCb = (WCTS_ControlBlockType*) data; if (WCTS_CB_MAGIC != pWCTSCb->wctsMagic) { WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s: Received unexpected SMD event %u", __func__, event); return; } switch (event) { case SMD_EVENT_OPEN: WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO, "%s: received SMD_EVENT_OPEN from SMD", __func__); if (WCTS_STATE_REM_CLOSED == pWCTSCb->wctsState) { WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO, "%s: received SMD_EVENT_OPEN in WCTS_STATE_REM_CLOSED state", __func__); wpalDriverReInit(); return; } palMsg = &pWCTSCb->wctsOpenMsg; break; case SMD_EVENT_DATA: if (WCTS_STATE_REM_CLOSED == pWCTSCb->wctsState) { WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s: received SMD data when the state is remote closed ", __func__); return; } WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO, "%s: received SMD_EVENT_DATA from SMD", __func__); palMsg = &pWCTSCb->wctsDataMsg; break; case SMD_EVENT_CLOSE: WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO, "%s: received SMD_EVENT_CLOSE from SMD", __func__); pWCTSCb->wctsState = WCTS_STATE_REM_CLOSED; WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO, "%s: received SMD_EVENT_CLOSE WLAN driver going down now", __func__); wpalDriverShutdown(); return; case SMD_EVENT_STATUS: WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO, "%s: received SMD_EVENT_STATUS from SMD", __func__); return; case SMD_EVENT_REOPEN_READY: WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s: received SMD_EVENT_REOPEN_READY from SMD", __func__); wpalEventSet(&pWCTSCb->wctsEvent); return; default: WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s: Unexpected event %u received from SMD", __func__, event); return; } wpalPostCtrlMsg(WDI_GET_PAL_CTX(), palMsg); }