Commit b8edc163 authored by Derek Robson's avatar Derek Robson Committed by Greg Kroah-Hartman
Browse files

Staging: rtl8192u: ieee80211: ieee80211_tx.c - style fix



Fixed style of block comments
Found using checkpatch

Signed-off-by: default avatarDerek Robson <robsonde@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 87bf14fe
Loading
Loading
Loading
Loading
+150 −140
Original line number Original line Diff line number Diff line
/******************************************************************************
/******************************************************************************

 *
  Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved.
 *  Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved.

 *
  This program is free software; you can redistribute it and/or modify it
 *  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
 *  under the terms of version 2 of the GNU General Public License as
  published by the Free Software Foundation.
 *  published by the Free Software Foundation.

 *
  This program is distributed in the hope that it will be useful, but WITHOUT
 *  This program is distributed in the hope that it will be useful, but WITHOUT
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  more details.
 *  more details.

 *
  You should have received a copy of the GNU General Public License along with
 *  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
 *  this program; if not, write to the Free Software Foundation, Inc., 59
  Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *  Temple Place - Suite 330, Boston, MA  02111-1307, USA.

 *
  The full GNU General Public License is included in this distribution in the
 *  The full GNU General Public License is included in this distribution in the
  file called LICENSE.
 *  file called LICENSE.

 *
  Contact Information:
 *  Contact Information:
  James P. Ketrenos <ipw2100-admin@linux.intel.com>
 *  James P. Ketrenos <ipw2100-admin@linux.intel.com>
  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
 *  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497

 *
******************************************************************************
 *

 *  Few modifications for Realtek's Wi-Fi drivers by
  Few modifications for Realtek's Wi-Fi drivers by
 *  Andrea Merello <andrea.merello@gmail.com>
  Andrea Merello <andrea.merello@gmail.com>
 *

 *  A special thanks goes to Realtek for their support !
  A special thanks goes to Realtek for their support !
 *

 ******************************************************************************/
 ******************************************************************************/


#include <linux/compiler.h>
#include <linux/compiler.h>
@@ -55,77 +54,77 @@




