Added frame type counters and zero length fix.

This commit is contained in:
mark 2000-05-11 21:37:24 +00:00
parent 1d032de10e
commit 5fc6ae5fc6
2 changed files with 222 additions and 5 deletions

View File

@ -69,6 +69,43 @@
/* struct device from linux/netdevice.h */
typedef struct device netdevice_t;
/* Received frame statistics */
typedef struct p80211_frmrx_t
{
UINT32 mgmt;
UINT32 assocreq;
UINT32 assocresp;
UINT32 reassocreq;
UINT32 reassocresp;
UINT32 probereq;
UINT32 proberesp;
UINT32 beacon;
UINT32 atim;
UINT32 disassoc;
UINT32 authen;
UINT32 deauthen;
UINT32 mgmt_unknown;
UINT32 ctl;
UINT32 pspoll;
UINT32 rts;
UINT32 cts;
UINT32 ack;
UINT32 cfend;
UINT32 cfendcfack;
UINT32 ctl_unknown;
UINT32 data;
UINT32 dataonly;
UINT32 data_cfack;
UINT32 data_cfpoll;
UINT32 data__cfack_cfpoll;
UINT32 null;
UINT32 cfack;
UINT32 cfpoll;
UINT32 cfack_cfpoll;
UINT32 data_unknown;
} p80211_frmrx_t;
/* WLAN device type */
typedef struct wlandevice
{
@ -111,6 +148,10 @@ typedef struct wlandevice
void *priv; /* private data for MSD */
struct wlandevice *next; /* link for list of devices */
/* 802.11 device statistics */
struct p80211_frmrx_t rx;
} wlandevice_t;

View File

