aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAviya Erenfeld <aviya.erenfeld@intel.com>2016-08-29 16:25:15 -0400
committerJohannes Berg <johannes.berg@intel.com>2016-09-12 05:24:47 -0400
commitd82121845d44334f5ec3c98906d1e4a592350beb (patch)
treeab061cce133bf16d5d85baedaaef370e5c4dd7ed
parent5a1f044b5048e834f936fbb33a93e5d8410779ec (diff)
mac80211: refactor monitor representation in sdata
Insert the u32 monitor flags variable in a new structure that represents a monitor interface. This will allow to add more configuration variables to that structure which will happen in an upcoming change. Signed-off-by: Aviya Erenfeld <aviya.erenfeld@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--net/mac80211/cfg.c8
-rw-r--r--net/mac80211/driver-ops.c2
-rw-r--r--net/mac80211/ieee80211_i.h6
-rw-r--r--net/mac80211/iface.c16
-rw-r--r--net/mac80211/rx.c4
-rw-r--r--net/mac80211/status.c2
-rw-r--r--net/mac80211/tx.c2
-rw-r--r--net/mac80211/util.c2
8 files changed, 23 insertions, 19 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 543b1d4fc33d..f2c8cd22d317 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -39,7 +39,7 @@ static struct wireless_dev *ieee80211_add_iface(struct wiphy *wiphy,
39 39
40 if (type == NL80211_IFTYPE_MONITOR && flags) { 40 if (type == NL80211_IFTYPE_MONITOR && flags) {
41 sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); 41 sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
42 sdata->u.mntr_flags = *flags; 42 sdata->u.mntr.flags = *flags;
43 } 43 }
44 44
45 return wdev; 45 return wdev;
@@ -89,11 +89,11 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
89 * cooked_mntrs, monitor and all fif_* counters 89 * cooked_mntrs, monitor and all fif_* counters
90 * reconfigure hardware 90 * reconfigure hardware
91 */ 91 */
92 if ((*flags & mask) != (sdata->u.mntr_flags & mask)) 92 if ((*flags & mask) != (sdata->u.mntr.flags & mask))
93 return -EBUSY; 93 return -EBUSY;
94 94
95 ieee80211_adjust_monitor_flags(sdata, -1); 95 ieee80211_adjust_monitor_flags(sdata, -1);
96 sdata->u.mntr_flags = *flags; 96 sdata->u.mntr.flags = *flags;
97 ieee80211_adjust_monitor_flags(sdata, 1); 97 ieee80211_adjust_monitor_flags(sdata, 1);
98 98
99 ieee80211_configure_filter(local); 99 ieee80211_configure_filter(local);
@@ -103,7 +103,7 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
103 * and ieee80211_do_open take care of "everything" 103 * and ieee80211_do_open take care of "everything"
104 * mentioned in the comment above. 104 * mentioned in the comment above.
105 */ 105 */
106 sdata->u.mntr_flags = *flags; 106 sdata->u.mntr.flags = *flags;
107 } 107 }
108 } 108 }
109 109
diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c
index c258f1041d33..c701b6438bd9 100644
--- a/net/mac80211/driver-ops.c
+++ b/net/mac80211/driver-ops.c
@@ -62,7 +62,7 @@ int drv_add_interface(struct ieee80211_local *local,
62 if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN || 62 if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
63 (sdata->vif.type == NL80211_IFTYPE_MONITOR && 63 (sdata->vif.type == NL80211_IFTYPE_MONITOR &&
64 !ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF) && 64 !ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF) &&
65 !(sdata->u.mntr_flags & MONITOR_FLAG_ACTIVE)))) 65 !(sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE))))
66 return -EINVAL; 66 return -EINVAL;
67 67
68 trace_drv_add_interface(local, sdata); 68 trace_drv_add_interface(local, sdata);
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index f56d342c31b8..9211cce10d3e 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -824,6 +824,10 @@ struct txq_info {
824 struct ieee80211_txq txq; 824 struct ieee80211_txq txq;
825}; 825};
826 826
827struct ieee80211_if_mntr {
828 u32 flags;
829};
830
827struct ieee80211_sub_if_data { 831struct ieee80211_sub_if_data {
828 struct list_head list; 832 struct list_head list;
829 833
@@ -922,7 +926,7 @@ struct ieee80211_sub_if_data {
922 struct ieee80211_if_ibss ibss; 926 struct ieee80211_if_ibss ibss;
923 struct ieee80211_if_mesh mesh; 927 struct ieee80211_if_mesh mesh;
924 struct ieee80211_if_ocb ocb; 928 struct ieee80211_if_ocb ocb;
925 u32 mntr_flags; 929 struct ieee80211_if_mntr mntr;
926 } u; 930 } u;
927 931
928#ifdef CONFIG_MAC80211_DEBUGFS 932#ifdef CONFIG_MAC80211_DEBUGFS
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index b123a9e325b3..c8509d95e09d 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -188,7 +188,7 @@ static int ieee80211_verify_mac(struct ieee80211_sub_if_data *sdata, u8 *addr,
188 continue; 188 continue;
189 189
190 if (iter->vif.type == NL80211_IFTYPE_MONITOR && 190 if (iter->vif.type == NL80211_IFTYPE_MONITOR &&
191 !(iter->u.mntr_flags & MONITOR_FLAG_ACTIVE)) 191 !(iter->u.mntr.flags & MONITOR_FLAG_ACTIVE))
192 continue; 192 continue;
193 193
194 m = iter->vif.addr; 194 m = iter->vif.addr;
@@ -217,7 +217,7 @@ static int ieee80211_change_mac(struct net_device *dev, void *addr)
217 return -EBUSY; 217 return -EBUSY;
218 218
219 if (sdata->vif.type == NL80211_IFTYPE_MONITOR && 219 if (sdata->vif.type == NL80211_IFTYPE_MONITOR &&
220 !(sdata->u.mntr_flags & MONITOR_FLAG_ACTIVE)) 220 !(sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE))
221 check_dup = false; 221 check_dup = false;
222 222
223 ret = ieee80211_verify_mac(sdata, sa->sa_data, check_dup); 223 ret = ieee80211_verify_mac(sdata, sa->sa_data, check_dup);
@@ -357,7 +357,7 @@ void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata,
357 const int offset) 357 const int offset)
358{ 358{
359 struct ieee80211_local *local = sdata->local; 359 struct ieee80211_local *local = sdata->local;
360 u32 flags = sdata->u.mntr_flags; 360 u32 flags = sdata->u.mntr.flags;
361 361
362#define ADJUST(_f, _s) do { \ 362#define ADJUST(_f, _s) do { \
363 if (flags & MONITOR_FLAG_##_f) \ 363 if (flags & MONITOR_FLAG_##_f) \
@@ -589,12 +589,12 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
589 } 589 }
590 break; 590 break;
591 case NL80211_IFTYPE_MONITOR: 591 case NL80211_IFTYPE_MONITOR:
592 if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) { 592 if (sdata->u.mntr.flags & MONITOR_FLAG_COOK_FRAMES) {
593 local->cooked_mntrs++; 593 local->cooked_mntrs++;
594 break; 594 break;
595 } 595 }
596 596
597 if (sdata->u.mntr_flags & MONITOR_FLAG_ACTIVE) { 597 if (sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE) {
598 res = drv_add_interface(local, sdata); 598 res = drv_add_interface(local, sdata);
599 if (res) 599 if (res)
600 goto err_stop; 600 goto err_stop;
@@ -926,7 +926,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
926 /* no need to tell driver */ 926 /* no need to tell driver */
927 break; 927 break;
928 case NL80211_IFTYPE_MONITOR: 928 case NL80211_IFTYPE_MONITOR:
929 if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) { 929 if (sdata->u.mntr.flags & MONITOR_FLAG_COOK_FRAMES) {
930 local->cooked_mntrs--; 930 local->cooked_mntrs--;
931 break; 931 break;
932 } 932 }
@@ -1012,7 +1012,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
1012 ieee80211_recalc_idle(local); 1012 ieee80211_recalc_idle(local);
1013 mutex_unlock(&local->mtx); 1013 mutex_unlock(&local->mtx);
1014 1014
1015 if (!(sdata->u.mntr_flags & MONITOR_FLAG_ACTIVE)) 1015 if (!(sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE))
1016 break; 1016 break;
1017 1017
1018 /* fall through */ 1018 /* fall through */
@@ -1444,7 +1444,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
1444 case NL80211_IFTYPE_MONITOR: 1444 case NL80211_IFTYPE_MONITOR:
1445 sdata->dev->type = ARPHRD_IEEE80211_RADIOTAP; 1445 sdata->dev->type = ARPHRD_IEEE80211_RADIOTAP;
1446 sdata->dev->netdev_ops = &ieee80211_monitorif_ops; 1446 sdata->dev->netdev_ops = &ieee80211_monitorif_ops;
1447 sdata->u.mntr_flags = MONITOR_FLAG_CONTROL | 1447 sdata->u.mntr.flags = MONITOR_FLAG_CONTROL |
1448 MONITOR_FLAG_OTHER_BSS; 1448 MONITOR_FLAG_OTHER_BSS;
1449 break; 1449 break;
1450 case NL80211_IFTYPE_WDS: 1450 case NL80211_IFTYPE_WDS:
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 9dce3b157908..708c3b1e49a1 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -567,7 +567,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
567 if (sdata->vif.type != NL80211_IFTYPE_MONITOR) 567 if (sdata->vif.type != NL80211_IFTYPE_MONITOR)
568 continue; 568 continue;
569 569
570 if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) 570 if (sdata->u.mntr.flags & MONITOR_FLAG_COOK_FRAMES)
571 continue; 571 continue;
572 572
573 if (!ieee80211_sdata_running(sdata)) 573 if (!ieee80211_sdata_running(sdata))
@@ -3147,7 +3147,7 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx,
3147 continue; 3147 continue;
3148 3148
3149 if (sdata->vif.type != NL80211_IFTYPE_MONITOR || 3149 if (sdata->vif.type != NL80211_IFTYPE_MONITOR ||
3150 !(sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES)) 3150 !(sdata->u.mntr.flags & MONITOR_FLAG_COOK_FRAMES))
3151 continue; 3151 continue;
3152 3152
3153 if (prev_dev) { 3153 if (prev_dev) {
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index a2a68269675d..fabd9ff710d9 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -709,7 +709,7 @@ void ieee80211_tx_monitor(struct ieee80211_local *local, struct sk_buff *skb,
709 if (!ieee80211_sdata_running(sdata)) 709 if (!ieee80211_sdata_running(sdata))
710 continue; 710 continue;
711 711
712 if ((sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) && 712 if ((sdata->u.mntr.flags & MONITOR_FLAG_COOK_FRAMES) &&
713 !send_to_cooked) 713 !send_to_cooked)
714 continue; 714 continue;
715 715
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 1d0746dfea57..efc38e7b90b9 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1643,7 +1643,7 @@ static bool __ieee80211_tx(struct ieee80211_local *local,
1643 1643
1644 switch (sdata->vif.type) { 1644 switch (sdata->vif.type) {
1645 case NL80211_IFTYPE_MONITOR: 1645 case NL80211_IFTYPE_MONITOR:
1646 if (sdata->u.mntr_flags & MONITOR_FLAG_ACTIVE) { 1646 if (sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE) {
1647 vif = &sdata->vif; 1647 vif = &sdata->vif;
1648 break; 1648 break;
1649 } 1649 }
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 42bf0b6685e8..e777c2a6568f 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -598,7 +598,7 @@ static void __iterate_interfaces(struct ieee80211_local *local,
598 list_for_each_entry_rcu(sdata, &local->interfaces, list) { 598 list_for_each_entry_rcu(sdata, &local->interfaces, list) {
599 switch (sdata->vif.type) { 599 switch (sdata->vif.type) {
600 case NL80211_IFTYPE_MONITOR: 600 case NL80211_IFTYPE_MONITOR:
601 if (!(sdata->u.mntr_flags & MONITOR_FLAG_ACTIVE)) 601 if (!(sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE))
602 continue; 602 continue;
603 break; 603 break;
604 case NL80211_IFTYPE_AP_VLAN: 604 case NL80211_IFTYPE_AP_VLAN: