* Re: [PATCH] cfg80211: support 4-way handshake offloading for WPA/WPA2-PSK
From: Arend Van Spriel @ 2017-02-21 10:32 UTC (permalink / raw)
To: Johannes Berg, linux-wireless; +Cc: Eliad Peller
In-Reply-To: <20170221100957.30965-1-johannes@sipsolutions.net>
On 21-2-2017 11:09, Johannes Berg wrote:
> From: Eliad Peller <eliad@wizery.com>
>
> Let drivers advertise support for station-mode 4-way handshake
> offloading with a new NL80211_EXT_FEATURE_4WAY_HANDSHAKE_OFFLOAD_STA
> flag.
I find use of the term OFFLOAD a bit redundant as it is implied by its
presence anyway.
> Add a new NL80211_ATTR_PMK attribute that might be passed as part
> of NL80211_CMD_CONNECT command, and contain the PSK (which is the
> PMK, hence the name.)
>
> The driver/device is assumed to handle the 4-way handshake by
> itself in this case (including key derivations, etc.), instead
> of relying on the supplicant.
>
> This patch is somewhat based on this one (by Vladimir Kondratiev):
> https://patchwork.kernel.org/patch/1309561/.
It also looks quite like this one we posted a while ago [1]. Our bad
that we did not follow-up :-p
Thanks,
Arend
[1] https://www.spinics.net/lists/linux-wireless/msg129387.html
> Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
> Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
> include/linux/ieee80211.h | 1 +
> include/net/cfg80211.h | 2 ++
> include/uapi/linux/nl80211.h | 9 +++++++++
> net/wireless/nl80211.c | 8 ++++++++
> 4 files changed, 20 insertions(+)
>
> diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
> index 6ea381c98aae..2049e983a994 100644
> --- a/include/linux/ieee80211.h
> +++ b/include/linux/ieee80211.h
> @@ -2357,6 +2357,7 @@ enum ieee80211_sa_query_action {
> #define WLAN_MAX_KEY_LEN 32
>
> #define WLAN_PMKID_LEN 16
> +#define WLAN_PMK_LEN 32
>
> #define WLAN_OUI_WFA 0x506f9a
> #define WLAN_OUI_TYPE_WFA_P2P 9
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index 86c12f85fb53..4ca968927d60 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -643,6 +643,7 @@ struct survey_info {
> * @wep_keys: static WEP keys, if not NULL points to an array of
> * CFG80211_MAX_WEP_KEYS WEP keys
> * @wep_tx_key: key index (0..3) of the default TX static WEP key
> + * @psk: PSK (for devices supporting 4-way-handshake offload)
> */
> struct cfg80211_crypto_settings {
> u32 wpa_versions;
> @@ -656,6 +657,7 @@ struct cfg80211_crypto_settings {
> bool control_port_no_encrypt;
> struct key_params *wep_keys;
> int wep_tx_key;
> + const u8 *psk;
> };
>
> /**
> diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
> index 9a499b15cfbc..ba102c937750 100644
> --- a/include/uapi/linux/nl80211.h
> +++ b/include/uapi/linux/nl80211.h
> @@ -2012,6 +2012,9 @@ enum nl80211_commands {
> * u32 attribute with an &enum nl80211_timeout_reason value. This is used,
> * e.g., with %NL80211_CMD_CONNECT event.
> *
> + * @NL80211_ATTR_PMK: PSK for offloaded 4-Way Handshake. Relevant only
> + * with %NL80211_CMD_CONNECT (for WPA/WPA2-PSK networks).
> + *
> * @NUM_NL80211_ATTR: total number of nl80211_attrs available
> * @NL80211_ATTR_MAX: highest attribute number currently defined
> * @__NL80211_ATTR_AFTER_LAST: internal use
> @@ -2423,6 +2426,8 @@ enum nl80211_attrs {
>
> NL80211_ATTR_TIMEOUT_REASON,
>
> + NL80211_ATTR_PMK,
> +
> /* add attributes here, update the policy in nl80211.c */
>
> __NL80211_ATTR_AFTER_LAST,
> @@ -4759,6 +4764,9 @@ enum nl80211_feature_flags {
> * @NL80211_EXT_FEATURE_CQM_RSSI_LIST: With this driver the
> * %NL80211_ATTR_CQM_RSSI_THOLD attribute accepts a list of zero or more
> * RSSI threshold values to monitor rather than exactly one threshold.
> + * @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_OFFLOAD_STA: Device supports
> + * doing 4-way handshake in station mode (PSK is passed as part
> + * of the connect command).
> *
> * @NUM_NL80211_EXT_FEATURES: number of extended features.
> * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
> @@ -4778,6 +4786,7 @@ enum nl80211_ext_feature_index {
> NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA_CONNECTED,
> NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI,
> NL80211_EXT_FEATURE_CQM_RSSI_LIST,
> + NL80211_EXT_FEATURE_4WAY_HANDSHAKE_OFFLOAD_STA,
>
> /* add new features before the definition below */
> NUM_NL80211_EXT_FEATURES,
> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
> index d516527fcb8e..34b551edbc4f 100644
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -410,6 +410,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
> .len = sizeof(struct nl80211_bss_select_rssi_adjust)
> },
> [NL80211_ATTR_TIMEOUT_REASON] = { .type = NLA_U32 },
> + [NL80211_ATTR_PMK] = { .len = WLAN_PMK_LEN },
> };
>
> /* policy for the key attributes */
> @@ -8039,6 +8040,13 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
> memcpy(settings->akm_suites, data, len);
> }
>
> + if (info->attrs[NL80211_ATTR_PMK]) {
> + if (!wiphy_ext_feature_isset(&rdev->wiphy,
> + NL80211_EXT_FEATURE_4WAY_HANDSHAKE_OFFLOAD_STA))
> + return -EINVAL;
> + settings->psk = nla_data(info->attrs[NL80211_ATTR_PMK]);
> + }
> +
> return 0;
> }
>
>
^ permalink raw reply
* [RFC] mac80211_hwsim: report survey data for scanned channels
From: Johannes Berg @ 2017-02-21 10:31 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg
From: Johannes Berg <johannes.berg@intel.com>
Currently, hwsim is reporting survey data (only a fake noise floor)
for the current channel. This breaks when the multi-channel support
is enabled since then there's no current channel.
Make the dummy implementation closer to a real one and only report
data while scanning, for all the scanned channels. At other times,
no survey data might be available (in real hardware) due to power-
save for example.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
Had this lying around - is it useful for anyone?
---
drivers/net/wireless/mac80211_hwsim.c | 73 ++++++++++++++++++++++++++++-------
1 file changed, 60 insertions(+), 13 deletions(-)
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 0150747c79ac..5a636b09320b 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -525,6 +525,11 @@ struct mac80211_hwsim_data {
struct ieee80211_vif *hw_scan_vif;
int scan_chan_idx;
u8 scan_addr[ETH_ALEN];
+ struct {
+ struct ieee80211_channel *channel;
+ unsigned long next_start, start, end;
+ } survey_data[ARRAY_SIZE(hwsim_channels_2ghz) +
+ ARRAY_SIZE(hwsim_channels_5ghz)];
struct ieee80211_channel *channel;
u64 beacon_int /* beacon interval in us */;
@@ -1576,6 +1581,7 @@ static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed)
[IEEE80211_SMPS_STATIC] = "static",
[IEEE80211_SMPS_DYNAMIC] = "dynamic",
};
+ int idx;
if (conf->chandef.chan)
wiphy_debug(hw->wiphy,
@@ -1598,9 +1604,33 @@ static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed)
data->idle = !!(conf->flags & IEEE80211_CONF_IDLE);
- data->channel = conf->chandef.chan;
+ WARN_ON(conf->chandef.chan && data->use_chanctx);
+
+ mutex_lock(&data->mutex);
+ if (data->scanning && conf->chandef.chan) {
+ for (idx = 0; idx < ARRAY_SIZE(data->survey_data); idx++) {
+ if (data->survey_data[idx].channel == data->channel) {
+ data->survey_data[idx].start =
+ data->survey_data[idx].next_start;
+ data->survey_data[idx].end = jiffies;
+ break;
+ }
+ }
- WARN_ON(data->channel && data->use_chanctx);
+ data->channel = conf->chandef.chan;
+
+ for (idx = 0; idx < ARRAY_SIZE(data->survey_data); idx++) {
+ if (data->survey_data[idx].channel &&
+ data->survey_data[idx].channel != data->channel)
+ continue;
+ data->survey_data[idx].channel = data->channel;
+ data->survey_data[idx].next_start = jiffies;
+ break;
+ }
+ } else {
+ data->channel = conf->chandef.chan;
+ }
+ mutex_unlock(&data->mutex);
data->power_level = conf->power_level;
if (!data->started || !data->beacon_int)
@@ -1787,28 +1817,39 @@ static int mac80211_hwsim_conf_tx(
return 0;
}
-static int mac80211_hwsim_get_survey(
- struct ieee80211_hw *hw, int idx,
- struct survey_info *survey)
+static int mac80211_hwsim_get_survey(struct ieee80211_hw *hw, int idx,
+ struct survey_info *survey)
{
- struct ieee80211_conf *conf = &hw->conf;
+ struct mac80211_hwsim_data *hwsim = hw->priv;
wiphy_debug(hw->wiphy, "%s (idx=%d)\n", __func__, idx);
- if (idx != 0)
+ if (idx < 0 || idx >= ARRAY_SIZE(hwsim->survey_data))
return -ENOENT;
- /* Current channel */
- survey->channel = conf->chandef.chan;
+ mutex_lock(&hwsim->mutex);
+ survey->channel = hwsim->survey_data[idx].channel;
+ if (!survey->channel) {
+ mutex_unlock(&hwsim->mutex);
+ return -ENOENT;
+ }
/*
- * Magically conjured noise level --- this is only ok for simulated hardware.
+ * Magically conjured dummy values --- this is only ok for simulated hardware.
*
- * A real driver which cannot determine the real channel noise MUST NOT
- * report any noise, especially not a magically conjured one :-)
+ * A real driver which cannot determine real values noise MUST NOT
+ * report any, especially not a magically conjured ones :-)
*/
- survey->filled = SURVEY_INFO_NOISE_DBM;
+ survey->filled = SURVEY_INFO_NOISE_DBM |
+ SURVEY_INFO_CHANNEL_TIME |
+ SURVEY_INFO_CHANNEL_TIME_BUSY;
survey->noise = -92;
+ survey->channel_time =
+ jiffies_to_msecs(hwsim->survey_data[idx].end -
+ hwsim->survey_data[idx].start);
+ /* report 12.5% of channel time is used */
+ survey->channel_time_busy = survey->channel_time/8;
+ mutex_unlock(&hwsim->mutex);
return 0;
}
@@ -1986,6 +2027,10 @@ static void hw_scan_work(struct work_struct *work)
}
ieee80211_queue_delayed_work(hwsim->hw, &hwsim->hw_scan,
msecs_to_jiffies(dwell));
+ hwsim->survey_data[hwsim->scan_chan_idx].channel = hwsim->tmp_chan;
+ hwsim->survey_data[hwsim->scan_chan_idx].start = jiffies;
+ hwsim->survey_data[hwsim->scan_chan_idx].end =
+ jiffies + msecs_to_jiffies(dwell);
hwsim->scan_chan_idx++;
mutex_unlock(&hwsim->mutex);
}
@@ -2011,6 +2056,7 @@ static int mac80211_hwsim_hw_scan(struct ieee80211_hw *hw,
hw_req->req.mac_addr_mask);
else
memcpy(hwsim->scan_addr, vif->addr, ETH_ALEN);
+ memset(hwsim->survey_data, 0, sizeof(hwsim->survey_data));
mutex_unlock(&hwsim->mutex);
wiphy_debug(hw->wiphy, "hwsim hw_scan request\n");
@@ -2057,6 +2103,7 @@ static void mac80211_hwsim_sw_scan(struct ieee80211_hw *hw,
memcpy(hwsim->scan_addr, mac_addr, ETH_ALEN);
hwsim->scanning = true;
+ memset(hwsim->survey_data, 0, sizeof(hwsim->survey_data));
out:
mutex_unlock(&hwsim->mutex);
--
2.9.3
^ permalink raw reply related
* [PATCH v2] ath10k: Remove return statement from a void function
From: Marcin Rokicki @ 2017-02-21 10:28 UTC (permalink / raw)
To: ath10k; +Cc: linux-wireless, arend.vanspriel
The empty 'return;' statement in a void function should be
used to return from somewhere else than the end.
Signed-off-by: Marcin Rokicki <marcin.rokicki@tieto.com>
---
Changes for v2
-remove only return statement instead of empty err label
which can be used in the future
---
drivers/net/wireless/ath/ath10k/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 59729aa..a22d3c9 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -2311,7 +2311,7 @@ static void ath10k_core_register_work(struct work_struct *work)
/* TODO: It's probably a good idea to release device from the driver
* but calling device_release_driver() here will cause a deadlock.
*/
- return;
+ ;
}
int ath10k_core_register(struct ath10k *ar, u32 chip_id)
--
2.7.4
^ permalink raw reply related
* [RFC] nl80211/cfg80211: Add API for setting the PMK to the driver
From: Johannes Berg @ 2017-02-21 10:26 UTC (permalink / raw)
To: linux-wireless; +Cc: Arend Van Spriel, Avraham Stern
From: Avraham Stern <avraham.stern@intel.com>
Add API for setting the PMK to the driver. For FT support, allow
setting also the PMK-R0 Name.
This can be used by drivers that support 4-Way handshake offload
while IEEE802.1X authentication is managed by upper layers.
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
We reused the PSK feature bit here since the 4-way-HS is the same,
but perhaps we should split it if some firmware/driver can't or
doesn't want to implement both?
---
include/linux/ieee80211.h | 3 ++
include/net/cfg80211.h | 27 ++++++++++++
include/uapi/linux/nl80211.h | 23 ++++++++--
net/wireless/nl80211.c | 99 ++++++++++++++++++++++++++++++++++++++++++++
net/wireless/rdev-ops.h | 25 +++++++++++
net/wireless/trace.h | 60 +++++++++++++++++++++++++++
6 files changed, 234 insertions(+), 3 deletions(-)
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 2049e983a994..fb1f533e75b3 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -2356,8 +2356,11 @@ enum ieee80211_sa_query_action {
#define WLAN_MAX_KEY_LEN 32
+#define WLAN_PMK_NAME_LEN 16
#define WLAN_PMKID_LEN 16
+#define WLAN_PMK_LEN_EAP_LEAP 16
#define WLAN_PMK_LEN 32
+#define WLAN_PMK_LEN_SUITE_B_192 48
#define WLAN_OUI_WFA 0x506f9a
#define WLAN_OUI_TYPE_WFA_P2P 9
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 4ca968927d60..a68c6db6ac55 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2507,6 +2507,23 @@ struct cfg80211_nan_func {
};
/**
+ * struct cfg80211_pmk_conf - PMK configuration
+ *
+ * @aa: authenticator address
+ * @pmk_len: PMK length in bytes.
+ * @pmk: the PMK material
+ * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
+ * is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
+ * holds PMK-R0.
+ */
+struct cfg80211_pmk_conf {
+ const u8 *aa;
+ u8 pmk_len;
+ const u8 *pmk;
+ const u8 *pmk_r0_name;
+};
+
+/**
* struct cfg80211_ops - backend description for wireless configuration
*
* This struct is registered by fullmac card drivers and/or wireless stacks
@@ -2823,6 +2840,11 @@ struct cfg80211_nan_func {
* All other parameters must be ignored.
*
* @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
+ *
+ * @set_pmk: configure the PMK to be used for offloaded 4-Way handshake.
+ * (invoked with the wireless_dev mutex held)
+ * @del_pmk: delete the previously configured PMK for the given authenticator.
+ * (invoked with the wireless_dev mutex held)
*/
struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -3111,6 +3133,11 @@ struct cfg80211_ops {
int (*set_multicast_to_unicast)(struct wiphy *wiphy,
struct net_device *dev,
const bool enabled);
+
+ int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
+ const struct cfg80211_pmk_conf *conf);
+ int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
+ const u8 *aa);
};
/*
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index ba102c937750..6ca7fb4a3d71 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -901,6 +901,14 @@
* does not result in a change for the current association. Currently,
* only the %NL80211_ATTR_IE data is used and updated with this command.
*
+ * @NL80211_CMD_SET_PMK: For offloaded 4-Way handshake, set the PMK or PMK-R0
+ * for the given authenticator address (specified with &NL80211_ATTR_MAC).
+ * When &NL80211_ATTR_PMKR0_NAME is set, &NL80211_ATTR_PMK specifies the
+ * PMK-R0, otherwise it specifies the PMK.
+ * @NL80211_CMD_DEL_PMK: For offloaded 4-Way handshake, delete the previously
+ * configured PMK for the authenticator address identified by
+ * &NL80211_ATTR_MAC.
+ *
* @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use
*/
@@ -1100,6 +1108,9 @@ enum nl80211_commands {
NL80211_CMD_UPDATE_CONNECT_PARAMS,
+ NL80211_CMD_SET_PMK,
+ NL80211_CMD_DEL_PMK,
+
/* add new commands above here */
/* used to define NL80211_CMD_MAX below */
@@ -2012,8 +2023,12 @@ enum nl80211_commands {
* u32 attribute with an &enum nl80211_timeout_reason value. This is used,
* e.g., with %NL80211_CMD_CONNECT event.
*
- * @NL80211_ATTR_PMK: PSK for offloaded 4-Way Handshake. Relevant only
- * with %NL80211_CMD_CONNECT (for WPA/WPA2-PSK networks).
+ * @NL80211_ATTR_PMK: PMK for offloaded 4-Way Handshake. Relevant with
+ * %NL80211_CMD_CONNECT (for WPA/WPA2-PSK networks) when PSK is used, or
+ * with %NL80211_CMD_SET_PMK when 802.1X authentication is used.
+ * When &NL80211_ATTR_PMKR0_NAME is specified, this attribute specifies
+ * the PMK-R0.
+ * @NL80211_ATTR_PMKR0_NAME: PMK-R0 Name for offloaded FT.
*
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
@@ -2427,6 +2442,7 @@ enum nl80211_attrs {
NL80211_ATTR_TIMEOUT_REASON,
NL80211_ATTR_PMK,
+ NL80211_ATTR_PMKR0_NAME,
/* add attributes here, update the policy in nl80211.c */
@@ -4766,7 +4782,8 @@ enum nl80211_feature_flags {
* RSSI threshold values to monitor rather than exactly one threshold.
* @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_OFFLOAD_STA: Device supports
* doing 4-way handshake in station mode (PSK is passed as part
- * of the connect command).
+ * of the connect command and the PMK for 802.1X is set with the
+ * %NL80211_CMD_SET_PMK command.)
*
* @NUM_NL80211_EXT_FEATURES: number of extended features.
* @MAX_NL80211_EXT_FEATURES: highest extended feature index.
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 34b551edbc4f..a78bc4c27ed0 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -12075,6 +12075,90 @@ static int nl80211_set_multicast_to_unicast(struct sk_buff *skb,
return rdev_set_multicast_to_unicast(rdev, dev, enabled);
}
+static int nl80211_set_pmk(struct sk_buff *skb, struct genl_info *info)
+{
+ struct cfg80211_registered_device *rdev = info->user_ptr[0];
+ struct net_device *dev = info->user_ptr[1];
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+ struct cfg80211_pmk_conf pmk_conf = {};
+ int ret;
+
+ if (wdev->iftype != NL80211_IFTYPE_STATION &&
+ wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)
+ return -EOPNOTSUPP;
+
+ if (!wiphy_ext_feature_isset(&rdev->wiphy,
+ NL80211_EXT_FEATURE_4WAY_HANDSHAKE_OFFLOAD_STA))
+ return -EOPNOTSUPP;
+
+ if (!info->attrs[NL80211_ATTR_MAC] || !info->attrs[NL80211_ATTR_PMK])
+ return -EINVAL;
+
+ wdev_lock(wdev);
+ if (!wdev->current_bss) {
+ ret = -ENOTCONN;
+ goto out;
+ }
+
+ pmk_conf.aa = nla_data(info->attrs[NL80211_ATTR_MAC]);
+ if (memcmp(pmk_conf.aa, wdev->current_bss->pub.bssid, ETH_ALEN)) {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ pmk_conf.pmk = nla_data(info->attrs[NL80211_ATTR_PMK]);
+ pmk_conf.pmk_len = nla_len(info->attrs[NL80211_ATTR_PMK]);
+ if (pmk_conf.pmk_len != WLAN_PMK_LEN &&
+ pmk_conf.pmk_len != WLAN_PMK_LEN_SUITE_B_192) {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if (info->attrs[NL80211_ATTR_PMKR0_NAME]) {
+ int r0_name_len = nla_len(info->attrs[NL80211_ATTR_PMKR0_NAME]);
+
+ if (r0_name_len != WLAN_PMK_NAME_LEN) {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ pmk_conf.pmk_r0_name =
+ nla_data(info->attrs[NL80211_ATTR_PMKR0_NAME]);
+ }
+
+ ret = rdev_set_pmk(rdev, dev, &pmk_conf);
+out:
+ wdev_unlock(wdev);
+ return ret;
+}
+
+static int nl80211_del_pmk(struct sk_buff *skb, struct genl_info *info)
+{
+ struct cfg80211_registered_device *rdev = info->user_ptr[0];
+ struct net_device *dev = info->user_ptr[1];
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+ const u8 *aa;
+ int ret;
+
+ if (wdev->iftype != NL80211_IFTYPE_STATION &&
+ wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)
+ return -EOPNOTSUPP;
+
+ if (!wiphy_ext_feature_isset(&rdev->wiphy,
+ NL80211_EXT_FEATURE_4WAY_HANDSHAKE_OFFLOAD_STA))
+ return -EOPNOTSUPP;
+
+ if (!info->attrs[NL80211_ATTR_MAC])
+ return -EINVAL;
+
+ wdev_lock(wdev);
+ aa = nla_data(info->attrs[NL80211_ATTR_MAC]);
+ ret = rdev_del_pmk(rdev, dev, aa);
+ wdev_unlock(wdev);
+
+ return ret;
+}
+
#define NL80211_FLAG_NEED_WIPHY 0x01
#define NL80211_FLAG_NEED_NETDEV 0x02
#define NL80211_FLAG_NEED_RTNL 0x04
@@ -12950,6 +13034,21 @@ static const struct genl_ops nl80211_ops[] = {
.internal_flags = NL80211_FLAG_NEED_NETDEV |
NL80211_FLAG_NEED_RTNL,
},
+ {
+ .cmd = NL80211_CMD_SET_PMK,
+ .doit = nl80211_set_pmk,
+ .policy = nl80211_policy,
+ .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
+ NL80211_FLAG_NEED_RTNL,
+ },
+ {
+ .cmd = NL80211_CMD_DEL_PMK,
+ .doit = nl80211_del_pmk,
+ .policy = nl80211_policy,
+ .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
+ NL80211_FLAG_NEED_RTNL,
+ },
+
};
static struct genl_family nl80211_fam __ro_after_init = {
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index f2baf5921091..06698552f1f2 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -1165,4 +1165,29 @@ rdev_set_coalesce(struct cfg80211_registered_device *rdev,
trace_rdev_return_int(&rdev->wiphy, ret);
return ret;
}
+
+static inline int rdev_set_pmk(struct cfg80211_registered_device *rdev,
+ struct net_device *dev,
+ struct cfg80211_pmk_conf *pmk_conf)
+{
+ int ret = -EOPNOTSUPP;
+
+ trace_rdev_set_pmk(&rdev->wiphy, dev, pmk_conf);
+ if (rdev->ops->set_pmk)
+ ret = rdev->ops->set_pmk(&rdev->wiphy, dev, pmk_conf);
+ trace_rdev_return_int(&rdev->wiphy, ret);
+ return ret;
+}
+
+static inline int rdev_del_pmk(struct cfg80211_registered_device *rdev,
+ struct net_device *dev, const u8 *aa)
+{
+ int ret = -EOPNOTSUPP;
+
+ trace_rdev_del_pmk(&rdev->wiphy, dev, aa);
+ if (rdev->ops->del_pmk)
+ ret = rdev->ops->del_pmk(&rdev->wiphy, dev, aa);
+ trace_rdev_return_int(&rdev->wiphy, ret);
+ return ret;
+}
#endif /* __CFG80211_RDEV_OPS */
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index fd55786f0462..47a5e8d4b113 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -2252,6 +2252,66 @@ TRACE_EVENT(rdev_tdls_cancel_channel_switch,
WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(addr))
);
+TRACE_EVENT(rdev_set_pmk,
+ TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
+ struct cfg80211_pmk_conf *pmk_conf),
+
+ TP_ARGS(wiphy, netdev, pmk_conf),
+
+ TP_STRUCT__entry(
+ WIPHY_ENTRY
+ NETDEV_ENTRY
+ MAC_ENTRY(aa)
+ __field(u8, pmk_len)
+ __field(u8, pmk_r0_name_len)
+ __dynamic_array(u8, pmk, pmk_conf->pmk_len)
+ __dynamic_array(u8, pmk_r0_name, WLAN_PMK_NAME_LEN)
+ ),
+
+ TP_fast_assign(
+ WIPHY_ASSIGN;
+ NETDEV_ASSIGN;
+ MAC_ASSIGN(aa, pmk_conf->aa);
+ __entry->pmk_len = pmk_conf->pmk_len;
+ __entry->pmk_r0_name_len =
+ pmk_conf->pmk_r0_name ? WLAN_PMK_NAME_LEN : 0;
+ memcpy(__get_dynamic_array(pmk), pmk_conf->pmk,
+ pmk_conf->pmk_len);
+ memcpy(__get_dynamic_array(pmk_r0_name), pmk_conf->pmk_r0_name,
+ pmk_conf->pmk_r0_name ? WLAN_PMK_NAME_LEN : 0);
+ ),
+
+ TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " MAC_PR_FMT
+ "pmk_len=%u, pmk: %s pmk_r0_name: %s", WIPHY_PR_ARG,
+ NETDEV_PR_ARG, MAC_PR_ARG(aa), __entry->pmk_len,
+ __print_array(__get_dynamic_array(pmk),
+ __get_dynamic_array_len(pmk), 1),
+ __entry->pmk_r0_name_len ?
+ __print_array(__get_dynamic_array(pmk_r0_name),
+ __get_dynamic_array_len(pmk_r0_name), 1) : "")
+);
+
+TRACE_EVENT(rdev_del_pmk,
+ TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, const u8 *aa),
+
+ TP_ARGS(wiphy, netdev, aa),
+
+ TP_STRUCT__entry(
+ WIPHY_ENTRY
+ NETDEV_ENTRY
+ MAC_ENTRY(aa)
+ ),
+
+ TP_fast_assign(
+ WIPHY_ASSIGN;
+ NETDEV_ASSIGN;
+ MAC_ASSIGN(aa, aa);
+ ),
+
+ TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " MAC_PR_FMT,
+ WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(aa))
+);
+
/*************************************************************
* cfg80211 exported functions traces *
*************************************************************/
--
2.9.3
^ permalink raw reply related
* [PATCH] cfg80211: support 4-way handshake offloading for WPA/WPA2-PSK
From: Johannes Berg @ 2017-02-21 10:09 UTC (permalink / raw)
To: linux-wireless; +Cc: Arend Van Spriel, Eliad Peller
From: Eliad Peller <eliad@wizery.com>
Let drivers advertise support for station-mode 4-way handshake
offloading with a new NL80211_EXT_FEATURE_4WAY_HANDSHAKE_OFFLOAD_STA
flag.
Add a new NL80211_ATTR_PMK attribute that might be passed as part
of NL80211_CMD_CONNECT command, and contain the PSK (which is the
PMK, hence the name.)
The driver/device is assumed to handle the 4-way handshake by
itself in this case (including key derivations, etc.), instead
of relying on the supplicant.
This patch is somewhat based on this one (by Vladimir Kondratiev):
https://patchwork.kernel.org/patch/1309561/.
Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
include/linux/ieee80211.h | 1 +
include/net/cfg80211.h | 2 ++
include/uapi/linux/nl80211.h | 9 +++++++++
net/wireless/nl80211.c | 8 ++++++++
4 files changed, 20 insertions(+)
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 6ea381c98aae..2049e983a994 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -2357,6 +2357,7 @@ enum ieee80211_sa_query_action {
#define WLAN_MAX_KEY_LEN 32
#define WLAN_PMKID_LEN 16
+#define WLAN_PMK_LEN 32
#define WLAN_OUI_WFA 0x506f9a
#define WLAN_OUI_TYPE_WFA_P2P 9
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 86c12f85fb53..4ca968927d60 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -643,6 +643,7 @@ struct survey_info {
* @wep_keys: static WEP keys, if not NULL points to an array of
* CFG80211_MAX_WEP_KEYS WEP keys
* @wep_tx_key: key index (0..3) of the default TX static WEP key
+ * @psk: PSK (for devices supporting 4-way-handshake offload)
*/
struct cfg80211_crypto_settings {
u32 wpa_versions;
@@ -656,6 +657,7 @@ struct cfg80211_crypto_settings {
bool control_port_no_encrypt;
struct key_params *wep_keys;
int wep_tx_key;
+ const u8 *psk;
};
/**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 9a499b15cfbc..ba102c937750 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2012,6 +2012,9 @@ enum nl80211_commands {
* u32 attribute with an &enum nl80211_timeout_reason value. This is used,
* e.g., with %NL80211_CMD_CONNECT event.
*
+ * @NL80211_ATTR_PMK: PSK for offloaded 4-Way Handshake. Relevant only
+ * with %NL80211_CMD_CONNECT (for WPA/WPA2-PSK networks).
+ *
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2423,6 +2426,8 @@ enum nl80211_attrs {
NL80211_ATTR_TIMEOUT_REASON,
+ NL80211_ATTR_PMK,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
@@ -4759,6 +4764,9 @@ enum nl80211_feature_flags {
* @NL80211_EXT_FEATURE_CQM_RSSI_LIST: With this driver the
* %NL80211_ATTR_CQM_RSSI_THOLD attribute accepts a list of zero or more
* RSSI threshold values to monitor rather than exactly one threshold.
+ * @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_OFFLOAD_STA: Device supports
+ * doing 4-way handshake in station mode (PSK is passed as part
+ * of the connect command).
*
* @NUM_NL80211_EXT_FEATURES: number of extended features.
* @MAX_NL80211_EXT_FEATURES: highest extended feature index.
@@ -4778,6 +4786,7 @@ enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA_CONNECTED,
NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI,
NL80211_EXT_FEATURE_CQM_RSSI_LIST,
+ NL80211_EXT_FEATURE_4WAY_HANDSHAKE_OFFLOAD_STA,
/* add new features before the definition below */
NUM_NL80211_EXT_FEATURES,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d516527fcb8e..34b551edbc4f 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -410,6 +410,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
.len = sizeof(struct nl80211_bss_select_rssi_adjust)
},
[NL80211_ATTR_TIMEOUT_REASON] = { .type = NLA_U32 },
+ [NL80211_ATTR_PMK] = { .len = WLAN_PMK_LEN },
};
/* policy for the key attributes */
@@ -8039,6 +8040,13 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
memcpy(settings->akm_suites, data, len);
}
+ if (info->attrs[NL80211_ATTR_PMK]) {
+ if (!wiphy_ext_feature_isset(&rdev->wiphy,
+ NL80211_EXT_FEATURE_4WAY_HANDSHAKE_OFFLOAD_STA))
+ return -EINVAL;
+ settings->psk = nla_data(info->attrs[NL80211_ATTR_PMK]);
+ }
+
return 0;
}
--
2.9.3
^ permalink raw reply related
* Re: [PATCH V3 2/2] brcmfmac: don't warn user about NVRAM if fallback to platform one succeeds
From: Arend Van Spriel @ 2017-02-21 9:57 UTC (permalink / raw)
To: Rafał Miłecki, Ming Lei, Luis R . Rodriguez, Greg KH,
Linux Kernel Mailing List
Cc: Kalle Valo, linux-wireless, brcm80211-dev-list.pdl,
Rafał Miłecki
In-Reply-To: <20170221094754.15406-2-zajec5@gmail.com>
On 21-2-2017 10:47, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
>
> Failing to load NVRAM file isn't critical if we manage to get platform
> one in the fallback path. It means warnings like:
> [ 10.801506] brcmfmac 0000:01:00.0: Direct firmware load for brcm/brcmfmac43602-pcie.txt failed with error -2
> are unnecessary & disturbing for people with platform NVRAM. This is
> very common case for Broadcom home routers.
>
> So instead of printing warning immediately with the firmware subsystem
> let's first try our fallback code. If that fails as well, then it's a
> right moment to print an error.
>
> This should reduce amount of false reports from users seeing this
> warning while having wireless working perfectly fine.
I think FW_OPT_NO_WARN does not cover all warnings in firmware_class
although I did not check. Anyway...
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
> V2: Update commit message as it wasn't clear enough (thanks Andy) & add extra
> messages to the firmware.c.
> V3: Set FW_OPT_UEVENT to don't change behavior
>
> Kalle, Arend: this patch is strictly related to the bigger 1/2. Could you ack
> this change as I expect this patchset to be picked by Ming, Luis or Greg?
> ---
> .../net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 17 ++++++++++++-----
> 1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
> index c7c1e9906500..6dbcceff2529 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
> @@ -462,8 +462,14 @@ static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
> raw_nvram = false;
> } else {
> data = bcm47xx_nvram_get_contents(&data_len);
> - if (!data && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
> - goto fail;
> + if (!data) {
> + brcmf_dbg(TRACE, "Failed to get platform NVRAM\n");
> + if (!(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL)) {
> + brcmf_err("Loading NVRAM from %s and using platform one both failed\n",
> + fwctx->nvram_name);
> + goto fail;
> + }
> + }
> raw_nvram = true;
> }
>
> @@ -504,9 +510,10 @@ static void brcmf_fw_request_code_done(const struct firmware *fw, void *ctx)
> return;
> }
> fwctx->code = fw;
> - ret = request_firmware_nowait(THIS_MODULE, true, fwctx->nvram_name,
> - fwctx->dev, GFP_KERNEL, fwctx,
> - brcmf_fw_request_nvram_done);
> + ret = request_firmware_async(THIS_MODULE,
> + FW_OPT_UEVENT | FW_OPT_NO_WARN,
> + fwctx->nvram_name, fwctx->dev, GFP_KERNEL,
> + fwctx, brcmf_fw_request_nvram_done);
^ permalink raw reply
* [PATCH V3 2/2] brcmfmac: don't warn user about NVRAM if fallback to platform one succeeds
From: Rafał Miłecki @ 2017-02-21 9:47 UTC (permalink / raw)
To: Ming Lei, Luis R . Rodriguez, Greg KH, Linux Kernel Mailing List
Cc: Kalle Valo, Arend van Spriel, linux-wireless,
brcm80211-dev-list.pdl, Rafał Miłecki
In-Reply-To: <20170221094754.15406-1-zajec5@gmail.com>
From: Rafał Miłecki <rafal@milecki.pl>
Failing to load NVRAM file isn't critical if we manage to get platform
one in the fallback path. It means warnings like:
[ 10.801506] brcmfmac 0000:01:00.0: Direct firmware load for brcm/brcmfmac43602-pcie.txt failed with error -2
are unnecessary & disturbing for people with platform NVRAM. This is
very common case for Broadcom home routers.
So instead of printing warning immediately with the firmware subsystem
let's first try our fallback code. If that fails as well, then it's a
right moment to print an error.
This should reduce amount of false reports from users seeing this
warning while having wireless working perfectly fine.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
V2: Update commit message as it wasn't clear enough (thanks Andy) & add extra
messages to the firmware.c.
V3: Set FW_OPT_UEVENT to don't change behavior
Kalle, Arend: this patch is strictly related to the bigger 1/2. Could you ack
this change as I expect this patchset to be picked by Ming, Luis or Greg?
---
.../net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
index c7c1e9906500..6dbcceff2529 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
@@ -462,8 +462,14 @@ static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
raw_nvram = false;
} else {
data = bcm47xx_nvram_get_contents(&data_len);
- if (!data && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
- goto fail;
+ if (!data) {
+ brcmf_dbg(TRACE, "Failed to get platform NVRAM\n");
+ if (!(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL)) {
+ brcmf_err("Loading NVRAM from %s and using platform one both failed\n",
+ fwctx->nvram_name);
+ goto fail;
+ }
+ }
raw_nvram = true;
}
@@ -504,9 +510,10 @@ static void brcmf_fw_request_code_done(const struct firmware *fw, void *ctx)
return;
}
fwctx->code = fw;
- ret = request_firmware_nowait(THIS_MODULE, true, fwctx->nvram_name,
- fwctx->dev, GFP_KERNEL, fwctx,
- brcmf_fw_request_nvram_done);
+ ret = request_firmware_async(THIS_MODULE,
+ FW_OPT_UEVENT | FW_OPT_NO_WARN,
+ fwctx->nvram_name, fwctx->dev, GFP_KERNEL,
+ fwctx, brcmf_fw_request_nvram_done);
if (!ret)
return;
--
2.11.0
^ permalink raw reply related
* [PATCH V3 1/2] firmware: add more flexible request_firmware_async function
From: Rafał Miłecki @ 2017-02-21 9:47 UTC (permalink / raw)
To: Ming Lei, Luis R . Rodriguez, Greg KH, Linux Kernel Mailing List
Cc: Kalle Valo, Arend van Spriel, linux-wireless,
brcm80211-dev-list.pdl, Rafał Miłecki
In-Reply-To: <20170216072636.7128-1-zajec5@gmail.com>
From: Rafał Miłecki <rafal@milecki.pl>
So far we got only one function for loading firmware asynchronously:
request_firmware_nowait. It didn't allow much customization of firmware
loading process - there is only one bool uevent argument. Moreover this
bool also controls user helper in an unclear way.
Resolve this problem by adding a one flexible function and making old
request_firmware_nowait a simple inline using new solution. This
implementation:
1) Modifies only single bits on existing code
2) Doesn't require adjusting / rewriting current drivers
3) Adds new function for drivers that need more control over loading a
firmware. Thanks to using flags more features can be added later.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
This patch is based on top of
[PATCH V2 RESEND] firmware: simplify defining and handling FW_OPT_FALLBACK
applied on top of Linux 4.10-rc8.
Ming/Luis/Greg: assuming this gets a positive review, could someone of you pick
this patchset? Second patch modifies brcmfmac, I'll try to get a proper Ack for
that one.
Unless you want this to go through wireless tree, then let me know please.
---
drivers/base/firmware_class.c | 25 ++++++-------------------
include/linux/firmware.h | 34 +++++++++++++++++++++++++++++-----
2 files changed, 35 insertions(+), 24 deletions(-)
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index d05be1732c8b..7b3f0a018dc3 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -182,18 +182,6 @@ static int __fw_state_check(struct fw_state *fw_st, enum fw_status status)
#endif /* CONFIG_FW_LOADER_USER_HELPER */
-/* firmware behavior options */
-#define FW_OPT_UEVENT (1U << 0)
-#define FW_OPT_NOWAIT (1U << 1)
-#ifdef CONFIG_FW_LOADER_USER_HELPER
-#define FW_OPT_USERHELPER (1U << 2)
-#else
-#define FW_OPT_USERHELPER 0
-#endif
-#define FW_OPT_NO_WARN (1U << 3)
-#define FW_OPT_NOCACHE (1U << 4)
-#define FW_OPT_FALLBACK (1U << 5)
-
struct firmware_cache {
/* firmware_buf instance will be added into the below list */
spinlock_t lock;
@@ -1356,7 +1344,7 @@ static void request_firmware_work_func(struct work_struct *work)
_request_firmware(&fw, fw_work->name, fw_work->device, NULL, 0,
fw_work->opt_flags);
fw_work->cont(fw, fw_work->context);
- put_device(fw_work->device); /* taken in request_firmware_nowait() */
+ put_device(fw_work->device); /* taken in request_firmware_async() */
module_put(fw_work->module);
kfree_const(fw_work->name);
@@ -1364,7 +1352,7 @@ static void request_firmware_work_func(struct work_struct *work)
}
/**
- * request_firmware_nowait - asynchronous version of request_firmware
+ * request_firmware_async - asynchronous version of request_firmware
* @module: module requesting the firmware
* @uevent: sends uevent to copy the firmware image if this flag
* is non-zero else the firmware copy must be done manually.
@@ -1387,8 +1375,8 @@ static void request_firmware_work_func(struct work_struct *work)
* - can't sleep at all if @gfp is GFP_ATOMIC.
**/
int
-request_firmware_nowait(
- struct module *module, bool uevent,
+request_firmware_async(
+ struct module *module, unsigned int opt_flags,
const char *name, struct device *device, gfp_t gfp, void *context,
void (*cont)(const struct firmware *fw, void *context))
{
@@ -1407,8 +1395,7 @@ request_firmware_nowait(
fw_work->device = device;
fw_work->context = context;
fw_work->cont = cont;
- fw_work->opt_flags = FW_OPT_NOWAIT | FW_OPT_FALLBACK |
- (uevent ? FW_OPT_UEVENT : FW_OPT_USERHELPER);
+ fw_work->opt_flags = FW_OPT_NOWAIT | opt_flags;
if (!try_module_get(module)) {
kfree_const(fw_work->name);
@@ -1421,7 +1408,7 @@ request_firmware_nowait(
schedule_work(&fw_work->work);
return 0;
}
-EXPORT_SYMBOL(request_firmware_nowait);
+EXPORT_SYMBOL(request_firmware_async);
#ifdef CONFIG_PM_SLEEP
static ASYNC_DOMAIN_EXCLUSIVE(fw_cache_domain);
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index b1f9f0ccb8ac..1f2bf14aa441 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -8,6 +8,18 @@
#define FW_ACTION_NOHOTPLUG 0
#define FW_ACTION_HOTPLUG 1
+/* firmware behavior options */
+#define FW_OPT_UEVENT (1U << 0)
+#define FW_OPT_NOWAIT (1U << 1)
+#ifdef CONFIG_FW_LOADER_USER_HELPER
+#define FW_OPT_USERHELPER (1U << 2)
+#else
+#define FW_OPT_USERHELPER 0
+#endif
+#define FW_OPT_NO_WARN (1U << 3)
+#define FW_OPT_NOCACHE (1U << 4)
+#define FW_OPT_FALLBACK (1U << 5)
+
struct firmware {
size_t size;
const u8 *data;
@@ -41,8 +53,8 @@ struct builtin_fw {
#if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE))
int request_firmware(const struct firmware **fw, const char *name,
struct device *device);
-int request_firmware_nowait(
- struct module *module, bool uevent,
+int request_firmware_async(
+ struct module *module, unsigned int opt_flags,
const char *name, struct device *device, gfp_t gfp, void *context,
void (*cont)(const struct firmware *fw, void *context));
int request_firmware_direct(const struct firmware **fw, const char *name,
@@ -58,8 +70,8 @@ static inline int request_firmware(const struct firmware **fw,
{
return -EINVAL;
}
-static inline int request_firmware_nowait(
- struct module *module, bool uevent,
+static inline int request_firmware_async(
+ struct module *module, unsigned int opt_flags,
const char *name, struct device *device, gfp_t gfp, void *context,
void (*cont)(const struct firmware *fw, void *context))
{
@@ -82,6 +94,18 @@ static inline int request_firmware_into_buf(const struct firmware **firmware_p,
{
return -EINVAL;
}
-
#endif
+
+static inline int request_firmware_nowait(
+ struct module *module, bool uevent,
+ const char *name, struct device *device, gfp_t gfp, void *context,
+ void (*cont)(const struct firmware *fw, void *context))
+{
+ unsigned int opt_flags = FW_OPT_FALLBACK |
+ (uevent ? FW_OPT_UEVENT : FW_OPT_USERHELPER);
+
+ return request_firmware_async(module, opt_flags, name, device, gfp,
+ context, cont);
+}
+
#endif
--
2.11.0
^ permalink raw reply related
* Re: [PATCH] ath10k: Remove return statement from a void function
From: Arend Van Spriel @ 2017-02-21 9:44 UTC (permalink / raw)
To: Marcin Rokicki, ath10k; +Cc: linux-wireless
In-Reply-To: <1487667873-3493-1-git-send-email-marcin.rokicki@tieto.com>
On 21-2-2017 10:04, Marcin Rokicki wrote:
> The empty 'return;' statement in a void function should be
> used to return from somewhere else then the end.
>
> Signed-off-by: Marcin Rokicki <marcin.rokicki@tieto.com>
> ---
> drivers/net/wireless/ath/ath10k/core.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
> index 59729aa..d65850e 100644
> --- a/drivers/net/wireless/ath/ath10k/core.c
> +++ b/drivers/net/wireless/ath/ath10k/core.c
> @@ -2268,7 +2268,7 @@ static void ath10k_core_register_work(struct work_struct *work)
> status = ath10k_core_probe_fw(ar);
> if (status) {
> ath10k_err(ar, "could not probe fw (%d)\n", status);
> - goto err;
> + return;
The subject seems misleading as you add a return here. Also removing the
goto will break the desired behavior as expressed in the TODO below.
> }
>
> status = ath10k_mac_register(ar);
> @@ -2307,11 +2307,10 @@ static void ath10k_core_register_work(struct work_struct *work)
> ath10k_mac_unregister(ar);
> err_release_fw:
> ath10k_core_free_firmware_files(ar);
> -err:
> - /* TODO: It's probably a good idea to release device from the driver
> - * but calling device_release_driver() here will cause a deadlock.
> - */
> - return;
So to me removing this return statement and no more is sufficient for
this patch. Just leave the label and TODO comment in place or fix it
properly by scheduling a "release driver" work here or whatever is
needed to prevent the deadlock.
Regards,
Arend
> +
> +/* TODO: It's probably a good idea to release device from the driver
> + * but calling device_release_driver() here will cause a deadlock.
> + */
> }
>
> int ath10k_core_register(struct ath10k *ar, u32 chip_id)
>
^ permalink raw reply
* Re: wpa psk offloading
From: Johannes Berg @ 2017-02-21 9:42 UTC (permalink / raw)
To: Arend Van Spriel; +Cc: linux-wireless, Kalle Valo, Avery Pennarun
In-Reply-To: <11aeb0b3-5c44-32d5-c73a-c809f3d53c9f@broadcom.com>
On Tue, 2017-02-21 at 10:20 +0100, Arend Van Spriel wrote:
> Hi Johannes,
>
> Internally I am asked to look at "pmk plumbing" patches allowing
> firmware to deal with 4-way handshake. Now I noticed this topic being
> discussed during last wireless workshop in Santa Fe [1].
>
> I do not recall any follow-up after that. At least no concrete
> patches, right? Also in wpa_supplicant there is already a solution
> using QCA vendor command. Should we aim to adopt just that or are
> there issues/requirements not covered by that.
I don't think we should adopt a QCA vendor command as the official
solution :)
We do have a patch internally, I'll send it out - we just haven't
managed to release the driver for it yet.
johannes
^ permalink raw reply
* ath10k regression on XPS13
From: Kalle Valo @ 2017-02-21 9:32 UTC (permalink / raw)
To: Linus Torvalds
Cc: Jiri Kosina, Linux Kernel Mailing List, ath10k, linux-wireless,
davem
In-Reply-To: <CA+55aFxLmgA7drrGfUJmCRPT-A74ROYf6GQHFGO5pzVjZ0dL7Q@mail.gmail.com>
(Changing subject, adding Dave and relevant lists)
Linus Torvalds <torvalds@linux-foundation.org> writes:
> On Mon, Feb 20, 2017 at 7:20 AM, Jiri Kosina <jikos@kernel.org> wrote:
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git for-linus
>>
>> to receive HID subsystem updates for 4.11:
>
> The touchpad on my XPS13 no longer works. It might not be this pull
> request, and I'll bisect the exact cause, but this pull seems the most
> likely culprit.
>
> Just an early heads-up,
While talking about XPS13 also a heads-up from me as we have a nasty
regression in ath10k on XPS13 with QCA6174 (though not sure if you have
QCA6174, recent models seem to have that) which completely breaks driver
initialisation an error:
"ath10k_pci 0000:3a:00.0: failed to fetch board data for
bus=pci,vendor=168c,device=003e,subsystem-vendor=1a56,subsystem-device=1535,variant=RV_0520
from ath10k/QCA6174/hw3.0/board-2.bin"
https://bugzilla.kernel.org/show_bug.cgi?id=185621#c9
This is caused by this commit which I believe Dave will be sending to
you soon:
f2593cb1b291 ath10k: Search SMBIOS for OEM board file extension
As a workaround I recommend updating ath10k/QCA6174/hw3.0/board-2.bin
from this link _before_ updating the kernel:
https://github.com/kvalo/ath10k-firmware/blob/8d15818b0f9c7b09f743538ac2d3e1409779f52a/QCA6174/hw3.0/board-2.bin
We are working on a fix so that ath10k continues to work with older
board-2.bin, but that might take a day or two still.
--
Kalle Valo
^ permalink raw reply
* wpa psk offloading
From: Arend Van Spriel @ 2017-02-21 9:20 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Kalle Valo, Avery Pennarun
Hi Johannes,
Internally I am asked to look at "pmk plumbing" patches allowing
firmware to deal with 4-way handshake. Now I noticed this topic being
discussed during last wireless workshop in Santa Fe [1].
I do not recall any follow-up after that. At least no concrete patches,
right? Also in wpa_supplicant there is already a solution using QCA
vendor command. Should we aim to adopt just that or are there
issues/requirements not covered by that.
Regards,
Arend
[1]
https://docs.google.com/document/u/1/d/e/2PACX-1vQXbVQ-3zQt3Bcr3OWfwzbw_C49tTvf0ed8Hmf7b20E6tXc3a40tWZmPku49iGDE-OhgxNmO_lkkHEn/pub#h.kj1rq2w7lxdv
^ permalink raw reply
* [PATCH] ath10k: Remove return statement from a void function
From: Marcin Rokicki @ 2017-02-21 9:04 UTC (permalink / raw)
To: ath10k; +Cc: linux-wireless
The empty 'return;' statement in a void function should be
used to return from somewhere else then the end.
Signed-off-by: Marcin Rokicki <marcin.rokicki@tieto.com>
---
drivers/net/wireless/ath/ath10k/core.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 59729aa..d65850e 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -2268,7 +2268,7 @@ static void ath10k_core_register_work(struct work_struct *work)
status = ath10k_core_probe_fw(ar);
if (status) {
ath10k_err(ar, "could not probe fw (%d)\n", status);
- goto err;
+ return;
}
status = ath10k_mac_register(ar);
@@ -2307,11 +2307,10 @@ static void ath10k_core_register_work(struct work_struct *work)
ath10k_mac_unregister(ar);
err_release_fw:
ath10k_core_free_firmware_files(ar);
-err:
- /* TODO: It's probably a good idea to release device from the driver
- * but calling device_release_driver() here will cause a deadlock.
- */
- return;
+
+/* TODO: It's probably a good idea to release device from the driver
+ * but calling device_release_driver() here will cause a deadlock.
+ */
}
int ath10k_core_register(struct ath10k *ar, u32 chip_id)
--
2.7.4
^ permalink raw reply related
* Re: [PATCH v6 1/3] cfg80211: Accept multiple RSSI thresholds for CQM
From: Kalle Valo @ 2017-02-21 8:48 UTC (permalink / raw)
To: Andrew Zaborowski; +Cc: Johannes Berg, linux-wireless
In-Reply-To: <CAOq732LwAs6bG5dPMuBWA7MnSMLSRyySEq-2y2niDU0ZsFRNfA@mail.gmail.com>
Andrew Zaborowski <andrew.zaborowski@intel.com> writes:
> Hi,
>
> On 15 February 2017 at 09:58, Kalle Valo <kvalo@codeaurora.org> wrote:
>> Johannes Berg <johannes@sipsolutions.net> writes:
>>> On Fri, 2017-02-10 at 10:02 +0100, Andrew Zaborowski wrote:
>>>> Change the SET CQM command's RSSI threshold attribute to accept any
>>>> number of thresholds as a sorted array. The API should be backwards
>>>> compatible so that if one s32 threshold value is passed, the old
>>>> mechanism is enabled. The netlink event generated is the same in
>>>> both cases.
>>>
>>> I've applied this now, thanks for your patience :)
>>>
>>> I got a bit confused - and then fixed it up - patchwork has giving your
>>> name as "Andrzej Zaborowski" which apparently you didn't really want
>>> (any more). I've fixed it for these patches to be as the patches you
>>> sent, but no guarantees I've done this before or will remember to do
>>> that in the future - if you can somehow change your name in patchwork
>>> (patchwork.kernel.org) that would be good.
>
> Thanks, changed it for consistency now.
>
>>
>> IIRC if you haven't registered to patchwork.kernel.org it's possible to
>> change the name easily. But after registration the user needs to contact
>> helpdesk to change the name.
>
> Indeed I was able to set name on registration today but can see no way
> to modify it. The project's mailing list has a thread about a patch
> that's about to be backported to the patchwork.kernel.org version
> though,
> https://github.com/getpatchwork/patchwork/commit/d365402fb98dfb2c4aea4b58346096f85bdfa0c3
Great, that's exactly the right way to fix this. Thanks for letting us
now.
--
Kalle Valo
^ permalink raw reply
* Re: Monitor mode 'cook' flag meaning
From: Johannes Berg @ 2017-02-21 8:37 UTC (permalink / raw)
To: Thomas d'Otreppe; +Cc: linux-wireless
In-Reply-To: <CALs6+X+p_bANrbXjuQpbRWj_qpK7ssERMMKRdVDzH1yEOvT5fA@mail.gmail.com>
(please quote properly)
On Mon, 2017-02-20 at 18:46 -0700, Thomas d'Otreppe wrote:
> Do you have any example of devices where control or otherbss would be
> useful? Would both be for FullMAC devices?
No, I don't really know.
johannes
^ permalink raw reply
* RE: [RFC 2/5] iwlwifi: fix request_module() use
From: Grumbach, Emmanuel @ 2017-02-21 7:16 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: Berg, Johannes, Coelho, Luciano, tj@kernel.org,
arjan@linux.intel.com, ming.lei@canonical.com, zajec5@gmail.com,
jeyu@redhat.com, rusty@rustcorp.com.au, pmladek@suse.com,
gregkh@linuxfoundation.org, linuxwifi,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <20170221022337.GG31264@wotan.suse.de>
>
> On Sun, Feb 19, 2017 at 09:47:59AM +0000, Grumbach, Emmanuel wrote:
> > >
> > > The return value of request_module() being 0 does not mean that the
> > > driver which was requested has loaded. To properly check that the
> > > driver was loaded each driver can use internal mechanisms to vet the
> > > driver is now present. The helper try_then_request_module() was
> > > added to help with this, allowing drivers to specify their own validation as
> the first argument.
> > >
> > > On iwlwifi the use case is a bit more complicated given that the
> > > value we need to check for is protected with a mutex later used on
> > > the
> > > module_init() of the module we are asking for. If we were to lock
> > > and
> > > request_module() we'd deadlock. iwlwifi needs its own wrapper then
> > > so it can handle its special locking requirements.
> > >
> > > Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
> >
> > I don't see the problem with the current code. We don't assume that
> > everything has been loaded immediately after request_module returns.
> > We just free the intermediate firmware structures that won't be using
> > anymore. What happens here is that after request_module returns, we
> > patiently wait until it is loaded, and when that happens, iwl{d,m}vm's init
> function will be called.
>
> Right I get that.
>
> The code today complains if its respective opmode module was not loaded if
> request_module() did not return 0. As the commit log explains, relying on a
> return code of 0 to ensure a module loads is not sufficient. So the current
> print is almost pointless, so best we either:
>
> a) just remove the print and use instead request_module_nowait() (this is
> more
> in alignment of what your code actually does today; or
>
> b) fix the request_module() use so that the error print matches the
> expected
> and proper recommended use of request_module() (what this patch does)
>
> I prefer a) actually but I had to show what b) looked like first :)
>
Me too. Let's do the simple thing. After all, it's been working for 5 years now (maybe more?)
and I don't see a huge need to verify that the opmode module has been loaded.
It is very unlikely to fail anyway, and in the case it did fail, it's not that we can do much
from iwlwifi point of view. iwlwifi will stay loaded and sit idle since no opmode will
be there to start using the hardware. We will keep having the device claimed, and will
keep the interrupt registered and all that. No WiFi for you, but no harm caused either.
^ permalink raw reply
* [openwrt-devel] [linux-wireless] 802.11s mesh network can not recover after connectivity goes low and back up
From: Xuebing Wang @ 2017-02-21 6:55 UTC (permalink / raw)
To: linux-wireless, OpenWrt Development List
Hi Community,
I am using several routers (Atheros AR9331 + OpenWRT) to build a 802.11s
mesh network. I am having an issue.
- Linux kernel: 3.18.29
- OpenWRT version / branch: chaos_calmer
- Hardware platform: AR9331 with ath9k driver.
Description of the issue:
- When connectivity of a mesh node is low and connection to other nodes
is lost. After connectivity is back up again, ping other nodes won't get
this node to recover to connect to its peers.
- Test setup: most routers are in one room, with one specific router in
another room to simulate low connectivity.
- I use 'iw wlan0 set txpower limit 0' to simulate low connectivity.
- It's not easy to reproduce, occurrence rate is low.
- I sometimes put a laptop to the isolated router and "ssh into this
laptop" to generate some WiFi traffic (possible collisions).
Does anyone see the similar issue? Thanks.
xuebing wang
^ permalink raw reply
* Re: [RFC 2/5] iwlwifi: fix request_module() use
From: Luis R. Rodriguez @ 2017-02-21 2:23 UTC (permalink / raw)
To: Grumbach, Emmanuel
Cc: Luis R. Rodriguez, Berg, Johannes, Coelho, Luciano, tj@kernel.org,
arjan@linux.intel.com, ming.lei@canonical.com, zajec5@gmail.com,
jeyu@redhat.com, rusty@rustcorp.com.au, pmladek@suse.com,
gregkh@linuxfoundation.org, linuxwifi,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <0BA3FCBA62E2DC44AF3030971E174FB3A8F4AE27@hasmsx107.ger.corp.intel.com>
On Sun, Feb 19, 2017 at 09:47:59AM +0000, Grumbach, Emmanuel wrote:
> >
> > The return value of request_module() being 0 does not mean that the driver
> > which was requested has loaded. To properly check that the driver was
> > loaded each driver can use internal mechanisms to vet the driver is now
> > present. The helper try_then_request_module() was added to help with
> > this, allowing drivers to specify their own validation as the first argument.
> >
> > On iwlwifi the use case is a bit more complicated given that the value we
> > need to check for is protected with a mutex later used on the
> > module_init() of the module we are asking for. If we were to lock and
> > request_module() we'd deadlock. iwlwifi needs its own wrapper then so it
> > can handle its special locking requirements.
> >
> > Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
>
> I don't see the problem with the current code. We don't assume that everything has been
> loaded immediately after request_module returns. We just free the intermediate firmware
> structures that won't be using anymore. What happens here is that after request_module
> returns, we patiently wait until it is loaded, and when that happens, iwl{d,m}vm's init function
> will be called.
Right I get that.
The code today complains if its respective opmode module was not loaded
if request_module() did not return 0. As the commit log explains, relying
on a return code of 0 to ensure a module loads is not sufficient. So the
current print is almost pointless, so best we either:
a) just remove the print and use instead request_module_nowait() (this is more
in alignment of what your code actually does today; or
b) fix the request_module() use so that the error print matches the expected
and proper recommended use of request_module() (what this patch does)
I prefer a) actually but I had to show what b) looked like first :)
The only issue with a) is today we have no *slim* way to let drivers
load a module asynchronously and then later verify it did get loaded.
>From a *quick* look this grammatical form of request_module_nowait() and
a verifier is essentially is not widely popular or not present at all
today. A verifier seems reasonable if you use request_module_nowait()
though and want to be pedantic about ensuring the module is there.
What this might look like for iwlwifi? Something like this:
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index be466a074c1d..8059e1dab061 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -137,11 +137,16 @@ static struct iwlwifi_opmode_table {
const char *name; /* name: iwldvm, iwlmvm, etc */
const struct iwl_op_mode_ops *ops; /* pointer to op_mode ops */
struct list_head drv; /* list of devices using this op_mode */
+ bool load_requested; /* Do we need to load a driver ? */
+ struct iwl_drv *drv_req; /* Device that set load_requested */
} iwlwifi_opmode_table[] = { /* ops set when driver is initialized */
[DVM_OP_MODE] = { .name = "iwldvm", .ops = NULL },
[MVM_OP_MODE] = { .name = "iwlmvm", .ops = NULL },
};
+static void iwlwifi_load_opmode(struct work_struct *work);
+static DECLARE_DELAYED_WORK(iwl_opload_work, iwlwifi_load_opmode);
+
#define IWL_DEFAULT_SCAN_CHANNELS 40
/*
@@ -1231,6 +1236,43 @@ static void _iwl_op_mode_stop(struct iwl_drv *drv)
}
}
+static void iwlwifi_load_opmode(struct work_struct *work)
+{
+ struct iwl_drv *drv = NULL;
+ struct iwlwifi_opmode_table *op;
+ unsigned int i;
+
+ mutex_lock(&iwlwifi_opmode_table_mtx);
+ for (i = 0; i < ARRAY_SIZE(iwlwifi_opmode_table); i++) {
+ op = &iwlwifi_opmode_table[i];
+ if (!op->load_requested)
+ continue;
+ drv = op->drv_req;
+
+ if (!op->ops && drv) {
+ IWL_ERR(drv,
+ "failed to load module %s, is dynamic loading enabled?\n",
+ op->name);
+ complete(&drv->request_firmware_complete);
+ device_release_driver(drv->trans->dev);
+ mutex_unlock(&iwlwifi_opmode_table_mtx);
+ return;
+ }
+
+ op->load_requested = false;
+ op->drv_req = NULL;
+ }
+ mutex_unlock(&iwlwifi_opmode_table_mtx);
+
+
+ /*
+ * Complete the firmware request last so that
+ * a driver unbind (stop) doesn't run while we
+ * are doing the opmode start().
+ */
+ complete(&drv->request_firmware_complete);
+}
+
/**
* iwl_req_fw_callback - callback when firmware was loaded
*
@@ -1250,7 +1292,6 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
size_t trigger_tlv_sz[FW_DBG_TRIGGER_MAX];
u32 api_ver;
int i;
- bool load_module = false;
bool usniffer_images = false;
fw->ucode_capa.max_probe_length = IWL_DEFAULT_MAX_PROBE_LENGTH;
@@ -1455,31 +1496,26 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
goto out_unbind;
}
} else {
- load_module = true;
+ op->load_requested = true;
+ op->drv_req = drv;
}
mutex_unlock(&iwlwifi_opmode_table_mtx);
/*
- * Complete the firmware request last so that
- * a driver unbind (stop) doesn't run while we
- * are doing the start() above.
- */
- complete(&drv->request_firmware_complete);
-
- /*
* Load the module last so we don't block anything
* else from proceeding if the module fails to load
* or hangs loading.
+ *
+ * Always try loading it, even if we were built-in as
+ * in built-in cases this will be a no-op and so will
+ * the verifier check.
*/
- if (load_module) {
- err = request_module("%s", op->name);
-#ifdef CONFIG_IWLWIFI_OPMODE_MODULAR
- if (err)
- IWL_ERR(drv,
- "failed to load module %s (error %d), is dynamic loading enabled?\n",
- op->name, err);
-#endif
- }
+ err = request_module_nowait("%s", op->name);
+ if (err)
+ goto out_unbind;
+
+ schedule_delayed_work(&iwl_opload_work, HZ);
+
goto free;
try_again:
So consider this for your driver -- if you agree today's print is rather
pointless upon failure then you'd be OK in just using request_module_nowait()
and removing the print -- and not adding a verifier step 2 like the above.
Only -- it seems you want a verifier.
So you have 2 options with a suboptions:
1) keep sync request and add the verifier -- as in the original patch in this e-mail
2) use async request and
2a) add verifier
2b) ignore the verifier
I don't see why you'd want 2b) is what I'm trying to say and the point of this
path is to show what a 1) would look like.
The point of this email also is to highlight what it would look like in general
if we wanted verifiers for module request for async_schedule() calls, given
they cannot use request_module() and *must* use request_module_nowait() and
that ultimately begs the question if they want verifiers or not as well.
For iwlwifi and wireless this is only generally relevant for the async
callback for firmware requests, but it seems only iwlwifi uses this form.
I used async_schedule() for the driver data API which I'm developing,
and as such 2a or a solution for 1) was needed in such a way it was
compatible.
> That one is the one that continues the flow by calling:
>
> ret = iwl_opmode_register("iwlmvm", &iwl_mvm_ops);
>
> (for the iwlmvm case).
>
> Where am I wrong here?
You are right, but note the 2 possible ways in which the alternative path
can be taken in the prior code we discussed, this should ensure we complain
if upon a load the module is really not present. From what I recall from
my testing it turns out though that in practice this *still* is still allowing
for the case where iwlmvm loads prior to iwlwifi's async fw callback code
checks for the opmode. One can test this with a loop of:
modprobe -r iwlmvm; while true; do modprobe iwlmvm; modprobe -r iwlmvm; dmesg -c && echo ; done
Prior to this add a check for an empty list on the opmode registration, if its
empty then we've hit the path discussed. In the loop above we are *triggering*
the load of iwlmvm first, that's why it *can* load first. If we wanted to ensure
iwlmvm and other other opmode load second we can add a simply symbol dependency
from the opmodes to the iwlwifi driver.
Luis
^ permalink raw reply related
* Re: Monitor mode 'cook' flag meaning
From: Thomas d'Otreppe @ 2017-02-21 1:46 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless
In-Reply-To: <1487633211.484.1.camel@sipsolutions.net>
Do you have any example of devices where control or otherbss would be
useful? Would both be for FullMAC devices?
Thanks,
Thomas
On Mon, Feb 20, 2017 at 4:26 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Mon, 2017-02-20 at 16:22 -0700, Thomas d'Otreppe wrote:
>> I've been looking through the different flags for monitor mode in iw.
>> Most of them are rather obvious (and well explained) but what is
>> exactly 'cooked mode'?
>>
>> I looked up in Google and in the linux-wireless wiki (nothing in
>> there) and I only found explanations in 2 patches (most likely still
>> in the source code) which are still vague:
>> - A monitor interface in "cooked" mode will see all frames that
>> mac80211 has not used internally
>> - report frames after processing. Overrides all other flags.
>>
>> Thinking about what the first one says, it doesn't seem any different
>> than just fcsfail.
>
> No, that's the wrong idea. "cook" means that e.g. auth frames that
> mac80211 didn't actually look at will be sent there.
>
> Anyway, ignore cooked mode. It's only for ancient hostapd versions.
>
>> I don't even see when control or otherbss should be needed since
>> 'none' is already providing them.
>
> Those are hw-dependent.
>
> johannes
^ permalink raw reply
* Re: [PATCH v6 1/3] cfg80211: Accept multiple RSSI thresholds for CQM
From: Andrew Zaborowski @ 2017-02-21 1:44 UTC (permalink / raw)
To: Kalle Valo; +Cc: Johannes Berg, linux-wireless
In-Reply-To: <87vasb96ep.fsf@purkki.adurom.net>
Hi,
On 15 February 2017 at 09:58, Kalle Valo <kvalo@codeaurora.org> wrote:
> Johannes Berg <johannes@sipsolutions.net> writes:
>> On Fri, 2017-02-10 at 10:02 +0100, Andrew Zaborowski wrote:
>>> Change the SET CQM command's RSSI threshold attribute to accept any
>>> number of thresholds as a sorted array. The API should be backwards
>>> compatible so that if one s32 threshold value is passed, the old
>>> mechanism is enabled. The netlink event generated is the same in
>>> both cases.
>>
>> I've applied this now, thanks for your patience :)
>>
>> I got a bit confused - and then fixed it up - patchwork has giving your
>> name as "Andrzej Zaborowski" which apparently you didn't really want
>> (any more). I've fixed it for these patches to be as the patches you
>> sent, but no guarantees I've done this before or will remember to do
>> that in the future - if you can somehow change your name in patchwork
>> (patchwork.kernel.org) that would be good.
Thanks, changed it for consistency now.
>
> IIRC if you haven't registered to patchwork.kernel.org it's possible to
> change the name easily. But after registration the user needs to contact
> helpdesk to change the name.
Indeed I was able to set name on registration today but can see no way
to modify it. The project's mailing list has a thread about a patch
that's about to be backported to the patchwork.kernel.org version
though, https://github.com/getpatchwork/patchwork/commit/d365402fb98dfb2c4aea4b58346096f85bdfa0c3
Best regards
^ permalink raw reply
* Re: Monitor mode 'cook' flag meaning
From: Johannes Berg @ 2017-02-20 23:26 UTC (permalink / raw)
To: Thomas d'Otreppe, linux-wireless
In-Reply-To: <CALs6+XLDZLmc6JWMPun4sT+W_M4Cqh47LcK+HjiuZ8gKFLkbTA@mail.gmail.com>
On Mon, 2017-02-20 at 16:22 -0700, Thomas d'Otreppe wrote:
> I've been looking through the different flags for monitor mode in iw.
> Most of them are rather obvious (and well explained) but what is
> exactly 'cooked mode'?
>
> I looked up in Google and in the linux-wireless wiki (nothing in
> there) and I only found explanations in 2 patches (most likely still
> in the source code) which are still vague:
> - A monitor interface in "cooked" mode will see all frames that
> mac80211 has not used internally
> - report frames after processing. Overrides all other flags.
>
> Thinking about what the first one says, it doesn't seem any different
> than just fcsfail.
No, that's the wrong idea. "cook" means that e.g. auth frames that
mac80211 didn't actually look at will be sent there.
Anyway, ignore cooked mode. It's only for ancient hostapd versions.
> I don't even see when control or otherbss should be needed since
> 'none' is already providing them.
Those are hw-dependent.
johannes
^ permalink raw reply
* Monitor mode 'cook' flag meaning
From: Thomas d'Otreppe @ 2017-02-20 23:22 UTC (permalink / raw)
To: linux-wireless
I've been looking through the different flags for monitor mode in iw.
Most of them are rather obvious (and well explained) but what is
exactly 'cooked mode'?
I looked up in Google and in the linux-wireless wiki (nothing in
there) and I only found explanations in 2 patches (most likely still
in the source code) which are still vague:
- A monitor interface in "cooked" mode will see all frames that
mac80211 has not used internally
- report frames after processing. Overrides all other flags.
Thinking about what the first one says, it doesn't seem any different
than just fcsfail. I don't even see when control or otherbss should be
needed since 'none' is already providing them.
Am I correct? Or is it related to transmitting frames? And in this case, how?
Thanks in advance,
Thomas
^ permalink raw reply
* Re: [PATCH 1/2] uapi: fix definition of struct sockaddr_nfc_llcp on x32 and mips n32
From: Dmitry V. Levin @ 2017-02-20 21:28 UTC (permalink / raw)
To: Lauro Ramos Venancio, Aloisio Almeida Jr, Samuel Ortiz,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin
Cc: linux-wireless, x86, linux-mips, linux-kernel
In-Reply-To: <20170220181533.GA11185@altlinux.org>
On Mon, Feb 20, 2017 at 09:15:33PM +0300, Dmitry V. Levin wrote:
> Replace size_t with __kernel_size_t to fix definition of struct
> sockaddr_nfc_llcp on architectures like x32 and mips n32 where
> sizeof(size_t) < sizeof(__kernel_size_t).
>
> This also fixes the following linux/nfc.h userspace compilation error:
>
> /usr/include/linux/nfc.h:279:2: error: unknown type name 'size_t'
> size_t service_name_len;
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
> ---
> include/uapi/linux/nfc.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
> index 399f39f..f8ccc12 100644
> --- a/include/uapi/linux/nfc.h
> +++ b/include/uapi/linux/nfc.h
> @@ -276,7 +276,7 @@ struct sockaddr_nfc_llcp {
> __u8 dsap; /* Destination SAP, if known */
> __u8 ssap; /* Source SAP to be bound to */
> char service_name[NFC_LLCP_MAX_SERVICE_NAME]; /* Service name URI */;
> - size_t service_name_len;
> + __kernel_size_t service_name_len;
> };
>
> /* NFC socket protocols */
Unfortunately, this is not the right fix for the problem.
It was definitely a bad idea to use architecture dependent types
in the definition of struct sockaddr_nfc_llcp. Somebody will have
to implement a compat layer to make it work properly with x86, x32,
and other compat personalities.
--
ldv
^ permalink raw reply
* [PATCH 1/2] uapi: fix definition of struct sockaddr_nfc_llcp on x32 and mips n32
From: Dmitry V. Levin @ 2017-02-20 18:15 UTC (permalink / raw)
To: Lauro Ramos Venancio, Aloisio Almeida Jr, Samuel Ortiz,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin
Cc: linux-wireless, x86, linux-mips, linux-kernel
Replace size_t with __kernel_size_t to fix definition of struct
sockaddr_nfc_llcp on architectures like x32 and mips n32 where
sizeof(size_t) < sizeof(__kernel_size_t).
This also fixes the following linux/nfc.h userspace compilation error:
/usr/include/linux/nfc.h:279:2: error: unknown type name 'size_t'
size_t service_name_len;
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
include/uapi/linux/nfc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
index 399f39f..f8ccc12 100644
--- a/include/uapi/linux/nfc.h
+++ b/include/uapi/linux/nfc.h
@@ -276,7 +276,7 @@ struct sockaddr_nfc_llcp {
__u8 dsap; /* Destination SAP, if known */
__u8 ssap; /* Source SAP to be bound to */
char service_name[NFC_LLCP_MAX_SERVICE_NAME]; /* Service name URI */;
- size_t service_name_len;
+ __kernel_size_t service_name_len;
};
/* NFC socket protocols */
--
ldv
^ permalink raw reply related
* [PATCH 2/2] uapi: fix linux/nfc.h userspace compilation errors
From: Dmitry V. Levin @ 2017-02-20 18:16 UTC (permalink / raw)
To: Lauro Ramos Venancio, Aloisio Almeida Jr, Samuel Ortiz
Cc: linux-wireless, linux-kernel
Replace sa_family_t with __kernel_sa_family_t to fix the following
linux/nfc.h userspace compilation errors:
/usr/include/linux/nfc.h:264:2: error: unknown type name 'sa_family_t'
sa_family_t sa_family;
/usr/include/linux/nfc.h:272:2: error: unknown type name 'sa_family_t'
sa_family_t sa_family;
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
include/uapi/linux/nfc.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
index f8ccc12..1b6d54a 100644
--- a/include/uapi/linux/nfc.h
+++ b/include/uapi/linux/nfc.h
@@ -261,7 +261,7 @@ enum nfc_sdp_attr {
#define NFC_SE_ENABLED 0x1
struct sockaddr_nfc {
- sa_family_t sa_family;
+ __kernel_sa_family_t sa_family;
__u32 dev_idx;
__u32 target_idx;
__u32 nfc_protocol;
@@ -269,7 +269,7 @@ struct sockaddr_nfc {
#define NFC_LLCP_MAX_SERVICE_NAME 63
struct sockaddr_nfc_llcp {
- sa_family_t sa_family;
+ __kernel_sa_family_t sa_family;
__u32 dev_idx;
__u32 target_idx;
__u32 nfc_protocol;
--
ldv
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox