All of lore.kernel.org
 help / color / mirror / Atom feed
From: jjohnson@codeaurora.org
To: Maharaja Kennadyrajan <mkenna@codeaurora.org>
Cc: ath11k@lists.infradead.org, linux-wireless@vger.kernel.org,
	ath11k <ath11k-bounces@lists.infradead.org>
Subject: Re: [PATCH v2 1/3] nl80211: Add support for beacon tx mode
Date: Wed, 05 May 2021 07:27:31 -0700	[thread overview]
Message-ID: <ce40ca27c3af5efd27a64415538d5b63@codeaurora.org> (raw)
In-Reply-To: <cc2182041c5fc8f1c168a262e3a3263c@codeaurora.org>

On 2021-05-05 00:18, Maharaja Kennadyrajan wrote:
> On 2021-05-03 22:54, jjohnson@codeaurora.org wrote:
>> On 2021-04-29 04:47, Maharaja Kennadyrajan wrote:
>> [..snip..]
>>> +/**
>>> + * enum nl80211_beacon_tx_mode - Beacon Tx Mode enum.
>>> + *      Used to configure beacon staggered mode or beacon burst 
>>> mode.
>>> + */
>>> +enum nl80211_beacon_tx_mode {
>>> +	NL80211_BEACON_STAGGERED_MODE = 1,
>>> +	NL80211_BEACON_BURST_MODE = 2,
>>> +};
>>> +
>> [..snip..]
>>> @@ -5330,6 +5331,10 @@ static int nl80211_start_ap(struct sk_buff 
>>> *skb,
>>> struct genl_info *info)
>>>  	params.dtim_period =
>>>  		nla_get_u32(info->attrs[NL80211_ATTR_DTIM_PERIOD]);
>>> 
>>> +	if (info->attrs[NL80211_ATTR_BEACON_TX_MODE])
>>> +		params.beacon_tx_mode =
>>> +
>>> nla_get_u32(info->attrs[NL80211_ATTR_BEACON_TX_MODE]);
>>> +
>> 
>> Note that in the case where NL80211_ATTR_BEACON_TX_MODE is not 
>> specified that
>> beacon_tx_mode will be zero, which is not a valid
>> nl80211_beacon_tx_mode enumeration.
>> 
>> Should you renumber the nl80211_beacon_tx_mode enumerations so that 
>> the default
>> mode has a value of 0? Or add NL80211_BEACON_DEFAULT_MODE = 0 and
>> allow the driver
>> to select a default mode?
> 
> [Maha]: Yes, it will select the default mode as STAGGERED mode when the 
> user set
> beacon_tx_mode as 0 in the hostapd conf file.
> Also, it will select the default mode as STAGGERED mode when the user 
> didn't add
> beacon_tx_mode config in the hostapd conf file.
> This is how it is handled here already.

Regardless of how it is handled, I still assert that there is a
coding/logic error here since in the case the attribute is not
present you send an invalid enumeration (0) to the driver. I'm
suggesting to fix that logic/coding error either by renumbering
the existing enumerations or by adding a new enumeration so that
0 is a valid enumeration.


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

WARNING: multiple messages have this Message-ID (diff)
From: jjohnson@codeaurora.org
To: Maharaja Kennadyrajan <mkenna@codeaurora.org>
Cc: ath11k@lists.infradead.org, linux-wireless@vger.kernel.org,
	ath11k <ath11k-bounces@lists.infradead.org>
Subject: Re: [PATCH v2 1/3] nl80211: Add support for beacon tx mode
Date: Wed, 05 May 2021 07:27:31 -0700	[thread overview]
Message-ID: <ce40ca27c3af5efd27a64415538d5b63@codeaurora.org> (raw)
In-Reply-To: <cc2182041c5fc8f1c168a262e3a3263c@codeaurora.org>

