From: Johannes Berg <johannes@sipsolutions.net> To: Marco Porsch <marco@cozybit.com> Cc: mcgrof@qca.qualcomm.com, jouni@qca.qualcomm.com, vthiagar@qca.qualcomm.com, senthilb@qca.qualcomm.com, sleffler@google.com, linux-wireless@vger.kernel.org, devel@lists.open80211s.org, ath9k-devel@lists.ath9k.org Subject: Re: [PATCHv2 2/3] mac80211: mesh power save doze scheduling Date: Wed, 20 Feb 2013 16:01:20 +0100 [thread overview] Message-ID: <1361372480.8629.33.camel@jlt4.sipsolutions.net> (raw) In-Reply-To: <1361203709-16669-2-git-send-email-marco@cozybit.com> (sfid-20130218_170842_350606_DE89DB9F) On Mon, 2013-02-18 at 17:08 +0100, Marco Porsch wrote: > +/** > + * ieee80211_mps_init - register callbacks for mesh powersave mode > + * > + * @hw: the hardware > + * @ops: callbacks for this device > + * > + * called by driver on mesh interface add/remove > + */ > +#ifdef CONFIG_MAC80211_MESH > +void ieee80211_mps_init(struct ieee80211_hw *hw, > + const struct ieee80211_mps_ops *ops); > +#else > +static inline void ieee80211_mps_init(struct ieee80211_hw *hw, > + const struct ieee80211_mps_ops *ops) > +{ return; } > +#endif The "return" there is spurious. Is it really worth providing a static inline? It seems drivers might want to #ifdef it anyway so they don't have carry around the ops struct and the called functions if mesh isn't compiled in. > +static bool mps_doze_check_sta(struct ieee80211_local *local, u64 *nexttbtt) > +{ > + struct sta_info *sta; > + bool allow = true; > + u64 nexttbtt_min = ULLONG_MAX; > + > + mutex_lock(&local->sta_mtx); > + list_for_each_entry(sta, &local->sta_list, list) { > + if (!ieee80211_vif_is_mesh(&sta->sdata->vif) || > + !ieee80211_sdata_running(sta->sdata) || > + sta->plink_state != NL80211_PLINK_ESTAB) { > + continue; This is strange, why bother with the else if there's a continue? > + } else if (test_sta_flag(sta, WLAN_STA_MPS_WAIT_FOR_CAB) || > + test_sta_flag(sta, WLAN_STA_MPSP_OWNER) || > + test_sta_flag(sta, WLAN_STA_MPSP_RECIPIENT) || > + !timer_pending(&sta->nexttbtt_timer) || > + time_after(jiffies, sta->nexttbtt_jiffies)) { Are you sure jiffies are good enough? Some systems have HZ=33 or so I think, which makes a jiffy like 30ms. > + allow = false; > + break; > + } else if (sta->nexttbtt_tsf < nexttbtt_min) { > + nexttbtt_min = sta->nexttbtt_tsf; > + } ditto, why bother with else after break? > + if (nexttbtt_min != ULLONG_MAX) > + *nexttbtt = nexttbtt_min; The API of this function is very strange. Sometimes it might set it, sometimes it might leave it, but that's not even consistent with the "allow" return value ... It seems it'd be better to always set it. > +/** > + * ieee80211_mps_doze - trigger radio doze state after checking conditions > + * > + * @local: local interface data "interface"? hardly. > +void ieee80211_mps_doze(struct ieee80211_local *local) > +{ > + u64 nexttbtt = 0; and get rid of the assignment here. > + > +void ieee80211_mps_init(struct ieee80211_hw *hw, > + const struct ieee80211_mps_ops *ops) > +{ > + struct ieee80211_local *local = hw_to_local(hw); > + > + if (!ops) > + local->mps_enabled = false; Allowing that seems pointless ... in fact, why is there this assignment function anyway? It seems these are pretty normal, if #ifdef MESH, driver callbacks? johannes
WARNING: multiple messages have this Message-ID (diff)
From: Johannes Berg <johannes@sipsolutions.net> To: ath9k-devel@lists.ath9k.org Subject: [ath9k-devel] [PATCHv2 2/3] mac80211: mesh power save doze scheduling Date: Wed, 20 Feb 2013 16:01:20 +0100 [thread overview] Message-ID: <1361372480.8629.33.camel@jlt4.sipsolutions.net> (raw) In-Reply-To: <1361203709-16669-2-git-send-email-marco@cozybit.com> (sfid-20130218_170842_350606_DE89DB9F) On Mon, 2013-02-18 at 17:08 +0100, Marco Porsch wrote: > +/** > + * ieee80211_mps_init - register callbacks for mesh powersave mode > + * > + * @hw: the hardware > + * @ops: callbacks for this device > + * > + * called by driver on mesh interface add/remove > + */ > +#ifdef CONFIG_MAC80211_MESH > +void ieee80211_mps_init(struct ieee80211_hw *hw, > + const struct ieee80211_mps_ops *ops); > +#else > +static inline void ieee80211_mps_init(struct ieee80211_hw *hw, > + const struct ieee80211_mps_ops *ops) > +{ return; } > +#endif The "return" there is spurious. Is it really worth providing a static inline? It seems drivers might want to #ifdef it anyway so they don't have carry around the ops struct and the called functions if mesh isn't compiled in. > +static bool mps_doze_check_sta(struct ieee80211_local *local, u64 *nexttbtt) > +{ > + struct sta_info *sta; > + bool allow = true; > + u64 nexttbtt_min = ULLONG_MAX; > + > + mutex_lock(&local->sta_mtx); > + list_for_each_entry(sta, &local->sta_list, list) { > + if (!ieee80211_vif_is_mesh(&sta->sdata->vif) || > + !ieee80211_sdata_running(sta->sdata) || > + sta->plink_state != NL80211_PLINK_ESTAB) { > + continue; This is strange, why bother with the else if there's a continue? > + } else if (test_sta_flag(sta, WLAN_STA_MPS_WAIT_FOR_CAB) || > + test_sta_flag(sta, WLAN_STA_MPSP_OWNER) || > + test_sta_flag(sta, WLAN_STA_MPSP_RECIPIENT) || > + !timer_pending(&sta->nexttbtt_timer) || > + time_after(jiffies, sta->nexttbtt_jiffies)) { Are you sure jiffies are good enough? Some systems have HZ=33 or so I think, which makes a jiffy like 30ms. > + allow = false; > + break; > + } else if (sta->nexttbtt_tsf < nexttbtt_min) { > + nexttbtt_min = sta->nexttbtt_tsf; > + } ditto, why bother with else after break? > + if (nexttbtt_min != ULLONG_MAX) > + *nexttbtt = nexttbtt_min; The API of this function is very strange. Sometimes it might set it, sometimes it might leave it, but that's not even consistent with the "allow" return value ... It seems it'd be better to always set it. > +/** > + * ieee80211_mps_doze - trigger radio doze state after checking conditions > + * > + * @local: local interface data "interface"? hardly. > +void ieee80211_mps_doze(struct ieee80211_local *local) > +{ > + u64 nexttbtt = 0; and get rid of the assignment here. > + > +void ieee80211_mps_init(struct ieee80211_hw *hw, > + const struct ieee80211_mps_ops *ops) > +{ > + struct ieee80211_local *local = hw_to_local(hw); > + > + if (!ops) > + local->mps_enabled = false; Allowing that seems pointless ... in fact, why is there this assignment function anyway? It seems these are pretty normal, if #ifdef MESH, driver callbacks? johannes
next prev parent reply other threads:[~2013-02-20 15:01 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-02-18 16:08 [PATCHv2 1/3] mac80211: move mesh sync beacon handler into neighbour_update Marco Porsch 2013-02-18 16:08 ` [ath9k-devel] " Marco Porsch 2013-02-18 16:08 ` [PATCHv2 2/3] mac80211: mesh power save doze scheduling Marco Porsch 2013-02-18 16:08 ` [ath9k-devel] " Marco Porsch 2013-02-18 16:41 ` Christian Lamparter 2013-02-18 16:41 ` [ath9k-devel] " Christian Lamparter 2013-02-20 15:01 ` Johannes Berg [this message] 2013-02-20 15:01 ` Johannes Berg 2013-02-25 10:06 ` Marco Porsch 2013-02-25 10:06 ` [ath9k-devel] " Marco Porsch 2013-02-26 20:52 ` Johannes Berg 2013-02-26 20:52 ` [ath9k-devel] " Johannes Berg 2013-02-18 16:08 ` [PATCHv2 3/3] ath9k: mesh powersave support Marco Porsch 2013-02-18 16:08 ` [ath9k-devel] " Marco Porsch 2013-02-20 14:50 ` [PATCHv2 1/3] mac80211: move mesh sync beacon handler into neighbour_update Johannes Berg 2013-02-20 14:50 ` [ath9k-devel] " Johannes Berg 2013-02-20 18:26 ` Thomas Pedersen 2013-02-20 18:26 ` [ath9k-devel] " Thomas Pedersen 2013-02-20 20:00 ` Johannes Berg 2013-02-20 20:00 ` [ath9k-devel] " 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=1361372480.8629.33.camel@jlt4.sipsolutions.net \ --to=johannes@sipsolutions.net \ --cc=ath9k-devel@lists.ath9k.org \ --cc=devel@lists.open80211s.org \ --cc=jouni@qca.qualcomm.com \ --cc=linux-wireless@vger.kernel.org \ --cc=marco@cozybit.com \ --cc=mcgrof@qca.qualcomm.com \ --cc=senthilb@qca.qualcomm.com \ --cc=sleffler@google.com \ --cc=vthiagar@qca.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: linkBe 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.