Skip to content

Commit

Permalink
cfg80211: allow driver to override PS default
Browse files Browse the repository at this point in the history
Sometimes drivers might have a good reason to override
the PS default, like iwlwifi right now where it affects
RX performance significantly at this point. This will
allow them to override the default, if desired, in a
way that users can still change it according to their
trade-off choices, not the driver's, like would happen
if the driver just disabled PS completely then.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Johannes Berg authored and John W. Linville committed Aug 14, 2009
1 parent 36e6fea commit 16cb9d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,9 @@ struct cfg80211_ops {
* @net: the network namespace this wiphy currently lives in
* @netnsok: if set to false, do not allow changing the netns of this
* wiphy at all
* @ps_default: default for powersave, will be set depending on the
* kernel's default on wiphy_new(), but can be changed by the
* driver if it has a good reason to override the default
*/
struct wiphy {
/* assign these fields before you register the wiphy */
Expand All @@ -1123,6 +1126,7 @@ struct wiphy {
bool disable_beacon_hints;

bool netnsok;
bool ps_default;

enum cfg80211_signal_type signal_type;

Expand Down
4 changes: 3 additions & 1 deletion net/wireless/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv)
rdev->wiphy.dev.class = &ieee80211_class;
rdev->wiphy.dev.platform_data = rdev;

rdev->wiphy.ps_default = CONFIG_CFG80211_DEFAULT_PS_VALUE;

wiphy_net_set(&rdev->wiphy, &init_net);

rdev->rfkill_ops.set_block = cfg80211_rfkill_set_block;
Expand Down Expand Up @@ -674,7 +676,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
wdev->wext.default_key = -1;
wdev->wext.default_mgmt_key = -1;
wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
wdev->wext.ps = CONFIG_CFG80211_DEFAULT_PS_VALUE;
wdev->wext.ps = wdev->wiphy->ps_default;
wdev->wext.ps_timeout = 100;
if (rdev->ops->set_power_mgmt)
if (rdev->ops->set_power_mgmt(wdev->wiphy, dev,
Expand Down

0 comments on commit 16cb9d4

Please sign in to comment.