mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2025-06-23 16:44:20 +00:00
rtl8188eu: Convert C90 comments
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
54abf571c4
commit
592c85f4e2
47 changed files with 4098 additions and 4374 deletions
|
@ -43,7 +43,7 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u
|
|||
|
||||
#ifdef CONFIG_USB_VENDOR_REQ_BUFFER_DYNAMIC_ALLOCATE
|
||||
u8 *tmp_buf;
|
||||
#else // use stack memory
|
||||
#else /* use stack memory */
|
||||
u8 tmp_buf[MAX_USB_IO_CTL_SIZE];
|
||||
#endif
|
||||
|
||||
|
@ -64,20 +64,20 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u
|
|||
#endif
|
||||
|
||||
|
||||
// Acquire IO memory for vendorreq
|
||||
/* Acquire IO memory for vendorreq */
|
||||
#ifdef CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC
|
||||
pIo_buf = pdvobjpriv->usb_vendor_req_buf;
|
||||
#else
|
||||
#ifdef CONFIG_USB_VENDOR_REQ_BUFFER_DYNAMIC_ALLOCATE
|
||||
tmp_buf = rtw_malloc( (u32) len + ALIGNMENT_UNIT);
|
||||
tmp_buflen = (u32)len + ALIGNMENT_UNIT;
|
||||
#else // use stack memory
|
||||
#else /* use stack memory */
|
||||
tmp_buflen = MAX_USB_IO_CTL_SIZE;
|
||||
#endif
|
||||
|
||||
// Added by Albert 2010/02/09
|
||||
// For mstar platform, mstar suggests the address for USB IO should be 16 bytes alignment.
|
||||
// Trying to fix it here.
|
||||
/* Added by Albert 2010/02/09 */
|
||||
/* For mstar platform, mstar suggests the address for USB IO should be 16 bytes alignment. */
|
||||
/* Trying to fix it here. */
|
||||
pIo_buf = (tmp_buf==NULL)?NULL:tmp_buf + ALIGNMENT_UNIT -((SIZE_PTR)(tmp_buf) & 0x0f );
|
||||
#endif
|
||||
|
||||
|
@ -93,27 +93,27 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u
|
|||
|
||||
if (requesttype == 0x01)
|
||||
{
|
||||
pipe = usb_rcvctrlpipe(udev, 0);//read_in
|
||||
pipe = usb_rcvctrlpipe(udev, 0);/* read_in */
|
||||
reqtype = REALTEK_USB_VENQT_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
pipe = usb_sndctrlpipe(udev, 0);//write_out
|
||||
pipe = usb_sndctrlpipe(udev, 0);/* write_out */
|
||||
reqtype = REALTEK_USB_VENQT_WRITE;
|
||||
memcpy( pIo_buf, pdata, len);
|
||||
}
|
||||
|
||||
status = rtw_usb_control_msg(udev, pipe, request, reqtype, value, index, pIo_buf, len, RTW_USB_CONTROL_MSG_TIMEOUT);
|
||||
|
||||
if ( status == len) // Success this control transfer.
|
||||
if ( status == len) /* Success this control transfer. */
|
||||
{
|
||||
rtw_reset_continual_io_error(pdvobjpriv);
|
||||
if ( requesttype == 0x01 )
|
||||
{ // For Control read transfer, we have to copy the read data from pIo_buf to pdata.
|
||||
{ /* For Control read transfer, we have to copy the read data from pIo_buf to pdata. */
|
||||
memcpy( pdata, pIo_buf, len );
|
||||
}
|
||||
}
|
||||
else { // error cases
|
||||
else { /* error cases */
|
||||
DBG_8192C("reg 0x%x, usb %s %u fail, status:%d value=0x%x, vendorreq_times:%d\n"
|
||||
, value,(requesttype == 0x01)?"read":"write" , len, status, *(u32*)pdata, vendorreq_times);
|
||||
|
||||
|
@ -130,11 +130,11 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u
|
|||
#endif
|
||||
}
|
||||
}
|
||||
else // status != len && status >= 0
|
||||
else /* status != len && status >= 0 */
|
||||
{
|
||||
if (status > 0) {
|
||||
if ( requesttype == 0x01 )
|
||||
{ // For Control read transfer, we have to copy the read data from pIo_buf to pdata.
|
||||
{ /* For Control read transfer, we have to copy the read data from pIo_buf to pdata. */
|
||||
memcpy( pdata, pIo_buf, len );
|
||||
}
|
||||
}
|
||||
|
@ -147,13 +147,13 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u
|
|||
|
||||
}
|
||||
|
||||
// firmware download is checksumed, don't retry
|
||||
/* firmware download is checksumed, don't retry */
|
||||
if ( (value >= FW_8188E_START_ADDRESS && value <= FW_8188E_END_ADDRESS) || status == len )
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
// release IO memory used by vendorreq
|
||||
/* release IO memory used by vendorreq */
|
||||
#ifdef CONFIG_USB_VENDOR_REQ_BUFFER_DYNAMIC_ALLOCATE
|
||||
rtw_mfree(tmp_buf, tmp_buflen);
|
||||
#endif
|
||||
|
@ -177,8 +177,8 @@ static u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
|
|||
u8 data;
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x01;//read_in
|
||||
index = 0;//n/a
|
||||
requesttype = 0x01;/* read_in */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr&0x0000ffff);
|
||||
len = 1;
|
||||
|
@ -197,8 +197,8 @@ static u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr)
|
|||
__le32 data;
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x01;//read_in
|
||||
index = 0;//n/a
|
||||
requesttype = 0x01;/* read_in */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr&0x0000ffff);
|
||||
len = 2;
|
||||
|
@ -217,8 +217,8 @@ static u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)
|
|||
__le32 data;
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x01;//read_in
|
||||
index = 0;//n/a
|
||||
requesttype = 0x01;/* read_in */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr&0x0000ffff);
|
||||
len = 4;
|
||||
|
@ -239,8 +239,8 @@ static int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
|
|||
int ret;
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x00;//write_out
|
||||
index = 0;//n/a
|
||||
requesttype = 0x00;/* write_out */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr&0x0000ffff);
|
||||
len = 1;
|
||||
|
@ -263,8 +263,8 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
|
|||
int ret;
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x00;//write_out
|
||||
index = 0;//n/a
|
||||
requesttype = 0x00;/* write_out */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr&0x0000ffff);
|
||||
len = 2;
|
||||
|
@ -287,8 +287,8 @@ static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
|
|||
int ret;
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x00;//write_out
|
||||
index = 0;//n/a
|
||||
requesttype = 0x00;/* write_out */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr&0x0000ffff);
|
||||
len = 4;
|
||||
|
@ -309,8 +309,8 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata
|
|||
u8 buf[VENDOR_CMD_MAX_DATA_LEN]={0};
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x00;//write_out
|
||||
index = 0;//n/a
|
||||
requesttype = 0x00;/* write_out */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr&0x0000ffff);
|
||||
len = length;
|
||||
|
@ -330,7 +330,7 @@ static void interrupt_handler_8188eu(struct adapter *padapter,u16 pkt_len,u8 *pb
|
|||
return ;
|
||||
}
|
||||
|
||||
// HISR
|
||||
/* HISR */
|
||||
memcpy(&(pHalData->IntArray[0]), &(pbuf[USB_INTR_CONTENT_HISR_OFFSET]), 4);
|
||||
memcpy(&(pHalData->IntArray[1]), &(pbuf[USB_INTR_CONTENT_HISRE_OFFSET]), 4);
|
||||
|
||||
|
@ -338,11 +338,11 @@ static void interrupt_handler_8188eu(struct adapter *padapter,u16 pkt_len,u8 *pb
|
|||
if ( pHalData->IntArray[0] & IMR_CPWM_88E ) {
|
||||
memcpy(&pwr_rpt.state, &(pbuf[USB_INTR_CONTENT_CPWM1_OFFSET]), 1);
|
||||
|
||||
//88e's cpwm value only change BIT0, so driver need to add PS_STATE_S2 for LPS flow.
|
||||
/* 88e's cpwm value only change BIT0, so driver need to add PS_STATE_S2 for LPS flow. */
|
||||
pwr_rpt.state |= PS_STATE_S2;
|
||||
_set_workitem(&(adapter_to_pwrctl(padapter)->cpwm_event));
|
||||
}
|
||||
#endif//CONFIG_LPS_LCLK
|
||||
#endif/* CONFIG_LPS_LCLK */
|
||||
|
||||
#ifdef CONFIG_INTERRUPT_BASED_TXBCN
|
||||
|
||||
|
@ -356,12 +356,12 @@ static void interrupt_handler_8188eu(struct adapter *padapter,u16 pkt_len,u8 *pb
|
|||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
|
||||
if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
|
||||
//send_beacon(padapter);
|
||||
/* send_beacon(padapter); */
|
||||
if (pmlmepriv->update_bcn == true)
|
||||
set_tx_beacon_cmd(padapter);
|
||||
}
|
||||
}
|
||||
#endif //CONFIG_INTERRUPT_BASED_TXBCN
|
||||
#endif /* CONFIG_INTERRUPT_BASED_TXBCN */
|
||||
|
||||
#ifdef DBG_CONFIG_ERROR_DETECT_INT
|
||||
if ( pHalData->IntArray[1] & IMR_TXERR_88E )
|
||||
|
@ -372,12 +372,12 @@ static void interrupt_handler_8188eu(struct adapter *padapter,u16 pkt_len,u8 *pb
|
|||
DBG_871X("===> %s Transmit FIFO Overflow \n",__FUNCTION__);
|
||||
if ( pHalData->IntArray[1] & IMR_RXFOVW_88E )
|
||||
DBG_871X("===> %s Receive FIFO Overflow \n",__FUNCTION__);
|
||||
#endif//DBG_CONFIG_ERROR_DETECT_INT
|
||||
#endif/* DBG_CONFIG_ERROR_DETECT_INT */
|
||||
|
||||
// C2H Event
|
||||
/* C2H Event */
|
||||
if (pbuf[0]!= 0){
|
||||
memcpy(&(pHalData->C2hArray[0]), &(pbuf[USB_INTR_CONTENT_C2H_OFFSET]), 16);
|
||||
//rtw_c2h_wk_cmd(padapter); to do..
|
||||
/* rtw_c2h_wk_cmd(padapter); to do.. */
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ static void usb_read_interrupt_complete(struct urb *purb, struct pt_regs *regs)
|
|||
return;
|
||||
}
|
||||
|
||||
if (purb->status==0)//SUCCESS
|
||||
if (purb->status==0)/* SUCCESS */
|
||||
{
|
||||
if (purb->actual_length > INTERRUPT_MSG_FORMAT_LEN)
|
||||
{
|
||||
|
@ -421,7 +421,7 @@ static void usb_read_interrupt_complete(struct urb *purb, struct pt_regs *regs)
|
|||
case -EPIPE:
|
||||
case -ENODEV:
|
||||
case -ESHUTDOWN:
|
||||
//padapter->bSurpriseRemoved=true;
|
||||
/* padapter->bSurpriseRemoved=true; */
|
||||
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete:bSurpriseRemoved=TRUE\n"));
|
||||
case -ENOENT:
|
||||
padapter->bDriverStopped=true;
|
||||
|
@ -451,7 +451,7 @@ static u32 usb_read_interrupt(struct intf_hdl *pintfhdl, u32 addr)
|
|||
|
||||
;
|
||||
|
||||
//translate DMA FIFO addr to pipehandle
|
||||
/* translate DMA FIFO addr to pipehandle */
|
||||
pipe = ffaddr2pipehdl(pdvobj, addr);
|
||||
|
||||
usb_fill_int_urb(precvpriv->int_in_urb, pusbd, pipe,
|
||||
|
@ -520,10 +520,10 @@ static int recvbuf2recvframe(struct adapter *padapter, struct recv_buf *precvbuf
|
|||
}
|
||||
|
||||
_rtw_init_listhead(&precvframe->u.hdr.list);
|
||||
precvframe->u.hdr.precvbuf = NULL; //can't access the precvbuf for new arch.
|
||||
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);
|
||||
/* rtl8192c_query_rx_desc_status(precvframe, prxstat); */
|
||||
update_recvframe_attrib_88e(precvframe, prxstat);
|
||||
|
||||
pattrib = &precvframe->u.hdr.attrib;
|
||||
|
@ -552,9 +552,9 @@ static int recvbuf2recvframe(struct adapter *padapter, struct recv_buf *precvbuf
|
|||
goto _exit_recvbuf2recvframe;
|
||||
}
|
||||
|
||||
// Modified by Albert 20101213
|
||||
// For 8 bytes IP header alignment.
|
||||
if (pattrib->qos) // Qos data, wireless lan header length is 26
|
||||
/* Modified by Albert 20101213 */
|
||||
/* For 8 bytes IP header alignment. */
|
||||
if (pattrib->qos) /* Qos data, wireless lan header length is 26 */
|
||||
{
|
||||
shift_sz = 6;
|
||||
}
|
||||
|
@ -565,10 +565,9 @@ static int recvbuf2recvframe(struct adapter *padapter, struct recv_buf *precvbuf
|
|||
|
||||
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
|
||||
/* 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)){
|
||||
//alloc_sz = 1664; //1664 is 128 alignment.
|
||||
if (skb_len <= 1650)
|
||||
alloc_sz = 1664;
|
||||
else
|
||||
|
@ -576,8 +575,8 @@ static int recvbuf2recvframe(struct adapter *padapter, struct recv_buf *precvbuf
|
|||
}
|
||||
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.
|
||||
/* 6 is for IP header 8 bytes alignment in QoS packet case. */
|
||||
/* 8 is for skb->data 4 bytes alignment. */
|
||||
alloc_sz += 14;
|
||||
}
|
||||
|
||||
|
@ -589,17 +588,17 @@ static int recvbuf2recvframe(struct adapter *padapter, struct recv_buf *precvbuf
|
|||
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.
|
||||
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 = 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);
|
||||
|
@ -608,7 +607,7 @@ static int recvbuf2recvframe(struct adapter *padapter, struct recv_buf *precvbuf
|
|||
}
|
||||
|
||||
recvframe_put(precvframe, skb_len);
|
||||
//recvframe_pull(precvframe, drvinfo_sz + RXDESC_SIZE);
|
||||
/* recvframe_pull(precvframe, drvinfo_sz + RXDESC_SIZE); */
|
||||
|
||||
#ifdef CONFIG_USB_RX_AGGREGATION
|
||||
switch(pHalData->UsbRxAggMode)
|
||||
|
@ -626,7 +625,7 @@ static int recvbuf2recvframe(struct adapter *padapter, struct recv_buf *precvbuf
|
|||
}
|
||||
#endif
|
||||
|
||||
if (pattrib->pkt_rpt_type == NORMAL_RX)//Normal rx packet
|
||||
if (pattrib->pkt_rpt_type == NORMAL_RX)/* Normal rx packet */
|
||||
{
|
||||
if (pattrib->physt)
|
||||
update_recvframe_phyinfo_88e(precvframe, (struct phy_stat*)pphy_status);
|
||||
|
@ -636,17 +635,17 @@ static int recvbuf2recvframe(struct adapter *padapter, struct recv_buf *precvbuf
|
|||
("recvbuf2recvframe: rtw_recv_entry(precvframe) != _SUCCESS\n"));
|
||||
}
|
||||
|
||||
} else{ // pkt_rpt_type == TX_REPORT1-CCX, TX_REPORT2-TX RTP,HIS_REPORT-USB HISR RTP
|
||||
} else{ /* pkt_rpt_type == TX_REPORT1-CCX, TX_REPORT2-TX RTP,HIS_REPORT-USB HISR RTP */
|
||||
|
||||
//enqueue recvframe to txrtp queue
|
||||
/* enqueue recvframe to txrtp queue */
|
||||
if (pattrib->pkt_rpt_type == TX_REPORT1){
|
||||
//DBG_8192C("rx CCX \n");
|
||||
//CCX-TXRPT ack for xmit mgmt frames.
|
||||
/* 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");
|
||||
/* DBG_8192C("rx TX RPT \n"); */
|
||||
ODM_RA_TxRPT2Handle_8188E(
|
||||
&pHalData->odmpriv,
|
||||
precvframe->u.hdr.rx_data,
|
||||
|
@ -658,7 +657,7 @@ static int recvbuf2recvframe(struct adapter *padapter, struct recv_buf *precvbuf
|
|||
}
|
||||
else if (pattrib->pkt_rpt_type == HIS_REPORT)
|
||||
{
|
||||
//DBG_8192C("%s , rx USB HISR \n",__FUNCTION__);
|
||||
/* 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
|
||||
|
@ -724,7 +723,7 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
|
|||
goto exit;
|
||||
}
|
||||
|
||||
if (purb->status==0)//SUCCESS
|
||||
if (purb->status==0)/* SUCCESS */
|
||||
{
|
||||
if ((purb->actual_length > MAX_RECVBUF_SZ) || (purb->actual_length < RXDESC_SIZE))
|
||||
{
|
||||
|
@ -738,7 +737,7 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
|
|||
|
||||
precvbuf->transfer_len = purb->actual_length;
|
||||
|
||||
//rtw_enqueue_rx_transfer_buffer(precvpriv, rx_transfer_buf);
|
||||
/* rtw_enqueue_rx_transfer_buffer(precvpriv, rx_transfer_buf); */
|
||||
rtw_enqueue_recvbuf(precvbuf, &precvpriv->recv_buf_pending_queue);
|
||||
|
||||
tasklet_schedule(&precvpriv->recv_tasklet);
|
||||
|
@ -759,7 +758,7 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
|
|||
case -EPIPE:
|
||||
case -ENODEV:
|
||||
case -ESHUTDOWN:
|
||||
//padapter->bSurpriseRemoved=true;
|
||||
/* padapter->bSurpriseRemoved=true; */
|
||||
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete:bSurpriseRemoved=TRUE\n"));
|
||||
case -ENOENT:
|
||||
padapter->bDriverStopped=true;
|
||||
|
@ -823,14 +822,14 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
|
|||
|
||||
purb = precvbuf->purb;
|
||||
|
||||
//translate DMA FIFO addr to pipehandle
|
||||
/* 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
|
||||
precvbuf);/* context is precvbuf */
|
||||
|
||||
purb->transfer_dma = precvbuf->dma_transfer_addr;
|
||||
purb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
|
||||
|
@ -856,7 +855,7 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
|
|||
|
||||
return ret;
|
||||
}
|
||||
#else // CONFIG_USE_USB_BUFFER_ALLOC_RX
|
||||
#else /* CONFIG_USE_USB_BUFFER_ALLOC_RX */
|
||||
static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb)
|
||||
{
|
||||
u8 *pbuf;
|
||||
|
@ -896,10 +895,10 @@ static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb)
|
|||
}
|
||||
|
||||
_rtw_init_listhead(&precvframe->u.hdr.list);
|
||||
precvframe->u.hdr.precvbuf = NULL; //can't access the precvbuf for new arch.
|
||||
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);
|
||||
/* rtl8192c_query_rx_desc_status(precvframe, prxstat); */
|
||||
update_recvframe_attrib_88e(precvframe, prxstat);
|
||||
|
||||
pattrib = &precvframe->u.hdr.attrib;
|
||||
|
@ -927,9 +926,9 @@ static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb)
|
|||
goto _exit_recvbuf2recvframe;
|
||||
}
|
||||
|
||||
// Modified by Albert 20101213
|
||||
// For 8 bytes IP header alignment.
|
||||
if (pattrib->qos) // Qos data, wireless lan header length is 26
|
||||
/* Modified by Albert 20101213 */
|
||||
/* For 8 bytes IP header alignment. */
|
||||
if (pattrib->qos) /* Qos data, wireless lan header length is 26 */
|
||||
{
|
||||
shift_sz = 6;
|
||||
}
|
||||
|
@ -940,10 +939,9 @@ static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb)
|
|||
|
||||
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
|
||||
/* 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)){
|
||||
//alloc_sz = 1664; //1664 is 128 alignment.
|
||||
if (skb_len <= 1650)
|
||||
alloc_sz = 1664;
|
||||
else
|
||||
|
@ -951,8 +949,8 @@ static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb)
|
|||
}
|
||||
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.
|
||||
/* 6 is for IP header 8 bytes alignment in QoS packet case. */
|
||||
/* 8 is for skb->data 4 bytes alignment. */
|
||||
alloc_sz += 14;
|
||||
}
|
||||
|
||||
|
@ -964,8 +962,8 @@ static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb)
|
|||
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.
|
||||
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;
|
||||
}
|
||||
|
@ -995,7 +993,7 @@ static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb)
|
|||
}
|
||||
|
||||
recvframe_put(precvframe, skb_len);
|
||||
//recvframe_pull(precvframe, drvinfo_sz + RXDESC_SIZE);
|
||||
/* recvframe_pull(precvframe, drvinfo_sz + RXDESC_SIZE); */
|
||||
|
||||
#ifdef CONFIG_USB_RX_AGGREGATION
|
||||
switch(pHalData->UsbRxAggMode)
|
||||
|
@ -1013,7 +1011,7 @@ static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (pattrib->pkt_rpt_type == NORMAL_RX)//Normal rx packet
|
||||
if (pattrib->pkt_rpt_type == NORMAL_RX)/* Normal rx packet */
|
||||
{
|
||||
if (pattrib->physt)
|
||||
update_recvframe_phyinfo_88e(precvframe, (struct phy_stat*)pphy_status);
|
||||
|
@ -1022,15 +1020,15 @@ static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb)
|
|||
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
|
||||
} 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.
|
||||
/* 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");
|
||||
/* DBG_8192C("rx TX RPT \n"); */
|
||||
ODM_RA_TxRPT2Handle_8188E(
|
||||
&pHalData->odmpriv,
|
||||
precvframe->u.hdr.rx_data,
|
||||
|
@ -1042,7 +1040,7 @@ static int recvbuf2recvframe(struct adapter *padapter, _pkt *pskb)
|
|||
}
|
||||
else if (pattrib->pkt_rpt_type == HIS_REPORT)
|
||||
{
|
||||
//DBG_8192C("%s , rx USB HISR \n",__FUNCTION__);
|
||||
/* 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
|
||||
|
@ -1111,18 +1109,18 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
|
|||
|
||||
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete!!!\n"));
|
||||
|
||||
//_enter_critical(&precvpriv->lock, &irqL);
|
||||
//precvbuf->irp_pending=false;
|
||||
//precvpriv->rx_pending_cnt --;
|
||||
//_exit_critical(&precvpriv->lock, &irqL);
|
||||
/* _enter_critical(&precvpriv->lock, &irqL); */
|
||||
/* precvbuf->irp_pending=false; */
|
||||
/* precvpriv->rx_pending_cnt --; */
|
||||
/* _exit_critical(&precvpriv->lock, &irqL); */
|
||||
|
||||
precvpriv->rx_pending_cnt --;
|
||||
|
||||
//if (precvpriv->rx_pending_cnt== 0)
|
||||
//{
|
||||
// RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete: rx_pending_cnt== 0, set allrxreturnevt!\n"));
|
||||
// _rtw_up_sema(&precvpriv->allrxreturnevt);
|
||||
//}
|
||||
/* if (precvpriv->rx_pending_cnt== 0) */
|
||||
/* */
|
||||
/* RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete: rx_pending_cnt== 0, set allrxreturnevt!\n")); */
|
||||
/* _rtw_up_sema(&precvpriv->allrxreturnevt); */
|
||||
/* */
|
||||
|
||||
if (padapter->bSurpriseRemoved || padapter->bDriverStopped||padapter->bReadPortCancel)
|
||||
{
|
||||
|
@ -1141,7 +1139,7 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
|
|||
goto exit;
|
||||
}
|
||||
|
||||
if (purb->status==0)//SUCCESS
|
||||
if (purb->status==0)/* SUCCESS */
|
||||
{
|
||||
if ((purb->actual_length > MAX_RECVBUF_SZ) || (purb->actual_length < RXDESC_SIZE))
|
||||
{
|
||||
|
@ -1181,7 +1179,7 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
|
|||
case -EPIPE:
|
||||
case -ENODEV:
|
||||
case -ESHUTDOWN:
|
||||
//padapter->bSurpriseRemoved=true;
|
||||
/* padapter->bSurpriseRemoved=true; */
|
||||
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete:bSurpriseRemoved=TRUE\n"));
|
||||
case -ENOENT:
|
||||
padapter->bDriverStopped=true;
|
||||
|
@ -1253,7 +1251,7 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
|
|||
if (precvbuf != NULL) {
|
||||
rtl8188eu_init_recvbuf(adapter, precvbuf);
|
||||
|
||||
//re-assign for linux based on skb
|
||||
/* re-assign for linux based on skb */
|
||||
if ((precvbuf->reuse == false) || (precvbuf->pskb == NULL)) {
|
||||
precvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
|
||||
|
||||
|
@ -1272,7 +1270,7 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
|
|||
precvbuf->ptail = skb_tail_pointer(precvbuf->pskb);
|
||||
precvbuf->pend = skb_end_pointer(precvbuf->pskb);
|
||||
precvbuf->pbuf = precvbuf->pskb->data;
|
||||
} else//reuse skb
|
||||
} else/* reuse skb */
|
||||
{
|
||||
precvbuf->phead = precvbuf->pskb->head;
|
||||
precvbuf->pdata = precvbuf->pskb->data;
|
||||
|
@ -1287,12 +1285,12 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
|
|||
|
||||
purb = precvbuf->purb;
|
||||
|
||||
//translate DMA FIFO addr to pipehandle
|
||||
/* 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
|
||||
precvbuf);/* context is precvbuf */
|
||||
|
||||
err = usb_submit_urb(purb, GFP_ATOMIC);
|
||||
if ((err) && (err != (-EPERM))) {
|
||||
|
@ -1309,7 +1307,7 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
#endif // CONFIG_USE_USB_BUFFER_ALLOC_RX
|
||||
#endif /* CONFIG_USE_USB_BUFFER_ALLOC_RX */
|
||||
|
||||
void rtl8188eu_xmit_tasklet(void *priv)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue