This patch, against 2.4.0-test9-pre2, moves ethtool.h from the private
domain of the sparc ports into include/linux.  This publishes an
existing interface, and has been discussed before.  (search past lkml
subject headers for "media tool" and "ethtool")

This updated patch should take some of the past threads into account. 
The differences from the current sparc ethtool.h are:

* bitmask for advertising as well as supported media types
* interrupt mitigation hints max{tx,rx}pkt (Jes suggestion)
* four reserved u32 slots for future expansion
* assigned an ioctl: SIOCETHTOOL (0x8944)

Questions, comments, and feedback welcome.  If there are no objections,
I'll submit to DaveM for inclusion in 2.4.0-test9-whatever, after this
current round of discussion.

        Jeff
diff -urN vanilla/linux-2.4.0-test9-pre2/include/linux/ethtool.h 
linux_2_3/include/linux/ethtool.h
--- vanilla/linux-2.4.0-test9-pre2/include/linux/ethtool.h      Wed Dec 31 19:00:00 
1969
+++ linux_2_3/include/linux/ethtool.h   Sun Sep 17 17:29:10 2000
@@ -0,0 +1,96 @@
+/* $Id: ethtool.h,v 1.1.186.1 2000/09/16 20:13:14 jgarzik Exp $
+ * ethtool.h: Defines for Linux ethtool.
+ *
+ * Copyright (C) 1998 David S. Miller ([EMAIL PROTECTED])
+ */
+
+#ifndef _LINUX_ETHTOOL_H
+#define _LINUX_ETHTOOL_H
+
+
+/* This should work for both 32 and 64 bit userland. */
+struct ethtool_cmd {
+       u32     cmd;
+       u32     supported;      /* Features this interface supports */
+       u32     advertising;    /* Features this interface advertises */
+       u16     speed;          /* The forced speed, 10Mb, 100Mb, gigabit */
+       u8      duplex;         /* Duplex, half or full */
+       u8      port;           /* Which connector port */
+       u8      phy_address;
+       u8      transceiver;    /* Which tranceiver to use */
+       u8      autoneg;        /* Enable or disable autonegotiation */
+       u32     maxtxpkt;       /* Tx pkts before generating tx int */
+       u32     maxrxpkt;       /* Rx pkts before generating rx int */
+       u32     reserved[4];
+};
+
+
+/* CMDs currently supported */
+#define ETHTOOL_GSET           0x00000001 /* Get settings, non-privileged. */
+#define ETHTOOL_SSET           0x00000002 /* Set settings, privileged. */
+
+/* compatibility with older code */
+#define SPARC_ETH_GSET         ETHTOOL_GSET
+#define SPARC_ETH_SSET         ETHTOOL_SSET
+
+/* Indicates what features are supported by the interface. */
+#define SUPPORTED_10baseT_Half         (1 << 0)
+#define SUPPORTED_10baseT_Full         (1 << 1)
+#define SUPPORTED_100baseT_Half                (1 << 2)
+#define SUPPORTED_100baseT_Full                (1 << 3)
+#define SUPPORTED_1000baseT_Half       (1 << 4)
+#define SUPPORTED_1000baseT_Full       (1 << 5)
+#define SUPPORTED_Autoneg              (1 << 6)
+#define SUPPORTED_TP                   (1 << 7)
+#define SUPPORTED_AUI                  (1 << 8)
+#define SUPPORTED_MII                  (1 << 9)
+#define SUPPORTED_FIBRE                        (1 << 10)
+
+/* Indicates what features are advertised by the interface. */
+#define ADVERTISED_10baseT_Half                (1 << 0)
+#define ADVERTISED_10baseT_Full                (1 << 1)
+#define ADVERTISED_100baseT_Half       (1 << 2)
+#define ADVERTISED_100baseT_Full       (1 << 3)
+#define ADVERTISED_1000baseT_Half      (1 << 4)
+#define ADVERTISED_1000baseT_Full      (1 << 5)
+#define ADVERTISED_Autoneg             (1 << 6)
+#define ADVERTISED_TP                  (1 << 7)
+#define ADVERTISED_AUI                 (1 << 8)
+#define ADVERTISED_MII                 (1 << 9)
+#define ADVERTISED_FIBRE               (1 << 10)
+
+/* The following are all involved in forcing a particular link
+ * mode for the device for setting things.  When getting the
+ * devices settings, these indicate the current mode and whether
+ * it was foced up into this mode or autonegotiated.
+ */
+
+/* The forced speed, 10Mb, 100Mb, gigabit. */
+#define SPEED_10               10
+#define SPEED_100              100
+#define SPEED_1000             1000
+
+/* Duplex, half or full. */
+#define DUPLEX_HALF            0x00
+#define DUPLEX_FULL            0x01
+
+/* Which connector port. */
+#define PORT_TP                        0x00
+#define PORT_AUI               0x01
+#define PORT_MII               0x02
+#define PORT_FIBRE             0x03
+
+/* Which tranceiver to use. */
+#define XCVR_INTERNAL          0x00
+#define XCVR_EXTERNAL          0x01
+#define XCVR_DUMMY1            0x02
+#define XCVR_DUMMY2            0x03
+#define XCVR_DUMMY3            0x04
+
+/* Enable or disable autonegotiation.  If this is set to enable,
+ * the forced link modes above are completely ignored.
+ */
+#define AUTONEG_DISABLE                0x00
+#define AUTONEG_ENABLE         0x01
+
+#endif /* _LINUX_ETHTOOL_H */
diff -urN vanilla/linux-2.4.0-test9-pre2/drivers/net/sunhme.c 
linux_2_3/drivers/net/sunhme.c
--- vanilla/linux-2.4.0-test9-pre2/drivers/net/sunhme.c Thu Sep  7 11:32:00 2000
+++ linux_2_3/drivers/net/sunhme.c      Sun Sep 17 17:29:03 2000
@@ -24,6 +24,7 @@
 #include <linux/string.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/ethtool.h>
 #include <asm/system.h>
 #include <asm/bitops.h>
 #include <asm/io.h>
