wifi: ath9k: use page_pool for RX buffers
PATCH 1/1 wifi: ath9k: use page_pool for RX buffers
Allocate RX buffers from a page_pool instead of allocating a new skb and mapping it for every received frame. The pool keeps its pages mapped, so refilling a descriptor only needs a sync for the device, and buffers are recycled once the stack is done with them.
The pool uses the smallest page order that fits at least two buffers and is sized for the number of pages the RX ring needs. With 4 KiB pages a buffer plus skb_shared_info does not fit into half a page, so this means order-1 pages split into three fragments.
Buffers are now aligned to the page_pool fragment alignment (at least the DMA cache alignment) plus NET_SKB_PAD instead of to the PCI cache line size reported in common->cachelsz. This keeps them cache line aligned, which is what the hardware needs.
On a Meraki MX60 (APM82181, 3x3 AR9300-family PCIe card, 5 GHz HT40) forwarding 90 Mbit/s of UDP from a wireless client to the WAN port, the CPU load drops from 56.2% to 54.8% (mean of 12 runs each, in-boot A/B), and the share of ath9k itself drops from 14.1% to 11.9% of the samples. TCP throughput is unchanged (air time bound).
--- drivers/net/wireless/ath/ath9k/Kconfig | 1 + drivers/net/wireless/ath/ath9k/ath9k.h | 2 + drivers/net/wireless/ath/ath9k/recv.c | 167 ++++++++++++++++--------- 3 files changed, 109 insertions(+), 61 deletions(-)
drivers/net/wireless/ath/ath9k/Kconfig +1 -0
@@ -22,6 +22,7 @@ config ATH9K tristate "Atheros 802.11n wireless cards support" depends on MAC80211 && HAS_DMA select MAC80211_LEDS if LEDS_CLASS=y || LEDS_CLASS=MAC80211 + select PAGE_POOL select ATH9K_HW select ATH9K_COMMON help
drivers/net/wireless/ath/ath9k/ath9k.h +2 -0
@@ -33,6 +33,7 @@struct ath_node ;struct ath_vif ; +struct page_pool ;extern struct ieee80211_ops ath9k_ops;extern int ath9k_modparam_nohwcrypt;
@@ -312,6 +313,7 @@ struct ath_rx {struct ath_rxbuf *buf_hold;struct sk_buff *frag; +struct page_pool *page_pool;u32 ampdu_ref; };
drivers/net/wireless/ath/ath9k/recv.c +106 -61
246 lines not on this page · raw message
Signature · 1 line
2.56.0