From: Johannes Berg <johannes@sipsolutions.net>
To: Michael Braun <michael-dev@fami-braun.de>
Cc: linux-wireless@vger.kernel.org, projekt-wlan@fem.tu-ilmenau.de
Subject: Re: [PATCH 2/3] mac80211: filter multicast data packets on AP / AP_VLAN
Date: Wed, 05 Oct 2016 12:01:17 +0200 [thread overview]
Message-ID: <1475661677.4994.27.camel@sipsolutions.net> (raw)
In-Reply-To: <1475643324-2845-2-git-send-email-michael-dev@fami-braun.de>
Please also add "v3" to the subject line, e.g. using --subject-prefix
'PATCH v3' when using git send-email.
> +static void add_vlan_files(struct ieee80211_sub_if_data *sdata)
> +{
> + // add num_mcast_sta_vlan using name num_mcast_sta
Please don't use // style comments.
> +static inline void
> +ieee80211_vif_inc_num_mcast(struct ieee80211_sub_if_data *sdata)
> +{
> + if (sdata->vif.type != NL80211_IFTYPE_AP &&
> + sdata->vif.type != NL80211_IFTYPE_AP_VLAN)
> + return;
That's pointless, given this:
> + if (sdata->vif.type == NL80211_IFTYPE_AP)
> + atomic_inc(&sdata->u.ap.num_mcast_sta);
> + else if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
> + atomic_inc(&sdata->u.vlan.num_mcast_sta);
> +}
> +
> +static inline void
> +ieee80211_vif_dec_num_mcast(struct ieee80211_sub_if_data *sdata)
> +{
> + if (sdata->vif.type != NL80211_IFTYPE_AP &&
> + sdata->vif.type != NL80211_IFTYPE_AP_VLAN)
> + return;
> +
> + if (sdata->vif.type == NL80211_IFTYPE_AP)
> + atomic_dec(&sdata->u.ap.num_mcast_sta);
> + else if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
> + atomic_dec(&sdata->u.vlan.num_mcast_sta);
Same here.
> +}
> +
> +/* This function returns the number of multicast stations connected
> to this
> + * interface. It returns -1 if that number is not tracked, that is
> for netdevs
> + * not in AP or AP_VLAN mode or when using 4addr. */
> +static inline int
> +ieee80211_vif_get_num_mcast_if(struct ieee80211_sub_if_data *sdata)
> +{
> + if (sdata->vif.type == NL80211_IFTYPE_AP)
> + return atomic_read(&sdata->u.ap.num_mcast_sta);
> + else if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
> + !sdata->u.vlan.sta)
> + return atomic_read(&sdata->u.vlan.num_mcast_sta);
> + else
> + return -1;
All the "else" branches are useless since you return immediately inside
each if.
> - } else if (unlikely(tx->sdata->vif.type == NL80211_IFTYPE_AP &&
> - ieee80211_is_data(hdr->frame_control) &&
> - !atomic_read(&tx->sdata->u.ap.num_mcast_sta))) {
> + } else if (unlikely(ieee80211_vif_get_num_mcast_if(tx->sdata) == 0 &&
> + ieee80211_is_data(hdr->frame_control))) {
any particular reason to invert the order of the checks? seems checking
for data first should be faster/cheaper from the cache, than accessing
the counters?
johannes
next prev parent reply other threads:[~2016-10-05 10:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-05 4:55 [PATCH 1/3] mac80211: remove unnecessary num_mcast_sta user Michael Braun
2016-10-05 4:55 ` [PATCH 2/3] mac80211: filter multicast data packets on AP / AP_VLAN Michael Braun
2016-10-05 9:56 ` Johannes Berg
2016-10-05 10:01 ` Johannes Berg [this message]
2016-10-05 4:55 ` [PATCH 3/3] mac80211: multicast to unicast conversion Michael Braun
2016-10-05 10:19 ` Johannes Berg
2016-10-05 10:19 ` Johannes Berg
2016-10-05 11:40 ` michael-dev
2016-10-05 11:40 ` michael-dev
2016-10-05 11:58 ` Johannes Berg
2016-10-06 11:53 ` michael-dev
2016-10-06 11:53 ` michael-dev
2016-10-06 11:55 ` Johannes Berg
-- strict thread matches above, loose matches on Subject: below --
2016-10-04 20:31 [PATCH 1/3] mac80211: remove unnecessary num_mcast_sta user Michael Braun
2016-10-04 20:31 ` [PATCH 2/3] mac80211: filter multicast data packets on AP / AP_VLAN Michael Braun
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=1475661677.4994.27.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=michael-dev@fami-braun.de \
--cc=projekt-wlan@fem.tu-ilmenau.de \
/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.