OWNED_BY_NIC = 1
} DEVICE_OWNER_TYPE, *PDEVICE_OWNER_TYPE;
-#define CB_MAX_RX_FRAG 64
-/* DeFragment Control Block, used for collecting fragments prior to reassembly */
-typedef struct tagSDeFragControlBlock {
- unsigned short wSequence;
- unsigned short wFragNum;
- unsigned char abyAddr2[ETH_ALEN];
- unsigned int uLifetime;
- struct sk_buff *skb;
- unsigned char *pbyRxBuffer;
- unsigned int cbFrameLength;
- bool bInUse;
-} SDeFragControlBlock, *PSDeFragControlBlock;
-
/* flags for options */
#define DEVICE_FLAGS_IP_ALIGN 0x00000001UL
#define DEVICE_FLAGS_PREAMBLE_TYPE 0x00000002UL
int nTxDescs[2]; /* Number of TX descriptors 0, 1 */
int int_works; /* interrupt limits */
int rts_thresh; /* rts threshold */
- int frag_thresh;
int data_rate;
int channel_num;
int short_retry;
volatile PSRxDesc aRD1Ring;
volatile PSRxDesc pCurrRD[TYPE_MAXRD];
- SDeFragControlBlock sRxDFCB[CB_MAX_RX_FRAG];
- unsigned int cbDFCB;
- unsigned int cbFreeDFCB;
- unsigned int uCurrentDFCBIdx;
-
OPTIONS sOpts;
u32 flags;
unsigned short wCurrentRate;
unsigned short wRTSThreshold;
- unsigned short wFragmentationThreshold;
unsigned char byShortRetryLimit;
unsigned char byLongRetryLimit;
enum nl80211_iftype op_mode;
{
return kzalloc(sizeof(DEVICE_TD_INFO), GFP_ATOMIC);
}
-
-/*--------------------- Export Functions --------------------------*/
-
-bool device_alloc_frag_buf(struct vnt_private *pDevice,
- PSDeFragControlBlock pDeF);
#endif
* device_intr - interrupt handle function
* device_rx_srv - rx service function
* device_alloc_rx_buf - rx buffer pre-allocated function
- * device_alloc_frag_buf - rx fragement pre-allocated function
* device_free_tx_buf - free tx buffer function
- * device_free_frag_buf- free de-fragement buffer
* device_init_rd0_ring- initial rd dma0 ring
* device_init_rd1_ring- initial rd dma1 ring
* device_init_td0_ring- initial tx dma0 ring buffer
* device_init_td1_ring- initial tx dma1 ring buffer
* device_init_registers- initial MAC & BBP & RF internal registers.
* device_init_rings- initial tx/rx ring buffer
- * device_init_defrag_cb- initial & allocate de-fragement buffer.
* device_free_rings- free all allocated ring buffer
* device_tx_srv- tx interrupt service function
*
DEVICE_PARAM(RTSThreshold, "RTS threshold");
-#define FRAG_THRESH_MIN 256
-#define FRAG_THRESH_MAX 2346
#define FRAG_THRESH_DEF 2346
-DEVICE_PARAM(FragThreshold, "Fragmentation threshold");
-
#define DATA_RATE_MIN 0
#define DATA_RATE_MAX 13
#define DATA_RATE_DEF 13
static void device_init_rd0_ring(struct vnt_private *pDevice);
static void device_init_rd1_ring(struct vnt_private *pDevice);
-static void device_init_defrag_cb(struct vnt_private *pDevice);
static void device_init_td0_ring(struct vnt_private *pDevice);
static void device_init_td1_ring(struct vnt_private *pDevice);
static void device_free_rd0_ring(struct vnt_private *pDevice);
static void device_free_rd1_ring(struct vnt_private *pDevice);
static void device_free_rings(struct vnt_private *pDevice);
-static void device_free_frag_buf(struct vnt_private *pDevice);
/*--------------------- Export Variables --------------------------*/
pOpts->flags |= DEVICE_FLAGS_IP_ALIGN;
pOpts->int_works = INT_WORKS_DEF;
pOpts->rts_thresh = RTS_THRESH_DEF;
- pOpts->frag_thresh = FRAG_THRESH_DEF;
pOpts->data_rate = DATA_RATE_DEF;
pOpts->channel_num = CHANNEL_DEF;
pDevice->uChannel = pDevice->sOpts.channel_num;
pDevice->wRTSThreshold = pDevice->sOpts.rts_thresh;
- pDevice->wFragmentationThreshold = pDevice->sOpts.frag_thresh;
pDevice->byShortRetryLimit = pDevice->sOpts.short_retry;
pDevice->byLongRetryLimit = pDevice->sOpts.long_retry;
pDevice->wMaxTransmitMSDULifetime = DEFAULT_MSDU_LIFETIME;
pDevice->pCurrRD[1] = &(pDevice->aRD1Ring[0]);
}
-static void device_init_defrag_cb(struct vnt_private *pDevice)
-{
- int i;
- PSDeFragControlBlock pDeF;
-
- /* Init the fragment ctl entries */
- for (i = 0; i < CB_MAX_RX_FRAG; i++) {
- pDeF = &(pDevice->sRxDFCB[i]);
- if (!device_alloc_frag_buf(pDevice, pDeF))
- dev_err(&pDevice->pcid->dev, "can not alloc frag bufs\n");
- }
- pDevice->cbDFCB = CB_MAX_RX_FRAG;
- pDevice->cbFreeDFCB = pDevice->cbDFCB;
-}
-
static void device_free_rd0_ring(struct vnt_private *pDevice)
{
int i;
}
}
-static void device_free_frag_buf(struct vnt_private *pDevice)
-{
- PSDeFragControlBlock pDeF;
- int i;
-
- for (i = 0; i < CB_MAX_RX_FRAG; i++) {
- pDeF = &(pDevice->sRxDFCB[i]);
-
- if (pDeF->skb)
- dev_kfree_skb(pDeF->skb);
-
- }
-}
-
static void device_init_td0_ring(struct vnt_private *pDevice)
{
int i;
return true;
}
-bool device_alloc_frag_buf(struct vnt_private *pDevice,
- PSDeFragControlBlock pDeF)
-{
- pDeF->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
- if (pDeF->skb == NULL)
- return false;
- ASSERT(pDeF->skb);
-
- return true;
-}
-
static const u8 fallback_rate0[5][5] = {
{RATE_18M, RATE_18M, RATE_12M, RATE_12M, RATE_12M},
{RATE_24M, RATE_24M, RATE_18M, RATE_12M, RATE_12M},
dev_dbg(&priv->pcid->dev, "call device init rd0 ring\n");
device_init_rd0_ring(priv);
device_init_rd1_ring(priv);
- device_init_defrag_cb(priv);
device_init_td0_ring(priv);
device_init_td1_ring(priv);
device_free_td1_ring(priv);
device_free_rd0_ring(priv);
device_free_rd1_ring(priv);
- device_free_frag_buf(priv);
device_free_rings(priv);
free_irq(priv->pcid->irq, priv);