From owner-freebsd-stable@FreeBSD.ORG Thu Jul 6 20:23:16 2006 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0C63A16A4DD for ; Thu, 6 Jul 2006 20:23:16 +0000 (UTC) (envelope-from atanas@asd.aplus.net) Received: from pro20.abac.com (pro20.abac.com [66.226.64.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A333543D49 for ; Thu, 6 Jul 2006 20:23:15 +0000 (GMT) (envelope-from atanas@asd.aplus.net) Received: from [216.55.129.5] (asd2.aplus.net [216.55.129.5]) (authenticated bits=0) by pro20.abac.com (8.13.6/8.13.6) with ESMTP id k66KNC4P061285 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 6 Jul 2006 13:23:12 -0700 (PDT) (envelope-from atanas@asd.aplus.net) Message-ID: <44AD7297.7080605@asd.aplus.net> Date: Thu, 06 Jul 2006 13:29:11 -0700 From: Atanas User-Agent: Thunderbird 1.5.0.4 (Macintosh/20060516) MIME-Version: 1.0 To: pyunyh@gmail.com References: <20060628225239.GA93265@dan.emsphone.com> <44A3394C.4090209@asd.aplus.net> <44A3817F.4030105@thebeastie.org> <20060629092154.GE742@turion.vk2pj.dyndns.org> <20060629083130.X1229@ganymede.hub.org> <44A4A02A.9060802@thebeastie.org> <20060630012615.Q1103@ganymede.hub.org> <44A57B71.6020201@asd.aplus.net> <20060701035416.GC54876@cdnetworks.co.kr> <44AC6793.2070608@asd.aplus.net> <20060706021444.GA76865@cdnetworks.co.kr> In-Reply-To: <20060706021444.GA76865@cdnetworks.co.kr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 1.47 (SPF_SOFTFAIL) Cc: Peter Jeremy , freebsd-stable@freebsd.org, Michael Vince , User Freebsd Subject: Re: em device hangs on ifconfig alias ... X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jul 2006 20:23:16 -0000 Pyun YongHyeon said the following on 7/5/06 7:14 PM: > > Here is patch generated against RELENG_6. > OK, I just tested that, but it doesn't seem to make any difference. Here's what I did: I commented out the em device from my kernel (a 6-STABLE one from yesterday) and compiled three if_em kernel modules: - one taken from 6.1 release - the unpatched 6-STABLE one - the latter with the above patch applied So I was able to load and test each of these modules independently and without actually restarting the machine. I changed also the driver version string in if_em.c, just to ensure that I'm really loading the right em module by checking dmesg: em1: port 0xdc80-0xdcbf mem 0xfcfe0000-0xfcffffff irq 55 at device 4.1 on pci3 em1: Ethernet address: 00:04:23:b5:1b:ff em1: link state changed to UP I used 2 machines - one running 6.1-RELEASE and using fxp (I'll call it "FXP"), and the test one running 6-STABLE with em (I'll call it "EM"), and tried exchanging/moving an IP alias between them. FXP# ifconfig fxp0: flags=8843 mtu 1500 options=b inet 10.10.64.30 netmask 0xffffff00 broadcast 10.10.64.255 ether 00:e0:81:31:f4:1e media: Ethernet autoselect (100baseTX ) status: active EM# ifconfig em1: flags=8843 mtu 1500 options=b inet 10.10.64.63 netmask 0xffffff00 broadcast 10.10.64.255 ether 00:04:23:b5:1b:ff media: Ethernet autoselect (100baseTX ) status: active First I brought up an IP alias on the FXP machine: FXP# ifconfig fxp0 inet alias 10.10.64.40 netmask 255.255.255.255 and checked whether it's accessible from anywhere - yes. Then I moved that to EM: FXP# ifconfig fxp0 inet -alias 10.10.64.40 EM# ifconfig em1 inet alias 10.10.64.40 netmask 255.255.255.255 and checked again - no. It was accessible only from its own subnet (10.10.64.x), but not from anywhere else. Moving that back to FXP works, but moving it back to EM doesn't. The only way I found to make it accessible was to arping something from the aliased IP address: EM# arping -S10.10.64.40 -c1 somehost So it seems that when an IP alias has been recently used on some other machine (on FXP in my case), the em driver is unable to initialize that IP alias properly. It might be that the fxp driver is not sending something when releasing an alias, who knows. But fact is that fxp always initializes its aliases properly - I use it extensively and it always worked. I tried setting another IP alias that never has been used on these machines. I brought that up first on EM and it worked. The moved it to FXP and it also worked! But moving it back to EM made it inaccessible. It looks like there's something fishy with the alias initialization. Another related problem is that the card gets re-initialized (reset?) on each alias you add (takes between 0.3 and 1 seconds, depending how fast the hardware is), which for mass aliased systems could be a serious hurdle after a crash or reboot. Regards, Atanas > > > ------------------------------------------------------------------------ > > --- if_em.c.orig Fri May 19 09:19:57 2006 > +++ if_em.c Thu Jul 6 11:10:56 2006 > @@ -657,8 +657,9 @@ > > mtx_assert(&adapter->mtx, MA_OWNED); > > - if (!adapter->link_active) > - return; > + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) != > + IFF_DRV_RUNNING) > + return; > > while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { > > @@ -719,11 +720,6 @@ > if (adapter->in_detach) return(error); > > switch (command) { > - case SIOCSIFADDR: > - case SIOCGIFADDR: > - IOCTL_DEBUGOUT("ioctl rcv'd: SIOCxIFADDR (Get/Set Interface Addr)"); > - ether_ioctl(ifp, command, data); > - break; > case SIOCSIFMTU: > { > int max_frame_size; > @@ -760,16 +756,17 @@ > IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFFLAGS (Set Interface Flags)"); > EM_LOCK(adapter); > if (ifp->if_flags & IFF_UP) { > - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { > + if ((ifp->if_drv_flags & IFF_DRV_RUNNING)) { > + if ((ifp->if_flags ^ adapter->if_flags) & > + IFF_PROMISC) { > + em_disable_promisc(adapter); > + em_set_promisc(adapter); > + } > + } else > em_init_locked(adapter); > - } > - > - em_disable_promisc(adapter); > - em_set_promisc(adapter); > } else { > - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { > + if (ifp->if_drv_flags & IFF_DRV_RUNNING) > em_stop(adapter); > - } > } > EM_UNLOCK(adapter); > break; > @@ -835,8 +832,8 @@ > break; > } > default: > - IOCTL_DEBUGOUT1("ioctl received: UNKNOWN (0x%x)", (int)command); > - error = EINVAL; > + error = ether_ioctl(ifp, command, data); > + break; > } > > return(error); > --- if_em.h.orig Thu Jul 6 11:06:17 2006 > +++ if_em.h Thu Jul 6 11:06:41 2006 > @@ -331,6 +331,7 @@ > struct callout timer; > struct callout tx_fifo_timer; > int io_rid; > + int if_flags; > u_int8_t unit; > struct mtx mtx; > int em_insert_vlan_header;