mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-05-15 03:35:12 +00:00
mac80211: support control port TX status reporting
Add support for TX status reporting for the control port TX API; this will be used by hostapd when it moves to the control port TX API. Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de> Link: https://lore.kernel.org/r/20200527160334.19224-1-markus.theil@tu-ilmenau.de [fix commit message, it was referring to nl80211] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
119aadf816
commit
a7528198ad
5 changed files with 56 additions and 22 deletions
|
@ -1783,7 +1783,8 @@ netdev_tx_t ieee80211_subif_start_xmit_8023(struct sk_buff *skb,
|
||||||
void __ieee80211_subif_start_xmit(struct sk_buff *skb,
|
void __ieee80211_subif_start_xmit(struct sk_buff *skb,
|
||||||
struct net_device *dev,
|
struct net_device *dev,
|
||||||
u32 info_flags,
|
u32 info_flags,
|
||||||
u32 ctrl_flags);
|
u32 ctrl_flags,
|
||||||
|
u64 *cookie);
|
||||||
void ieee80211_purge_tx_queue(struct ieee80211_hw *hw,
|
void ieee80211_purge_tx_queue(struct ieee80211_hw *hw,
|
||||||
struct sk_buff_head *skbs);
|
struct sk_buff_head *skbs);
|
||||||
struct sk_buff *
|
struct sk_buff *
|
||||||
|
|
|
@ -596,6 +596,8 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
|
||||||
NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211);
|
NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211);
|
||||||
wiphy_ext_feature_set(wiphy,
|
wiphy_ext_feature_set(wiphy,
|
||||||
NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH);
|
NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH);
|
||||||
|
wiphy_ext_feature_set(wiphy,
|
||||||
|
NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211_TX_STATUS);
|
||||||
wiphy_ext_feature_set(wiphy,
|
wiphy_ext_feature_set(wiphy,
|
||||||
NL80211_EXT_FEATURE_SCAN_FREQ_KHZ);
|
NL80211_EXT_FEATURE_SCAN_FREQ_KHZ);
|
||||||
|
|
||||||
|
|
|
@ -649,10 +649,17 @@ static void ieee80211_report_ack_skb(struct ieee80211_local *local,
|
||||||
info->status.ack_signal,
|
info->status.ack_signal,
|
||||||
info->status.is_valid_ack_signal,
|
info->status.is_valid_ack_signal,
|
||||||
GFP_ATOMIC);
|
GFP_ATOMIC);
|
||||||
else
|
else if (ieee80211_is_mgmt(hdr->frame_control))
|
||||||
cfg80211_mgmt_tx_status(&sdata->wdev, cookie,
|
cfg80211_mgmt_tx_status(&sdata->wdev, cookie,
|
||||||
skb->data, skb->len,
|
skb->data, skb->len,
|
||||||
acked, GFP_ATOMIC);
|
acked, GFP_ATOMIC);
|
||||||
|
else
|
||||||
|
cfg80211_control_port_tx_status(&sdata->wdev,
|
||||||
|
cookie,
|
||||||
|
skb->data,
|
||||||
|
skb->len,
|
||||||
|
acked,
|
||||||
|
GFP_ATOMIC);
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
|
|
|
@ -1054,7 +1054,7 @@ ieee80211_tdls_prep_mgmt_packet(struct wiphy *wiphy, struct net_device *dev,
|
||||||
|
|
||||||
/* disable bottom halves when entering the Tx path */
|
/* disable bottom halves when entering the Tx path */
|
||||||
local_bh_disable();
|
local_bh_disable();
|
||||||
__ieee80211_subif_start_xmit(skb, dev, flags, 0);
|
__ieee80211_subif_start_xmit(skb, dev, flags, 0, NULL);
|
||||||
local_bh_enable();
|
local_bh_enable();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -2436,13 +2436,19 @@ int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ieee80211_store_ack_skb(struct ieee80211_local *local,
|
static u16 ieee80211_store_ack_skb(struct ieee80211_local *local,
|
||||||
struct sk_buff *skb,
|
struct sk_buff *skb,
|
||||||
u32 *info_flags)
|
u32 *info_flags,
|
||||||
|
u64 *cookie)
|
||||||
{
|
{
|
||||||
struct sk_buff *ack_skb = skb_clone_sk(skb);
|
struct sk_buff *ack_skb;
|
||||||
u16 info_id = 0;
|
u16 info_id = 0;
|
||||||
|
|
||||||
|
if (skb->sk)
|
||||||
|
ack_skb = skb_clone_sk(skb);
|
||||||
|
else
|
||||||
|
ack_skb = skb_clone(skb, GFP_ATOMIC);
|
||||||
|
|
||||||
if (ack_skb) {
|
if (ack_skb) {
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int id;
|
int id;
|
||||||
|
@ -2455,6 +2461,10 @@ static int ieee80211_store_ack_skb(struct ieee80211_local *local,
|
||||||
if (id >= 0) {
|
if (id >= 0) {
|
||||||
info_id = id;
|
info_id = id;
|
||||||
*info_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
|
*info_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
|
||||||
|
if (cookie) {
|
||||||
|
*cookie = ieee80211_mgmt_tx_cookie(local);
|
||||||
|
IEEE80211_SKB_CB(ack_skb)->ack.cookie = *cookie;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
kfree_skb(ack_skb);
|
kfree_skb(ack_skb);
|
||||||
}
|
}
|
||||||
|
@ -2484,7 +2494,8 @@ static int ieee80211_store_ack_skb(struct ieee80211_local *local,
|
||||||
*/
|
*/
|
||||||
static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
|
static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
|
||||||
struct sk_buff *skb, u32 info_flags,
|
struct sk_buff *skb, u32 info_flags,
|
||||||
struct sta_info *sta, u32 ctrl_flags)
|
struct sta_info *sta, u32 ctrl_flags,
|
||||||
|
u64 *cookie)
|
||||||
{
|
{
|
||||||
struct ieee80211_local *local = sdata->local;
|
struct ieee80211_local *local = sdata->local;
|
||||||
struct ieee80211_tx_info *info;
|
struct ieee80211_tx_info *info;
|
||||||
|
@ -2755,9 +2766,11 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
|
||||||
goto free;
|
goto free;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(!multicast && skb->sk &&
|
if (unlikely(!multicast && ((skb->sk &&
|
||||||
skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS))
|
skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS) ||
|
||||||
info_id = ieee80211_store_ack_skb(local, skb, &info_flags);
|
ctrl_flags & IEEE80211_TX_CTL_REQ_TX_STATUS)))
|
||||||
|
info_id = ieee80211_store_ack_skb(local, skb, &info_flags,
|
||||||
|
cookie);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the skb is shared we need to obtain our own copy.
|
* If the skb is shared we need to obtain our own copy.
|
||||||
|
@ -3913,7 +3926,8 @@ EXPORT_SYMBOL(ieee80211_txq_schedule_start);
|
||||||
void __ieee80211_subif_start_xmit(struct sk_buff *skb,
|
void __ieee80211_subif_start_xmit(struct sk_buff *skb,
|
||||||
struct net_device *dev,
|
struct net_device *dev,
|
||||||
u32 info_flags,
|
u32 info_flags,
|
||||||
u32 ctrl_flags)
|
u32 ctrl_flags,
|
||||||
|
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;
|
||||||
|
@ -3983,7 +3997,7 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb,
|
||||||
skb_mark_not_on_list(skb);
|
skb_mark_not_on_list(skb);
|
||||||
|
|
||||||
skb = ieee80211_build_hdr(sdata, skb, info_flags,
|
skb = ieee80211_build_hdr(sdata, skb, info_flags,
|
||||||
sta, ctrl_flags);
|
sta, ctrl_flags, cookie);
|
||||||
if (IS_ERR(skb)) {
|
if (IS_ERR(skb)) {
|
||||||
kfree_skb_list(next);
|
kfree_skb_list(next);
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -4125,9 +4139,9 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
|
||||||
__skb_queue_head_init(&queue);
|
__skb_queue_head_init(&queue);
|
||||||
ieee80211_convert_to_unicast(skb, dev, &queue);
|
ieee80211_convert_to_unicast(skb, dev, &queue);
|
||||||
while ((skb = __skb_dequeue(&queue)))
|
while ((skb = __skb_dequeue(&queue)))
|
||||||
__ieee80211_subif_start_xmit(skb, dev, 0, 0);
|
__ieee80211_subif_start_xmit(skb, dev, 0, 0, NULL);
|
||||||
} else {
|
} else {
|
||||||
__ieee80211_subif_start_xmit(skb, dev, 0, 0);
|
__ieee80211_subif_start_xmit(skb, dev, 0, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NETDEV_TX_OK;
|
return NETDEV_TX_OK;
|
||||||
|
@ -4215,7 +4229,7 @@ static void ieee80211_8023_xmit(struct ieee80211_sub_if_data *sdata,
|
||||||
|
|
||||||
if (unlikely(!multicast && skb->sk &&
|
if (unlikely(!multicast && skb->sk &&
|
||||||
skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS))
|
skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS))
|
||||||
ieee80211_store_ack_skb(local, skb, &info->flags);
|
ieee80211_store_ack_skb(local, skb, &info->flags, NULL);
|
||||||
|
|
||||||
memset(info, 0, sizeof(*info));
|
memset(info, 0, sizeof(*info));
|
||||||
|
|
||||||
|
@ -4299,7 +4313,7 @@ ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
skb = ieee80211_build_hdr(sdata, skb, info_flags, sta, 0);
|
skb = ieee80211_build_hdr(sdata, skb, info_flags, sta, 0, NULL);
|
||||||
if (IS_ERR(skb))
|
if (IS_ERR(skb))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
@ -5347,7 +5361,7 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
struct ethhdr *ehdr;
|
struct ethhdr *ehdr;
|
||||||
u32 ctrl_flags = 0;
|
u32 ctrl_flags = 0;
|
||||||
u32 flags;
|
u32 flags = 0;
|
||||||
|
|
||||||
/* Only accept CONTROL_PORT_PROTOCOL configured in CONNECT/ASSOCIATE
|
/* Only accept CONTROL_PORT_PROTOCOL configured in CONNECT/ASSOCIATE
|
||||||
* or Pre-Authentication
|
* or Pre-Authentication
|
||||||
|
@ -5360,9 +5374,13 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
|
||||||
ctrl_flags |= IEEE80211_TX_CTRL_PORT_CTRL_PROTO;
|
ctrl_flags |= IEEE80211_TX_CTRL_PORT_CTRL_PROTO;
|
||||||
|
|
||||||
if (unencrypted)
|
if (unencrypted)
|
||||||
flags = IEEE80211_TX_INTFL_DONT_ENCRYPT;
|
flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
|
||||||
else
|
|
||||||
flags = 0;
|
if (cookie)
|
||||||
|
ctrl_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
|
||||||
|
|
||||||
|
flags |= IEEE80211_TX_INTFL_NL80211_FRAME_TX |
|
||||||
|
IEEE80211_TX_CTL_INJECTED;
|
||||||
|
|
||||||
skb = dev_alloc_skb(local->hw.extra_tx_headroom +
|
skb = dev_alloc_skb(local->hw.extra_tx_headroom +
|
||||||
sizeof(struct ethhdr) + len);
|
sizeof(struct ethhdr) + len);
|
||||||
|
@ -5383,10 +5401,15 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
|
||||||
skb_reset_network_header(skb);
|
skb_reset_network_header(skb);
|
||||||
skb_reset_mac_header(skb);
|
skb_reset_mac_header(skb);
|
||||||
|
|
||||||
|
/* mutex lock is only needed for incrementing the cookie counter */
|
||||||
|
mutex_lock(&local->mtx);
|
||||||
|
|
||||||
local_bh_disable();
|
local_bh_disable();
|
||||||
__ieee80211_subif_start_xmit(skb, skb->dev, flags, ctrl_flags);
|
__ieee80211_subif_start_xmit(skb, skb->dev, flags, ctrl_flags, cookie);
|
||||||
local_bh_enable();
|
local_bh_enable();
|
||||||
|
|
||||||
|
mutex_unlock(&local->mtx);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5413,7 +5436,8 @@ int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev,
|
||||||
|
|
||||||
local_bh_disable();
|
local_bh_disable();
|
||||||
__ieee80211_subif_start_xmit(skb, skb->dev, 0,
|
__ieee80211_subif_start_xmit(skb, skb->dev, 0,
|
||||||
IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP);
|
IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP,
|
||||||
|
NULL);
|
||||||
local_bh_enable();
|
local_bh_enable();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue