From: Ben Greear <greearb@candelatech.com>
To: "David S. Miller" <davem@redhat.com>
Cc: netdev@oss.sgi.com
Subject: Re: netdev_ops?
Date: Tue, 22 Jul 2003 23:24:00 -0700 [thread overview]
Message-ID: <3F1E2A00.5080506@candelatech.com> (raw)
In-Reply-To: <20030722230215.284dd270.davem@redhat.com>
David S. Miller wrote:
> On Tue, 22 Jul 2003 22:30:10 -0700
> Ben Greear <greearb@candelatech.com> wrote:
>
>
>>Any interest in a lower-risk netdev-ops lite?
>
>
> Not really.
>
> Nobody is really helped with this, not even you. It makes almost no
> sense to make a driver only work with a 2.4.x kernel that has this
> netdev-ops-lite thing patched into it, because then it doesn't work on
> all the bazillion other 2.4.x kernels out there.
My goal is a place to add new generic net-device ioctls without having
to worry about testing the ioctls on various platforms (You've said
before you don't like when I try to add new ioctls because I break SPARC and
who knows what else...)
My patch looks like this, and it has zero impact on drivers. It's primary
benefit is to get around adding more ioctls:
### Line 2304 or so, default case of the dev_ifsioc switch... ###
default:
+ /* Handle some generic ethtool commands here */
+ if (cmd == SIOCETHTOOL) {
+ u32 cmd = 0;
+ if (copy_from_user(&cmd, ifr->ifr_data, sizeof(cmd))) {
+ return -EFAULT;
+ }
+
+ if (cmd == ETHTOOL_GNDSTATS) {
+
+ struct ethtool_ndstats* nds = (struct ethtool_ndstats*)(ifr->ifr_data);
+
+ /* Get net-device stats struct, will save it in the space
+ * passed in to us in ifr->ifr_data. Would like to use
+ * ethtool, but it seems to require specific driver support,
+ * when this is a general purpose netdevice request...
+ */
+ struct net_device_stats *stats = dev->get_stats(dev);
+ if (stats) {
+ if (copy_to_user(nds->data, stats, sizeof(*stats))) {
+ return -EFAULT;
+ }
+ }
+ else {
+ return -EOPNOTSUPP;
+ }
+ return 0;
+ }
+ }
+
+
+
### Fall through to the rest of the ioctl (ethtool included) handling...
--
Ben Greear <greearb@candelatech.com> <Ben_Greear AT excite.com>
President of Candela Technologies Inc http://www.candelatech.com
ScryMUD: http://scry.wanfear.com http://scry.wanfear.com/~greear
next prev parent reply other threads:[~2003-07-23 6:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-23 5:06 netdev_ops? Ben Greear
2003-07-23 5:07 ` netdev_ops? David S. Miller
2003-07-23 5:30 ` netdev_ops? Ben Greear
2003-07-23 6:02 ` netdev_ops? David S. Miller
2003-07-23 6:24 ` Ben Greear [this message]
2003-07-23 6:27 ` netdev_ops? David S. Miller
2003-07-23 6:36 ` netdev_ops? Ben Greear
2003-07-23 7:01 ` netdev_ops? David S. Miller
2003-07-23 7:28 ` netdev_ops? Ben Greear
2003-07-23 7:34 ` netdev_ops? David S. Miller
2003-07-23 8:08 ` netdev_ops? Ben Greear
2003-07-23 8:15 ` netdev_ops? David S. Miller
2003-07-23 16:59 ` netdev_ops? Jeff Garzik
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=3F1E2A00.5080506@candelatech.com \
--to=greearb@candelatech.com \
--cc=davem@redhat.com \
--cc=netdev@oss.sgi.com \
/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 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).