Added multi TX FID support.

This commit is contained in:
mark 2000-05-03 21:55:04 +00:00
parent 172ead397e
commit 7b24c9b69f
2 changed files with 90 additions and 33 deletions

View File

@ -195,6 +195,45 @@ static void prism2sta_inf_psusercnt(
/*================================================================*/
/* Function Definitions */
inline int txfid_stackempty(prism2sta_priv_t *priv)
{
UINT32 flags;
/* paranoid? */
int result;
spin_lock_irqsave(&(priv->txfid_lock),flags);
result = (priv->txfid_top == 0);
spin_unlock_irqrestore(&(priv->txfid_lock), flags);
return priv->txfid_top == 0;
}
inline void txfid_push(prism2sta_priv_t *priv, UINT16 val)
{
UINT32 flags;
spin_lock_irqsave(&(priv->txfid_lock),flags);
if ( priv->txfid_top < PRISM2_FIDSTACKLEN_MAX ) {
priv->txfid_stack[priv->txfid_top] = val;
priv->txfid_top++;
}
spin_unlock_irqrestore(&(priv->txfid_lock), flags);
return;
}
inline UINT16 txfid_pop(prism2sta_priv_t *priv)
{
UINT16 result;
UINT32 flags;
spin_lock_irqsave(&(priv->txfid_lock),flags);
if ( priv->txfid_top > 0 ) {
priv->txfid_top--;
result = priv->txfid_stack[priv->txfid_top];
} else {
result = 0;
}
spin_unlock_irqrestore(&(priv->txfid_lock), flags);
return result;
}
/*----------------------------------------------------------------
* dmpmem
*
@ -391,6 +430,7 @@ int prism2sta_txframe(wlandevice_t *wlandev, wlan_pb_t *pb )
UINT16 proto;
UINT8 dscp;
UINT16 macq = 0;
UINT16 fid;
int result;
DBFENTER;
@ -420,6 +460,9 @@ dmpmem(pb->ethbuf, pb->ethbuflen);
txdesc.data_len += pb->p80211_payloadlen;
txdesc.data_len = host2hfa384x_16(txdesc.data_len);
/* Allocate FID */
fid = txfid_pop(priv);
/* Copy descriptor part to FID */
#if defined(DDESC)
printk(KERN_DEBUG "Desc[0] - [%d]: \n", sizeof(txdesc));
@ -427,13 +470,13 @@ dmpmem(&txdesc, sizeof(txdesc));
#endif
result = hfa384x_copy_to_bap(hw,
hw->bap,
priv->txfid,
fid,
0,
&txdesc,
sizeof(txdesc));
if ( result ) {
WLAN_LOG_DEBUG3(1, "copy_to_bap(%04x, 0, %d) failed, result=0x%x\n",
priv->txfid,
fid,
sizeof(txdesc),
result);
result = 3;
@ -449,14 +492,14 @@ dmpmem(pb->p80211buf + WLAN_HDR_A3_LEN, pb->p80211buflen - WLAN_HDR_A3_LEN);
result = hfa384x_copy_to_bap( hw,
hw->bap,
priv->txfid,
fid,
sizeof(txdesc),
pb->p80211buf + WLAN_HDR_A3_LEN,
pb->p80211buflen - WLAN_HDR_A3_LEN);
if ( result ) {
WLAN_LOG_DEBUG4(1,
"copy_to_bap(%04x, %d, %d) failed, result=0x%x\n",
priv->txfid,
fid,
sizeof(txdesc),
pb->p80211buflen - WLAN_HDR_A3_LEN,
result);
@ -472,7 +515,7 @@ dmpmem(pb->p80211_payload, pb->p80211_payloadlen);
result = hfa384x_copy_to_bap( hw,
hw->bap,
priv->txfid,
fid,
sizeof(txdesc) + pb->p80211buflen - WLAN_HDR_A3_LEN,
pb->p80211_payload,
pb->p80211_payloadlen);
@ -480,7 +523,7 @@ dmpmem(pb->p80211_payload, pb->p80211_payloadlen);
if ( result ) {
WLAN_LOG_DEBUG4(1,
"copy_to_bap(%04x, %d, %d) failed, result=0x%x\n",
priv->txfid,
fid,
sizeof(txdesc) + pb->p80211buflen - WLAN_HDR_A3_LEN,
pb->p80211_payloadlen,
result);
@ -515,15 +558,17 @@ dmpmem(pb->p80211_payload, pb->p80211_payloadlen);
}
/* Issue Tx command */
result = hfa384x_cmd_transmit(hw, HFA384x_TXCMD_RECL, macq, priv->txfid);
result = hfa384x_cmd_transmit(hw, HFA384x_TXCMD_RECL, macq, fid);
if ( result != 0 ) {
WLAN_LOG_DEBUG2(1,"cmd_tx(%04x) failed, result=%d",
priv->txfid, result);
fid, result);
result = 2;
goto failed;
}
result = 1; /* indicate we haven't any buffers, int_alloc will clear */
/* indicate we haven't any buffers, int_alloc will clear */
result = txfid_stackempty(priv) ? 1 : 0;
failed:
p80211pb_free(pb);
@ -693,6 +738,11 @@ int prism2sta_initmac(wlandevice_t *wlandev)
goto failed;
}
/* Initialize FID stack */
spin_lock_init(&(priv->txfid_lock));
priv->txfid_top = 0;
memset(priv->txfid_stack, 0, sizeof(priv->txfid_stack));
/* make sure interrupts are disabled and any layabout events cleared */
wlan_outw_cpu_to_le16(0, HFA384x_INTEN(hw->iobase));
wlan_outw_cpu_to_le16(0xffff, HFA384x_EVACK(hw->iobase));
@ -707,26 +757,29 @@ int prism2sta_initmac(wlandevice_t *wlandev)
/* Allocate tx and notify FIDs */
/* First, tx */
result = hfa384x_cmd_allocate(hw, PRISM2_TXBUF_MAX);
if (result != 0) {
WLAN_LOG_ERROR0("Allocate(tx) command failed.\n");
goto failed;
for ( i = 0; i < PRISM2_FIDSTACKLEN_MAX; i++) {
result = hfa384x_cmd_allocate(hw, PRISM2_TXBUF_MAX);
if (result != 0) {
WLAN_LOG_ERROR0("Allocate(tx) command failed.\n");
goto failed;
}
i = 0;
do {
reg = wlan_inw_le16_to_cpu(HFA384x_EVSTAT(hw->iobase));
udelay(10);
i++;
} while ( !HFA384x_INTEN_ISALLOC(reg) && i < 50); /* 50 is timeout */
if ( i >= 50 ) {
WLAN_LOG_ERROR0("Timed out waiting for evalloc(tx).\n");
result = -ETIMEDOUT;
goto failed;
}
priv->txfid_stack[i] = wlan_inw_le16_to_cpu(HFA384x_ALLOCFID(hw->iobase));
reg = HFA384x_EVACK_ALLOC_SET(1);
wlan_outw_cpu_to_le16( reg, HFA384x_EVACK(hw->iobase));
WLAN_LOG_DEBUG2(1,"priv->txfid_stack[%d]=0x%04x\n",i,priv->txfid_stack[i]);
}
i = 0;
do {
reg = wlan_inw_le16_to_cpu(HFA384x_EVSTAT(hw->iobase));
udelay(10);
i++;
} while ( !HFA384x_INTEN_ISALLOC(reg) && i < 50); /* 50 is timeout */
if ( i >= 50 ) {
WLAN_LOG_ERROR0("Timed out waiting for evalloc(tx).\n");
result = -ETIMEDOUT;
goto failed;
}
priv->txfid = wlan_inw_le16_to_cpu(HFA384x_ALLOCFID(hw->iobase));
reg = HFA384x_EVACK_ALLOC_SET(1);
wlan_outw_cpu_to_le16( reg, HFA384x_EVACK(hw->iobase));
WLAN_LOG_DEBUG1(1,"priv->txfid=0x%04x\n", priv->txfid);
priv->txfid_top = PRISM2_FIDSTACKLEN_MAX;
/* Now, the info frame fid */
result = hfa384x_cmd_allocate(hw, PRISM2_INFOBUF_MAX);
@ -1765,19 +1818,20 @@ failed:
----------------------------------------------------------------*/
void prism2sta_int_alloc(wlandevice_t *wlandev)
{
#if 0
prism2sta_priv_t *priv = wlandev->priv;
hfa384x_t *hw = priv->hw;
#endif
DBFENTER;
/* Handle the reclaimed FID (clear tbusy) */
/* Handle the reclaimed FID */
/* collect the FID and push it onto the stack */
txfid_push(priv, wlan_inw_le16_to_cpu(HFA384x_ALLOCFID(hw->iobase)));
/* clear tbusy (if set) */
wlandev->netdev->tbusy = 0;
mark_bh(NET_BH);
DBFEXIT;
return;
}

View File

@ -63,6 +63,7 @@
#define MAX_GRP_ADDR (32)
#define MAX_PRISM2_GRP_ADDR (16)
#define P2_DSCP_MAX (64)
#define PRISM2_FIDSTACKLEN_MAX (10)
#define MM_SAT_PCF (BIT14)
#define MM_GCSD_PCF (BIT15)
@ -109,7 +110,9 @@ typedef struct prism2sta_priv
UINT npdrec;
/* MAC buffer ids */
UINT16 txfid;
spinlock_t txfid_lock;
UINT txfid_top;
UINT16 txfid_stack[PRISM2_FIDSTACKLEN_MAX];
UINT16 infofid;
/* The following are dot11StationConfigurationTable mibitems