diff --git a/build_install_no_kms.sh b/build_install_no_kms.sh new file mode 100755 index 0000000..ced116d --- /dev/null +++ b/build_install_no_kms.sh @@ -0,0 +1,9 @@ +#bin/bash + +# need to run make 2 times for whatever reason to get the .ko +make +make + +sudo rmmod 88XXau_wfb + +sudo insmod 88XXau_wfb.ko diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index 4fd8df1..1b9acc8 100644 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -7170,12 +7170,14 @@ struct xmit_frame *_alloc_mgtxmitframe(struct xmit_priv *pxmitpriv, bool once) if (pmgntframe == NULL) { RTW_INFO(FUNC_ADPT_FMT" alloc xmitframe fail, once:%d\n", FUNC_ADPT_ARG(pxmitpriv->adapter), once); + //RTW_WARN("OpenHD rtw_alloc_xmitframe fail, once:%d\n", once); goto exit; } pxmitbuf = rtw_alloc_xmitbuf_ext(pxmitpriv); if (pxmitbuf == NULL) { RTW_INFO(FUNC_ADPT_FMT" alloc xmitbuf fail\n", FUNC_ADPT_ARG(pxmitpriv->adapter)); + //RTW_WARN("OpenHD rtw_alloc_xmitbuf_ext fail\n"); rtw_free_xmitframe(pxmitpriv, pmgntframe); pmgntframe = NULL; goto exit; diff --git a/core/rtw_recv.c b/core/rtw_recv.c index 3999948..d69f460 100644 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -3800,6 +3800,9 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe) rt_len++; // alignment } + //RTW_WARN("OpenHD rx_pwdb_all:%d rx_power:%d recv_signal_power:%d bt_rx_rssi_percentage:%d signal_strength:%d SNR:[%d:%d:%d:%d]\n",pattrib->phy_info.rx_pwdb_all,pattrib->phy_info.rx_power, + // pattrib->phy_info.recv_signal_power,pattrib->phy_info.bt_rx_rssi_percentage,pattrib->phy_info.signal_strength, + // pattrib->phy_info.rx_snr[0],pattrib->phy_info.rx_snr[1],pattrib->phy_info.rx_snr[2],pattrib->phy_info.rx_snr[3]); /* Signal Quality */ rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_LOCK_QUALITY); diff --git a/core/rtw_rf.c b/core/rtw_rf.c index 6bcf812..59d95d4 100644 --- a/core/rtw_rf.c +++ b/core/rtw_rf.c @@ -218,7 +218,8 @@ u8 rtw_get_scch_by_cch_offset(u8 cch, u8 bw, u8 offset) } /* 2.4G, 40MHz */ - if (cch >= 3 && cch <= 11 && bw == CHANNEL_WIDTH_40) { + //if (cch >= 3 && cch <= 11 && bw == CHANNEL_WIDTH_40) { + if (cch >= 3 && cch <= 14 && bw == CHANNEL_WIDTH_40) { // OpenHD fix: t_cch = (offset == HAL_PRIME_CHNL_OFFSET_UPPER) ? cch + 2 : cch - 2; goto exit; } @@ -234,7 +235,8 @@ u8 rtw_get_scch_by_cch_offset(u8 cch, u8 bw, u8 offset) goto exit; /* 5G, 40MHz */ - } else if (cch >= 38 && cch <= 175 && bw == CHANNEL_WIDTH_40) { + //} else if (cch >= 38 && cch <= 175 && bw == CHANNEL_WIDTH_40) { + } else if (cch >= 32 && cch <= 177 && bw == CHANNEL_WIDTH_40) { //OpenHD fix: t_cch = (offset == HAL_PRIME_CHNL_OFFSET_UPPER) ? cch + 2 : cch - 2; goto exit; diff --git a/core/rtw_xmit.c b/core/rtw_xmit.c index 29dad43..745875d 100644 --- a/core/rtw_xmit.c +++ b/core/rtw_xmit.c @@ -26,7 +26,8 @@ static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; -static int openhd_tx_error_count=0; +static int openhd_alloc_mgtxmitframe_error_count=0; +static int openhd_monitor_alloc_mgtxmitframe_error_count=0; static void _init_txservq(struct tx_servq *ptxservq) { @@ -3105,9 +3106,10 @@ struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv) _enter_critical(&pfree_queue->lock, &irqL); - if (_rtw_queue_empty(pfree_queue) == _TRUE) - pxmitbuf = NULL; - else { + if (_rtw_queue_empty(pfree_queue) == _TRUE) { + pxmitbuf = NULL; + //RTW_WARN("OpenHD alloc rtw_alloc_xmitbuf_ext fail NR_XMIT_EXTBUFF:%d MAX_XMIT_EXTBUF_SZ:%d\n",NR_XMIT_EXTBUFF,MAX_XMIT_EXTBUF_SZ); + }else { phead = get_list_head(pfree_queue); @@ -3124,7 +3126,6 @@ struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv) RTW_INFO("DBG_XMIT_BUF_EXT ALLOC no=%d, free_xmit_extbuf_cnt=%d\n", pxmitbuf->no, pxmitpriv->free_xmit_extbuf_cnt); #endif - pxmitbuf->priv_data = NULL; #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) @@ -3374,13 +3375,11 @@ struct xmit_frame *rtw_alloc_xmitframe_ext(struct xmit_priv *pxmitpriv) _list *plist, *phead; _queue *queue = &pxmitpriv->free_xframe_ext_queue; - // OpenHD: From rtw_mlme_ext.c we go via function calls back to here - //RTW_WARN("OpenHD: calling rtw_alloc_xmitframe_ext"); - _enter_critical_bh(&queue->lock, &irqL); if (_rtw_queue_empty(queue) == _TRUE) { pxframe = NULL; + //RTW_WARN("OpenHD alloc rtw_alloc_xmitframe_ext failed "); } else { phead = get_list_head(queue); plist = get_next(phead); @@ -4235,10 +4234,22 @@ static struct xmit_frame* monitor_alloc_mgtxmitframe(struct xmit_priv *pxmitpriv // OpenHD: Here a method that returns a frame if place is in the queue // Is called 4 times with a (increasing) sleep until there is space in the queue // If no space is in the queue after 4 calls, NULL is returned + // The method alloc_mgtxmitframe just calls + // _alloc_mgtxmitframe(pxmitpriv, _FALSE); (once=false) + // wich then calls rtw_alloc_xmitframe_ext + // and rtw_alloc_xmitbuf_ext (Frame and buffer) + // If one of these 2 fails, it returns NULL + // rtw_alloc_xmitframe_ext uses the free_xframe_ext_queue + // rtw_alloc_xmitbuf_ext uses the free_xmit_extbuf_queue + // On tx errors, rtw_alloc_xmitbuf_ext seems to be the one that fails all the time + // with size(s) NR_XMIT_EXTBUFF:64 MAX_XMIT_EXTBUF_SZ:1536 (default in driver as original) for(tries = 3; tries >= 0; tries--) { pmgntframe = alloc_mgtxmitframe(pxmitpriv); if(pmgntframe != NULL) return pmgntframe; + openhd_alloc_mgtxmitframe_error_count++; + //RTW_WARN("OpenHD: alloc_mgtxmitframe failed, retries:%d, total error count %d:%d", + // tries,openhd_alloc_mgtxmitframe_error_count,openhd_monitor_alloc_mgtxmitframe_error_count); rtw_udelay_os(delay); delay += delay/2; } @@ -4273,6 +4284,9 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev) u32 len = skb->len; u8 category, action; int type = -1; + // OpenHD debug + u64 before_allocate; + u64 delta_allocate; if (skb) rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize); @@ -4289,10 +4303,14 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev) goto fail; //RTW_WARN("OpenHD: calling monitor_alloc_mgtxmitframe X"); + before_allocate=ktime_get_ns(); if ((pmgntframe = monitor_alloc_mgtxmitframe(pxmitpriv)) == NULL) { DBG_COUNTER(padapter->tx_logs.core_tx_err_pxmitframe); - openhd_tx_error_count++; - RTW_WARN("OpenHD: monitor_alloc_mgtxmitframe - tx busy %d",openhd_tx_error_count); + openhd_monitor_alloc_mgtxmitframe_error_count++; + delta_allocate=ktime_get_ns()-before_allocate; + RTW_WARN("OpenHD: monitor_alloc_mgtxmitframe - (%dus) tx busy %d", + (int)(delta_allocate/1000), + openhd_monitor_alloc_mgtxmitframe_error_count); return NETDEV_TX_BUSY; } diff --git a/hal/rtl8812a/usb/rtl8812au_xmit.c b/hal/rtl8812a/usb/rtl8812au_xmit.c index b368128..2434fd4 100644 --- a/hal/rtl8812a/usb/rtl8812au_xmit.c +++ b/hal/rtl8812a/usb/rtl8812au_xmit.c @@ -121,8 +121,11 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz , u8 ba /* injected frame */ if(pattrib->inject == 0xa5) { SET_TX_DESC_RETRY_LIMIT_ENABLE_8812(ptxdesc, 1); + //RTW_WARN("pattrib->retry_ctrl %d\n",(int)pattrib->retry_ctrl); if (pattrib->retry_ctrl == _TRUE) { - SET_TX_DESC_DATA_RETRY_LIMIT_8812(ptxdesc, 6); + // OpenHD: See https://patchwork.kernel.org/project/linux-wireless/patch/477d745b-6bac-111d-403c-487fc19aa30d@gmail.com/ + //SET_TX_DESC_DATA_RETRY_LIMIT_8812(ptxdesc, 6); + SET_TX_DESC_DATA_RETRY_LIMIT_8812(ptxdesc, 32); } else { SET_TX_DESC_DATA_RETRY_LIMIT_8812(ptxdesc, 0); }