From owner-freebsd-net@FreeBSD.ORG Fri Dec 1 16:52:31 2006 Return-Path: X-Original-To: net@freebsd.org Delivered-To: freebsd-net@FreeBSD.ORG Received: by hub.freebsd.org (Postfix, from userid 618) id 4089216A416; Fri, 1 Dec 2006 16:52:31 +0000 (UTC) In-Reply-To: <20061201161131.GD16100@hoeg.nl> from Ed Schouten at "Dec 1, 2006 05:11:31 pm" To: ed@fxq.nl (Ed Schouten) Date: Fri, 1 Dec 2006 16:52:31 +0000 (GMT) X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20061201165231.4089216A416@hub.freebsd.org> From: wpaul@FreeBSD.ORG (Bill Paul) Cc: pyunyh@gmail.com, stable@freebsd.org, net@freebsd.org Subject: Re: re(4) needs promisc to work properly X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Dec 2006 16:52:31 -0000 > Hello Bill, > > * Bill Paul wrote: > > > - Switching from and to promiscuous mode takes 7 seconds. All packets > > > are dropped in the mean time. > > > > The SIOCSIFFLAGS handler in re_ioctl() currently just takes a shortcut > > of calling re_init(). While this does eventually end up changing the RX > > filter settings accordingly, it takes a while because re_init() also shuts > > down and re-initializes the whole chip (including resetting the link). > > > > This is relatively easy to fix though. The IFF_PROMISC flag can be > > singled out and handled separately. (A few other drivers already do this.) > > I wrote a small patch that moves all rxcfg code in re_init_locked() to a > separate function. This way, we can just call that function instead of > re_init_locked when reaching SIOCSIFFLAGS. I tested it by reverting your > patch and ping6'ing the box. When I run tcpdump, the box doesn't freeze > and enters promiscuous mode (suddenly the ping6 starts to work then). > > What do you think about this patch? I'm a little concerned about the fact that now SIOCSIFFLAGS can never cause re_init_locked() to be called. There are some cases where it does need to be called (like when the IFF_UP flag is first set to turn the interface on). I usually do it like in the vge(4) driver: if it's just the IFF_PROMISC bit that's being toggled, then I only toggle the promisc mode bit in the RX config register. -Bill