netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Jaewan Kim <jaewan@google.com>,
	gregkh@linuxfoundation.org, linux-wireless@vger.kernel.org,
	netdev@vger.kernel.org
Cc: kernel-team@android.com, adelva@google.com
Subject: Re: [PATCH v7 2/4] mac80211_hwsim: add PMSR request support via virtio
Date: Wed, 15 Feb 2023 19:07:47 +0100	[thread overview]
Message-ID: <fbe6f8eb820b29f0cc932a63ad84253d0cef93c3.camel@sipsolutions.net> (raw)
In-Reply-To: <20230207085400.2232544-3-jaewan@google.com>

On Tue, 2023-02-07 at 08:53 +0000, Jaewan Kim wrote:
> 
>  
> +static int mac80211_hwsim_send_pmsr_ftm_request_peer(struct sk_buff *msg,
> +						     struct cfg80211_pmsr_ftm_request_peer *request)

this ...

> +{
> +	struct nlattr *ftm;
> +
> +	if (!request->requested)
> +		return -EINVAL;
> +
> +	ftm = nla_nest_start(msg, NL80211_PMSR_TYPE_FTM);
> +	if (!ftm)
> +		return -ENOBUFS;
> +
> +	if (nla_put_u32(msg, NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE, request->preamble))
> +		return -ENOBUFS;
> +
> +	if (nla_put_u16(msg, NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD, request->burst_period))
> +		return -ENOBUFS;

and this ... etc ...

also got some really long lines that could easily be broken

> +	chandef = nla_nest_start(msg, NL80211_PMSR_PEER_ATTR_CHAN);
> +	if (!chandef)
> +		return -ENOBUFS;
> +
> +	err = cfg80211_send_chandef(msg, &request->chandef);
> +	if (err)
> +		return err;

So this one I think I'll let you do with the export and all, because
that's way nicer than duplicating the code, and it's clearly necessary.

> +static int mac80211_hwsim_send_pmsr_request(struct sk_buff *msg,
> +					    struct cfg80211_pmsr_request *request)
> +{
> +	int err;
> +	struct nlattr *pmsr = nla_nest_start(msg, NL80211_ATTR_PEER_MEASUREMENTS);

I'm not going to complain _too_ much about this, but all this use of
nl80211 attributes better be thoroughly documented in the header file.

> + * @HWSIM_CMD_START_PMSR: start PMSR

That sounds almost like it's a command ("start PMSR") but really it's a
notification/event as far as hwsim is concerned, so please document
that.

> + * @HWSIM_ATTR_PMSR_REQUEST: peer measurement request

and please document the structure of the request that userspace will get
(and how it should respond?)

> +++ b/include/net/cfg80211.h
> @@ -938,6 +938,16 @@ int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
>  				  const struct cfg80211_chan_def *chandef,
>  				  enum nl80211_iftype iftype);
>  
> +/**
> + * cfg80211_send_chandef - sends the channel definition.
> + * @msg: the msg to send channel definition
> + * @chandef: the channel definition to check
> + *
> + * Returns: 0 if sent the channel definition to msg, < 0 on error
> + **/

That last line should just be */

> +int cfg80211_send_chandef(struct sk_buff *msg, const struct cfg80211_chan_def *chandef);

I think it'd be better if you exported it as nl80211_..., since it
really is just a netlink thing, not cfg80211 functionality.

It would also be good, IMHO, to split this part out into a separate
patch saying that e.g. hwsim might use it like you do here, or even that
vendor netlink could use it where needed.

johannes

  reply	other threads:[~2023-02-15 18:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-07  8:53 [PATCH v7 0/4] mac80211_hwsim: Add PMSR support Jaewan Kim
2023-02-07  8:53 ` [PATCH v7 1/4] mac80211_hwsim: add PMSR capability support Jaewan Kim
2023-02-07  9:08   ` Greg KH
2023-02-07  9:12   ` Greg KH
2023-02-15 18:01   ` Johannes Berg
2023-02-17  5:11     ` Jaewan Kim
2023-02-17  7:43       ` Greg KH
2023-02-17  9:13         ` Johannes Berg
2023-02-17  9:31           ` Greg KH
2023-02-17  9:34             ` Johannes Berg
2023-02-17  9:41               ` Greg KH
2023-02-17  9:19       ` Johannes Berg
2023-02-07  8:53 ` [PATCH v7 2/4] mac80211_hwsim: add PMSR request support via virtio Jaewan Kim
2023-02-15 18:07   ` Johannes Berg [this message]
2023-02-23 15:38     ` Jaewan Kim
2023-02-28 15:06       ` Johannes Berg
2023-02-07  8:53 ` [PATCH v7 3/4] mac80211_hwsim: add PMSR abort " Jaewan Kim
2023-02-07  8:54 ` [PATCH v7 4/4] mac80211_hwsim: add PMSR report " Jaewan Kim
2023-02-15 18:13   ` Johannes Berg
2023-02-07  9:06 ` [PATCH v7 0/4] mac80211_hwsim: Add PMSR support Greg KH

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=fbe6f8eb820b29f0cc932a63ad84253d0cef93c3.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=adelva@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jaewan@google.com \
    --cc=kernel-team@android.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@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 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).