netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] allow setting mtu and txqlen via RTM_SETLINK and provide txqlen via RTM_GETLINK
@ 2004-08-23 20:51 Thomas Graf
  2004-08-24  2:26 ` Herbert Xu
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas Graf @ 2004-08-23 20:51 UTC (permalink / raw)
  To: davem, kuznet, hadi; +Cc: netdev

Hello

Introduces a new rtnetlink link message attribute to provide txqlen value
via RTM_GETLINK and adds support for setting MTU and txqlen via RTM_SETLINK.

First step to supersede ioctl network link configuration with
rtnetlink equivalent.

    Thomas


--- 1.19/net/core/rtnetlink.c	Thu Apr 29 01:04:48 2004
+++ 1.20/net/core/rtnetlink.c	Sun Aug 22 18:11:03 2004
@@ -175,6 +175,7 @@
 		r->ifi_flags |= IFF_RUNNING;
 
 	RTA_PUT(skb, IFLA_IFNAME, strlen(dev->name)+1, dev->name);
+	RTA_PUT(skb, IFLA_TXQLEN, sizeof(unsigned long), &dev->tx_queue_len);
 	if (dev->addr_len) {
 		RTA_PUT(skb, IFLA_ADDRESS, dev->addr_len, dev->dev_addr);
 		RTA_PUT(skb, IFLA_BROADCAST, dev->addr_len, dev->broadcast);
@@ -268,6 +269,23 @@
 			goto out;
 		memcpy(dev->broadcast, RTA_DATA(ida[IFLA_BROADCAST - 1]),
 		       dev->addr_len);
+	}
+
+	if (ida[IFLA_MTU - 1]) {
+		if (ida[IFLA_MTU - 1]->rta_len != RTA_LENGTH(sizeof(unsigned)))
+			goto out;
+		err = dev_set_mtu(dev, *((unsigned *) RTA_DATA(ida[IFLA_MTU - 1])));
+
+		if (err)
+			goto out;
+
+	}
+
+	if (ida[IFLA_TXQLEN - 1]) {
+		if (ida[IFLA_TXQLEN - 1]->rta_len != RTA_LENGTH(sizeof(unsigned long)))
+			goto out;
+
+		dev->tx_queue_len = *((unsigned long *) RTA_DATA(ida[IFLA_TXQLEN - 1]));
 	}
 
 	err = 0;

--- 1.33/include/linux/rtnetlink.h	Mon Apr  5 23:41:40 2004
+++ 1.34/include/linux/rtnetlink.h	Sun Aug 22 18:11:03 2004
@@ -540,6 +540,7 @@
 	IFLA_QDISC,
 	IFLA_STATS,
 	IFLA_COST,
+	IFLA_TXQLEN,
 #define IFLA_COST IFLA_COST
 	IFLA_PRIORITY,
 #define IFLA_PRIORITY IFLA_PRIORITY

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2004-08-25  0:34 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-23 20:51 [PATCH] allow setting mtu and txqlen via RTM_SETLINK and provide txqlen via RTM_GETLINK Thomas Graf
2004-08-24  2:26 ` Herbert Xu
2004-08-24  9:49   ` Thomas Graf
2004-08-24 10:16     ` Herbert Xu
2004-08-24 12:04       ` Thomas Graf
2004-08-24 17:32         ` David S. Miller
2004-08-24 18:15           ` Thomas Graf
2004-08-24 20:47           ` [RFC/PATCH] Convert architecture dependent rtnetlink attribute to fixed sized ones Thomas Graf
2004-08-24 22:44             ` David S. Miller
2004-08-24 16:25       ` [PATCH] allow setting mtu and txqlen via RTM_SETLINK and provide txqlen via RTM_GETLINK Thomas Graf
2004-08-24 17:32         ` David S. Miller
2004-08-24 18:08           ` Thomas Graf
2004-08-25  0:34             ` David S. 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).