aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtlwifi/pci.c
diff options
context:
space:
mode:
authorMike McCormack <mikem@ring3k.org>2011-06-06 10:13:06 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-06-10 14:26:51 -0400
commitfd854772c11d6ad0377f0b613142e397bec58a3a (patch)
tree3a1fb323bf53f8ef9201cff11ff441f407238f8c /drivers/net/wireless/rtlwifi/pci.c
parent14058adddd4fd40e45c434c801e8ed8baf09251e (diff)
rtlwifi: Factor out code to receive one packet
Signed-off-by: Mike McCormack <mikem@ring3k.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rtlwifi/pci.c')
-rw-r--r--drivers/net/wireless/rtlwifi/pci.c99
1 files changed, 51 insertions, 48 deletions
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index b60c1abb1a3..cb4e5e80c9c 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -626,6 +626,56 @@ tx_status_ok:
626 } 626 }
627} 627}
628 628
629static void _rtl_receive_one(struct ieee80211_hw *hw, struct sk_buff *skb,
630 struct ieee80211_rx_status rx_status)
631{
632 struct rtl_priv *rtlpriv = rtl_priv(hw);
633 struct ieee80211_hdr *hdr = rtl_get_hdr(skb);
634 __le16 fc = rtl_get_fc(skb);
635 bool unicast = false;
636 struct sk_buff *uskb = NULL;
637 u8 *pdata;
638
639
640 memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status));
641
642 if (is_broadcast_ether_addr(hdr->addr1)) {
643 ;/*TODO*/
644 } else if (is_multicast_ether_addr(hdr->addr1)) {
645 ;/*TODO*/
646 } else {
647 unicast = true;
648 rtlpriv->stats.rxbytesunicast += skb->len;
649 }
650
651 rtl_is_special_data(hw, skb, false);
652
653 if (ieee80211_is_data(fc)) {
654 rtlpriv->cfg->ops->led_control(hw, LED_CTL_RX);
655
656 if (unicast)
657 rtlpriv->link_info.num_rx_inperiod++;
658 }
659
660 /* for sw lps */
661 rtl_swlps_beacon(hw, (void *)skb->data, skb->len);
662 rtl_recognize_peer(hw, (void *)skb->data, skb->len);
663 if ((rtlpriv->mac80211.opmode == NL80211_IFTYPE_AP) &&
664 (rtlpriv->rtlhal.current_bandtype == BAND_ON_2_4G) &&
665 (ieee80211_is_beacon(fc) || ieee80211_is_probe_resp(fc)))
666 return;
667
668 if (unlikely(!rtl_action_proc(hw, skb, false)))
669 return;
670
671 uskb = dev_alloc_skb(skb->len + 128);
672 memcpy(IEEE80211_SKB_RXCB(uskb), &rx_status, sizeof(rx_status));
673 pdata = (u8 *)skb_put(uskb, skb->len);
674 memcpy(pdata, skb->data, skb->len);
675
676 ieee80211_rx_irqsafe(hw, uskb);
677}
678
629static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) 679static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
630{ 680{
631 struct rtl_priv *rtlpriv = rtl_priv(hw); 681 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -637,7 +687,6 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
637 u8 own; 687 u8 own;
638 u8 tmp_one; 688 u8 tmp_one;
639 u32 bufferaddress; 689 u32 bufferaddress;
640 bool unicast = false;
641 690
642 struct rtl_stats stats = { 691 struct rtl_stats stats = {
643 .signal = 0, 692 .signal = 0,
@@ -654,8 +703,6 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
654 /*rx pkt */ 703 /*rx pkt */
655 struct sk_buff *skb = rtlpci->rx_ring[rx_queue_idx].rx_buf[ 704 struct sk_buff *skb = rtlpci->rx_ring[rx_queue_idx].rx_buf[
656 index]; 705 index];
657 struct ieee80211_hdr *hdr;
658 __le16 fc;
659 struct sk_buff *new_skb = NULL; 706 struct sk_buff *new_skb = NULL;
660 707
661 own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) pdesc, 708 own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) pdesc,
@@ -696,51 +743,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
696 * skb_trim(skb, skb->len - 4); 743 * skb_trim(skb, skb->len - 4);
697 */ 744 */
698 745
699 hdr = rtl_get_hdr(skb); 746 _rtl_receive_one(hw, skb, rx_status);
700 fc = rtl_get_fc(skb);
701
702 memcpy(IEEE80211_SKB_RXCB(skb), &rx_status,
703 sizeof(rx_status));
704
705 if (is_broadcast_ether_addr(hdr->addr1)) {
706 ;/*TODO*/
707 } else if (is_multicast_ether_addr(hdr->addr1)) {
708 ;/*TODO*/
709 } else {
710 unicast = true;
711 rtlpriv->stats.rxbytesunicast += skb->len;
712 }
713
714 rtl_is_special_data(hw, skb, false);
715
716 if (ieee80211_is_data(fc)) {
717 rtlpriv->cfg->ops->led_control(hw, LED_CTL_RX);
718
719 if (unicast)
720 rtlpriv->link_info.num_rx_inperiod++;
721 }
722
723 /* for sw lps */
724 rtl_swlps_beacon(hw, (void *)skb->data, skb->len);
725 rtl_recognize_peer(hw, (void *)skb->data, skb->len);
726 if ((rtlpriv->mac80211.opmode == NL80211_IFTYPE_AP) &&
727 (rtlpriv->rtlhal.current_bandtype == BAND_ON_2_4G) &&
728 (ieee80211_is_beacon(fc) ||
729 ieee80211_is_probe_resp(fc))) {
730 ;
731 } else {
732 if (likely(rtl_action_proc(hw, skb, false))) {
733 struct sk_buff *uskb = NULL;
734 u8 *pdata;
735 uskb = dev_alloc_skb(skb->len + 128);
736 memcpy(IEEE80211_SKB_RXCB(uskb),
737 &rx_status, sizeof(rx_status));
738 pdata = (u8 *)skb_put(uskb, skb->len);
739 memcpy(pdata, skb->data, skb->len);
740
741 ieee80211_rx_irqsafe(hw, uskb);
742 }
743 }
744 747
745 if (((rtlpriv->link_info.num_rx_inperiod + 748 if (((rtlpriv->link_info.num_rx_inperiod +
746 rtlpriv->link_info.num_tx_inperiod) > 8) || 749 rtlpriv->link_info.num_tx_inperiod) > 8) ||