aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlegacy
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2013-07-01 08:19:30 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-08-01 15:49:34 -0400
commitc1de4a9557d9e25e41fc4ba034b9659152205539 (patch)
tree280ba352c7b952f279493ecd8b6d8f5862330672 /drivers/net/wireless/iwlegacy
parent092c46498e76904a3c21124131a29edff56ce3ed (diff)
iwl4965: better skb management in rx path
4965 version of Eric patch "iwl3945: better skb management in rx path". It fixes several problems : 1) skb->truesize is underestimated. We really consume PAGE_SIZE bytes for a fragment, not the frame length. 2) 128 bytes of initial headroom is a bit low and forces reallocations. 3) We can avoid consuming a full page for small enough frames. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlegacy')
-rw-r--r--drivers/net/wireless/iwlegacy/4965-mac.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index b9b2bb51e605..c4b22e190a54 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -574,9 +574,11 @@ il4965_translate_rx_status(struct il_priv *il, u32 decrypt_in)
574 return decrypt_out; 574 return decrypt_out;
575} 575}
576 576
577#define SMALL_PACKET_SIZE 256
578
577static void 579static void
578il4965_pass_packet_to_mac80211(struct il_priv *il, struct ieee80211_hdr *hdr, 580il4965_pass_packet_to_mac80211(struct il_priv *il, struct ieee80211_hdr *hdr,
579 u16 len, u32 ampdu_status, struct il_rx_buf *rxb, 581 u32 len, u32 ampdu_status, struct il_rx_buf *rxb,
580 struct ieee80211_rx_status *stats) 582 struct ieee80211_rx_status *stats)
581{ 583{
582 struct sk_buff *skb; 584 struct sk_buff *skb;
@@ -598,21 +600,25 @@ il4965_pass_packet_to_mac80211(struct il_priv *il, struct ieee80211_hdr *hdr,
598 il_set_decrypted_flag(il, hdr, ampdu_status, stats)) 600 il_set_decrypted_flag(il, hdr, ampdu_status, stats))
599 return; 601 return;
600 602
601 skb = dev_alloc_skb(128); 603 skb = dev_alloc_skb(SMALL_PACKET_SIZE);
602 if (!skb) { 604 if (!skb) {
603 IL_ERR("dev_alloc_skb failed\n"); 605 IL_ERR("dev_alloc_skb failed\n");
604 return; 606 return;
605 } 607 }
606 608
607 skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb), len, 609 if (len <= SMALL_PACKET_SIZE) {
608 len); 610 memcpy(skb_put(skb, len), hdr, len);
611 } else {
612 skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb),
613 len, PAGE_SIZE << il->hw_params.rx_page_order);
614 il->alloc_rxb_page--;
615 rxb->page = NULL;
616 }
609 617
610 il_update_stats(il, false, fc, len); 618 il_update_stats(il, false, fc, len);
611 memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); 619 memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats));
612 620
613 ieee80211_rx(il->hw, skb); 621 ieee80211_rx(il->hw, skb);
614 il->alloc_rxb_page--;
615 rxb->page = NULL;
616} 622}
617 623
618/* Called for N_RX (legacy ABG frames), or 624/* Called for N_RX (legacy ABG frames), or