2013-05-08 21:45:39 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
|
2014-12-19 06:59:46 +00:00
|
|
|
*
|
2013-05-08 21:45:39 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of version 2 of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
|
|
|
*
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
#define _XMIT_OSDEP_C_
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
#include <drv_conf.h>
|
2013-05-08 21:45:39 +00:00
|
|
|
#include <osdep_service.h>
|
|
|
|
#include <drv_types.h>
|
|
|
|
|
|
|
|
#include <if_ether.h>
|
|
|
|
#include <ip.h>
|
|
|
|
#include <wifi.h>
|
|
|
|
#include <mlme_osdep.h>
|
|
|
|
#include <xmit_osdep.h>
|
|
|
|
#include <osdep_intf.h>
|
2014-12-17 01:03:30 +00:00
|
|
|
#include <circ_buf.h>
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
uint rtw_remainder_len(struct pkt_file *pfile)
|
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
return (pfile->buf_len - ((SIZE_PTR)(pfile->cur_addr) - (SIZE_PTR)(pfile->buf_start)));
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
void _rtw_open_pktfile (_pkt *pktptr, struct pkt_file *pfile)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-01 22:31:15 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
pfile->pkt = pktptr;
|
2014-12-17 01:03:30 +00:00
|
|
|
pfile->cur_addr = pfile->buf_start = pktptr->data;
|
|
|
|
pfile->pkt_len = pfile->buf_len = pktptr->len;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
pfile->cur_buffer = pfile->buf_start ;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint _rtw_pktfile_read (struct pkt_file *pfile, u8 *rmem, uint rlen)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
uint len = 0;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-03-10 16:18:03 +00:00
|
|
|
len = rtw_remainder_len(pfile);
|
2014-12-19 06:59:46 +00:00
|
|
|
len = (rlen > len)? len: rlen;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-03-10 16:18:03 +00:00
|
|
|
if (rmem)
|
|
|
|
skb_copy_bits(pfile->pkt, pfile->buf_len-pfile->pkt_len, rmem, len);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-03-10 16:18:03 +00:00
|
|
|
pfile->cur_addr += len;
|
|
|
|
pfile->pkt_len -= len;
|
2014-12-19 06:59:46 +00:00
|
|
|
return len;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
sint rtw_endofpktfile(struct pkt_file *pfile)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
if (pfile->pkt_len == 0) {
|
2014-12-29 02:13:24 +00:00
|
|
|
return true;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
void rtw_set_tx_chksum_offload(_pkt *pkt, struct pkt_attrib *pattrib)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_TCP_CSUM_OFFLOAD_TX
|
|
|
|
struct sk_buff *skb = (struct sk_buff *)pkt;
|
|
|
|
pattrib->hw_tcp_csum = 0;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
|
|
|
if (skb_shinfo(skb)->nr_frags == 0)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
const struct iphdr *ip = ip_hdr(skb);
|
|
|
|
if (ip->protocol == IPPROTO_TCP) {
|
2015-02-20 04:11:26 +00:00
|
|
|
/* TCP checksum offload by HW */
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("CHECKSUM_PARTIAL TCP\n");
|
|
|
|
pattrib->hw_tcp_csum = 1;
|
2015-02-20 04:11:26 +00:00
|
|
|
/* skb_checksum_help(skb); */
|
2014-12-17 01:03:30 +00:00
|
|
|
} else if (ip->protocol == IPPROTO_UDP) {
|
2015-02-20 04:11:26 +00:00
|
|
|
/* DBG_871X("CHECKSUM_PARTIAL UDP\n"); */
|
2014-12-17 01:03:30 +00:00
|
|
|
skb_checksum_help(skb);
|
|
|
|
} else {
|
|
|
|
DBG_871X("%s-%d TCP CSUM offload Error!!\n", __FUNCTION__, __LINE__);
|
|
|
|
WARN_ON(1); /* we need a WARN() */
|
|
|
|
}
|
|
|
|
}
|
2015-02-20 04:11:26 +00:00
|
|
|
else { /* IP fragmentation case */
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("%s-%d nr_frags != 0, using skb_checksum_help(skb);!!\n", __FUNCTION__, __LINE__);
|
2014-12-19 06:59:46 +00:00
|
|
|
skb_checksum_help(skb);
|
|
|
|
}
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitbuf,u32 alloc_sz)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
int i;
|
2014-12-17 01:03:30 +00:00
|
|
|
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
|
|
|
|
struct usb_device *pusbd = pdvobjpriv->pusbdev;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_TX
|
|
|
|
pxmitbuf->pallocated_buf = rtw_usb_buffer_alloc(pusbd, (size_t)alloc_sz, &pxmitbuf->dma_transfer_addr);
|
|
|
|
pxmitbuf->pbuf = pxmitbuf->pallocated_buf;
|
|
|
|
if(pxmitbuf->pallocated_buf == NULL)
|
|
|
|
return _FAIL;
|
2015-02-20 04:11:26 +00:00
|
|
|
#else /* CONFIG_USE_USB_BUFFER_ALLOC_TX */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
pxmitbuf->pallocated_buf = rtw_zmalloc(alloc_sz);
|
|
|
|
if (pxmitbuf->pallocated_buf == NULL)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
return _FAIL;
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitbuf->pallocated_buf), XMITBUF_ALIGN_SZ);
|
2013-05-08 21:45:39 +00:00
|
|
|
pxmitbuf->dma_transfer_addr = 0;
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* CONFIG_USE_USB_BUFFER_ALLOC_TX */
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
for(i=0; i<8; i++)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
|
|
|
pxmitbuf->pxmit_urb[i] = usb_alloc_urb(0, GFP_KERNEL);
|
|
|
|
if(pxmitbuf->pxmit_urb[i] == NULL)
|
|
|
|
{
|
|
|
|
DBG_871X("pxmitbuf->pxmit_urb[i]==NULL");
|
|
|
|
return _FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return _SUCCESS;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_os_xmit_resource_free(struct adapter *padapter, struct xmit_buf *pxmitbuf,u32 free_sz)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
int i;
|
2014-12-17 01:03:30 +00:00
|
|
|
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
|
|
|
|
struct usb_device *pusbd = pdvobjpriv->pusbdev;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
for(i=0; i<8; i++)
|
|
|
|
{
|
|
|
|
if(pxmitbuf->pxmit_urb[i])
|
|
|
|
{
|
2015-02-20 04:11:26 +00:00
|
|
|
/* usb_kill_urb(pxmitbuf->pxmit_urb[i]); */
|
2014-12-17 01:03:30 +00:00
|
|
|
usb_free_urb(pxmitbuf->pxmit_urb[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_TX
|
|
|
|
rtw_usb_buffer_free(pusbd, (size_t)free_sz, pxmitbuf->pallocated_buf, pxmitbuf->dma_transfer_addr);
|
|
|
|
pxmitbuf->pallocated_buf = NULL;
|
|
|
|
pxmitbuf->dma_transfer_addr = 0;
|
2015-02-20 04:11:26 +00:00
|
|
|
#else /* CONFIG_USE_USB_BUFFER_ALLOC_TX */
|
2014-12-17 01:03:30 +00:00
|
|
|
if(pxmitbuf->pallocated_buf)
|
|
|
|
rtw_mfree(pxmitbuf->pallocated_buf, free_sz);
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* CONFIG_USE_USB_BUFFER_ALLOC_TX */
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#define WMM_XMIT_THRESHOLD (NR_XMITFRAME*2/5)
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_os_pkt_complete(struct adapter *padapter, _pkt *pkt)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
|
2013-05-08 21:45:39 +00:00
|
|
|
u16 queue;
|
|
|
|
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
|
|
|
|
|
|
|
queue = skb_get_queue_mapping(pkt);
|
|
|
|
if (padapter->registrypriv.wifi_spec) {
|
2014-12-17 01:03:30 +00:00
|
|
|
if(__netif_subqueue_stopped(padapter->pnetdev, queue) &&
|
|
|
|
(pxmitpriv->hwxmits[queue].accnt < WMM_XMIT_THRESHOLD))
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
netif_wake_subqueue(padapter->pnetdev, queue);
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
} else {
|
2014-12-17 01:03:30 +00:00
|
|
|
if(__netif_subqueue_stopped(padapter->pnetdev, queue))
|
2013-05-08 21:45:39 +00:00
|
|
|
netif_wake_subqueue(padapter->pnetdev, queue);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
if (netif_queue_stopped(padapter->pnetdev))
|
|
|
|
netif_wake_queue(padapter->pnetdev);
|
|
|
|
#endif
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
rtw_skb_free(pkt);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_os_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
if(pxframe->pkt)
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_os_pkt_complete(padapter, pxframe->pkt);
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
pxframe->pkt = NULL;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_os_xmit_schedule(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *pri_adapter = padapter;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
_irqL irqL;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct xmit_priv *pxmitpriv;
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
if(!padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
pxmitpriv = &padapter->xmitpriv;
|
|
|
|
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_lock_bh(&pxmitpriv->lock);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
if(rtw_txframes_pending(padapter))
|
2013-05-08 21:45:39 +00:00
|
|
|
tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
|
|
|
|
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_unlock_bh(&pxmitpriv->lock);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void rtw_check_xmit_resource(struct adapter *padapter, _pkt *pkt)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
2014-12-17 01:03:30 +00:00
|
|
|
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
|
2013-05-08 21:45:39 +00:00
|
|
|
u16 queue;
|
|
|
|
|
|
|
|
queue = skb_get_queue_mapping(pkt);
|
|
|
|
if (padapter->registrypriv.wifi_spec) {
|
|
|
|
/* No free space for Tx, tx_worker is too slow */
|
2014-12-17 01:03:30 +00:00
|
|
|
if (pxmitpriv->hwxmits[queue].accnt > WMM_XMIT_THRESHOLD) {
|
2015-02-20 04:11:26 +00:00
|
|
|
/* DBG_871X("%s(): stop netif_subqueue[%d]\n", __FUNCTION__, queue); */
|
2013-05-08 21:45:39 +00:00
|
|
|
netif_stop_subqueue(padapter->pnetdev, queue);
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
} else {
|
2014-12-17 01:03:30 +00:00
|
|
|
if(pxmitpriv->free_xmitframe_cnt<=4) {
|
2013-05-08 21:45:39 +00:00
|
|
|
if (!netif_tx_queue_stopped(netdev_get_tx_queue(padapter->pnetdev, queue)))
|
|
|
|
netif_stop_subqueue(padapter->pnetdev, queue);
|
|
|
|
}
|
|
|
|
}
|
2014-12-17 01:03:30 +00:00
|
|
|
#else
|
|
|
|
if(pxmitpriv->free_xmitframe_cnt<=4)
|
|
|
|
{
|
|
|
|
if (!rtw_netif_queue_stopped(padapter->pnetdev))
|
|
|
|
rtw_netif_stop_queue(padapter->pnetdev);
|
|
|
|
}
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct sta_priv *pstapriv = &padapter->stapriv;
|
|
|
|
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
2014-12-17 01:03:30 +00:00
|
|
|
_irqL irqL;
|
|
|
|
_list *phead, *plist;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct sk_buff *newskb;
|
|
|
|
struct sta_info *psta = NULL;
|
2014-12-17 01:03:30 +00:00
|
|
|
u8 chk_alive_num = 0;
|
|
|
|
char chk_alive_list[NUM_STA];
|
|
|
|
u8 bc_addr[6]={0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
|
|
|
u8 null_addr[6]={0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
|
|
|
|
|
|
int i;
|
2013-05-08 21:45:39 +00:00
|
|
|
s32 res;
|
|
|
|
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_lock_bh(&pstapriv->asoc_list_lock);
|
2013-05-08 21:45:39 +00:00
|
|
|
phead = &pstapriv->asoc_list;
|
|
|
|
plist = get_next(phead);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* free sta asoc_queue */
|
2014-12-29 02:13:24 +00:00
|
|
|
while ((rtw_end_of_queue_search(phead, plist)) == false) {
|
2014-12-17 01:03:30 +00:00
|
|
|
int stainfo_offset;
|
2013-05-08 21:45:39 +00:00
|
|
|
psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
|
|
|
|
plist = get_next(plist);
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
stainfo_offset = rtw_stainfo_offset(pstapriv, psta);
|
|
|
|
if (stainfo_offset_valid(stainfo_offset)) {
|
|
|
|
chk_alive_list[chk_alive_num++] = stainfo_offset;
|
|
|
|
}
|
|
|
|
}
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_unlock_bh(&pstapriv->asoc_list_lock);
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
for (i = 0; i < chk_alive_num; i++) {
|
|
|
|
psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]);
|
|
|
|
if(!(psta->state &_FW_LINKED))
|
2014-12-19 06:59:46 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
/* avoid come from STA1 and send back STA1 */
|
2014-12-29 02:13:24 +00:00
|
|
|
if (_rtw_memcmp(psta->hwaddr, &skb->data[6], 6) == true
|
|
|
|
|| _rtw_memcmp(psta->hwaddr, null_addr, 6) == true
|
|
|
|
|| _rtw_memcmp(psta->hwaddr, bc_addr, 6) == true
|
2014-12-17 01:03:30 +00:00
|
|
|
)
|
2013-05-19 04:28:07 +00:00
|
|
|
continue;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
newskb = rtw_skb_copy(skb);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
if (newskb) {
|
2015-02-19 20:50:04 +00:00
|
|
|
memcpy(newskb->data, psta->hwaddr, 6);
|
2013-05-08 21:45:39 +00:00
|
|
|
res = rtw_xmit(padapter, &newskb);
|
|
|
|
if (res < 0) {
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("%s()-%d: rtw_xmit() return error!\n", __FUNCTION__, __LINE__);
|
2013-05-08 21:45:39 +00:00
|
|
|
pxmitpriv->tx_drop++;
|
2014-12-17 01:03:30 +00:00
|
|
|
rtw_skb_free(newskb);
|
|
|
|
} else
|
2013-05-08 21:45:39 +00:00
|
|
|
pxmitpriv->tx_pkts++;
|
|
|
|
} else {
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("%s-%d: rtw_skb_copy() failed!\n", __FUNCTION__, __LINE__);
|
2013-05-08 21:45:39 +00:00
|
|
|
pxmitpriv->tx_drop++;
|
2015-02-20 04:11:26 +00:00
|
|
|
/* rtw_skb_free(skb); */
|
|
|
|
return false; /* Caller shall tx this multicast frame via normal way. */
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
rtw_skb_free(skb);
|
2014-12-29 02:13:24 +00:00
|
|
|
return true;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
int _rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev);
|
2013-05-08 21:45:39 +00:00
|
|
|
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
|
|
|
s32 res = 0;
|
2014-12-17 01:03:30 +00:00
|
|
|
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
|
|
|
|
u16 queue;
|
|
|
|
#endif
|
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("+xmit_enry\n"));
|
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if (rtw_if_up(padapter) == false) {
|
2013-05-08 21:45:39 +00:00
|
|
|
RT_TRACE(_module_xmit_osdep_c_, _drv_err_, ("rtw_xmit_entry: rtw_if_up fail\n"));
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef DBG_TX_DROP_FRAME
|
|
|
|
DBG_871X("DBG_TX_DROP_FRAME %s if_up fail\n", __FUNCTION__);
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
goto drop_packet;
|
|
|
|
}
|
|
|
|
|
|
|
|
rtw_check_xmit_resource(padapter, pkt);
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
if ( !rtw_mc2u_disable
|
2014-12-29 02:13:24 +00:00
|
|
|
&& check_fwstate(pmlmepriv, WIFI_AP_STATE) == true
|
2014-12-17 01:03:30 +00:00
|
|
|
&& ( IP_MCAST_MAC(pkt->data)
|
|
|
|
|| ICMPV6_MCAST_MAC(pkt->data) )
|
|
|
|
&& (padapter->registrypriv.wifi_spec == 0)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if ( pxmitpriv->free_xmitframe_cnt > (NR_XMITFRAME/4) ) {
|
2013-05-08 21:45:39 +00:00
|
|
|
res = rtw_mlcst2unicst(padapter, pkt);
|
2014-12-29 02:13:24 +00:00
|
|
|
if (res == true) {
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
res = rtw_xmit(padapter, &pkt);
|
2014-12-17 01:03:30 +00:00
|
|
|
if (res < 0) {
|
|
|
|
#ifdef DBG_TX_DROP_FRAME
|
|
|
|
DBG_871X("DBG_TX_DROP_FRAME %s rtw_xmit fail\n", __FUNCTION__);
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
goto drop_packet;
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
pxmitpriv->tx_pkts++;
|
|
|
|
RT_TRACE(_module_xmit_osdep_c_, _drv_info_, ("rtw_xmit_entry: tx_pkts=%d\n", (u32)pxmitpriv->tx_pkts));
|
|
|
|
goto exit;
|
|
|
|
|
|
|
|
drop_packet:
|
|
|
|
pxmitpriv->tx_drop++;
|
2014-12-17 01:03:30 +00:00
|
|
|
rtw_skb_free(pkt);
|
2013-05-08 21:45:39 +00:00
|
|
|
RT_TRACE(_module_xmit_osdep_c_, _drv_notice_, ("rtw_xmit_entry: drop, tx_drop=%d\n", (u32)pxmitpriv->tx_drop));
|
|
|
|
|
|
|
|
exit:
|
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
int rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev)
|
|
|
|
{
|
|
|
|
if (pkt)
|
|
|
|
rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, pkt->truesize);
|
|
|
|
return _rtw_xmit_entry(pkt, pnetdev);
|
|
|
|
}
|