@ -173,6 +173,7 @@ static void prism2sta_int_info(wlandevice_t *wlandev);
static void prism2sta_int_txexc(wlandevice_t *wlandev);
static void prism2sta_int_tx(wlandevice_t *wlandev);
static void prism2sta_int_rx(wlandevice_t *wlandev);
static int prism2sta_int_rx_typedrop( wlandevice_t *wlandev, UINT16 fc);
static void prism2sta_int_alloc(wlandevice_t *wlandev);
static void prism2sta_inf_handover(
@ -1757,15 +1758,19 @@ printk("\n");
HFA384x_RX_80211HDR_OFF,
WLAN_HDR_A3_LEN,
result);
p80211pb_free(pb);
goto failed;
goto failed_cleanup;
}
if (!prism2sta_int_rx_typedrop(wlandev, ieee2host16(pb->p80211_hdr->a3.fc))) {
WLAN_LOG_WARNING0("Unhandled frame type, dropped.\n");
goto failed_cleanup;
}
/* If exclude and we receive an unencrypted, drop it */
if ( priv->exclude_unencrypt &&
!WLAN_GET_FC_ISWEP(ieee2host16(pb->p80211_hdr->a3.fc))) {
p80211pb_free(pb);
goto failed;
goto failed_cleanup;
}
/* Copy the payload data to the buffer */
@ -1781,7 +1786,7 @@ printk("\n");
rxdesc.data_len,
result);
p80211pb_free(pb);
goto failed;
goto failed_cleanup;
}
}
/* Set the length */
@ -1794,13 +1799,184 @@ printk("\n");
HFA384x_RXSTATUS_MACPORT_GET(rxdesc.status) );
break;
}
goto done;
failed_cleanup:
p80211pb_free(pb);
failed:
done:
DBFEXIT;
return;
}
/*----------------------------------------------------------------
* prism2sta_int_rc_typedrop
*
* Classifies the frame, increments the appropriate counter, and
* returns 0|1 indicating whether the driver should handle or
* drop the frame
*
* Arguments:
* wlandev wlan device structure
* fc frame control field
*
* Returns:
* zero if the frame should be handled by the driver,
* non-zero otherwise.
*
* Side effects:
*
* Call context:
* interrupt
----------------------------------------------------------------*/
int prism2sta_int_rx_typedrop( wlandevice_t *wlandev, UINT16 fc)
{
UINT16 ftype;
UINT16 fstype;
int drop = 0;
/* Classify frame, increment counter */
ftype = WLAN_GET_FC_FTYPE(fc);
fstype = WLAN_GET_FC_FSTYPE(fc);
switch ( ftype ) {
case WLAN_FTYPE_MGMT:
WLAN_LOG_WARNING0("prism2sta_int_rx(): rx'd mgmt:");
wlandev->rx.mgmt++;
switch( fstype ) {
case WLAN_FSTYPE_ASSOCREQ:
printk("assocreq");
wlandev->rx.assocreq++;
break;
case WLAN_FSTYPE_ASSOCRESP:
printk("assocresp");
wlandev->rx.assocresp++;
break;
case WLAN_FSTYPE_REASSOCREQ:
printk("reassocreq");
wlandev->rx.reassocreq++;
break;
case WLAN_FSTYPE_REASSOCRESP:
printk("reassocresp");
wlandev->rx.reassocresp++;
break;
case WLAN_FSTYPE_PROBEREQ:
printk("probereq");
wlandev->rx.probereq++;
break;
case WLAN_FSTYPE_PROBERESP:
printk("proberesp");
wlandev->rx.proberesp++;
break;
case WLAN_FSTYPE_BEACON:
printk("beacon");
wlandev->rx.beacon++;
break;
case WLAN_FSTYPE_ATIM:
printk("atim");
wlandev->rx.atim++;
break;
case WLAN_FSTYPE_DISASSOC:
printk("disassoc");
wlandev->rx.disassoc++;
break;
case WLAN_FSTYPE_AUTHEN:
printk("authen");
wlandev->rx.authen++;
break;
case WLAN_FSTYPE_DEAUTHEN:
printk("deauthen");
wlandev->rx.deauthen++;
break;
default:
printk("unknown");
wlandev->rx.mgmt_unknown++;
break;
}
printk("\n");
drop = 1;
break;
case WLAN_FTYPE_CTL:
WLAN_LOG_WARNING0("prism2sta_int_rx(): rx'd ctl:");
wlandev->rx.ctl++;
switch( fstype ) {
case WLAN_FSTYPE_PSPOLL:
printk("pspoll");
wlandev->rx.pspoll++;
break;
case WLAN_FSTYPE_RTS:
printk("rts");
wlandev->rx.rts++;
break;
case WLAN_FSTYPE_CTS:
printk("cts");
wlandev->rx.cts++;
break;
case WLAN_FSTYPE_ACK:
printk("ack");
wlandev->rx.ack++;
break;
case WLAN_FSTYPE_CFEND:
printk("cfend");
wlandev->rx.cfend++;
break;
case WLAN_FSTYPE_CFENDCFACK:
printk("cfendcfack");
wlandev->rx.cfendcfack++;
break;
default:
printk("unknown");
wlandev->rx.ctl_unknown++;
break;
}
printk("\n");
drop = 1;
break;
case WLAN_FTYPE_DATA:
wlandev->rx.data++;
switch( fstype ) {
case WLAN_FSTYPE_DATAONLY:
wlandev->rx.dataonly++;
break;
case WLAN_FSTYPE_DATA_CFACK:
wlandev->rx.data_cfack++;
break;
case WLAN_FSTYPE_DATA_CFPOLL:
wlandev->rx.data_cfpoll++;
break;
case WLAN_FSTYPE_DATA_CFACK_CFPOLL:
wlandev->rx.data__cfack_cfpoll++;
break;
case WLAN_FSTYPE_NULL:
WLAN_LOG_WARNING0("prism2sta_int_rx(): rx'd data:null\n");
wlandev->rx.null++;
break;
case WLAN_FSTYPE_CFACK:
WLAN_LOG_WARNING0("prism2sta_int_rx(): rx'd data:cfack\n");
wlandev->rx.cfack++;
break;
case WLAN_FSTYPE_CFPOLL:
WLAN_LOG_WARNING0("prism2sta_int_rx(): rx'd data:cfpoll\n");
wlandev->rx.cfpoll++;
break;
case WLAN_FSTYPE_CFACK_CFPOLL:
WLAN_LOG_WARNING0("prism2sta_int_rx(): rx'd data:cfack_cfpoll\n");
wlandev->rx.cfack_cfpoll++;
break;
default:
printk("unknown");
wlandev->rx.data_unknown++;
break;
}
break;
}
return drop;
}
/*----------------------------------------------------------------
* prism2sta_int_alloc
*