forked from rpms/kernel
		
	Add patches to fix iwl skb managment (rhbz 977040)
This commit is contained in:
		
							parent
							
								
									289de5293a
								
							
						
					
					
						commit
						af1ede06d2
					
				
							
								
								
									
										97
									
								
								iwl3945-better-skb-management-in-rx-path.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										97
									
								
								iwl3945-better-skb-management-in-rx-path.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,97 @@ | ||||
| From: Eric Dumazet <edumazet@google.com> | ||||
| 
 | ||||
| Steinar reported reallocations of skb->head with IPv6, leading to | ||||
| a warning in skb_try_coalesce() | ||||
| 
 | ||||
| It turns out iwl3945 has 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. | ||||
| 
 | ||||
| Reported-by: Steinar H. Gunderson <sesse@google.com> | ||||
| Signed-off-by: Eric Dumazet <edumazet@google.com> | ||||
| Cc: Paul Stewart <pstew@google.com> | ||||
| ---
 | ||||
| v3: use regular memcpy(skb_put(...),...) | ||||
| v2: SMALL_PACKET_SIZE define | ||||
| 
 | ||||
|  drivers/net/wireless/iwlegacy/3945.c |   31 +++++++++++++++---------- | ||||
|  1 file changed, 19 insertions(+), 12 deletions(-) | ||||
| 
 | ||||
| diff --git a/drivers/net/wireless/iwlegacy/3945.c b/drivers/net/wireless/iwlegacy/3945.c
 | ||||
| index c092033..f09e257 100644
 | ||||
| --- a/drivers/net/wireless/iwlegacy/3945.c
 | ||||
| +++ b/drivers/net/wireless/iwlegacy/3945.c
 | ||||
| @@ -475,6 +475,8 @@ il3945_is_network_packet(struct il_priv *il, struct ieee80211_hdr *header)
 | ||||
|  	} | ||||
|  } | ||||
|   | ||||
| +#define SMALL_PACKET_SIZE 256
 | ||||
| +
 | ||||
|  static void | ||||
|  il3945_pass_packet_to_mac80211(struct il_priv *il, struct il_rx_buf *rxb, | ||||
|  			       struct ieee80211_rx_status *stats) | ||||
| @@ -483,14 +485,13 @@ il3945_pass_packet_to_mac80211(struct il_priv *il, struct il_rx_buf *rxb,
 | ||||
|  	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)IL_RX_DATA(pkt); | ||||
|  	struct il3945_rx_frame_hdr *rx_hdr = IL_RX_HDR(pkt); | ||||
|  	struct il3945_rx_frame_end *rx_end = IL_RX_END(pkt); | ||||
| -	u16 len = le16_to_cpu(rx_hdr->len);
 | ||||
| +	u32 len = le16_to_cpu(rx_hdr->len);
 | ||||
|  	struct sk_buff *skb; | ||||
|  	__le16 fc = hdr->frame_control; | ||||
| +	u32 fraglen = PAGE_SIZE << il->hw_params.rx_page_order;
 | ||||
|   | ||||
|  	/* We received data from the HW, so stop the watchdog */ | ||||
| -	if (unlikely
 | ||||
| -	    (len + IL39_RX_FRAME_SIZE >
 | ||||
| -	     PAGE_SIZE << il->hw_params.rx_page_order)) {
 | ||||
| +	if (unlikely(len + IL39_RX_FRAME_SIZE > fraglen)) {
 | ||||
|  		D_DROP("Corruption detected!\n"); | ||||
|  		return; | ||||
|  	} | ||||
| @@ -506,26 +507,32 @@ il3945_pass_packet_to_mac80211(struct il_priv *il, struct il_rx_buf *rxb,
 | ||||
|  		D_INFO("Woke queues - frame received on passive channel\n"); | ||||
|  	} | ||||
|   | ||||
| -	skb = dev_alloc_skb(128);
 | ||||
| +	skb = dev_alloc_skb(SMALL_PACKET_SIZE);
 | ||||
|  	if (!skb) { | ||||
|  		IL_ERR("dev_alloc_skb failed\n"); | ||||
|  		return; | ||||
|  	} | ||||
|   | ||||
|  	if (!il3945_mod_params.sw_crypto) | ||||
| -		il_set_decrypted_flag(il, (struct ieee80211_hdr *)rxb_addr(rxb),
 | ||||
| +		il_set_decrypted_flag(il, (struct ieee80211_hdr *)pkt,
 | ||||
|  				      le32_to_cpu(rx_end->status), stats); | ||||
|   | ||||
| -	skb_add_rx_frag(skb, 0, rxb->page,
 | ||||
| -			(void *)rx_hdr->payload - (void *)pkt, len,
 | ||||
| -			len);
 | ||||
| -
 | ||||
| +	/* If frame is small enough to fit into skb->head, copy it
 | ||||
| +	 * and do not consume a full page
 | ||||
| +	 */
 | ||||
| +	if (len <= SMALL_PACKET_SIZE) {
 | ||||
| +		memcpy(skb_put(skb, len), rx_hdr->payload, len);
 | ||||
| +	} else {
 | ||||
| +		skb_add_rx_frag(skb, 0, rxb->page,
 | ||||
| +				(void *)rx_hdr->payload - (void *)pkt, len,
 | ||||
| +				fraglen);
 | ||||
| +		il->alloc_rxb_page--;
 | ||||
| +		rxb->page = NULL;
 | ||||
| +	}
 | ||||
|  	il_update_stats(il, false, fc, len); | ||||
|  	memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); | ||||
|   | ||||
|  	ieee80211_rx(il->hw, skb); | ||||
| -	il->alloc_rxb_page--;
 | ||||
| -	rxb->page = NULL;
 | ||||
|  } | ||||
|   | ||||
|  #define IL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) | ||||
| 
 | ||||
