Commit 4bd43f50 authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by Greg Kroah-Hartman

Staging: add otus Atheros wireless network driver

Initial dump of the otus USB wireless network driver.
It builds properly, but a lot of work needs to be done cleaning
it up before it can be merged into the wireless driver tree.
Signed-off-by: default avatarLuis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent e543c241
...@@ -65,5 +65,7 @@ source "drivers/staging/poch/Kconfig" ...@@ -65,5 +65,7 @@ source "drivers/staging/poch/Kconfig"
source "drivers/staging/agnx/Kconfig" source "drivers/staging/agnx/Kconfig"
source "drivers/staging/otus/Kconfig"
endif # !STAGING_EXCLUDE_BUILD endif # !STAGING_EXCLUDE_BUILD
endif # STAGING endif # STAGING
...@@ -15,3 +15,4 @@ obj-$(CONFIG_ECHO) += echo/ ...@@ -15,3 +15,4 @@ obj-$(CONFIG_ECHO) += echo/
obj-$(CONFIG_USB_ATMEL) += at76_usb/ obj-$(CONFIG_USB_ATMEL) += at76_usb/
obj-$(CONFIG_POCH) += poch/ obj-$(CONFIG_POCH) += poch/
obj-$(CONFIG_AGNX) += agnx/ obj-$(CONFIG_AGNX) += agnx/
obj-$(CONFIG_OTUS) += otus/
/*
* Copyright (c) 2007-2008 Atheros Communications Inc.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "cprecomp.h"
/************************************************************************/
/* */
/* FUNCTION DESCRIPTION zfGetAmsduSubFrame */
/* Get a subframe from a-MSDU. */
/* */
/* INPUTS */
/* dev : device pointer */
/* buf : A-MSDU frame buffer */
/* offset : offset of subframe in the A-MSDU */
/* */
/* OUTPUTS */
/* NULL or subframe */
/* */
/* AUTHOR */
/* Stephen Chen Atheros Communications, INC. 2007.2 */
/* */
/************************************************************************/
zbuf_t* zfGetAmsduSubFrame(zdev_t* dev, zbuf_t* buf, u16_t* offset)
{
u16_t subframeLen;
u16_t amsduLen = zfwBufGetSize(dev, buf);
zbuf_t* newBuf;
ZM_PERFORMANCE_RX_AMSDU(dev, buf, amsduLen);
/* Verify A-MSDU length */
if (amsduLen < (*offset + 14))
{
return NULL;
}
/* Locate A-MSDU subframe by offset and verify subframe length */
subframeLen = (zmw_buf_readb(dev, buf, *offset + 12) << 8) +
zmw_buf_readb(dev, buf, *offset + 13);
if (subframeLen == 0)
{
return NULL;
}
/* Verify A-MSDU subframe length */
if ((*offset+14+subframeLen) <= amsduLen)
{
/* Allocate a new buffer */
if ((newBuf = zfwBufAllocate(dev, 24+2+subframeLen)) != NULL)
{
#ifdef ZM_ENABLE_NATIVE_WIFI
/* Copy and convert subframe to wlan frame format */
/* SHALL NOT INCLUDE QOS and AMSDU header. Ray 20070807 For Vista */
zfRxBufferCopy(dev, newBuf, buf, 0, 0, 24);
zfRxBufferCopy(dev, newBuf, buf, 24, *offset+14, subframeLen);
zfwBufSetSize(dev, newBuf, 24+subframeLen);
#else
/* Copy subframe to new buffer */
zfRxBufferCopy(dev, newBuf, buf, 0, *offset, 14+subframeLen);
zfwBufSetSize(dev, newBuf, 14+subframeLen);
#endif
/* Update offset */
*offset += (((14+subframeLen)+3) & 0xfffc);
/* Return buffer pointer */
return newBuf;
}
}
return NULL;
}
/************************************************************************/
/* */
/* FUNCTION DESCRIPTION zfDeAmsdu */
/* De-AMSDU. */
/* */
/* INPUTS */
/* dev : device pointer */
/* buf : A-MSDU frame buffer */
/* vap : VAP port */
/* */
/* OUTPUTS */
/* None */
/* */
/* AUTHOR */
/* Stephen Chen Atheros Communications, INC. 2007.2 */
/* */
/************************************************************************/
void zfDeAmsdu(zdev_t* dev, zbuf_t* buf, u16_t vap, u8_t encryMode)
{
u16_t offset = ZM_SIZE_OF_WLAN_DATA_HEADER+ZM_SIZE_OF_QOS_CTRL;
zbuf_t* subframeBuf;
zmw_get_wlan_dev(dev);
ZM_BUFFER_TRACE(dev, buf)
if (encryMode == ZM_AES || encryMode == ZM_TKIP)
{
offset += (ZM_SIZE_OF_IV + ZM_SIZE_OF_EXT_IV);
}
else if (encryMode == ZM_WEP64 || encryMode == ZM_WEP128)
{
offset += ZM_SIZE_OF_IV;
}
/* Repeatly calling zfGetAmsduSubFrame() until NULL returned */
while ((subframeBuf = zfGetAmsduSubFrame(dev, buf, &offset)) != NULL)
{
wd->commTally.NotifyNDISRxFrmCnt++;
if (wd->zfcbRecvEth != NULL)
{
wd->zfcbRecvEth(dev, subframeBuf, (u8_t)vap);
ZM_PERFORMANCE_RX_MSDU(dev, wd->tick);
}
}
zfwBufFree(dev, buf, 0);
return;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* Copyright (c) 2007-2008 Atheros Communications Inc.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* */
/* Module Name : hb.c */
/* */
/* Abstract */
/* This module contains house keeping and timer functions. */
/* */
/* NOTES */
/* None */
/* */
/************************************************************************/
#include "cprecomp.h"
/* Called by wrapper every 10 msec */
void zfiHeartBeat(zdev_t* dev)
{
zmw_get_wlan_dev(dev);
wd->tick++;
#if 0
/* => every 1.28 seconds */
if (wd->cwm.cw_enable && ((wd->tick & 0x7f) == 0x3f))
{
zfHpCwmUpdate(dev);
}
#endif
/* => every 2.56 seconds */
if ((wd->tick & 0xff) == 0)
{
zfAgingDefragList(dev, 1);
}
/* Watch Dog */
//zfWatchDog();
/* LED Control (per 100ms) */
if ((wd->tick % 10) == 9)
{
zfLed100msCtrl(dev);
#ifdef ZM_ENABLE_BA_RATECTRL
if (!wd->modeMDKEnable)
{
zfiDbgReadTally(dev);
}
#endif
}
#ifdef ZM_ENABLE_REWRITE_BEACON_START_ADDRESS
if ( wd->wlanMode == ZM_MODE_IBSS )
{
if ( zfStaIsConnected(dev) )
{
zfReWriteBeaconStartAddress(dev);
}
}
#endif
if ( wd->wlanMode == ZM_MODE_IBSS )
{
if ( zfStaIsConnected(dev) )
{
wd->tickIbssReceiveBeacon++; // add 10ms
if ( (wd->sta.ibssSiteSurveyStatus == 2) &&
(wd->tickIbssReceiveBeacon == 300) &&
(wd->sta.ibssReceiveBeaconCount < 3) )
{
zm_debug_msg0("It is happen!!! No error message");
zfReSetCurrentFrequency(dev);
}
}
}
if(wd->sta.ReceivedPacketRateCounter <= 0)
{
wd->sta.ReceivedPktRatePerSecond = wd->sta.TotalNumberOfReceivePackets;
//zm_debug_msg1("Receive Packet Per Second = ", wd->sta.ReceivedPktRatePerSecond);
if (wd->sta.TotalNumberOfReceivePackets != 0)
{
wd->sta.avgSizeOfReceivePackets = wd->sta.TotalNumberOfReceiveBytes/wd->sta.TotalNumberOfReceivePackets;
}
else
{
wd->sta.avgSizeOfReceivePackets = 640;
}
wd->sta.TotalNumberOfReceivePackets = 0;
wd->sta.TotalNumberOfReceiveBytes = 0;
wd->sta.ReceivedPacketRateCounter = 100; /*for another 1s*/
}
else
{
wd->sta.ReceivedPacketRateCounter--;
}
/* => every 1.28 seconds */
if((wd->tick & 0x7f) == 0x3f)
{
if( wd->sta.NonNAPcount > 0)
{
wd->sta.RTSInAGGMode = TRUE;
wd->sta.NonNAPcount = 0;
}
else
{
wd->sta.RTSInAGGMode = FALSE;
}
}
/* Maintain management time tick */
zfMmApTimeTick(dev);
zfMmStaTimeTick(dev);
//zfPhyCrTuning(dev);
//zfTxPowerControl(dev);
zfHpHeartBeat(dev);
}
void zfDumpBssList(zdev_t* dev)
{
struct zsBssInfo* pBssInfo;
u8_t str[33];
u8_t i, j;
u32_t addr1, addr2;
zmw_get_wlan_dev(dev);
zmw_declare_for_critical_section();
zm_debug_msg0("***** Bss scan result *****");
zmw_enter_critical_section(dev);
pBssInfo = wd->sta.bssList.head;
for( i=0; i<wd->sta.bssList.bssCount; i++ )
{
if ( i )
{
zm_debug_msg0("---------------------------");
}
zm_debug_msg1("BSS #", i);
for(j=0; j<pBssInfo->ssid[1]; j++)
{
str[j] = pBssInfo->ssid[2+j];
}
str[pBssInfo->ssid[1]] = 0;
zm_debug_msg0("SSID = ");
zm_debug_msg0(str);
addr1 = (pBssInfo->bssid[0] << 16) + (pBssInfo->bssid[1] << 8 )
+ pBssInfo->bssid[2];
addr2 = (pBssInfo->bssid[3] << 16) + (pBssInfo->bssid[4] << 8 )
+ pBssInfo->bssid[5];
zm_debug_msg2("Bssid = ", addr1);
zm_debug_msg2(" ", addr2);
zm_debug_msg1("frequency = ", pBssInfo->frequency);
zm_debug_msg1("security type = ", pBssInfo->securityType);
zm_debug_msg1("WME = ", pBssInfo->wmeSupport);
zm_debug_msg1("beacon interval = ", pBssInfo->beaconInterval[0]
+ (pBssInfo->beaconInterval[1] << 8));
zm_debug_msg1("capability = ", pBssInfo->capability[0]
+ (pBssInfo->capability[1] << 8));
if ( pBssInfo->supportedRates[1] > 0 )
{
for( j=0; j<pBssInfo->supportedRates[1]; j++ )
{
zm_debug_msg2("supported rates = ", pBssInfo->supportedRates[2+j]);
}
}
for( j=0; j<pBssInfo->extSupportedRates[1]; j++ )
{
zm_debug_msg2("ext supported rates = ", pBssInfo->extSupportedRates[2+j]);
}
pBssInfo = pBssInfo->next;
}
zmw_leave_critical_section(dev);
zm_debug_msg0("***************************");
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* Copyright (c) 2007-2008 Atheros Communications Inc.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _CPRECOMP_H
#define _CPRECOMP_H
#include "../oal_dt.h"
#include "../oal_marc.h"
#include "pub_zfi.h"
#include "pub_zfw.h"
#include "pub_usb.h"
#include "wlan.h"
#include "struct.h"
#include "cfunc.h"
#include "cagg.h"
#include "cwm.h"
#include "performance.h"
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* Copyright (c) 2007-2008 Atheros Communications Inc.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* */
/* Module Name : cwm.c */
/* */
/* Abstract */
/* This module contains channel width related functions. */
/* */
/* NOTES */
/* None */
/* */
/************************************************************************/
#include "cprecomp.h"
void zfCwmInit(zdev_t* dev) {
//u16_t i;
zmw_get_wlan_dev(dev);
switch (wd->wlanMode) {
case ZM_MODE_AP:
wd->cwm.cw_mode = CWM_MODE2040;
wd->cwm.cw_width = CWM_WIDTH40;
wd->cwm.cw_enable = 1;
break;
case ZM_MODE_INFRASTRUCTURE:
case ZM_MODE_PSEUDO:
case ZM_MODE_IBSS:
default:
wd->cwm.cw_mode = CWM_MODE2040;
wd->cwm.cw_width = CWM_WIDTH20;
wd->cwm.cw_enable = 1;
break;
}
}
void zfCoreCwmBusy(zdev_t* dev, u16_t busy)
{
zmw_get_wlan_dev(dev);
zm_msg1_mm(ZM_LV_0, "CwmBusy=", busy);
if(wd->cwm.cw_mode == CWM_MODE20) {
wd->cwm.cw_width = CWM_WIDTH20;
return;
}
if(wd->cwm.cw_mode == CWM_MODE40) {
wd->cwm.cw_width = CWM_WIDTH40;
return;
}
if (busy) {
wd->cwm.cw_width = CWM_WIDTH20;
return;
}
if((wd->wlanMode == ZM_MODE_INFRASTRUCTURE || wd->wlanMode == ZM_MODE_PSEUDO ||
wd->wlanMode == ZM_MODE_IBSS)) {
if (wd->sta.ie.HtCap.HtCapInfo && HTCAP_SupChannelWidthSet != 0 &&
wd->sta.ie.HtInfo.ChannelInfo && ExtHtCap_RecomTxWidthSet != 0 &&
(wd->sta.ie.HtInfo.ChannelInfo && ExtHtCap_ExtChannelOffsetAbove) == 1) {
wd->cwm.cw_width = CWM_WIDTH40;
}
else {
wd->cwm.cw_width = CWM_WIDTH20;
}
return;
}
if(wd->wlanMode == ZM_MODE_AP) {
wd->cwm.cw_width = CWM_WIDTH40;
}
}
u16_t zfCwmIsExtChanBusy(u32_t ctlBusy, u32_t extBusy)
{
u32_t busy; /* percentage */
u32_t cycleTime, ctlClear;
cycleTime = 1280000; //1.28 seconds
if (cycleTime > ctlBusy) {
ctlClear = cycleTime - ctlBusy;
}
else
{
ctlClear = 0;
}
/* Compute ratio of extension channel busy to control channel clear
* as an approximation to extension channel cleanliness.
*
* According to the hardware folks, ext rxclear is undefined
* if the ctrl rxclear is de-asserted (i.e. busy)
*/
if (ctlClear) {
busy = (extBusy * 100) / ctlClear;
} else {
busy = 0;
}
if (busy > ATH_CWM_EXTCH_BUSY_THRESHOLD) {
return TRUE;
}
return FALSE;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
TODO:
- checkpatch.pl cleanups
- sparse cleanups
- port to in-kernel 80211 stack
- proper network developer maintainer
Please send any patches to Greg Kroah-Hartman <greg@kroah.com> and
Luis Rodriguez <Luis.Rodriguez@Atheros.com> and the
otus-devel@lists.madwifi-project.org mailing list.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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