aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/rtlwifi/base.c93
-rw-r--r--drivers/net/wireless/rtlwifi/wifi.h6
2 files changed, 42 insertions, 57 deletions
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c
index 9a78e3daf742..ff784072fb42 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -37,6 +37,7 @@
37 37
38#include <linux/ip.h> 38#include <linux/ip.h>
39#include <linux/module.h> 39#include <linux/module.h>
40#include <linux/udp.h>
40 41
41/* 42/*
42 *NOTICE!!!: This file will be very big, we should 43 *NOTICE!!!: This file will be very big, we should
@@ -1074,64 +1075,52 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)
1074 if (!ieee80211_is_data(fc)) 1075 if (!ieee80211_is_data(fc))
1075 return false; 1076 return false;
1076 1077
1078 ip = (const struct iphdr *)(skb->data + mac_hdr_len +
1079 SNAP_SIZE + PROTOC_TYPE_SIZE);
1080 ether_type = be16_to_cpup((__be16 *)
1081 (skb->data + mac_hdr_len + SNAP_SIZE));
1077 1082
1078 ip = (struct iphdr *)((u8 *) skb->data + mac_hdr_len + 1083 switch (ether_type) {
1079 SNAP_SIZE + PROTOC_TYPE_SIZE); 1084 case ETH_P_IP: {
1080 ether_type = *(u16 *) ((u8 *) skb->data + mac_hdr_len + SNAP_SIZE); 1085 struct udphdr *udp;
1081 /* ether_type = ntohs(ether_type); */ 1086 u16 src;
1082 1087 u16 dst;
1083 if (ETH_P_IP == ether_type) {
1084 if (IPPROTO_UDP == ip->protocol) {
1085 struct udphdr *udp = (struct udphdr *)((u8 *) ip +
1086 (ip->ihl << 2));
1087 if (((((u8 *) udp)[1] == 68) &&
1088 (((u8 *) udp)[3] == 67)) ||
1089 ((((u8 *) udp)[1] == 67) &&
1090 (((u8 *) udp)[3] == 68))) {
1091 /*
1092 * 68 : UDP BOOTP client
1093 * 67 : UDP BOOTP server
1094 */
1095 RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV),
1096 DBG_DMESG, "dhcp %s !!\n",
1097 is_tx ? "Tx" : "Rx");
1098
1099 if (is_tx) {
1100 rtlpriv->enter_ps = false;
1101 schedule_work(&rtlpriv->
1102 works.lps_change_work);
1103 ppsc->last_delaylps_stamp_jiffies =
1104 jiffies;
1105 }
1106 1088
1107 return true; 1089 if (ip->protocol != IPPROTO_UDP)
1108 } 1090 return false;
1109 } 1091 udp = (struct udphdr *)((u8 *)ip + (ip->ihl << 2));
1110 } else if (ETH_P_ARP == ether_type) { 1092 src = be16_to_cpu(udp->source);
1111 if (is_tx) { 1093 dst = be16_to_cpu(udp->dest);
1112 rtlpriv->enter_ps = false;
1113 schedule_work(&rtlpriv->works.lps_change_work);
1114 ppsc->last_delaylps_stamp_jiffies = jiffies;
1115 }
1116 1094
1117 return true; 1095 /* If this case involves port 68 (UDP BOOTP client) connecting
1118 } else if (ETH_P_PAE == ether_type) { 1096 * with port 67 (UDP BOOTP server), then return true so that
1097 * the lowest speed is used.
1098 */
1099 if (!((src == 68 && dst == 67) || (src == 67 && dst == 68)))
1100 return false;
1101
1102 RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG,
1103 "dhcp %s !!\n", is_tx ? "Tx" : "Rx");
1104 break;
1105 }
1106 case ETH_P_ARP:
1107 break;
1108 case ETH_P_PAE:
1119 RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG, 1109 RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG,
1120 "802.1X %s EAPOL pkt!!\n", is_tx ? "Tx" : "Rx"); 1110 "802.1X %s EAPOL pkt!!\n", is_tx ? "Tx" : "Rx");
1121 1111 break;
1122 if (is_tx) { 1112 case ETH_P_IPV6:
1123 rtlpriv->enter_ps = false; 1113 /* TODO: Is this right? */
1124 schedule_work(&rtlpriv->works.lps_change_work); 1114 return false;
1125 ppsc->last_delaylps_stamp_jiffies = jiffies; 1115 default:
1126 } 1116 return false;
1127
1128 return true;
1129 } else if (ETH_P_IPV6 == ether_type) {
1130 /* IPv6 */
1131 return true;
1132 } 1117 }
1133 1118 if (is_tx) {
1134 return false; 1119 rtlpriv->enter_ps = false;
1120 schedule_work(&rtlpriv->works.lps_change_work);
1121 ppsc->last_delaylps_stamp_jiffies = jiffies;
1122 }
1123 return true;
1135} 1124}
1136EXPORT_SYMBOL_GPL(rtl_is_special_data); 1125EXPORT_SYMBOL_GPL(rtl_is_special_data);
1137 1126
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index d224dc3bb092..0c65386fa30d 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -77,11 +77,7 @@
77#define RTL_SLOT_TIME_9 9 77#define RTL_SLOT_TIME_9 9
78#define RTL_SLOT_TIME_20 20 78#define RTL_SLOT_TIME_20 20
79 79
80/*related with tcp/ip. */ 80/*related to tcp/ip. */
81/*if_ehther.h*/
82#define ETH_P_PAE 0x888E /*Port Access Entity (IEEE 802.1X) */
83#define ETH_P_IP 0x0800 /*Internet Protocol packet */
84#define ETH_P_ARP 0x0806 /*Address Resolution packet */
85#define SNAP_SIZE 6 81#define SNAP_SIZE 6
86#define PROTOC_TYPE_SIZE 2 82#define PROTOC_TYPE_SIZE 2
87 83