mirror of
https://github.com/LineageOS/android_kernel_samsung_msm8226.git
synced 2026-09-28 00:00:22 +02:00
cfg80211: add support for 802.11r Fast BSS Transition
Added CMD_UPDATE_FT_IES to support update of FT ies to the wlan driver. Added CMD_FT_EVENT to send FT event from the WLAN driver. This will carry the target AP's MAC address along with the relevant Information Elements. This event to report received FT IEs (MDIE, FTIE,RSN IE, TIE, RICIE) Change-Id: I5ae28b9412f3ba325aebab9b9768ca77f6757f23 Acked-by: Yathish Hanumapuradoddi Shivanna <yathishh@qca.qualcomm.com> Signed-off-by: Jeff Johnson <jjohnson@codeaurora.org>
This commit is contained in:
@@ -548,6 +548,14 @@
|
||||
* @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether
|
||||
* No Acknowledgement Policy should be applied.
|
||||
*
|
||||
* @NL80211_CMD_UPDATE_FT_IES: Pass down the most up-to-date Fast Transition
|
||||
* Information Element to the WLAN driver
|
||||
*
|
||||
* @NL80211_CMD_FT_EVENT: Send a Fast transition event from the WLAN driver
|
||||
* to the supplicant. This will carry the target AP's MAC address along
|
||||
* with the relevant Information Elements. This event to report received
|
||||
* FT IEs( MDIE, FTIE,RSN IE, TIE, RICIE).
|
||||
*
|
||||
* @NL80211_CMD_MAX: highest used command number
|
||||
* @__NL80211_CMD_AFTER_LAST: internal use
|
||||
*/
|
||||
@@ -689,6 +697,9 @@ enum nl80211_commands {
|
||||
|
||||
NL80211_CMD_SET_NOACK_MAP,
|
||||
|
||||
NL80211_CMD_UPDATE_FT_IES,
|
||||
NL80211_CMD_FT_EVENT,
|
||||
|
||||
/* add new commands above here */
|
||||
|
||||
/* used to define NL80211_CMD_MAX below */
|
||||
@@ -1264,6 +1275,10 @@ enum nl80211_commands {
|
||||
* @NL80211_ATTR_BG_SCAN_PERIOD: Background scan period in seconds
|
||||
* or 0 to disable background scan.
|
||||
*
|
||||
* @NL80211_ATTR_MDID: Mobility Domain Identifier
|
||||
*
|
||||
* @NL80211_ATTR_IE_RIC: Resource Information Container Information Element
|
||||
*
|
||||
* @NL80211_ATTR_MAX: highest attribute number currently defined
|
||||
* @__NL80211_ATTR_AFTER_LAST: internal use
|
||||
*/
|
||||
@@ -1515,6 +1530,9 @@ enum nl80211_attrs {
|
||||
|
||||
NL80211_ATTR_BG_SCAN_PERIOD,
|
||||
|
||||
NL80211_ATTR_MDID,
|
||||
NL80211_ATTR_IE_RIC,
|
||||
|
||||
/* add attributes here, update the policy in nl80211.c */
|
||||
|
||||
__NL80211_ATTR_AFTER_LAST,
|
||||
|
||||
@@ -1317,6 +1317,21 @@ struct cfg80211_gtk_rekey_data {
|
||||
u8 replay_ctr[NL80211_REPLAY_CTR_LEN];
|
||||
};
|
||||
|
||||
/**
|
||||
* struct cfg80211_update_ft_ies_params - FT IE Information
|
||||
*
|
||||
* This structure provides information needed to update the fast transition IE
|
||||
*
|
||||
* @md: The Mobility Domain ID, 2 Octet value
|
||||
* @ie: Fast Transition IEs
|
||||
* @ie_len: Length of ft_ie in octets
|
||||
*/
|
||||
struct cfg80211_update_ft_ies_params {
|
||||
u16 md;
|
||||
u8 *ie;
|
||||
size_t ie_len;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct cfg80211_ops - backend description for wireless configuration
|
||||
*
|
||||
@@ -1697,6 +1712,8 @@ struct cfg80211_ops {
|
||||
u16 noack_map);
|
||||
|
||||
struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy);
|
||||
int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
|
||||
struct cfg80211_update_ft_ies_params *ftie);
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -3348,6 +3365,32 @@ int cfg80211_can_beacon_sec_chan(struct wiphy *wiphy,
|
||||
*/
|
||||
u16 cfg80211_calculate_bitrate(struct rate_info *rate);
|
||||
|
||||
/**
|
||||
* struct cfg80211_ft_event - FT Information Elements
|
||||
* @dev: network device
|
||||
* @ies: FT IEs
|
||||
* @ies_len: length of the FT IE in bytes
|
||||
* @target_ap: target AP's MAC address
|
||||
* @ric_ies: RIC IE
|
||||
* @ric_ies_len: length of the RIC IE in bytes
|
||||
*/
|
||||
struct cfg80211_ft_event_params {
|
||||
u8 *ies;
|
||||
size_t ies_len;
|
||||
u8 target_ap[ETH_ALEN];
|
||||
u8 *ric_ies;
|
||||
size_t ric_ies_len;
|
||||
};
|
||||
|
||||
/**
|
||||
* cfg80211_ft_event - notify userspace about FT IE and RIC IE
|
||||
* @dev: network device
|
||||
* @cfg80211_ft_event_params: IE information
|
||||
*/
|
||||
int cfg80211_ft_event(struct net_device *dev,
|
||||
struct cfg80211_ft_event_params ft_event);
|
||||
|
||||
|
||||
/* Logging, debugging and troubleshooting/diagnostic helpers. */
|
||||
|
||||
/* wiphy_printk helpers, similar to dev_printk */
|
||||
|
||||
@@ -954,3 +954,16 @@ bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
|
||||
return nl80211_unexpected_4addr_frame(dev, addr, gfp);
|
||||
}
|
||||
EXPORT_SYMBOL(cfg80211_rx_unexpected_4addr_frame);
|
||||
|
||||
int cfg80211_ft_event(struct net_device *dev,
|
||||
struct cfg80211_ft_event_params ft_event)
|
||||
{
|
||||
int err = 0;
|
||||
struct wiphy *wiphy = dev->ieee80211_ptr->wiphy;
|
||||
struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
|
||||
|
||||
nl80211_ft_event(rdev, dev, ft_event);
|
||||
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(cfg80211_ft_event);
|
||||
|
||||
@@ -206,6 +206,9 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
|
||||
[NL80211_ATTR_NOACK_MAP] = { .type = NLA_U16 },
|
||||
[NL80211_ATTR_INACTIVITY_TIMEOUT] = { .type = NLA_U16 },
|
||||
[NL80211_ATTR_BG_SCAN_PERIOD] = { .type = NLA_U16 },
|
||||
[NL80211_ATTR_MDID] = { .type = NLA_U16 },
|
||||
[NL80211_ATTR_IE_RIC] = { .type = NLA_BINARY,
|
||||
.len = IEEE80211_MAX_DATA_LEN },
|
||||
};
|
||||
|
||||
/* policy for the key attributes */
|
||||
@@ -6299,6 +6302,26 @@ static int nl80211_register_beacons(struct sk_buff *skb, struct genl_info *info)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nl80211_update_ft_ies(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct cfg80211_registered_device *rdev = info->user_ptr[0];
|
||||
struct cfg80211_update_ft_ies_params ft_params;
|
||||
struct net_device *dev = info->user_ptr[1];
|
||||
|
||||
if (!info->attrs[NL80211_ATTR_MDID])
|
||||
return -EINVAL;
|
||||
|
||||
ft_params.md = nla_get_u16(info->attrs[NL80211_ATTR_MDID]);
|
||||
|
||||
if (!info->attrs[NL80211_ATTR_IE])
|
||||
return -EINVAL;
|
||||
|
||||
ft_params.ie = nla_data(info->attrs[NL80211_ATTR_IE]);
|
||||
ft_params.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]);
|
||||
|
||||
return rdev->ops->update_ft_ies(&rdev->wiphy, dev, &ft_params);
|
||||
}
|
||||
|
||||
#define NL80211_FLAG_NEED_WIPHY 0x01
|
||||
#define NL80211_FLAG_NEED_NETDEV 0x02
|
||||
#define NL80211_FLAG_NEED_RTNL 0x04
|
||||
@@ -6887,6 +6910,14 @@ static struct genl_ops nl80211_ops[] = {
|
||||
.internal_flags = NL80211_FLAG_NEED_NETDEV |
|
||||
NL80211_FLAG_NEED_RTNL,
|
||||
},
|
||||
{
|
||||
.cmd = NL80211_CMD_UPDATE_FT_IES,
|
||||
.doit = nl80211_update_ft_ies,
|
||||
.policy = nl80211_policy,
|
||||
.flags = GENL_ADMIN_PERM,
|
||||
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
|
||||
NL80211_FLAG_NEED_RTNL,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
@@ -8080,6 +8111,47 @@ static struct notifier_block nl80211_netlink_notifier = {
|
||||
.notifier_call = nl80211_netlink_notify,
|
||||
};
|
||||
|
||||
void nl80211_ft_event(struct cfg80211_registered_device *rdev,
|
||||
struct net_device *netdev, struct cfg80211_ft_event_params ft_event)
|
||||
{
|
||||
struct sk_buff *msg;
|
||||
void *hdr;
|
||||
|
||||
msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
|
||||
if (!msg)
|
||||
return;
|
||||
|
||||
hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_FT_EVENT);
|
||||
if (!hdr) {
|
||||
nlmsg_free(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx);
|
||||
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex);
|
||||
if (ft_event.target_ap)
|
||||
NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, ft_event.target_ap);
|
||||
if (ft_event.ies)
|
||||
NLA_PUT(msg, NL80211_ATTR_IE, ft_event.ies_len, ft_event.ies);
|
||||
if (ft_event.ric_ies)
|
||||
NLA_PUT(msg, NL80211_ATTR_IE_RIC, ft_event.ric_ies_len,
|
||||
ft_event.ric_ies);
|
||||
|
||||
if (genlmsg_end(msg, hdr) < 0) {
|
||||
nlmsg_free(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
|
||||
nl80211_mlme_mcgrp.id, GFP_KERNEL);
|
||||
return;
|
||||
|
||||
nla_put_failure:
|
||||
genlmsg_cancel(msg, hdr);
|
||||
nlmsg_free(msg);
|
||||
}
|
||||
|
||||
|
||||
/* initialisation/exit functions */
|
||||
|
||||
int nl80211_init(void)
|
||||
|
||||
@@ -123,4 +123,8 @@ bool nl80211_unexpected_frame(struct net_device *dev,
|
||||
bool nl80211_unexpected_4addr_frame(struct net_device *dev,
|
||||
const u8 *addr, gfp_t gfp);
|
||||
|
||||
void nl80211_ft_event(struct cfg80211_registered_device *rdev,
|
||||
struct net_device *netdev,
|
||||
struct cfg80211_ft_event_params ft_event);
|
||||
|
||||
#endif /* __NET_WIRELESS_NL80211_H */
|
||||
|
||||
Reference in New Issue
Block a user