Commit e9f935e3 authored by Rajkumar Manoharan's avatar Rajkumar Manoharan Committed by John W. Linville
Browse files

nl80211/cfg80211: Add support to disable CCK rate for management frame



Add a new nl80211 attribute to specify whether to send the management
frames in CCK rate or not. As of now the wpa_supplicant is disabling
CCK rate at P2P init itself. So this patch helps to send P2P probe
request/probe response/action frames being sent at non CCK rate in 2GHz
without disabling 11b rates.

This attribute is used with NL80211_CMD_TRIGGER_SCAN and
NL80211_CMD_FRAME commands to disable CCK rate for management frame
transmission.

Cc: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: default avatarRajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 8ebafde0
...@@ -238,6 +238,8 @@ ...@@ -238,6 +238,8 @@
* *
* @NL80211_CMD_GET_SCAN: get scan results * @NL80211_CMD_GET_SCAN: get scan results
* @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters
* %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the
* probe requests at CCK rate or not.
* @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to
* NL80211_CMD_GET_SCAN and on the "scan" multicast group) * NL80211_CMD_GET_SCAN and on the "scan" multicast group)
* @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons, * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
...@@ -432,6 +434,8 @@ ...@@ -432,6 +434,8 @@
* specified using %NL80211_ATTR_DURATION. When called, this operation * specified using %NL80211_ATTR_DURATION. When called, this operation
* returns a cookie (%NL80211_ATTR_COOKIE) that will be included with the * returns a cookie (%NL80211_ATTR_COOKIE) that will be included with the
* TX status event pertaining to the TX request. * TX status event pertaining to the TX request.
* %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the
* management frames at CCK rate or not in 2GHz band.
* @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this
* command may be used with the corresponding cookie to cancel the wait * command may be used with the corresponding cookie to cancel the wait
* time if it is known that it is no longer necessary. * time if it is known that it is no longer necessary.
...@@ -1078,6 +1082,13 @@ enum nl80211_commands { ...@@ -1078,6 +1082,13 @@ enum nl80211_commands {
* @NL80211_ATTR_PMKSA_CANDIDATE: Nested attribute containing the PMKSA caching * @NL80211_ATTR_PMKSA_CANDIDATE: Nested attribute containing the PMKSA caching
* candidate information, see &enum nl80211_pmksa_candidate_attr. * candidate information, see &enum nl80211_pmksa_candidate_attr.
* *
* @NL80211_ATTR_TX_NO_CCK_RATE: Indicates whether to use CCK rate or not
* for management frames transmission. In order to avoid p2p probe/action
* frames are being transmitted at CCK rate in 2GHz band, the user space
* applications use this attribute.
* This attribute is used with %NL80211_CMD_TRIGGER_SCAN and
* %NL80211_CMD_FRAME commands.
*
* @NL80211_ATTR_MAX: highest attribute number currently defined * @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use * @__NL80211_ATTR_AFTER_LAST: internal use
*/ */
...@@ -1298,6 +1309,8 @@ enum nl80211_attrs { ...@@ -1298,6 +1309,8 @@ enum nl80211_attrs {
NL80211_ATTR_PMKSA_CANDIDATE, NL80211_ATTR_PMKSA_CANDIDATE,
NL80211_ATTR_TX_NO_CCK_RATE,
/* add attributes here, update the policy in nl80211.c */ /* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST, __NL80211_ATTR_AFTER_LAST,
......
...@@ -860,6 +860,7 @@ struct cfg80211_ssid { ...@@ -860,6 +860,7 @@ struct cfg80211_ssid {
* @wiphy: the wiphy this was for * @wiphy: the wiphy this was for
* @dev: the interface * @dev: the interface
* @aborted: (internal) scan request was notified as aborted * @aborted: (internal) scan request was notified as aborted
* @no_cck: used to send probe requests at non CCK rate in 2GHz band
*/ */
struct cfg80211_scan_request { struct cfg80211_scan_request {
struct cfg80211_ssid *ssids; struct cfg80211_ssid *ssids;
...@@ -874,6 +875,7 @@ struct cfg80211_scan_request { ...@@ -874,6 +875,7 @@ struct cfg80211_scan_request {
struct wiphy *wiphy; struct wiphy *wiphy;
struct net_device *dev; struct net_device *dev;
bool aborted; bool aborted;
bool no_cck;
/* keep last */ /* keep last */
struct ieee80211_channel *channels[0]; struct ieee80211_channel *channels[0];
...@@ -1560,7 +1562,8 @@ struct cfg80211_ops { ...@@ -1560,7 +1562,8 @@ struct cfg80211_ops {
struct ieee80211_channel *chan, bool offchan, struct ieee80211_channel *chan, bool offchan,
enum nl80211_channel_type channel_type, enum nl80211_channel_type channel_type,
bool channel_type_valid, unsigned int wait, bool channel_type_valid, unsigned int wait,
const u8 *buf, size_t len, u64 *cookie); const u8 *buf, size_t len, bool no_cck,
u64 *cookie);
int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
struct net_device *dev, struct net_device *dev,
u64 cookie); u64 cookie);
......
...@@ -1869,7 +1869,8 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct net_device *dev, ...@@ -1869,7 +1869,8 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct net_device *dev,
struct ieee80211_channel *chan, bool offchan, struct ieee80211_channel *chan, bool offchan,
enum nl80211_channel_type channel_type, enum nl80211_channel_type channel_type,
bool channel_type_valid, unsigned int wait, bool channel_type_valid, unsigned int wait,
const u8 *buf, size_t len, u64 *cookie) const u8 *buf, size_t len, bool no_cck,
u64 *cookie)
{ {
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
......
...@@ -375,7 +375,8 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, ...@@ -375,7 +375,8 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
struct ieee80211_channel *chan, bool offchan, struct ieee80211_channel *chan, bool offchan,
enum nl80211_channel_type channel_type, enum nl80211_channel_type channel_type,
bool channel_type_valid, unsigned int wait, bool channel_type_valid, unsigned int wait,
const u8 *buf, size_t len, u64 *cookie); const u8 *buf, size_t len, bool no_cck,
u64 *cookie);
/* SME */ /* SME */
int __cfg80211_connect(struct cfg80211_registered_device *rdev, int __cfg80211_connect(struct cfg80211_registered_device *rdev,
......
...@@ -900,7 +900,8 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, ...@@ -900,7 +900,8 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
struct ieee80211_channel *chan, bool offchan, struct ieee80211_channel *chan, bool offchan,
enum nl80211_channel_type channel_type, enum nl80211_channel_type channel_type,
bool channel_type_valid, unsigned int wait, bool channel_type_valid, unsigned int wait,
const u8 *buf, size_t len, u64 *cookie) const u8 *buf, size_t len, bool no_cck,
u64 *cookie)
{ {
struct wireless_dev *wdev = dev->ieee80211_ptr; struct wireless_dev *wdev = dev->ieee80211_ptr;
const struct ieee80211_mgmt *mgmt; const struct ieee80211_mgmt *mgmt;
...@@ -991,7 +992,7 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, ...@@ -991,7 +992,7 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
/* Transmit the Action frame as requested by user space */ /* Transmit the Action frame as requested by user space */
return rdev->ops->mgmt_tx(&rdev->wiphy, dev, chan, offchan, return rdev->ops->mgmt_tx(&rdev->wiphy, dev, chan, offchan,
channel_type, channel_type_valid, channel_type, channel_type_valid,
wait, buf, len, cookie); wait, buf, len, no_cck, cookie);
} }
bool cfg80211_rx_mgmt(struct net_device *dev, int freq, const u8 *buf, bool cfg80211_rx_mgmt(struct net_device *dev, int freq, const u8 *buf,
......
...@@ -191,6 +191,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { ...@@ -191,6 +191,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
.len = IEEE80211_MAX_DATA_LEN }, .len = IEEE80211_MAX_DATA_LEN },
[NL80211_ATTR_ROAM_SUPPORT] = { .type = NLA_FLAG }, [NL80211_ATTR_ROAM_SUPPORT] = { .type = NLA_FLAG },
[NL80211_ATTR_SCHED_SCAN_MATCH] = { .type = NLA_NESTED }, [NL80211_ATTR_SCHED_SCAN_MATCH] = { .type = NLA_NESTED },
[NL80211_ATTR_TX_NO_CCK_RATE] = { .type = NLA_FLAG },
}; };
/* policy for the key attributes */ /* policy for the key attributes */
...@@ -3620,6 +3621,9 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) ...@@ -3620,6 +3621,9 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
} }
} }
request->no_cck =
nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]);
request->dev = dev; request->dev = dev;
request->wiphy = &rdev->wiphy; request->wiphy = &rdev->wiphy;
...@@ -5171,6 +5175,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) ...@@ -5171,6 +5175,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
struct sk_buff *msg; struct sk_buff *msg;
unsigned int wait = 0; unsigned int wait = 0;
bool offchan; bool offchan;
bool no_cck;
if (!info->attrs[NL80211_ATTR_FRAME] || if (!info->attrs[NL80211_ATTR_FRAME] ||
!info->attrs[NL80211_ATTR_WIPHY_FREQ]) !info->attrs[NL80211_ATTR_WIPHY_FREQ])
...@@ -5207,6 +5212,8 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) ...@@ -5207,6 +5212,8 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
offchan = info->attrs[NL80211_ATTR_OFFCHANNEL_TX_OK]; offchan = info->attrs[NL80211_ATTR_OFFCHANNEL_TX_OK];
no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]);
freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]);
chan = rdev_freq_to_chan(rdev, freq, channel_type); chan = rdev_freq_to_chan(rdev, freq, channel_type);
if (chan == NULL) if (chan == NULL)
...@@ -5227,7 +5234,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) ...@@ -5227,7 +5234,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
channel_type_valid, wait, channel_type_valid, wait,
nla_data(info->attrs[NL80211_ATTR_FRAME]), nla_data(info->attrs[NL80211_ATTR_FRAME]),
nla_len(info->attrs[NL80211_ATTR_FRAME]), nla_len(info->attrs[NL80211_ATTR_FRAME]),
&cookie); no_cck, &cookie);
if (err) if (err)
goto free_msg; goto free_msg;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment