aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-12-10 05:57:42 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-01-03 07:01:15 -0500
commita357d7f9855e3002d6aaaea5c40dd1ac02b78de7 (patch)
tree8e292e42105d5837acf61d1808e3e2d3974972ec /drivers
parentf4eabc918c3b88763bc20dd9e2b248aa6c757005 (diff)
mac80211_hwsim: allow testing paged RX
Paged RX, i.e. SKBs with (some of) the data in pages instead of the SKB header data (skb->data) can behave differently in the stack and cause other bugs. To make debugging easier add an option to hwsim to test with such SKBs. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index ff9085502bea..145498f8411f 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -48,6 +48,10 @@ static int channels = 1;
48module_param(channels, int, 0444); 48module_param(channels, int, 0444);
49MODULE_PARM_DESC(channels, "Number of concurrent channels"); 49MODULE_PARM_DESC(channels, "Number of concurrent channels");
50 50
51static bool paged_rx = false;
52module_param(paged_rx, bool, 0644);
53MODULE_PARM_DESC(paged_rx, "Use paged SKBs for RX instead of linear ones");
54
51/** 55/**
52 * enum hwsim_regtest - the type of regulatory tests we offer 56 * enum hwsim_regtest - the type of regulatory tests we offer
53 * 57 *
@@ -755,9 +759,25 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,
755 * reserve some space for our vendor and the normal 759 * reserve some space for our vendor and the normal
756 * radiotap header, since we're copying anyway 760 * radiotap header, since we're copying anyway
757 */ 761 */
758 nskb = skb_copy_expand(skb, 64, 0, GFP_ATOMIC); 762 if (skb->len < PAGE_SIZE && paged_rx) {
759 if (nskb == NULL) 763 struct page *page = alloc_page(GFP_ATOMIC);
760 continue; 764
765 if (!page)
766 continue;
767
768 nskb = dev_alloc_skb(128);
769 if (!nskb) {
770 __free_page(page);
771 continue;
772 }
773
774 memcpy(page_address(page), skb->data, skb->len);
775 skb_add_rx_frag(nskb, 0, page, 0, skb->len, skb->len);
776 } else {
777 nskb = skb_copy(skb, GFP_ATOMIC);
778 if (!nskb)
779 continue;
780 }
761 781
762 if (mac80211_hwsim_addr_match(data2, hdr->addr1)) 782 if (mac80211_hwsim_addr_match(data2, hdr->addr1))
763 ack = true; 783 ack = true;