Replace d_plcp_svc with d_residue. The latter is the number of whole

empty/unused octets to fill out the data time slot.  The value is constrained
by math to 0 for <= 5.5Mb, 0-1 for 11Mb, and 0-2 for 22Mb.  It is used to
signal to the MAC that there is residue.
This commit is contained in:
mycroft 2004-12-27 01:51:49 +00:00
parent c0abe52657
commit 06e4fe7f62
4 changed files with 17 additions and 27 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: atw.c,v 1.80 2004/10/30 18:08:36 thorpej Exp $ */
/* $NetBSD: atw.c,v 1.81 2004/12/27 01:51:49 mycroft Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.80 2004/10/30 18:08:36 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.81 2004/12/27 01:51:49 mycroft Exp $");
#include "bpfilter.h"
@ -3539,7 +3539,7 @@ atw_start(struct ifnet *ifp)
* probably strip FCS just in case it sticks around in
* bridged packets.
*/
hh->atw_service = IEEE80211_PLCP_SERVICE; /* XXX guess */
hh->atw_service = 0x00; /* XXX guess */
hh->atw_paylen = htole16(m0->m_pkthdr.len -
sizeof(struct atw_frame));

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtw.c,v 1.24 2004/12/26 22:59:41 dyoung Exp $ */
/* $NetBSD: rtw.c,v 1.25 2004/12/27 01:51:49 mycroft Exp $ */
/*-
* Copyright (c) 2004, 2005 David Young. All rights reserved.
*
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.24 2004/12/26 22:59:41 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.25 2004/12/27 01:51:49 mycroft Exp $");
#include "bpfilter.h"
@ -2740,7 +2740,7 @@ rtw_start(struct ifnet *ifp)
ctl1 = LSHIFT(d0->d_plcp_len, RTW_TXCTL1_LENGTH_MASK) |
LSHIFT(d0->d_rts_dur, RTW_TXCTL1_RTSDUR_MASK);
if ((d0->d_plcp_svc & IEEE80211_PLCP_SERVICE_LENEXT) != 0)
if (d0->d_residue)
ctl1 |= RTW_TXCTL1_LENGEXT;
/* TBD fragmentation */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211.h,v 1.9 2004/12/23 05:25:41 dyoung Exp $ */
/* $NetBSD: ieee80211.h,v 1.10 2004/12/27 01:51:49 mycroft Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2004 Sam Leffler, Errno Consulting
@ -53,9 +53,6 @@ struct ieee80211_plcp_hdr {
} __attribute__((__packed__));
#define IEEE80211_PLCP_SFD 0xF3A0
#define IEEE80211_PLCP_SERVICE 0x00
#define IEEE80211_PLCP_SERVICE_PBCC 0x08 /* PBCC encoded */
#define IEEE80211_PLCP_SERVICE_LENEXT 0x80 /* length extension bit */
/*
* generic definitions for IEEE 802.11 frames
@ -614,7 +611,7 @@ struct ieee80211_duration {
uint16_t d_rts_dur;
uint16_t d_data_dur;
uint16_t d_plcp_len;
uint8_t d_plcp_svc;
uint8_t d_residue; /* unused octets in time slot */
};
/* One Time Unit (TU) is 1Kus = 1024 microseconds. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211_output.c,v 1.19 2004/12/23 06:08:52 dyoung Exp $ */
/* $NetBSD: ieee80211_output.c,v 1.20 2004/12/27 01:51:49 mycroft Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
@ -35,7 +35,7 @@
#ifdef __FreeBSD__
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_output.c,v 1.10 2004/04/02 23:25:39 sam Exp $");
#else
__KERNEL_RCSID(0, "$NetBSD: ieee80211_output.c,v 1.19 2004/12/23 06:08:52 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: ieee80211_output.c,v 1.20 2004/12/27 01:51:49 mycroft Exp $");
#endif
#include "opt_inet.h"
@ -308,31 +308,24 @@ ieee80211_compute_duration1(int len, uint32_t flags, int rate,
/* RTS is always sent at 1 Mb/s. (XXX Really?) */
d->d_rts_plcp_len = sizeof(struct ieee80211_frame_rts) * 8;
#endif
d->d_plcp_svc = 0;
d->d_residue = 0;
data_dur = (bitlen * 2) / rate;
switch (rate) {
case 2: /* 1 Mb/s */
case 4: /* 2 Mb/s */
data_dur = (bitlen * 2) / rate;
/* 1 - 2 Mb/s WLAN: send ACK/CTS at 1 Mb/s */
cts = IEEE80211_DUR_DS_SLOW_CTS;
ack = IEEE80211_DUR_DS_SLOW_ACK;
break;
case 44: /* 22 Mb/s */
d->d_plcp_svc = IEEE80211_PLCP_SERVICE_PBCC;
/*FALLTHROUGH*/
case 11: /* 5.5 Mb/s */
case 22: /* 11 Mb/s */
case 44: /* 22 Mb/s */
remainder = (bitlen * 2) % rate;
if (remainder != 0)
data_dur = (bitlen * 2) / rate + 1;
else
data_dur = (bitlen * 2) / rate;
if (rate == 22 && remainder <= 6)
d->d_plcp_svc |= IEEE80211_PLCP_SERVICE_LENEXT;
if (remainder != 0) {
data_dur++;
d->d_residue = (rate - remainder) / 16;
}
/* 5.5 - 11 Mb/s WLAN: send ACK/CTS at 2 Mb/s */
cts = IEEE80211_DUR_DS_FAST_CTS;