/*
/*

 *

 *
802.11 Data Frame
 * 802.11 Data Frame

 *

 *
802.11 frame_contorl for data frames - 2 bytes
 * 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   |
 * 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   |
 * 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   |
 * desc | ^-ver-^  |  ^type-^  |  ^-----subtype-----^  | to  |from |more |retry| pwr |more |wep   |
     |          |           | x=0 data,x=1 data+ack | DS  | DS  |frag |     | mgm |data |      |
 *      |          |           | x=0 data,x=1 data+ack | DS  | DS  |frag |     | mgm |data |      |
     '-----------------------------------------------------------------------------------------'
 *      '-----------------------------------------------------------------------------------------'
                                                    /\
 *                                                    /\
                                                    |
 *                                                    |
802.11 Data Frame                                   |
 * 802.11 Data Frame                                  |
           ,--------- 'ctrl' expands to >-----------'
 *           ,--------- 'ctrl' expands to >-----------'
          |
 *           |
      ,--'---,-------------------------------------------------------------.
 *        ,--'---,-------------------------------------------------------------.
Bytes |  2   |  2   |    6    |    6    |    6    |  2   | 0..2312 |   4  |
 *  Bytes |  2   |  2   |    6    |    6    |    6    |  2   | 0..2312 |   4  |
      |------|------|---------|---------|---------|------|---------|------|
 *        |------|------|---------|---------|---------|------|---------|------|
Desc. | ctrl | dura |  DA/RA  |   TA    |    SA   | Sequ |  Frame  |  fcs |
 *  Desc. | ctrl | dura |  DA/RA  |   TA    |    SA   | Sequ |  Frame  |  fcs |
      |      | tion | (BSSID) |         |         | ence |  data   |      |
 *        |      | tion | (BSSID) |         |         | ence |  data   |      |
      `--------------------------------------------------|         |------'
 *        `--------------------------------------------------|         |------'
Total: 28 non-data bytes                                 `----.----'
 *  Total: 28 non-data bytes                                 `----.----'
                                                              |
 *                                                                |
       .- 'Frame data' expands to <---------------------------'
 *         .- 'Frame data' expands to <---------------------------'
       |
 *         |
       V
 *         V
      ,---------------------------------------------------.
 *        ,---------------------------------------------------.
Bytes |  1   |  1   |    1    |    3     |  2   |  0-2304 |
 *  Bytes |  1   |  1   |    1    |    3     |  2   |  0-2304 |
      |------|------|---------|----------|------|---------|
 *        |------|------|---------|----------|------|---------|
Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP      |
 *  Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP      |
      | DSAP | SSAP |         |          |      | Packet  |
 *        | DSAP | SSAP |         |          |      | Packet  |
      | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8|      |         |
 *        | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8|      |         |
      `-----------------------------------------|         |
 *        `-----------------------------------------|         |
Total: 8 non-data bytes                         `----.----'
 *  Total: 8 non-data bytes                         `----.----'
                                                     |
 *                                                       |
       .- 'IP Packet' expands, if WEP enabled, to <--'
 *         .- 'IP Packet' expands, if WEP enabled, to <--'
       |
 *         |
       V
 *         V
      ,-----------------------.
 *        ,-----------------------.
Bytes |  4  |   0-2296  |  4  |
 *  Bytes |  4  |   0-2296  |  4  |
      |-----|-----------|-----|
 *        |-----|-----------|-----|
Desc. | IV  | Encrypted | ICV |
 *  Desc. | IV  | Encrypted | ICV |
      |     | IP Packet |     |
 *        |     | IP Packet |     |
      `-----------------------'
 *        `-----------------------'
Total: 8 non-data bytes
 *  Total: 8 non-data bytes

 *

 *
802.3 Ethernet Data Frame
 *  802.3 Ethernet Data Frame

 *
      ,-----------------------------------------.
 *        ,-----------------------------------------.
Bytes |   6   |   6   |  2   |  Variable |   4  |
 *  Bytes |   6   |   6   |  2   |  Variable |   4  |
      |-------|-------|------|-----------|------|
 *        |-------|-------|------|-----------|------|
Desc. | Dest. | Source| Type | IP Packet |  fcs |
 *  Desc. | Dest. | Source| Type | IP Packet |  fcs |
      |  MAC  |  MAC  |      |           |      |
 *        |  MAC  |  MAC  |      |           |      |
      `-----------------------------------------'
 *        `-----------------------------------------'
Total: 18 non-data bytes
 *  Total: 18 non-data bytes

 *
In the event that fragmentation is required, the incoming payload is split into
 *  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
 *  N parts of size ieee->fts.  The first fragment contains the SNAP header and the
remaining packets are just data.
 *  remaining packets are just data.

 *
If encryption is enabled, each fragment payload size is reduced by enough space
 *  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)
 *  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
 *  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
 *  encryption it will take 3 frames.  With WEP it will take 4 frames as the
payload of each frame is reduced to 492 bytes.
 *  payload of each frame is reduced to 492 bytes.

 *
 * SKB visualization
 * SKB visualization
 *
 *
 *  ,- skb->data
 *  ,- skb->data
@@ -205,11 +204,13 @@ int ieee80211_encrypt_fragment(
	}
	}


	/* To encrypt, frame format is:
	/* 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.
	// PR: FIXME: Copied from hostap. Check fragmentation/MSDU/MPDU encryption.
	/* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so
	/* 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);
	atomic_inc(&crypt->refcnt);
	res = 0;
	res = 0;
	if (crypt->ops->encrypt_msdu)
	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);
	spin_lock_irqsave(&ieee->lock, flags);


	/* If there is no driver handler to take the TXB, dont' bother
	/* 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))||
	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)))) {
	   ((!ieee->softmac_data_hard_start_xmit && (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)))) {
		printk(KERN_WARNING "%s: No xmit handler.\n",
		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) {
		if (ieee->iw_mode == IW_MODE_INFRA) {
			fc |= IEEE80211_FCTL_TODS;
			fc |= IEEE80211_FCTL_TODS;
			/* To DS: Addr1 = BSSID, Addr2 = SA,
			/* To DS: Addr1 = BSSID, Addr2 = SA,
			Addr3 = DA */
			 * Addr3 = DA
			 */
			memcpy(&header.addr1, ieee->current_network.bssid, ETH_ALEN);
			memcpy(&header.addr1, ieee->current_network.bssid, ETH_ALEN);
			memcpy(&header.addr2, &src, ETH_ALEN);
			memcpy(&header.addr2, &src, ETH_ALEN);
			memcpy(&header.addr3, &dest, ETH_ALEN);
			memcpy(&header.addr3, &dest, ETH_ALEN);
		} else if (ieee->iw_mode == IW_MODE_ADHOC) {
		} else if (ieee->iw_mode == IW_MODE_ADHOC) {
			/* not From/To DS: Addr1 = DA, Addr2 = SA,
			/* not From/To DS: Addr1 = DA, Addr2 = SA,
			Addr3 = BSSID */
			 * Addr3 = BSSID
			 */
			memcpy(&header.addr1, dest, ETH_ALEN);
			memcpy(&header.addr1, dest, ETH_ALEN);
			memcpy(&header.addr2, src, ETH_ALEN);
			memcpy(&header.addr2, src, ETH_ALEN);
			memcpy(&header.addr3, ieee->current_network.bssid, 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);
		header.frame_ctl = cpu_to_le16(fc);


		/* Determine fragmentation size based on destination (multicast
		/* Determine fragmentation size based on destination (multicast
		* and broadcast are not fragmented) */
		 * and broadcast are not fragmented)
		 */
		if (is_multicast_ether_addr(header.addr1)) {
		if (is_multicast_ether_addr(header.addr1)) {
			frag_size = MAX_FRAG_THRESHOLD;
			frag_size = MAX_FRAG_THRESHOLD;
			qos_ctl |= QOS_CTL_NOTCONTAIN_ACK;
			qos_ctl |= QOS_CTL_NOTCONTAIN_ACK;
@@ -722,7 +727,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
		/* Determine amount of payload per fragment.  Regardless of if
		/* Determine amount of payload per fragment.  Regardless of if
		 * this stack is providing the full 802.11 header, one will
		 * this stack is providing the full 802.11 header, one will
		 * eventually be affixed to this fragment -- so we must account for
		 * eventually be affixed to this fragment -- so we must account for
		* it when determining the amount of payload space. */
		 * it when determining the amount of payload space.
		 */
		bytes_per_frag = frag_size - hdr_len;
		bytes_per_frag = frag_size - hdr_len;
		if (ieee->config &
		if (ieee->config &
		(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
		(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;
				crypt->ops->extra_postfix_len;


		/* Number of fragments is the total bytes_per_frag /
		/* Number of fragments is the total bytes_per_frag /
		* payload_per_fragment */
		 * payload_per_fragment
		 */
		nr_frags = bytes / bytes_per_frag;
		nr_frags = bytes / bytes_per_frag;
		bytes_last_frag = bytes % bytes_per_frag;
		bytes_last_frag = bytes % bytes_per_frag;
		if (bytes_last_frag)
		if (bytes_last_frag)
@@ -744,7 +751,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)


		/* When we allocate the TXB we allocate enough space for the reserve
		/* When we allocate the TXB we allocate enough space for the reserve
		 * and full fragment bytes (bytes_per_frag doesn't include prefix,
		 * and full fragment bytes (bytes_per_frag doesn't include prefix,
		* postfix, header, FCS, etc.) */
		 * postfix, header, FCS, etc.)
		 */
		txb = ieee80211_alloc_txb(nr_frags, frag_size + ieee->tx_headroom, GFP_ATOMIC);
		txb = ieee80211_alloc_txb(nr_frags, frag_size + ieee->tx_headroom, GFP_ATOMIC);
		if (unlikely(!txb)) {
		if (unlikely(!txb)) {
			printk(KERN_WARNING "%s: Could not allocate TXB\n",
			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);
			memcpy(frag_hdr, &header, hdr_len);


			/* If this is not the last fragment, then add the MOREFRAGS
			/* 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) {
			if (i != nr_frags - 1) {
				frag_hdr->frame_ctl = cpu_to_le16(
				frag_hdr->frame_ctl = cpu_to_le16(
					fc | IEEE80211_FCTL_MOREFRAGS);
					fc | IEEE80211_FCTL_MOREFRAGS);
@@ -824,7 +833,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
			skb_pull(skb, bytes);
			skb_pull(skb, bytes);


			/* Encryption routine will move the header forward in order
			/* 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)
			if (encrypt)
				ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
				ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
			if (ieee->config &
			if (ieee->config &