@@ -41,7 +42,6 @@
 #ifndef __sparc_v9__
 #include <asm/io-unit.h>
 #endif
-#include <asm/ethtool.h>
 #include <asm/uaccess.h>
 
 #include <linux/netdevice.h>
diff -urN vanilla/linux-2.4.0-test9-pre2/include/asm-sparc/ethtool.h 
linux_2_3/include/asm-sparc/ethtool.h
--- vanilla/linux-2.4.0-test9-pre2/include/asm-sparc/ethtool.h  Tue Feb  1 02:37:19 
2000
+++ linux_2_3/include/asm-sparc/ethtool.h       Wed Dec 31 19:00:00 1969
@@ -1,79 +0,0 @@
-/* $Id: ethtool.h,v 1.2 2000/01/31 04:59:17 davem Exp $
- * ethtool.h: Defines for SparcLinux ethtool.
- *
- * Copyright (C) 1998 David S. Miller ([EMAIL PROTECTED])
- */
-
-#ifndef _SPARC_ETHTOOL_H
-#define _SPARC_ETHTOOL_H
-
-/* We do things like this so it does not matter what kernel
- * headers you have on your system etc.
- */
-#undef SIOCETHTOOL
-#define SIOCETHTOOL    (SIOCDEVPRIVATE + 0x0f)
-
-/* This should work for both 32 and 64 bit userland. */
-struct ethtool_cmd {
-       u32     cmd;
-       u32     supported;
-       u16     speed;
-       u8      duplex;
-       u8      port;
-       u8      phy_address;
-       u8      transceiver;
-       u8      autoneg;
-};
-
-/* CMDs currently supported */
-#define SPARC_ETH_GSET         0x00000001      /* Get settings, non-privileged. */
-#define SPARC_ETH_SSET         0x00000002      /* Set settings, privileged. */
-
-/* Indicates what features are supported by the interface. */
-#define SUPPORTED_10baseT_Half         0x00000001
-#define SUPPORTED_10baseT_Full         0x00000002
-#define SUPPORTED_100baseT_Half                0x00000004
-#define SUPPORTED_100baseT_Full                0x00000008
-#define SUPPORTED_1000baseT_Half       0x00000010
-#define SUPPORTED_1000baseT_Full       0x00000020
-#define SUPPORTED_Autoneg              0x00000040
-#define SUPPORTED_TP                   0x00000080
-#define SUPPORTED_AUI                  0x00000100
-#define SUPPORTED_MII                  0x00000200
-#define SUPPORTED_FIBRE                        0x00000400
-
-/* The following are all involved in forcing a particular link
- * mode for the device for setting things.  When getting the
- * devices settings, these indicate the current mode and whether
- * it was foced up into this mode or autonegotiated.
- */
-
-/* The forced speec, 10Mb, 100Mb, gigabit. */
-#define SPEED_10               10
-#define SPEED_100              100
-#define SPEED_1000             1000
-
-/* Duplex, half or full. */
-#define DUPLEX_HALF            0x00
-#define DUPLEX_FULL            0x01
-
-/* Which connector port. */
-#define PORT_TP                        0x00
-#define PORT_AUI               0x01
-#define PORT_MII               0x02
-#define PORT_FIBRE             0x03
-
-/* Which tranceiver to use. */
-#define XCVR_INTERNAL          0x00
-#define XCVR_EXTERNAL          0x01
-#define XCVR_DUMMY1            0x02
-#define XCVR_DUMMY2            0x03
-#define XCVR_DUMMY3            0x04
-
-/* Enable or disable autonegotiation.  If this is set to enable,
- * the forced link modes above are completely ignored.
- */
-#define AUTONEG_DISABLE                0x00
-#define AUTONEG_ENABLE         0x01
-
-#endif /* _SPARC_ETHTOOL_H */
diff -urN vanilla/linux-2.4.0-test9-pre2/include/asm-sparc64/ethtool.h 
linux_2_3/include/asm-sparc64/ethtool.h
--- vanilla/linux-2.4.0-test9-pre2/include/asm-sparc64/ethtool.h        Tue Feb  1 
02:37:19 2000
+++ linux_2_3/include/asm-sparc64/ethtool.h     Wed Dec 31 19:00:00 1969
@@ -1,79 +0,0 @@
-/* $Id: ethtool.h,v 1.2 2000/01/31 04:59:19 davem Exp $
- * ethtool.h: Defines for SparcLinux ethtool.
- *
- * Copyright (C) 1998 David S. Miller ([EMAIL PROTECTED])
- */
-
-#ifndef _SPARC64_ETHTOOL_H
-#define _SPARC64_ETHTOOL_H
-
-/* We do things like this so it does not matter what kernel
- * headers you have on your system etc.
- */
-#undef SIOCETHTOOL
-#define SIOCETHTOOL    (SIOCDEVPRIVATE + 0x0f)
-
-/* This should work for both 32 and 64 bit userland. */
-struct ethtool_cmd {
-       u32     cmd;
-       u32     supported;
-       u16     speed;
-       u8      duplex;
-       u8      port;
-       u8      phy_address;
-       u8      transceiver;
-       u8      autoneg;
-};
-
-/* CMDs currently supported */
-#define SPARC_ETH_GSET         0x00000001      /* Get settings, non-privileged. */
-#define SPARC_ETH_SSET         0x00000002      /* Set settings, privileged. */
-
-/* Indicates what features are supported by the interface. */
-#define SUPPORTED_10baseT_Half         0x00000001
-#define SUPPORTED_10baseT_Full         0x00000002
-#define SUPPORTED_100baseT_Half                0x00000004
-#define SUPPORTED_100baseT_Full                0x00000008
-#define SUPPORTED_1000baseT_Half       0x00000010
-#define SUPPORTED_1000baseT_Full       0x00000020
-#define SUPPORTED_Autoneg              0x00000040
-#define SUPPORTED_TP                   0x00000080
-#define SUPPORTED_AUI                  0x00000100
-#define SUPPORTED_MII                  0x00000200
-#define SUPPORTED_FIBRE                        0x00000400
-
-/* The following are all involved in forcing a particular link
- * mode for the device for setting things.  When getting the
- * devices settings, these indicate the current mode and whether
- * it was foced up into this mode or autonegotiated.
- */
-
-/* The forced speec, 10Mb, 100Mb, gigabit. */
-#define SPEED_10               10
-#define SPEED_100              100
-#define SPEED_1000             1000
-
-/* Duplex, half or full. */
-#define DUPLEX_HALF            0x00
-#define DUPLEX_FULL            0x01
-
-/* Which connector port. */
-#define PORT_TP                        0x00
-#define PORT_AUI               0x01
-#define PORT_MII               0x02
-#define PORT_FIBRE             0x03
-
-/* Which tranceiver to use. */
-#define XCVR_INTERNAL          0x00
-#define XCVR_EXTERNAL          0x01
-#define XCVR_DUMMY1            0x02
-#define XCVR_DUMMY2            0x03
-#define XCVR_DUMMY3            0x04
-
-/* Enable or disable autonegotiation.  If this is set to enable,
- * the forced link modes above are completely ignored.
- */
-#define AUTONEG_DISABLE                0x00
-#define AUTONEG_ENABLE         0x01
-
-#endif /* _SPARC64_ETHTOOL_H */
diff -urN vanilla/linux-2.4.0-test9-pre2/include/linux/sockios.h 
linux_2_3/include/linux/sockios.h
--- vanilla/linux-2.4.0-test9-pre2/include/linux/sockios.h      Sat Jan 22 14:54:57 
2000
+++ linux_2_3/include/linux/sockios.h   Sun Sep 17 17:29:10 2000
@@ -71,7 +71,7 @@
 
 #define SIOCGIFTXQLEN  0x8942          /* Get the tx queue length      */
 #define SIOCSIFTXQLEN  0x8943          /* Set the tx queue length      */
-
+#define SIOCETHTOOL    0x8944          /* Ethtool interface            */
 
 /* ARP cache control calls. */
                    /*  0x8950 - 0x8952  * obsolete calls, don't re-use */

Reply via email to