Commit 4c532321 authored by Johannes Berg's avatar Johannes Berg

wifi: cfg80211/mac80211: report link ID on control port RX

For control port RX, report the link ID for MLO.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230301115906.fe06dfc3791b.Iddcab94789cafe336417be406072ce8a6312fc2d@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 81202305
...@@ -8126,6 +8126,7 @@ void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie, ...@@ -8126,6 +8126,7 @@ void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,
* responsible for any cleanup. The caller must also ensure that * responsible for any cleanup. The caller must also ensure that
* skb->protocol is set appropriately. * skb->protocol is set appropriately.
* @unencrypted: Whether the frame was received unencrypted * @unencrypted: Whether the frame was received unencrypted
* @link_id: the link the frame was received on, -1 if not applicable or unknown
* *
* This function is used to inform userspace about a received control port * This function is used to inform userspace about a received control port
* frame. It should only be used if userspace indicated it wants to receive * frame. It should only be used if userspace indicated it wants to receive
...@@ -8136,8 +8137,8 @@ void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie, ...@@ -8136,8 +8137,8 @@ void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,
* *
* Return: %true if the frame was passed to userspace * Return: %true if the frame was passed to userspace
*/ */
bool cfg80211_rx_control_port(struct net_device *dev, bool cfg80211_rx_control_port(struct net_device *dev, struct sk_buff *skb,
struct sk_buff *skb, bool unencrypted); bool unencrypted, int link_id);
/** /**
* cfg80211_cqm_rssi_notify - connection quality monitoring rssi event * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
......
...@@ -2591,7 +2591,7 @@ static void ieee80211_deliver_skb_to_local_stack(struct sk_buff *skb, ...@@ -2591,7 +2591,7 @@ static void ieee80211_deliver_skb_to_local_stack(struct sk_buff *skb,
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
bool noencrypt = !(status->flag & RX_FLAG_DECRYPTED); bool noencrypt = !(status->flag & RX_FLAG_DECRYPTED);
cfg80211_rx_control_port(dev, skb, noencrypt); cfg80211_rx_control_port(dev, skb, noencrypt, rx->link_id);
dev_kfree_skb(skb); dev_kfree_skb(skb);
} else { } else {
struct ethhdr *ehdr = (void *)skb_mac_header(skb); struct ethhdr *ehdr = (void *)skb_mac_header(skb);
......
...@@ -18754,7 +18754,9 @@ EXPORT_SYMBOL(cfg80211_mgmt_tx_status_ext); ...@@ -18754,7 +18754,9 @@ EXPORT_SYMBOL(cfg80211_mgmt_tx_status_ext);
static int __nl80211_rx_control_port(struct net_device *dev, static int __nl80211_rx_control_port(struct net_device *dev,
struct sk_buff *skb, struct sk_buff *skb,
bool unencrypted, gfp_t gfp) bool unencrypted,
int link_id,
gfp_t gfp)
{ {
struct wireless_dev *wdev = dev->ieee80211_ptr; struct wireless_dev *wdev = dev->ieee80211_ptr;
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
...@@ -18786,6 +18788,8 @@ static int __nl80211_rx_control_port(struct net_device *dev, ...@@ -18786,6 +18788,8 @@ static int __nl80211_rx_control_port(struct net_device *dev,
NL80211_ATTR_PAD) || NL80211_ATTR_PAD) ||
nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr) || nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr) ||
nla_put_u16(msg, NL80211_ATTR_CONTROL_PORT_ETHERTYPE, proto) || nla_put_u16(msg, NL80211_ATTR_CONTROL_PORT_ETHERTYPE, proto) ||
(link_id >= 0 &&
nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, link_id)) ||
(unencrypted && nla_put_flag(msg, (unencrypted && nla_put_flag(msg,
NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT))) NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT)))
goto nla_put_failure; goto nla_put_failure;
...@@ -18804,13 +18808,14 @@ static int __nl80211_rx_control_port(struct net_device *dev, ...@@ -18804,13 +18808,14 @@ static int __nl80211_rx_control_port(struct net_device *dev,
return -ENOBUFS; return -ENOBUFS;
} }
bool cfg80211_rx_control_port(struct net_device *dev, bool cfg80211_rx_control_port(struct net_device *dev, struct sk_buff *skb,
struct sk_buff *skb, bool unencrypted) bool unencrypted, int link_id)
{ {
int ret; int ret;
trace_cfg80211_rx_control_port(dev, skb, unencrypted); trace_cfg80211_rx_control_port(dev, skb, unencrypted, link_id);
ret = __nl80211_rx_control_port(dev, skb, unencrypted, GFP_ATOMIC); ret = __nl80211_rx_control_port(dev, skb, unencrypted, link_id,
GFP_ATOMIC);
trace_cfg80211_return_bool(ret == 0); trace_cfg80211_return_bool(ret == 0);
return ret == 0; return ret == 0;
} }
......
...@@ -3165,14 +3165,15 @@ TRACE_EVENT(cfg80211_control_port_tx_status, ...@@ -3165,14 +3165,15 @@ TRACE_EVENT(cfg80211_control_port_tx_status,
TRACE_EVENT(cfg80211_rx_control_port, TRACE_EVENT(cfg80211_rx_control_port,
TP_PROTO(struct net_device *netdev, struct sk_buff *skb, TP_PROTO(struct net_device *netdev, struct sk_buff *skb,
bool unencrypted), bool unencrypted, int link_id),
TP_ARGS(netdev, skb, unencrypted), TP_ARGS(netdev, skb, unencrypted, link_id),
TP_STRUCT__entry( TP_STRUCT__entry(
NETDEV_ENTRY NETDEV_ENTRY
__field(int, len) __field(int, len)
MAC_ENTRY(from) MAC_ENTRY(from)
__field(u16, proto) __field(u16, proto)
__field(bool, unencrypted) __field(bool, unencrypted)
__field(int, link_id)
), ),
TP_fast_assign( TP_fast_assign(
NETDEV_ASSIGN; NETDEV_ASSIGN;
...@@ -3180,10 +3181,12 @@ TRACE_EVENT(cfg80211_rx_control_port, ...@@ -3180,10 +3181,12 @@ TRACE_EVENT(cfg80211_rx_control_port,
MAC_ASSIGN(from, eth_hdr(skb)->h_source); MAC_ASSIGN(from, eth_hdr(skb)->h_source);
__entry->proto = be16_to_cpu(skb->protocol); __entry->proto = be16_to_cpu(skb->protocol);
__entry->unencrypted = unencrypted; __entry->unencrypted = unencrypted;
__entry->link_id = link_id;
), ),
TP_printk(NETDEV_PR_FMT ", len=%d, %pM, proto: 0x%x, unencrypted: %s", TP_printk(NETDEV_PR_FMT ", len=%d, %pM, proto: 0x%x, unencrypted: %s, link: %d",
NETDEV_PR_ARG, __entry->len, __entry->from, NETDEV_PR_ARG, __entry->len, __entry->from,
__entry->proto, BOOL_TO_STR(__entry->unencrypted)) __entry->proto, BOOL_TO_STR(__entry->unencrypted),
__entry->link_id)
); );
TRACE_EVENT(cfg80211_cqm_rssi_notify, TRACE_EVENT(cfg80211_cqm_rssi_notify,
......
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