Commit c6112046 authored by Mukesh Sisodiya's avatar Mukesh Sisodiya Committed by Johannes Berg

wifi: cfg80211: make TDLS management link-aware

For multi-link operation(MLO) TDLS management
frames need to be transmitted on a specific link.
The TDLS setup request will add BSSID along with
peer address and userspace will pass the link-id
based on BSSID value to the driver(or mac80211).
Signed-off-by: default avatarMukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094948.cb3d87c22812.Ia3d15ac4a9a182145bf2d418bcb3ddf4539cd0a7@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 71e7552c
...@@ -3753,10 +3753,10 @@ static int mwifiex_cfg80211_set_coalesce(struct wiphy *wiphy, ...@@ -3753,10 +3753,10 @@ static int mwifiex_cfg80211_set_coalesce(struct wiphy *wiphy,
*/ */
static int static int
mwifiex_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, mwifiex_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
const u8 *peer, u8 action_code, u8 dialog_token, const u8 *peer, int link_id, u8 action_code,
u16 status_code, u32 peer_capability, u8 dialog_token, u16 status_code,
bool initiator, const u8 *extra_ies, u32 peer_capability, bool initiator,
size_t extra_ies_len) const u8 *extra_ies, size_t extra_ies_len)
{ {
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
int ret; int ret;
......
...@@ -4607,9 +4607,10 @@ struct cfg80211_ops { ...@@ -4607,9 +4607,10 @@ struct cfg80211_ops {
struct cfg80211_gtk_rekey_data *data); struct cfg80211_gtk_rekey_data *data);
int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
const u8 *peer, u8 action_code, u8 dialog_token, const u8 *peer, int link_id,
u16 status_code, u32 peer_capability, u8 action_code, u8 dialog_token, u16 status_code,
bool initiator, const u8 *buf, size_t len); u32 peer_capability, bool initiator,
const u8 *buf, size_t len);
int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
const u8 *peer, enum nl80211_tdls_operation oper); const u8 *peer, enum nl80211_tdls_operation oper);
......
...@@ -2565,10 +2565,10 @@ void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local, ...@@ -2565,10 +2565,10 @@ void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local,
/* TDLS */ /* TDLS */
int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
const u8 *peer, u8 action_code, u8 dialog_token, const u8 *peer, int link_id,
u16 status_code, u32 peer_capability, u8 action_code, u8 dialog_token, u16 status_code,
bool initiator, const u8 *extra_ies, u32 peer_capability, bool initiator,
size_t extra_ies_len); const u8 *extra_ies, size_t extra_ies_len);
int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
const u8 *peer, enum nl80211_tdls_operation oper); const u8 *peer, enum nl80211_tdls_operation oper);
void ieee80211_tdls_peer_del_work(struct work_struct *wk); void ieee80211_tdls_peer_del_work(struct work_struct *wk);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Copyright 2014, Intel Corporation * Copyright 2014, Intel Corporation
* Copyright 2014 Intel Mobile Communications GmbH * Copyright 2014 Intel Mobile Communications GmbH
* Copyright 2015 - 2016 Intel Deutschland GmbH * Copyright 2015 - 2016 Intel Deutschland GmbH
* Copyright (C) 2019, 2021-2022 Intel Corporation * Copyright (C) 2019, 2021-2023 Intel Corporation
*/ */
#include <linux/ieee80211.h> #include <linux/ieee80211.h>
...@@ -1185,10 +1185,10 @@ ieee80211_tdls_mgmt_teardown(struct wiphy *wiphy, struct net_device *dev, ...@@ -1185,10 +1185,10 @@ ieee80211_tdls_mgmt_teardown(struct wiphy *wiphy, struct net_device *dev,
} }
int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
const u8 *peer, u8 action_code, u8 dialog_token, const u8 *peer, int link_id,
u16 status_code, u32 peer_capability, u8 action_code, u8 dialog_token, u16 status_code,
bool initiator, const u8 *extra_ies, u32 peer_capability, bool initiator,
size_t extra_ies_len) const u8 *extra_ies, size_t extra_ies_len)
{ {
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
int ret; int ret;
......
...@@ -12262,6 +12262,7 @@ static int nl80211_tdls_mgmt(struct sk_buff *skb, struct genl_info *info) ...@@ -12262,6 +12262,7 @@ static int nl80211_tdls_mgmt(struct sk_buff *skb, struct genl_info *info)
u32 peer_capability = 0; u32 peer_capability = 0;
u16 status_code; u16 status_code;
u8 *peer; u8 *peer;
int link_id;
bool initiator; bool initiator;
if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) || if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) ||
...@@ -12283,8 +12284,9 @@ static int nl80211_tdls_mgmt(struct sk_buff *skb, struct genl_info *info) ...@@ -12283,8 +12284,9 @@ static int nl80211_tdls_mgmt(struct sk_buff *skb, struct genl_info *info)
if (info->attrs[NL80211_ATTR_TDLS_PEER_CAPABILITY]) if (info->attrs[NL80211_ATTR_TDLS_PEER_CAPABILITY])
peer_capability = peer_capability =
nla_get_u32(info->attrs[NL80211_ATTR_TDLS_PEER_CAPABILITY]); nla_get_u32(info->attrs[NL80211_ATTR_TDLS_PEER_CAPABILITY]);
link_id = nl80211_link_id_or_invalid(info->attrs);
return rdev_tdls_mgmt(rdev, dev, peer, action_code, return rdev_tdls_mgmt(rdev, dev, peer, link_id, action_code,
dialog_token, status_code, peer_capability, dialog_token, status_code, peer_capability,
initiator, initiator,
nla_data(info->attrs[NL80211_ATTR_IE]), nla_data(info->attrs[NL80211_ATTR_IE]),
...@@ -17151,7 +17153,8 @@ static const struct genl_small_ops nl80211_small_ops[] = { ...@@ -17151,7 +17153,8 @@ static const struct genl_small_ops nl80211_small_ops[] = {
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
.doit = nl80211_tdls_mgmt, .doit = nl80211_tdls_mgmt,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP), .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_MLO_VALID_LINK_ID),
}, },
{ {
.cmd = NL80211_CMD_TDLS_OPER, .cmd = NL80211_CMD_TDLS_OPER,
......
...@@ -899,17 +899,18 @@ static inline int rdev_set_rekey_data(struct cfg80211_registered_device *rdev, ...@@ -899,17 +899,18 @@ static inline int rdev_set_rekey_data(struct cfg80211_registered_device *rdev,
static inline int rdev_tdls_mgmt(struct cfg80211_registered_device *rdev, static inline int rdev_tdls_mgmt(struct cfg80211_registered_device *rdev,
struct net_device *dev, u8 *peer, struct net_device *dev, u8 *peer,
u8 action_code, u8 dialog_token, int link_id, u8 action_code,
u16 status_code, u32 peer_capability, u8 dialog_token, u16 status_code,
bool initiator, const u8 *buf, size_t len) u32 peer_capability, bool initiator,
const u8 *buf, size_t len)
{ {
int ret; int ret;
trace_rdev_tdls_mgmt(&rdev->wiphy, dev, peer, action_code, trace_rdev_tdls_mgmt(&rdev->wiphy, dev, peer, link_id, action_code,
dialog_token, status_code, peer_capability,
initiator, buf, len);
ret = rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
dialog_token, status_code, peer_capability, dialog_token, status_code, peer_capability,
initiator, buf, len); initiator, buf, len);
ret = rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, link_id,
action_code, dialog_token, status_code,
peer_capability, initiator, buf, len);
trace_rdev_return_int(&rdev->wiphy, ret); trace_rdev_return_int(&rdev->wiphy, ret);
return ret; return ret;
} }
......
...@@ -1779,15 +1779,16 @@ DEFINE_EVENT(wiphy_netdev_id_evt, rdev_sched_scan_stop, ...@@ -1779,15 +1779,16 @@ DEFINE_EVENT(wiphy_netdev_id_evt, rdev_sched_scan_stop,
TRACE_EVENT(rdev_tdls_mgmt, TRACE_EVENT(rdev_tdls_mgmt,
TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
u8 *peer, u8 action_code, u8 dialog_token, u8 *peer, int link_id, u8 action_code, u8 dialog_token,
u16 status_code, u32 peer_capability, u16 status_code, u32 peer_capability,
bool initiator, const u8 *buf, size_t len), bool initiator, const u8 *buf, size_t len),
TP_ARGS(wiphy, netdev, peer, action_code, dialog_token, status_code, TP_ARGS(wiphy, netdev, peer, link_id, action_code, dialog_token,
peer_capability, initiator, buf, len), status_code, peer_capability, initiator, buf, len),
TP_STRUCT__entry( TP_STRUCT__entry(
WIPHY_ENTRY WIPHY_ENTRY
NETDEV_ENTRY NETDEV_ENTRY
MAC_ENTRY(peer) MAC_ENTRY(peer)
__field(int, link_id)
__field(u8, action_code) __field(u8, action_code)
__field(u8, dialog_token) __field(u8, dialog_token)
__field(u16, status_code) __field(u16, status_code)
...@@ -1799,6 +1800,7 @@ TRACE_EVENT(rdev_tdls_mgmt, ...@@ -1799,6 +1800,7 @@ TRACE_EVENT(rdev_tdls_mgmt,
WIPHY_ASSIGN; WIPHY_ASSIGN;
NETDEV_ASSIGN; NETDEV_ASSIGN;
MAC_ASSIGN(peer, peer); MAC_ASSIGN(peer, peer);
__entry->link_id = link_id;
__entry->action_code = action_code; __entry->action_code = action_code;
__entry->dialog_token = dialog_token; __entry->dialog_token = dialog_token;
__entry->status_code = status_code; __entry->status_code = status_code;
...@@ -1806,11 +1808,12 @@ TRACE_EVENT(rdev_tdls_mgmt, ...@@ -1806,11 +1808,12 @@ TRACE_EVENT(rdev_tdls_mgmt,
__entry->initiator = initiator; __entry->initiator = initiator;
memcpy(__get_dynamic_array(buf), buf, len); memcpy(__get_dynamic_array(buf), buf, len);
), ),
TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", %pM, action_code: %u, " TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", %pM"
", link_id: %d, action_code: %u "
"dialog_token: %u, status_code: %u, peer_capability: %u " "dialog_token: %u, status_code: %u, peer_capability: %u "
"initiator: %s buf: %#.2x ", "initiator: %s buf: %#.2x ",
WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->peer, WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->peer,
__entry->action_code, __entry->dialog_token, __entry->link_id, __entry->action_code, __entry->dialog_token,
__entry->status_code, __entry->peer_capability, __entry->status_code, __entry->peer_capability,
BOOL_TO_STR(__entry->initiator), BOOL_TO_STR(__entry->initiator),
((u8 *)__get_dynamic_array(buf))[0]) ((u8 *)__get_dynamic_array(buf))[0])
......
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