All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: tamizhr@codeaurora.org
Cc: linux-wireless@vger.kernel.org, tamizhr@qti.qualcomm.com
Subject: Re: [PATCH 1/2] cfg80211: Add support to notify station's opmode change to userspace
Date: Mon, 22 Jan 2018 13:48:07 +0100	[thread overview]
Message-ID: <1516625287.2508.18.camel@sipsolutions.net> (raw)
In-Reply-To: <1516173508-16528-1-git-send-email-tamizhr@codeaurora.org>

On Wed, 2018-01-17 at 12:48 +0530, tamizhr@codeaurora.org wrote:
> 
>  /**
> + * enum wiphy_opmode_info_flag - opmode information flags
> + *
> + * @MAX_BW_CHANGED: Max Bandwidth changed
> + * @SMPS_MODE_CHANGED: SMPS mode changed
> + * @N_SS_CHANGED: max N_SS (number of spatial streams) changed
> + *
> + */
> +enum wiphy_opmode_info_flag {
> +	MAX_BW_CHANGED		= BIT(0),
> +	SMPS_MODE_CHANGED	= BIT(1),
> +	N_SS_CHANGED		= BIT(2),
> +};

These need to have some kind of common prefix, e.g.
STA_OPMODE_{BW,SMPS,NSS}_CHANGED


>  /**
> + * cfg80211_sta_opmode_change_notify - Station's SMPS mode, rx_nss and
> + *	max bandwidth change event

need to find a shorter description - must fit on one line

> + * @dev: network device
> + * @mac: MAC address of a station which opmode got modified
> + * @changed: contains value from &enum wiphy_opmode_info_flag
> + * @smps_mode: New SMPS mode of a station
> + * @bw: new max bandwidth value of a station
> + * @rx_nss: new rx_nss value of a station
> + * @gfp: context flags
> + *
> + * This function is called when station's opmode modified via action frame.

Rephrase, say "Drivers should call this function when ..."

> +void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
> +				       enum wiphy_opmode_info_flag changed,
> +				       u8 smps_mode, u8 bw, u8 rx_nss,
> +				       gfp_t gfp);

We may not want to add more, but pulling out those parameters "changed,
smps_mode, bw, rx_nss" into a small structure would IMHO be a good
idea.

> + * @NL80211_CMD_STA_OPMODE_CHANGED: An event that notify station's
> + *	ht opmode or vht opmode changes. This will use &NL80211_ATTR_SMPS_MODE,
> + *	&NL80211_ATTR_CHANNEL_WIDTH, &NL80211_ATTR_NSS to send the event to
> + *	userspace.

Should document that not all of those attributes may be included at all
times.

> +void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
> +				       enum wiphy_opmode_info_flag changed,
> +				       u8 smps, u8 bw, u8 rx_nss, gfp_t gfp)
> +{
> +	struct sk_buff *msg;
> +	struct wireless_dev *wdev = dev->ieee80211_ptr;
> +	struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
> +	void *hdr;
> +
> +	if (!mac)
> +		return;

WARN_ON(), perhaps

> +	if (mac && nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, mac))
> +		goto nla_put_failure;

no need to check mac != NULL again

> +nla_put_failure:
> +	genlmsg_cancel(msg, hdr);

no need for cancel when you're going to free the message

johannes

  parent reply	other threads:[~2018-01-22 12:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-17  7:18 [PATCH 1/2] cfg80211: Add support to notify station's opmode change to userspace tamizhr
2018-01-17  7:18 ` [PATCH 2/2] mac80211: Add support to notify ht/vht opmode modification tamizhr
2018-01-22 12:48 ` Johannes Berg [this message]
2018-01-23 11:35   ` [PATCH 1/2] cfg80211: Add support to notify station's opmode change to userspace Tamizh chelvam

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=1516625287.2508.18.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=tamizhr@codeaurora.org \
    --cc=tamizhr@qti.qualcomm.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 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.