diff options
author | Zhu Yi <yi.zhu@intel.com> | 2010-03-29 04:42:26 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-03-31 14:43:58 -0400 |
commit | ecdf94b81237d272b1514b76f27a5d22782bcaa6 (patch) | |
tree | 53487ff42cf5f183faae9b9a8693c60eef8aae7d | |
parent | e3cf8b3f7b9eefbe1d39b160726d6e5c2cbb4c5d (diff) |
iwlwifi: remove skb_linearize for rx frames
Remove skb_linearize() in the iwlwifi drivers since
mac80211 supports paged rx SKBs now.
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945.c | 29 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 32 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 7 |
3 files changed, 4 insertions, 64 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 6b7201551ca7..2c16c5c10bc5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -548,7 +548,6 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl_priv *priv, | |||
548 | struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt); | 548 | struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt); |
549 | u16 len = le16_to_cpu(rx_hdr->len); | 549 | u16 len = le16_to_cpu(rx_hdr->len); |
550 | struct sk_buff *skb; | 550 | struct sk_buff *skb; |
551 | int ret; | ||
552 | __le16 fc = hdr->frame_control; | 551 | __le16 fc = hdr->frame_control; |
553 | 552 | ||
554 | /* We received data from the HW, so stop the watchdog */ | 553 | /* We received data from the HW, so stop the watchdog */ |
@@ -565,9 +564,9 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl_priv *priv, | |||
565 | return; | 564 | return; |
566 | } | 565 | } |
567 | 566 | ||
568 | skb = alloc_skb(IWL_LINK_HDR_MAX * 2, GFP_ATOMIC); | 567 | skb = dev_alloc_skb(128); |
569 | if (!skb) { | 568 | if (!skb) { |
570 | IWL_ERR(priv, "alloc_skb failed\n"); | 569 | IWL_ERR(priv, "dev_alloc_skb failed\n"); |
571 | return; | 570 | return; |
572 | } | 571 | } |
573 | 572 | ||
@@ -576,37 +575,13 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl_priv *priv, | |||
576 | (struct ieee80211_hdr *)rxb_addr(rxb), | 575 | (struct ieee80211_hdr *)rxb_addr(rxb), |
577 | le32_to_cpu(rx_end->status), stats); | 576 | le32_to_cpu(rx_end->status), stats); |
578 | 577 | ||
579 | skb_reserve(skb, IWL_LINK_HDR_MAX); | ||
580 | skb_add_rx_frag(skb, 0, rxb->page, | 578 | skb_add_rx_frag(skb, 0, rxb->page, |
581 | (void *)rx_hdr->payload - (void *)pkt, len); | 579 | (void *)rx_hdr->payload - (void *)pkt, len); |
582 | 580 | ||
583 | /* mac80211 currently doesn't support paged SKB. Convert it to | ||
584 | * linear SKB for management frame and data frame requires | ||
585 | * software decryption or software defragementation. */ | ||
586 | if (ieee80211_is_mgmt(fc) || | ||
587 | ieee80211_has_protected(fc) || | ||
588 | ieee80211_has_morefrags(fc) || | ||
589 | le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) | ||
590 | ret = skb_linearize(skb); | ||
591 | else | ||
592 | ret = __pskb_pull_tail(skb, min_t(u16, IWL_LINK_HDR_MAX, len)) ? | ||
593 | 0 : -ENOMEM; | ||
594 | |||
595 | if (ret) { | ||
596 | kfree_skb(skb); | ||
597 | goto out; | ||
598 | } | ||
599 | |||
600 | /* | ||
601 | * XXX: We cannot touch the page and its virtual memory (pkt) after | ||
602 | * here. It might have already been freed by the above skb change. | ||
603 | */ | ||
604 | |||
605 | iwl_update_stats(priv, false, fc, len); | 581 | iwl_update_stats(priv, false, fc, len); |
606 | memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); | 582 | memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); |
607 | 583 | ||
608 | ieee80211_rx(priv->hw, skb); | 584 | ieee80211_rx(priv->hw, skb); |
609 | out: | ||
610 | priv->alloc_rxb_page--; | 585 | priv->alloc_rxb_page--; |
611 | rxb->page = NULL; | 586 | rxb->page = NULL; |
612 | } | 587 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c index e8e3118ec0ad..1d2e84c1fad5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c | |||
@@ -931,7 +931,6 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv, | |||
931 | struct ieee80211_rx_status *stats) | 931 | struct ieee80211_rx_status *stats) |
932 | { | 932 | { |
933 | struct sk_buff *skb; | 933 | struct sk_buff *skb; |
934 | int ret = 0; | ||
935 | __le16 fc = hdr->frame_control; | 934 | __le16 fc = hdr->frame_control; |
936 | 935 | ||
937 | /* We only process data packets if the interface is open */ | 936 | /* We only process data packets if the interface is open */ |
@@ -946,45 +945,18 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv, | |||
946 | iwl_set_decrypted_flag(priv, hdr, ampdu_status, stats)) | 945 | iwl_set_decrypted_flag(priv, hdr, ampdu_status, stats)) |
947 | return; | 946 | return; |
948 | 947 | ||
949 | skb = alloc_skb(IWL_LINK_HDR_MAX * 2, GFP_ATOMIC); | 948 | skb = dev_alloc_skb(128); |
950 | if (!skb) { | 949 | if (!skb) { |
951 | IWL_ERR(priv, "alloc_skb failed\n"); | 950 | IWL_ERR(priv, "dev_alloc_skb failed\n"); |
952 | return; | 951 | return; |
953 | } | 952 | } |
954 | 953 | ||
955 | skb_reserve(skb, IWL_LINK_HDR_MAX); | ||
956 | skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb), len); | 954 | skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb), len); |
957 | 955 | ||
958 | /* mac80211 currently doesn't support paged SKB. Convert it to | ||
959 | * linear SKB for management frame and data frame requires | ||
960 | * software decryption or software defragementation. */ | ||
961 | if (ieee80211_is_mgmt(fc) || | ||
962 | ieee80211_has_protected(fc) || | ||
963 | ieee80211_has_morefrags(fc) || | ||
964 | le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG || | ||
965 | (ieee80211_is_data_qos(fc) && | ||
966 | *ieee80211_get_qos_ctl(hdr) & | ||
967 | IEEE80211_QOS_CONTROL_A_MSDU_PRESENT)) | ||
968 | ret = skb_linearize(skb); | ||
969 | else | ||
970 | ret = __pskb_pull_tail(skb, min_t(u16, IWL_LINK_HDR_MAX, len)) ? | ||
971 | 0 : -ENOMEM; | ||
972 | |||
973 | if (ret) { | ||
974 | kfree_skb(skb); | ||
975 | goto out; | ||
976 | } | ||
977 | |||
978 | /* | ||
979 | * XXX: We cannot touch the page and its virtual memory (hdr) after | ||
980 | * here. It might have already been freed by the above skb change. | ||
981 | */ | ||
982 | |||
983 | iwl_update_stats(priv, false, fc, len); | 956 | iwl_update_stats(priv, false, fc, len); |
984 | memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); | 957 | memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); |
985 | 958 | ||
986 | ieee80211_rx(priv->hw, skb); | 959 | ieee80211_rx(priv->hw, skb); |
987 | out: | ||
988 | priv->alloc_rxb_page--; | 960 | priv->alloc_rxb_page--; |
989 | rxb->page = NULL; | 961 | rxb->page = NULL; |
990 | } | 962 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index bff182ffeac9..46a574080160 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -325,13 +325,6 @@ enum { | |||
325 | 325 | ||
326 | #define DEF_CMD_PAYLOAD_SIZE 320 | 326 | #define DEF_CMD_PAYLOAD_SIZE 320 |
327 | 327 | ||
328 | /* | ||
329 | * IWL_LINK_HDR_MAX should include ieee80211_hdr, radiotap header, | ||
330 | * SNAP header and alignment. It should also be big enough for 802.11 | ||
331 | * control frames. | ||
332 | */ | ||
333 | #define IWL_LINK_HDR_MAX 64 | ||
334 | |||
335 | /** | 328 | /** |
336 | * struct iwl_device_cmd | 329 | * struct iwl_device_cmd |
337 | * | 330 | * |