]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
[PATCH] bcm43xx: basic ethtool support
authorMichael Buesch <mbuesch@freenet.de>
Thu, 2 Feb 2006 18:11:08 +0000 (19:11 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 27 Mar 2006 16:18:28 +0000 (11:18 -0500)
This patch contains the beginnings of ethtool support for bcm43xx.

It only implements get_drvinfo and get_link, but that's enough for
ifplugd to use ethtool to know whether we're associated or not and then
start or stop dhcp as necessary.

Signed-off-by: Jason Lunz <lunz@falooley.org>
Signed-off-by: Michael Buesch <mbuesch@freenet.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/bcm43xx/Makefile
drivers/net/wireless/bcm43xx/bcm43xx_ethtool.c [new file with mode: 0644]
drivers/net/wireless/bcm43xx/bcm43xx_ethtool.h [new file with mode: 0644]
drivers/net/wireless/bcm43xx/bcm43xx_main.c

index 3e5ed77835e2098673241edb608654a26549e516..e025e9f052b24824ff2831fac16f744ee13e71dc 100644 (file)
@@ -5,4 +5,5 @@ bcm43xx-objs := bcm43xx_main.o bcm43xx_dma.o \
                bcm43xx_radio.o bcm43xx_phy.o \
                bcm43xx_power.o bcm43xx_wx.o \
                bcm43xx_pio.o bcm43xx_ilt.o \
-               bcm43xx_leds.o $(bcm43xx-obj-y)
+               bcm43xx_leds.o bcm43xx_ethtool.o \
+               $(bcm43xx-obj-y)
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_ethtool.c b/drivers/net/wireless/bcm43xx/bcm43xx_ethtool.c
new file mode 100644 (file)
index 0000000..b3ffcf5
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+
+  Broadcom BCM43xx wireless driver
+
+  ethtool support
+
+  Copyright (c) 2006 Jason Lunz <lunz@falooley.org>
+
+  Some code in this file is derived from the 8139too.c driver
+  Copyright (C) 2002 Jeff Garzik
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; see the file COPYING.  If not, write to
+  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
+  Boston, MA 02110-1301, USA.
+
+*/
+
+#include "bcm43xx.h"
+#include "bcm43xx_ethtool.h"
+
+#include <linux/netdevice.h>
+#include <linux/pci.h>
+#include <linux/string.h>
+#include <linux/version.h>
+
+
+static void bcm43xx_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
+{
+       struct bcm43xx_private *bcm = bcm43xx_priv(dev);
+
+       strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
+       strncpy(info->version, UTS_RELEASE, sizeof(info->version));
+       strncpy(info->bus_info, pci_name(bcm->pci_dev), ETHTOOL_BUSINFO_LEN);
+}
+
+struct ethtool_ops bcm43xx_ethtool_ops = {
+       .get_drvinfo = bcm43xx_get_drvinfo,
+       .get_link = ethtool_op_get_link,
+};
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_ethtool.h b/drivers/net/wireless/bcm43xx/bcm43xx_ethtool.h
new file mode 100644 (file)
index 0000000..8137049
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef BCM43xx_ETHTOOL_H_
+#define BCM43xx_ETHTOOL_H_
+
+#include <linux/ethtool.h>
+
+extern struct ethtool_ops bcm43xx_ethtool_ops;
+
+#endif /* BCM43xx_ETHTOOL_H_ */
index c0ec503102c88288186ebc4b99b0e32fdb311668..1051a49ddafe688f4d2080ab40dcd1f0e0b7ec79 100644 (file)
@@ -49,6 +49,7 @@
 #include "bcm43xx_pio.h"
 #include "bcm43xx_power.h"
 #include "bcm43xx_wx.h"
+#include "bcm43xx_ethtool.h"
 
 
 MODULE_DESCRIPTION("Broadcom BCM43xx wireless driver");
@@ -4249,6 +4250,7 @@ static int __devinit bcm43xx_init_one(struct pci_dev *pdev,
 #endif
        net_dev->wireless_handlers = &bcm43xx_wx_handlers_def;
        net_dev->irq = pdev->irq;
+       SET_ETHTOOL_OPS(net_dev, &bcm43xx_ethtool_ops);
 
        /* initialize the bcm43xx_private struct */
        bcm = bcm43xx_priv(net_dev);