backports.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hauke Mehrtens <hauke@hauke-m.de>
To: backports@vger.kernel.org
Cc: johannes@sipsolutions.net, Hauke Mehrtens <hauke@hauke-m.de>
Subject: [PATCH 16/30] backports: Make rx_list handling work on older kernel versions
Date: Tue,  1 Dec 2020 23:04:01 +0100	[thread overview]
Message-ID: <20201201220415.30582-17-hauke@hauke-m.de> (raw)
In-Reply-To: <20201201220415.30582-1-hauke@hauke-m.de>

The commit c5d1686b314e ("mac80211: add a function for running rx
without passing skbs to the stack") added a new function
ieee80211_rx_list() which uses the list attribute of the skbs, but they
were added only with kernel 4.19. Use the next pointer in the skb on
the older kernel instead. The list attributes where also backported to
4.14, but to make it easier, just use the next pointer also there.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/linux/netdevice.h |  12 ++
 patches/0097-skb-list/mac80211-rx.patch     | 115 ++++++++++++++++++++
 2 files changed, 127 insertions(+)
 create mode 100644 patches/0097-skb-list/mac80211-rx.patch

diff --git a/backport/backport-include/linux/netdevice.h b/backport/backport-include/linux/netdevice.h
index edb0aaf3..7646d6e2 100644
--- a/backport/backport-include/linux/netdevice.h
+++ b/backport/backport-include/linux/netdevice.h
@@ -372,6 +372,18 @@ static inline int _bp_netdev_upper_dev_link(struct net_device *dev,
 	macro_dispatcher(netdev_upper_dev_link, __VA_ARGS__)(__VA_ARGS__)
 #endif
 
+#if LINUX_VERSION_IS_LESS(4,19,0)
+static inline void netif_receive_skb_list(struct sk_buff_head *head)
+{
+	struct sk_buff *skb, *next;
+
+	skb_queue_walk_safe(head, skb, next) {
+		__skb_unlink(skb, head);
+		netif_receive_skb(skb);
+	}
+}
+#endif
+
 #if LINUX_VERSION_IS_LESS(5,0,0)
 static inline int backport_dev_open(struct net_device *dev, struct netlink_ext_ack *extack)
 {
diff --git a/patches/0097-skb-list/mac80211-rx.patch b/patches/0097-skb-list/mac80211-rx.patch
new file mode 100644
index 00000000..b698d192
--- /dev/null
+++ b/patches/0097-skb-list/mac80211-rx.patch
@@ -0,0 +1,115 @@
+Make rx_list handling work on older kernel versions
+
+The commit c5d1686b314e ("mac80211: add a function for running rx
+without passing skbs to the stack") added a new function
+ieee80211_rx_list() which uses the list attribute of the skbs, but they
+were added only with kernel 4.19. Use the next pointer in the skb on
+the older kernel instead. The list attributes where also backported to
+4.14, but to make it easier, just use the next pointer also there.
+
+--- a/include/net/mac80211.h
++++ b/include/net/mac80211.h
+@@ -4383,7 +4383,11 @@ void ieee80211_restart_hw(struct ieee802
+  * @list: the destination list
+  */
+ void ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
++#if LINUX_VERSION_IS_GEQ(4,19,0)
+ 		       struct sk_buff *skb, struct list_head *list);
++#else
++		       struct sk_buff *skb, struct sk_buff_head *list);
++#endif
+ 
+ /**
+  * ieee80211_rx_napi - receive frame from NAPI context
+--- a/net/mac80211/ieee80211_i.h
++++ b/net/mac80211/ieee80211_i.h
+@@ -217,7 +217,11 @@ enum ieee80211_rx_flags {
+ };
+ 
+ struct ieee80211_rx_data {
++#if LINUX_VERSION_IS_GEQ(4,19,0)
+ 	struct list_head *list;
++#else
++	struct sk_buff_head *list;
++#endif
+ 	struct sk_buff *skb;
+ 	struct ieee80211_local *local;
+ 	struct ieee80211_sub_if_data *sdata;
+--- a/net/mac80211/rx.c
++++ b/net/mac80211/rx.c
+@@ -2580,7 +2580,11 @@ static void ieee80211_deliver_skb_to_loc
+ 
+ 		/* deliver to local stack */
+ 		if (rx->list)
++#if LINUX_VERSION_IS_GEQ(4,19,0)
+ 			list_add_tail(&skb->list, rx->list);
++#else
++			__skb_queue_tail(rx->list, skb);
++#endif
+ 		else
+ 			netif_receive_skb(skb);
+ 	}
+@@ -4480,7 +4484,11 @@ static bool ieee80211_invoke_fast_rx(str
+ 	skb->protocol = eth_type_trans(skb, fast_rx->dev);
+ 	memset(skb->cb, 0, sizeof(skb->cb));
+ 	if (rx->list)
++#if LINUX_VERSION_IS_GEQ(4,19,0)
+ 		list_add_tail(&skb->list, rx->list);
++#else
++		__skb_queue_tail(rx->list, skb);
++#endif
+ 	else
+ 		netif_receive_skb(skb);
+ 
+@@ -4547,7 +4555,11 @@ static bool ieee80211_prepare_and_rx_han
+ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
+ 					 struct ieee80211_sta *pubsta,
+ 					 struct sk_buff *skb,
++#if LINUX_VERSION_IS_GEQ(4,19,0)
+ 					 struct list_head *list)
++#else
++					 struct sk_buff_head *list)
++#endif
+ {
+ 	struct ieee80211_local *local = hw_to_local(hw);
+ 	struct ieee80211_sub_if_data *sdata;
+@@ -4671,7 +4683,11 @@ static void __ieee80211_rx_handle_packet
+  * 802.11 MPDU is received from the hardware.
+  */
+ void ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta,
++#if LINUX_VERSION_IS_GEQ(4,19,0)
+ 		       struct sk_buff *skb, struct list_head *list)
++#else
++		       struct sk_buff *skb, struct sk_buff_head *list)
++#endif
+ {
+ 	struct ieee80211_local *local = hw_to_local(hw);
+ 	struct ieee80211_rate *rate = NULL;
+@@ -4788,7 +4804,13 @@ void ieee80211_rx_napi(struct ieee80211_
+ 		       struct sk_buff *skb, struct napi_struct *napi)
+ {
+ 	struct sk_buff *tmp;
++#if LINUX_VERSION_IS_GEQ(4,19,0)
+ 	LIST_HEAD(list);
++#else
++	struct sk_buff_head list;
++
++	__skb_queue_head_init(&list);
++#endif
+ 
+ 
+ 	/*
+@@ -4805,8 +4827,13 @@ void ieee80211_rx_napi(struct ieee80211_
+ 		return;
+ 	}
+ 
++#if LINUX_VERSION_IS_GEQ(4,19,0)
+ 	list_for_each_entry_safe(skb, tmp, &list, list) {
+ 		skb_list_del_init(skb);
++#else
++	skb_queue_walk_safe(&list, skb, tmp) {
++		__skb_unlink(skb, &list);
++#endif
+ 		napi_gro_receive(napi, skb);
+ 	}
+ }
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

  parent reply	other threads:[~2020-12-01 22:06 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01 22:03 [PATCH 00/30] backports: Update to match kernel 5.10-rc6 Hauke Mehrtens
2020-12-01 22:03 ` [PATCH 01/30] backports: Adapt to changes in Ubuntu mainline URLs Hauke Mehrtens
2020-12-01 22:03 ` [PATCH 02/30] gentree.py: Remoace space between -I and $(src) Hauke Mehrtens
2020-12-01 22:03 ` [PATCH 03/30] backports: Extend NOSTDINC_FLAGS Hauke Mehrtens
2020-12-01 22:03 ` [PATCH 04/30] patches: Refresh on kernel 5.8.18 Hauke Mehrtens
2020-12-01 22:03 ` [PATCH 05/30] backports: add sched_set_fifo_low Hauke Mehrtens
2020-12-01 22:03 ` [PATCH 06/30] backports: add tasklet_setup, from_tasklet Hauke Mehrtens
2020-12-01 22:03 ` [PATCH 07/30] backports: Add time64_to_tm and ipv6_mc_check_mld Hauke Mehrtens
2020-12-01 22:03 ` [PATCH 08/30] backprots: make patches apply on 5.9.11 Hauke Mehrtens
2020-12-01 22:03 ` [PATCH 09/30] header: add module_sdio_driver Hauke Mehrtens
2020-12-01 22:03 ` [PATCH 10/30] header: Rename kfree_sensitive(x) to kzfree(x) Hauke Mehrtens
2020-12-01 22:03 ` [PATCH 11/30] header: dummy implementation for thermal_zone_device_enable Hauke Mehrtens
2020-12-01 22:03 ` [PATCH 12/30] header: Add __skb_put_zero() Hauke Mehrtens
2020-12-01 22:03 ` [PATCH 13/30] dependency: add MT7663S Hauke Mehrtens
2020-12-01 22:03 ` [PATCH 14/30] backports: add gpiochip_request_own_desc() Hauke Mehrtens
2020-12-01 22:04 ` [PATCH 15/30] backports: Add microchip wilc1000 driver Hauke Mehrtens
2020-12-01 22:04 ` Hauke Mehrtens [this message]
2020-12-01 22:04 ` [PATCH 17/30] patches: Add missing linux/kthread.h include Hauke Mehrtens
2020-12-01 22:04 ` [PATCH 18/30] patches: Add include to rtw88 Hauke Mehrtens
2020-12-01 22:04 ` [PATCH 19/30] patches: handle netdev_walk_all_lower_dev() Hauke Mehrtens
2020-12-01 22:04 ` [PATCH 20/30] patches: Remove unneeded 0018-pv-trace-fixes patch Hauke Mehrtens
2020-12-01 22:04 ` [PATCH 21/30] patches: Refresh on kernel 5.10-rc6 Hauke Mehrtens
2020-12-01 22:04 ` [PATCH 22/30] patches: Avoid using NLA_POLICY_RANGE(NLA_BINARY, ...) Hauke Mehrtens
2020-12-01 22:04 ` [PATCH 23/30] patches: Deactivate hikey9xx staging driver Hauke Mehrtens
2020-12-01 22:04 ` [PATCH 24/30] patches: Revert usage of small_ops Hauke Mehrtens
2020-12-01 22:04 ` [PATCH 25/30] headers: Add DEFINE_SEQ_ATTRIBUTE Hauke Mehrtens
2020-12-01 22:04 ` [PATCH 26/30] backports: Add netif_rx_any_context() Hauke Mehrtens
2020-12-01 22:04 ` [PATCH 27/30] backports: Add dev_fetch_sw_netstats() Hauke Mehrtens
2020-12-01 22:04 ` [PATCH 28/30] backports: Make ieee80211_tx_status handling work on older kernel versions Hauke Mehrtens
2020-12-01 22:04 ` [PATCH 29/30] backports: Add sysfs_emit() Hauke Mehrtens
2020-12-01 22:04 ` [PATCH 30/30] backports: Remove crypto/akcipher.h Hauke Mehrtens
2020-12-06 15:57 ` [PATCH 00/30] backports: Update to match kernel 5.10-rc6 Hauke Mehrtens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201201220415.30582-17-hauke@hauke-m.de \
    --to=hauke@hauke-m.de \
    --cc=backports@vger.kernel.org \
    --cc=johannes@sipsolutions.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).