aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Robson <robsonde@gmail.com>2017-02-16 00:33:51 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-02-16 13:41:22 -0500
commitb8edc16314d8f41b4d4c2d152e80295bb50262a5 (patch)
tree522acc720e94ef23f2a9e0aecf43272a88c70bbe
parent87bf14fe117e68ba5a146934db7e07ec8402fbb1 (diff)
Staging: rtl8192u: ieee80211: ieee80211_tx.c - style fix
Fixed style of block comments Found using checkpatch Signed-off-by: Derek Robson <robsonde@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c290
1 files changed, 150 insertions, 140 deletions
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
index 949c496084fd..5704e4d7aa68 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
@@ -1,35 +1,34 @@
1/****************************************************************************** 1/******************************************************************************
2 2 *
3 Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved.
4 4 *
5 This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
7 published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 8 *
9 This program is distributed in the hope that it will be useful, but WITHOUT 9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 more details. 12 * more details.
13 13 *
14 You should have received a copy of the GNU General Public License along with 14 * You should have received a copy of the GNU General Public License along with
15 this program; if not, write to the Free Software Foundation, Inc., 59 15 * this program; if not, write to the Free Software Foundation, Inc., 59
16 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 17 *
18 The full GNU General Public License is included in this distribution in the 18 * The full GNU General Public License is included in this distribution in the
19 file called LICENSE. 19 * file called LICENSE.
20 20 *
21 Contact Information: 21 * Contact Information:
22 James P. Ketrenos <ipw2100-admin@linux.intel.com> 22 * James P. Ketrenos <ipw2100-admin@linux.intel.com>
23 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 23 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
24 24 *
25****************************************************************************** 25 *
26 26 * Few modifications for Realtek's Wi-Fi drivers by
27 Few modifications for Realtek's Wi-Fi drivers by 27 * Andrea Merello <andrea.merello@gmail.com>
28 Andrea Merello <andrea.merello@gmail.com> 28 *
29 29 * A special thanks goes to Realtek for their support !
30 A special thanks goes to Realtek for their support ! 30 *
31 31 ******************************************************************************/
32******************************************************************************/
33 32
34#include <linux/compiler.h> 33#include <linux/compiler.h>
35#include <linux/errno.h> 34#include <linux/errno.h>
@@ -55,101 +54,101 @@
55 54
56 55
57/* 56/*
58 57 *
59 58 *
60802.11 Data Frame 59 * 802.11 Data Frame
61 60 *
62 61 *
63802.11 frame_contorl for data frames - 2 bytes 62 * 802.11 frame_contorl for data frames - 2 bytes
64 ,-----------------------------------------------------------------------------------------. 63 * ,-----------------------------------------------------------------------------------------.
65bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | 64 * bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e |
66 |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| 65 * |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------|
67val | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 | 0 | x | x | x | x | x | 66 * val | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 | 0 | x | x | x | x | x |
68 |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| 67 * |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------|
69desc | ^-ver-^ | ^type-^ | ^-----subtype-----^ | to |from |more |retry| pwr |more |wep | 68 * desc | ^-ver-^ | ^type-^ | ^-----subtype-----^ | to |from |more |retry| pwr |more |wep |
70 | | | x=0 data,x=1 data+ack | DS | DS |frag | | mgm |data | | 69 * | | | x=0 data,x=1 data+ack | DS | DS |frag | | mgm |data | |
71 '-----------------------------------------------------------------------------------------' 70 * '-----------------------------------------------------------------------------------------'
72 /\ 71 * /\
73 | 72 * |
74802.11 Data Frame | 73 * 802.11 Data Frame |
75 ,--------- 'ctrl' expands to >-----------' 74 * ,--------- 'ctrl' expands to >-----------'
76 | 75 * |
77 ,--'---,-------------------------------------------------------------. 76 * ,--'---,-------------------------------------------------------------.
78Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | 77 * Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
79 |------|------|---------|---------|---------|------|---------|------| 78 * |------|------|---------|---------|---------|------|---------|------|
80Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs | 79 * Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs |
81 | | tion | (BSSID) | | | ence | data | | 80 * | | tion | (BSSID) | | | ence | data | |
82 `--------------------------------------------------| |------' 81 * `--------------------------------------------------| |------'
83Total: 28 non-data bytes `----.----' 82 * Total: 28 non-data bytes `----.----'
84 | 83 * |
85 .- 'Frame data' expands to <---------------------------' 84 * .- 'Frame data' expands to <---------------------------'
86 | 85 * |
87 V 86 * V
88 ,---------------------------------------------------. 87 * ,---------------------------------------------------.
89Bytes | 1 | 1 | 1 | 3 | 2 | 0-2304 | 88 * Bytes | 1 | 1 | 1 | 3 | 2 | 0-2304 |
90 |------|------|---------|----------|------|---------| 89 * |------|------|---------|----------|------|---------|
91Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP | 90 * Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP |
92 | DSAP | SSAP | | | | Packet | 91 * | DSAP | SSAP | | | | Packet |
93 | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | | 92 * | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | |
94 `-----------------------------------------| | 93 * `-----------------------------------------| |
95Total: 8 non-data bytes `----.----' 94 * Total: 8 non-data bytes `----.----'
96 | 95 * |
97 .- 'IP Packet' expands, if WEP enabled, to <--' 96 * .- 'IP Packet' expands, if WEP enabled, to <--'
98 | 97 * |
99 V 98 * V
100 ,-----------------------. 99 * ,-----------------------.
101Bytes | 4 | 0-2296 | 4 | 100 * Bytes | 4 | 0-2296 | 4 |
102 |-----|-----------|-----| 101 * |-----|-----------|-----|
103Desc. | IV | Encrypted | ICV | 102 * Desc. | IV | Encrypted | ICV |
104 | | IP Packet | | 103 * | | IP Packet | |
105 `-----------------------' 104 * `-----------------------'
106Total: 8 non-data bytes 105 * Total: 8 non-data bytes
107 106 *
108 107 *
109802.3 Ethernet Data Frame 108 * 802.3 Ethernet Data Frame
110 109 *
111 ,-----------------------------------------. 110 * ,-----------------------------------------.
112Bytes | 6 | 6 | 2 | Variable | 4 | 111 * Bytes | 6 | 6 | 2 | Variable | 4 |
113 |-------|-------|------|-----------|------| 112 * |-------|-------|------|-----------|------|
114Desc. | Dest. | Source| Type | IP Packet | fcs | 113 * Desc. | Dest. | Source| Type | IP Packet | fcs |
115 | MAC | MAC | | | | 114 * | MAC | MAC | | | |
116 `-----------------------------------------' 115 * `-----------------------------------------'
117Total: 18 non-data bytes 116 * Total: 18 non-data bytes
118 117 *
119In the event that fragmentation is required, the incoming payload is split into 118 * In the event that fragmentation is required, the incoming payload is split into
120N parts of size ieee->fts. The first fragment contains the SNAP header and the 119 * N parts of size ieee->fts. The first fragment contains the SNAP header and the
121remaining packets are just data. 120 * remaining packets are just data.
122 121 *
123If encryption is enabled, each fragment payload size is reduced by enough space 122 * If encryption is enabled, each fragment payload size is reduced by enough space
124to add the prefix and postfix (IV and ICV totalling 8 bytes in the case of WEP) 123 * to add the prefix and postfix (IV and ICV totalling 8 bytes in the case of WEP)
125So if you have 1500 bytes of payload with ieee->fts set to 500 without 124 * So if you have 1500 bytes of payload with ieee->fts set to 500 without
126encryption it will take 3 frames. With WEP it will take 4 frames as the 125 * encryption it will take 3 frames. With WEP it will take 4 frames as the
127payload of each frame is reduced to 492 bytes. 126 * payload of each frame is reduced to 492 bytes.
128 127 *
129* SKB visualization 128 * SKB visualization
130* 129 *
131* ,- skb->data 130 * ,- skb->data
132* | 131 * |
133* | ETHERNET HEADER ,-<-- PAYLOAD 132 * | ETHERNET HEADER ,-<-- PAYLOAD
134* | | 14 bytes from skb->data 133 * | | 14 bytes from skb->data
135* | 2 bytes for Type --> ,T. | (sizeof ethhdr) 134 * | 2 bytes for Type --> ,T. | (sizeof ethhdr)
136* | | | | 135 * | | | |
137* |,-Dest.--. ,--Src.---. | | | 136 * |,-Dest.--. ,--Src.---. | | |
138* | 6 bytes| | 6 bytes | | | | 137 * | 6 bytes| | 6 bytes | | | |
139* v | | | | | | 138 * v | | | | | |
140* 0 | v 1 | v | v 2 139 * 0 | v 1 | v | v 2
141* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 140 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
142* ^ | ^ | ^ | 141 * ^ | ^ | ^ |
143* | | | | | | 142 * | | | | | |
144* | | | | `T' <---- 2 bytes for Type 143 * | | | | `T' <---- 2 bytes for Type
145* | | | | 144 * | | | |
146* | | '---SNAP--' <-------- 6 bytes for SNAP 145 * | | '---SNAP--' <-------- 6 bytes for SNAP
147* | | 146 * | |
148* `-IV--' <-------------------- 4 bytes for IV (WEP) 147 * `-IV--' <-------------------- 4 bytes for IV (WEP)
149* 148 *
150* SNAP HEADER 149 * SNAP HEADER
151* 150 *
152*/ 151 */
153 152
154static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; 153static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
155static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; 154static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
@@ -205,11 +204,13 @@ int ieee80211_encrypt_fragment(
205 } 204 }
206 205
207 /* To encrypt, frame format is: 206 /* To encrypt, frame format is:
208 * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) */ 207 * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes)
208 */
209 209
210 // PR: FIXME: Copied from hostap. Check fragmentation/MSDU/MPDU encryption. 210 // PR: FIXME: Copied from hostap. Check fragmentation/MSDU/MPDU encryption.
211 /* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so 211 /* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so
212 * call both MSDU and MPDU encryption functions from here. */ 212 * call both MSDU and MPDU encryption functions from here.
213 */
213 atomic_inc(&crypt->refcnt); 214 atomic_inc(&crypt->refcnt);
214 res = 0; 215 res = 0;
215 if (crypt->ops->encrypt_msdu) 216 if (crypt->ops->encrypt_msdu)
@@ -620,7 +621,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
620 spin_lock_irqsave(&ieee->lock, flags); 621 spin_lock_irqsave(&ieee->lock, flags);
621 622
622 /* If there is no driver handler to take the TXB, dont' bother 623 /* If there is no driver handler to take the TXB, dont' bother
623 * creating it... */ 624 * creating it...
625 */
624 if ((!ieee->hard_start_xmit && !(ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE))|| 626 if ((!ieee->hard_start_xmit && !(ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE))||
625 ((!ieee->softmac_data_hard_start_xmit && (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)))) { 627 ((!ieee->softmac_data_hard_start_xmit && (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)))) {
626 printk(KERN_WARNING "%s: No xmit handler.\n", 628 printk(KERN_WARNING "%s: No xmit handler.\n",
@@ -683,13 +685,15 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
683 if (ieee->iw_mode == IW_MODE_INFRA) { 685 if (ieee->iw_mode == IW_MODE_INFRA) {
684 fc |= IEEE80211_FCTL_TODS; 686 fc |= IEEE80211_FCTL_TODS;
685 /* To DS: Addr1 = BSSID, Addr2 = SA, 687 /* To DS: Addr1 = BSSID, Addr2 = SA,
686 Addr3 = DA */ 688 * Addr3 = DA
689 */
687 memcpy(&header.addr1, ieee->current_network.bssid, ETH_ALEN); 690 memcpy(&header.addr1, ieee->current_network.bssid, ETH_ALEN);
688 memcpy(&header.addr2, &src, ETH_ALEN); 691 memcpy(&header.addr2, &src, ETH_ALEN);
689 memcpy(&header.addr3, &dest, ETH_ALEN); 692 memcpy(&header.addr3, &dest, ETH_ALEN);
690 } else if (ieee->iw_mode == IW_MODE_ADHOC) { 693 } else if (ieee->iw_mode == IW_MODE_ADHOC) {
691 /* not From/To DS: Addr1 = DA, Addr2 = SA, 694 /* not From/To DS: Addr1 = DA, Addr2 = SA,
692 Addr3 = BSSID */ 695 * Addr3 = BSSID
696 */
693 memcpy(&header.addr1, dest, ETH_ALEN); 697 memcpy(&header.addr1, dest, ETH_ALEN);
694 memcpy(&header.addr2, src, ETH_ALEN); 698 memcpy(&header.addr2, src, ETH_ALEN);
695 memcpy(&header.addr3, ieee->current_network.bssid, ETH_ALEN); 699 memcpy(&header.addr3, ieee->current_network.bssid, ETH_ALEN);
@@ -698,7 +702,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
698 header.frame_ctl = cpu_to_le16(fc); 702 header.frame_ctl = cpu_to_le16(fc);
699 703
700 /* Determine fragmentation size based on destination (multicast 704 /* Determine fragmentation size based on destination (multicast
701 * and broadcast are not fragmented) */ 705 * and broadcast are not fragmented)
706 */
702 if (is_multicast_ether_addr(header.addr1)) { 707 if (is_multicast_ether_addr(header.addr1)) {
703 frag_size = MAX_FRAG_THRESHOLD; 708 frag_size = MAX_FRAG_THRESHOLD;
704 qos_ctl |= QOS_CTL_NOTCONTAIN_ACK; 709 qos_ctl |= QOS_CTL_NOTCONTAIN_ACK;
@@ -720,9 +725,10 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
720 hdr_len = IEEE80211_3ADDR_LEN; 725 hdr_len = IEEE80211_3ADDR_LEN;
721 } 726 }
722 /* Determine amount of payload per fragment. Regardless of if 727 /* Determine amount of payload per fragment. Regardless of if
723 * this stack is providing the full 802.11 header, one will 728 * this stack is providing the full 802.11 header, one will
724 * eventually be affixed to this fragment -- so we must account for 729 * eventually be affixed to this fragment -- so we must account for
725 * it when determining the amount of payload space. */ 730 * it when determining the amount of payload space.
731 */
726 bytes_per_frag = frag_size - hdr_len; 732 bytes_per_frag = frag_size - hdr_len;
727 if (ieee->config & 733 if (ieee->config &
728 (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) 734 (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
@@ -734,7 +740,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
734 crypt->ops->extra_postfix_len; 740 crypt->ops->extra_postfix_len;
735 741
736 /* Number of fragments is the total bytes_per_frag / 742 /* Number of fragments is the total bytes_per_frag /
737 * payload_per_fragment */ 743 * payload_per_fragment
744 */
738 nr_frags = bytes / bytes_per_frag; 745 nr_frags = bytes / bytes_per_frag;
739 bytes_last_frag = bytes % bytes_per_frag; 746 bytes_last_frag = bytes % bytes_per_frag;
740 if (bytes_last_frag) 747 if (bytes_last_frag)
@@ -743,8 +750,9 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
743 bytes_last_frag = bytes_per_frag; 750 bytes_last_frag = bytes_per_frag;
744 751
745 /* When we allocate the TXB we allocate enough space for the reserve 752 /* When we allocate the TXB we allocate enough space for the reserve
746 * and full fragment bytes (bytes_per_frag doesn't include prefix, 753 * and full fragment bytes (bytes_per_frag doesn't include prefix,
747 * postfix, header, FCS, etc.) */ 754 * postfix, header, FCS, etc.)
755 */
748 txb = ieee80211_alloc_txb(nr_frags, frag_size + ieee->tx_headroom, GFP_ATOMIC); 756 txb = ieee80211_alloc_txb(nr_frags, frag_size + ieee->tx_headroom, GFP_ATOMIC);
749 if (unlikely(!txb)) { 757 if (unlikely(!txb)) {
750 printk(KERN_WARNING "%s: Could not allocate TXB\n", 758 printk(KERN_WARNING "%s: Could not allocate TXB\n",
@@ -791,7 +799,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
791 memcpy(frag_hdr, &header, hdr_len); 799 memcpy(frag_hdr, &header, hdr_len);
792 800
793 /* If this is not the last fragment, then add the MOREFRAGS 801 /* If this is not the last fragment, then add the MOREFRAGS
794 * bit to the frame control */ 802 * bit to the frame control
803 */
795 if (i != nr_frags - 1) { 804 if (i != nr_frags - 1) {
796 frag_hdr->frame_ctl = cpu_to_le16( 805 frag_hdr->frame_ctl = cpu_to_le16(
797 fc | IEEE80211_FCTL_MOREFRAGS); 806 fc | IEEE80211_FCTL_MOREFRAGS);
@@ -824,7 +833,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
824 skb_pull(skb, bytes); 833 skb_pull(skb, bytes);
825 834
826 /* Encryption routine will move the header forward in order 835 /* Encryption routine will move the header forward in order
827 * to insert the IV between the header and the payload */ 836 * to insert the IV between the header and the payload
837 */
828 if (encrypt) 838 if (encrypt)
829 ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len); 839 ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
830 if (ieee->config & 840 if (ieee->config &