linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Philip Prindeville <philipp_subx@redfish-solutions.com>
Cc: Jouni Malinen <jouni.malinen@atheros.com>,
	"John W. Linville" <linville@tuxdriver.com>,
	linux-wireless@vger.kernel.org, Jouni Malinen <j@w1.fi>
Subject: Re: [PATCH 3/3] nl80211: New command for setting TX rate mask for rate control
Date: Fri, 20 Aug 2010 11:20:04 +0200	[thread overview]
Message-ID: <1282296004.3785.25.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <4C6DA19B.7010606@redfish-solutions.com>

On Thu, 2010-08-19 at 14:26 -0700, Philip Prindeville wrote:

> > +	/*
> > +	 * The nested attribute uses enum nl80211_band as the index. This maps
> > +	 * directly to the enum ieee80211_band values used in cfg80211.
> > +	 */
> > +	nla_for_each_nested(tx_rates, info->attrs[NL80211_ATTR_TX_RATES], rem)
> > +	{
> > +		enum ieee80211_band band = nla_type(tx_rates);
> 
> Can this even work?  The first entry in nl80211_band is NL80211_BAND_2GHZ, i.e. zero.
> 
> Yet looking at libnl-1.1/lib/attr.c there's:
> 
> int nla_parse(struct nlattr *tb[], int maxtype, struct nlattr *head, int len,
>                struct nla_policy *policy)
> {
> ...
>          nla_for_each_attr(nla, head, len, rem) {
>                  int type = nla_type(nla);
> 
>                  if (type == 0) {

Well, notice how you're quoting code that does the same thing
(for_each_attr), but the latter code does the extra non-zero check,
which we don't.

We don't use nla_parse for this, we have to use
nla_parse_nested/for_each_attr. Yeah, it's a little quirky, but still
works fine.

johannes


  reply	other threads:[~2010-08-20  9:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-29 10:59 [PATCH 3/3] nl80211: New command for setting TX rate mask for rate control Jouni Malinen
2010-01-05  9:39 ` Johannes Berg
2010-08-19 21:26 ` Philip Prindeville
2010-08-20  9:20   ` Johannes Berg [this message]
2010-08-20 16:33     ` Philip Prindeville
2010-08-20 22:54       ` Philip Prindeville
2010-08-24 10:16         ` Johannes Berg
2010-08-24 21:29           ` Philip Prindeville

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1282296004.3785.25.camel@jlt3.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=j@w1.fi \
    --cc=jouni.malinen@atheros.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=philipp_subx@redfish-solutions.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).