| 
 | ||||
							
								
								
									
										65
									
								
								iwl4965-better-skb-management-in-rx-path.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								iwl4965-better-skb-management-in-rx-path.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,65 @@ | ||||
| 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> | ||||
| ---
 | ||||
|  drivers/net/wireless/iwlegacy/4965-mac.c | 18 ++++++++++++------ | ||||
|  1 file changed, 12 insertions(+), 6 deletions(-) | ||||
| 
 | ||||
| diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
 | ||||
| index d287fd2..4e5d408 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)
 | ||||
|  	return decrypt_out; | ||||
|  } | ||||
|   | ||||
| +#define SMALL_PACKET_SIZE 256
 | ||||
| +
 | ||||
|  static void | ||||
|  il4965_pass_packet_to_mac80211(struct il_priv *il, struct ieee80211_hdr *hdr, | ||||
| -			       u16 len, u32 ampdu_status, struct il_rx_buf *rxb,
 | ||||
| +			       u32 len, u32 ampdu_status, struct il_rx_buf *rxb,
 | ||||
|  			       struct ieee80211_rx_status *stats) | ||||
|  { | ||||
|  	struct sk_buff *skb; | ||||
| @@ -598,21 +600,25 @@ il4965_pass_packet_to_mac80211(struct il_priv *il, struct ieee80211_hdr *hdr,
 | ||||
|  	    il_set_decrypted_flag(il, hdr, ampdu_status, stats)) | ||||
|  		return; | ||||
|   | ||||
| -	skb = dev_alloc_skb(128);
 | ||||
| +	skb = dev_alloc_skb(SMALL_PACKET_SIZE);
 | ||||
|  	if (!skb) { | ||||
|  		IL_ERR("dev_alloc_skb failed\n"); | ||||
|  		return; | ||||
|  	} | ||||
|   | ||||
| -	skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb), len,
 | ||||
| -			len);
 | ||||
| +	if (len <= SMALL_PACKET_SIZE) {
 | ||||
| +		memcpy(skb_put(skb, len), hdr, len);
 | ||||
| +	} else {
 | ||||
| +		skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb),
 | ||||
| +				len, PAGE_SIZE << il->hw_params.rx_page_order);
 | ||||
| +		il->alloc_rxb_page--;
 | ||||
| +		rxb->page = NULL;
 | ||||
| +	}
 | ||||
|   | ||||
|  	il_update_stats(il, false, fc, len); | ||||
|  	memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); | ||||
|   | ||||
|  	ieee80211_rx(il->hw, skb); | ||||
| -	il->alloc_rxb_page--;
 | ||||
| -	rxb->page = NULL;
 | ||||
|  } | ||||
|   | ||||
|  /* Called for N_RX (legacy ABG frames), or | ||||
| -- 
 | ||||
| 1.7.11.7 | ||||
| 
 | ||||
							
								
								
									
										11
									
								
								kernel.spec
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								kernel.spec
									
									
									
									
									
								
							| @ -788,6 +788,10 @@ Patch25054: bridge-send-query-as-soon-as-leave-is-received.patch | ||||
| #rhbz 977558 | ||||
| Patch25055: ath3k-dont-use-stack-memory-for-DMA.patch | ||||
| 
 | ||||
| #rhbz 977040 | ||||
| Patch25056: iwl3945-better-skb-management-in-rx-path.patch | ||||
| Patch25057: iwl4965-better-skb-management-in-rx-path.patch | ||||
| 
 | ||||
| # END OF PATCH DEFINITIONS | ||||
| 
 | ||||
| %endif | ||||
| @ -1501,6 +1505,10 @@ ApplyPatch bridge-send-query-as-soon-as-leave-is-received.patch | ||||
| #rhbz 977558 | ||||
| ApplyPatch ath3k-dont-use-stack-memory-for-DMA.patch | ||||
| 
 | ||||
| #rhbz 977040 | ||||
| ApplyPatch iwl3945-better-skb-management-in-rx-path.patch | ||||
| ApplyPatch iwl4965-better-skb-management-in-rx-path.patch | ||||
| 
 | ||||
| # END OF PATCH APPLICATIONS | ||||
| 
 | ||||
| %endif | ||||
| @ -2297,6 +2305,9 @@ fi | ||||
| #                 ||----w | | ||||
| #                 ||     || | ||||
| %changelog | ||||
| * Wed Jul 03 2013 Josh Boyer <jwboyer@redhat.com> | ||||
| - Add patches to fix iwl skb managment (rhbz 977040) | ||||
| 
 | ||||
| * Tue Jul 02 2013 Dennis Gilmore <dennis@ausil.us> - 3.10-2 | ||||
| - create a dtb for wandboard quad | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user