On 2021-05-05 00:18, Maharaja Kennadyrajan wrote:
> On 2021-05-03 22:54, jjohnson@codeaurora.org wrote:
>> On 2021-04-29 04:47, Maharaja Kennadyrajan wrote:
>> [..snip..]
>>> +/**
>>> + * enum nl80211_beacon_tx_mode - Beacon Tx Mode enum.
>>> + *      Used to configure beacon staggered mode or beacon burst 
>>> mode.
>>> + */
>>> +enum nl80211_beacon_tx_mode {
>>> +	NL80211_BEACON_STAGGERED_MODE = 1,
>>> +	NL80211_BEACON_BURST_MODE = 2,
>>> +};
>>> +
>> [..snip..]
>>> @@ -5330,6 +5331,10 @@ static int nl80211_start_ap(struct sk_buff 
>>> *skb,
>>> struct genl_info *info)
>>>  	params.dtim_period =
>>>  		nla_get_u32(info->attrs[NL80211_ATTR_DTIM_PERIOD]);
>>> 
>>> +	if (info->attrs[NL80211_ATTR_BEACON_TX_MODE])
>>> +		params.beacon_tx_mode =
>>> +
>>> nla_get_u32(info->attrs[NL80211_ATTR_BEACON_TX_MODE]);
>>> +
>> 
>> Note that in the case where NL80211_ATTR_BEACON_TX_MODE is not 
>> specified that
>> beacon_tx_mode will be zero, which is not a valid
>> nl80211_beacon_tx_mode enumeration.
>> 
>> Should you renumber the nl80211_beacon_tx_mode enumerations so that 
>> the default
>> mode has a value of 0? Or add NL80211_BEACON_DEFAULT_MODE = 0 and
>> allow the driver
>> to select a default mode?
> 
> [Maha]: Yes, it will select the default mode as STAGGERED mode when the 
> user set
> beacon_tx_mode as 0 in the hostapd conf file.
> Also, it will select the default mode as STAGGERED mode when the user 
> didn't add
> beacon_tx_mode config in the hostapd conf file.
> This is how it is handled here already.

Regardless of how it is handled, I still assert that there is a
coding/logic error here since in the case the attribute is not
present you send an invalid enumeration (0) to the driver. I'm
suggesting to fix that logic/coding error either by renumbering
the existing enumerations or by adding a new enumeration so that
0 is a valid enumeration.


  reply	other threads:[~2021-05-05 14:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 11:47 [PATCH v2 0/3] Add support to configure beacon tx mode Maharaja Kennadyrajan
2021-04-29 11:47 ` Maharaja Kennadyrajan
2021-04-29 11:47 ` [PATCH v2 1/3] nl80211: Add support for " Maharaja Kennadyrajan
2021-04-29 11:47   ` Maharaja Kennadyrajan
2021-05-03 17:24   ` jjohnson
2021-05-03 17:24     ` jjohnson
2021-05-05  7:18     ` Maharaja Kennadyrajan
2021-05-05  7:18       ` Maharaja Kennadyrajan
2021-05-05 14:27       ` jjohnson [this message]
2021-05-05 14:27         ` jjohnson
2021-04-29 11:47 ` [PATCH v2 2/3] mac80211: " Maharaja Kennadyrajan
2021-04-29 11:47   ` Maharaja Kennadyrajan
2021-04-29 11:47 ` [PATCH v2 3/3] ath11k: " Maharaja Kennadyrajan
2021-04-29 11:47   ` Maharaja Kennadyrajan
2021-04-30  7:15 ` [PATCH v2 0/3] Add support to configure " Sven Eckelmann
2021-04-30  7:15   ` Sven Eckelmann
2021-05-26 14:13   ` Maharaja Kennadyrajan
2021-05-26 14:13     ` Maharaja Kennadyrajan

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=ce40ca27c3af5efd27a64415538d5b63@codeaurora.org \
    --to=jjohnson@codeaurora.org \
    --cc=ath11k-bounces@lists.infradead.org \
    --cc=ath11k@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mkenna@codeaurora.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.