/*----------------------------------------------------------------------------*/ int mtk_cfg80211_join_ibss ( struct wiphy *wiphy, struct net_device *ndev, struct cfg80211_ibss_params *params ) { PARAM_SSID_T rNewSsid; P_GLUE_INFO_T prGlueInfo = NULL; UINT_32 u4ChnlFreq; /* Store channel or frequency information */ UINT_32 u4BufLen = 0; WLAN_STATUS rStatus; prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); ASSERT(prGlueInfo); /* set channel */ if(params->channel) { u4ChnlFreq = nicChannelNum2Freq(params->channel->hw_value); rStatus = kalIoctl(prGlueInfo, wlanoidSetFrequency, &u4ChnlFreq, sizeof(u4ChnlFreq), FALSE, FALSE, FALSE, FALSE, &u4BufLen); if (rStatus != WLAN_STATUS_SUCCESS) { return -EFAULT; } } /* set SSID */ kalMemCopy(rNewSsid.aucSsid, params->ssid, params->ssid_len); rStatus = kalIoctl(prGlueInfo, wlanoidSetSsid, (PVOID) &rNewSsid, sizeof(PARAM_SSID_T), FALSE, FALSE, TRUE, FALSE, &u4BufLen); if (rStatus != WLAN_STATUS_SUCCESS) { DBGLOG(REQ, WARN, ("set SSID:%lx\n", rStatus)); return -EFAULT; } return 0; return -EINVAL; }
VOID kalP2PIndicateRxMgmtFrame(IN P_GLUE_INFO_T prGlueInfo, IN P_SW_RFB_T prSwRfb) { #define DBG_P2P_MGMT_FRAME_INDICATION 0 P_GL_P2P_INFO_T prGlueP2pInfo = (P_GL_P2P_INFO_T) NULL; INT_32 i4Freq = 0; UINT_8 ucChnlNum = 0; #if DBG_P2P_MGMT_FRAME_INDICATION P_WLAN_MAC_HEADER_T prWlanHeader = (P_WLAN_MAC_HEADER_T) NULL; #endif do { if ((prGlueInfo == NULL) || (prSwRfb == NULL)) { ASSERT(FALSE); break; } prGlueP2pInfo = prGlueInfo->prP2PInfo; ucChnlNum = prSwRfb->prHifRxHdr->ucHwChannelNum; #if DBG_P2P_MGMT_FRAME_INDICATION prWlanHeader = (P_WLAN_MAC_HEADER_T) prSwRfb->pvHeader; switch (prWlanHeader->u2FrameCtrl) { case MAC_FRAME_PROBE_REQ: DBGLOG(P2P, TRACE, "RX Probe Req at channel %d ", ucChnlNum); break; case MAC_FRAME_PROBE_RSP: DBGLOG(P2P, TRACE, "RX Probe Rsp at channel %d ", ucChnlNum); break; case MAC_FRAME_ACTION: DBGLOG(P2P, TRACE, "RX Action frame at channel %d ", ucChnlNum); break; default: DBGLOG(P2P, TRACE, "RX Packet:%d at channel %d ", prWlanHeader->u2FrameCtrl, ucChnlNum); break; } DBGLOG(P2P, TRACE, "from: %pM\n", prWlanHeader->aucAddr2); #endif i4Freq = nicChannelNum2Freq(ucChnlNum) / 1000; cfg80211_rx_mgmt(prGlueP2pInfo->prWdev, /* struct net_device * dev, */ i4Freq, RCPI_TO_dBm(prSwRfb->prHifRxHdr->ucRcpi), prSwRfb->pvHeader, prSwRfb->u2PacketLen, GFP_ATOMIC); } while (FALSE); } /* kalP2PIndicateRxMgmtFrame */
/*----------------------------------------------------------------------------*/ int mtk_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev, struct cfg80211_ibss_params *params) { PARAM_SSID_T rNewSsid; P_GLUE_INFO_T prGlueInfo = NULL; UINT_32 u4ChnlFreq; /* Store channel or frequency information */ UINT_32 u4BufLen = 0; WLAN_STATUS rStatus; prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); ASSERT(prGlueInfo); /* set channel */ #if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 7, 0) if (params->channel) { u4ChnlFreq = nicChannelNum2Freq(params->channel->hw_value); #else if (params->chandef.chan) { u4ChnlFreq = nicChannelNum2Freq(params->chandef.chan->hw_value); #endif rStatus = kalIoctl(prGlueInfo, wlanoidSetFrequency, &u4ChnlFreq, sizeof(u4ChnlFreq), FALSE, FALSE, FALSE, FALSE, &u4BufLen); if (rStatus != WLAN_STATUS_SUCCESS) { return -EFAULT; } } /* set SSID */ kalMemCopy(rNewSsid.aucSsid, params->ssid, params->ssid_len); rStatus = kalIoctl(prGlueInfo, wlanoidSetSsid, (PVOID) & rNewSsid, sizeof(PARAM_SSID_T), FALSE, FALSE, TRUE, FALSE, &u4BufLen); if (rStatus != WLAN_STATUS_SUCCESS) { DBGLOG(REQ, WARN, ("set SSID:%lx\n", rStatus)); return -EFAULT; } return 0; return -EINVAL; } /*----------------------------------------------------------------------------*/ /*! * @brief This routine is responsible for requesting to leave from IBSS group * * @param * * @retval 0: successful * others: failure */ /*----------------------------------------------------------------------------*/ int mtk_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *ndev) { P_GLUE_INFO_T prGlueInfo = NULL; WLAN_STATUS rStatus; UINT_32 u4BufLen; prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); ASSERT(prGlueInfo); rStatus = kalIoctl(prGlueInfo, wlanoidSetDisassociate, NULL, 0, FALSE, FALSE, TRUE, FALSE, &u4BufLen); if (rStatus != WLAN_STATUS_SUCCESS) { DBGLOG(REQ, WARN, ("disassociate error:%lx\n", rStatus)); return -EFAULT; } return 0; }
VOID kalP2PIndicateRxMgmtFrame(IN P_GLUE_INFO_T prGlueInfo, IN P_SW_RFB_T prSwRfb, IN BOOLEAN fgIsDevInterface, IN UINT_8 ucRoleIdx) { #define DBG_P2P_MGMT_FRAME_INDICATION 1 P_GL_P2P_INFO_T prGlueP2pInfo = (P_GL_P2P_INFO_T) NULL; INT_32 i4Freq = 0; UINT_8 ucChnlNum = 0; #if DBG_P2P_MGMT_FRAME_INDICATION P_WLAN_MAC_HEADER_T prWlanHeader = (P_WLAN_MAC_HEADER_T) NULL; #endif do { if ((prGlueInfo == NULL) || (prSwRfb == NULL)) { ASSERT(FALSE); break; } prGlueP2pInfo = prGlueInfo->prP2PInfo; /* ToDo[6630]: Get the following by chnnel freq */ /* HAL_RX_STATUS_GET_CHAN_FREQ( prSwRfb->prRxStatus) */ /* ucChnlNum = prSwRfb->prHifRxHdr->ucHwChannelNum; */ ucChnlNum = HAL_RX_STATUS_GET_CHNL_NUM(prSwRfb->prRxStatus); #if DBG_P2P_MGMT_FRAME_INDICATION prWlanHeader = (P_WLAN_MAC_HEADER_T) prSwRfb->pvHeader; switch (prWlanHeader->u2FrameCtrl) { case MAC_FRAME_PROBE_REQ: DBGLOG(P2P, TRACE, ("RX Probe Req at channel %d ", ucChnlNum)); break; case MAC_FRAME_PROBE_RSP: DBGLOG(P2P, TRACE, ("RX Probe Rsp at channel %d ", ucChnlNum)); break; case MAC_FRAME_ACTION: DBGLOG(P2P, TRACE, ("RX Action frame at channel %d ", ucChnlNum)); break; default: DBGLOG(P2P, TRACE, ("RX Packet:%d at channel %d ", prWlanHeader->u2FrameCtrl, ucChnlNum)); break; } DBGLOG(P2P, TRACE, ("from: " MACSTR "\n", MAC2STR(prWlanHeader->aucAddr2))); #endif i4Freq = nicChannelNum2Freq(ucChnlNum) / 1000; #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) cfg80211_rx_mgmt(&prGlueP2pInfo->wdev, /* struct net_device * dev, */ #else cfg80211_rx_mgmt((fgIsDevInterface) ? prGlueP2pInfo->prDevHandler : prGlueP2pInfo->aprRoleHandler[ucRoleIdx], /* struct net_device * dev, */ #endif /* LINUX_VERSION_CODE */ i4Freq, RCPI_TO_dBm(HAL_RX_STATUS_GET_RCPI(prSwRfb->prRxStatusGroup3)), prSwRfb->pvHeader, prSwRfb->u2PacketLen, GFP_ATOMIC); #else cfg80211_rx_mgmt((fgIsDevInterface) ? prGlueP2pInfo->prDevHandler : prGlueP2pInfo->aprRoleHandler[ucRoleIdx], /* struct net_device * dev, */ i4Freq, prSwRfb->pvHeader, prSwRfb->u2PacketLen, GFP_ATOMIC); #endif } while (FALSE); } /* kalP2PIndicateRxMgmtFrame */