All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tamizh chelvam <tamizhr@codeaurora.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH 4/7] cfg80211: Add support to notify station's rssi level crossing
Date: Wed, 04 Jul 2018 11:43:46 +0530	[thread overview]
Message-ID: <b87dc6cea56faee0a3570d90b4e6d42a@codeaurora.org> (raw)
In-Reply-To: <1530264922.3481.40.camel@sipsolutions.net>

On 2018-06-29 15:05, Johannes Berg wrote:
> On Wed, 2018-06-13 at 16:15 +0530, Tamizh chelvam wrote:
>> Add cfg80211_sta_mon_rssi_notify api to update user space upon
>> crossing the configured rssi threshold of a station.
>> NL80211_CMD_NOTIFY_STA_MON introduced to send this event to
>> userspace along with NL80211_ATTR_STA_MON_RSSI_THRESHOLD_EVENT,
>> NL80211_ATTR_MAC and NL80211_ATTR_STA_MON_RSSI_LEVEL info.
>> Userspace application can make a decision depends on this
>> notification.
> 
> I guess you should also combine this with patch 2, it's a bit weird to
> only have one side and not be able to use it in one patch, and both
> aren't all that big.
Sure
> 
> 
>> --- a/include/uapi/linux/nl80211.h
>> +++ b/include/uapi/linux/nl80211.h
>> @@ -1249,6 +1249,7 @@ enum nl80211_commands {
>>  	NL80211_CMD_CONTROL_PORT_FRAME,
>> 
>>  	NL80211_CMD_SET_STA_MON,
>> +	NL80211_CMD_NOTIFY_STA_MON,
> 
> Missing documentation - but again, why not unify it with the existing
> event? Or can't we because that might confuse older applications?
> Perhaps anyway we should unicast these notifications? Not sure though,
> perhaps one app could set them up and the other might care?
> 
This new command introduced as per the previous discussion
https://patchwork.kernel.org/patch/10168685/
https://patchwork.kernel.org/patch/10240697/

Is my understanding correct ?

>> +static struct sk_buff *cfg80211_prepare_sta_mon(struct net_device 
>> *dev,
>> +						const char *mac, gfp_t gfp)
>> +{
>> +	struct wireless_dev *wdev = dev->ieee80211_ptr;
>> +	struct cfg80211_registered_device *rdev = 
>> wiphy_to_rdev(wdev->wiphy);
>> +	struct sk_buff *msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp);
>> +	void **cb;
>> +
>> +	if (!msg)
>> +		return NULL;
>> +
>> +	cb = (void **)msg->cb;
> 
> Uh, what's that? Please use a structure.

I just referred this code from cfg80211_prepare_cqm. Do you want me to 
change this to struct based?
> 
>> +	cb[0] = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_NOTIFY_STA_MON);
>> 
> [...]
>> +
>> +	cb[1] = nla_nest_start(msg, NL80211_ATTR_STA_MON);
>> +	if (!cb[1])
>> +		goto nla_put_failure;
>> +
>> +	cb[2] = rdev;
> 
> Yeah, definitely use a struct instead of three magic array indices.
> 
>> +
>> +	msg = cfg80211_prepare_sta_mon(dev, peer, gfp);
>> +	if (!msg)
>> +		return;
>> +
>> +	if (nla_put_u32(msg, NL80211_ATTR_STA_MON_RSSI_THRESHOLD_EVENT,
>> +			rssi_event))
>> +		goto nla_put_failure;
>> +
>> +	if (rssi_level && nla_put_s32(msg, NL80211_ATTR_STA_MON_RSSI_LEVEL,
>> +				      rssi_level))
>> +		goto nla_put_failure;
>> +
>> +	cfg80211_send_sta_mon(msg, gfp);
> 
> In fact, perhaps better to have something like
> 
> struct nl80211_sta_mon_prep {
> 	struct sk_buff *skb;
> 	....
> };
> 
> struct nl80211_sta_mon_prep prep;
> 
> if (cfg80211_prepare_sta_mon(&prep))
> 	return;
> ...
> cfg80211_send_sta_mon(&prep, gfp);
> 
> or so?

Tamizh.

  reply	other threads:[~2018-07-04  6:13 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-13 10:45 [PATCH 0/7] cfg80211/mac80211: Add support to configure and monitor rssi threshold Tamizh chelvam
2018-06-13 10:45 ` [PATCH 1/7] wireless: Change single cqm_config to rssi config list Tamizh chelvam
2018-06-29  9:26   ` Johannes Berg
2018-07-04 18:16     ` Tamizh chelvam
2018-07-06 11:46       ` Johannes Berg
2018-07-11  6:54         ` Tamizh chelvam
2018-08-28  9:02           ` Johannes Berg
2018-06-13 10:45 ` [PATCH 2/7] cfg80211: Add new NL command to configure peer specific rssi threshold Tamizh chelvam
2018-06-29  9:29   ` Johannes Berg
2018-07-04  6:09     ` Tamizh chelvam
2018-07-06 11:40       ` Johannes Berg
2018-07-11  7:04         ` Tamizh chelvam
2018-08-28  9:01           ` Johannes Berg
2018-06-13 10:45 ` [PATCH 3/7] mac80211: Add api to support configuring station " Tamizh chelvam
2018-06-29  9:31   ` Johannes Berg
2018-07-04  5:13     ` Tamizh chelvam
2018-06-13 10:45 ` [PATCH 4/7] cfg80211: Add support to notify station's rssi level crossing Tamizh chelvam
2018-06-29  9:35   ` Johannes Berg
2018-07-04  6:13     ` Tamizh chelvam [this message]
2018-07-06 11:39       ` Johannes Berg
2018-07-11  5:55         ` Tamizh chelvam
2018-06-13 10:45 ` [PATCH 5/7] mac80211: Implement functionality to monitor station's rssi cross event Tamizh chelvam
2018-06-29  9:36   ` Johannes Berg
2018-07-04  9:36     ` Tamizh chelvam
2018-06-13 10:45 ` [PATCH 6/7] cfg80211: Accept multiple RSSI threholds for STA_MON command Tamizh chelvam
2018-06-29  9:39   ` Johannes Berg
2018-07-05  7:37     ` Tamizh chelvam
2018-07-06 11:38       ` Johannes Berg
2018-06-13 10:45 ` [PATCH 7/7] mac80211: Add api to configure low and high RSSI threshold Tamizh chelvam
2018-06-29  9:39   ` Johannes Berg

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=b87dc6cea56faee0a3570d90b4e6d42a@codeaurora.org \
    --to=tamizhr@codeaurora.org \
    --cc=johannes@sipsolutions.net \
    --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.