All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Arend van Spriel <arend@broadcom.com>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
	Gautam Kumar Shukla <gautams@broadcom.com>
Subject: Re: [RFC V2] cfg80211: Add feature flag for 4-way handshake offload
Date: Fri, 19 Dec 2014 10:18:27 +0100	[thread overview]
Message-ID: <1418980707.1889.1.camel@sipsolutions.net> (raw)
In-Reply-To: <1418935344-22159-1-git-send-email-arend@broadcom.com>

On Thu, 2014-12-18 at 21:42 +0100, Arend van Spriel wrote:

> +	u8 ext_features[(NUM_NL80211_EXT_FEATURES / 8) + 1];

Should probably use DIV_ROUND_UP() here.

> +static inline bool
> +wiphy_ext_feature_isset(struct wiphy *wiphy,
> +			enum nl80211_ext_feature_index ftidx)
> +{
> +	u8 ft_byte;
> +
> +	ft_byte = wiphy->ext_features[ftidx / 8];
> +	return (ft_byte & BIT(ftidx % 8)) != 0;
> +}

Don't really need != 0 (but doesn't hurt either) since the type
promotion is to bool in the return value.

>  /**
> + * enum nl80211_ext_feature_index - bit index of extended features.
> + *
> + * @NL80211_EXT_FEATURE_4WAY_HANDSHAKE: the device supports 4way handshake
> + */
> +enum nl80211_ext_feature_index {
> +	NL80211_EXT_FEATURE_4WAY_HANDSHAKE,
> +
> +	/* add new features before the definition below */
> +	NUM_NL80211_EXT_FEATURES,
> +	MAX_NL80211_EXT_FEATURES = NUM_NL80211_EXT_FEATURES - 1
> +};

Don't think you need MAX_? Also you should add NUM_ to the documentation
(and MAX_ also if you want to keep it)

> +++ b/net/wireless/nl80211.c
> @@ -1603,6 +1603,11 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
>  		if (nla_put_u32(msg, NL80211_ATTR_FEATURE_FLAGS, features))
>  			goto nla_put_failure;
>  
> +		if (nla_put(msg, NL80211_ATTR_EXT_FEATURES,
> +			    sizeof(rdev->wiphy.ext_features),
> +			    rdev->wiphy.ext_features))
> +			goto nla_put_failure;

I don't think this should go here - I can see how it's tempting to put
it with the feature flags but there's a size limit issue with the wiphy
data on old userspace, so this should go towards the end to deal with
the split data.

johannes


  reply	other threads:[~2014-12-19  9:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-18 20:42 [RFC V2] cfg80211: Add feature flag for 4-way handshake offload Arend van Spriel
2014-12-19  9:18 ` Johannes Berg [this message]
2014-12-19  9:43   ` Arend van Spriel
2014-12-19  9:59     ` Arend van Spriel
2014-12-19 10:05       ` Johannes Berg
2014-12-19 10:15         ` Arend van Spriel

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=1418980707.1889.1.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=arend@broadcom.com \
    --cc=gautams@broadcom.com \
    --cc=linux-wireless@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.