* [PATCH 2.5.70] e100 report link speed via if_port
@ 2003-05-29 17:41 Stephen Hemminger
2003-05-29 20:49 ` Jeff Garzik
2003-05-29 21:08 ` David S. Miller
0 siblings, 2 replies; 8+ messages in thread
From: Stephen Hemminger @ 2003-05-29 17:41 UTC (permalink / raw)
To: David S. Miller, Scott Feldman; +Cc: netdev
The e100 driver knows the link speed, but it is not visible through sysfs.
Small patch to update the net_device if_port when speed is detected;
this can then be read through /sys/class/net/eth0/if_port.
--- linux-2.5-incr/drivers/net/e100/e100_main.c 2003-05-29 09:52:35.000000000 -0700
+++ linux-2.5-sysfs/drivers/net/e100/e100_main.c 2003-05-29 08:56:47.000000000 -0700
@@ -1720,12 +1720,22 @@
(bdp->cur_dplx_mode == HALF_DUPLEX) ?
"Half" : "Full");
+ if (bdp->cur_line_speed == 10)
+ dev->if_port = IF_PORT_10BASET;
+ else if(bdp->cur_line_speed == 100) {
+ if (bdp->cur_dplx_mode == HALF_DUPLEX)
+ dev->if_port = IF_PORT_100BASETX;
+ else
+ dev->if_port = IF_PORT_100BASEFX;
+ }
+
e100_config_fc(bdp);
e100_config(bdp);
} else {
printk(KERN_ERR "e100: %s NIC Link is Down\n",
bdp->device->name);
+ dev->if_port = IF_PORT_UNKNOWN;
}
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2.5.70] e100 report link speed via if_port
2003-05-29 17:41 [PATCH 2.5.70] e100 report link speed via if_port Stephen Hemminger
@ 2003-05-29 20:49 ` Jeff Garzik
2003-05-29 21:08 ` David S. Miller
1 sibling, 0 replies; 8+ messages in thread
From: Jeff Garzik @ 2003-05-29 20:49 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David S. Miller, Scott Feldman, netdev
dev->if_port is deprecated. that's what ethtool is for... :)
Jeff
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2.5.70] e100 report link speed via if_port
2003-05-29 17:41 [PATCH 2.5.70] e100 report link speed via if_port Stephen Hemminger
2003-05-29 20:49 ` Jeff Garzik
@ 2003-05-29 21:08 ` David S. Miller
2003-05-29 21:28 ` [PATCH 2.5.70] remove if_port_text Stephen Hemminger
1 sibling, 1 reply; 8+ messages in thread
From: David S. Miller @ 2003-05-29 21:08 UTC (permalink / raw)
To: shemminger; +Cc: scott.feldman, netdev
From: Stephen Hemminger <shemminger@osdl.org>
Date: Thu, 29 May 2003 10:41:38 -0700
The e100 driver knows the link speed, but it is not visible through sysfs.
Small patch to update the net_device if_port when speed is detected;
this can then be read through /sys/class/net/eth0/if_port.
if_port is deprecated, use ethtool ioctls to determine the link
speed...
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2.5.70] remove if_port_text
2003-05-29 21:08 ` David S. Miller
@ 2003-05-29 21:28 ` Stephen Hemminger
2003-05-29 21:39 ` Jeff Garzik
2003-05-30 3:15 ` David S. Miller
0 siblings, 2 replies; 8+ messages in thread
From: Stephen Hemminger @ 2003-05-29 21:28 UTC (permalink / raw)
To: David S. Miller, Jeff Garzik; +Cc: scott.feldman, netdev
Eliminate necrophilic code, net-sysfs shouldn't support deprecated if_port.
Since nowhere else is using if_port_text, eliminate it.
diff -Nru a/include/linux/netdevice.h b/include/linux/netdevice.h
--- a/include/linux/netdevice.h Thu May 29 14:24:18 2003
+++ b/include/linux/netdevice.h Thu May 29 14:24:18 2003
@@ -147,8 +147,6 @@
#ifdef __KERNEL__
-extern const char *if_port_text[];
-
#include <linux/cache.h>
#include <linux/skbuff.h>
diff -Nru a/net/core/net-sysfs.c b/net/core/net-sysfs.c
--- a/net/core/net-sysfs.c Thu May 29 14:24:18 2003
+++ b/net/core/net-sysfs.c Thu May 29 14:24:18 2003
@@ -16,16 +16,6 @@
#include <net/sock.h>
#include <linux/rtnetlink.h>
-const char *if_port_text[] = {
- [IF_PORT_UNKNOWN] = "unknown",
- [IF_PORT_10BASE2] = "BNC",
- [IF_PORT_10BASET] = "10baseT",
- [IF_PORT_AUI] = "AUI",
- [IF_PORT_100BASET] = "100baseT",
- [IF_PORT_100BASETX] = "100baseTX",
- [IF_PORT_100BASEFX] = "100baseFX"
-};
-
#define to_net_dev(class) container_of((class), struct net_device, class_dev)
/* generate a show function for simple field */
@@ -66,20 +56,6 @@
NETDEVICE_ATTR(features, "%#x\n");
NETDEVICE_ATTR(type, "%d\n");
-/* TODO: only a few devices set this now should fix others. */
-static ssize_t show_port(struct class_device *dev, char *buf)
-{
- unsigned char port = to_net_dev(dev)->if_port;
- char *cp = buf;
-
- cp += sprintf(cp, "%d", port);
- if (port < ARRAY_SIZE(if_port_text))
- cp += sprintf(cp, " (%s)", if_port_text[port]);
- *cp++ ='\n';
- return cp - buf;
-}
-static CLASS_DEVICE_ATTR(if_port, S_IRUGO, show_port, NULL);
-
static ssize_t format_addr(char *buf, const unsigned char *addr, int len)
{
int i;
@@ -175,7 +151,6 @@
&class_device_attr_features,
&class_device_attr_mtu,
&class_device_attr_flags,
- &class_device_attr_if_port,
&class_device_attr_type,
&class_device_attr_address,
&class_device_attr_broadcast,
diff -Nru a/net/netsyms.c b/net/netsyms.c
--- a/net/netsyms.c Thu May 29 14:24:18 2003
+++ b/net/netsyms.c Thu May 29 14:24:18 2003
@@ -609,8 +609,6 @@
EXPORT_SYMBOL(dev_mc_upload);
EXPORT_SYMBOL(__kill_fasync);
-EXPORT_SYMBOL(if_port_text);
-
#ifdef CONFIG_HIPPI
EXPORT_SYMBOL(hippi_type_trans);
#endif
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2.5.70] remove if_port_text
2003-05-29 21:28 ` [PATCH 2.5.70] remove if_port_text Stephen Hemminger
@ 2003-05-29 21:39 ` Jeff Garzik
2003-05-29 21:48 ` David S. Miller
2003-05-30 3:15 ` David S. Miller
1 sibling, 1 reply; 8+ messages in thread
From: Jeff Garzik @ 2003-05-29 21:39 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David S. Miller, scott.feldman, netdev
Stephen Hemminger wrote:
> Eliminate necrophilic code, net-sysfs shouldn't support deprecated if_port.
> Since nowhere else is using if_port_text, eliminate it.
Looks good to me... David?
Jeff
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2.5.70] remove if_port_text
2003-05-29 21:39 ` Jeff Garzik
@ 2003-05-29 21:48 ` David S. Miller
2003-05-29 22:07 ` Jeff Garzik
0 siblings, 1 reply; 8+ messages in thread
From: David S. Miller @ 2003-05-29 21:48 UTC (permalink / raw)
To: jgarzik; +Cc: shemminger, scott.feldman, netdev
From: Jeff Garzik <jgarzik@pobox.com>
Date: Thu, 29 May 2003 17:39:13 -0400
Stephen Hemminger wrote:
> Eliminate necrophilic code, net-sysfs shouldn't support
> deprecated if_port. Since nowhere else is using if_port_text,
> eliminate it.
Looks good to me... David?
I'm fine with it. I'll apply to 2.5.x
Jeff what do you think about 2.4.x?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2.5.70] remove if_port_text
2003-05-29 21:48 ` David S. Miller
@ 2003-05-29 22:07 ` Jeff Garzik
0 siblings, 0 replies; 8+ messages in thread
From: Jeff Garzik @ 2003-05-29 22:07 UTC (permalink / raw)
To: David S. Miller; +Cc: shemminger, scott.feldman, netdev
David S. Miller wrote:
> From: Jeff Garzik <jgarzik@pobox.com>
> Date: Thu, 29 May 2003 17:39:13 -0400
>
> Stephen Hemminger wrote:
> > Eliminate necrophilic code, net-sysfs shouldn't support
> > deprecated if_port. Since nowhere else is using if_port_text,
> > eliminate it.
>
> Looks good to me... David?
>
> I'm fine with it. I'll apply to 2.5.x
>
> Jeff what do you think about 2.4.x?
I'd rather not... that's an ABI-visible thing.
Jeff
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2.5.70] remove if_port_text
2003-05-29 21:28 ` [PATCH 2.5.70] remove if_port_text Stephen Hemminger
2003-05-29 21:39 ` Jeff Garzik
@ 2003-05-30 3:15 ` David S. Miller
1 sibling, 0 replies; 8+ messages in thread
From: David S. Miller @ 2003-05-30 3:15 UTC (permalink / raw)
To: shemminger; +Cc: jgarzik, scott.feldman, netdev
From: Stephen Hemminger <shemminger@osdl.org>
Date: Thu, 29 May 2003 14:28:20 -0700
Eliminate necrophilic code, net-sysfs shouldn't support deprecated
if_port. Since nowhere else is using if_port_text, eliminate it.
Applied, thanks Stephen.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2003-05-30 3:15 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-29 17:41 [PATCH 2.5.70] e100 report link speed via if_port Stephen Hemminger
2003-05-29 20:49 ` Jeff Garzik
2003-05-29 21:08 ` David S. Miller
2003-05-29 21:28 ` [PATCH 2.5.70] remove if_port_text Stephen Hemminger
2003-05-29 21:39 ` Jeff Garzik
2003-05-29 21:48 ` David S. Miller
2003-05-29 22:07 ` Jeff Garzik
2003-05-30 3:15 ` David S. Miller
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).