From owner-freebsd-stable@FreeBSD.ORG Wed Oct 22 15:12:31 2008 Return-Path: Delivered-To: stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7B10106567E for ; Wed, 22 Oct 2008 15:12:31 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from QMTA07.emeryville.ca.mail.comcast.net (qmta07.emeryville.ca.mail.comcast.net [76.96.30.64]) by mx1.freebsd.org (Postfix) with ESMTP id A94578FC1C for ; Wed, 22 Oct 2008 15:12:31 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from OMTA03.emeryville.ca.mail.comcast.net ([76.96.30.27]) by QMTA07.emeryville.ca.mail.comcast.net with comcast id Vq261a0010b6N64A7rCXEW; Wed, 22 Oct 2008 15:12:31 +0000 Received: from koitsu.dyndns.org ([69.181.141.110]) by OMTA03.emeryville.ca.mail.comcast.net with comcast id VrCU1a0102P6wsM8PrCV7s; Wed, 22 Oct 2008 15:12:30 +0000 X-Authority-Analysis: v=1.0 c=1 a=BYaJvuN2rVMA:10 a=Ddka7i0Yzg4A:10 a=QycZ5dHgAAAA:8 a=Vqa5PNIH18thbzTcvQ8A:9 a=iV7sG1_RVtsSYHQbGi8A:7 a=2spc-O8DAFmxqPtSFMZYDChbjJMA:4 a=EoioJ0NPDVgA:10 a=MSl-tDqOz04A:10 a=LY0hPdMaydYA:10 Received: by icarus.home.lan (Postfix, from userid 1000) id BA2FFC9432; Wed, 22 Oct 2008 08:12:28 -0700 (PDT) Date: Wed, 22 Oct 2008 08:12:28 -0700 From: Jeremy Chadwick To: Eduardo Meyer Message-ID: <20081022151228.GA60664@icarus.home.lan> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Cc: stable@freebsd.org, pluknet Subject: Re: Check if interface supports Device Polling 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: Wed, 22 Oct 2008 15:12:31 -0000 On Wed, Oct 22, 2008 at 12:09:31PM -0200, Eduardo Meyer wrote: > On Tue, Oct 21, 2008 at 7:29 PM, pluknet wrote: > > 2008/10/21 Eduardo Meyer : > >> Is there another way to check if a certain interface supports polling, > >> other than reading polling(4)? I would like to have a script to check > >> it, issuing something like > >> > >> ifconfig -v -m > >> > >> How can I list all NIC capabilities? Would polling be listed if the > >> driver supports? > >> > > > > I don't know if ifconfig supports listing NIC capabilities, but you can > > always add this. Something like: > > > > --- ifconfig.c.orig 2008-10-22 00:50:03.000000000 +0400 > > +++ ifconfig.c 2008-10-22 01:28:21.000000000 +0400 > > @@ -708,6 +708,19 @@ > > } > > > > void > > +getifcaps(const char *vname, int value, int s, const struct afswtch *afp) > > +{ > > + int flags; > > + > > + if (ioctl(s, SIOCGIFCAP, (caddr_t)&ifr) < 0) { > > + Perror("ioctl (SIOCGIFCAP)"); > > + exit(1); > > + } > > + flags = ifr.ifr_reqcap; > > + printf("Capabilities: %x\n", flags); > > +} > > + > > +void > > setifcap(const char *vname, int value, int s, const struct afswtch *afp) > > { > > int flags; > > @@ -1009,6 +1022,7 @@ > > DEF_CMD("-monitor", -IFF_MONITOR, setifflags), > > DEF_CMD("staticarp", IFF_STATICARP, setifflags), > > DEF_CMD("-staticarp", -IFF_STATICARP, setifflags), > > + DEF_CMD("caps", 0, getifcaps), > > DEF_CMD("rxcsum", IFCAP_RXCSUM, setifcap), > > DEF_CMD("-rxcsum", -IFCAP_RXCSUM, setifcap), > > DEF_CMD("txcsum", IFCAP_TXCSUM, setifcap), > > $ diff -u ifconfig.h.orig ifconfig.h > > --- ifconfig.h.orig 2008-04-27 20:12:43.000000000 +0400 > > +++ ifconfig.h 2008-10-22 00:56:14.000000000 +0400 > > @@ -134,6 +134,7 @@ > > extern int verbose; > > > > void setifcap(const char *, int value, int s, const struct afswtch *); > > +void getifcaps(const char *, int value, int s, const struct afswtch *); > > > > void Perror(const char *cmd); > > void printb(const char *s, unsigned value, const char *bits); > > -- > > wbr, > > pluknet > > > > I have applied your patch, but all I get is: > > # ifconfig -v rl0 caps > Capabilities: 48 The above patch is completely unnecessary. The -m flag in ifconfig will do what you want. However, the existing ifconfig code does not print POLLING as a capability, which is where the bug truly lies. I'll provide a patch that extends the capability list properly, and will allow you to determine a full capability list. -- | Jeremy Chadwick jdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB |