From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754077AbdBPFeL (ORCPT ); Thu, 16 Feb 2017 00:34:11 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:36251 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753757AbdBPFeJ (ORCPT ); Thu, 16 Feb 2017 00:34:09 -0500 From: Derek Robson To: gregkh@linuxfoundation.org, binoy.jayan@linaro.org, robsonde@gmail.com Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 13/15] Staging: rtl8192u: ieee80211: ieee80211_tx.c - style fix Date: Thu, 16 Feb 2017 18:33:51 +1300 Message-Id: X-Mailer: git-send-email 2.11.1 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fixed style of block comments Found using checkpatch Signed-off-by: Derek Robson --- drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c | 290 +++++++++++----------- 1 file 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 @@ /****************************************************************************** - - Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved. - - This program is free software; you can redistribute it and/or modify it - under the terms of version 2 of the GNU General Public License as - published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 - Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - The full GNU General Public License is included in this distribution in the - file called LICENSE. - - Contact Information: - James P. Ketrenos - Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - -****************************************************************************** - - Few modifications for Realtek's Wi-Fi drivers by - Andrea Merello - - A special thanks goes to Realtek for their support ! - -******************************************************************************/ + * + * Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The full GNU General Public License is included in this distribution in the + * file called LICENSE. + * + * Contact Information: + * James P. Ketrenos + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + * + * + * Few modifications for Realtek's Wi-Fi drivers by + * Andrea Merello + * + * A special thanks goes to Realtek for their support ! + * + ******************************************************************************/ #include #include @@ -55,101 +54,101 @@ /* - - -802.11 Data Frame - - -802.11 frame_contorl for data frames - 2 bytes - ,-----------------------------------------------------------------------------------------. -bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | - |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| -val | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 | 0 | x | x | x | x | x | - |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| -desc | ^-ver-^ | ^type-^ | ^-----subtype-----^ | to |from |more |retry| pwr |more |wep | - | | | x=0 data,x=1 data+ack | DS | DS |frag | | mgm |data | | - '-----------------------------------------------------------------------------------------' - /\ - | -802.11 Data Frame | - ,--------- 'ctrl' expands to >-----------' - | - ,--'---,-------------------------------------------------------------. -Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | - |------|------|---------|---------|---------|------|---------|------| -Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs | - | | tion | (BSSID) | | | ence | data | | - `--------------------------------------------------| |------' -Total: 28 non-data bytes `----.----' - | - .- 'Frame data' expands to <---------------------------' - | - V - ,---------------------------------------------------. -Bytes | 1 | 1 | 1 | 3 | 2 | 0-2304 | - |------|------|---------|----------|------|---------| -Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP | - | DSAP | SSAP | | | | Packet | - | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | | - `-----------------------------------------| | -Total: 8 non-data bytes `----.----' - | - .- 'IP Packet' expands, if WEP enabled, to <--' - | - V - ,-----------------------. -Bytes | 4 | 0-2296 | 4 | - |-----|-----------|-----| -Desc. | IV | Encrypted | ICV | - | | IP Packet | | - `-----------------------' -Total: 8 non-data bytes - - -802.3 Ethernet Data Frame - - ,-----------------------------------------. -Bytes | 6 | 6 | 2 | Variable | 4 | - |-------|-------|------|-----------|------| -Desc. | Dest. | Source| Type | IP Packet | fcs | - | MAC | MAC | | | | - `-----------------------------------------' -Total: 18 non-data bytes - -In the event that fragmentation is required, the incoming payload is split into -N parts of size ieee->fts. The first fragment contains the SNAP header and the -remaining packets are just data. - -If encryption is enabled, each fragment payload size is reduced by enough space -to add the prefix and postfix (IV and ICV totalling 8 bytes in the case of WEP) -So if you have 1500 bytes of payload with ieee->fts set to 500 without -encryption it will take 3 frames. With WEP it will take 4 frames as the -payload of each frame is reduced to 492 bytes. - -* SKB visualization -* -* ,- skb->data -* | -* | ETHERNET HEADER ,-<-- PAYLOAD -* | | 14 bytes from skb->data -* | 2 bytes for Type --> ,T. | (sizeof ethhdr) -* | | | | -* |,-Dest.--. ,--Src.---. | | | -* | 6 bytes| | 6 bytes | | | | -* v | | | | | | -* 0 | v 1 | v | v 2 -* 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 -* ^ | ^ | ^ | -* | | | | | | -* | | | | `T' <---- 2 bytes for Type -* | | | | -* | | '---SNAP--' <-------- 6 bytes for SNAP -* | | -* `-IV--' <-------------------- 4 bytes for IV (WEP) -* -* SNAP HEADER -* -*/ + * + * + * 802.11 Data Frame + * + * + * 802.11 frame_contorl for data frames - 2 bytes + * ,-----------------------------------------------------------------------------------------. + * bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | + * |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| + * val | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 | 0 | x | x | x | x | x | + * |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| + * desc | ^-ver-^ | ^type-^ | ^-----subtype-----^ | to |from |more |retry| pwr |more |wep | + * | | | x=0 data,x=1 data+ack | DS | DS |frag | | mgm |data | | + * '-----------------------------------------------------------------------------------------' + * /\ + * | + * 802.11 Data Frame | + * ,--------- 'ctrl' expands to >-----------' + * | + * ,--'---,-------------------------------------------------------------. + * Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | + * |------|------|---------|---------|---------|------|---------|------| + * Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs | + * | | tion | (BSSID) | | | ence | data | | + * `--------------------------------------------------| |------' + * Total: 28 non-data bytes `----.----' + * | + * .- 'Frame data' expands to <---------------------------' + * | + * V + * ,---------------------------------------------------. + * Bytes | 1 | 1 | 1 | 3 | 2 | 0-2304 | + * |------|------|---------|----------|------|---------| + * Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP | + * | DSAP | SSAP | | | | Packet | + * | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | | + * `-----------------------------------------| | + * Total: 8 non-data bytes `----.----' + * | + * .- 'IP Packet' expands, if WEP enabled, to <--' + * | + * V + * ,-----------------------. + * Bytes | 4 | 0-2296 | 4 | + * |-----|-----------|-----| + * Desc. | IV | Encrypted | ICV | + * | | IP Packet | | + * `-----------------------' + * Total: 8 non-data bytes + * + * + * 802.3 Ethernet Data Frame + * + * ,-----------------------------------------. + * Bytes | 6 | 6 | 2 | Variable | 4 | + * |-------|-------|------|-----------|------| + * Desc. | Dest. | Source| Type | IP Packet | fcs | + * | MAC | MAC | | | | + * `-----------------------------------------' + * Total: 18 non-data bytes + * + * In the event that fragmentation is required, the incoming payload is split into + * N parts of size ieee->fts. The first fragment contains the SNAP header and the + * remaining packets are just data. + * + * If encryption is enabled, each fragment payload size is reduced by enough space + * to add the prefix and postfix (IV and ICV totalling 8 bytes in the case of WEP) + * So if you have 1500 bytes of payload with ieee->fts set to 500 without + * encryption it will take 3 frames. With WEP it will take 4 frames as the + * payload of each frame is reduced to 492 bytes. + * + * SKB visualization + * + * ,- skb->data + * | + * | ETHERNET HEADER ,-<-- PAYLOAD + * | | 14 bytes from skb->data + * | 2 bytes for Type --> ,T. | (sizeof ethhdr) + * | | | | + * |,-Dest.--. ,--Src.---. | | | + * | 6 bytes| | 6 bytes | | | | + * v | | | | | | + * 0 | v 1 | v | v 2 + * 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 + * ^ | ^ | ^ | + * | | | | | | + * | | | | `T' <---- 2 bytes for Type + * | | | | + * | | '---SNAP--' <-------- 6 bytes for SNAP + * | | + * `-IV--' <-------------------- 4 bytes for IV (WEP) + * + * SNAP HEADER + * + */ static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; @@ -205,11 +204,13 @@ int ieee80211_encrypt_fragment( } /* To encrypt, frame format is: - * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) */ + * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) + */ // PR: FIXME: Copied from hostap. Check fragmentation/MSDU/MPDU encryption. /* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so - * call both MSDU and MPDU encryption functions from here. */ + * call both MSDU and MPDU encryption functions from here. + */ atomic_inc(&crypt->refcnt); res = 0; if (crypt->ops->encrypt_msdu) @@ -620,7 +621,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) spin_lock_irqsave(&ieee->lock, flags); /* If there is no driver handler to take the TXB, dont' bother - * creating it... */ + * creating it... + */ if ((!ieee->hard_start_xmit && !(ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE))|| ((!ieee->softmac_data_hard_start_xmit && (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)))) { printk(KERN_WARNING "%s: No xmit handler.\n", @@ -683,13 +685,15 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) if (ieee->iw_mode == IW_MODE_INFRA) { fc |= IEEE80211_FCTL_TODS; /* To DS: Addr1 = BSSID, Addr2 = SA, - Addr3 = DA */ + * Addr3 = DA + */ memcpy(&header.addr1, ieee->current_network.bssid, ETH_ALEN); memcpy(&header.addr2, &src, ETH_ALEN); memcpy(&header.addr3, &dest, ETH_ALEN); } else if (ieee->iw_mode == IW_MODE_ADHOC) { /* not From/To DS: Addr1 = DA, Addr2 = SA, - Addr3 = BSSID */ + * Addr3 = BSSID + */ memcpy(&header.addr1, dest, ETH_ALEN); memcpy(&header.addr2, src, ETH_ALEN); memcpy(&header.addr3, ieee->current_network.bssid, ETH_ALEN); @@ -698,7 +702,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) header.frame_ctl = cpu_to_le16(fc); /* Determine fragmentation size based on destination (multicast - * and broadcast are not fragmented) */ + * and broadcast are not fragmented) + */ if (is_multicast_ether_addr(header.addr1)) { frag_size = MAX_FRAG_THRESHOLD; qos_ctl |= QOS_CTL_NOTCONTAIN_ACK; @@ -720,9 +725,10 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) hdr_len = IEEE80211_3ADDR_LEN; } /* Determine amount of payload per fragment. Regardless of if - * this stack is providing the full 802.11 header, one will - * eventually be affixed to this fragment -- so we must account for - * it when determining the amount of payload space. */ + * this stack is providing the full 802.11 header, one will + * eventually be affixed to this fragment -- so we must account for + * it when determining the amount of payload space. + */ bytes_per_frag = frag_size - hdr_len; if (ieee->config & (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) @@ -734,7 +740,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) crypt->ops->extra_postfix_len; /* Number of fragments is the total bytes_per_frag / - * payload_per_fragment */ + * payload_per_fragment + */ nr_frags = bytes / bytes_per_frag; bytes_last_frag = bytes % bytes_per_frag; if (bytes_last_frag) @@ -743,8 +750,9 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) bytes_last_frag = bytes_per_frag; /* When we allocate the TXB we allocate enough space for the reserve - * and full fragment bytes (bytes_per_frag doesn't include prefix, - * postfix, header, FCS, etc.) */ + * and full fragment bytes (bytes_per_frag doesn't include prefix, + * postfix, header, FCS, etc.) + */ txb = ieee80211_alloc_txb(nr_frags, frag_size + ieee->tx_headroom, GFP_ATOMIC); if (unlikely(!txb)) { printk(KERN_WARNING "%s: Could not allocate TXB\n", @@ -791,7 +799,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) memcpy(frag_hdr, &header, hdr_len); /* If this is not the last fragment, then add the MOREFRAGS - * bit to the frame control */ + * bit to the frame control + */ if (i != nr_frags - 1) { frag_hdr->frame_ctl = cpu_to_le16( fc | IEEE80211_FCTL_MOREFRAGS); @@ -824,7 +833,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) skb_pull(skb, bytes); /* Encryption routine will move the header forward in order - * to insert the IV between the header and the payload */ + * to insert the IV between the header and the payload + */ if (encrypt) ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len); if (ieee->config & -- 2.11.1