Commit 83a27326 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Greg Kroah-Hartman

Staging: vt6655: remove PRIVATE_OBJ ifdefs

Cc: Forest Bond <forest@alittletooquiet.net>
Cc: Alexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b8bc58c5
......@@ -41,12 +41,6 @@
#if !defined(__TETHER_H__)
#include "tether.h"
#endif
// #ifdef PRIVATE_OBJ
//#if !defined(__DEVICE_MODULE_H)
//#include "device_module.h"
//#endif
/*--------------------- Export Definitions -------------------------*/
......@@ -237,9 +231,6 @@
typedef struct tagDEVICE_RD_INFO {
struct sk_buff* skb;
#ifdef PRIVATE_OBJ
ref_sk_buff ref_skb;
#endif
dma_addr_t skb_dma;
dma_addr_t curr_desc;
} DEVICE_RD_INFO, *PDEVICE_RD_INFO;
......
......@@ -137,11 +137,6 @@
//#define TASK_LET
//PLICE_DEBUG<-
// #ifdef PRIVATE_OBJ
//#if !defined(__DEVICE_MODULE_H)
//#include "device_module.h"
//#endif
/*--------------------- Export Definitions -------------------------*/
......@@ -203,93 +198,9 @@
// BUILD OBJ mode
#ifdef PRIVATE_OBJ
#undef dev_kfree_skb
#undef dev_kfree_skb_irq
#undef dev_alloc_skb
#undef kfree
#undef del_timer
#undef init_timer
#undef add_timer
#undef kmalloc
#undef netif_stop_queue
#undef netif_start_queue
#undef netif_wake_queue
#undef netif_queue_stopped
#undef netif_rx
#undef netif_running
#undef udelay
#undef mdelay
#undef eth_type_trans
#undef skb_put
#undef HZ
#undef RUN_AT
#undef pci_alloc_consistent
#undef pci_free_consistent
#undef register_netdevice
#undef register_netdev
#undef unregister_netdevice
#undef unregister_netdev
#undef skb_queue_head_init
#undef skb_queue_tail
#undef skb_queue_empty
#undef free_irq
#undef copy_from_user
#undef copy_to_user
#undef spin_lock_init
#undef pci_map_single
#undef pci_unmap_single
// redefine kernel dependent fucntion
#define dev_kfree_skb ref_dev_kfree_skb
#define dev_kfree_skb_irq ref_dev_kfree_skb_irq
#define dev_alloc_skb ref_dev_alloc_skb
#define kfree ref_kfree
#define del_timer ref_del_timer
#define init_timer ref_init_timer
#define add_timer ref_add_timer
#define kmalloc ref_kmalloc
#define netif_stop_queue ref_netif_stop_queue
#define netif_start_queue ref_netif_start_queue
#define netif_wake_queue ref_netif_wake_queue
#define netif_queue_stopped ref_netif_queue_stopped
#define netif_rx ref_netif_rx
#define netif_running ref_netif_running
#define udelay ref_udelay
#define mdelay ref_mdelay
#define get_jiffies() ref_get_jiffies()
#define RUN_AT(x) (get_jiffies()+(x))
#define HZ ref_HZ_tick()
#define eth_type_trans ref_eth_type_trans
#define skb_put ref_skb_put
#define skb_queue_head_init ref_skb_queue_head_init
#define skb_queue_tail ref_skb_queue_tail
#define skb_queue_empty ref_skb_queue_empty
#define pci_alloc_consistent ref_pci_alloc_consistent
#define pci_free_consistent ref_pci_free_consistent
#define register_netdevice ref_register_netdevice
#define register_netdev ref_register_netdev
#define unregister_netdevice ref_unregister_netdevice
#define unregister_netdev ref_unregister_netdev
#define free_irq ref_free_irq
#define copy_from_user ref_copy_from_user
#define copy_to_user ref_copy_to_user
#define spin_lock_init ref_spin_lock_init
#define pci_map_single ref_pci_map_single
#define pci_unmap_single ref_pci_unmap_single
#endif
#ifdef PRIVATE_OBJ
#undef printk
#define DEVICE_PRT(l, p, args...) {if (l<=msglevel) do {} while (0);}
//#define DEVICE_PRT(l, p, args...) {if (l<=msglevel) printk( p ,##args);}
#else
#define DEVICE_PRT(l, p, args...) {if (l<=msglevel) printk( p ,##args);}
#endif
#define AVAIL_TD(p,q) ((p)->sOpts.nTxDescs[(q)]-((p)->iTDUsed[(q)]))
......@@ -452,9 +363,6 @@ typedef struct tagSDeFragControlBlock
BYTE abyAddr2[U_ETHER_ADDR_LEN];
UINT uLifetime;
struct sk_buff* skb;
#ifdef PRIVATE_OBJ
ref_sk_buff ref_skb;
#endif
PBYTE pbyRxBuffer;
UINT cbFrameLength;
BOOL bInUse;
......
......@@ -132,16 +132,8 @@
#include <linux/delay.h>
#include <linux/kthread.h>
// #ifdef PRIVATE_OBJ
//#if !defined(__DEVICE_EXP_H)
//#include "device_exp.h"
//#endif
//#if !defined(__DEVICE_MODULE_H)
//#include "device_module.h"
//#endif
// #endif
//#define DEBUG
/*--------------------- Static Definitions -------------------------*/
//static int msglevel =MSG_LEVEL_DEBUG;
......@@ -151,11 +143,9 @@ static int msglevel = MSG_LEVEL_INFO;
//
// Define module options
//
#ifndef PRIVATE_OBJ
MODULE_AUTHOR("VIA Networking Technologies, Inc., <lyndonchen@vntek.com.tw>");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("VIA Networking Solomon-A/B/G Wireless LAN Adapter Driver");
#endif
//PLICE_DEBUG ->
static int mlme_kill;
......@@ -332,7 +322,6 @@ DEVICE_PARAM(bDiversityANTEnable, "ANT diversity mode");
//
#ifndef PRIVATE_OBJ
static int device_nics =0;
static PSDevice pDevice_Infos =NULL;
static struct net_device *root_device_dev = NULL;
......@@ -347,11 +336,9 @@ static struct pci_device_id device_id_table[] __devinitdata = {
{ 0x1106, 0x3253, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long)&chip_info_table[0]},
{ 0, }
};
#endif
/*--------------------- Static Functions --------------------------*/
#ifndef PRIVATE_OBJ
static int device_found1(struct pci_dev *pcid, const struct pci_device_id *ent);
static BOOL device_init_info(struct pci_dev* pcid, PSDevice* ppDevice, PCHIP_INFO);
......@@ -378,7 +365,6 @@ struct notifier_block device_notifier = {
};
#endif
#endif // #ifndef PRIVATE_OBJ
static void device_init_rd0_ring(PSDevice pDevice);
static void device_init_rd1_ring(PSDevice pDevice);
......@@ -386,9 +372,7 @@ static void device_init_defrag_cb(PSDevice pDevice);
static void device_init_td0_ring(PSDevice pDevice);
static void device_init_td1_ring(PSDevice pDevice);
#ifndef PRIVATE_OBJ
static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev);
#endif
//2008-0714<Add>by Mike Liu
static BOOL device_release_WPADEV(PSDevice pDevice);
......@@ -412,7 +396,6 @@ static int Config_FileGetParameter(UCHAR *string, UCHAR *dest,UCHAR *source);
/*--------------------- Export Functions --------------------------*/
#ifndef PRIVATE_OBJ
static char* get_chip_name(int chip_id) {
int i;
......@@ -432,7 +415,6 @@ static void __devexit device_remove1(struct pci_dev *pcid)
}
#endif
/*
static void
device_set_int_opt(int *opt, int val, int min, int max, int def,char* name,char* devname) {
......@@ -978,7 +960,6 @@ static const struct net_device_ops device_netdev_ops = {
};
#ifndef PRIVATE_OBJ
static int
device_found1(struct pci_dev *pcid, const struct pci_device_id *ent)
......@@ -1329,7 +1310,6 @@ device_release_WPADEV(pDevice);
pci_set_drvdata(pDevice->pcid,NULL);
}
}
#endif// ifndef PRIVATE_OBJ
static BOOL device_init_rings(PSDevice pDevice) {
void* vir_pool;
......@@ -1676,11 +1656,7 @@ static int device_rx_srv(PSDevice pDevice, UINT uIdx) {
}
}
pRD->m_rd0RD0.f1Owner = OWNED_BY_NIC;
#ifdef PRIVATE_OBJ
ref_set_rx_jiffies(pDevice->dev);
#else
pDevice->dev->last_rx = jiffies;
#endif
}
pDevice->pCurrRD[uIdx]=pRD;
......@@ -1693,15 +1669,6 @@ static BOOL device_alloc_rx_buf(PSDevice pDevice, PSRxDesc pRD) {
PDEVICE_RD_INFO pRDInfo=pRD->pRDInfo;
#ifdef PRIVATE_OBJ
pRDInfo->skb=dev_alloc_skb(pDevice->rx_buf_sz);
if (pRDInfo->skb==NULL)
return FALSE;
ref_skb_remap(pDevice->dev, &(pRDInfo->ref_skb), pRDInfo->skb);
pRDInfo->skb_dma = pci_map_single(pDevice->pcid, pRDInfo->ref_skb.tail, pDevice->rx_buf_sz,
PCI_DMA_FROMDEVICE);
#else
pRDInfo->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
#ifdef PLICE_DEBUG
......@@ -1713,7 +1680,6 @@ static BOOL device_alloc_rx_buf(PSDevice pDevice, PSRxDesc pRD) {
pRDInfo->skb->dev = pDevice->dev;
pRDInfo->skb_dma = pci_map_single(pDevice->pcid, pRDInfo->skb->tail, pDevice->rx_buf_sz,
PCI_DMA_FROMDEVICE);
#endif
*((PU32) &(pRD->m_rd0RD0)) = 0;
pRD->m_rd0RD0.wResCount = cpu_to_le16(pDevice->rx_buf_sz);
......@@ -1728,20 +1694,11 @@ static BOOL device_alloc_rx_buf(PSDevice pDevice, PSRxDesc pRD) {
BOOL device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF) {
#ifdef PRIVATE_OBJ
pDeF->skb=dev_alloc_skb(pDevice->rx_buf_sz);
if (pDeF->skb==NULL)
return FALSE;
ref_skb_remap(pDevice->dev, &(pDeF->ref_skb), pDeF->skb);
#else
pDeF->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
if (pDeF->skb == NULL)
return FALSE;
ASSERT(pDeF->skb);
pDeF->skb->dev = pDevice->dev;
#endif
return TRUE;
}
......@@ -1760,9 +1717,6 @@ static int device_tx_srv(PSDevice pDevice, UINT uIdx) {
struct sk_buff* skb;
UINT uNodeIndex;
PSMgmtObject pMgmt = pDevice->pMgmt;
#ifdef PRIVATE_OBJ
ref_sk_buff ref_skb;
#endif
for (pTD = pDevice->apTailTD[uIdx]; pDevice->iTDUsed[uIdx] >0; pTD = pTD->next) {
......@@ -1782,9 +1736,6 @@ static int device_tx_srv(PSDevice pDevice, UINT uIdx) {
uFIFOHeaderSize = pTD->pTDInfo->dwHeaderLength;
uFrameSize = pTD->pTDInfo->dwReqCount - uFIFOHeaderSize;
pTxBufHead = (PSTxBufHead) (pTD->pTDInfo->buf);
#ifdef PRIVATE_OBJ
ref_skb_remap(pDevice->dev, &ref_skb, pTD->pTDInfo->skb);
#endif
// Update the statistics based on the Transmit status
// now, we DO'NT check TSR0_CDH
......@@ -1809,11 +1760,7 @@ static int device_tx_srv(PSDevice pDevice, UINT uIdx) {
pDevice->s802_11Counter.TransmittedFragmentCount ++;
}
pStats->tx_packets++;
#ifdef PRIVATE_OBJ
pStats->tx_bytes += *(ref_skb.len);
#else
pStats->tx_bytes += pTD->pTDInfo->skb->len;
#endif
}
else {
DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Tx[%d] dropped & tsr1[%02X] tsr0[%02X].\n",
......@@ -1826,14 +1773,6 @@ static int device_tx_srv(PSDevice pDevice, UINT uIdx) {
if ((pTD->pTDInfo->byFlags & TD_FLAGS_PRIV_SKB) != 0) {
if (pDevice->bEnableHostapd) {
DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "tx call back netif.. \n");
#ifdef PRIVATE_OBJ
ref_skb_remap(pDevice->apdev, &(ref_skb), pTD->pTDInfo->skb);
ref_skb.mac.raw = ref_skb.data;
*(ref_skb.pkt_type) = PACKET_OTHERHOST;
//*(ref_skb.protocol) = htons(ETH_P_802_2);
memset(ref_skb.cb, 0, sizeof(ref_skb.cb));
netif_rx(ref_skb.skb);
#else
skb = pTD->pTDInfo->skb;
skb->dev = pDevice->apdev;
skb->mac_header = skb->data;
......@@ -1841,7 +1780,6 @@ static int device_tx_srv(PSDevice pDevice, UINT uIdx) {
//skb->protocol = htons(ETH_P_802_2);
memset(skb->cb, 0, sizeof(skb->cb));
netif_rx(skb);
#endif
}
}
......@@ -1998,28 +1936,18 @@ INT MlmeThread(
}
#ifdef PRIVATE_OBJ
int __device_open(HANDLE pExDevice) {
PSDevice_info pDevice_info = (PSDevice_info)pExDevice;
PSDevice pDevice = (PSDevice)(pDevice_info->pWDevice);
#else
static int device_open(struct net_device *dev) {
PSDevice pDevice=(PSDevice) netdev_priv(dev);
int i;
#endif
pDevice->rx_buf_sz = PKT_BUF_SZ;
if (!device_init_rings(pDevice)) {
return -ENOMEM;
}
//2008-5-13 <add> by chester
#ifndef PRIVATE_OBJ
i=request_irq(pDevice->pcid->irq, &device_intr, IRQF_SHARED, dev->name, dev);
if (i)
return i;
#endif
//printk("DEBUG1\n");
#ifdef WPA_SM_Transtatus
extern SWPAResult wpa_Result;
......@@ -2085,11 +2013,7 @@ DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call device_init_registers\n");
device_init_registers(pDevice, DEVICE_INIT_COLD);
MACvReadEtherAddress(pDevice->PortOffset, pDevice->abyCurrentNetAddr);
memcpy(pDevice->pMgmt->abyMACAddr, pDevice->abyCurrentNetAddr, U_ETHER_ADDR_LEN);
#ifdef PRIVATE_OBJ
__device_set_multi(pExDevice);
#else
device_set_multi(pDevice->dev);
#endif
// Init for Key Management
KeyvInitTable(&pDevice->sKey, pDevice->PortOffset);
......@@ -2141,17 +2065,8 @@ DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call MACvIntEnable\n");
}
#ifdef PRIVATE_OBJ
int __device_close(HANDLE pExDevice) {
PSDevice_info pDevice_info = (PSDevice_info)pExDevice;
struct net_device *dev = pDevice_info->dev;
PSDevice pDevice = (PSDevice)(pDevice_info->pWDevice);
#else
static int device_close(struct net_device *dev) {
PSDevice pDevice=(PSDevice) netdev_priv(dev);
#endif
PSMgmtObject pMgmt = pDevice->pMgmt;
//PLICE_DEBUG->
#ifdef THREAD
......@@ -2204,19 +2119,10 @@ device_release_WPADEV(pDevice);
return 0;
}
#ifdef PRIVATE_OBJ
int __device_dma0_tx_80211(HANDLE pExDevice, struct sk_buff *skb) {
PSDevice_info pDevice_info = (PSDevice_info)pExDevice;
PSDevice pDevice = (PSDevice)(pDevice_info->pWDevice);
ref_sk_buff ref_skb;
#else
static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) {
PSDevice pDevice=netdev_priv(dev);
#endif
PBYTE pbMPDU;
UINT cbMPDULen = 0;
......@@ -2237,14 +2143,8 @@ static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) {
return 0;
};
#ifdef PRIVATE_OBJ
ref_skb_remap(pDevice->dev, &ref_skb, skb);
cbMPDULen = *(ref_skb.len);
pbMPDU = ref_skb.data;
#else
cbMPDULen = skb->len;
pbMPDU = skb->data;
#endif
vDMA0_tx_80211(pDevice, skb, pbMPDU, cbMPDULen);
......@@ -2268,9 +2168,6 @@ BOOL device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, UINT uNodeIndex) {
UINT ii;
SKeyItem STempKey;
// BYTE byKeyIndex = 0;
#ifdef PRIVATE_OBJ
ref_sk_buff ref_skb;
#endif
if (pDevice->bStopTx0Pkt == TRUE) {
......@@ -2292,21 +2189,12 @@ BOOL device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, UINT uNodeIndex) {
}
}
#ifdef PRIVATE_OBJ
ref_skb_remap(pDevice->dev, &(ref_skb), skb);
#endif
pHeadTD = pDevice->apCurrTD[TYPE_TXDMA0];
pHeadTD->m_td1TD1.byTCR = (TCR_EDP|TCR_STP);
#ifdef PRIVATE_OBJ
memcpy(pDevice->sTxEthHeader.abyDstAddr, (PBYTE)(ref_skb.data), U_HEADER_LEN);
cbFrameBodySize = *(ref_skb.len) - U_HEADER_LEN;
#else
memcpy(pDevice->sTxEthHeader.abyDstAddr, (PBYTE)(skb->data), U_HEADER_LEN);
cbFrameBodySize = skb->len - U_HEADER_LEN;
#endif
// 802.1H
if (ntohs(pDevice->sTxEthHeader.wType) > MAX_DATA_LEN) {
......@@ -2417,19 +2305,9 @@ BOOL device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, UINT uNodeIndex) {
}
//TYPE_AC0DMA data tx
#ifdef PRIVATE_OBJ
int __device_xmit(HANDLE pExDevice, struct sk_buff *skb) {
PSDevice_info pDevice_info = (PSDevice_info)pExDevice;
PSDevice pDevice = (PSDevice)(pDevice_info->pWDevice);
struct net_device *dev = pDevice_info->dev;
ref_sk_buff ref_skb;
#else
static int device_xmit(struct sk_buff *skb, struct net_device *dev) {
PSDevice pDevice=netdev_priv(dev);
#endif
PSMgmtObject pMgmt = pDevice->pMgmt;
PSTxDesc pHeadTD, pLastTD;
UINT uNodeIndex = 0;
......@@ -2463,9 +2341,6 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) {
return 0;
}
#ifdef PRIVATE_OBJ
ref_skb_remap(pDevice->dev, &ref_skb, skb);
#endif
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
if (pDevice->uAssocCount == 0) {
......@@ -2473,19 +2348,11 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) {
spin_unlock_irq(&pDevice->lock);
return 0;
}
#ifdef PRIVATE_OBJ
if (IS_MULTICAST_ADDRESS((PBYTE)(ref_skb.data))) {
#else
if (IS_MULTICAST_ADDRESS((PBYTE)(skb->data))) {
#endif
uNodeIndex = 0;
bNodeExist = TRUE;
if (pMgmt->sNodeDBTable[0].bPSEnable) {
#ifdef PRIVATE_OBJ
skb_queue_tail(&(pMgmt->sNodeDBTable[0].sTxPSQueue), ref_skb.skb);
#else
skb_queue_tail(&(pMgmt->sNodeDBTable[0].sTxPSQueue), skb);
#endif
pMgmt->sNodeDBTable[0].wEnQueueCnt++;
// set tx map
pMgmt->abyPSTxMap[0] |= byMask[0];
......@@ -2493,17 +2360,9 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) {
return 0;
}
}else {
#ifdef PRIVATE_OBJ
if (BSSDBbIsSTAInNodeDB(pMgmt, (PBYTE)(ref_skb.data), &uNodeIndex)) {
#else
if (BSSDBbIsSTAInNodeDB(pMgmt, (PBYTE)(skb->data), &uNodeIndex)) {
#endif
if (pMgmt->sNodeDBTable[uNodeIndex].bPSEnable) {
#ifdef PRIVATE_OBJ
skb_queue_tail(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue, ref_skb.skb);
#else
skb_queue_tail(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue, skb);
#endif
pMgmt->sNodeDBTable[uNodeIndex].wEnQueueCnt++;
// set tx map
wAID = pMgmt->sNodeDBTable[uNodeIndex].wAID;
......@@ -2538,13 +2397,8 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) {
pHeadTD->m_td1TD1.byTCR = (TCR_EDP|TCR_STP);
#ifdef PRIVATE_OBJ
memcpy(pDevice->sTxEthHeader.abyDstAddr, (PBYTE)(ref_skb.data), U_HEADER_LEN);
cbFrameBodySize = *(ref_skb.len) - U_HEADER_LEN;
#else
memcpy(pDevice->sTxEthHeader.abyDstAddr, (PBYTE)(skb->data), U_HEADER_LEN);
cbFrameBodySize = skb->len - U_HEADER_LEN;
#endif
// 802.1H
if (ntohs(pDevice->sTxEthHeader.wType) > MAX_DATA_LEN) {
cbFrameBodySize += 8;
......@@ -2763,14 +2617,6 @@ pDevice->byTopCCKBasicRate,pDevice->byTopOFDMBasicRate);
}
#ifdef PRIVATE_OBJ
vGenerateFIFOHeader(pDevice, byPktTyp, pDevice->pbyTmpBuff, bNeedEncryption,
cbFrameBodySize, TYPE_AC0DMA, pHeadTD,
&pDevice->sTxEthHeader, (PBYTE)ref_skb.data, pTransmitKey, uNodeIndex,
&uMACfragNum,
&cbHeaderSize
);
#else
#ifdef PLICE_DEBUG
//if (skb->len == 98)
//{
......@@ -2783,7 +2629,6 @@ pDevice->byTopCCKBasicRate,pDevice->byTopOFDMBasicRate);
&uMACfragNum,
&cbHeaderSize
);
#endif
if (MACbIsRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PS)) {
// Disable PS
......@@ -2804,11 +2649,7 @@ pDevice->byTopCCKBasicRate,pDevice->byTopOFDMBasicRate);
// Save the information needed by the tx interrupt handler
// to complete the Send request
#ifdef PRIVATE_OBJ
pLastTD->pTDInfo->skb = ref_skb.skb;
#else
pLastTD->pTDInfo->skb = skb;
#endif
pLastTD->pTDInfo->byFlags = 0;
pLastTD->pTDInfo->byFlags |= TD_FLAGS_NETIF_SKB;
#ifdef TxInSleep
......@@ -2862,29 +2703,16 @@ BOOL bTxeapol_key = FALSE;
MACvTransmitAC0(pDevice->PortOffset);
// DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "acdma0:pDevice->apCurrTD= %p\n", pHeadTD);
#ifdef PRIVATE_OBJ
ref_set_tx_jiffies(pDevice->dev);
#else
dev->trans_start = jiffies;
#endif
spin_unlock_irq(&pDevice->lock);
return 0;
}
#ifdef PRIVATE_OBJ
int __device_intr(int irq, HANDLE pExDevice, struct pt_regs *regs) {
PSDevice_info pDevice_info = (PSDevice_info)pExDevice;
PSDevice pDevice = (PSDevice)(pDevice_info->pWDevice);
#else
static irqreturn_t device_intr(int irq, void *dev_instance) {
struct net_device* dev=dev_instance;
PSDevice pDevice=(PSDevice) netdev_priv(dev);
#endif
int max_count=0;
DWORD dwMIBCounter=0;
......@@ -3290,18 +3118,9 @@ else {
}
#ifdef PRIVATE_OBJ
void __device_set_multi(HANDLE pExDevice) {
PSDevice_info pDevice_info = (PSDevice_info)pExDevice;
ref_net_device *dev = &(pDevice_info->ref_dev);
PSDevice pDevice = (PSDevice)(pDevice_info->pWDevice);
#else
static void device_set_multi(struct net_device *dev) {
PSDevice pDevice = (PSDevice) netdev_priv(dev);
#endif
PSMgmtObject pMgmt = pDevice->pMgmt;
u32 mc_filter[2];
......@@ -3311,24 +3130,13 @@ static void device_set_multi(struct net_device *dev) {
VNSvInPortB(pDevice->PortOffset + MAC_REG_RCR, &(pDevice->byRxMode));
#ifdef PRIVATE_OBJ
if (*(dev->flags) & IFF_PROMISC) { /* Set promiscuous. */
DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: Promiscuous mode enabled.\n", pDevice->dev->name);
#else
if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
DEVICE_PRT(MSG_LEVEL_ERR,KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name);
#endif
/* Unconditionally log net taps. */
pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST|RCR_UNICAST);
}
#ifdef PRIVATE_OBJ
else if ((*(dev->mc_count) > pDevice->multicast_limit)
|| (*(dev->flags) & IFF_ALLMULTI)) {
#else
else if ((dev->mc_count > pDevice->multicast_limit)
|| (dev->flags & IFF_ALLMULTI)) {
#endif
MACvSelectPage1(pDevice->PortOffset);
VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR0, 0xffffffff);
VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR0 + 4, 0xffffffff);
......@@ -3337,13 +3145,8 @@ static void device_set_multi(struct net_device *dev) {
}
else {
memset(mc_filter, 0, sizeof(mc_filter));
#ifdef PRIVATE_OBJ
for (i = 0, mclist = dev->mc_list; mclist && i < *(dev->mc_count);
i++, mclist = mclist->next) {
#else
for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count;
i++, mclist = mclist->next) {
#endif
int bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26;
mc_filter[bit_nr >> 5] |= cpu_to_le32(1 << (bit_nr & 31));
}
......@@ -3366,33 +3169,16 @@ static void device_set_multi(struct net_device *dev) {
}
#ifdef PRIVATE_OBJ
struct net_device_stats *__device_get_stats(HANDLE pExDevice) {
PSDevice_info pDevice_info = (PSDevice_info)pExDevice;
PSDevice pDevice = (PSDevice)(pDevice_info->pWDevice);
#else
static struct net_device_stats *device_get_stats(struct net_device *dev) {
PSDevice pDevice=(PSDevice) netdev_priv(dev);
#endif
return &pDevice->stats;
}
#ifdef PRIVATE_OBJ
int __device_ioctl(HANDLE pExDevice, struct ifreq *rq, int cmd) {
PSDevice_info pDevice_info = (PSDevice_info)pExDevice;
struct net_device *dev = pDevice_info->dev;
PSDevice pDevice = (PSDevice)(pDevice_info->pWDevice);
#else
static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
PSDevice pDevice = (PSDevice)netdev_priv(dev);
#endif
struct iwreq *wrq = (struct iwreq *) rq;
int rc =0;
......@@ -3854,7 +3640,6 @@ static int ethtool_ioctl(struct net_device *dev, void *useraddr)
}
/*------------------------------------------------------------------*/
#ifndef PRIVATE_OBJ
MODULE_DEVICE_TABLE(pci, device_id_table);
......@@ -3987,59 +3772,6 @@ viawget_resume(struct pci_dev *pcid)
#endif
#endif //#ifndef PRIVATE_OBJ
#ifdef PRIVATE_OBJ
int __device_hw_reset(HANDLE pExDevice){
PSDevice_info pDevice_info = (PSDevice_info)pExDevice;
return MACbSoftwareReset(pDevice_info->port_offset);
}
int __device_hw_init(HANDLE pExDevice){
PSDevice_info pDevice_info = (PSDevice_info)pExDevice;
PSDevice pDevice;
pDevice = (PSDevice)kmalloc(sizeof(DEVICE_INFO), (int)GFP_ATOMIC);
if (pDevice == NULL)
return FALSE;
memset(pDevice, 0, sizeof(DEVICE_INFO));
pDevice_info->pWDevice = pDevice;
pDevice->PortOffset = pDevice_info->port_offset;
pDevice->dev = pDevice_info->dev;
pDevice->pcid = pDevice_info->pcid;
pDevice->chip_id = pDevice_info->chip_id;
pDevice->memaddr = pDevice_info->mem_addr;
pDevice->ioaddr = pDevice_info->io_addr;
pDevice->io_size = pDevice_info->io_size;
pDevice->nTxQueues = pDevice_info->nTxQueues;
pDevice->multicast_limit = pDevice_info->multicast_limit;
pDevice->sMgmtObj.pAdapter = (PVOID)pDevice;
pDevice->pMgmt = &(pDevice->sMgmtObj);
MACvInitialize(pDevice->PortOffset);
device_get_options(pDevice, 0 , pDevice_info->dev->name);
device_set_options(pDevice);
pDevice->sOpts.flags &= pDevice_info->flags;
pDevice->flags = pDevice->sOpts.flags | (pDevice_info->flags & 0xFF000000UL);
spin_lock_init(&(pDevice->lock));
return TRUE;
}
void __device_read_mac(HANDLE pExDevice, PBYTE dev_addr){
PSDevice_info pDevice_info = (PSDevice_info)pExDevice;
PSDevice pDevice = (PSDevice)(pDevice_info->pWDevice);
MACvReadEtherAddress(pDevice->PortOffset, dev_addr);
return;
}
#endif
......@@ -143,17 +143,6 @@ static BOOL s_bAPModeRxCtl(
IN INT iSANodeIndex
);
#ifdef PRIVATE_OBJ
static BOOL s_bAPModeRxData (
IN PSDevice pDevice,
IN ref_sk_buff* skb,
IN UINT FrameSize,
IN UINT cbHeaderOffset,
IN INT iSANodeIndex,
IN INT iDANodeIndex
);
#else
static BOOL s_bAPModeRxData (
IN PSDevice pDevice,
......@@ -163,7 +152,6 @@ static BOOL s_bAPModeRxData (
IN INT iSANodeIndex,
IN INT iDANodeIndex
);
#endif
static BOOL s_bHandleRxEncryption(
......@@ -395,11 +383,7 @@ device_receive_frame (
//printk("device_receive_frame:pCurrRD is %x,pRDInfo is %x\n",pCurrRD,pCurrRD->pRDInfo);
#endif
struct net_device_stats* pStats=&pDevice->stats;
#ifdef PRIVATE_OBJ
ref_sk_buff* skb;
#else
struct sk_buff* skb;
#endif
PSMgmtObject pMgmt = pDevice->pMgmt;
PSRxMgmtPacket pRxPacket = &(pDevice->pMgmt->sRxPacket);
PS802_11Header p802_11Header;
......@@ -435,12 +419,8 @@ device_receive_frame (
BOOL bRxeapol_key = FALSE;
// DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- device_receive_frame---\n");
#ifdef PRIVATE_OBJ
skb = &(pRDInfo->ref_skb);
#else
skb = pRDInfo->skb;
#endif
//PLICE_DEBUG->
......@@ -541,11 +521,7 @@ device_receive_frame (
p802_11Header = (PS802_11Header) (pbyFrame);
// get SA NodeIndex
if (BSSDBbIsSTAInNodeDB(pMgmt, (PBYTE)(p802_11Header->abyAddr2), &iSANodeIndex)) {
#ifdef PRIVATE_OBJ
pMgmt->sNodeDBTable[iSANodeIndex].ulLastRxJiffer = get_jiffies();
#else
pMgmt->sNodeDBTable[iSANodeIndex].ulLastRxJiffer = jiffies;
#endif
pMgmt->sNodeDBTable[iSANodeIndex].uInActiveCount = 0;
}
}
......@@ -639,11 +615,7 @@ device_receive_frame (
pDevice->s802_11Counter.ReceivedFragmentCount++;
if (bDeFragRx) {
// defrag complete
#ifdef PRIVATE_OBJ
skb = &(pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].ref_skb);
#else
skb = pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].skb;
#endif
FrameSize = pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength;
}
......@@ -705,16 +677,6 @@ device_receive_frame (
// hostap Deamon handle 802.11 management
if (pDevice->bEnableHostapd) {
skb->dev = pDevice->apdev;
#ifdef PRIVATE_OBJ
ref_skb_add_offset(skb->skb, 4);
ref_skb_set_dev(pDevice->apdev, skb->skb);
skb_put(skb->skb, FrameSize);
skb->mac_header = skb->data;
*(skb->pkt_type) = PACKET_OTHERHOST;
*(skb->protocol) = htons(ETH_P_802_2);
memset(skb->cb, 0, sizeof(skb->cb));
netif_rx(skb->skb);
#else
skb->data += 4;
skb->tail += 4;
skb_put(skb, FrameSize);
......@@ -723,7 +685,6 @@ device_receive_frame (
skb->protocol = htons(ETH_P_802_2);
memset(skb->cb, 0, sizeof(skb->cb));
netif_rx(skb);
#endif
return TRUE;
}
}
......@@ -846,16 +807,6 @@ device_receive_frame (
memcpy(&abyMacHdr[0], (skb->data + 4), 24);
memcpy((skb->data + 4 + cbIVOffset), &abyMacHdr[0], 24);
}
#ifdef PRIVATE_OBJ
ref_skb_add_offset(skb->skb, (cbIVOffset + 4));
ref_skb_set_dev(pDevice->apdev, skb->skb);
skb_put(skb->skb, FrameSize);
skb->mac_header = skb->data;
*(skb->pkt_type) = PACKET_OTHERHOST;
*(skb->protocol) = htons(ETH_P_802_2);
memset(skb->cb, 0, sizeof(skb->cb));
netif_rx(skb->skb);
#else
skb->data += (cbIVOffset + 4);
skb->tail += (cbIVOffset + 4);
skb_put(skb, FrameSize);
......@@ -865,7 +816,6 @@ device_receive_frame (
skb->protocol = htons(ETH_P_802_2);
memset(skb->cb, 0, sizeof(skb->cb));
netif_rx(skb);
#endif
return TRUE;
}
......@@ -1081,29 +1031,17 @@ device_receive_frame (
}
#ifdef PRIVATE_OBJ
ref_skb_add_offset(skb->skb, cbHeaderOffset);
skb_put(skb->skb, FrameSize);
*(skb->protocol)=eth_type_trans(skb->skb, skb->dev);
#else
skb->data += cbHeaderOffset;
skb->tail += cbHeaderOffset;
skb_put(skb, FrameSize);
skb->protocol=eth_type_trans(skb, skb->dev);
#endif
//drop frame not met IEEE 802.3
/*
if (pDevice->flags & DEVICE_FLAGS_VAL_PKT_LEN) {
#ifdef PRIVATE_OBJ
if ((*(skb->protocol)==htons(ETH_P_802_3)) &&
(*(skb->len)!=htons(skb->mac.ethernet->h_proto))) {
#else
if ((skb->protocol==htons(ETH_P_802_3)) &&
(skb->len!=htons(skb->mac.ethernet->h_proto))) {
#endif
pStats->rx_length_errors++;
pStats->rx_dropped++;
if (bDeFragRx) {
......@@ -1117,17 +1055,10 @@ device_receive_frame (
}
*/
#ifdef PRIVATE_OBJ
*(skb->ip_summed)=CHECKSUM_NONE;
pStats->rx_bytes +=*(skb->len);
pStats->rx_packets++;
netif_rx(skb->skb);
#else
skb->ip_summed=CHECKSUM_NONE;
pStats->rx_bytes +=skb->len;
pStats->rx_packets++;
netif_rx(skb);
#endif
if (bDeFragRx) {
if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) {
......@@ -1541,18 +1472,6 @@ static BOOL s_bHostWepRxEncryption (
#ifdef PRIVATE_OBJ
static BOOL s_bAPModeRxData (
IN PSDevice pDevice,
IN ref_sk_buff* skb,
IN UINT FrameSize,
IN UINT cbHeaderOffset,
IN INT iSANodeIndex,
IN INT iDANodeIndex
)
#else
static BOOL s_bAPModeRxData (
IN PSDevice pDevice,
......@@ -1562,20 +1481,13 @@ static BOOL s_bAPModeRxData (
IN INT iSANodeIndex,
IN INT iDANodeIndex
)
#endif
{
PSMgmtObject pMgmt = pDevice->pMgmt;
BOOL bRelayAndForward = FALSE;
BOOL bRelayOnly = FALSE;
BYTE byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
WORD wAID;
#ifdef PRIVATE_OBJ
struct sk_buff* tmp_skb;
ref_sk_buff s_ref_skb;
ref_sk_buff* skbcpy = &s_ref_skb;
#else
struct sk_buff* skbcpy = NULL;
#endif
......@@ -1585,28 +1497,16 @@ static BOOL s_bAPModeRxData (
if(IS_MULTICAST_ADDRESS((PBYTE)(skb->data+cbHeaderOffset))) {
if (pMgmt->sNodeDBTable[0].bPSEnable) {
#ifdef PRIVATE_OBJ
tmp_skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
skbcpy = &s_ref_skb;
ref_skb_remap(pDevice->dev, skbcpy, tmp_skb);
#else
skbcpy = dev_alloc_skb((int)pDevice->rx_buf_sz);
#endif
// if any node in PS mode, buffer packet until DTIM.
if (skbcpy == NULL) {
DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "relay multicast no skb available \n");
}
else {
skbcpy->dev = pDevice->dev;
#ifdef PRIVATE_OBJ
*(skbcpy->len) = FrameSize;
memcpy(skbcpy->data, skb->data+cbHeaderOffset, FrameSize);
skb_queue_tail(&(pMgmt->sNodeDBTable[0].sTxPSQueue), skbcpy->skb);
#else
skbcpy->len = FrameSize;
memcpy(skbcpy->data, skb->data+cbHeaderOffset, FrameSize);
skb_queue_tail(&(pMgmt->sNodeDBTable[0].sTxPSQueue), skbcpy);
#endif
pMgmt->sNodeDBTable[0].wEnQueueCnt++;
// set tx map
pMgmt->abyPSTxMap[0] |= byMask[0];
......@@ -1623,16 +1523,10 @@ static BOOL s_bAPModeRxData (
if (pMgmt->sNodeDBTable[iDANodeIndex].bPSEnable) {
// queue this skb until next PS tx, and then release.
#ifdef PRIVATE_OBJ
ref_skb_add_offset(skb->skb, cbHeaderOffset);
skb_put(skb->skb, FrameSize);
skb_queue_tail(&pMgmt->sNodeDBTable[iDANodeIndex].sTxPSQueue, skb->skb);
#else
skb->data += cbHeaderOffset;
skb->tail += cbHeaderOffset;
skb_put(skb, FrameSize);
skb_queue_tail(&pMgmt->sNodeDBTable[iDANodeIndex].sTxPSQueue, skb);
#endif
pMgmt->sNodeDBTable[iDANodeIndex].wEnQueueCnt++;
wAID = pMgmt->sNodeDBTable[iDANodeIndex].wAID;
pMgmt->abyPSTxMap[wAID >> 3] |= byMask[wAID & 7];
......
......@@ -106,25 +106,6 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Enabling hostapd mode\n", dev->name);
#ifdef PRIVATE_OBJ
pDevice->apdev = ref_init_apdev(dev);
if (pDevice->apdev == NULL)
return -ENOMEM;
if (rtnl_locked)
ret = register_netdevice(pDevice->apdev);
else
ret = register_netdev(pDevice->apdev);
if (ret) {
DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: register_netdevice(AP) failed!\n",
dev->name);
return -1;
}
DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Registered netdevice %s for AP management\n",
dev->name, pDevice->apdev->name);
#else
pDevice->apdev = (struct net_device *)kmalloc(sizeof(struct net_device), GFP_KERNEL);
if (pDevice->apdev == NULL)
return -ENOMEM;
......@@ -160,7 +141,6 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
dev->name, pDevice->apdev->name);
KeyvInitTable(&pDevice->sKey, pDevice->PortOffset);
#endif
return 0;
}
......@@ -308,11 +288,7 @@ static int hostap_add_sta(PSDevice pDevice,
WLAN_GET_CAP_INFO_SHORTPREAMBLE(pMgmt->sNodeDBTable[uNodeIndex].wCapInfo);
pMgmt->sNodeDBTable[uNodeIndex].wAID = (WORD)param->u.add_sta.aid;
#ifdef PRIVATE_OBJ
pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer = get_jiffies();
#else
pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer = jiffies;
#endif
DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Add STA AID= %d \n", pMgmt->sNodeDBTable[uNodeIndex].wAID);
DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X \n",
param->sta_addr[0],
......@@ -349,13 +325,8 @@ static int hostap_get_info_sta(PSDevice pDevice,
UINT uNodeIndex;
if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) {
#ifdef PRIVATE_OBJ
param->u.get_info_sta.inactive_sec =
(get_jiffies() - pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer) / HZ;
#else
param->u.get_info_sta.inactive_sec =
(jiffies - pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer) / HZ;
#endif
//param->u.get_info_sta.txexc = pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts;
}
else {
......
......@@ -66,11 +66,7 @@
#ifndef IRQ_RETVAL
typedef void irqreturn_t;
#ifdef PRIVATE_OBJ
#define IRQ_RETVAL(x) (int)x
#else
#define IRQ_RETVAL(x)
#endif
#endif
......
......@@ -212,11 +212,7 @@ UINT uHeaderSize;
}
}
// reserve 4 byte to match MAC RX Buffer
#ifdef PRIVATE_OBJ
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer = (PBYTE) (pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].ref_skb.data + 4);
#else
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer = (PBYTE) (pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].skb->data + 4);
#endif
memcpy(pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer, pMACHeader, cbFrameLength);
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength = cbFrameLength;
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer += cbFrameLength;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment