From owner-freebsd-bugs@FreeBSD.ORG Wed Feb 2 14:00:57 2005 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CF70E16A4DC for ; Wed, 2 Feb 2005 14:00:56 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 874C243D6D for ; Wed, 2 Feb 2005 14:00:52 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.1/8.13.1) with ESMTP id j12E0qZ2073651 for ; Wed, 2 Feb 2005 14:00:52 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.1/8.13.1/Submit) id j12E0qed073650; Wed, 2 Feb 2005 14:00:52 GMT (envelope-from gnats) Date: Wed, 2 Feb 2005 14:00:52 GMT Message-Id: <200502021400.j12E0qed073650@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Gleb Smirnoff Subject: Re: kern/76890: [patch] em driver does not send routing messages on interface link state changes X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Gleb Smirnoff List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Feb 2005 14:00:57 -0000 The following reply was made to PR kern/76890; it has been noted by GNATS. From: Gleb Smirnoff To: Alexander Hausner Cc: FreeBSD-gnats-submit@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 #include #include +#include #include #include -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE