aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-03-18 06:13:39 -0400
committerJohannes Berg <johannes.berg@intel.com>2015-03-30 04:36:17 -0400
commit6bab2e19c5ffd1f21b28c2cabb3801a37b77ae69 (patch)
tree6e2f45a9254d9def4beecc02c2e14b2fc78d3be5 /net/mac80211
parent6a8b4adb47aea322e376cd1be62781c50dc1a9b5 (diff)
cfg80211: pass name_assign_type to rdev_add_virtual_intf()
This will expose in /sys whether the ifname of a device is set by userspace or generated by the kernel. The latter kind (wlanX, etc) is not deterministic, so userspace needs to rename these devices to names that are guaranteed to stay the same between reboots. The former, however should never be renamed, so userspace needs to be able to reliably tell the difference. Similar functionality was introduced for the rtnetlink core in commit 5517750f058e ("net: rtnetlink - make create_link take name_assign_type") Signed-off-by: Tom Gundersen <teg@jklm.no> Cc: Kalle Valo <kvalo@qca.qualcomm.com> Cc: Brett Rudley <brudley@broadcom.com> Cc: Arend van Spriel <arend@broadcom.com> Cc: Franky (Zhenhui) Lin <frankyl@broadcom.com> Cc: Hante Meuleman <meuleman@broadcom.com> Cc: Johannes Berg <johannes@sipsolutions.net> [reformat changelog to fit 72 cols] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/cfg.c3
-rw-r--r--net/mac80211/ieee80211_i.h1
-rw-r--r--net/mac80211/iface.c3
-rw-r--r--net/mac80211/main.c2
4 files changed, 6 insertions, 3 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index e01cea3b9043..49401238ac39 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -24,6 +24,7 @@
24 24
25static struct wireless_dev *ieee80211_add_iface(struct wiphy *wiphy, 25static struct wireless_dev *ieee80211_add_iface(struct wiphy *wiphy,
26 const char *name, 26 const char *name,
27 unsigned char name_assign_type,
27 enum nl80211_iftype type, 28 enum nl80211_iftype type,
28 u32 *flags, 29 u32 *flags,
29 struct vif_params *params) 30 struct vif_params *params)
@@ -33,7 +34,7 @@ static struct wireless_dev *ieee80211_add_iface(struct wiphy *wiphy,
33 struct ieee80211_sub_if_data *sdata; 34 struct ieee80211_sub_if_data *sdata;
34 int err; 35 int err;
35 36
36 err = ieee80211_if_add(local, name, &wdev, type, params); 37 err = ieee80211_if_add(local, name, name_assign_type, &wdev, type, params);
37 if (err) 38 if (err)
38 return ERR_PTR(err); 39 return ERR_PTR(err);
39 40
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index ebc8135e0aaa..3e3cfe8da4ef 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1578,6 +1578,7 @@ int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
1578int ieee80211_iface_init(void); 1578int ieee80211_iface_init(void);
1579void ieee80211_iface_exit(void); 1579void ieee80211_iface_exit(void);
1580int ieee80211_if_add(struct ieee80211_local *local, const char *name, 1580int ieee80211_if_add(struct ieee80211_local *local, const char *name,
1581 unsigned char name_assign_type,
1581 struct wireless_dev **new_wdev, enum nl80211_iftype type, 1582 struct wireless_dev **new_wdev, enum nl80211_iftype type,
1582 struct vif_params *params); 1583 struct vif_params *params);
1583int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, 1584int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 9689d3b1133b..a0cd97fd0c49 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1648,6 +1648,7 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local,
1648} 1648}
1649 1649
1650int ieee80211_if_add(struct ieee80211_local *local, const char *name, 1650int ieee80211_if_add(struct ieee80211_local *local, const char *name,
1651 unsigned char name_assign_type,
1651 struct wireless_dev **new_wdev, enum nl80211_iftype type, 1652 struct wireless_dev **new_wdev, enum nl80211_iftype type,
1652 struct vif_params *params) 1653 struct vif_params *params)
1653{ 1654{
@@ -1676,7 +1677,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
1676 txqs = IEEE80211_NUM_ACS; 1677 txqs = IEEE80211_NUM_ACS;
1677 1678
1678 ndev = alloc_netdev_mqs(sizeof(*sdata) + local->hw.vif_data_size, 1679 ndev = alloc_netdev_mqs(sizeof(*sdata) + local->hw.vif_data_size,
1679 name, NET_NAME_UNKNOWN, 1680 name, name_assign_type,
1680 ieee80211_if_setup, txqs, 1); 1681 ieee80211_if_setup, txqs, 1);
1681 if (!ndev) 1682 if (!ndev)
1682 return -ENOMEM; 1683 return -ENOMEM;
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 2f51e6d1f2b3..4977967c8b00 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -1057,7 +1057,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
1057 /* add one default STA interface if supported */ 1057 /* add one default STA interface if supported */
1058 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION) && 1058 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION) &&
1059 !(hw->flags & IEEE80211_HW_NO_AUTO_VIF)) { 1059 !(hw->flags & IEEE80211_HW_NO_AUTO_VIF)) {
1060 result = ieee80211_if_add(local, "wlan%d", NULL, 1060 result = ieee80211_if_add(local, "wlan%d", NET_NAME_ENUM, NULL,
1061 NL80211_IFTYPE_STATION, NULL); 1061 NL80211_IFTYPE_STATION, NULL);
1062 if (result) 1062 if (result)
1063 wiphy_warn(local->hw.wiphy, 1063 wiphy_warn(local->hw.wiphy,