rtl8188eu: Remove CONFIG_USE_USB_BUFFER_ALLOC_RX

This was never defined.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2015-02-26 14:06:11 -06:00
parent fdafd36b5e
commit 42a1d09fe1
6 changed files with 1 additions and 423 deletions

View file

@ -148,10 +148,6 @@ void rtw_mfree_recv_priv_lock(struct recv_priv *precvpriv)
_rtw_spinlock_free(&precvpriv->recv_pending_queue.lock); _rtw_spinlock_free(&precvpriv->recv_pending_queue.lock);
_rtw_spinlock_free(&precvpriv->free_recv_buf_queue.lock); _rtw_spinlock_free(&precvpriv->free_recv_buf_queue.lock);
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX
_rtw_spinlock_free(&precvpriv->recv_buf_pending_queue.lock);
#endif /* CONFIG_USE_USB_BUFFER_ALLOC_RX */
} }
void _rtw_free_recv_priv (struct recv_priv *precvpriv) void _rtw_free_recv_priv (struct recv_priv *precvpriv)

View file

@ -85,10 +85,6 @@ int rtl8188eu_init_recv_priv(struct adapter *padapter)
/* init recv_buf */ /* init recv_buf */
_rtw_init_queue(&precvpriv->free_recv_buf_queue); _rtw_init_queue(&precvpriv->free_recv_buf_queue);
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX
_rtw_init_queue(&precvpriv->recv_buf_pending_queue);
#endif /* CONFIG_USE_USB_BUFFER_ALLOC_RX */
precvpriv->pallocated_recv_buf = rtw_zmalloc(NR_RECVBUFF *sizeof(struct recv_buf) + 4); precvpriv->pallocated_recv_buf = rtw_zmalloc(NR_RECVBUFF *sizeof(struct recv_buf) + 4);
if(precvpriv->pallocated_recv_buf==NULL){ if(precvpriv->pallocated_recv_buf==NULL){
res= _FAIL; res= _FAIL;
@ -98,14 +94,10 @@ int rtl8188eu_init_recv_priv(struct adapter *padapter)
memset(precvpriv->pallocated_recv_buf, 0, NR_RECVBUFF *sizeof(struct recv_buf) + 4); memset(precvpriv->pallocated_recv_buf, 0, NR_RECVBUFF *sizeof(struct recv_buf) + 4);
precvpriv->precv_buf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(precvpriv->pallocated_recv_buf), 4); precvpriv->precv_buf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(precvpriv->pallocated_recv_buf), 4);
/* precvpriv->precv_buf = precvpriv->pallocated_recv_buf + 4 - */
/* ((uint) (precvpriv->pallocated_recv_buf) &(4-1)); */
precvbuf = (struct recv_buf*)precvpriv->precv_buf; precvbuf = (struct recv_buf*)precvpriv->precv_buf;
for(i=0; i < NR_RECVBUFF ; i++) for(i=0; i < NR_RECVBUFF ; i++) {
{
_rtw_init_listhead(&precvbuf->list); _rtw_init_listhead(&precvbuf->list);
_rtw_spinlock_init(&precvbuf->recvbuf_lock); _rtw_spinlock_init(&precvbuf->recvbuf_lock);

View file

@ -446,382 +446,6 @@ static s32 pre_recv_entry(union recv_frame *precvframe, struct recv_stat *prxsta
return ret; return ret;
} }
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX
static int recvbuf2recvframe(struct adapter *padapter, struct recv_buf *precvbuf)
{
u8 *pbuf;
u8 shift_sz = 0;
u16 pkt_cnt, drvinfo_sz;
u32 pkt_offset, skb_len, alloc_sz;
s32 transfer_len;
struct recv_stat *prxstat;
struct phy_stat *pphy_status = NULL;
_pkt *pkt_copy = NULL;
union recv_frame *precvframe = NULL;
struct rx_pkt_attrib *pattrib = NULL;
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
struct recv_priv *precvpriv = &padapter->recvpriv;
_queue *pfree_recv_queue = &precvpriv->free_recv_queue;
transfer_len = (s32)precvbuf->transfer_len;
pbuf = precvbuf->pbuf;
prxstat = (struct recv_stat *)pbuf;
pkt_cnt = (le32_to_cpu(prxstat->rxdw2)>>16) & 0xff;
do{
RT_TRACE(_module_rtl871x_recv_c_, _drv_info_,
("recvbuf2recvframe: rxdesc=offsset 0:0x%08x, 4:0x%08x, 8:0x%08x, C:0x%08x\n",
prxstat->rxdw0, prxstat->rxdw1, prxstat->rxdw2, prxstat->rxdw4));
prxstat = (struct recv_stat *)pbuf;
precvframe = rtw_alloc_recvframe(pfree_recv_queue);
if (precvframe==NULL)
{
RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("recvbuf2recvframe: precvframe==NULL\n"));
DBG_8192C("%s()-%d: rtw_alloc_recvframe() failed! RX Drop!\n", __FUNCTION__, __LINE__);
goto _exit_recvbuf2recvframe;
}
_rtw_init_listhead(&precvframe->u.hdr.list);
precvframe->u.hdr.precvbuf = NULL; /* can't access the precvbuf for new arch. */
precvframe->u.hdr.len=0;
/* rtl8192c_query_rx_desc_status(precvframe, prxstat); */
update_recvframe_attrib_88e(precvframe, prxstat);
pattrib = &precvframe->u.hdr.attrib;
if ((padapter->registrypriv.mp_mode == 0) &&((pattrib->crc_err) || (pattrib->icv_err)))
{
DBG_8192C("%s: RX Warning! crc_err=%d icv_err=%d, skip!\n", __FUNCTION__, pattrib->crc_err, pattrib->icv_err);
rtw_free_recvframe(precvframe, pfree_recv_queue);
goto _exit_recvbuf2recvframe;
}
if ( (pattrib->physt) && (pattrib->pkt_rpt_type == NORMAL_RX))
{
pphy_status = (struct phy_stat *)(pbuf + RXDESC_OFFSET);
}
pkt_offset = RXDESC_SIZE + pattrib->drvinfo_sz + pattrib->shift_sz + pattrib->pkt_len;
if ((pattrib->pkt_len<=0) || (pkt_offset>transfer_len))
{
RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("recvbuf2recvframe: pkt_len<=0\n"));
DBG_8192C("%s()-%d: RX Warning!\n", __FUNCTION__, __LINE__);
rtw_free_recvframe(precvframe, pfree_recv_queue);
goto _exit_recvbuf2recvframe;
}
/* Modified by Albert 20101213 */
/* For 8 bytes IP header alignment. */
if (pattrib->qos) /* Qos data, wireless lan header length is 26 */
{
shift_sz = 6;
}
else
{
shift_sz = 0;
}
skb_len = pattrib->pkt_len;
/* for first fragment packet, driver need allocate 1536+drvinfo_sz+RXDESC_SIZE to defrag packet. */
/* modify alloc_sz for recvive crc error packet by thomas 2011-06-02 */
if ((pattrib->mfrag == 1)&&(pattrib->frag_num == 0)){
if (skb_len <= 1650)
alloc_sz = 1664;
else
alloc_sz = skb_len + 14;
}
else {
alloc_sz = skb_len;
/* 6 is for IP header 8 bytes alignment in QoS packet case. */
/* 8 is for skb->data 4 bytes alignment. */
alloc_sz += 14;
}
pkt_copy = rtw_skb_alloc(alloc_sz);
if (pkt_copy)
{
pkt_copy->dev = padapter->pnetdev;
precvframe->u.hdr.pkt = pkt_copy;
precvframe->u.hdr.rx_head = pkt_copy->data;
precvframe->u.hdr.rx_end = pkt_copy->data + alloc_sz;
skb_reserve( pkt_copy, 8 - ((SIZE_PTR)( pkt_copy->data ) & 7 ));/* force pkt_copy->data at 8-byte alignment address */
skb_reserve( pkt_copy, shift_sz );/* force ip_hdr at 8-byte alignment address according to shift_sz. */
memcpy(pkt_copy->data, (pbuf + pattrib->drvinfo_sz + RXDESC_SIZE), skb_len);
precvframe->u.hdr.rx_data = precvframe->u.hdr.rx_tail = pkt_copy->data;
}
else
{
DBG_8192C("recvbuf2recvframe:can not allocate memory for skb copy\n");
/* precvframe->u.hdr.pkt = rtw_skb_clone(pskb); */
/* precvframe->u.hdr.rx_head = precvframe->u.hdr.rx_data = precvframe->u.hdr.rx_tail = pbuf; */
/* precvframe->u.hdr.rx_end = pbuf + (pkt_offset>1612?pkt_offset:1612); */
precvframe->u.hdr.pkt = NULL;
rtw_free_recvframe(precvframe, pfree_recv_queue);
goto _exit_recvbuf2recvframe;
}
recvframe_put(precvframe, skb_len);
/* recvframe_pull(precvframe, drvinfo_sz + RXDESC_SIZE); */
#ifdef CONFIG_USB_RX_AGGREGATION
switch(pHalData->UsbRxAggMode)
{
case USB_RX_AGG_DMA:
case USB_RX_AGG_MIX:
pkt_offset = (u16)_RND128(pkt_offset);
break;
case USB_RX_AGG_USB:
pkt_offset = (u16)_RND4(pkt_offset);
break;
case USB_RX_AGG_DISABLE:
default:
break;
}
#endif
if (pattrib->pkt_rpt_type == NORMAL_RX)/* Normal rx packet */
{
if (pattrib->physt)
update_recvframe_phyinfo_88e(precvframe, (struct phy_stat*)pphy_status);
if (rtw_recv_entry(precvframe) != _SUCCESS)
{
RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,
("recvbuf2recvframe: rtw_recv_entry(precvframe) != _SUCCESS\n"));
}
} else{ /* pkt_rpt_type == TX_REPORT1-CCX, TX_REPORT2-TX RTP,HIS_REPORT-USB HISR RTP */
/* enqueue recvframe to txrtp queue */
if (pattrib->pkt_rpt_type == TX_REPORT1){
/* DBG_8192C("rx CCX \n"); */
/* CCX-TXRPT ack for xmit mgmt frames. */
handle_txrpt_ccx_88e(padapter, precvframe->u.hdr.rx_data);
}
else if (pattrib->pkt_rpt_type == TX_REPORT2){
/* DBG_8192C("rx TX RPT \n"); */
ODM_RA_TxRPT2Handle_8188E(
&pHalData->odmpriv,
precvframe->u.hdr.rx_data,
pattrib->pkt_len,
pattrib->MacIDValidEntry[0],
pattrib->MacIDValidEntry[1]
);
}
else if (pattrib->pkt_rpt_type == HIS_REPORT)
{
/* DBG_8192C("%s , rx USB HISR \n",__FUNCTION__); */
#ifdef CONFIG_SUPPORT_USB_INT
interrupt_handler_8188eu(padapter,pattrib->pkt_len,precvframe->u.hdr.rx_data);
#endif
}
rtw_free_recvframe(precvframe, pfree_recv_queue);
}
pkt_cnt--;
transfer_len -= pkt_offset;
pbuf += pkt_offset;
precvframe = NULL;
pkt_copy = NULL;
if (transfer_len>0 && pkt_cnt==0)
pkt_cnt = (le32_to_cpu(prxstat->rxdw2)>>16) & 0xff;
}while((transfer_len>0) && (pkt_cnt>0));
_exit_recvbuf2recvframe:
return _SUCCESS;
}
void rtl8188eu_recv_tasklet(void *priv)
{
struct recv_buf *precvbuf = NULL;
struct adapter *padapter = (struct adapter*)priv;
struct recv_priv *precvpriv = &padapter->recvpriv;
while (NULL != (precvbuf = rtw_dequeue_recvbuf(&precvpriv->recv_buf_pending_queue)))
{
if ((padapter->bDriverStopped == true)||(padapter->bSurpriseRemoved== true))
{
DBG_8192C("recv_tasklet => bDriverStopped or bSurpriseRemoved \n");
break;
}
recvbuf2recvframe(padapter, precvbuf);
rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf);
}
}
static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
{
struct recv_buf *precvbuf = (struct recv_buf *)purb->context;
struct adapter *padapter =(struct adapter *)precvbuf->adapter;
struct recv_priv *precvpriv = &padapter->recvpriv;
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete!!!\n"));
precvpriv->rx_pending_cnt --;
if (padapter->bSurpriseRemoved || padapter->bDriverStopped||padapter->bReadPortCancel)
{
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete:bDriverStopped(%d) OR bSurpriseRemoved(%d)\n", padapter->bDriverStopped, padapter->bSurpriseRemoved));
DBG_8192C("%s() RX Warning! bDriverStopped(%d) OR bSurpriseRemoved(%d) bReadPortCancel(%d)\n",
__FUNCTION__,padapter->bDriverStopped, padapter->bSurpriseRemoved,padapter->bReadPortCancel);
goto exit;
}
if (purb->status==0)/* SUCCESS */
{
if ((purb->actual_length > MAX_RECVBUF_SZ) || (purb->actual_length < RXDESC_SIZE))
{
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete: (purb->actual_length > MAX_RECVBUF_SZ) || (purb->actual_length < RXDESC_SIZE)\n"));
rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf);
}
else
{
rtw_reset_continual_io_error(adapter_to_dvobj(padapter));
precvbuf->transfer_len = purb->actual_length;
/* rtw_enqueue_rx_transfer_buffer(precvpriv, rx_transfer_buf); */
rtw_enqueue_recvbuf(precvbuf, &precvpriv->recv_buf_pending_queue);
tasklet_schedule(&precvpriv->recv_tasklet);
}
}
else
{
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete : purb->status(%d) != 0 \n", purb->status));
DBG_8192C("###=> usb_read_port_complete => urb status(%d)\n", purb->status);
if (rtw_inc_and_chk_continual_io_error(adapter_to_dvobj(padapter)) == true ){
padapter->bSurpriseRemoved = true;
}
switch(purb->status) {
case -EINVAL:
case -EPIPE:
case -ENODEV:
case -ESHUTDOWN:
/* padapter->bSurpriseRemoved=true; */
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete:bSurpriseRemoved=TRUE\n"));
case -ENOENT:
padapter->bDriverStopped=true;
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete:bDriverStopped=TRUE\n"));
break;
case -EPROTO:
case -EILSEQ:
case -ETIME:
case -ECOMM:
case -EOVERFLOW:
#ifdef DBG_CONFIG_ERROR_DETECT
{
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
pHalData->srestpriv.Wifi_Error_Status = USB_READ_PORT_FAIL;
}
#endif
rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf);
break;
case -EINPROGRESS:
DBG_8192C("ERROR: URB IS IN PROGRESS!/n");
break;
default:
break;
}
}
exit:
;
}
static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
{
int err;
unsigned int pipe;
u32 ret = _SUCCESS;
PURB purb = NULL;
struct recv_buf *precvbuf = (struct recv_buf *)rmem;
struct adapter *adapter = pintfhdl->padapter;
struct dvobj_priv *pdvobj = adapter_to_dvobj(adapter);
struct recv_priv *precvpriv = &adapter->recvpriv;
struct usb_device *pusbd = pdvobj->pusbdev;
;
if (adapter->bDriverStopped || adapter->bSurpriseRemoved ||dvobj_to_pwrctl(pdvobj)->pnp_bstop_trx)
{
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port:( padapter->bDriverStopped ||padapter->bSurpriseRemoved ||pwrctl->pnp_bstop_trx)!!!\n"));
return _FAIL;
}
if (precvbuf !=NULL)
{
rtl8188eu_init_recvbuf(adapter, precvbuf);
if (precvbuf->pbuf)
{
precvpriv->rx_pending_cnt++;
purb = precvbuf->purb;
/* translate DMA FIFO addr to pipehandle */
pipe = ffaddr2pipehdl(pdvobj, addr);
usb_fill_bulk_urb(purb, pusbd, pipe,
precvbuf->pbuf,
MAX_RECVBUF_SZ,
usb_read_port_complete,
precvbuf);/* context is precvbuf */
purb->transfer_dma = precvbuf->dma_transfer_addr;
purb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
err = usb_submit_urb(purb, GFP_ATOMIC);
if ((err) && (err != (-EPERM)))
{
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("cannot submit rx in-token(err=0x%.8x), URB_STATUS =0x%.8x", err, purb->status));
DBG_8192C("cannot submit rx in-token(err = 0x%08x),urb_status = %d\n",err,purb->status);
ret = _FAIL;
}
}
}
else
{
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port:precvbuf ==NULL\n"));
ret = _FAIL;
}
;
return ret;
}
#else /* CONFIG_USE_USB_BUFFER_ALLOC_RX */
static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb) static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb)
{ {
u8 *pbuf; u8 *pbuf;
@ -1273,7 +897,6 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
} }
return ret; return ret;
} }
#endif /* CONFIG_USE_USB_BUFFER_ALLOC_RX */
void rtl8188eu_xmit_tasklet(void *priv) void rtl8188eu_xmit_tasklet(void *priv)
{ {

View file

@ -92,13 +92,6 @@
#define CONFIG_PREALLOC_RECV_SKB #define CONFIG_PREALLOC_RECV_SKB
/*
* CONFIG_USE_USB_BUFFER_ALLOC_XX uses Linux USB Buffer alloc API and is for Linux platform only now!
*/
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX
#undef CONFIG_PREALLOC_RECV_SKB
#endif
/* /*
* USB VENDOR REQ BUFFER ALLOCATION METHOD * USB VENDOR REQ BUFFER ALLOCATION METHOD
* if not set we'll use function local variable (stack memory) * if not set we'll use function local variable (stack memory)

View file

@ -258,10 +258,6 @@ struct recv_priv
struct ifqueue rx_indicate_queue; struct ifqueue rx_indicate_queue;
#endif // CONFIG_RX_INDICATE_QUEUE #endif // CONFIG_RX_INDICATE_QUEUE
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX
_queue recv_buf_pending_queue;
#endif // CONFIG_USE_USB_BUFFER_ALLOC_RX
u8 *pallocated_recv_buf; u8 *pallocated_recv_buf;
u8 *precv_buf; // 4 alignment u8 *precv_buf; // 4 alignment
_queue free_recv_buf_queue; _queue free_recv_buf_queue;

View file

@ -95,12 +95,6 @@ int rtw_os_recvbuf_resource_alloc(struct adapter *padapter, struct recv_buf *pre
precvbuf->len = 0; precvbuf->len = 0;
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX
precvbuf->pallocated_buf = rtw_usb_buffer_alloc(pusbd, (size_t)precvbuf->alloc_sz, &precvbuf->dma_transfer_addr);
precvbuf->pbuf = precvbuf->pallocated_buf;
if(precvbuf->pallocated_buf == NULL)
return _FAIL;
#endif /* CONFIG_USE_USB_BUFFER_ALLOC_RX */
return res; return res;
} }
@ -109,28 +103,12 @@ int rtw_os_recvbuf_resource_free(struct adapter *padapter, struct recv_buf *prec
{ {
int ret = _SUCCESS; int ret = _SUCCESS;
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
struct usb_device *pusbd = pdvobjpriv->pusbdev;
rtw_usb_buffer_free(pusbd, (size_t)precvbuf->alloc_sz, precvbuf->pallocated_buf, precvbuf->dma_transfer_addr);
precvbuf->pallocated_buf = NULL;
precvbuf->dma_transfer_addr = 0;
#endif /* CONFIG_USE_USB_BUFFER_ALLOC_RX */
if(precvbuf->purb) if(precvbuf->purb)
{
/* usb_kill_urb(precvbuf->purb); */
usb_free_urb(precvbuf->purb); usb_free_urb(precvbuf->purb);
}
if(precvbuf->pskb) if(precvbuf->pskb)
rtw_skb_free(precvbuf->pskb); rtw_skb_free(precvbuf->pskb);
return ret; return ret;
} }
void rtw_handle_tkip_mic_err(struct adapter *padapter,u8 bgroup) void rtw_handle_tkip_mic_err(struct adapter *padapter,u8 bgroup)