aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2013-06-25 22:03:56 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-07-16 02:57:55 -0400
commit50ac6607845755e594c8a39b9c6a00d1c9b48ea4 (patch)
treea7308bf0f9e69408acc2acac6ceda98fa45906cc
parentad81f0545ef01ea651886dddac4bef6cec930092 (diff)
cfg80211/nl80211: rename packet pattern related structures and enums
Currently packet patterns and it's enum/structures are used only for WoWLAN feature. As we intend to reuse them for new feature packet coalesce, they are renamed in this patch. Older names are kept for backward compatibility purpose. Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c2
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c3
-rw-r--r--drivers/net/wireless/ti/wlcore/main.c10
-rw-r--r--include/net/cfg80211.h6
-rw-r--r--include/uapi/linux/nl80211.h45
-rw-r--r--net/wireless/nl80211.c34
6 files changed, 53 insertions, 47 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 1737a3e33685..1adb803a9d86 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -2094,7 +2094,7 @@ static void ath9k_wow_add_pattern(struct ath_softc *sc,
2094{ 2094{
2095 struct ath_hw *ah = sc->sc_ah; 2095 struct ath_hw *ah = sc->sc_ah;
2096 struct ath9k_wow_pattern *wow_pattern = NULL; 2096 struct ath9k_wow_pattern *wow_pattern = NULL;
2097 struct cfg80211_wowlan_trig_pkt_pattern *patterns = wowlan->patterns; 2097 struct cfg80211_pkt_pattern *patterns = wowlan->patterns;
2098 int mask_len; 2098 int mask_len;
2099 s8 i = 0; 2099 s8 i = 0;
2100 2100
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index ef5fa890a286..0bd631fd556c 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -2298,8 +2298,7 @@ EXPORT_SYMBOL_GPL(mwifiex_del_virtual_intf);
2298 2298
2299#ifdef CONFIG_PM 2299#ifdef CONFIG_PM
2300static bool 2300static bool
2301mwifiex_is_pattern_supported(struct cfg80211_wowlan_trig_pkt_pattern *pat, 2301mwifiex_is_pattern_supported(struct cfg80211_pkt_pattern *pat, s8 *byte_seq)
2302 s8 *byte_seq)
2303{ 2302{
2304 int j, k, valid_byte_cnt = 0; 2303 int j, k, valid_byte_cnt = 0;
2305 bool dont_care_byte = false; 2304 bool dont_care_byte = false;
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index b8db55c868c7..d1b19c38a907 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -1315,7 +1315,7 @@ static struct sk_buff *wl12xx_alloc_dummy_packet(struct wl1271 *wl)
1315 1315
1316#ifdef CONFIG_PM 1316#ifdef CONFIG_PM
1317static int 1317static int
1318wl1271_validate_wowlan_pattern(struct cfg80211_wowlan_trig_pkt_pattern *p) 1318wl1271_validate_wowlan_pattern(struct cfg80211_pkt_pattern *p)
1319{ 1319{
1320 int num_fields = 0, in_field = 0, fields_size = 0; 1320 int num_fields = 0, in_field = 0, fields_size = 0;
1321 int i, pattern_len = 0; 1321 int i, pattern_len = 0;
@@ -1458,9 +1458,9 @@ void wl1271_rx_filter_flatten_fields(struct wl12xx_rx_filter *filter,
1458 * Allocates an RX filter returned through f 1458 * Allocates an RX filter returned through f
1459 * which needs to be freed using rx_filter_free() 1459 * which needs to be freed using rx_filter_free()
1460 */ 1460 */
1461static int wl1271_convert_wowlan_pattern_to_rx_filter( 1461static int
1462 struct cfg80211_wowlan_trig_pkt_pattern *p, 1462wl1271_convert_wowlan_pattern_to_rx_filter(struct cfg80211_pkt_pattern *p,
1463 struct wl12xx_rx_filter **f) 1463 struct wl12xx_rx_filter **f)
1464{ 1464{
1465 int i, j, ret = 0; 1465 int i, j, ret = 0;
1466 struct wl12xx_rx_filter *filter; 1466 struct wl12xx_rx_filter *filter;
@@ -1562,7 +1562,7 @@ static int wl1271_configure_wowlan(struct wl1271 *wl,
1562 1562
1563 /* Translate WoWLAN patterns into filters */ 1563 /* Translate WoWLAN patterns into filters */
1564 for (i = 0; i < wow->n_patterns; i++) { 1564 for (i = 0; i < wow->n_patterns; i++) {
1565 struct cfg80211_wowlan_trig_pkt_pattern *p; 1565 struct cfg80211_pkt_pattern *p;
1566 struct wl12xx_rx_filter *filter = NULL; 1566 struct wl12xx_rx_filter *filter = NULL;
1567 1567
1568 p = &wow->patterns[i]; 1568 p = &wow->patterns[i];
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 7b0730aeb892..207b079a8fa5 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1698,7 +1698,7 @@ struct cfg80211_pmksa {
1698}; 1698};
1699 1699
1700/** 1700/**
1701 * struct cfg80211_wowlan_trig_pkt_pattern - packet pattern 1701 * struct cfg80211_pkt_pattern - packet pattern
1702 * @mask: bitmask where to match pattern and where to ignore bytes, 1702 * @mask: bitmask where to match pattern and where to ignore bytes,
1703 * one bit per byte, in same format as nl80211 1703 * one bit per byte, in same format as nl80211
1704 * @pattern: bytes to match where bitmask is 1 1704 * @pattern: bytes to match where bitmask is 1
@@ -1708,7 +1708,7 @@ struct cfg80211_pmksa {
1708 * Internal note: @mask and @pattern are allocated in one chunk of 1708 * Internal note: @mask and @pattern are allocated in one chunk of
1709 * memory, free @mask only! 1709 * memory, free @mask only!
1710 */ 1710 */
1711struct cfg80211_wowlan_trig_pkt_pattern { 1711struct cfg80211_pkt_pattern {
1712 u8 *mask, *pattern; 1712 u8 *mask, *pattern;
1713 int pattern_len; 1713 int pattern_len;
1714 int pkt_offset; 1714 int pkt_offset;
@@ -1770,7 +1770,7 @@ struct cfg80211_wowlan {
1770 bool any, disconnect, magic_pkt, gtk_rekey_failure, 1770 bool any, disconnect, magic_pkt, gtk_rekey_failure,
1771 eap_identity_req, four_way_handshake, 1771 eap_identity_req, four_way_handshake,
1772 rfkill_release; 1772 rfkill_release;
1773 struct cfg80211_wowlan_trig_pkt_pattern *patterns; 1773 struct cfg80211_pkt_pattern *patterns;
1774 struct cfg80211_wowlan_tcp *tcp; 1774 struct cfg80211_wowlan_tcp *tcp;
1775 int n_patterns; 1775 int n_patterns;
1776}; 1776};
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 861e5eba3953..de0ce809068a 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -3060,11 +3060,11 @@ enum nl80211_tx_power_setting {
3060}; 3060};
3061 3061
3062/** 3062/**
3063 * enum nl80211_wowlan_packet_pattern_attr - WoWLAN packet pattern attribute 3063 * enum nl80211_packet_pattern_attr - packet pattern attribute
3064 * @__NL80211_WOWLAN_PKTPAT_INVALID: invalid number for nested attribute 3064 * @__NL80211_PKTPAT_INVALID: invalid number for nested attribute
3065 * @NL80211_WOWLAN_PKTPAT_PATTERN: the pattern, values where the mask has 3065 * @NL80211_PKTPAT_PATTERN: the pattern, values where the mask has
3066 * a zero bit are ignored 3066 * a zero bit are ignored
3067 * @NL80211_WOWLAN_PKTPAT_MASK: pattern mask, must be long enough to have 3067 * @NL80211_PKTPAT_MASK: pattern mask, must be long enough to have
3068 * a bit for each byte in the pattern. The lowest-order bit corresponds 3068 * a bit for each byte in the pattern. The lowest-order bit corresponds
3069 * to the first byte of the pattern, but the bytes of the pattern are 3069 * to the first byte of the pattern, but the bytes of the pattern are
3070 * in a little-endian-like format, i.e. the 9th byte of the pattern 3070 * in a little-endian-like format, i.e. the 9th byte of the pattern
@@ -3075,23 +3075,23 @@ enum nl80211_tx_power_setting {
3075 * Note that the pattern matching is done as though frames were not 3075 * Note that the pattern matching is done as though frames were not
3076 * 802.11 frames but 802.3 frames, i.e. the frame is fully unpacked 3076 * 802.11 frames but 802.3 frames, i.e. the frame is fully unpacked
3077 * first (including SNAP header unpacking) and then matched. 3077 * first (including SNAP header unpacking) and then matched.
3078 * @NL80211_WOWLAN_PKTPAT_OFFSET: packet offset, pattern is matched after 3078 * @NL80211_PKTPAT_OFFSET: packet offset, pattern is matched after
3079 * these fixed number of bytes of received packet 3079 * these fixed number of bytes of received packet
3080 * @NUM_NL80211_WOWLAN_PKTPAT: number of attributes 3080 * @NUM_NL80211_PKTPAT: number of attributes
3081 * @MAX_NL80211_WOWLAN_PKTPAT: max attribute number 3081 * @MAX_NL80211_PKTPAT: max attribute number
3082 */ 3082 */
3083enum nl80211_wowlan_packet_pattern_attr { 3083enum nl80211_packet_pattern_attr {
3084 __NL80211_WOWLAN_PKTPAT_INVALID, 3084 __NL80211_PKTPAT_INVALID,
3085 NL80211_WOWLAN_PKTPAT_MASK, 3085 NL80211_PKTPAT_MASK,
3086 NL80211_WOWLAN_PKTPAT_PATTERN, 3086 NL80211_PKTPAT_PATTERN,
3087 NL80211_WOWLAN_PKTPAT_OFFSET, 3087 NL80211_PKTPAT_OFFSET,
3088 3088
3089 NUM_NL80211_WOWLAN_PKTPAT, 3089 NUM_NL80211_PKTPAT,
3090 MAX_NL80211_WOWLAN_PKTPAT = NUM_NL80211_WOWLAN_PKTPAT - 1, 3090 MAX_NL80211_PKTPAT = NUM_NL80211_PKTPAT - 1,
3091}; 3091};
3092 3092
3093/** 3093/**
3094 * struct nl80211_wowlan_pattern_support - pattern support information 3094 * struct nl80211_pattern_support - packet pattern support information
3095 * @max_patterns: maximum number of patterns supported 3095 * @max_patterns: maximum number of patterns supported
3096 * @min_pattern_len: minimum length of each pattern 3096 * @min_pattern_len: minimum length of each pattern
3097 * @max_pattern_len: maximum length of each pattern 3097 * @max_pattern_len: maximum length of each pattern
@@ -3101,13 +3101,22 @@ enum nl80211_wowlan_packet_pattern_attr {
3101 * that is part of %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED in the 3101 * that is part of %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED in the
3102 * capability information given by the kernel to userspace. 3102 * capability information given by the kernel to userspace.
3103 */ 3103 */
3104struct nl80211_wowlan_pattern_support { 3104struct nl80211_pattern_support {
3105 __u32 max_patterns; 3105 __u32 max_patterns;
3106 __u32 min_pattern_len; 3106 __u32 min_pattern_len;
3107 __u32 max_pattern_len; 3107 __u32 max_pattern_len;
3108 __u32 max_pkt_offset; 3108 __u32 max_pkt_offset;
3109} __attribute__((packed)); 3109} __attribute__((packed));
3110 3110
3111/* only for backward compatibility */
3112#define __NL80211_WOWLAN_PKTPAT_INVALID __NL80211_PKTPAT_INVALID
3113#define NL80211_WOWLAN_PKTPAT_MASK NL80211_PKTPAT_MASK
3114#define NL80211_WOWLAN_PKTPAT_PATTERN NL80211_PKTPAT_PATTERN
3115#define NL80211_WOWLAN_PKTPAT_OFFSET NL80211_PKTPAT_OFFSET
3116#define NUM_NL80211_WOWLAN_PKTPAT NUM_NL80211_PKTPAT
3117#define MAX_NL80211_WOWLAN_PKTPAT MAX_NL80211_PKTPAT
3118#define nl80211_wowlan_pattern_support nl80211_pattern_support
3119
3111/** 3120/**
3112 * enum nl80211_wowlan_triggers - WoWLAN trigger definitions 3121 * enum nl80211_wowlan_triggers - WoWLAN trigger definitions
3113 * @__NL80211_WOWLAN_TRIG_INVALID: invalid number for nested attributes 3122 * @__NL80211_WOWLAN_TRIG_INVALID: invalid number for nested attributes
@@ -3127,7 +3136,7 @@ struct nl80211_wowlan_pattern_support {
3127 * pattern matching is done after the packet is converted to the MSDU. 3136 * pattern matching is done after the packet is converted to the MSDU.
3128 * 3137 *
3129 * In %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, it is a binary attribute 3138 * In %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, it is a binary attribute
3130 * carrying a &struct nl80211_wowlan_pattern_support. 3139 * carrying a &struct nl80211_pattern_support.
3131 * 3140 *
3132 * When reporting wakeup. it is a u32 attribute containing the 0-based 3141 * When reporting wakeup. it is a u32 attribute containing the 0-based
3133 * index of the pattern that caused the wakeup, in the patterns passed 3142 * index of the pattern that caused the wakeup, in the patterns passed
@@ -3284,7 +3293,7 @@ struct nl80211_wowlan_tcp_data_token_feature {
3284 * @NL80211_WOWLAN_TCP_WAKE_PAYLOAD: wake packet payload, for advertising a 3293 * @NL80211_WOWLAN_TCP_WAKE_PAYLOAD: wake packet payload, for advertising a
3285 * u32 attribute holding the maximum length 3294 * u32 attribute holding the maximum length
3286 * @NL80211_WOWLAN_TCP_WAKE_MASK: Wake packet payload mask, not used for 3295 * @NL80211_WOWLAN_TCP_WAKE_MASK: Wake packet payload mask, not used for
3287 * feature advertising. The mask works like @NL80211_WOWLAN_PKTPAT_MASK 3296 * feature advertising. The mask works like @NL80211_PKTPAT_MASK
3288 * but on the TCP payload only. 3297 * but on the TCP payload only.
3289 * @NUM_NL80211_WOWLAN_TCP: number of TCP attributes 3298 * @NUM_NL80211_WOWLAN_TCP: number of TCP attributes
3290 * @MAX_NL80211_WOWLAN_TCP: highest attribute number 3299 * @MAX_NL80211_WOWLAN_TCP: highest attribute number
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 1cc47aca7f05..a044762f5ea3 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -974,7 +974,7 @@ static int nl80211_send_wowlan(struct sk_buff *msg,
974 return -ENOBUFS; 974 return -ENOBUFS;
975 975
976 if (dev->wiphy.wowlan->n_patterns) { 976 if (dev->wiphy.wowlan->n_patterns) {
977 struct nl80211_wowlan_pattern_support pat = { 977 struct nl80211_pattern_support pat = {
978 .max_patterns = dev->wiphy.wowlan->n_patterns, 978 .max_patterns = dev->wiphy.wowlan->n_patterns,
979 .min_pattern_len = dev->wiphy.wowlan->pattern_min_len, 979 .min_pattern_len = dev->wiphy.wowlan->pattern_min_len,
980 .max_pattern_len = dev->wiphy.wowlan->pattern_max_len, 980 .max_pattern_len = dev->wiphy.wowlan->pattern_max_len,
@@ -7591,12 +7591,11 @@ static int nl80211_send_wowlan_patterns(struct sk_buff *msg,
7591 if (!nl_pat) 7591 if (!nl_pat)
7592 return -ENOBUFS; 7592 return -ENOBUFS;
7593 pat_len = wowlan->patterns[i].pattern_len; 7593 pat_len = wowlan->patterns[i].pattern_len;
7594 if (nla_put(msg, NL80211_WOWLAN_PKTPAT_MASK, 7594 if (nla_put(msg, NL80211_PKTPAT_MASK, DIV_ROUND_UP(pat_len, 8),
7595 DIV_ROUND_UP(pat_len, 8),
7596 wowlan->patterns[i].mask) || 7595 wowlan->patterns[i].mask) ||
7597 nla_put(msg, NL80211_WOWLAN_PKTPAT_PATTERN, 7596 nla_put(msg, NL80211_PKTPAT_PATTERN, pat_len,
7598 pat_len, wowlan->patterns[i].pattern) || 7597 wowlan->patterns[i].pattern) ||
7599 nla_put_u32(msg, NL80211_WOWLAN_PKTPAT_OFFSET, 7598 nla_put_u32(msg, NL80211_PKTPAT_OFFSET,
7600 wowlan->patterns[i].pkt_offset)) 7599 wowlan->patterns[i].pkt_offset))
7601 return -ENOBUFS; 7600 return -ENOBUFS;
7602 nla_nest_end(msg, nl_pat); 7601 nla_nest_end(msg, nl_pat);
@@ -7937,7 +7936,7 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info)
7937 struct nlattr *pat; 7936 struct nlattr *pat;
7938 int n_patterns = 0; 7937 int n_patterns = 0;
7939 int rem, pat_len, mask_len, pkt_offset; 7938 int rem, pat_len, mask_len, pkt_offset;
7940 struct nlattr *pat_tb[NUM_NL80211_WOWLAN_PKTPAT]; 7939 struct nlattr *pat_tb[NUM_NL80211_PKTPAT];
7941 7940
7942 nla_for_each_nested(pat, tb[NL80211_WOWLAN_TRIG_PKT_PATTERN], 7941 nla_for_each_nested(pat, tb[NL80211_WOWLAN_TRIG_PKT_PATTERN],
7943 rem) 7942 rem)
@@ -7956,26 +7955,25 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info)
7956 7955
7957 nla_for_each_nested(pat, tb[NL80211_WOWLAN_TRIG_PKT_PATTERN], 7956 nla_for_each_nested(pat, tb[NL80211_WOWLAN_TRIG_PKT_PATTERN],
7958 rem) { 7957 rem) {
7959 nla_parse(pat_tb, MAX_NL80211_WOWLAN_PKTPAT, 7958 nla_parse(pat_tb, MAX_NL80211_PKTPAT, nla_data(pat),
7960 nla_data(pat), nla_len(pat), NULL); 7959 nla_len(pat), NULL);
7961 err = -EINVAL; 7960 err = -EINVAL;
7962 if (!pat_tb[NL80211_WOWLAN_PKTPAT_MASK] || 7961 if (!pat_tb[NL80211_PKTPAT_MASK] ||
7963 !pat_tb[NL80211_WOWLAN_PKTPAT_PATTERN]) 7962 !pat_tb[NL80211_PKTPAT_PATTERN])
7964 goto error; 7963 goto error;
7965 pat_len = nla_len(pat_tb[NL80211_WOWLAN_PKTPAT_PATTERN]); 7964 pat_len = nla_len(pat_tb[NL80211_PKTPAT_PATTERN]);
7966 mask_len = DIV_ROUND_UP(pat_len, 8); 7965 mask_len = DIV_ROUND_UP(pat_len, 8);
7967 if (nla_len(pat_tb[NL80211_WOWLAN_PKTPAT_MASK]) != 7966 if (nla_len(pat_tb[NL80211_PKTPAT_MASK]) != mask_len)
7968 mask_len)
7969 goto error; 7967 goto error;
7970 if (pat_len > wowlan->pattern_max_len || 7968 if (pat_len > wowlan->pattern_max_len ||
7971 pat_len < wowlan->pattern_min_len) 7969 pat_len < wowlan->pattern_min_len)
7972 goto error; 7970 goto error;
7973 7971
7974 if (!pat_tb[NL80211_WOWLAN_PKTPAT_OFFSET]) 7972 if (!pat_tb[NL80211_PKTPAT_OFFSET])
7975 pkt_offset = 0; 7973 pkt_offset = 0;
7976 else 7974 else
7977 pkt_offset = nla_get_u32( 7975 pkt_offset = nla_get_u32(
7978 pat_tb[NL80211_WOWLAN_PKTPAT_OFFSET]); 7976 pat_tb[NL80211_PKTPAT_OFFSET]);
7979 if (pkt_offset > wowlan->max_pkt_offset) 7977 if (pkt_offset > wowlan->max_pkt_offset)
7980 goto error; 7978 goto error;
7981 new_triggers.patterns[i].pkt_offset = pkt_offset; 7979 new_triggers.patterns[i].pkt_offset = pkt_offset;
@@ -7989,11 +7987,11 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info)
7989 new_triggers.patterns[i].pattern = 7987 new_triggers.patterns[i].pattern =
7990 new_triggers.patterns[i].mask + mask_len; 7988 new_triggers.patterns[i].mask + mask_len;
7991 memcpy(new_triggers.patterns[i].mask, 7989 memcpy(new_triggers.patterns[i].mask,
7992 nla_data(pat_tb[NL80211_WOWLAN_PKTPAT_MASK]), 7990 nla_data(pat_tb[NL80211_PKTPAT_MASK]),
7993 mask_len); 7991 mask_len);
7994 new_triggers.patterns[i].pattern_len = pat_len; 7992 new_triggers.patterns[i].pattern_len = pat_len;
7995 memcpy(new_triggers.patterns[i].pattern, 7993 memcpy(new_triggers.patterns[i].pattern,
7996 nla_data(pat_tb[NL80211_WOWLAN_PKTPAT_PATTERN]), 7994 nla_data(pat_tb[NL80211_PKTPAT_PATTERN]),
7997 pat_len); 7995 pat_len);
7998 i++; 7996 i++;
7999 } 7997 }