* [PATCH 0/4] More device type integration
@ 2009-10-02 15:15 Marcel Holtmann
2009-10-02 15:15 ` [PATCH 1/4] usbnet: Use wwan%d interface name for mobile broadband devices Marcel Holtmann
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Marcel Holtmann @ 2009-10-02 15:15 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Johannes Berg, Greg KH
Hi Dave,
I followed the work from Johannes and made sure we can register the
device type for wireless devices via the netdev notifier callback for
all cfg80211 based devices. This way we don't have to touch any of
the drivers.
For the mobile broadband cards from Ericsson, the device type is now
set to "wwan" and it also uses "wwan%d" for the default interface name.
Regards
Marcel
Johannes Berg (1):
net: introduce NETDEV_POST_INIT notifier
Marcel Holtmann (3):
usbnet: Use wwan%d interface name for mobile broadband devices
usbnet: Set device type for wlan and wwan devices
cfg80211: assign device type in netdev notifier callback
drivers/net/usb/cdc_ether.c | 20 ++++++++++++++------
drivers/net/usb/usbnet.c | 17 +++++++++++++++++
include/linux/notifier.h | 1 +
include/linux/usb/usbnet.h | 1 +
net/core/dev.c | 6 ++++++
net/mac80211/iface.c | 5 -----
net/wireless/core.c | 7 +++++++
7 files changed, 46 insertions(+), 11 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] usbnet: Use wwan%d interface name for mobile broadband devices
2009-10-02 15:15 [PATCH 0/4] More device type integration Marcel Holtmann
@ 2009-10-02 15:15 ` Marcel Holtmann
2009-10-02 15:15 ` [PATCH 2/4] usbnet: Set device type for wlan and wwan devices Marcel Holtmann
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2009-10-02 15:15 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Johannes Berg, Greg KH
Add support for usbnet based devices like CDC-Ether to indicate that they
are actually mobile broadband devices. In that case use wwan%d as default
interface name.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
drivers/net/usb/cdc_ether.c | 20 ++++++++++++++------
drivers/net/usb/usbnet.c | 3 +++
include/linux/usb/usbnet.h | 1 +
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 4a6aff5..71e65fc 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -420,6 +420,14 @@ static const struct driver_info cdc_info = {
.status = cdc_status,
};
+static const struct driver_info mbm_info = {
+ .description = "Mobile Broadband Network Device",
+ .flags = FLAG_WWAN,
+ .bind = cdc_bind,
+ .unbind = usbnet_cdc_unbind,
+ .status = cdc_status,
+};
+
/*-------------------------------------------------------------------------*/
@@ -532,32 +540,32 @@ static const struct usb_device_id products [] = {
/* Ericsson F3507g */
USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1900, USB_CLASS_COMM,
USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
- .driver_info = (unsigned long) &cdc_info,
+ .driver_info = (unsigned long) &mbm_info,
}, {
/* Ericsson F3507g ver. 2 */
USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1902, USB_CLASS_COMM,
USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
- .driver_info = (unsigned long) &cdc_info,
+ .driver_info = (unsigned long) &mbm_info,
}, {
/* Ericsson F3607gw */
USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1904, USB_CLASS_COMM,
USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
- .driver_info = (unsigned long) &cdc_info,
+ .driver_info = (unsigned long) &mbm_info,
}, {
/* Ericsson F3307 */
USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1906, USB_CLASS_COMM,
USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
- .driver_info = (unsigned long) &cdc_info,
+ .driver_info = (unsigned long) &mbm_info,
}, {
/* Toshiba F3507g */
USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130b, USB_CLASS_COMM,
USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
- .driver_info = (unsigned long) &cdc_info,
+ .driver_info = (unsigned long) &mbm_info,
}, {
/* Dell F3507g */
USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8147, USB_CLASS_COMM,
USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
- .driver_info = (unsigned long) &cdc_info,
+ .driver_info = (unsigned long) &mbm_info,
},
{ }, // END
};
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index ca5ca5a..8124cf1 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1295,6 +1295,9 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
/* WLAN devices should always be named "wlan%d" */
if ((dev->driver_info->flags & FLAG_WLAN) != 0)
strcpy(net->name, "wlan%d");
+ /* WWAN devices should always be named "wwan%d" */
+ if ((dev->driver_info->flags & FLAG_WWAN) != 0)
+ strcpy(net->name, "wwan%d");
/* maybe the remote can't receive an Ethernet MTU */
if (net->mtu > (dev->hard_mtu - net->hard_header_len))
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index f814730..86c31b7 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -90,6 +90,7 @@ struct driver_info {
#define FLAG_WLAN 0x0080 /* use "wlan%d" names */
#define FLAG_AVOID_UNLINK_URBS 0x0100 /* don't unlink urbs at usbnet_stop() */
#define FLAG_SEND_ZLP 0x0200 /* hw requires ZLPs are sent */
+#define FLAG_WWAN 0x0400 /* use "wwan%d" names */
/* init device ... can sleep, or cause probe() failure */
--
1.6.2.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] usbnet: Set device type for wlan and wwan devices
2009-10-02 15:15 [PATCH 0/4] More device type integration Marcel Holtmann
2009-10-02 15:15 ` [PATCH 1/4] usbnet: Use wwan%d interface name for mobile broadband devices Marcel Holtmann
@ 2009-10-02 15:15 ` Marcel Holtmann
2009-10-02 15:15 ` [PATCH 3/4] net: introduce NETDEV_POST_INIT notifier Marcel Holtmann
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2009-10-02 15:15 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Johannes Berg, Greg KH
For usbnet devices with FLAG_WLAN and FLAG_WWAN set the proper device
type so that uevent contains the correct value. This then allows an easy
identification of the actual underlying technology of the Ethernet device.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
drivers/net/usb/usbnet.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 8124cf1..378da8c 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1210,6 +1210,14 @@ static const struct net_device_ops usbnet_netdev_ops = {
// precondition: never called in_interrupt
+static struct device_type wlan_type = {
+ .name = "wlan",
+};
+
+static struct device_type wwan_type = {
+ .name = "wwan",
+};
+
int
usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
{
@@ -1325,6 +1333,12 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
dev->maxpacket = usb_maxpacket (dev->udev, dev->out, 1);
SET_NETDEV_DEV(net, &udev->dev);
+
+ if ((dev->driver_info->flags & FLAG_WLAN) != 0)
+ SET_NETDEV_DEVTYPE(net, &wlan_type);
+ if ((dev->driver_info->flags & FLAG_WWAN) != 0)
+ SET_NETDEV_DEVTYPE(net, &wwan_type);
+
status = register_netdev (net);
if (status)
goto out3;
--
1.6.2.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] net: introduce NETDEV_POST_INIT notifier
2009-10-02 15:15 [PATCH 0/4] More device type integration Marcel Holtmann
2009-10-02 15:15 ` [PATCH 1/4] usbnet: Use wwan%d interface name for mobile broadband devices Marcel Holtmann
2009-10-02 15:15 ` [PATCH 2/4] usbnet: Set device type for wlan and wwan devices Marcel Holtmann
@ 2009-10-02 15:15 ` Marcel Holtmann
2009-10-02 15:15 ` [PATCH 4/4] cfg80211: assign device type in netdev notifier callback Marcel Holtmann
2009-10-05 7:44 ` [PATCH 0/4] More device type integration David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2009-10-02 15:15 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Johannes Berg, Greg KH
From: Johannes Berg <johannes@sipsolutions.net>
For various purposes including a wireless extensions
bugfix, we need to hook into the netdev creation before
before netdev_register_kobject(). This will also ease
doing the dev type assignment that Marcel was working
on for cfg80211 drivers w/o touching them all.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
include/linux/notifier.h | 1 +
net/core/dev.c | 6 ++++++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 44428d2..29714b8 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -201,6 +201,7 @@ static inline int notifier_to_errno(int ret)
#define NETDEV_PRE_UP 0x000D
#define NETDEV_BONDING_OLDTYPE 0x000E
#define NETDEV_BONDING_NEWTYPE 0x000F
+#define NETDEV_POST_INIT 0x0010
#define SYS_DOWN 0x0001 /* Notify of system down */
#define SYS_RESTART SYS_DOWN
diff --git a/net/core/dev.c b/net/core/dev.c
index b8f74cf..a74c8fd 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4836,6 +4836,12 @@ int register_netdevice(struct net_device *dev)
dev->features |= NETIF_F_GSO;
netdev_initialize_kobject(dev);
+
+ ret = call_netdevice_notifiers(NETDEV_POST_INIT, dev);
+ ret = notifier_to_errno(ret);
+ if (ret)
+ goto err_uninit;
+
ret = netdev_register_kobject(dev);
if (ret)
goto err_uninit;
--
1.6.2.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] cfg80211: assign device type in netdev notifier callback
2009-10-02 15:15 [PATCH 0/4] More device type integration Marcel Holtmann
` (2 preceding siblings ...)
2009-10-02 15:15 ` [PATCH 3/4] net: introduce NETDEV_POST_INIT notifier Marcel Holtmann
@ 2009-10-02 15:15 ` Marcel Holtmann
2009-10-05 7:44 ` [PATCH 0/4] More device type integration David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2009-10-02 15:15 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Johannes Berg, Greg KH
Instead of having to modify every non-mac80211 for device type assignment,
do this inside the netdev notifier callback of cfg80211. So all drivers
that integrate with cfg80211 will export a proper device type.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/mac80211/iface.c | 5 -----
net/wireless/core.c | 7 +++++++
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index b8295cb..f6005ad 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -754,10 +754,6 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
return 0;
}
-static struct device_type wiphy_type = {
- .name = "wlan",
-};
-
int ieee80211_if_add(struct ieee80211_local *local, const char *name,
struct net_device **new_dev, enum nl80211_iftype type,
struct vif_params *params)
@@ -789,7 +785,6 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
memcpy(ndev->dev_addr, local->hw.wiphy->perm_addr, ETH_ALEN);
SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy));
- SET_NETDEV_DEVTYPE(ndev, &wiphy_type);
/* don't use IEEE80211_DEV_TO_SUB_IF because it checks too much */
sdata = netdev_priv(ndev);
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 45b2be3..e6f02e9 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -625,6 +625,10 @@ static void wdev_cleanup_work(struct work_struct *work)
dev_put(wdev->netdev);
}
+static struct device_type wiphy_type = {
+ .name = "wlan",
+};
+
static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
unsigned long state,
void *ndev)
@@ -641,6 +645,9 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
WARN_ON(wdev->iftype == NL80211_IFTYPE_UNSPECIFIED);
switch (state) {
+ case NETDEV_POST_INIT:
+ SET_NETDEV_DEVTYPE(dev, &wiphy_type);
+ break;
case NETDEV_REGISTER:
/*
* NB: cannot take rdev->mtx here because this may be
--
1.6.2.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] More device type integration
2009-10-02 15:15 [PATCH 0/4] More device type integration Marcel Holtmann
` (3 preceding siblings ...)
2009-10-02 15:15 ` [PATCH 4/4] cfg80211: assign device type in netdev notifier callback Marcel Holtmann
@ 2009-10-05 7:44 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2009-10-05 7:44 UTC (permalink / raw)
To: marcel; +Cc: netdev, johannes, greg
From: Marcel Holtmann <marcel@holtmann.org>
Date: Fri, 2 Oct 2009 17:15:24 +0200
> I followed the work from Johannes and made sure we can register the
> device type for wireless devices via the netdev notifier callback for
> all cfg80211 based devices. This way we don't have to touch any of
> the drivers.
>
> For the mobile broadband cards from Ericsson, the device type is now
> set to "wwan" and it also uses "wwan%d" for the default interface name.
Looks good, all applied to net-next-2.6
Thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-10-05 7:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-02 15:15 [PATCH 0/4] More device type integration Marcel Holtmann
2009-10-02 15:15 ` [PATCH 1/4] usbnet: Use wwan%d interface name for mobile broadband devices Marcel Holtmann
2009-10-02 15:15 ` [PATCH 2/4] usbnet: Set device type for wlan and wwan devices Marcel Holtmann
2009-10-02 15:15 ` [PATCH 3/4] net: introduce NETDEV_POST_INIT notifier Marcel Holtmann
2009-10-02 15:15 ` [PATCH 4/4] cfg80211: assign device type in netdev notifier callback Marcel Holtmann
2009-10-05 7:44 ` [PATCH 0/4] More device type integration David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).