aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rx.c21
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.h1
3 files changed, 17 insertions, 8 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
index f4b84d1596e3..22474608a70b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
@@ -773,8 +773,7 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv,
773 struct sk_buff *skb; 773 struct sk_buff *skb;
774 __le16 fc = hdr->frame_control; 774 __le16 fc = hdr->frame_control;
775 struct iwl_rxon_context *ctx; 775 struct iwl_rxon_context *ctx;
776 struct page *p; 776 unsigned int hdrlen, fraglen;
777 int offset;
778 777
779 /* We only process data packets if the interface is open */ 778 /* We only process data packets if the interface is open */
780 if (unlikely(!priv->is_open)) { 779 if (unlikely(!priv->is_open)) {
@@ -788,16 +787,24 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv,
788 iwlagn_set_decrypted_flag(priv, hdr, ampdu_status, stats)) 787 iwlagn_set_decrypted_flag(priv, hdr, ampdu_status, stats))
789 return; 788 return;
790 789
791 skb = dev_alloc_skb(128); 790 /* Dont use dev_alloc_skb(), we'll have enough headroom once
791 * ieee80211_hdr pulled.
792 */
793 skb = alloc_skb(128, GFP_ATOMIC);
792 if (!skb) { 794 if (!skb) {
793 IWL_ERR(priv, "dev_alloc_skb failed\n"); 795 IWL_ERR(priv, "alloc_skb failed\n");
794 return; 796 return;
795 } 797 }
798 hdrlen = min_t(unsigned int, len, skb_tailroom(skb));
799 memcpy(skb_put(skb, hdrlen), hdr, hdrlen);
800 fraglen = len - hdrlen;
796 801
797 offset = (void *)hdr - rxb_addr(rxb); 802 if (fraglen) {
798 p = rxb_steal_page(rxb); 803 int offset = (void *)hdr + hdrlen - rxb_addr(rxb);
799 skb_add_rx_frag(skb, 0, p, offset, len, len);
800 804
805 skb_add_rx_frag(skb, 0, rxb_steal_page(rxb), offset,
806 fraglen, rxb->truesize);
807 }
801 iwl_update_stats(priv, false, fc, len); 808 iwl_update_stats(priv, false, fc, len);
802 809
803 /* 810 /*
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
index 8b1a7988e176..aa7aea168138 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
@@ -374,8 +374,9 @@ static void iwl_rx_handle_rxbuf(struct iwl_trans *trans,
374 if (WARN_ON(!rxb)) 374 if (WARN_ON(!rxb))
375 return; 375 return;
376 376
377 rxcb.truesize = PAGE_SIZE << hw_params(trans).rx_page_order;
377 dma_unmap_page(trans->dev, rxb->page_dma, 378 dma_unmap_page(trans->dev, rxb->page_dma,
378 PAGE_SIZE << hw_params(trans).rx_page_order, 379 rxcb.truesize,
379 DMA_FROM_DEVICE); 380 DMA_FROM_DEVICE);
380 381
381 rxcb._page = rxb->page; 382 rxcb._page = rxb->page;
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index 0c81cbaa8088..fdf97886a5e4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -260,6 +260,7 @@ static inline void iwl_free_resp(struct iwl_host_cmd *cmd)
260 260
261struct iwl_rx_cmd_buffer { 261struct iwl_rx_cmd_buffer {
262 struct page *_page; 262 struct page *_page;
263 unsigned int truesize;
263}; 264};
264 265
265static inline void *rxb_addr(struct iwl_rx_cmd_buffer *r) 266static inline void *rxb_addr(struct iwl_rx_cmd_buffer *r)