All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] [patch] ethtool support
@ 2004-04-30  9:45 Gerd Knorr
  2004-05-04 20:41 ` Jeff Dike
  0 siblings, 1 reply; 6+ messages in thread
From: Gerd Knorr @ 2004-04-30  9:45 UTC (permalink / raw)
  To: uml devel

  Hi,

Trivial patch for the uml network driver: basic ethtool support
so it returns name + version on ETHTOOL_GDRVINFO.

  Gerd

--- linux-2.6.5/arch/um/drivers/net_kern.c.ethtool	2004-04-28 15:17:29.125885216 +0200
+++ linux-2.6.5/arch/um/drivers/net_kern.c	2004-04-28 16:59:57.841138416 +0200
@@ -15,6 +15,7 @@
 #include "linux/module.h"
 #include "linux/init.h"
 #include "linux/etherdevice.h"
+#include "linux/ethtool.h"
 #include "linux/list.h"
 #include "linux/inetdevice.h"
 #include "linux/ctype.h"
@@ -242,7 +243,30 @@
 
 static int uml_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
-	return(-EINVAL);
+	static const struct ethtool_drvinfo info = {
+		.cmd     = ETHTOOL_GDRVINFO,
+		.driver  = "uml virtual ethernet",
+		.version = "42",
+	};
+	void *useraddr;
+	u32 ethcmd;
+
+	switch (cmd) {
+        case SIOCETHTOOL:
+		useraddr = ifr->ifr_data;
+		if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
+			return -EFAULT;
+		switch (ethcmd) {
+		case ETHTOOL_GDRVINFO:
+			if (copy_to_user(useraddr, &info, sizeof(info)))
+				return -EFAULT;
+			return 0;
+		default:
+			return -EOPNOTSUPP;
+		}
+	default:
+		return -EINVAL;
+	}
 }
 
 void uml_net_user_timer_expire(unsigned long _conn)


-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE. 
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

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

end of thread, other threads:[~2004-07-09 15:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-30  9:45 [uml-devel] [patch] ethtool support Gerd Knorr
2004-05-04 20:41 ` Jeff Dike
2004-05-05  5:45   ` Gerd Knorr
2004-05-05  6:33     ` the ultimate answer - was: " roland
2004-05-05 11:30       ` [ot] " Henrik Nordstrom
2004-07-09 15:55       ` Romain Chantereau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.