/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2008 Atheros Communications Inc.
*
* 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 <inet/wifi_ioctl.h>
#include "arn_core.h"
/*
* Associates the beacon frame buffer with a transmit descriptor. Will set
* up all required antenna switch parameters, rate codes, and channel flags.
* Beacons are always sent out at the lowest rate, and are not retried.
*/
#ifdef ARN_IBSS
static void
{
/* LINTED E_FUNC_SET_NOT_USED */
int ctsrate = 0;
int ctsduration = 0;
/* set up descriptors */
/*
* Let hardware handle antenna switching.
*/
antenna = 0;
} else {
/*
* Switch antenna every 4 beacons.
* NB: assumes two antenna
*/
}
/*
* Calculate rate code.
* XXX everything at min xmit rate
*/
rix = 0;
ATH9K_PKT_TYPE_BEACON, /* Atheros packet type */
MAX_RATE_POWER, /* FIXME */
ATH9K_TXKEYIX_INVALID, /* no encryption */
ATH9K_KEY_TYPE_CLEAR, /* no encryption */
flags); /* no ack, veol for beacons */
/* NB: beacon's BufLen must be a multiple of 4 bytes */
B_TRUE, /* first segment */
B_TRUE, /* last segment */
ds); /* first descriptor */
}
#endif
/*
* Startup beacon transmission for adhoc mode when they are sent entirely
* by the hardware using the self-linked descriptor + veol trick.
*/
#ifdef ARN_IBSS
static void
{
/* Construct tx descriptor. */
/*
* Stop any current dma and put the new frame on the queue.
* This should never fail since we check above that no frames
* are still pending on the queue.
*/
arn_problem("ath: beacon queue %d did not stop?\n",
sc->sc_beaconq);
}
/* NB: caller is known to have already stopped tx dma */
}
#endif /* ARN_IBSS */
{
/* NB: don't enable any interrupts */
}
int
{
arn_problem("arn: arn_beacon_alloc():"
"no dma buffers");
return (ENOMEM);
}
arn_problem("ath: arn_beacon_alloc():"
"cannot get mbuf\n");
return (ENOMEM);
}
return (0);
}
void
{
}
}
}
}
void
{
/* New added */
/* XXX fix me */
/*
* Setup dtim and cfp parameters according to
* last beacon we received (which may be none).
*/
if (dtimperiod <= 0) /* NB: 0 if not known */
dtimperiod = 1;
dtimcount = 0;
cfpcount = 0;
if (sleepduration <= 0)
/*
* Pull nexttbtt forward to reflect the current
* TSF and calculate dtim+cfp state for the result.
*/
do {
if (--dtimcount < 0) {
if (--cfpcount < 0)
}
bs.bs_cfpmaxduration = 0;
/*
* Calculate the number of consecutive beacons to miss* before taking
* a BMISS interrupt. The configuration is specified in TU so we only
* need calculate based on the beacon interval. Note that we clamp the
* result to at most 15 beacons.
*/
if (sleepduration > intval) {
} else {
else if (bs.bs_bmissthreshold == 0)
}
/*
* Calculate sleep duration. The configuration is given in ms.
* We ensure a multiple of the beacon period is used. Also, if the sleep
* duration is greater than the DTIM period then it makes senses
* to make it a multiple of that.
*
* XXX fixed at 100ms
*/
/* TSF out of range threshold fixed at 1 second */
"tsf %llu "
"tsf:tu %u "
"intval %u "
"nexttbtt %u "
"dtim %u "
"nextdtim %u "
"bmiss %u "
"sleep %u "
"cfp:period %u "
"maxdur %u "
"next %u "
"timoffset %u\n",
bs.bs_timoffset));
/* Set the computed STA beacon timers */
}
void
{
/*
* Resync beacon timers using the tsf of the
* beacon frame we just received.
*/
}
void
{
return;
}
" tsf %llu, lastrx %llu (%lld), bmiss %u\n",
ARN_UNLOCK(sc);
/* temp workaround */
}