kern/76890: [patch] em driver does not send routing messages on
interface link state changes
Gleb Smirnoff
glebius at freebsd.org
Wed Feb 2 06:00:57 PST 2005
The following reply was made to PR kern/76890; it has been noted by GNATS.
From: Gleb Smirnoff <glebius at freebsd.org>
To: Alexander Hausner <alex at hugo.bmg.gv.at>
Cc: FreeBSD-gnats-submit at freebsd.org
Subject: Re: kern/76890: [patch] em driver does not send routing messages on interface link state changes
Date: Wed, 2 Feb 2005 16:52:05 +0300
Alexander,
A> Intel(R) PRO/1000 Gigabit Ethernet adapter driver (em) does not send
A> routing messages on interface link state changes, which where needed
A> by some kind of routing/failover software (zebra, ifstated etc.)
A> If you unplug/plug the network-cable on an em-interface, you will get
A> no routing messages on routing sockets.
A> /*********************************************************************
A> * Set this to one to display debug statistics
A> @@ -1016,6 +1017,7 @@ em_intr(void *arg)
A> callout_stop(&adapter->timer);
A> adapter->hw.get_link_status = 1;
A> em_check_for_link(&adapter->hw);
A> + rt_ifmsg(ifp);
A> em_print_link_status(adapter);
A> callout_reset(&adapter->timer, 2*hz, em_local_timer, adapter);
A> }
The problem is that em(4) is not miibus(4) aware. All miibus(4) aware drivers send
routing message when link state changes.
Suggested patch looks like a hack, and has one significant problem - rt_ifmsg()
would be called hz/2 times per second, while we need to call only when link
state does changes.
I'd propose this patch, which is still hack alike... Sorry, but it can be applied
only to HEAD, where if_link_state_change() has been introduced. I'd be happy to MFC
this change to RELENG_5 but it will cause binary incompatibilty between miibus.ko
and kernel.
Index: if_em.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/em/if_em.c,v
retrieving revision 1.60
diff -u -r1.60 if_em.c
--- if_em.c 26 Jan 2005 19:45:51 -0000 1.60
+++ if_em.c 2 Feb 2005 12:45:49 -0000
@@ -1654,6 +1654,8 @@
static void
em_print_link_status(struct adapter * adapter)
{
+ struct ifnet *ifp = &adapter->interface_data.ac_if;
+
if (E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU) {
if (adapter->link_active == 0) {
em_get_speed_and_duplex(&adapter->hw,
@@ -1667,6 +1669,7 @@
"Full Duplex" : "Half Duplex"));
adapter->link_active = 1;
adapter->smartspeed = 0;
+ if_link_state_change(ifp, LINK_STATE_UP);
}
} else {
if (adapter->link_active == 1) {
@@ -1675,6 +1678,7 @@
if (bootverbose)
printf("em%d: Link is Down\n", adapter->unit);
adapter->link_active = 0;
+ if_link_state_change(ifp, LINK_STATE_DOWN);
}
}
Index: if_em.h
===================================================================
RCS file: /home/ncvs/src/sys/dev/em/if_em.h,v
retrieving revision 1.30
diff -u -r1.30 if_em.h
--- if_em.h 15 Jan 2005 20:52:15 -0000 1.30
+++ if_em.h 1 Feb 2005 14:52:19 -0000
@@ -53,6 +53,7 @@
#include <net/ethernet.h>
#include <net/if_dl.h>
#include <net/if_media.h>
+#include <net/if_var.h>
#include <net/bpf.h>
#include <net/if_types.h>
--
Totus tuus, Glebius.
GLEBIUS-RIPN GLEB-RIPE
More information about the freebsd-bugs
mailing list