mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2024-11-10 15:39:38 +00:00
rtl8188eu: Remove dead code for FREEBSD
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
a68c6cc26e
commit
dd606233f2
22 changed files with 6 additions and 2326 deletions
270
core/rtw_mlme.c
270
core/rtw_mlme.c
|
@ -288,17 +288,6 @@ _func_enter_;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
//i think needs to check again
|
|
||||||
delta_time = (curr_time -pnetwork->last_scanned)/hz;
|
|
||||||
|
|
||||||
if(delta_time < lifetime)// unit:sec
|
|
||||||
{
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,7 +514,6 @@ _func_exit_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef PLATFORM_FREEBSD //Baron
|
|
||||||
static struct wlan_network *rtw_dequeue_network(_queue *queue)
|
static struct wlan_network *rtw_dequeue_network(_queue *queue)
|
||||||
{
|
{
|
||||||
struct wlan_network *pnetwork;
|
struct wlan_network *pnetwork;
|
||||||
|
@ -534,7 +522,6 @@ _func_enter_;
|
||||||
_func_exit_;
|
_func_exit_;
|
||||||
return pnetwork;
|
return pnetwork;
|
||||||
}
|
}
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
struct wlan_network *rtw_alloc_network(struct mlme_priv *pmlmepriv );
|
struct wlan_network *rtw_alloc_network(struct mlme_priv *pmlmepriv );
|
||||||
struct wlan_network *rtw_alloc_network(struct mlme_priv *pmlmepriv )//(_queue *free_queue)
|
struct wlan_network *rtw_alloc_network(struct mlme_priv *pmlmepriv )//(_queue *free_queue)
|
||||||
|
@ -2458,25 +2445,6 @@ void _rtw_join_timeout_handler (_adapter *adapter)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_func_enter_;
|
_func_enter_;
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
rtw_mtx_lock(NULL);
|
|
||||||
if (callout_pending(&adapter->mlmepriv.assoc_timer.callout)) {
|
|
||||||
/* callout was reset */
|
|
||||||
//mtx_unlock(&sc->sc_mtx);
|
|
||||||
rtw_mtx_unlock(NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!callout_active(&adapter->mlmepriv.assoc_timer.callout)) {
|
|
||||||
/* callout was stopped */
|
|
||||||
//mtx_unlock(&sc->sc_mtx);
|
|
||||||
rtw_mtx_unlock(NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
callout_deactivate(&adapter->mlmepriv.assoc_timer.callout);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DBG_871X("%s, fw_state=%x\n", __FUNCTION__, get_fwstate(pmlmepriv));
|
DBG_871X("%s, fw_state=%x\n", __FUNCTION__, get_fwstate(pmlmepriv));
|
||||||
|
|
||||||
if(adapter->bDriverStopped ||adapter->bSurpriseRemoved)
|
if(adapter->bDriverStopped ||adapter->bSurpriseRemoved)
|
||||||
|
@ -2530,9 +2498,6 @@ _func_enter_;
|
||||||
#ifdef CONFIG_DRVEXT_MODULE_WSC
|
#ifdef CONFIG_DRVEXT_MODULE_WSC
|
||||||
drvext_assoc_fail_indicate(&adapter->drvextpriv);
|
drvext_assoc_fail_indicate(&adapter->drvextpriv);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
rtw_mtx_unlock(NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_func_exit_;
|
_func_exit_;
|
||||||
|
|
||||||
|
@ -2769,7 +2734,6 @@ void rtw_event_polling_timer_hdl(_adapter *adapter)
|
||||||
#define RTW_SCAN_RESULT_EXPIRE 2000
|
#define RTW_SCAN_RESULT_EXPIRE 2000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PLATFORM_FREEBSD
|
|
||||||
/*
|
/*
|
||||||
* Select a new join candidate from the original @param candidate and @param competitor
|
* Select a new join candidate from the original @param candidate and @param competitor
|
||||||
* @return _TRUE: candidate is updated
|
* @return _TRUE: candidate is updated
|
||||||
|
@ -2814,46 +2778,6 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv
|
||||||
updated = _TRUE;
|
updated = _TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
if(pmlmepriv->assoc_by_bssid==_TRUE) { // associate with bssid
|
|
||||||
if( (*candidate == NULL ||(*candidate)->network.Rssi<competitor->network.Rssi )
|
|
||||||
&& _rtw_memcmp(competitor->network.MacAddress, pmlmepriv->assoc_bssid, ETH_ALEN)==_TRUE
|
|
||||||
) {
|
|
||||||
*candidate = competitor;
|
|
||||||
updated = _TRUE;
|
|
||||||
}
|
|
||||||
} else if (pmlmepriv->assoc_ssid.SsidLength == 0 ) { // associate with ssid, but ssidlength is 0
|
|
||||||
if( (*candidate == NULL ||(*candidate)->network.Rssi<competitor->network.Rssi ) ) {
|
|
||||||
*candidate = competitor;
|
|
||||||
updated = _TRUE;
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
#ifdef CONFIG_LAYER2_ROAMING
|
|
||||||
if(rtw_to_roaming(adapter)) { // roaming
|
|
||||||
if( (*candidate == NULL ||(*candidate)->network.Rssi<competitor->network.Rssi )
|
|
||||||
&& is_same_ess(&competitor->network, &pmlmepriv->cur_network.network)
|
|
||||||
//&&(!is_same_network(&competitor->network, &pmlmepriv->cur_network.network))
|
|
||||||
&& rtw_get_passing_time_ms((u32)competitor->last_scanned) < RTW_SCAN_RESULT_EXPIRE
|
|
||||||
&& rtw_is_desired_network(adapter, competitor)
|
|
||||||
) {
|
|
||||||
*candidate = competitor;
|
|
||||||
updated = _TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{ // associate with ssid
|
|
||||||
if( (*candidate == NULL ||(*candidate)->network.Rssi<competitor->network.Rssi )
|
|
||||||
&& (competitor->network.Ssid.SsidLength==pmlmepriv->assoc_ssid.SsidLength)
|
|
||||||
&&((_rtw_memcmp(competitor->network.Ssid.Ssid, pmlmepriv->assoc_ssid.Ssid, pmlmepriv->assoc_ssid.SsidLength)) == _TRUE)
|
|
||||||
&& rtw_is_desired_network(adapter, competitor)
|
|
||||||
) {
|
|
||||||
*candidate = competitor;
|
|
||||||
updated = _TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(updated){
|
if(updated){
|
||||||
DBG_871X("[by_bssid:%u][assoc_ssid:%s]"
|
DBG_871X("[by_bssid:%u][assoc_ssid:%s]"
|
||||||
#ifdef CONFIG_LAYER2_ROAMING
|
#ifdef CONFIG_LAYER2_ROAMING
|
||||||
|
@ -2984,200 +2908,6 @@ _func_exit_;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv )
|
|
||||||
{
|
|
||||||
_irqL irqL;
|
|
||||||
_list *phead;
|
|
||||||
#ifdef CONFIG_ANTENNA_DIVERSITY
|
|
||||||
u8 CurrentAntenna;
|
|
||||||
#endif
|
|
||||||
unsigned char *dst_ssid, *src_ssid;
|
|
||||||
_adapter *adapter;
|
|
||||||
_queue *queue = &(pmlmepriv->scanned_queue);
|
|
||||||
struct wlan_network *pnetwork = NULL;
|
|
||||||
struct wlan_network *pnetwork_max_rssi = NULL;
|
|
||||||
#ifdef CONFIG_LAYER2_ROAMING
|
|
||||||
struct wlan_network * roaming_candidate=NULL;
|
|
||||||
u32 cur_time=rtw_get_current_time();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_func_enter_;
|
|
||||||
_enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
|
|
||||||
phead = get_list_head(queue);
|
|
||||||
adapter = (_adapter *)pmlmepriv->nic_hdl;
|
|
||||||
|
|
||||||
pmlmepriv->pscanned = get_next( phead );
|
|
||||||
|
|
||||||
while (!rtw_end_of_queue_search(phead, pmlmepriv->pscanned)) {
|
|
||||||
|
|
||||||
pnetwork = LIST_CONTAINOR(pmlmepriv->pscanned, struct wlan_network, list);
|
|
||||||
if(pnetwork==NULL){
|
|
||||||
RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("(2)rtw_select_and_join_from_scanned_queue return _FAIL:(pnetwork==NULL)\n"));
|
|
||||||
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
|
|
||||||
return _FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
dst_ssid = pnetwork->network.Ssid.Ssid;
|
|
||||||
src_ssid = pmlmepriv->assoc_ssid.Ssid;
|
|
||||||
|
|
||||||
pmlmepriv->pscanned = get_next(pmlmepriv->pscanned);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
DBG_871X("MacAddress:"MAC_FMT" ssid:%s\n", MAC_ARG(pnetwork->network.MacAddress), pnetwork->network.Ssid.Ssid);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(pmlmepriv->assoc_by_bssid==_TRUE)
|
|
||||||
{
|
|
||||||
if(_rtw_memcmp(pnetwork->network.MacAddress, pmlmepriv->assoc_bssid, ETH_ALEN)==_TRUE)
|
|
||||||
{
|
|
||||||
//remove the condition @ 20081125
|
|
||||||
//if((pmlmepriv->cur_network.network.InfrastructureMode==Ndis802_11AutoUnknown)||
|
|
||||||
// pmlmepriv->cur_network.network.InfrastructureMode == pnetwork->network.InfrastructureMode)
|
|
||||||
// goto ask_for_joinbss;
|
|
||||||
|
|
||||||
if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
|
|
||||||
{
|
|
||||||
if(is_same_network(&pmlmepriv->cur_network.network, &pnetwork->network), 0)
|
|
||||||
{
|
|
||||||
//DBG_871X("select_and_join(1): _FW_LINKED and is same network, it needn't join again\n");
|
|
||||||
|
|
||||||
rtw_indicate_connect(adapter);//rtw_indicate_connect again
|
|
||||||
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rtw_disassoc_cmd(adapter, 0, _TRUE);
|
|
||||||
rtw_indicate_disconnect(adapter);
|
|
||||||
rtw_free_assoc_resources(adapter, 0);
|
|
||||||
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
|
|
||||||
goto ask_for_joinbss;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
|
|
||||||
goto ask_for_joinbss;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (pmlmepriv->assoc_ssid.SsidLength == 0) {
|
|
||||||
goto ask_for_joinbss;//anyway, join first selected(dequeued) pnetwork if ssid_len=0
|
|
||||||
|
|
||||||
#ifdef CONFIG_LAYER2_ROAMING
|
|
||||||
} else if (rtw_to_roaming(adapter) > 0) {
|
|
||||||
|
|
||||||
if( (roaming_candidate == NULL ||roaming_candidate->network.Rssi<pnetwork->network.Rssi )
|
|
||||||
&& is_same_ess(&pnetwork->network, &pmlmepriv->cur_network.network)
|
|
||||||
//&&(!is_same_network(&pnetwork->network, &pmlmepriv->cur_network.network, 0))
|
|
||||||
&& rtw_get_time_interval_ms((u32)pnetwork->last_scanned,cur_time) < 5000
|
|
||||||
) {
|
|
||||||
roaming_candidate = pnetwork;
|
|
||||||
//RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,
|
|
||||||
DBG_871X
|
|
||||||
("roaming_candidate???: %s("MAC_FMT")\n",
|
|
||||||
roaming_candidate->network.Ssid.Ssid, MAC_ARG(roaming_candidate->network.MacAddress) )
|
|
||||||
//)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} else if ( (pnetwork->network.Ssid.SsidLength==pmlmepriv->assoc_ssid.SsidLength)
|
|
||||||
&&((_rtw_memcmp(dst_ssid, src_ssid, pmlmepriv->assoc_ssid.SsidLength)) == _TRUE)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("dst_ssid=%s, src_ssid=%s \n", dst_ssid, src_ssid));
|
|
||||||
#ifdef CONFIG_ANTENNA_DIVERSITY
|
|
||||||
rtw_hal_get_def_var(adapter, HAL_DEF_CURRENT_ANTENNA, &(CurrentAntenna));
|
|
||||||
DBG_871X("#### dst_ssid=(%s) Opt_Ant_(%s) , cur_Ant(%s)\n", dst_ssid,
|
|
||||||
(2==pnetwork->network.PhyInfo.Optimum_antenna)?"A":"B",
|
|
||||||
(2==CurrentAntenna)?"A":"B");
|
|
||||||
#endif
|
|
||||||
//remove the condition @ 20081125
|
|
||||||
//if((pmlmepriv->cur_network.network.InfrastructureMode==Ndis802_11AutoUnknown)||
|
|
||||||
// pmlmepriv->cur_network.network.InfrastructureMode == pnetwork->network.InfrastructureMode)
|
|
||||||
//{
|
|
||||||
// _rtw_memcpy(pmlmepriv->assoc_bssid, pnetwork->network.MacAddress, ETH_ALEN);
|
|
||||||
// goto ask_for_joinbss;
|
|
||||||
//}
|
|
||||||
|
|
||||||
if(pmlmepriv->assoc_by_rssi==_TRUE)//if the ssid is the same, select the bss which has the max rssi
|
|
||||||
{
|
|
||||||
if( NULL==pnetwork_max_rssi|| pnetwork->network.Rssi > pnetwork_max_rssi->network.Rssi)
|
|
||||||
pnetwork_max_rssi = pnetwork;
|
|
||||||
}
|
|
||||||
else if(rtw_is_desired_network(adapter, pnetwork) == _TRUE)
|
|
||||||
{
|
|
||||||
if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
if(is_same_network(&pmlmepriv->cur_network.network, &pnetwork->network, 0))
|
|
||||||
{
|
|
||||||
DBG_871X("select_and_join(2): _FW_LINKED and is same network, it needn't join again\n");
|
|
||||||
|
|
||||||
rtw_indicate_connect(adapter);//rtw_indicate_connect again
|
|
||||||
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
rtw_disassoc_cmd(adapter, 0, _TRUE);
|
|
||||||
//rtw_indicate_disconnect(adapter);//
|
|
||||||
rtw_free_assoc_resources(adapter, 0);
|
|
||||||
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
|
|
||||||
goto ask_for_joinbss;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
|
|
||||||
goto ask_for_joinbss;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
|
|
||||||
#ifdef CONFIG_LAYER2_ROAMING
|
|
||||||
if(rtw_to_roaming(adapter) > 0 && roaming_candidate ){
|
|
||||||
pnetwork=roaming_candidate;
|
|
||||||
DBG_871X("select_and_join_from_scanned_queue: roaming_candidate: %s("MAC_FMT")\n",
|
|
||||||
pnetwork->network.Ssid.Ssid, MAC_ARG(pnetwork->network.MacAddress));
|
|
||||||
goto ask_for_joinbss;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if((pmlmepriv->assoc_by_rssi==_TRUE) && (pnetwork_max_rssi!=NULL))
|
|
||||||
{
|
|
||||||
pnetwork = pnetwork_max_rssi;
|
|
||||||
DBG_871X("select_and_join_from_scanned_queue: pnetwork_max_rssi: %s("MAC_FMT")\n",
|
|
||||||
pnetwork->network.Ssid.Ssid, MAC_ARG(pnetwork->network.MacAddress));
|
|
||||||
goto ask_for_joinbss;
|
|
||||||
}
|
|
||||||
|
|
||||||
DBG_871X("(1)rtw_select_and_join_from_scanned_queue return _FAIL\n");
|
|
||||||
|
|
||||||
_func_exit_;
|
|
||||||
|
|
||||||
return _FAIL;
|
|
||||||
|
|
||||||
ask_for_joinbss:
|
|
||||||
|
|
||||||
_func_exit_;
|
|
||||||
|
|
||||||
return rtw_joinbss_cmd(adapter, pnetwork);
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
|
|
||||||
sint rtw_set_auth(_adapter * adapter,struct security_priv *psecuritypriv)
|
sint rtw_set_auth(_adapter * adapter,struct security_priv *psecuritypriv)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10979,26 +10979,6 @@ void survey_timer_hdl(_adapter *padapter)
|
||||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||||
#ifdef CONFIG_P2P
|
#ifdef CONFIG_P2P
|
||||||
struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
|
struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
|
||||||
#endif
|
|
||||||
|
|
||||||
//DBG_871X("marc: survey timer\n");
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
rtw_mtx_lock(NULL);
|
|
||||||
if (callout_pending(&padapter->mlmeextpriv.survey_timer.callout)) {
|
|
||||||
/* callout was reset */
|
|
||||||
//mtx_unlock(&sc->sc_mtx);
|
|
||||||
rtw_mtx_unlock(NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!callout_active(&padapter->mlmeextpriv.survey_timer.callout)) {
|
|
||||||
/* callout was stopped */
|
|
||||||
//mtx_unlock(&sc->sc_mtx);
|
|
||||||
rtw_mtx_unlock(NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
callout_deactivate(&padapter->mlmeextpriv.survey_timer.callout);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//issue rtw_sitesurvey_cmd
|
//issue rtw_sitesurvey_cmd
|
||||||
|
@ -11053,10 +11033,6 @@ void survey_timer_hdl(_adapter *padapter)
|
||||||
|
|
||||||
|
|
||||||
exit_survey_timer_hdl:
|
exit_survey_timer_hdl:
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
rtw_mtx_unlock(NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11069,25 +11045,6 @@ void link_timer_hdl(_adapter *padapter)
|
||||||
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
||||||
//struct sta_priv *pstapriv = &padapter->stapriv;
|
//struct sta_priv *pstapriv = &padapter->stapriv;
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
rtw_mtx_lock(NULL);
|
|
||||||
if (callout_pending(&padapter->mlmeextpriv.survey_timer.callout)) {
|
|
||||||
/* callout was reset */
|
|
||||||
//mtx_unlock(&sc->sc_mtx);
|
|
||||||
rtw_mtx_unlock(NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!callout_active(&padapter->mlmeextpriv.survey_timer.callout)) {
|
|
||||||
/* callout was stopped */
|
|
||||||
//mtx_unlock(&sc->sc_mtx);
|
|
||||||
rtw_mtx_unlock(NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
callout_deactivate(&padapter->mlmeextpriv.survey_timer.callout);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (pmlmeinfo->state & WIFI_FW_AUTH_NULL)
|
if (pmlmeinfo->state & WIFI_FW_AUTH_NULL)
|
||||||
{
|
{
|
||||||
DBG_871X("link_timer_hdl:no beacon while connecting\n");
|
DBG_871X("link_timer_hdl:no beacon while connecting\n");
|
||||||
|
@ -11194,10 +11151,6 @@ void link_timer_hdl(_adapter *padapter)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
rtw_mtx_unlock(NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -204,7 +204,6 @@ exit:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (PLATFORM_LINUX)||defined (PLATFORM_FREEBSD)
|
|
||||||
void rtw_ps_processor(_adapter*padapter)
|
void rtw_ps_processor(_adapter*padapter)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_P2P
|
#ifdef CONFIG_P2P
|
||||||
|
@ -333,15 +332,11 @@ exit:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pwr_state_check_handler(void *FunctionContext);
|
|
||||||
void pwr_state_check_handler(void *FunctionContext)
|
void pwr_state_check_handler(void *FunctionContext)
|
||||||
{
|
{
|
||||||
_adapter *padapter = (_adapter *)FunctionContext;
|
_adapter *padapter = (_adapter *)FunctionContext;
|
||||||
rtw_ps_cmd(padapter);
|
rtw_ps_cmd(padapter);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_LPS
|
#ifdef CONFIG_LPS
|
||||||
/*
|
/*
|
||||||
|
|
373
core/rtw_recv.c
373
core/rtw_recv.c
|
@ -264,8 +264,6 @@ _func_enter_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD)
|
|
||||||
|
|
||||||
if(precvframe->u.hdr.pkt)
|
if(precvframe->u.hdr.pkt)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_BSD_RX_USE_MBUF
|
#ifdef CONFIG_BSD_RX_USE_MBUF
|
||||||
|
@ -276,8 +274,6 @@ _func_enter_;
|
||||||
precvframe->u.hdr.pkt = NULL;
|
precvframe->u.hdr.pkt = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD)
|
|
||||||
|
|
||||||
_enter_critical_bh(&pfree_recv_queue->lock, &irqL);
|
_enter_critical_bh(&pfree_recv_queue->lock, &irqL);
|
||||||
|
|
||||||
rtw_list_delete(&(precvframe->u.hdr.list));
|
rtw_list_delete(&(precvframe->u.hdr.list));
|
||||||
|
@ -2828,23 +2824,16 @@ _func_exit_;
|
||||||
int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe);
|
int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe);
|
||||||
int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe)
|
int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe)
|
||||||
{
|
{
|
||||||
#if defined (PLATFORM_LINUX) || defined (PLATFORM_FREEBSD) //for amsdu TP improvement,Creator: Thomas
|
|
||||||
int a_len, padding_len;
|
int a_len, padding_len;
|
||||||
u16 eth_type, nSubframe_Length;
|
u16 eth_type, nSubframe_Length;
|
||||||
u8 nr_subframes, i;
|
u8 nr_subframes, i;
|
||||||
unsigned char *pdata;
|
unsigned char *pdata;
|
||||||
struct rx_pkt_attrib *pattrib;
|
struct rx_pkt_attrib *pattrib;
|
||||||
#ifndef PLATFORM_FREEBSD
|
|
||||||
unsigned char *data_ptr;
|
unsigned char *data_ptr;
|
||||||
_pkt *sub_skb,*subframes[MAX_SUBFRAME_COUNT];
|
_pkt *sub_skb,*subframes[MAX_SUBFRAME_COUNT];
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
struct recv_priv *precvpriv = &padapter->recvpriv;
|
struct recv_priv *precvpriv = &padapter->recvpriv;
|
||||||
_queue *pfree_recv_queue = &(precvpriv->free_recv_queue);
|
_queue *pfree_recv_queue = &(precvpriv->free_recv_queue);
|
||||||
int ret = _SUCCESS;
|
int ret = _SUCCESS;
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
struct mbuf *sub_m=NULL, *subframes[MAX_SUBFRAME_COUNT];
|
|
||||||
u8 *ptr,offset;
|
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
nr_subframes = 0;
|
nr_subframes = 0;
|
||||||
|
|
||||||
pattrib = &prframe->u.hdr.attrib;
|
pattrib = &prframe->u.hdr.attrib;
|
||||||
|
@ -2878,7 +2867,6 @@ int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe)
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PLATFORM_FREEBSD
|
|
||||||
/* move the data point to data content */
|
/* move the data point to data content */
|
||||||
pdata += ETH_HLEN;
|
pdata += ETH_HLEN;
|
||||||
a_len -= ETH_HLEN;
|
a_len -= ETH_HLEN;
|
||||||
|
@ -2909,24 +2897,8 @@ int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
//PLATFORM_FREEBSD
|
|
||||||
//Allocate a mbuff,
|
|
||||||
//sub_m =m_devget(pdata, nSubframe_Length+12, 12, padapter->pifp,NULL);
|
|
||||||
sub_m =m_devget(pdata, nSubframe_Length+ETH_HLEN, ETHER_ALIGN, padapter->pifp,NULL);
|
|
||||||
|
|
||||||
pdata += ETH_HLEN;
|
|
||||||
a_len -= ETH_HLEN;
|
|
||||||
#endif // PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
#ifndef PLATFORM_FREEBSD
|
|
||||||
//sub_skb->dev = padapter->pnetdev;
|
//sub_skb->dev = padapter->pnetdev;
|
||||||
subframes[nr_subframes++] = sub_skb;
|
subframes[nr_subframes++] = sub_skb;
|
||||||
#else //PLATFORM_FREEBSD
|
|
||||||
//PLATFORM_FREEBSD
|
|
||||||
subframes[nr_subframes++] = sub_m;
|
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
if(nr_subframes >= MAX_SUBFRAME_COUNT) {
|
if(nr_subframes >= MAX_SUBFRAME_COUNT) {
|
||||||
DBG_871X("ParseSubframe(): Too many Subframes! Packets dropped!\n");
|
DBG_871X("ParseSubframe(): Too many Subframes! Packets dropped!\n");
|
||||||
|
@ -2950,7 +2922,6 @@ int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe)
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0; i<nr_subframes; i++){
|
for(i=0; i<nr_subframes; i++){
|
||||||
#ifndef PLATFORM_FREEBSD
|
|
||||||
sub_skb = subframes[i];
|
sub_skb = subframes[i];
|
||||||
/* convert hdr + possible LLC headers into Ethernet header */
|
/* convert hdr + possible LLC headers into Ethernet header */
|
||||||
#ifdef ENDIAN_FREE
|
#ifdef ENDIAN_FREE
|
||||||
|
@ -3027,70 +2998,6 @@ int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe)
|
||||||
|
|
||||||
rtw_netif_rx(padapter->pnetdev, sub_skb);
|
rtw_netif_rx(padapter->pnetdev, sub_skb);
|
||||||
}
|
}
|
||||||
#else //PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
//PLATFORM_FREEBSD
|
|
||||||
sub_m = subframes[i];
|
|
||||||
ptr=mtod(sub_m, u8 *);
|
|
||||||
offset=ETH_HLEN;
|
|
||||||
/* convert hdr + possible LLC headers into Ethernet header */
|
|
||||||
#ifdef ENDIAN_FREE
|
|
||||||
eth_type = ntohs(*(u16*)&ptr[offset+6]);
|
|
||||||
#else // ENDIAN_FREE
|
|
||||||
eth_type = ( ptr[offset+6] << 8) | ptr[offset+7];
|
|
||||||
#endif // ENDIAN_FREE
|
|
||||||
if (sub_m->m_pkthdr.len >= ETH_HLEN+8 &&
|
|
||||||
((_rtw_memcmp(ptr+ETH_HLEN, rtw_rfc1042_header, SNAP_SIZE) &&
|
|
||||||
eth_type != ETH_P_AARP && eth_type != ETH_P_IPX) ||
|
|
||||||
_rtw_memcmp(ptr+ETH_HLEN, rtw_bridge_tunnel_header, SNAP_SIZE) )) {
|
|
||||||
/* remove RFC1042 or Bridge-Tunnel encapsulation and replace EtherType */
|
|
||||||
offset+=SNAP_SIZE;
|
|
||||||
_rtw_memcpy(&ptr[offset-ETH_ALEN], pattrib->src, ETH_ALEN);
|
|
||||||
offset-=ETH_ALEN;
|
|
||||||
_rtw_memcpy(&ptr[offset-ETH_ALEN], pattrib->dst, ETH_ALEN);
|
|
||||||
offset-=ETH_ALEN;
|
|
||||||
} else {
|
|
||||||
u16 len;
|
|
||||||
/* Leave Ethernet header part of hdr and full payload */
|
|
||||||
len = htons(sub_m->m_pkthdr.len-offset);
|
|
||||||
_rtw_memcpy(&ptr[offset- 2], &len, 2);
|
|
||||||
offset-=2;
|
|
||||||
_rtw_memcpy(&ptr[offset-ETH_ALEN], pattrib->src, ETH_ALEN);
|
|
||||||
offset-=ETH_ALEN;
|
|
||||||
_rtw_memcpy(&ptr[offset-ETH_ALEN], pattrib->dst, ETH_ALEN);
|
|
||||||
offset-=ETH_ALEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_adj(sub_m,offset);
|
|
||||||
|
|
||||||
/* Indicat the packets to upper layer */
|
|
||||||
if (sub_m) {
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
#ifdef CONFIG_TCP_CSUM_OFFLOAD_RX
|
|
||||||
if ( (pattrib->tcpchk_valid == 1) && (pattrib->tcp_chkrpt == 1) ) {
|
|
||||||
sub_skb->ip_summed = CHECKSUM_UNNECESSARY;
|
|
||||||
} else {
|
|
||||||
sub_skb->ip_summed = CHECKSUM_NONE;
|
|
||||||
}
|
|
||||||
#else /* !CONFIG_TCP_CSUM_OFFLOAD_RX */
|
|
||||||
sub_skb->ip_summed = CHECKSUM_NONE;
|
|
||||||
#endif //CONFIG_TCP_CSUM_OFFLOAD_RX
|
|
||||||
#endif //0
|
|
||||||
|
|
||||||
if ( ((u32)(mtod(sub_m, caddr_t) + 14) % 4) != 0)
|
|
||||||
printf("%s()-%d: mtod(sub_m) = %p\n", __FUNCTION__, __LINE__, mtod(sub_m, caddr_t));
|
|
||||||
#ifdef CONFIG_RX_INDICATE_QUEUE
|
|
||||||
IF_ENQUEUE(&precvpriv->rx_indicate_queue, sub_m);
|
|
||||||
if (_IF_QLEN(&precvpriv->rx_indicate_queue) <= 1) {
|
|
||||||
taskqueue_enqueue(taskqueue_thread, &precvpriv->rx_indicate_tasklet);
|
|
||||||
}
|
|
||||||
#else // CONFIG_RX_INDICATE_QUEUE
|
|
||||||
(*padapter->pifp->if_input)(padapter->pifp, sub_m);
|
|
||||||
#endif // CONFIG_RX_INDICATE_QUEUE
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -3099,288 +3006,8 @@ exit:
|
||||||
rtw_free_recvframe(prframe, pfree_recv_queue);//free this recv_frame
|
rtw_free_recvframe(prframe, pfree_recv_queue);//free this recv_frame
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
#else // || defined (PLATFORM_LINUX) || defined (PLATFORM_FREEBSD)
|
|
||||||
unsigned char *ptr, *pdata, *pbuf, *psnap_type;
|
|
||||||
union recv_frame *pnrframe, *pnrframe_new;
|
|
||||||
int a_len, mv_len, padding_len;
|
|
||||||
u16 eth_type, type_len;
|
|
||||||
u8 bsnaphdr;
|
|
||||||
struct ieee80211_snap_hdr *psnap;
|
|
||||||
struct _vlan *pvlan;
|
|
||||||
struct recv_priv *precvpriv = &padapter->recvpriv;
|
|
||||||
_queue *pfree_recv_queue = &(precvpriv->free_recv_queue);
|
|
||||||
int ret = _SUCCESS;
|
|
||||||
a_len = prframe->u.hdr.len - prframe->u.hdr.attrib.hdrlen;
|
|
||||||
|
|
||||||
recvframe_pull(prframe, prframe->u.hdr.attrib.hdrlen);
|
|
||||||
|
|
||||||
if(prframe->u.hdr.attrib.iv_len >0)
|
|
||||||
{
|
|
||||||
recvframe_pull(prframe, prframe->u.hdr.attrib.iv_len);
|
|
||||||
}
|
|
||||||
|
|
||||||
pdata = prframe->u.hdr.rx_data;
|
|
||||||
|
|
||||||
prframe->u.hdr.len=0;
|
|
||||||
|
|
||||||
pnrframe = prframe;
|
|
||||||
|
|
||||||
|
|
||||||
do{
|
|
||||||
|
|
||||||
mv_len=0;
|
|
||||||
pnrframe->u.hdr.rx_data = pnrframe->u.hdr.rx_tail = pdata;
|
|
||||||
ptr = pdata;
|
|
||||||
|
|
||||||
|
|
||||||
_rtw_memcpy(pnrframe->u.hdr.attrib.dst, ptr, ETH_ALEN);
|
|
||||||
ptr+=ETH_ALEN;
|
|
||||||
_rtw_memcpy(pnrframe->u.hdr.attrib.src, ptr, ETH_ALEN);
|
|
||||||
ptr+=ETH_ALEN;
|
|
||||||
|
|
||||||
_rtw_memcpy(&type_len, ptr, 2);
|
|
||||||
type_len= ntohs((unsigned short )type_len);
|
|
||||||
ptr +=2;
|
|
||||||
mv_len += ETH_HLEN;
|
|
||||||
|
|
||||||
recvframe_put(pnrframe, type_len+ETH_HLEN);//update tail;
|
|
||||||
|
|
||||||
if(pnrframe->u.hdr.rx_data >= pnrframe->u.hdr.rx_tail || type_len<8)
|
|
||||||
{
|
|
||||||
//panic("pnrframe->u.hdr.rx_data >= pnrframe->u.hdr.rx_tail || type_len<8\n");
|
|
||||||
|
|
||||||
rtw_free_recvframe(pnrframe, pfree_recv_queue);
|
|
||||||
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
psnap=(struct ieee80211_snap_hdr *)(ptr);
|
|
||||||
psnap_type=ptr+SNAP_SIZE;
|
|
||||||
if (psnap->dsap==0xaa && psnap->ssap==0xaa && psnap->ctrl==0x03)
|
|
||||||
{
|
|
||||||
if ( _rtw_memcmp(psnap->oui, oui_rfc1042, WLAN_IEEE_OUI_LEN))
|
|
||||||
{
|
|
||||||
bsnaphdr=_TRUE;//wlan_pkt_format = WLAN_PKT_FORMAT_SNAP_RFC1042;
|
|
||||||
}
|
|
||||||
else if (_rtw_memcmp(psnap->oui, SNAP_HDR_APPLETALK_DDP, WLAN_IEEE_OUI_LEN) &&
|
|
||||||
_rtw_memcmp(psnap_type, SNAP_ETH_TYPE_APPLETALK_DDP, 2) )
|
|
||||||
{
|
|
||||||
bsnaphdr=_TRUE; //wlan_pkt_format = WLAN_PKT_FORMAT_APPLETALK;
|
|
||||||
}
|
|
||||||
else if (_rtw_memcmp( psnap->oui, oui_8021h, WLAN_IEEE_OUI_LEN))
|
|
||||||
{
|
|
||||||
bsnaphdr=_TRUE; //wlan_pkt_format = WLAN_PKT_FORMAT_SNAP_TUNNEL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("drop pkt due to invalid frame format!\n"));
|
|
||||||
|
|
||||||
//KeBugCheckEx(0x87123333, 0xe0, 0x4c, 0x87, 0xdd);
|
|
||||||
|
|
||||||
//panic("0x87123333, 0xe0, 0x4c, 0x87, 0xdd\n");
|
|
||||||
|
|
||||||
rtw_free_recvframe(pnrframe, pfree_recv_queue);
|
|
||||||
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bsnaphdr=_FALSE;//wlan_pkt_format = WLAN_PKT_FORMAT_OTHERS;
|
|
||||||
}
|
|
||||||
|
|
||||||
ptr += (bsnaphdr?SNAP_SIZE:0);
|
|
||||||
_rtw_memcpy(ð_type, ptr, 2);
|
|
||||||
eth_type= ntohs((unsigned short )eth_type); //pattrib->ether_type
|
|
||||||
|
|
||||||
mv_len+= 2+(bsnaphdr?SNAP_SIZE:0);
|
|
||||||
ptr += 2;//now move to iphdr;
|
|
||||||
|
|
||||||
pvlan = NULL;
|
|
||||||
if(eth_type == 0x8100) //vlan
|
|
||||||
{
|
|
||||||
pvlan = (struct _vlan *)ptr;
|
|
||||||
ptr+=4;
|
|
||||||
mv_len+=4;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(eth_type==0x0800)//ip
|
|
||||||
{
|
|
||||||
struct iphdr* piphdr = (struct iphdr*)ptr;
|
|
||||||
|
|
||||||
|
|
||||||
if (piphdr->protocol == 0x06)
|
|
||||||
{
|
|
||||||
RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("@@@===recv tcp len:%d @@@===\n", pnrframe->u.hdr.len));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifdef PLATFORM_OS_XP
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NDIS_PACKET_8021Q_INFO VlanPriInfo;
|
|
||||||
UINT32 UserPriority = pnrframe->u.hdr.attrib.priority;
|
|
||||||
UINT32 VlanID = (pvlan!=NULL ? get_vlan_id(pvlan) : 0 );
|
|
||||||
|
|
||||||
VlanPriInfo.Value = // Get current value.
|
|
||||||
NDIS_PER_PACKET_INFO_FROM_PACKET(pnrframe->u.hdr.pkt, Ieee8021QInfo);
|
|
||||||
|
|
||||||
VlanPriInfo.TagHeader.UserPriority = UserPriority;
|
|
||||||
VlanPriInfo.TagHeader.VlanId = VlanID;
|
|
||||||
|
|
||||||
VlanPriInfo.TagHeader.CanonicalFormatId = 0; // Should be zero.
|
|
||||||
VlanPriInfo.TagHeader.Reserved = 0; // Should be zero.
|
|
||||||
NDIS_PER_PACKET_INFO_FROM_PACKET(pnrframe->u.hdr.pkt, Ieee8021QInfo) = VlanPriInfo.Value;
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif //PLATFORM_OS_XP
|
|
||||||
|
|
||||||
pbuf = recvframe_pull(pnrframe, (mv_len-sizeof(struct ethhdr)));
|
|
||||||
|
|
||||||
_rtw_memcpy(pbuf, pnrframe->u.hdr.attrib.dst, ETH_ALEN);
|
|
||||||
_rtw_memcpy(pbuf+ETH_ALEN, pnrframe->u.hdr.attrib.src, ETH_ALEN);
|
|
||||||
|
|
||||||
eth_type = htons((unsigned short)eth_type) ;
|
|
||||||
_rtw_memcpy(pbuf+12, ð_type, 2);
|
|
||||||
|
|
||||||
padding_len = (4) - ((type_len + ETH_HLEN)&(4-1));
|
|
||||||
|
|
||||||
a_len -= (type_len + ETH_HLEN + padding_len) ;
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
if(a_len > ETH_HLEN)
|
|
||||||
{
|
|
||||||
pnrframe_new = rtw_alloc_recvframe(pfree_recv_queue);
|
|
||||||
if(pnrframe_new)
|
|
||||||
{
|
|
||||||
_pkt *pskb_copy;
|
|
||||||
unsigned int copy_len = pnrframe->u.hdr.len;
|
|
||||||
|
|
||||||
_rtw_init_listhead(&pnrframe_new->u.hdr.list);
|
|
||||||
|
|
||||||
pskb_copy = rtw_skb_alloc(copy_len+64);
|
|
||||||
|
|
||||||
if(pskb_copy==NULL)
|
|
||||||
{
|
|
||||||
DBG_871X("amsdu_to_msdu:can not all(ocate memory for skb copy\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
pnrframe_new->u.hdr.pkt = pskb_copy;
|
|
||||||
|
|
||||||
_rtw_memcpy(pskb_copy->data, pnrframe->u.hdr.rx_data, copy_len);
|
|
||||||
|
|
||||||
pnrframe_new->u.hdr.rx_data = pnrframe->u.hdr.rx_data;
|
|
||||||
pnrframe_new->u.hdr.rx_tail = pnrframe->u.hdr.rx_data + copy_len;
|
|
||||||
|
|
||||||
|
|
||||||
if ((padapter->bDriverStopped ==_FALSE)&&( padapter->bSurpriseRemoved==_FALSE))
|
|
||||||
{
|
|
||||||
rtw_recv_indicatepkt(padapter, pnrframe_new);//indicate this recv_frame
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rtw_free_recvframe(pnrframe_new, pfree_recv_queue);//free this recv_frame
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DBG_871X("amsdu_to_msdu:can not allocate memory for pnrframe_new\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((padapter->bDriverStopped ==_FALSE)&&( padapter->bSurpriseRemoved==_FALSE))
|
|
||||||
{
|
|
||||||
rtw_recv_indicatepkt(padapter, pnrframe);//indicate this recv_frame
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rtw_free_recvframe(pnrframe, pfree_recv_queue);//free this recv_frame
|
|
||||||
}
|
|
||||||
|
|
||||||
pnrframe = NULL;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#else // 0
|
|
||||||
|
|
||||||
//padding_len = (4) - ((type_len + ETH_HLEN)&(4-1));
|
|
||||||
|
|
||||||
//a_len -= (type_len + ETH_HLEN + padding_len) ;
|
|
||||||
|
|
||||||
pnrframe_new = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
if(a_len > ETH_HLEN)
|
|
||||||
{
|
|
||||||
pnrframe_new = rtw_alloc_recvframe(pfree_recv_queue);
|
|
||||||
|
|
||||||
if(pnrframe_new)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
//pnrframe_new->u.hdr.precvbuf = precvbuf;//precvbuf is assigned before call rtw_init_recvframe()
|
|
||||||
//rtw_init_recvframe(pnrframe_new, precvpriv);
|
|
||||||
{
|
|
||||||
#ifdef PLATFORM_LINUX
|
|
||||||
_pkt *pskb = pnrframe->u.hdr.pkt;
|
|
||||||
#endif //PLATFORM_LINUX
|
|
||||||
_rtw_init_listhead(&pnrframe_new->u.hdr.list);
|
|
||||||
|
|
||||||
pnrframe_new->u.hdr.len=0;
|
|
||||||
|
|
||||||
#ifdef PLATFORM_LINUX
|
|
||||||
if(pskb)
|
|
||||||
{
|
|
||||||
pnrframe_new->u.hdr.pkt = rtw_skb_clone(pskb);
|
|
||||||
}
|
|
||||||
#endif //PLATFORM_LINUX
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pdata += (type_len + ETH_HLEN + padding_len);
|
|
||||||
pnrframe_new->u.hdr.rx_head = pnrframe_new->u.hdr.rx_data = pnrframe_new->u.hdr.rx_tail = pdata;
|
|
||||||
pnrframe_new->u.hdr.rx_end = pdata + a_len + padding_len;//
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//panic("pnrframe_new=%x\n", pnrframe_new);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ((padapter->bDriverStopped ==_FALSE)&&( padapter->bSurpriseRemoved==_FALSE) )
|
|
||||||
{
|
|
||||||
rtw_recv_indicatepkt(padapter, pnrframe);//indicate this recv_frame
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rtw_free_recvframe(pnrframe, pfree_recv_queue);//free this recv_frame
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pnrframe = NULL;
|
|
||||||
if(pnrframe_new)
|
|
||||||
{
|
|
||||||
pnrframe = pnrframe_new;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // end defined (PLATFORM_LINUX) || defined (PLATFORM_FREEBSD)
|
|
||||||
|
|
||||||
}while(pnrframe);
|
|
||||||
|
|
||||||
exit:
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num);
|
|
||||||
int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num)
|
int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num)
|
||||||
{
|
{
|
||||||
u8 wsize = preorder_ctrl->wsize_b;
|
u8 wsize = preorder_ctrl->wsize_b;
|
||||||
|
|
|
@ -973,13 +973,11 @@ static void next_key(u8 *key, sint round);
|
||||||
static void byte_sub(u8 *in, u8 *out);
|
static void byte_sub(u8 *in, u8 *out);
|
||||||
static void shift_row(u8 *in, u8 *out);
|
static void shift_row(u8 *in, u8 *out);
|
||||||
static void mix_column(u8 *in, u8 *out);
|
static void mix_column(u8 *in, u8 *out);
|
||||||
#ifndef PLATFORM_FREEBSD
|
|
||||||
static void add_round_key( u8 *shiftrow_in,
|
static void add_round_key( u8 *shiftrow_in,
|
||||||
u8 *mcol_in,
|
u8 *mcol_in,
|
||||||
u8 *block_in,
|
u8 *block_in,
|
||||||
sint round,
|
sint round,
|
||||||
u8 *out);
|
u8 *out);
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext);
|
static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext);
|
||||||
|
|
||||||
|
|
||||||
|
@ -2195,7 +2193,6 @@ BIP_exit:
|
||||||
}
|
}
|
||||||
#endif //CONFIG_IEEE80211W
|
#endif //CONFIG_IEEE80211W
|
||||||
|
|
||||||
#ifndef PLATFORM_FREEBSD
|
|
||||||
/* compress 512-bits */
|
/* compress 512-bits */
|
||||||
static int sha256_compress(struct sha256_state *md, unsigned char *buf)
|
static int sha256_compress(struct sha256_state *md, unsigned char *buf)
|
||||||
{
|
{
|
||||||
|
@ -2461,7 +2458,6 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
|
||||||
_len[1] = 32;
|
_len[1] = 32;
|
||||||
sha256_vector(2, _addr, _len, mac);
|
sha256_vector(2, _addr, _len, mac);
|
||||||
}
|
}
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
/**
|
/**
|
||||||
* sha256_prf - SHA256-based Pseudo-Random Function (IEEE 802.11r, 8.5.1.5.2)
|
* sha256_prf - SHA256-based Pseudo-Random Function (IEEE 802.11r, 8.5.1.5.2)
|
||||||
* @key: Key for PRF
|
* @key: Key for PRF
|
||||||
|
@ -2475,7 +2471,6 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
|
||||||
* This function is used to derive new, cryptographically separate keys from a
|
* This function is used to derive new, cryptographically separate keys from a
|
||||||
* given key.
|
* given key.
|
||||||
*/
|
*/
|
||||||
#ifndef PLATFORM_FREEBSD //Baron
|
|
||||||
static void sha256_prf(u8 *key, size_t key_len, char *label,
|
static void sha256_prf(u8 *key, size_t key_len, char *label,
|
||||||
u8 *data, size_t data_len, u8 *buf, size_t buf_len)
|
u8 *data, size_t data_len, u8 *buf, size_t buf_len)
|
||||||
{
|
{
|
||||||
|
@ -2512,7 +2507,6 @@ static void sha256_prf(u8 *key, size_t key_len, char *label,
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //PLATFORM_FREEBSD Baron
|
|
||||||
|
|
||||||
/* AES tables*/
|
/* AES tables*/
|
||||||
const u32 Te0[256] = {
|
const u32 Te0[256] = {
|
||||||
|
@ -2691,7 +2685,6 @@ const u8 rcons[] = {
|
||||||
*
|
*
|
||||||
* @return the number of rounds for the given cipher key size.
|
* @return the number of rounds for the given cipher key size.
|
||||||
*/
|
*/
|
||||||
#ifndef PLATFORM_FREEBSD //Baron
|
|
||||||
static void rijndaelKeySetupEnc(u32 rk[/*44*/], const u8 cipherKey[])
|
static void rijndaelKeySetupEnc(u32 rk[/*44*/], const u8 cipherKey[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -2907,7 +2900,6 @@ int omac1_aes_128(u8 *key, u8 *data, size_t data_len, u8 *mac)
|
||||||
{
|
{
|
||||||
return omac1_aes_128_vector(key, 1, &data, &data_len, mac);
|
return omac1_aes_128_vector(key, 1, &data, &data_len, mac);
|
||||||
}
|
}
|
||||||
#endif //PLATFORM_FREEBSD Baron
|
|
||||||
|
|
||||||
#ifdef CONFIG_TDLS
|
#ifdef CONFIG_TDLS
|
||||||
void wpa_tdls_generate_tpk(_adapter *padapter, struct sta_info *psta)
|
void wpa_tdls_generate_tpk(_adapter *padapter, struct sta_info *psta)
|
||||||
|
@ -3082,9 +3074,6 @@ int tdls_verify_mic(u8 *kck, u8 trans_seq,
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
void rtw_use_tkipkey_handler(void *FunctionContext)
|
void rtw_use_tkipkey_handler(void *FunctionContext)
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
void rtw_use_tkipkey_handler(void *FunctionContext)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
_adapter *padapter = (_adapter *)FunctionContext;
|
_adapter *padapter = (_adapter *)FunctionContext;
|
||||||
|
|
||||||
|
@ -3093,14 +3082,6 @@ _func_enter_;
|
||||||
|
|
||||||
RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("^^^rtw_use_tkipkey_handler ^^^\n"));
|
RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("^^^rtw_use_tkipkey_handler ^^^\n"));
|
||||||
|
|
||||||
/*
|
|
||||||
if(padapter->bDriverStopped ||padapter->bSurpriseRemoved){
|
|
||||||
RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("^^^rtw_use_tkipkey_handler (padapter->bDriverStopped %d)(padapter->bSurpriseRemoved %d)^^^\n",padapter->bDriverStopped,padapter->bSurpriseRemoved));
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
padapter->securitypriv.busetkipkey=_TRUE;
|
padapter->securitypriv.busetkipkey=_TRUE;
|
||||||
|
|
||||||
RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("^^^rtw_use_tkipkey_handler padapter->securitypriv.busetkipkey=%d^^^\n",padapter->securitypriv.busetkipkey));
|
RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("^^^rtw_use_tkipkey_handler padapter->securitypriv.busetkipkey=%d^^^\n",padapter->securitypriv.busetkipkey));
|
||||||
|
|
|
@ -68,50 +68,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
typedef signed char s8;
|
|
||||||
typedef unsigned char u8;
|
|
||||||
|
|
||||||
typedef signed short s16;
|
|
||||||
typedef unsigned short u16;
|
|
||||||
|
|
||||||
typedef signed int s32;
|
|
||||||
typedef unsigned int u32;
|
|
||||||
|
|
||||||
typedef unsigned int uint;
|
|
||||||
typedef signed int sint;
|
|
||||||
typedef long atomic_t;
|
|
||||||
|
|
||||||
typedef signed long long s64;
|
|
||||||
typedef unsigned long long u64;
|
|
||||||
#define IN
|
|
||||||
#define OUT
|
|
||||||
#define VOID void
|
|
||||||
#define NDIS_OID uint
|
|
||||||
#define NDIS_STATUS uint
|
|
||||||
|
|
||||||
#ifndef PVOID
|
|
||||||
typedef void * PVOID;
|
|
||||||
//#define PVOID (void *)
|
|
||||||
#endif
|
|
||||||
typedef u32 dma_addr_t;
|
|
||||||
#define UCHAR u8
|
|
||||||
#define USHORT u16
|
|
||||||
#define UINT u32
|
|
||||||
#define ULONG u32
|
|
||||||
|
|
||||||
typedef void (*proc_t)(void*);
|
|
||||||
|
|
||||||
typedef unsigned int __kernel_size_t;
|
|
||||||
typedef int __kernel_ssize_t;
|
|
||||||
|
|
||||||
typedef __kernel_size_t SIZE_T;
|
|
||||||
typedef __kernel_ssize_t SSIZE_T;
|
|
||||||
#define FIELD_OFFSET(s,field) ((SSIZE_T)&((s*)(0))->field)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MEM_ALIGNMENT_OFFSET (sizeof (SIZE_T))
|
#define MEM_ALIGNMENT_OFFSET (sizeof (SIZE_T))
|
||||||
#define MEM_ALIGNMENT_PADDING (sizeof(SIZE_T) - 1)
|
#define MEM_ALIGNMENT_PADDING (sizeof(SIZE_T) - 1)
|
||||||
|
|
||||||
|
|
|
@ -165,15 +165,11 @@
|
||||||
extern __u32 ntohl(__u32);
|
extern __u32 ntohl(__u32);
|
||||||
extern __u32 htonl(__u32);
|
extern __u32 htonl(__u32);
|
||||||
#else //defined(PLATFORM_LINUX) || (defined (__GLIBC__) && __GLIBC__ >= 2)
|
#else //defined(PLATFORM_LINUX) || (defined (__GLIBC__) && __GLIBC__ >= 2)
|
||||||
#ifndef PLATFORM_FREEBSD
|
|
||||||
extern unsigned long int ntohl(unsigned long int);
|
extern unsigned long int ntohl(unsigned long int);
|
||||||
extern unsigned long int htonl(unsigned long int);
|
extern unsigned long int htonl(unsigned long int);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#ifndef PLATFORM_FREEBSD
|
|
||||||
extern unsigned short int ntohs(unsigned short int);
|
extern unsigned short int ntohs(unsigned short int);
|
||||||
extern unsigned short int htons(unsigned short int);
|
extern unsigned short int htons(unsigned short int);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__) || defined(PLATFORM_MPIXEL)
|
#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__) || defined(PLATFORM_MPIXEL)
|
||||||
|
|
||||||
|
|
|
@ -108,19 +108,12 @@ __inline static __u64 __arch__swab64(__u64 x)
|
||||||
#define __swab64(x) __fswab64(x)
|
#define __swab64(x) __fswab64(x)
|
||||||
#endif // __swab16
|
#endif // __swab16
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
__inline static __u16 __fswab16(__u16 x)
|
|
||||||
#else
|
|
||||||
__inline static const __u16 __fswab16(__u16 x)
|
__inline static const __u16 __fswab16(__u16 x)
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
{
|
{
|
||||||
return __arch__swab16(x);
|
return __arch__swab16(x);
|
||||||
}
|
}
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
__inline static __u32 __fswab32(__u32 x)
|
|
||||||
#else
|
|
||||||
__inline static const __u32 __fswab32(__u32 x)
|
__inline static const __u32 __fswab32(__u32 x)
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
{
|
{
|
||||||
return __arch__swab32(x);
|
return __arch__swab32(x);
|
||||||
}
|
}
|
||||||
|
|
|
@ -328,10 +328,6 @@ struct dvobj_priv
|
||||||
struct usb_device *pusbdev;
|
struct usb_device *pusbdev;
|
||||||
#endif//PLATFORM_LINUX
|
#endif//PLATFORM_LINUX
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
struct usb_interface *pusbintf;
|
|
||||||
struct usb_device *pusbdev;
|
|
||||||
#endif//PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
#endif//CONFIG_USB_HCI
|
#endif//CONFIG_USB_HCI
|
||||||
|
|
||||||
|
@ -560,11 +556,6 @@ struct _ADAPTER{
|
||||||
|
|
||||||
#endif //end of PLATFORM_LINUX
|
#endif //end of PLATFORM_LINUX
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
_nic_hdl pifp;
|
|
||||||
int bup;
|
|
||||||
_lock glock;
|
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
int net_closed;
|
int net_closed;
|
||||||
|
|
||||||
u8 bFWReady;
|
u8 bFWReady;
|
||||||
|
|
|
@ -315,8 +315,6 @@ struct ieee_ibss_seq {
|
||||||
_list list;
|
_list list;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(PLATFORM_LINUX) || defined(CONFIG_RTL8711FW)||defined(PLATFORM_FREEBSD)
|
|
||||||
|
|
||||||
struct rtw_ieee80211_hdr {
|
struct rtw_ieee80211_hdr {
|
||||||
u16 frame_ctl;
|
u16 frame_ctl;
|
||||||
u16 duration_id;
|
u16 duration_id;
|
||||||
|
@ -366,8 +364,6 @@ struct eapol {
|
||||||
u16 length;
|
u16 length;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum eap_type {
|
enum eap_type {
|
||||||
EAP_PACKET = 0,
|
EAP_PACKET = 0,
|
||||||
EAPOL_START,
|
EAPOL_START,
|
||||||
|
@ -476,8 +472,6 @@ enum eap_type {
|
||||||
|
|
||||||
#define P80211_OUI_LEN 3
|
#define P80211_OUI_LEN 3
|
||||||
|
|
||||||
#if defined(PLATFORM_LINUX) || defined(CONFIG_RTL8711FW) || defined(PLATFORM_FREEBSD)
|
|
||||||
|
|
||||||
struct ieee80211_snap_hdr {
|
struct ieee80211_snap_hdr {
|
||||||
|
|
||||||
u8 dsap; /* always 0xAA */
|
u8 dsap; /* always 0xAA */
|
||||||
|
@ -487,8 +481,6 @@ struct ieee80211_snap_hdr {
|
||||||
|
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
|
#define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
|
||||||
|
|
||||||
#define WLAN_FC_GET_TYPE(fc) ((fc) & RTW_IEEE80211_FCTL_FTYPE)
|
#define WLAN_FC_GET_TYPE(fc) ((fc) & RTW_IEEE80211_FCTL_FTYPE)
|
||||||
|
@ -693,7 +685,6 @@ struct ieee80211_frag_entry {
|
||||||
u8 dst_addr[ETH_ALEN];
|
u8 dst_addr[ETH_ALEN];
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef PLATFORM_FREEBSD //Baron BSD has already defined
|
|
||||||
struct ieee80211_stats {
|
struct ieee80211_stats {
|
||||||
uint tx_unicast_frames;
|
uint tx_unicast_frames;
|
||||||
uint tx_multicast_frames;
|
uint tx_multicast_frames;
|
||||||
|
@ -717,7 +708,7 @@ struct ieee80211_stats {
|
||||||
uint rx_message_in_msg_fragments;
|
uint rx_message_in_msg_fragments;
|
||||||
uint rx_message_in_bad_msg_fragments;
|
uint rx_message_in_bad_msg_fragments;
|
||||||
};
|
};
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
struct ieee80211_softmac_stats{
|
struct ieee80211_softmac_stats{
|
||||||
uint rx_ass_ok;
|
uint rx_ass_ok;
|
||||||
uint rx_ass_err;
|
uint rx_ass_err;
|
||||||
|
@ -989,8 +980,6 @@ join_res:
|
||||||
> 0: TID
|
> 0: TID
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PLATFORM_FREEBSD //Baron BSD has already defined
|
|
||||||
|
|
||||||
enum ieee80211_state {
|
enum ieee80211_state {
|
||||||
|
|
||||||
/* the card is not linked at all */
|
/* the card is not linked at all */
|
||||||
|
@ -1029,7 +1018,6 @@ enum ieee80211_state {
|
||||||
IEEE80211_LINKED_SCANNING,
|
IEEE80211_LINKED_SCANNING,
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
|
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
|
||||||
#define DEFAULT_FTS 2346
|
#define DEFAULT_FTS 2346
|
||||||
|
@ -1038,12 +1026,6 @@ enum ieee80211_state {
|
||||||
#define IP_FMT "%d.%d.%d.%d"
|
#define IP_FMT "%d.%d.%d.%d"
|
||||||
#define IP_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3]
|
#define IP_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3]
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD //Baron change func to macro
|
|
||||||
#define is_multicast_mac_addr(Addr) ((((Addr[0]) & 0x01) == 0x01) && ((Addr[0]) != 0xff))
|
|
||||||
#define is_broadcast_mac_addr(Addr) ((((Addr[0]) & 0xff) == 0xff) && (((Addr[1]) & 0xff) == 0xff) && \
|
|
||||||
(((Addr[2]) & 0xff) == 0xff) && (((Addr[3]) & 0xff) == 0xff) && (((Addr[4]) & 0xff) == 0xff) && \
|
|
||||||
(((Addr[5]) & 0xff) == 0xff))
|
|
||||||
#else
|
|
||||||
extern __inline int is_multicast_mac_addr(const u8 *addr)
|
extern __inline int is_multicast_mac_addr(const u8 *addr)
|
||||||
{
|
{
|
||||||
return ((addr[0] != 0xff) && (0x01 & addr[0]));
|
return ((addr[0] != 0xff) && (0x01 & addr[0]));
|
||||||
|
@ -1060,7 +1042,6 @@ extern __inline int is_zero_mac_addr(const u8 *addr)
|
||||||
return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && \
|
return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && \
|
||||||
(addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00));
|
(addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00));
|
||||||
}
|
}
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
#define CFG_IEEE80211_RESERVE_FCS (1<<0)
|
#define CFG_IEEE80211_RESERVE_FCS (1<<0)
|
||||||
#define CFG_IEEE80211_COMPUTE_FCS (1<<1)
|
#define CFG_IEEE80211_COMPUTE_FCS (1<<1)
|
||||||
|
@ -1194,9 +1175,7 @@ enum rtw_ieee80211_back_parties {
|
||||||
|
|
||||||
#define OUI_MICROSOFT 0x0050f2 /* Microsoft (also used in Wi-Fi specs)
|
#define OUI_MICROSOFT 0x0050f2 /* Microsoft (also used in Wi-Fi specs)
|
||||||
* 00:50:F2 */
|
* 00:50:F2 */
|
||||||
#ifndef PLATFORM_FREEBSD //Baron BSD has defined
|
|
||||||
#define WME_OUI_TYPE 2
|
#define WME_OUI_TYPE 2
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
#define WME_OUI_SUBTYPE_INFORMATION_ELEMENT 0
|
#define WME_OUI_SUBTYPE_INFORMATION_ELEMENT 0
|
||||||
#define WME_OUI_SUBTYPE_PARAMETER_ELEMENT 1
|
#define WME_OUI_SUBTYPE_PARAMETER_ELEMENT 1
|
||||||
#define WME_OUI_SUBTYPE_TSPEC_ELEMENT 2
|
#define WME_OUI_SUBTYPE_TSPEC_ELEMENT 2
|
||||||
|
|
|
@ -123,11 +123,6 @@ static void rtw_proc_remove_one(struct net_device *dev){}
|
||||||
#endif //!CONFIG_PROC_DEBUG
|
#endif //!CONFIG_PROC_DEBUG
|
||||||
#endif //PLATFORM_LINUX
|
#endif //PLATFORM_LINUX
|
||||||
|
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
extern int rtw_ioctl(struct ifnet * ifp, u_long cmd, caddr_t data);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void rtw_ips_dev_unload(_adapter *padapter);
|
void rtw_ips_dev_unload(_adapter *padapter);
|
||||||
|
|
||||||
#ifdef CONFIG_RF_GAIN_OFFSET
|
#ifdef CONFIG_RF_GAIN_OFFSET
|
||||||
|
|
|
@ -36,713 +36,6 @@
|
||||||
#define _FALSE 0
|
#define _FALSE 0
|
||||||
|
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/systm.h>
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <sys/sockio.h>
|
|
||||||
#include <sys/sysctl.h>
|
|
||||||
#include <sys/lock.h>
|
|
||||||
#include <sys/mutex.h>
|
|
||||||
#include <sys/mbuf.h>
|
|
||||||
#include <sys/kernel.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/systm.h>
|
|
||||||
#include <sys/malloc.h>
|
|
||||||
#include <sys/module.h>
|
|
||||||
#include <sys/bus.h>
|
|
||||||
#include <sys/endian.h>
|
|
||||||
#include <sys/kdb.h>
|
|
||||||
#include <sys/kthread.h>
|
|
||||||
#include <machine/atomic.h>
|
|
||||||
|
|
||||||
#include <machine/bus.h>
|
|
||||||
#include <machine/resource.h>
|
|
||||||
#include <sys/rman.h>
|
|
||||||
|
|
||||||
#include <net/bpf.h>
|
|
||||||
#include <net/if.h>
|
|
||||||
#include <net/if_arp.h>
|
|
||||||
#include <net/ethernet.h>
|
|
||||||
#include <net/if_dl.h>
|
|
||||||
#include <net/if_media.h>
|
|
||||||
#include <net/if_types.h>
|
|
||||||
#include <net/route.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <netinet/in_systm.h>
|
|
||||||
#include <netinet/in_var.h>
|
|
||||||
#include <netinet/if_ether.h>
|
|
||||||
|
|
||||||
#include <net80211/ieee80211_var.h>
|
|
||||||
#include <net80211/ieee80211_regdomain.h>
|
|
||||||
#include <net80211/ieee80211_radiotap.h>
|
|
||||||
#include <net80211/ieee80211_ratectl.h>
|
|
||||||
|
|
||||||
#include <dev/usb/usb.h>
|
|
||||||
#include <dev/usb/usbdi.h>
|
|
||||||
#include "usbdevs.h"
|
|
||||||
|
|
||||||
#define USB_DEBUG_VAR rum_debug
|
|
||||||
#include <dev/usb/usb_debug.h>
|
|
||||||
|
|
||||||
#if 1 //Baron porting from linux, it's all temp solution, needs to check again
|
|
||||||
#include <sys/sema.h>
|
|
||||||
#include <sys/pcpu.h> /* XXX for PCPU_GET */
|
|
||||||
// typedef struct semaphore _sema;
|
|
||||||
typedef struct sema _sema;
|
|
||||||
// typedef spinlock_t _lock;
|
|
||||||
typedef struct mtx _lock;
|
|
||||||
typedef struct mtx _mutex;
|
|
||||||
typedef struct timer_list _timer;
|
|
||||||
struct list_head {
|
|
||||||
struct list_head *next, *prev;
|
|
||||||
};
|
|
||||||
struct __queue {
|
|
||||||
struct list_head queue;
|
|
||||||
_lock lock;
|
|
||||||
};
|
|
||||||
|
|
||||||
//typedef struct sk_buff _pkt;
|
|
||||||
typedef struct mbuf _pkt;
|
|
||||||
typedef struct mbuf _buffer;
|
|
||||||
|
|
||||||
typedef struct __queue _queue;
|
|
||||||
typedef struct list_head _list;
|
|
||||||
typedef int _OS_STATUS;
|
|
||||||
//typedef u32 _irqL;
|
|
||||||
typedef unsigned long _irqL;
|
|
||||||
typedef struct ifnet * _nic_hdl;
|
|
||||||
|
|
||||||
typedef pid_t _thread_hdl_;
|
|
||||||
// typedef struct thread _thread_hdl_;
|
|
||||||
typedef void thread_return;
|
|
||||||
typedef void* thread_context;
|
|
||||||
|
|
||||||
//#define thread_exit() complete_and_exit(NULL, 0)
|
|
||||||
|
|
||||||
typedef void timer_hdl_return;
|
|
||||||
typedef void* timer_hdl_context;
|
|
||||||
typedef struct work_struct _workitem;
|
|
||||||
|
|
||||||
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
|
|
||||||
/* emulate a modern version */
|
|
||||||
#define LINUX_VERSION_CODE KERNEL_VERSION(2, 6, 35)
|
|
||||||
|
|
||||||
#define WIRELESS_EXT -1
|
|
||||||
#define HZ hz
|
|
||||||
#define spin_lock_irqsave mtx_lock_irqsave
|
|
||||||
#define spin_lock_bh mtx_lock_irqsave
|
|
||||||
#define mtx_lock_irqsave(lock, x) mtx_lock(lock)//{local_irq_save((x)); mtx_lock_spin((lock));}
|
|
||||||
//#define IFT_RTW 0xf9 //ifnet allocate type for RTW
|
|
||||||
#define free_netdev if_free
|
|
||||||
#define LIST_CONTAINOR(ptr, type, member) \
|
|
||||||
((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member)))
|
|
||||||
#define container_of(p,t,n) (t*)((p)-&(((t*)0)->n))
|
|
||||||
/*
|
|
||||||
* Linux timers are emulated using FreeBSD callout functions
|
|
||||||
* (and taskqueue functionality).
|
|
||||||
*
|
|
||||||
* Currently no timer stats functionality.
|
|
||||||
*
|
|
||||||
* See (linux_compat) processes.c
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
struct timer_list {
|
|
||||||
|
|
||||||
/* FreeBSD callout related fields */
|
|
||||||
struct callout callout;
|
|
||||||
|
|
||||||
//timeout function
|
|
||||||
void (*function)(void*);
|
|
||||||
//argument
|
|
||||||
void *arg;
|
|
||||||
|
|
||||||
};
|
|
||||||
struct workqueue_struct;
|
|
||||||
struct work_struct;
|
|
||||||
typedef void (*work_func_t)(struct work_struct *work);
|
|
||||||
/* Values for the state of an item of work (work_struct) */
|
|
||||||
typedef enum work_state {
|
|
||||||
WORK_STATE_UNSET = 0,
|
|
||||||
WORK_STATE_CALLOUT_PENDING = 1,
|
|
||||||
WORK_STATE_TASK_PENDING = 2,
|
|
||||||
WORK_STATE_WORK_CANCELLED = 3
|
|
||||||
} work_state_t;
|
|
||||||
|
|
||||||
struct work_struct {
|
|
||||||
struct task task; /* FreeBSD task */
|
|
||||||
work_state_t state; /* the pending or otherwise state of work. */
|
|
||||||
work_func_t func;
|
|
||||||
};
|
|
||||||
#define spin_unlock_irqrestore mtx_unlock_irqrestore
|
|
||||||
#define spin_unlock_bh mtx_unlock_irqrestore
|
|
||||||
#define mtx_unlock_irqrestore(lock,x) mtx_unlock(lock);
|
|
||||||
extern void _rtw_spinlock_init(_lock *plock);
|
|
||||||
|
|
||||||
//modify private structure to match freebsd
|
|
||||||
#define BITS_PER_LONG 32
|
|
||||||
union ktime {
|
|
||||||
s64 tv64;
|
|
||||||
#if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR)
|
|
||||||
struct {
|
|
||||||
#ifdef __BIG_ENDIAN
|
|
||||||
s32 sec, nsec;
|
|
||||||
#else
|
|
||||||
s32 nsec, sec;
|
|
||||||
#endif
|
|
||||||
} tv;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
#define kmemcheck_bitfield_begin(name)
|
|
||||||
#define kmemcheck_bitfield_end(name)
|
|
||||||
#define CHECKSUM_NONE 0
|
|
||||||
typedef unsigned char *sk_buff_data_t;
|
|
||||||
typedef union ktime ktime_t; /* Kill this */
|
|
||||||
|
|
||||||
void rtw_mtx_lock(_lock *plock);
|
|
||||||
|
|
||||||
void rtw_mtx_unlock(_lock *plock);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* struct sk_buff - socket buffer
|
|
||||||
* @next: Next buffer in list
|
|
||||||
* @prev: Previous buffer in list
|
|
||||||
* @sk: Socket we are owned by
|
|
||||||
* @tstamp: Time we arrived
|
|
||||||
* @dev: Device we arrived on/are leaving by
|
|
||||||
* @transport_header: Transport layer header
|
|
||||||
* @network_header: Network layer header
|
|
||||||
* @mac_header: Link layer header
|
|
||||||
* @_skb_refdst: destination entry (with norefcount bit)
|
|
||||||
* @sp: the security path, used for xfrm
|
|
||||||
* @cb: Control buffer. Free for use by every layer. Put private vars here
|
|
||||||
* @len: Length of actual data
|
|
||||||
* @data_len: Data length
|
|
||||||
* @mac_len: Length of link layer header
|
|
||||||
* @hdr_len: writable header length of cloned skb
|
|
||||||
* @csum: Checksum (must include start/offset pair)
|
|
||||||
* @csum_start: Offset from skb->head where checksumming should start
|
|
||||||
* @csum_offset: Offset from csum_start where checksum should be stored
|
|
||||||
* @local_df: allow local fragmentation
|
|
||||||
* @cloned: Head may be cloned (check refcnt to be sure)
|
|
||||||
* @nohdr: Payload reference only, must not modify header
|
|
||||||
* @pkt_type: Packet class
|
|
||||||
* @fclone: skbuff clone status
|
|
||||||
* @ip_summed: Driver fed us an IP checksum
|
|
||||||
* @priority: Packet queueing priority
|
|
||||||
* @users: User count - see {datagram,tcp}.c
|
|
||||||
* @protocol: Packet protocol from driver
|
|
||||||
* @truesize: Buffer size
|
|
||||||
* @head: Head of buffer
|
|
||||||
* @data: Data head pointer
|
|
||||||
* @tail: Tail pointer
|
|
||||||
* @end: End pointer
|
|
||||||
* @destructor: Destruct function
|
|
||||||
* @mark: Generic packet mark
|
|
||||||
* @nfct: Associated connection, if any
|
|
||||||
* @ipvs_property: skbuff is owned by ipvs
|
|
||||||
* @peeked: this packet has been seen already, so stats have been
|
|
||||||
* done for it, don't do them again
|
|
||||||
* @nf_trace: netfilter packet trace flag
|
|
||||||
* @nfctinfo: Relationship of this skb to the connection
|
|
||||||
* @nfct_reasm: netfilter conntrack re-assembly pointer
|
|
||||||
* @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
|
|
||||||
* @skb_iif: ifindex of device we arrived on
|
|
||||||
* @rxhash: the packet hash computed on receive
|
|
||||||
* @queue_mapping: Queue mapping for multiqueue devices
|
|
||||||
* @tc_index: Traffic control index
|
|
||||||
* @tc_verd: traffic control verdict
|
|
||||||
* @ndisc_nodetype: router type (from link layer)
|
|
||||||
* @dma_cookie: a cookie to one of several possible DMA operations
|
|
||||||
* done by skb DMA functions
|
|
||||||
* @secmark: security marking
|
|
||||||
* @vlan_tci: vlan tag control information
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct sk_buff {
|
|
||||||
/* These two members must be first. */
|
|
||||||
struct sk_buff *next;
|
|
||||||
struct sk_buff *prev;
|
|
||||||
|
|
||||||
ktime_t tstamp;
|
|
||||||
|
|
||||||
struct sock *sk;
|
|
||||||
//struct net_device *dev;
|
|
||||||
struct ifnet *dev;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is the control buffer. It is free to use for every
|
|
||||||
* layer. Please put your private variables there. If you
|
|
||||||
* want to keep them across layers you have to do a skb_clone()
|
|
||||||
* first. This is owned by whoever has the skb queued ATM.
|
|
||||||
*/
|
|
||||||
char cb[48] __aligned(8);
|
|
||||||
|
|
||||||
unsigned long _skb_refdst;
|
|
||||||
#ifdef CONFIG_XFRM
|
|
||||||
struct sec_path *sp;
|
|
||||||
#endif
|
|
||||||
unsigned int len,
|
|
||||||
data_len;
|
|
||||||
u16 mac_len,
|
|
||||||
hdr_len;
|
|
||||||
union {
|
|
||||||
u32 csum;
|
|
||||||
struct {
|
|
||||||
u16 csum_start;
|
|
||||||
u16 csum_offset;
|
|
||||||
}smbol2;
|
|
||||||
}smbol1;
|
|
||||||
u32 priority;
|
|
||||||
kmemcheck_bitfield_begin(flags1);
|
|
||||||
u8 local_df:1,
|
|
||||||
cloned:1,
|
|
||||||
ip_summed:2,
|
|
||||||
nohdr:1,
|
|
||||||
nfctinfo:3;
|
|
||||||
u8 pkt_type:3,
|
|
||||||
fclone:2,
|
|
||||||
ipvs_property:1,
|
|
||||||
peeked:1,
|
|
||||||
nf_trace:1;
|
|
||||||
kmemcheck_bitfield_end(flags1);
|
|
||||||
u16 protocol;
|
|
||||||
|
|
||||||
void (*destructor)(struct sk_buff *skb);
|
|
||||||
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
|
|
||||||
struct nf_conntrack *nfct;
|
|
||||||
struct sk_buff *nfct_reasm;
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_BRIDGE_NETFILTER
|
|
||||||
struct nf_bridge_info *nf_bridge;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int skb_iif;
|
|
||||||
#ifdef CONFIG_NET_SCHED
|
|
||||||
u16 tc_index; /* traffic control index */
|
|
||||||
#ifdef CONFIG_NET_CLS_ACT
|
|
||||||
u16 tc_verd; /* traffic control verdict */
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
u32 rxhash;
|
|
||||||
|
|
||||||
kmemcheck_bitfield_begin(flags2);
|
|
||||||
u16 queue_mapping:16;
|
|
||||||
#ifdef CONFIG_IPV6_NDISC_NODETYPE
|
|
||||||
u8 ndisc_nodetype:2,
|
|
||||||
deliver_no_wcard:1;
|
|
||||||
#else
|
|
||||||
u8 deliver_no_wcard:1;
|
|
||||||
#endif
|
|
||||||
kmemcheck_bitfield_end(flags2);
|
|
||||||
|
|
||||||
/* 0/14 bit hole */
|
|
||||||
|
|
||||||
#ifdef CONFIG_NET_DMA
|
|
||||||
dma_cookie_t dma_cookie;
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_NETWORK_SECMARK
|
|
||||||
u32 secmark;
|
|
||||||
#endif
|
|
||||||
union {
|
|
||||||
u32 mark;
|
|
||||||
u32 dropcount;
|
|
||||||
}symbol3;
|
|
||||||
|
|
||||||
u16 vlan_tci;
|
|
||||||
|
|
||||||
sk_buff_data_t transport_header;
|
|
||||||
sk_buff_data_t network_header;
|
|
||||||
sk_buff_data_t mac_header;
|
|
||||||
/* These elements must be at the end, see alloc_skb() for details. */
|
|
||||||
sk_buff_data_t tail;
|
|
||||||
sk_buff_data_t end;
|
|
||||||
unsigned char *head,
|
|
||||||
*data;
|
|
||||||
unsigned int truesize;
|
|
||||||
atomic_t users;
|
|
||||||
};
|
|
||||||
struct sk_buff_head {
|
|
||||||
/* These two members must be first. */
|
|
||||||
struct sk_buff *next;
|
|
||||||
struct sk_buff *prev;
|
|
||||||
|
|
||||||
u32 qlen;
|
|
||||||
_lock lock;
|
|
||||||
};
|
|
||||||
#define skb_tail_pointer(skb) skb->tail
|
|
||||||
static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
|
|
||||||
{
|
|
||||||
unsigned char *tmp = skb_tail_pointer(skb);
|
|
||||||
//SKB_LINEAR_ASSERT(skb);
|
|
||||||
skb->tail += len;
|
|
||||||
skb->len += len;
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len)
|
|
||||||
{
|
|
||||||
skb->len -= len;
|
|
||||||
if(skb->len < skb->data_len)
|
|
||||||
printf("%s(),%d,error!\n",__FUNCTION__,__LINE__);
|
|
||||||
return skb->data += len;
|
|
||||||
}
|
|
||||||
static inline unsigned char *skb_pull(struct sk_buff *skb, unsigned int len)
|
|
||||||
{
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
return __skb_pull(skb, len);
|
|
||||||
#else
|
|
||||||
return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len);
|
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
}
|
|
||||||
static inline u32 skb_queue_len(const struct sk_buff_head *list_)
|
|
||||||
{
|
|
||||||
return list_->qlen;
|
|
||||||
}
|
|
||||||
static inline void __skb_insert(struct sk_buff *newsk,
|
|
||||||
struct sk_buff *prev, struct sk_buff *next,
|
|
||||||
struct sk_buff_head *list)
|
|
||||||
{
|
|
||||||
newsk->next = next;
|
|
||||||
newsk->prev = prev;
|
|
||||||
next->prev = prev->next = newsk;
|
|
||||||
list->qlen++;
|
|
||||||
}
|
|
||||||
static inline void __skb_queue_before(struct sk_buff_head *list,
|
|
||||||
struct sk_buff *next,
|
|
||||||
struct sk_buff *newsk)
|
|
||||||
{
|
|
||||||
__skb_insert(newsk, next->prev, next, list);
|
|
||||||
}
|
|
||||||
static inline void skb_queue_tail(struct sk_buff_head *list,
|
|
||||||
struct sk_buff *newsk)
|
|
||||||
{
|
|
||||||
mtx_lock(&list->lock);
|
|
||||||
__skb_queue_before(list, (struct sk_buff *)list, newsk);
|
|
||||||
mtx_unlock(&list->lock);
|
|
||||||
}
|
|
||||||
static inline struct sk_buff *skb_peek(struct sk_buff_head *list_)
|
|
||||||
{
|
|
||||||
struct sk_buff *list = ((struct sk_buff *)list_)->next;
|
|
||||||
if (list == (struct sk_buff *)list_)
|
|
||||||
list = NULL;
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
|
|
||||||
{
|
|
||||||
struct sk_buff *next, *prev;
|
|
||||||
|
|
||||||
list->qlen--;
|
|
||||||
next = skb->next;
|
|
||||||
prev = skb->prev;
|
|
||||||
skb->next = skb->prev = NULL;
|
|
||||||
next->prev = prev;
|
|
||||||
prev->next = next;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline struct sk_buff *skb_dequeue(struct sk_buff_head *list)
|
|
||||||
{
|
|
||||||
mtx_lock(&list->lock);
|
|
||||||
|
|
||||||
struct sk_buff *skb = skb_peek(list);
|
|
||||||
if (skb)
|
|
||||||
__skb_unlink(skb, list);
|
|
||||||
|
|
||||||
mtx_unlock(&list->lock);
|
|
||||||
|
|
||||||
return skb;
|
|
||||||
}
|
|
||||||
static inline void skb_reserve(struct sk_buff *skb, int len)
|
|
||||||
{
|
|
||||||
skb->data += len;
|
|
||||||
skb->tail += len;
|
|
||||||
}
|
|
||||||
static inline void __skb_queue_head_init(struct sk_buff_head *list)
|
|
||||||
{
|
|
||||||
list->prev = list->next = (struct sk_buff *)list;
|
|
||||||
list->qlen = 0;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* This function creates a split out lock class for each invocation;
|
|
||||||
* this is needed for now since a whole lot of users of the skb-queue
|
|
||||||
* infrastructure in drivers have different locking usage (in hardirq)
|
|
||||||
* than the networking core (in softirq only). In the long run either the
|
|
||||||
* network layer or drivers should need annotation to consolidate the
|
|
||||||
* main types of usage into 3 classes.
|
|
||||||
*/
|
|
||||||
static inline void skb_queue_head_init(struct sk_buff_head *list)
|
|
||||||
{
|
|
||||||
_rtw_spinlock_init(&list->lock);
|
|
||||||
__skb_queue_head_init(list);
|
|
||||||
}
|
|
||||||
unsigned long copy_from_user(void *to, const void *from, unsigned long n);
|
|
||||||
unsigned long copy_to_user(void *to, const void *from, unsigned long n);
|
|
||||||
struct sk_buff * dev_alloc_skb(unsigned int size);
|
|
||||||
struct sk_buff *skb_clone(const struct sk_buff *skb);
|
|
||||||
void dev_kfree_skb_any(struct sk_buff *skb);
|
|
||||||
#endif //Baron porting from linux, it's all temp solution, needs to check again
|
|
||||||
|
|
||||||
|
|
||||||
#if 1 // kenny add Linux compatibility code for Linux USB driver
|
|
||||||
#include <dev/usb/usb_compat_linux.h>
|
|
||||||
|
|
||||||
#define __init // __attribute ((constructor))
|
|
||||||
#define __exit // __attribute ((destructor))
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Definitions for module_init and module_exit macros.
|
|
||||||
*
|
|
||||||
* These macros will use the SYSINIT framework to call a specified
|
|
||||||
* function (with no arguments) on module loading or unloading.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
void module_init_exit_wrapper(void *arg);
|
|
||||||
|
|
||||||
#define module_init(initfn) \
|
|
||||||
SYSINIT(mod_init_ ## initfn, \
|
|
||||||
SI_SUB_KLD, SI_ORDER_FIRST, \
|
|
||||||
module_init_exit_wrapper, initfn)
|
|
||||||
|
|
||||||
#define module_exit(exitfn) \
|
|
||||||
SYSUNINIT(mod_exit_ ## exitfn, \
|
|
||||||
SI_SUB_KLD, SI_ORDER_ANY, \
|
|
||||||
module_init_exit_wrapper, exitfn)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The usb_register and usb_deregister functions are used to register
|
|
||||||
* usb drivers with the usb subsystem.
|
|
||||||
*/
|
|
||||||
int usb_register(struct usb_driver *driver);
|
|
||||||
int usb_deregister(struct usb_driver *driver);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* usb_get_dev and usb_put_dev - increment/decrement the reference count
|
|
||||||
* of the usb device structure.
|
|
||||||
*
|
|
||||||
* Original body of usb_get_dev:
|
|
||||||
*
|
|
||||||
* if (dev)
|
|
||||||
* get_device(&dev->dev);
|
|
||||||
* return dev;
|
|
||||||
*
|
|
||||||
* Reference counts are not currently used in this compatibility
|
|
||||||
* layer. So these functions will do nothing.
|
|
||||||
*/
|
|
||||||
static inline struct usb_device *
|
|
||||||
usb_get_dev(struct usb_device *dev)
|
|
||||||
{
|
|
||||||
return dev;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
usb_put_dev(struct usb_device *dev)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// rtw_usb_compat_linux
|
|
||||||
int rtw_usb_submit_urb(struct urb *urb, uint16_t mem_flags);
|
|
||||||
int rtw_usb_unlink_urb(struct urb *urb);
|
|
||||||
int rtw_usb_clear_halt(struct usb_device *dev, struct usb_host_endpoint *uhe);
|
|
||||||
int rtw_usb_control_msg(struct usb_device *dev, struct usb_host_endpoint *uhe,
|
|
||||||
uint8_t request, uint8_t requesttype,
|
|
||||||
uint16_t value, uint16_t index, void *data,
|
|
||||||
uint16_t size, usb_timeout_t timeout);
|
|
||||||
int rtw_usb_set_interface(struct usb_device *dev, uint8_t iface_no, uint8_t alt_index);
|
|
||||||
int rtw_usb_setup_endpoint(struct usb_device *dev,
|
|
||||||
struct usb_host_endpoint *uhe, usb_size_t bufsize);
|
|
||||||
struct urb *rtw_usb_alloc_urb(uint16_t iso_packets, uint16_t mem_flags);
|
|
||||||
struct usb_host_endpoint *rtw_usb_find_host_endpoint(struct usb_device *dev, uint8_t type, uint8_t ep);
|
|
||||||
struct usb_host_interface *rtw_usb_altnum_to_altsetting(const struct usb_interface *intf, uint8_t alt_index);
|
|
||||||
struct usb_interface *rtw_usb_ifnum_to_if(struct usb_device *dev, uint8_t iface_no);
|
|
||||||
void *rtw_usb_buffer_alloc(struct usb_device *dev, usb_size_t size, uint8_t *dma_addr);
|
|
||||||
void *rtw_usbd_get_intfdata(struct usb_interface *intf);
|
|
||||||
void rtw_usb_linux_register(void *arg);
|
|
||||||
void rtw_usb_linux_deregister(void *arg);
|
|
||||||
void rtw_usb_linux_free_device(struct usb_device *dev);
|
|
||||||
void rtw_usb_buffer_free(struct usb_device *dev, usb_size_t size,
|
|
||||||
void *addr, uint8_t dma_addr);
|
|
||||||
void rtw_usb_free_urb(struct urb *urb);
|
|
||||||
void rtw_usb_init_urb(struct urb *urb);
|
|
||||||
void rtw_usb_kill_urb(struct urb *urb);
|
|
||||||
void rtw_usb_set_intfdata(struct usb_interface *intf, void *data);
|
|
||||||
void rtw_usb_fill_bulk_urb(struct urb *urb, struct usb_device *udev,
|
|
||||||
struct usb_host_endpoint *uhe, void *buf,
|
|
||||||
int length, usb_complete_t callback, void *arg);
|
|
||||||
int rtw_usb_bulk_msg(struct usb_device *udev, struct usb_host_endpoint *uhe,
|
|
||||||
void *data, int len, uint16_t *pactlen, usb_timeout_t timeout);
|
|
||||||
void *usb_get_intfdata(struct usb_interface *intf);
|
|
||||||
int usb_linux_init_endpoints(struct usb_device *udev);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct urb * PURB;
|
|
||||||
|
|
||||||
typedef unsigned gfp_t;
|
|
||||||
#define __GFP_WAIT ((gfp_t)0x10u) /* Can wait and reschedule? */
|
|
||||||
#define __GFP_HIGH ((gfp_t)0x20u) /* Should access emergency pools? */
|
|
||||||
#define __GFP_IO ((gfp_t)0x40u) /* Can start physical IO? */
|
|
||||||
#define __GFP_FS ((gfp_t)0x80u) /* Can call down to low-level FS? */
|
|
||||||
#define __GFP_COLD ((gfp_t)0x100u) /* Cache-cold page required */
|
|
||||||
#define __GFP_NOWARN ((gfp_t)0x200u) /* Suppress page allocation failure warning */
|
|
||||||
#define __GFP_REPEAT ((gfp_t)0x400u) /* Retry the allocation. Might fail */
|
|
||||||
#define __GFP_NOFAIL ((gfp_t)0x800u) /* Retry for ever. Cannot fail */
|
|
||||||
#define __GFP_NORETRY ((gfp_t)0x1000u)/* Do not retry. Might fail */
|
|
||||||
#define __GFP_NO_GROW ((gfp_t)0x2000u)/* Slab internal usage */
|
|
||||||
#define __GFP_COMP ((gfp_t)0x4000u)/* Add compound page metadata */
|
|
||||||
#define __GFP_ZERO ((gfp_t)0x8000u)/* Return zeroed page on success */
|
|
||||||
#define __GFP_NOMEMALLOC ((gfp_t)0x10000u) /* Don't use emergency reserves */
|
|
||||||
#define __GFP_HARDWALL ((gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */
|
|
||||||
|
|
||||||
/* This equals 0, but use constants in case they ever change */
|
|
||||||
#define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH)
|
|
||||||
/* GFP_ATOMIC means both !wait (__GFP_WAIT not set) and use emergency pool */
|
|
||||||
#define GFP_ATOMIC (__GFP_HIGH)
|
|
||||||
#define GFP_NOIO (__GFP_WAIT)
|
|
||||||
#define GFP_NOFS (__GFP_WAIT | __GFP_IO)
|
|
||||||
#define GFP_KERNEL (__GFP_WAIT | __GFP_IO | __GFP_FS)
|
|
||||||
#define GFP_USER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL)
|
|
||||||
#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \
|
|
||||||
__GFP_HIGHMEM)
|
|
||||||
|
|
||||||
|
|
||||||
#endif // kenny add Linux compatibility code for Linux USB
|
|
||||||
|
|
||||||
__inline static _list *get_next(_list *list)
|
|
||||||
{
|
|
||||||
return list->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
__inline static _list *get_list_head(_queue *queue)
|
|
||||||
{
|
|
||||||
return (&(queue->queue));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define LIST_CONTAINOR(ptr, type, member) \
|
|
||||||
((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member)))
|
|
||||||
|
|
||||||
|
|
||||||
__inline static void _enter_critical(_lock *plock, _irqL *pirqL)
|
|
||||||
{
|
|
||||||
spin_lock_irqsave(plock, *pirqL);
|
|
||||||
}
|
|
||||||
|
|
||||||
__inline static void _exit_critical(_lock *plock, _irqL *pirqL)
|
|
||||||
{
|
|
||||||
spin_unlock_irqrestore(plock, *pirqL);
|
|
||||||
}
|
|
||||||
|
|
||||||
__inline static void _enter_critical_ex(_lock *plock, _irqL *pirqL)
|
|
||||||
{
|
|
||||||
spin_lock_irqsave(plock, *pirqL);
|
|
||||||
}
|
|
||||||
|
|
||||||
__inline static void _exit_critical_ex(_lock *plock, _irqL *pirqL)
|
|
||||||
{
|
|
||||||
spin_unlock_irqrestore(plock, *pirqL);
|
|
||||||
}
|
|
||||||
|
|
||||||
__inline static void _enter_critical_bh(_lock *plock, _irqL *pirqL)
|
|
||||||
{
|
|
||||||
spin_lock_bh(plock, *pirqL);
|
|
||||||
}
|
|
||||||
|
|
||||||
__inline static void _exit_critical_bh(_lock *plock, _irqL *pirqL)
|
|
||||||
{
|
|
||||||
spin_unlock_bh(plock, *pirqL);
|
|
||||||
}
|
|
||||||
|
|
||||||
__inline static void _enter_critical_mutex(_mutex *pmutex, _irqL *pirqL)
|
|
||||||
{
|
|
||||||
|
|
||||||
mtx_lock(pmutex);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
__inline static void _exit_critical_mutex(_mutex *pmutex, _irqL *pirqL)
|
|
||||||
{
|
|
||||||
|
|
||||||
mtx_unlock(pmutex);
|
|
||||||
|
|
||||||
}
|
|
||||||
static inline void __list_del(struct list_head * prev, struct list_head * next)
|
|
||||||
{
|
|
||||||
next->prev = prev;
|
|
||||||
prev->next = next;
|
|
||||||
}
|
|
||||||
static inline void INIT_LIST_HEAD(struct list_head *list)
|
|
||||||
{
|
|
||||||
list->next = list;
|
|
||||||
list->prev = list;
|
|
||||||
}
|
|
||||||
__inline static void rtw_list_delete(_list *plist)
|
|
||||||
{
|
|
||||||
__list_del(plist->prev, plist->next);
|
|
||||||
INIT_LIST_HEAD(plist);
|
|
||||||
}
|
|
||||||
|
|
||||||
__inline static void _init_timer(_timer *ptimer,_nic_hdl padapter,void *pfunc,void* cntx)
|
|
||||||
{
|
|
||||||
ptimer->function = pfunc;
|
|
||||||
ptimer->arg = cntx;
|
|
||||||
callout_init(&ptimer->callout, CALLOUT_MPSAFE);
|
|
||||||
}
|
|
||||||
|
|
||||||
__inline static void _set_timer(_timer *ptimer,u32 delay_time)
|
|
||||||
{
|
|
||||||
// mod_timer(ptimer , (jiffies+(delay_time*HZ/1000)));
|
|
||||||
if(ptimer->function && ptimer->arg){
|
|
||||||
rtw_mtx_lock(NULL);
|
|
||||||
callout_reset(&ptimer->callout, delay_time,ptimer->function, ptimer->arg);
|
|
||||||
rtw_mtx_unlock(NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
__inline static void _cancel_timer(_timer *ptimer,u8 *bcancelled)
|
|
||||||
{
|
|
||||||
// del_timer_sync(ptimer);
|
|
||||||
// *bcancelled= _TRUE;//TRUE ==1; FALSE==0
|
|
||||||
rtw_mtx_lock(NULL);
|
|
||||||
callout_drain(&ptimer->callout);
|
|
||||||
rtw_mtx_unlock(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
__inline static void _init_workitem(_workitem *pwork, void *pfunc, PVOID cntx)
|
|
||||||
{
|
|
||||||
printf("%s Not implement yet! \n",__FUNCTION__);
|
|
||||||
}
|
|
||||||
|
|
||||||
__inline static void _set_workitem(_workitem *pwork)
|
|
||||||
{
|
|
||||||
printf("%s Not implement yet! \n",__FUNCTION__);
|
|
||||||
// schedule_work(pwork);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Global Mutex: can only be used at PASSIVE level.
|
|
||||||
//
|
|
||||||
|
|
||||||
#define ACQUIRE_GLOBAL_MUTEX(_MutexCounter) \
|
|
||||||
{ \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define RELEASE_GLOBAL_MUTEX(_MutexCounter) \
|
|
||||||
{ \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define ATOMIC_INIT(i) { (i) }
|
|
||||||
|
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
#include <linux/version.h>
|
#include <linux/version.h>
|
||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
|
@ -1439,9 +732,7 @@ extern void _rtw_init_listhead(_list *list);
|
||||||
extern u32 rtw_is_list_empty(_list *phead);
|
extern u32 rtw_is_list_empty(_list *phead);
|
||||||
extern void rtw_list_insert_head(_list *plist, _list *phead);
|
extern void rtw_list_insert_head(_list *plist, _list *phead);
|
||||||
extern void rtw_list_insert_tail(_list *plist, _list *phead);
|
extern void rtw_list_insert_tail(_list *plist, _list *phead);
|
||||||
#ifndef PLATFORM_FREEBSD
|
|
||||||
extern void rtw_list_delete(_list *plist);
|
extern void rtw_list_delete(_list *plist);
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
extern void _rtw_init_sema(_sema *sema, int init_val);
|
extern void _rtw_init_sema(_sema *sema, int init_val);
|
||||||
extern void _rtw_free_sema(_sema *sema);
|
extern void _rtw_free_sema(_sema *sema);
|
||||||
|
@ -1449,9 +740,7 @@ extern void _rtw_up_sema(_sema *sema);
|
||||||
extern u32 _rtw_down_sema(_sema *sema);
|
extern u32 _rtw_down_sema(_sema *sema);
|
||||||
extern void _rtw_mutex_init(_mutex *pmutex);
|
extern void _rtw_mutex_init(_mutex *pmutex);
|
||||||
extern void _rtw_mutex_free(_mutex *pmutex);
|
extern void _rtw_mutex_free(_mutex *pmutex);
|
||||||
#ifndef PLATFORM_FREEBSD
|
|
||||||
extern void _rtw_spinlock_init(_lock *plock);
|
extern void _rtw_spinlock_init(_lock *plock);
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
extern void _rtw_spinlock_free(_lock *plock);
|
extern void _rtw_spinlock_free(_lock *plock);
|
||||||
extern void _rtw_spinlock(_lock *plock);
|
extern void _rtw_spinlock(_lock *plock);
|
||||||
extern void _rtw_spinunlock(_lock *plock);
|
extern void _rtw_spinunlock(_lock *plock);
|
||||||
|
@ -1493,15 +782,8 @@ __inline static unsigned char _cancel_timer_ex(_timer *ptimer)
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
return del_timer_sync(ptimer);
|
return del_timer_sync(ptimer);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
_cancel_timer(ptimer,0);
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
static __inline void thread_enter(char *name);
|
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
static __inline void thread_enter(char *name)
|
static __inline void thread_enter(char *name)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
|
@ -1510,14 +792,8 @@ static __inline void thread_enter(char *name)
|
||||||
#endif
|
#endif
|
||||||
allow_signal(SIGTERM);
|
allow_signal(SIGTERM);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
printf("%s", "RTKTHREAD_enter");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
#define thread_exit() do{printf("%s", "RTKTHREAD_exit");}while(0)
|
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
__inline static void flush_signals_thread(void)
|
__inline static void flush_signals_thread(void)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
|
@ -1530,11 +806,7 @@ __inline static void flush_signals_thread(void)
|
||||||
|
|
||||||
__inline static _OS_STATUS res_to_status(sint res)
|
__inline static _OS_STATUS res_to_status(sint res)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
#if defined (PLATFORM_LINUX) || defined (PLATFORM_MPIXEL) || defined (PLATFORM_FREEBSD)
|
|
||||||
return res;
|
return res;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__inline static void rtw_dump_stack(void)
|
__inline static void rtw_dump_stack(void)
|
||||||
|
@ -1655,11 +927,7 @@ extern void rtw_lock_ext_suspend_timeout(u32 timeout_ms);
|
||||||
|
|
||||||
|
|
||||||
//Atomic integer operations
|
//Atomic integer operations
|
||||||
#ifdef PLATFORM_LINUX
|
|
||||||
#define ATOMIC_T atomic_t
|
#define ATOMIC_T atomic_t
|
||||||
#elif defined(PLATFORM_FREEBSD)
|
|
||||||
typedef uint32_t ATOMIC_T ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern void ATOMIC_SET(ATOMIC_T *v, int i);
|
extern void ATOMIC_SET(ATOMIC_T *v, int i);
|
||||||
extern int ATOMIC_READ(ATOMIC_T *v);
|
extern int ATOMIC_READ(ATOMIC_T *v);
|
||||||
|
@ -1678,7 +946,6 @@ extern int rtw_retrive_from_file(char *path, u8* buf, u32 sz);
|
||||||
extern int rtw_store_to_file(char *path, u8* buf, u32 sz);
|
extern int rtw_store_to_file(char *path, u8* buf, u32 sz);
|
||||||
|
|
||||||
|
|
||||||
#if 1 //#ifdef MEM_ALLOC_REFINE_ADAPTOR
|
|
||||||
struct rtw_netdev_priv_indicator {
|
struct rtw_netdev_priv_indicator {
|
||||||
void *priv;
|
void *priv;
|
||||||
u32 sizeof_priv;
|
u32 sizeof_priv;
|
||||||
|
@ -1686,30 +953,9 @@ struct rtw_netdev_priv_indicator {
|
||||||
struct net_device *rtw_alloc_etherdev_with_old_priv(int sizeof_priv, void *old_priv);
|
struct net_device *rtw_alloc_etherdev_with_old_priv(int sizeof_priv, void *old_priv);
|
||||||
extern struct net_device * rtw_alloc_etherdev(int sizeof_priv);
|
extern struct net_device * rtw_alloc_etherdev(int sizeof_priv);
|
||||||
|
|
||||||
#ifndef PLATFORM_FREEBSD
|
|
||||||
#define rtw_netdev_priv(netdev) ( ((struct rtw_netdev_priv_indicator *)netdev_priv(netdev))->priv )
|
#define rtw_netdev_priv(netdev) ( ((struct rtw_netdev_priv_indicator *)netdev_priv(netdev))->priv )
|
||||||
#else //PLATFORM_FREEBSD
|
|
||||||
#define rtw_netdev_priv(netdev) (((struct ifnet *)netdev)->if_softc)
|
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
#ifndef PLATFORM_FREEBSD
|
|
||||||
extern void rtw_free_netdev(struct net_device * netdev);
|
extern void rtw_free_netdev(struct net_device * netdev);
|
||||||
#else //PLATFORM_FREEBSD
|
|
||||||
#define rtw_free_netdev(netdev) if_free((netdev))
|
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
#else //MEM_ALLOC_REFINE_ADAPTOR
|
|
||||||
|
|
||||||
#define rtw_alloc_etherdev(sizeof_priv) alloc_etherdev((sizeof_priv))
|
|
||||||
|
|
||||||
#ifndef PLATFORM_FREEBSD
|
|
||||||
#define rtw_netdev_priv(netdev) netdev_priv((netdev))
|
|
||||||
#define rtw_free_netdev(netdev) free_netdev((netdev))
|
|
||||||
#else //PLATFORM_FREEBSD
|
|
||||||
#define rtw_netdev_priv(netdev) (((struct ifnet *)netdev)->if_softc)
|
|
||||||
#define rtw_free_netdev(netdev) if_free((netdev))
|
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
#define NDEV_FMT "%s"
|
#define NDEV_FMT "%s"
|
||||||
|
|
|
@ -128,7 +128,7 @@ typedef struct _LED_871x{
|
||||||
u8 bLedStartToLinkBlinkInProgress;
|
u8 bLedStartToLinkBlinkInProgress;
|
||||||
u8 bLedScanBlinkInProgress;
|
u8 bLedScanBlinkInProgress;
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)|| defined PLATFORM_FREEBSD
|
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
|
||||||
_workitem BlinkWorkItem; // Workitem used by BlinkTimer to manipulate H/W to blink LED.
|
_workitem BlinkWorkItem; // Workitem used by BlinkTimer to manipulate H/W to blink LED.
|
||||||
#endif
|
#endif
|
||||||
#endif //defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
|
#endif //defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
|
||||||
|
|
|
@ -630,11 +630,9 @@ extern void rtw_stadel_event_callback(_adapter *adapter, u8 *pbuf);
|
||||||
extern void rtw_atimdone_event_callback(_adapter *adapter, u8 *pbuf);
|
extern void rtw_atimdone_event_callback(_adapter *adapter, u8 *pbuf);
|
||||||
extern void rtw_cpwm_event_callback(_adapter *adapter, u8 *pbuf);
|
extern void rtw_cpwm_event_callback(_adapter *adapter, u8 *pbuf);
|
||||||
|
|
||||||
#if defined (PLATFORM_LINUX)|| defined (PLATFORM_FREEBSD)
|
|
||||||
extern int event_thread(void *context);
|
extern int event_thread(void *context);
|
||||||
extern void rtw_join_timeout_handler(void* FunctionContext);
|
extern void rtw_join_timeout_handler(void* FunctionContext);
|
||||||
extern void _rtw_scan_timeout_handler(void* FunctionContext);
|
extern void _rtw_scan_timeout_handler(void* FunctionContext);
|
||||||
#endif
|
|
||||||
|
|
||||||
extern void rtw_free_network_queue(_adapter *adapter,u8 isfreeall);
|
extern void rtw_free_network_queue(_adapter *adapter,u8 isfreeall);
|
||||||
extern int rtw_init_mlme_priv(_adapter *adapter);// (struct mlme_priv *pmlmepriv);
|
extern int rtw_init_mlme_priv(_adapter *adapter);// (struct mlme_priv *pmlmepriv);
|
||||||
|
|
|
@ -298,14 +298,8 @@ struct recv_priv
|
||||||
#endif //CONFIG_USB_INTERRUPT_IN_PIPE
|
#endif //CONFIG_USB_INTERRUPT_IN_PIPE
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD)
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
struct task irq_prepare_beacon_tasklet;
|
|
||||||
struct task recv_tasklet;
|
|
||||||
#else //PLATFORM_FREEBSD
|
|
||||||
struct tasklet_struct irq_prepare_beacon_tasklet;
|
struct tasklet_struct irq_prepare_beacon_tasklet;
|
||||||
struct tasklet_struct recv_tasklet;
|
struct tasklet_struct recv_tasklet;
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
struct sk_buff_head free_recv_skb_queue;
|
struct sk_buff_head free_recv_skb_queue;
|
||||||
struct sk_buff_head rx_skb_queue;
|
struct sk_buff_head rx_skb_queue;
|
||||||
#ifdef CONFIG_RX_INDICATE_QUEUE
|
#ifdef CONFIG_RX_INDICATE_QUEUE
|
||||||
|
@ -316,7 +310,6 @@ struct recv_priv
|
||||||
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX
|
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX
|
||||||
_queue recv_buf_pending_queue;
|
_queue recv_buf_pending_queue;
|
||||||
#endif // CONFIG_USE_USB_BUFFER_ALLOC_RX
|
#endif // CONFIG_USE_USB_BUFFER_ALLOC_RX
|
||||||
#endif //defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD)
|
|
||||||
|
|
||||||
u8 *pallocated_recv_buf;
|
u8 *pallocated_recv_buf;
|
||||||
u8 *precv_buf; // 4 alignment
|
u8 *precv_buf; // 4 alignment
|
||||||
|
@ -401,19 +394,9 @@ struct recv_buf
|
||||||
|
|
||||||
#ifdef CONFIG_USB_HCI
|
#ifdef CONFIG_USB_HCI
|
||||||
|
|
||||||
#if defined(PLATFORM_OS_XP)||defined(PLATFORM_LINUX)||defined(PLATFORM_FREEBSD)
|
|
||||||
PURB purb;
|
PURB purb;
|
||||||
dma_addr_t dma_transfer_addr; /* (in) dma addr for transfer_buffer */
|
dma_addr_t dma_transfer_addr; /* (in) dma addr for transfer_buffer */
|
||||||
u32 alloc_sz;
|
u32 alloc_sz;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PLATFORM_OS_XP
|
|
||||||
PIRP pirp;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PLATFORM_OS_CE
|
|
||||||
USB_TRANSFER usb_transfer_read_port;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
u8 irp_pending;
|
u8 irp_pending;
|
||||||
int transfer_len;
|
int transfer_len;
|
||||||
|
@ -424,10 +407,6 @@ struct recv_buf
|
||||||
_pkt *pskb;
|
_pkt *pskb;
|
||||||
u8 reuse;
|
u8 reuse;
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD //skb solution
|
|
||||||
struct sk_buff *pskb;
|
|
||||||
u8 reuse;
|
|
||||||
#endif //PLATFORM_FREEBSD //skb solution
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -444,10 +444,6 @@ int tdls_verify_mic(u8 *kck, u8 trans_seq,
|
||||||
void rtw_use_tkipkey_handler(void* FunctionContext);
|
void rtw_use_tkipkey_handler(void* FunctionContext);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
void rtw_use_tkipkey_handler(void* FunctionContext);
|
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
void rtw_sec_restore_wep_key(_adapter *adapter);
|
void rtw_sec_restore_wep_key(_adapter *adapter);
|
||||||
u8 rtw_handle_tkip_countermeasure(_adapter* adapter, const char *caller);
|
u8 rtw_handle_tkip_countermeasure(_adapter* adapter, const char *caller);
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,6 @@
|
||||||
#include <drv_conf.h>
|
#include <drv_conf.h>
|
||||||
#include <osdep_service.h>
|
#include <osdep_service.h>
|
||||||
#include <drv_types.h>
|
#include <drv_types.h>
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
#include <if_ether.h>
|
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
#if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
|
#if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
|
||||||
//#define MAX_XMITBUF_SZ (30720)// (2048)
|
//#define MAX_XMITBUF_SZ (30720)// (2048)
|
||||||
|
@ -308,22 +305,6 @@ struct pkt_attrib
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
#define ETH_ALEN 6 /* Octets in one ethernet addr */
|
|
||||||
#define ETH_HLEN 14 /* Total octets in header. */
|
|
||||||
#define ETH_P_IP 0x0800 /* Internet Protocol packet */
|
|
||||||
|
|
||||||
/*struct rtw_ieee80211_hdr {
|
|
||||||
uint16_t frame_control;
|
|
||||||
uint16_t duration_id;
|
|
||||||
u8 addr1[6];
|
|
||||||
u8 addr2[6];
|
|
||||||
u8 addr3[6];
|
|
||||||
uint16_t seq_ctrl;
|
|
||||||
u8 addr4[6];
|
|
||||||
} ;*/
|
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
#define WLANHDR_OFFSET 64
|
#define WLANHDR_OFFSET 64
|
||||||
|
|
||||||
#define NULL_FRAMETAG (0x0)
|
#define NULL_FRAMETAG (0x0)
|
||||||
|
@ -394,19 +375,8 @@ struct xmit_buf
|
||||||
//u32 sz[8];
|
//u32 sz[8];
|
||||||
u32 ff_hwaddr;
|
u32 ff_hwaddr;
|
||||||
|
|
||||||
#if defined(PLATFORM_OS_XP)||defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD)
|
|
||||||
PURB pxmit_urb[8];
|
PURB pxmit_urb[8];
|
||||||
dma_addr_t dma_transfer_addr; /* (in) dma addr for transfer_buffer */
|
dma_addr_t dma_transfer_addr; /* (in) dma addr for transfer_buffer */
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PLATFORM_OS_XP
|
|
||||||
PIRP pxmit_irp[8];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PLATFORM_OS_CE
|
|
||||||
USB_TRANSFER usb_transfer_write_port;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
u8 bpending[8];
|
u8 bpending[8];
|
||||||
|
|
||||||
sint last[8];
|
sint last[8];
|
||||||
|
@ -590,9 +560,6 @@ struct xmit_priv {
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
struct tasklet_struct xmit_tasklet;
|
struct tasklet_struct xmit_tasklet;
|
||||||
#endif
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
struct task xmit_tasklet;
|
|
||||||
#endif
|
#endif
|
||||||
//per AC pending irp
|
//per AC pending irp
|
||||||
int beq_cnt;
|
int beq_cnt;
|
||||||
|
|
|
@ -84,14 +84,7 @@ void rtl8192du_set_hw_type(_adapter *padapter);
|
||||||
#define hal_set_hw_type rtl8192du_set_hw_type
|
#define hal_set_hw_type rtl8192du_set_hw_type
|
||||||
void rtl8192du_set_intf_ops(struct _io_ops *pops);
|
void rtl8192du_set_intf_ops(struct _io_ops *pops);
|
||||||
#define usb_set_intf_ops rtl8192du_set_intf_ops
|
#define usb_set_intf_ops rtl8192du_set_intf_ops
|
||||||
#ifndef PLATFORM_FREEBSD
|
|
||||||
void rtl8192du_recv_tasklet(void *priv);
|
void rtl8192du_recv_tasklet(void *priv);
|
||||||
#else // PLATFORM_FREEBSD
|
|
||||||
void rtl8192du_recv_tasklet(void *priv, int npending);
|
|
||||||
#ifdef CONFIG_RX_INDICATE_QUEUE
|
|
||||||
void rtw_rx_indicate_tasklet(void *priv, int npending);
|
|
||||||
#endif // CONFIG_RX_INDICATE_QUEUE
|
|
||||||
#endif // PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
void rtl8192du_xmit_tasklet(void *priv);
|
void rtl8192du_xmit_tasklet(void *priv);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -678,11 +678,6 @@ struct rtw_ieee80211_bar {
|
||||||
#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
|
#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
|
||||||
#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004
|
#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004
|
||||||
|
|
||||||
|
|
||||||
#if defined(PLATFORM_LINUX) || defined(CONFIG_RTL8712FW) || defined(PLATFORM_FREEBSD)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct rtw_ieee80211_ht_cap - HT capabilities
|
* struct rtw_ieee80211_ht_cap - HT capabilities
|
||||||
*
|
*
|
||||||
|
@ -760,8 +755,6 @@ struct ADDBA_request
|
||||||
__le16 BA_starting_seqctrl;
|
__le16 BA_starting_seqctrl;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum _HT_CAP_AMPDU_FACTOR {
|
typedef enum _HT_CAP_AMPDU_FACTOR {
|
||||||
MAX_AMPDU_FACTOR_8K = 0,
|
MAX_AMPDU_FACTOR_8K = 0,
|
||||||
MAX_AMPDU_FACTOR_16K = 1,
|
MAX_AMPDU_FACTOR_16K = 1,
|
||||||
|
|
|
@ -296,275 +296,6 @@ typedef struct _NDIS_802_11_TEST
|
||||||
|
|
||||||
#endif //end of #ifdef PLATFORM_LINUX
|
#endif //end of #ifdef PLATFORM_LINUX
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
#define NDIS_802_11_LENGTH_SSID 32
|
|
||||||
#define NDIS_802_11_LENGTH_RATES 8
|
|
||||||
#define NDIS_802_11_LENGTH_RATES_EX 16
|
|
||||||
|
|
||||||
typedef unsigned char NDIS_802_11_MAC_ADDRESS[6];
|
|
||||||
typedef long NDIS_802_11_RSSI; // in dBm
|
|
||||||
typedef unsigned char NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; // Set of 8 data rates
|
|
||||||
typedef unsigned char NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; // Set of 16 data rates
|
|
||||||
|
|
||||||
|
|
||||||
typedef ULONG NDIS_802_11_KEY_INDEX;
|
|
||||||
typedef unsigned long long NDIS_802_11_KEY_RSC;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _NDIS_802_11_SSID
|
|
||||||
{
|
|
||||||
ULONG SsidLength;
|
|
||||||
UCHAR Ssid[32];
|
|
||||||
} NDIS_802_11_SSID, *PNDIS_802_11_SSID;
|
|
||||||
|
|
||||||
typedef enum _NDIS_802_11_NETWORK_TYPE
|
|
||||||
{
|
|
||||||
Ndis802_11FH,
|
|
||||||
Ndis802_11DS,
|
|
||||||
Ndis802_11OFDM5,
|
|
||||||
Ndis802_11OFDM24,
|
|
||||||
Ndis802_11NetworkTypeMax // not a real type, defined as an upper bound
|
|
||||||
} NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE;
|
|
||||||
|
|
||||||
typedef struct _NDIS_802_11_CONFIGURATION_FH
|
|
||||||
{
|
|
||||||
ULONG Length; // Length of structure
|
|
||||||
ULONG HopPattern; // As defined by 802.11, MSB set
|
|
||||||
ULONG HopSet; // to one if non-802.11
|
|
||||||
ULONG DwellTime; // units are Kusec
|
|
||||||
} NDIS_802_11_CONFIGURATION_FH, *PNDIS_802_11_CONFIGURATION_FH;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
FW will only save the channel number in DSConfig.
|
|
||||||
ODI Handler will convert the channel number to freq. number.
|
|
||||||
*/
|
|
||||||
typedef struct _NDIS_802_11_CONFIGURATION
|
|
||||||
{
|
|
||||||
ULONG Length; // Length of structure
|
|
||||||
ULONG BeaconPeriod; // units are Kusec
|
|
||||||
ULONG ATIMWindow; // units are Kusec
|
|
||||||
ULONG DSConfig; // Frequency, units are kHz
|
|
||||||
NDIS_802_11_CONFIGURATION_FH FHConfig;
|
|
||||||
} NDIS_802_11_CONFIGURATION, *PNDIS_802_11_CONFIGURATION;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE
|
|
||||||
{
|
|
||||||
Ndis802_11IBSS,
|
|
||||||
Ndis802_11Infrastructure,
|
|
||||||
Ndis802_11AutoUnknown,
|
|
||||||
Ndis802_11InfrastructureMax, // Not a real value, defined as upper bound
|
|
||||||
Ndis802_11APMode
|
|
||||||
} NDIS_802_11_NETWORK_INFRASTRUCTURE, *PNDIS_802_11_NETWORK_INFRASTRUCTURE;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _NDIS_802_11_FIXED_IEs
|
|
||||||
{
|
|
||||||
UCHAR Timestamp[8];
|
|
||||||
USHORT BeaconInterval;
|
|
||||||
USHORT Capabilities;
|
|
||||||
} NDIS_802_11_FIXED_IEs, *PNDIS_802_11_FIXED_IEs;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _NDIS_802_11_VARIABLE_IEs
|
|
||||||
{
|
|
||||||
UCHAR ElementID;
|
|
||||||
UCHAR Length;
|
|
||||||
UCHAR data[1];
|
|
||||||
} NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Length is the 4 bytes multiples of the sume of
|
|
||||||
sizeof (NDIS_802_11_MAC_ADDRESS) + 2 + sizeof (NDIS_802_11_SSID) + sizeof (ULONG)
|
|
||||||
+ sizeof (NDIS_802_11_RSSI) + sizeof (NDIS_802_11_NETWORK_TYPE) + sizeof (NDIS_802_11_CONFIGURATION)
|
|
||||||
+ sizeof (NDIS_802_11_RATES_EX) + IELength
|
|
||||||
|
|
||||||
Except the IELength, all other fields are fixed length. Therefore, we can define a marco to present the
|
|
||||||
partial sum.
|
|
||||||
|
|
||||||
*/
|
|
||||||
#if 0
|
|
||||||
typedef struct _NDIS_WLAN_BSSID_EX
|
|
||||||
{
|
|
||||||
ULONG Length;
|
|
||||||
NDIS_802_11_MAC_ADDRESS MacAddress;
|
|
||||||
UCHAR Reserved[2];//[0]: IS beacon frame, [1]:optimum_antenna=>For antenna diversity;
|
|
||||||
NDIS_802_11_SSID Ssid;
|
|
||||||
ULONG Privacy;
|
|
||||||
NDIS_802_11_RSSI Rssi;
|
|
||||||
NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
|
|
||||||
NDIS_802_11_CONFIGURATION Configuration;
|
|
||||||
NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode;
|
|
||||||
NDIS_802_11_RATES_EX SupportedRates;
|
|
||||||
ULONG IELength;
|
|
||||||
UCHAR IEs[MAX_IE_SZ]; //(timestamp, beacon interval, and capability information)
|
|
||||||
} NDIS_WLAN_BSSID_EX, *PNDIS_WLAN_BSSID_EX;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _NDIS_802_11_BSSID_LIST_EX
|
|
||||||
{
|
|
||||||
ULONG NumberOfItems;
|
|
||||||
NDIS_WLAN_BSSID_EX Bssid[1];
|
|
||||||
} NDIS_802_11_BSSID_LIST_EX, *PNDIS_802_11_BSSID_LIST_EX;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum _NDIS_802_11_AUTHENTICATION_MODE
|
|
||||||
{
|
|
||||||
Ndis802_11AuthModeOpen,
|
|
||||||
Ndis802_11AuthModeShared,
|
|
||||||
Ndis802_11AuthModeAutoSwitch,
|
|
||||||
Ndis802_11AuthModeWPA,
|
|
||||||
Ndis802_11AuthModeWPAPSK,
|
|
||||||
Ndis802_11AuthModeWPANone,
|
|
||||||
Ndis802_11AuthModeMax // Not a real mode, defined as upper bound
|
|
||||||
} NDIS_802_11_AUTHENTICATION_MODE, *PNDIS_802_11_AUTHENTICATION_MODE;
|
|
||||||
|
|
||||||
typedef enum _NDIS_802_11_WEP_STATUS
|
|
||||||
{
|
|
||||||
Ndis802_11WEPEnabled,
|
|
||||||
Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
|
|
||||||
Ndis802_11WEPDisabled,
|
|
||||||
Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
|
|
||||||
Ndis802_11WEPKeyAbsent,
|
|
||||||
Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
|
|
||||||
Ndis802_11WEPNotSupported,
|
|
||||||
Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
|
|
||||||
Ndis802_11Encryption2Enabled,
|
|
||||||
Ndis802_11Encryption2KeyAbsent,
|
|
||||||
Ndis802_11Encryption3Enabled,
|
|
||||||
Ndis802_11Encryption3KeyAbsent
|
|
||||||
} NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
|
|
||||||
NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
|
|
||||||
|
|
||||||
|
|
||||||
#define NDIS_802_11_AI_REQFI_CAPABILITIES 1
|
|
||||||
#define NDIS_802_11_AI_REQFI_LISTENINTERVAL 2
|
|
||||||
#define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS 4
|
|
||||||
|
|
||||||
#define NDIS_802_11_AI_RESFI_CAPABILITIES 1
|
|
||||||
#define NDIS_802_11_AI_RESFI_STATUSCODE 2
|
|
||||||
#define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4
|
|
||||||
|
|
||||||
typedef struct _NDIS_802_11_AI_REQFI
|
|
||||||
{
|
|
||||||
USHORT Capabilities;
|
|
||||||
USHORT ListenInterval;
|
|
||||||
NDIS_802_11_MAC_ADDRESS CurrentAPAddress;
|
|
||||||
} NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI;
|
|
||||||
|
|
||||||
typedef struct _NDIS_802_11_AI_RESFI
|
|
||||||
{
|
|
||||||
USHORT Capabilities;
|
|
||||||
USHORT StatusCode;
|
|
||||||
USHORT AssociationId;
|
|
||||||
} NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI;
|
|
||||||
|
|
||||||
typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
|
|
||||||
{
|
|
||||||
ULONG Length;
|
|
||||||
USHORT AvailableRequestFixedIEs;
|
|
||||||
NDIS_802_11_AI_REQFI RequestFixedIEs;
|
|
||||||
ULONG RequestIELength;
|
|
||||||
ULONG OffsetRequestIEs;
|
|
||||||
USHORT AvailableResponseFixedIEs;
|
|
||||||
NDIS_802_11_AI_RESFI ResponseFixedIEs;
|
|
||||||
ULONG ResponseIELength;
|
|
||||||
ULONG OffsetResponseIEs;
|
|
||||||
} NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
|
|
||||||
|
|
||||||
typedef enum _NDIS_802_11_RELOAD_DEFAULTS
|
|
||||||
{
|
|
||||||
Ndis802_11ReloadWEPKeys
|
|
||||||
} NDIS_802_11_RELOAD_DEFAULTS, *PNDIS_802_11_RELOAD_DEFAULTS;
|
|
||||||
|
|
||||||
|
|
||||||
// Key mapping keys require a BSSID
|
|
||||||
typedef struct _NDIS_802_11_KEY
|
|
||||||
{
|
|
||||||
ULONG Length; // Length of this structure
|
|
||||||
ULONG KeyIndex;
|
|
||||||
ULONG KeyLength; // length of key in bytes
|
|
||||||
NDIS_802_11_MAC_ADDRESS BSSID;
|
|
||||||
NDIS_802_11_KEY_RSC KeyRSC;
|
|
||||||
UCHAR KeyMaterial[32]; // variable length depending on above field
|
|
||||||
} NDIS_802_11_KEY, *PNDIS_802_11_KEY;
|
|
||||||
|
|
||||||
typedef struct _NDIS_802_11_REMOVE_KEY
|
|
||||||
{
|
|
||||||
ULONG Length; // Length of this structure
|
|
||||||
ULONG KeyIndex;
|
|
||||||
NDIS_802_11_MAC_ADDRESS BSSID;
|
|
||||||
} NDIS_802_11_REMOVE_KEY, *PNDIS_802_11_REMOVE_KEY;
|
|
||||||
|
|
||||||
typedef struct _NDIS_802_11_WEP
|
|
||||||
{
|
|
||||||
ULONG Length; // Length of this structure
|
|
||||||
ULONG KeyIndex; // 0 is the per-client key, 1-N are the global keys
|
|
||||||
ULONG KeyLength; // length of key in bytes
|
|
||||||
UCHAR KeyMaterial[16];// variable length depending on above field
|
|
||||||
} NDIS_802_11_WEP, *PNDIS_802_11_WEP;
|
|
||||||
|
|
||||||
typedef struct _NDIS_802_11_AUTHENTICATION_REQUEST
|
|
||||||
{
|
|
||||||
ULONG Length; // Length of structure
|
|
||||||
NDIS_802_11_MAC_ADDRESS Bssid;
|
|
||||||
ULONG Flags;
|
|
||||||
} NDIS_802_11_AUTHENTICATION_REQUEST, *PNDIS_802_11_AUTHENTICATION_REQUEST;
|
|
||||||
|
|
||||||
typedef enum _NDIS_802_11_STATUS_TYPE
|
|
||||||
{
|
|
||||||
Ndis802_11StatusType_Authentication,
|
|
||||||
Ndis802_11StatusType_MediaStreamMode,
|
|
||||||
Ndis802_11StatusType_PMKID_CandidateList,
|
|
||||||
Ndis802_11StatusTypeMax // not a real type, defined as an upper bound
|
|
||||||
} NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE;
|
|
||||||
|
|
||||||
typedef struct _NDIS_802_11_STATUS_INDICATION
|
|
||||||
{
|
|
||||||
NDIS_802_11_STATUS_TYPE StatusType;
|
|
||||||
} NDIS_802_11_STATUS_INDICATION, *PNDIS_802_11_STATUS_INDICATION;
|
|
||||||
|
|
||||||
// mask for authentication/integrity fields
|
|
||||||
#define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f
|
|
||||||
#define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01
|
|
||||||
#define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02
|
|
||||||
#define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06
|
|
||||||
#define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E
|
|
||||||
|
|
||||||
// MIC check time, 60 seconds.
|
|
||||||
#define MIC_CHECK_TIME 60000000
|
|
||||||
|
|
||||||
typedef struct _NDIS_802_11_AUTHENTICATION_EVENT
|
|
||||||
{
|
|
||||||
NDIS_802_11_STATUS_INDICATION Status;
|
|
||||||
NDIS_802_11_AUTHENTICATION_REQUEST Request[1];
|
|
||||||
} NDIS_802_11_AUTHENTICATION_EVENT, *PNDIS_802_11_AUTHENTICATION_EVENT;
|
|
||||||
|
|
||||||
typedef struct _NDIS_802_11_TEST
|
|
||||||
{
|
|
||||||
ULONG Length;
|
|
||||||
ULONG Type;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
NDIS_802_11_AUTHENTICATION_EVENT AuthenticationEvent;
|
|
||||||
NDIS_802_11_RSSI RssiTrigger;
|
|
||||||
}tt;
|
|
||||||
} NDIS_802_11_TEST, *PNDIS_802_11_TEST;
|
|
||||||
|
|
||||||
|
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
#ifndef Ndis802_11APMode
|
#ifndef Ndis802_11APMode
|
||||||
#define Ndis802_11APMode (Ndis802_11InfrastructureMax+1)
|
#define Ndis802_11APMode (Ndis802_11InfrastructureMax+1)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -33,12 +33,6 @@ struct pkt_file {
|
||||||
SIZE_T buf_len;
|
SIZE_T buf_len;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
#define NR_XMITFRAME 256
|
|
||||||
extern int rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev);
|
|
||||||
extern void rtw_xmit_entry_wrap (struct ifnet * pifp);
|
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
|
|
||||||
#define NR_XMITFRAME 256
|
#define NR_XMITFRAME 256
|
||||||
|
|
|
@ -28,10 +28,6 @@
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
#include <linux/vmalloc.h>
|
#include <linux/vmalloc.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
#include <sys/malloc.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#endif /* PLATFORM_FREEBSD */
|
|
||||||
#ifdef RTK_DMP_PLATFORM
|
#ifdef RTK_DMP_PLATFORM
|
||||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12))
|
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12))
|
||||||
#include <linux/pageremap.h>
|
#include <linux/pageremap.h>
|
||||||
|
@ -99,10 +95,6 @@ inline u8* _rtw_vmalloc(u32 sz)
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
pbuf = vmalloc(sz);
|
pbuf = vmalloc(sz);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
pbuf = malloc(sz,M_DEVBUF,M_NOWAIT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DBG_MEMORY_LEAK
|
#ifdef DBG_MEMORY_LEAK
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
if ( pbuf != NULL) {
|
if ( pbuf != NULL) {
|
||||||
|
@ -122,9 +114,6 @@ inline u8* _rtw_zvmalloc(u32 sz)
|
||||||
pbuf = _rtw_vmalloc(sz);
|
pbuf = _rtw_vmalloc(sz);
|
||||||
if (pbuf != NULL)
|
if (pbuf != NULL)
|
||||||
memset(pbuf, 0, sz);
|
memset(pbuf, 0, sz);
|
||||||
#endif
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
pbuf = malloc(sz,M_DEVBUF,M_ZERO|M_NOWAIT);
|
|
||||||
#endif
|
#endif
|
||||||
return pbuf;
|
return pbuf;
|
||||||
}
|
}
|
||||||
|
@ -134,9 +123,6 @@ inline void _rtw_vmfree(u8 *pbuf, u32 sz)
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
vfree(pbuf);
|
vfree(pbuf);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
free(pbuf,M_DEVBUF);
|
|
||||||
#endif
|
|
||||||
#ifdef DBG_MEMORY_LEAK
|
#ifdef DBG_MEMORY_LEAK
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
atomic_dec(&_malloc_cnt);
|
atomic_dec(&_malloc_cnt);
|
||||||
|
@ -159,9 +145,6 @@ u8* _rtw_malloc(u32 sz)
|
||||||
pbuf = kmalloc(sz,in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
|
pbuf = kmalloc(sz,in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
pbuf = malloc(sz,M_DEVBUF,M_NOWAIT);
|
|
||||||
#endif
|
|
||||||
#ifdef DBG_MEMORY_LEAK
|
#ifdef DBG_MEMORY_LEAK
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
if ( pbuf != NULL) {
|
if ( pbuf != NULL) {
|
||||||
|
@ -178,9 +161,6 @@ u8* _rtw_malloc(u32 sz)
|
||||||
|
|
||||||
u8* _rtw_zmalloc(u32 sz)
|
u8* _rtw_zmalloc(u32 sz)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
return malloc(sz,M_DEVBUF,M_ZERO|M_NOWAIT);
|
|
||||||
#else // PLATFORM_FREEBSD
|
|
||||||
u8 *pbuf = _rtw_malloc(sz);
|
u8 *pbuf = _rtw_malloc(sz);
|
||||||
|
|
||||||
if (pbuf != NULL) {
|
if (pbuf != NULL) {
|
||||||
|
@ -191,7 +171,6 @@ u8* _rtw_zmalloc(u32 sz)
|
||||||
}
|
}
|
||||||
|
|
||||||
return pbuf;
|
return pbuf;
|
||||||
#endif // PLATFORM_FREEBSD
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _rtw_mfree(u8 *pbuf, u32 sz)
|
void _rtw_mfree(u8 *pbuf, u32 sz)
|
||||||
|
@ -206,9 +185,6 @@ void _rtw_mfree(u8 *pbuf, u32 sz)
|
||||||
kfree(pbuf);
|
kfree(pbuf);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
free(pbuf,M_DEVBUF);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DBG_MEMORY_LEAK
|
#ifdef DBG_MEMORY_LEAK
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
|
@ -219,62 +195,11 @@ void _rtw_mfree(u8 *pbuf, u32 sz)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
inline struct sk_buff *_rtw_skb_alloc(u32 sz)
|
||||||
//review again
|
|
||||||
struct sk_buff * dev_alloc_skb(unsigned int size)
|
|
||||||
{
|
|
||||||
struct sk_buff *skb=NULL;
|
|
||||||
u8 *data=NULL;
|
|
||||||
|
|
||||||
//skb = (struct sk_buff *)_rtw_zmalloc(sizeof(struct sk_buff)); // for skb->len, etc.
|
|
||||||
skb = (struct sk_buff *)_rtw_malloc(sizeof(struct sk_buff));
|
|
||||||
if(!skb)
|
|
||||||
goto out;
|
|
||||||
data = _rtw_malloc(size);
|
|
||||||
if(!data)
|
|
||||||
goto nodata;
|
|
||||||
|
|
||||||
skb->head = (unsigned char*)data;
|
|
||||||
skb->data = (unsigned char*)data;
|
|
||||||
skb->tail = (unsigned char*)data;
|
|
||||||
skb->end = (unsigned char*)data + size;
|
|
||||||
skb->len = 0;
|
|
||||||
//printf("%s()-%d: skb=%p, skb->head = %p\n", __FUNCTION__, __LINE__, skb, skb->head);
|
|
||||||
|
|
||||||
out:
|
|
||||||
return skb;
|
|
||||||
nodata:
|
|
||||||
_rtw_mfree((u8 *)skb, sizeof(struct sk_buff));
|
|
||||||
skb = NULL;
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void dev_kfree_skb_any(struct sk_buff *skb)
|
|
||||||
{
|
|
||||||
//printf("%s()-%d: skb->head = %p\n", __FUNCTION__, __LINE__, skb->head);
|
|
||||||
if(skb->head)
|
|
||||||
_rtw_mfree(skb->head, 0);
|
|
||||||
//printf("%s()-%d: skb = %p\n", __FUNCTION__, __LINE__, skb);
|
|
||||||
if(skb)
|
|
||||||
_rtw_mfree((u8 *)skb, 0);
|
|
||||||
}
|
|
||||||
struct sk_buff *skb_clone(const struct sk_buff *skb)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* PLATFORM_FREEBSD */
|
|
||||||
|
|
||||||
inline struct sk_buff *_rtw_skb_alloc(u32 sz)
|
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
return __dev_alloc_skb(sz, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
|
return __dev_alloc_skb(sz, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
|
||||||
#endif /* PLATFORM_LINUX */
|
#endif /* PLATFORM_LINUX */
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
return dev_alloc_skb(sz);
|
|
||||||
#endif /* PLATFORM_FREEBSD */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void _rtw_skb_free(struct sk_buff *skb)
|
inline void _rtw_skb_free(struct sk_buff *skb)
|
||||||
|
@ -287,10 +212,6 @@ inline struct sk_buff *_rtw_skb_copy(const struct sk_buff *skb)
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
return skb_copy(skb, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
|
return skb_copy(skb, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
|
||||||
#endif /* PLATFORM_LINUX */
|
#endif /* PLATFORM_LINUX */
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
return NULL;
|
|
||||||
#endif /* PLATFORM_FREEBSD */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline struct sk_buff *_rtw_skb_clone(struct sk_buff *skb)
|
inline struct sk_buff *_rtw_skb_clone(struct sk_buff *skb)
|
||||||
|
@ -298,10 +219,6 @@ inline struct sk_buff *_rtw_skb_clone(struct sk_buff *skb)
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
return skb_clone(skb, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
|
return skb_clone(skb, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
|
||||||
#endif /* PLATFORM_LINUX */
|
#endif /* PLATFORM_LINUX */
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
return skb_clone(skb);
|
|
||||||
#endif /* PLATFORM_FREEBSD */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int _rtw_netif_rx(_nic_hdl ndev, struct sk_buff *skb)
|
inline int _rtw_netif_rx(_nic_hdl ndev, struct sk_buff *skb)
|
||||||
|
@ -310,10 +227,6 @@ inline int _rtw_netif_rx(_nic_hdl ndev, struct sk_buff *skb)
|
||||||
skb->dev = ndev;
|
skb->dev = ndev;
|
||||||
return netif_rx(skb);
|
return netif_rx(skb);
|
||||||
#endif /* PLATFORM_LINUX */
|
#endif /* PLATFORM_LINUX */
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
return (*ndev->if_input)(ndev, skb);
|
|
||||||
#endif /* PLATFORM_FREEBSD */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _rtw_skb_queue_purge(struct sk_buff_head *list)
|
void _rtw_skb_queue_purge(struct sk_buff_head *list)
|
||||||
|
@ -334,11 +247,8 @@ inline void *_rtw_usb_buffer_alloc(struct usb_device *dev, size_t size, dma_addr
|
||||||
return usb_buffer_alloc(dev, size, (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL), dma);
|
return usb_buffer_alloc(dev, size, (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL), dma);
|
||||||
#endif
|
#endif
|
||||||
#endif /* PLATFORM_LINUX */
|
#endif /* PLATFORM_LINUX */
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
return (malloc(size, M_USBDEV, M_NOWAIT | M_ZERO));
|
|
||||||
#endif /* PLATFORM_FREEBSD */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void _rtw_usb_buffer_free(struct usb_device *dev, size_t size, void *addr, dma_addr_t dma)
|
inline void _rtw_usb_buffer_free(struct usb_device *dev, size_t size, void *addr, dma_addr_t dma)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
|
@ -348,10 +258,6 @@ inline void _rtw_usb_buffer_free(struct usb_device *dev, size_t size, void *addr
|
||||||
usb_buffer_free(dev, size, addr, dma);
|
usb_buffer_free(dev, size, addr, dma);
|
||||||
#endif
|
#endif
|
||||||
#endif /* PLATFORM_LINUX */
|
#endif /* PLATFORM_LINUX */
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
free(addr, M_USBDEV);
|
|
||||||
#endif /* PLATFORM_FREEBSD */
|
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_USB_HCI */
|
#endif /* CONFIG_USB_HCI */
|
||||||
|
|
||||||
|
@ -762,51 +668,23 @@ void rtw_mfree2d(void *pbuf, int h, int w, int size)
|
||||||
|
|
||||||
void _rtw_memcpy(void* dst, void* src, u32 sz)
|
void _rtw_memcpy(void* dst, void* src, u32 sz)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if defined (PLATFORM_LINUX)|| defined (PLATFORM_FREEBSD)
|
|
||||||
|
|
||||||
memcpy(dst, src, sz);
|
memcpy(dst, src, sz);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int _rtw_memcmp(void *dst, void *src, u32 sz)
|
int _rtw_memcmp(void *dst, void *src, u32 sz)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if defined (PLATFORM_LINUX)|| defined (PLATFORM_FREEBSD)
|
|
||||||
//under Linux/GNU/GLibc, the return value of memcmp for two same mem. chunk is 0
|
//under Linux/GNU/GLibc, the return value of memcmp for two same mem. chunk is 0
|
||||||
|
|
||||||
if (!(memcmp(dst, src, sz)))
|
if (!(memcmp(dst, src, sz)))
|
||||||
return _TRUE;
|
return _TRUE;
|
||||||
else
|
else
|
||||||
return _FALSE;
|
return _FALSE;
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _rtw_memset(void *pbuf, int c, u32 sz)
|
void _rtw_memset(void *pbuf, int c, u32 sz)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if defined (PLATFORM_LINUX)|| defined (PLATFORM_FREEBSD)
|
|
||||||
|
|
||||||
memset(pbuf, c, sz);
|
memset(pbuf, c, sz);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
static inline void __list_add(_list *pnew, _list *pprev, _list *pnext)
|
|
||||||
{
|
|
||||||
pnext->prev = pnew;
|
|
||||||
pnew->next = pnext;
|
|
||||||
pnew->prev = pprev;
|
|
||||||
pprev->next = pnew;
|
|
||||||
}
|
|
||||||
#endif /* PLATFORM_FREEBSD */
|
|
||||||
|
|
||||||
void _rtw_init_listhead(_list *list)
|
void _rtw_init_listhead(_list *list)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -815,11 +693,6 @@ void _rtw_init_listhead(_list *list)
|
||||||
INIT_LIST_HEAD(list);
|
INIT_LIST_HEAD(list);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
list->next = list;
|
|
||||||
list->prev = list;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -838,14 +711,6 @@ u32 rtw_is_list_empty(_list *phead)
|
||||||
else
|
else
|
||||||
return _FALSE;
|
return _FALSE;
|
||||||
|
|
||||||
#endif
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
if (phead->next == phead)
|
|
||||||
return _TRUE;
|
|
||||||
else
|
|
||||||
return _FALSE;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -855,11 +720,6 @@ void rtw_list_insert_head(_list *plist, _list *phead)
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
list_add(plist, phead);
|
list_add(plist, phead);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
__list_add(plist, phead, phead->next);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtw_list_insert_tail(_list *plist, _list *phead)
|
void rtw_list_insert_tail(_list *plist, _list *phead)
|
||||||
|
@ -869,11 +729,6 @@ void rtw_list_insert_tail(_list *plist, _list *phead)
|
||||||
|
|
||||||
list_add_tail(plist, phead);
|
list_add_tail(plist, phead);
|
||||||
|
|
||||||
#endif
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
__list_add(plist, phead->prev, phead);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -893,31 +748,10 @@ void _rtw_init_sema(_sema *sema, int init_val)
|
||||||
sema_init(sema, init_val);
|
sema_init(sema, init_val);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
sema_init(sema, init_val, "rtw_drv");
|
|
||||||
#endif
|
|
||||||
#ifdef PLATFORM_OS_XP
|
|
||||||
|
|
||||||
KeInitializeSemaphore(sema, init_val, SEMA_UPBND); // count=0;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PLATFORM_OS_CE
|
|
||||||
if(*sema == NULL)
|
|
||||||
*sema = CreateSemaphore(NULL, init_val, SEMA_UPBND, NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _rtw_free_sema(_sema *sema)
|
void _rtw_free_sema(_sema *sema)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
sema_destroy(sema);
|
|
||||||
#endif
|
|
||||||
#ifdef PLATFORM_OS_CE
|
|
||||||
CloseHandle(*sema);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _rtw_up_sema(_sema *sema)
|
void _rtw_up_sema(_sema *sema)
|
||||||
|
@ -928,18 +762,6 @@ void _rtw_up_sema(_sema *sema)
|
||||||
up(sema);
|
up(sema);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
sema_post(sema);
|
|
||||||
#endif
|
|
||||||
#ifdef PLATFORM_OS_XP
|
|
||||||
|
|
||||||
KeReleaseSemaphore(sema, IO_NETWORK_INCREMENT, 1, FALSE );
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PLATFORM_OS_CE
|
|
||||||
ReleaseSemaphore(*sema, 1, NULL );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 _rtw_down_sema(_sema *sema)
|
u32 _rtw_down_sema(_sema *sema)
|
||||||
|
@ -951,25 +773,6 @@ u32 _rtw_down_sema(_sema *sema)
|
||||||
return _FAIL;
|
return _FAIL;
|
||||||
else
|
else
|
||||||
return _SUCCESS;
|
return _SUCCESS;
|
||||||
|
|
||||||
#endif
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
sema_wait(sema);
|
|
||||||
return _SUCCESS;
|
|
||||||
#endif
|
|
||||||
#ifdef PLATFORM_OS_XP
|
|
||||||
|
|
||||||
if(STATUS_SUCCESS == KeWaitForSingleObject(sema, Executive, KernelMode, TRUE, NULL))
|
|
||||||
return _SUCCESS;
|
|
||||||
else
|
|
||||||
return _FAIL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PLATFORM_OS_CE
|
|
||||||
if(WAIT_OBJECT_0 == WaitForSingleObject(*sema, INFINITE ))
|
|
||||||
return _SUCCESS;
|
|
||||||
else
|
|
||||||
return _FAIL;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -985,43 +788,16 @@ void _rtw_mutex_init(_mutex *pmutex)
|
||||||
init_MUTEX(pmutex);
|
init_MUTEX(pmutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
mtx_init(pmutex, "", NULL, MTX_DEF|MTX_RECURSE);
|
|
||||||
#endif
|
|
||||||
#ifdef PLATFORM_OS_XP
|
|
||||||
|
|
||||||
KeInitializeMutex(pmutex, 0);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PLATFORM_OS_CE
|
|
||||||
*pmutex = CreateMutex( NULL, _FALSE, NULL);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void _rtw_mutex_free(_mutex *pmutex);
|
|
||||||
void _rtw_mutex_free(_mutex *pmutex)
|
void _rtw_mutex_free(_mutex *pmutex)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
|
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
|
||||||
mutex_destroy(pmutex);
|
mutex_destroy(pmutex);
|
||||||
#else
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
sema_destroy(pmutex);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PLATFORM_OS_XP
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PLATFORM_OS_CE
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1033,40 +809,11 @@ void _rtw_spinlock_init(_lock *plock)
|
||||||
spin_lock_init(plock);
|
spin_lock_init(plock);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
mtx_init(plock, "", NULL, MTX_DEF|MTX_RECURSE);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _rtw_spinlock_free(_lock *plock)
|
void _rtw_spinlock_free(_lock *plock)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
mtx_destroy(plock);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
extern PADAPTER prtw_lock;
|
|
||||||
|
|
||||||
void rtw_mtx_lock(_lock *plock){
|
|
||||||
if(prtw_lock){
|
|
||||||
mtx_lock(&prtw_lock->glock);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
printf("%s prtw_lock==NULL",__FUNCTION__);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void rtw_mtx_unlock(_lock *plock){
|
|
||||||
if(prtw_lock){
|
|
||||||
mtx_unlock(&prtw_lock->glock);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
printf("%s prtw_lock==NULL",__FUNCTION__);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
|
|
||||||
void _rtw_spinlock(_lock *plock)
|
void _rtw_spinlock(_lock *plock)
|
||||||
{
|
{
|
||||||
|
@ -1076,22 +823,13 @@ void _rtw_spinlock(_lock *plock)
|
||||||
spin_lock(plock);
|
spin_lock(plock);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
mtx_lock(plock);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _rtw_spinunlock(_lock *plock)
|
void _rtw_spinunlock(_lock *plock)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
|
|
||||||
spin_unlock(plock);
|
spin_unlock(plock);
|
||||||
|
|
||||||
#endif
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
mtx_unlock(plock);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1104,9 +842,6 @@ void _rtw_spinlock_ex(_lock *plock)
|
||||||
spin_lock(plock);
|
spin_lock(plock);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
mtx_lock(plock);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _rtw_spinunlock_ex(_lock *plock)
|
void _rtw_spinunlock_ex(_lock *plock)
|
||||||
|
@ -1117,13 +852,8 @@ void _rtw_spinunlock_ex(_lock *plock)
|
||||||
spin_unlock(plock);
|
spin_unlock(plock);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
mtx_unlock(plock);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void _rtw_init_queue(_queue *pqueue)
|
void _rtw_init_queue(_queue *pqueue)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1154,11 +884,6 @@ u32 rtw_get_current_time(void)
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
return jiffies;
|
return jiffies;
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
struct timeval tvp;
|
|
||||||
getmicrotime(&tvp);
|
|
||||||
return tvp.tv_sec;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline u32 rtw_systime_to_ms(u32 systime)
|
inline u32 rtw_systime_to_ms(u32 systime)
|
||||||
|
@ -1166,9 +891,6 @@ inline u32 rtw_systime_to_ms(u32 systime)
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
return systime * 1000 / HZ;
|
return systime * 1000 / HZ;
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
return systime * 1000;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline u32 rtw_ms_to_systime(u32 ms)
|
inline u32 rtw_ms_to_systime(u32 ms)
|
||||||
|
@ -1176,9 +898,6 @@ inline u32 rtw_ms_to_systime(u32 ms)
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
return ms * HZ / 1000;
|
return ms * HZ / 1000;
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
return ms /1000;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// the input parameter start use the same unit as returned by rtw_get_current_time
|
// the input parameter start use the same unit as returned by rtw_get_current_time
|
||||||
|
@ -1187,9 +906,6 @@ inline s32 rtw_get_passing_time_ms(u32 start)
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
return rtw_systime_to_ms(jiffies-start);
|
return rtw_systime_to_ms(jiffies-start);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
return rtw_systime_to_ms(rtw_get_current_time());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline s32 rtw_get_time_interval_ms(u32 start, u32 end)
|
inline s32 rtw_get_time_interval_ms(u32 start, u32 end)
|
||||||
|
@ -1197,9 +913,6 @@ inline s32 rtw_get_time_interval_ms(u32 start, u32 end)
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
return rtw_systime_to_ms(end-start);
|
return rtw_systime_to_ms(end-start);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
return rtw_systime_to_ms(rtw_get_current_time());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1221,10 +934,6 @@ void rtw_sleep_schedulable(int ms)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
DELAY(ms*1000);
|
|
||||||
return ;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1236,11 +945,6 @@ void rtw_msleep_os(int ms)
|
||||||
msleep((unsigned int)ms);
|
msleep((unsigned int)ms);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
//Delay for delay microseconds
|
|
||||||
DELAY(ms*1000);
|
|
||||||
return ;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtw_usleep_os(int us)
|
void rtw_usleep_os(int us)
|
||||||
|
@ -1255,12 +959,6 @@ void rtw_usleep_os(int us)
|
||||||
msleep( (us/1000) + 1);
|
msleep( (us/1000) + 1);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
//Delay for delay microseconds
|
|
||||||
DELAY(us);
|
|
||||||
|
|
||||||
return ;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1285,11 +983,6 @@ void rtw_mdelay_os(int ms)
|
||||||
mdelay((unsigned long)ms);
|
mdelay((unsigned long)ms);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
DELAY(ms*1000);
|
|
||||||
return ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
void rtw_udelay_os(int us)
|
void rtw_udelay_os(int us)
|
||||||
{
|
{
|
||||||
|
@ -1299,11 +992,6 @@ void rtw_udelay_os(int us)
|
||||||
udelay((unsigned long)us);
|
udelay((unsigned long)us);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
//Delay for delay microseconds
|
|
||||||
DELAY(us);
|
|
||||||
return ;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1312,9 +1000,6 @@ void rtw_yield_os()
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
yield();
|
yield();
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
yield();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RTW_SUSPEND_LOCK_NAME "rtw_wifi"
|
#define RTW_SUSPEND_LOCK_NAME "rtw_wifi"
|
||||||
|
@ -1403,8 +1088,6 @@ inline void ATOMIC_SET(ATOMIC_T *v, int i)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
atomic_set(v,i);
|
atomic_set(v,i);
|
||||||
#elif defined(PLATFORM_FREEBSD)
|
|
||||||
atomic_set_int(v,i);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1412,8 +1095,6 @@ inline int ATOMIC_READ(ATOMIC_T *v)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
return atomic_read(v);
|
return atomic_read(v);
|
||||||
#elif defined(PLATFORM_FREEBSD)
|
|
||||||
return atomic_load_acq_32(v);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1421,16 +1102,12 @@ inline void ATOMIC_ADD(ATOMIC_T *v, int i)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
atomic_add(i,v);
|
atomic_add(i,v);
|
||||||
#elif defined(PLATFORM_FREEBSD)
|
|
||||||
atomic_add_int(v,i);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
inline void ATOMIC_SUB(ATOMIC_T *v, int i)
|
inline void ATOMIC_SUB(ATOMIC_T *v, int i)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
atomic_sub(i,v);
|
atomic_sub(i,v);
|
||||||
#elif defined(PLATFORM_FREEBSD)
|
|
||||||
atomic_subtract_int(v,i);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1438,8 +1115,6 @@ inline void ATOMIC_INC(ATOMIC_T *v)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
atomic_inc(v);
|
atomic_inc(v);
|
||||||
#elif defined(PLATFORM_FREEBSD)
|
|
||||||
atomic_add_int(v,1);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1447,8 +1122,6 @@ inline void ATOMIC_DEC(ATOMIC_T *v)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
atomic_dec(v);
|
atomic_dec(v);
|
||||||
#elif defined(PLATFORM_FREEBSD)
|
|
||||||
atomic_subtract_int(v,1);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1456,9 +1129,6 @@ inline int ATOMIC_ADD_RETURN(ATOMIC_T *v, int i)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
return atomic_add_return(i,v);
|
return atomic_add_return(i,v);
|
||||||
#elif defined(PLATFORM_FREEBSD)
|
|
||||||
atomic_add_int(v,i);
|
|
||||||
return atomic_load_acq_32(v);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1466,9 +1136,6 @@ inline int ATOMIC_SUB_RETURN(ATOMIC_T *v, int i)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
return atomic_sub_return(i,v);
|
return atomic_sub_return(i,v);
|
||||||
#elif defined(PLATFORM_FREEBSD)
|
|
||||||
atomic_subtract_int(v,i);
|
|
||||||
return atomic_load_acq_32(v);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1476,9 +1143,6 @@ inline int ATOMIC_INC_RETURN(ATOMIC_T *v)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
return atomic_inc_return(v);
|
return atomic_inc_return(v);
|
||||||
#elif defined(PLATFORM_FREEBSD)
|
|
||||||
atomic_add_int(v,1);
|
|
||||||
return atomic_load_acq_32(v);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1486,9 +1150,6 @@ inline int ATOMIC_DEC_RETURN(ATOMIC_T *v)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
return atomic_dec_return(v);
|
return atomic_dec_return(v);
|
||||||
#elif defined(PLATFORM_FREEBSD)
|
|
||||||
atomic_subtract_int(v,1);
|
|
||||||
return atomic_load_acq_32(v);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1859,76 +1520,6 @@ error:
|
||||||
#endif
|
#endif
|
||||||
#endif //MEM_ALLOC_REFINE_ADAPTOR
|
#endif //MEM_ALLOC_REFINE_ADAPTOR
|
||||||
|
|
||||||
#ifdef PLATFORM_FREEBSD
|
|
||||||
/*
|
|
||||||
* Copy a buffer from userspace and write into kernel address
|
|
||||||
* space.
|
|
||||||
*
|
|
||||||
* This emulation just calls the FreeBSD copyin function (to
|
|
||||||
* copy data from user space buffer into a kernel space buffer)
|
|
||||||
* and is designed to be used with the above io_write_wrapper.
|
|
||||||
*
|
|
||||||
* This function should return the number of bytes not copied.
|
|
||||||
* I.e. success results in a zero value.
|
|
||||||
* Negative error values are not returned.
|
|
||||||
*/
|
|
||||||
unsigned long
|
|
||||||
copy_from_user(void *to, const void *from, unsigned long n)
|
|
||||||
{
|
|
||||||
if ( copyin(from, to, n) != 0 ) {
|
|
||||||
/* Any errors will be treated as a failure
|
|
||||||
to copy any of the requested bytes */
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned long
|
|
||||||
copy_to_user(void *to, const void *from, unsigned long n)
|
|
||||||
{
|
|
||||||
if ( copyout(from, to, n) != 0 ) {
|
|
||||||
/* Any errors will be treated as a failure
|
|
||||||
to copy any of the requested bytes */
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The usb_register and usb_deregister functions are used to register
|
|
||||||
* usb drivers with the usb subsystem. In this compatibility layer
|
|
||||||
* emulation a list of drivers (struct usb_driver) is maintained
|
|
||||||
* and is used for probing/attaching etc.
|
|
||||||
*
|
|
||||||
* usb_register and usb_deregister simply call these functions.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
usb_register(struct usb_driver *driver)
|
|
||||||
{
|
|
||||||
rtw_usb_linux_register(driver);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
usb_deregister(struct usb_driver *driver)
|
|
||||||
{
|
|
||||||
rtw_usb_linux_deregister(driver);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void module_init_exit_wrapper(void *arg)
|
|
||||||
{
|
|
||||||
int (*func)(void) = arg;
|
|
||||||
func();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif //PLATFORM_FREEBSD
|
|
||||||
|
|
||||||
#ifdef CONFIG_PLATFORM_SPRD
|
#ifdef CONFIG_PLATFORM_SPRD
|
||||||
#ifdef do_div
|
#ifdef do_div
|
||||||
#undef do_div
|
#undef do_div
|
||||||
|
@ -1940,8 +1531,6 @@ u64 rtw_modular64(u64 x, u64 y)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
return do_div(x, y);
|
return do_div(x, y);
|
||||||
#elif defined(PLATFORM_FREEBSD)
|
|
||||||
return (x %y);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1950,8 +1539,6 @@ u64 rtw_division64(u64 x, u64 y)
|
||||||
#ifdef PLATFORM_LINUX
|
#ifdef PLATFORM_LINUX
|
||||||
do_div(x, y);
|
do_div(x, y);
|
||||||
return x;
|
return x;
|
||||||
#elif defined(PLATFORM_FREEBSD)
|
|
||||||
return (x / y);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue