Skip to contentSkip to conversation

Minor PPP devices improvements

PATCH In review Guillaume Nault 2 participants 4 messages Dec 11, 2015 – Dec 14, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Minor PPP devices improvements

Let PPP devices be friendlier to user space by registering their device type and reporting their interface naming scheme.

Guillaume Nault (2):
ppp: define "ppp" device type
ppp: declare ppp devices as enumerated interfaces

 drivers/net/ppp/ppp_generic.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
Signature · 1 line
2.6.4
#1 lore raw

PATCH 1/2 ppp: define "ppp" device type

Let PPP devices be identified as such in /sys/class/net/<iface>/uevent.

---
 drivers/net/ppp/ppp_generic.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/ppp/ppp_generic.c +6 -0
index 9a863c6..1cd7651 100644
@@ -1138,9 +1138,15 @@ static const struct net_device_ops ppp_netdev_ops = {
 	.ndo_get_stats64 = ppp_get_stats64,
 };
 
+static struct device_type ppp_type = {
+	.name = "ppp",
+};
+
 static void ppp_setup(struct net_device *dev)
 {
 	dev->netdev_ops = &ppp_netdev_ops;
+	SET_NETDEV_DEVTYPE(dev, &ppp_type);
+
 	dev->hard_header_len = PPP_HDRLEN;
 	dev->mtu = PPP_MRU;
 	dev->addr_len = 0;
Signature · 1 line
2.6.4
#2 lore raw

PATCH 2/2 ppp: declare ppp devices as enumerated interfaces

In reply to Guillaume Nault

Let user space be aware of the naming scheme used by ppp interfaces (visible in /sys/class/net/<iface>/name_assign_type).

---
 drivers/net/ppp/ppp_generic.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ppp/ppp_generic.c +1 -2
index 1cd7651..fc8ad00 100644
@@ -2726,8 +2726,7 @@ static struct ppp *ppp_create_interface(struct net *net, int unit,
 	int ret = -ENOMEM;
 	int i;
 
-	dev = alloc_netdev(sizeof(struct ppp), "", NET_NAME_UNKNOWN,
-			   ppp_setup);
+	dev = alloc_netdev(sizeof(struct ppp), "", NET_NAME_ENUM, ppp_setup);
 	if (!dev)
 		goto out1;
 
Signature · 1 line
2.6.4