All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Knorr <kraxel@bytesex.org>
To: uml devel <user-mode-linux-devel@lists.sourceforge.net>
Subject: [uml-devel] [patch] ethtool support
Date: Fri, 30 Apr 2004 11:45:57 +0200	[thread overview]
Message-ID: <20040430094557.GA19219@bytesex.org> (raw)

  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

             reply	other threads:[~2004-04-30  9:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-30  9:45 Gerd Knorr [this message]
2004-05-04 20:41 ` [uml-devel] [patch] ethtool support 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040430094557.GA19219@bytesex.org \
    --to=kraxel@bytesex.org \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.