mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
cfg80211: Add TDLS event to allow drivers to request operations
The NL80211_CMD_TDLS_OPER command was previously used only for userspace request for the kernel code to perform TDLS operations. However, there are also cases where the driver may need to request operations from userspace, e.g., when using security on the AP path. Add a new cfg80211 function for generating a TDLS operation event for drivers to request a new link to be set up (NL80211_TDLS_SETUP) or an existing link to be torn down (NL80211_TDLS_TEARDOWN). Drivers can optionally use these events, e.g., based on noticing data traffic being sent to a peer station that is seen with good signal strength. Signed-off-by: Jouni Malinen <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
This commit is contained in:
parent
90b9e446fb
commit
3475b0946b
4 changed files with 95 additions and 0 deletions
|
|
@ -9027,6 +9027,53 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy,
|
|||
}
|
||||
EXPORT_SYMBOL(cfg80211_report_obss_beacon);
|
||||
|
||||
void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
|
||||
enum nl80211_tdls_operation oper,
|
||||
u16 reason_code, gfp_t gfp)
|
||||
{
|
||||
struct wireless_dev *wdev = dev->ieee80211_ptr;
|
||||
struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
|
||||
struct sk_buff *msg;
|
||||
void *hdr;
|
||||
int err;
|
||||
|
||||
trace_cfg80211_tdls_oper_request(wdev->wiphy, dev, peer, oper,
|
||||
reason_code);
|
||||
|
||||
msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp);
|
||||
if (!msg)
|
||||
return;
|
||||
|
||||
hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_TDLS_OPER);
|
||||
if (!hdr) {
|
||||
nlmsg_free(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
|
||||
nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) ||
|
||||
nla_put_u8(msg, NL80211_ATTR_TDLS_OPERATION, oper) ||
|
||||
nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, peer) ||
|
||||
(reason_code > 0 &&
|
||||
nla_put_u16(msg, NL80211_ATTR_REASON_CODE, reason_code)))
|
||||
goto nla_put_failure;
|
||||
|
||||
err = genlmsg_end(msg, hdr);
|
||||
if (err < 0) {
|
||||
nlmsg_free(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
|
||||
nl80211_mlme_mcgrp.id, gfp);
|
||||
return;
|
||||
|
||||
nla_put_failure:
|
||||
genlmsg_cancel(msg, hdr);
|
||||
nlmsg_free(msg);
|
||||
}
|
||||
EXPORT_SYMBOL(cfg80211_tdls_oper_request);
|
||||
|
||||
static int nl80211_netlink_notify(struct notifier_block * nb,
|
||||
unsigned long state,
|
||||
void *_notify)
|
||||
|
|
|
|||
|
|
@ -2157,6 +2157,29 @@ TRACE_EVENT(cfg80211_report_obss_beacon,
|
|||
WIPHY_PR_ARG, __entry->freq, __entry->sig_dbm)
|
||||
);
|
||||
|
||||
TRACE_EVENT(cfg80211_tdls_oper_request,
|
||||
TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, const u8 *peer,
|
||||
enum nl80211_tdls_operation oper, u16 reason_code),
|
||||
TP_ARGS(wiphy, netdev, peer, oper, reason_code),
|
||||
TP_STRUCT__entry(
|
||||
WIPHY_ENTRY
|
||||
NETDEV_ENTRY
|
||||
MAC_ENTRY(peer)
|
||||
__field(enum nl80211_tdls_operation, oper)
|
||||
__field(u16, reason_code)
|
||||
),
|
||||
TP_fast_assign(
|
||||
WIPHY_ASSIGN;
|
||||
NETDEV_ASSIGN;
|
||||
MAC_ASSIGN(peer, peer);
|
||||
__entry->oper = oper;
|
||||
__entry->reason_code = reason_code;
|
||||
),
|
||||
TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", peer: " MAC_PR_FMT ", oper: %d, reason_code %u",
|
||||
WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer), __entry->oper,
|
||||
__entry->reason_code)
|
||||
);
|
||||
|
||||
TRACE_EVENT(cfg80211_scan_done,
|
||||
TP_PROTO(struct cfg80211_scan_request *request, bool aborted),
|
||||
TP_ARGS(request, aborted),
|
||||
|
|
|
|||
Loading…
Reference in a new issue