From owner-freebsd-wireless@FreeBSD.ORG Wed Apr 18 09:37:01 2012 Return-Path: Delivered-To: freebsd-wireless@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2774D106564A for ; Wed, 18 Apr 2012 09:37:01 +0000 (UTC) (envelope-from bschmidt@techwires.net) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 98A2B8FC0A for ; Wed, 18 Apr 2012 09:37:00 +0000 (UTC) Received: by lbbgm6 with SMTP id gm6so1376907lbb.13 for ; Wed, 18 Apr 2012 02:36:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:x-originating-ip:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=zso1LH8SegTHVftCV4c3mnnFsjTOyD1ctO7tSF2fTrc=; b=EklI1ZRTBQcb9Cok7d3H6Kz6B3dfcgFkujqWYwGlz/ht/5P9e2/+hurptS+v0w7vv9 IbUdbaXqZtXEk6ijUtqapjpxEbIBYSOghiIaRG58tL9bnhwZqinkfghJD/2Na6N13SQJ 1SrRU+HHINQKtPEH6PgaYy3sZARHLVk0ct2kb34/jx26AB0M7qLeCaen0g2nJeMSbkTh N2IitYGmPPuunU7UIsYX0s+65PtphW7in21d33sGE9RyZIVjqhh5r6ami6YMgBz58d5S tr+EUByp7j/TAoQURGURgO7iW7c44B0v1k8MOR7YyNZeYDROMXa/b10IEXqN5umjuv2W NVlA== MIME-Version: 1.0 Received: by 10.152.112.100 with SMTP id ip4mr1496439lab.1.1334741818692; Wed, 18 Apr 2012 02:36:58 -0700 (PDT) Sender: bschmidt@techwires.net Received: by 10.152.144.195 with HTTP; Wed, 18 Apr 2012 02:36:58 -0700 (PDT) X-Originating-IP: [79.140.39.245] In-Reply-To: References: Date: Wed, 18 Apr 2012 11:36:58 +0200 X-Google-Sender-Auth: HvlmPvH4T4gveBEe_n9OBk9Ijk8 Message-ID: From: Bernhard Schmidt To: Adrian Chadd Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQkTFktLOfLMZVcYVgrE6z2nGwclBzQO+keT8Q17UMf4v33RPdbKnKUBRxxZLF55gdmGRE17 Cc: freebsd-wireless@freebsd.org Subject: Re: Question: IEEE80211_RATE_BASIC versus IEEE80211_RATE_MCS ? X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Apr 2012 09:37:01 -0000 On Tue, Apr 17, 2012 at 20:12, Adrian Chadd wrote: > Hi, > > So after doing some digging into the rate representation, I've > discovered that both IEEE80211_RATE_BASIC and IEEE80211_RATE_MCS are > represented as the high bit set (ie, 0x80.) > > My query is - how exactly should we be representing rates, and is > there a clear, consistent, non-overlapping use case for where each is > used? > > This shows up in setbasicrates(), where the 11na/11ng modes have the > OFDM/CCK (respectively) rates set as basic, just like for 11a/11bg, > however the high bit is set. ifconfig(8) at least just looks at the tx > rateset list (which setbasicrates is setting up for us) and > mis-interpreting the high bit as MCS, rather than as "basic". > > Any ideas/suggestions? I'd be tempted to create a 'ratecode_t' that is > a uint8_t struct, then finding/fixing all instances where ratecode is > being passed in as a uint8_t, but that may be slightly overkill. In some places the current channel can be abused to determine if it's a MCS or legacy rate, but this is really just an ugly hack. As you've already noted, the basic rate flag isn't handle correctly, neither in status output nor in IEs in the MCS case. Though, I'm not sure we *really* need (BASIC | MCS) right now anywhere, can you think of a place? Hmm, right, ni_txrate might be one of those places. Basically we have 2 arrays ni_rates and ni_htrates, the later implicitly has the MCS flag set, both can set the BASIC flag as required. The tricky part is just to figure out when and where to drop/set the flags as required when assigning from one of the arrays to another variable. I pondered changing "rate" to an uint16_t once and move all flags to the new byte, which would also allow to merge both arrays, but feared the ABI/API breakage.. -- Bernhard