diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2015-09-08 01:01:14 -0300 |
---|---|---|
committer | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2015-09-08 01:01:14 -0300 |
commit | e5fd91f1ef340da553f7a79da9540c3db711c937 (patch) | |
tree | b11842027dc6641da63f4bcc524f8678263304a3 /drivers/staging/rtl8192e/rtllib_tx.c | |
parent | 2a9b0348e685a63d97486f6749622b61e9e3292f (diff) |
Linux-libre 4.2-gnu
Diffstat (limited to 'drivers/staging/rtl8192e/rtllib_tx.c')
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_tx.c | 78 |
1 files changed, 42 insertions, 36 deletions
diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c index 3b159638b..e99ea5e67 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c @@ -57,18 +57,19 @@ * * * 802.11 frame_control 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 >-----------' + * ,--------------------------------------------------------------------. + * 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 |DS | DS |frag| | mgm |data | | + * | | | x=1 data+ack | | | | | | | | + * '--------------------------------------------------------------------' + * /\ + * | + * 802.11 Data Frame | + * ,--------- 'ctrl' expands to >---' * | * ,--'---,-------------------------------------------------------------. * Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | @@ -112,15 +113,15 @@ * `-----------------------------------------' * 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. + * 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. + * 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 * @@ -260,7 +261,10 @@ static int rtllib_classify(struct sk_buff *skb, u8 bIsAmsdu) if (eth->h_proto != htons(ETH_P_IP)) return 0; - RTLLIB_DEBUG_DATA(RTLLIB_DL_DATA, skb->data, skb->len); +#ifdef VERBOSE_DEBUG + print_hex_dump_bytes("rtllib_classify(): ", DUMP_PREFIX_NONE, skb->data, + skb->len); +#endif ip = ip_hdr(skb); switch (ip->tos & 0xfc) { case 0x20: @@ -579,8 +583,9 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) .seq_ctl = 0, .qos_ctl = 0 }; - u8 dest[ETH_ALEN], src[ETH_ALEN]; int qos_actived = ieee->current_network.qos_data.active; + u8 dest[ETH_ALEN]; + u8 src[ETH_ALEN]; struct lib80211_crypt_data *crypt = NULL; struct cb_desc *tcb_desc; u8 bIsMulticast = false; @@ -608,8 +613,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) goto success; } /* Save source and destination addresses */ - memcpy(dest, skb->data, ETH_ALEN); - memcpy(src, skb->data+ETH_ALEN, ETH_ALEN); + ether_addr_copy(dest, skb->data); + ether_addr_copy(src, skb->data + ETH_ALEN); memset(skb->cb, 0, sizeof(skb->cb)); ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto); @@ -669,8 +674,9 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) struct eapol *eap = (struct eapol *)(skb->data + sizeof(struct ethhdr) - SNAP_SIZE - sizeof(u16)); - RTLLIB_DEBUG_EAP("TX: IEEE 802.11 EAPOL frame: %s\n", - eap_get_type(eap->type)); + netdev_dbg(ieee->dev, + "TX: IEEE 802.11 EAPOL frame: %s\n", + eap_get_type(eap->type)); } /* Advance the SKB to the start of the payload */ @@ -694,22 +700,22 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) /* To DS: Addr1 = BSSID, Addr2 = SA, * Addr3 = DA */ - memcpy(&header.addr1, ieee->current_network.bssid, - ETH_ALEN); - memcpy(&header.addr2, &src, ETH_ALEN); + ether_addr_copy(header.addr1, + ieee->current_network.bssid); + ether_addr_copy(header.addr2, src); if (IsAmsdu) - memcpy(&header.addr3, - ieee->current_network.bssid, ETH_ALEN); + ether_addr_copy(header.addr3, + ieee->current_network.bssid); else - memcpy(&header.addr3, &dest, ETH_ALEN); + ether_addr_copy(header.addr3, dest); } else if (ieee->iw_mode == IW_MODE_ADHOC) { /* not From/To DS: Addr1 = DA, Addr2 = SA, * Addr3 = BSSID */ - memcpy(&header.addr1, dest, ETH_ALEN); - memcpy(&header.addr2, src, ETH_ALEN); - memcpy(&header.addr3, ieee->current_network.bssid, - ETH_ALEN); + ether_addr_copy(header.addr1, dest); + ether_addr_copy(header.addr2, src); + ether_addr_copy(header.addr3, + ieee->current_network.bssid); } bIsMulticast = is_multicast_ether_addr(header.addr1); |