From owner-freebsd-stable@FreeBSD.ORG Wed Oct 22 14:09:33 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 392531065676 for ; Wed, 22 Oct 2008 14:09:33 +0000 (UTC) (envelope-from dudu.meyer@gmail.com) Received: from mail-gx0-f16.google.com (mail-gx0-f16.google.com [209.85.217.16]) by mx1.freebsd.org (Postfix) with ESMTP id CE2B28FC22 for ; Wed, 22 Oct 2008 14:09:32 +0000 (UTC) (envelope-from dudu.meyer@gmail.com) Received: by gxk9 with SMTP id 9so6994542gxk.19 for ; Wed, 22 Oct 2008 07:09:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=LFdPqID7sjuGuZnFM7IEysEo+6fjyI7a/b+mahha/9g=; b=Mz+N2pEm6zO+coNOuTbJ7sR5IHq356nPbaAEk3OT8b5HerSIODpy8poevdvr2Slsj/ h07mJJK0CSf+qHzigf2g+XOyhh9stOh3FHcNVXEzhXXSoZY7LEOZSvquXw61O+76kt8s zJtuwV31/8XreBGmqIhenmtPtif1wqRIZylGk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=caztdr+a8ceH9LyM6JlIkNrjaTxtWTm2EHXbz/xno1KquyhJk1xuC7ynKPvLcgQSLq k7IeDFipEg8PzNeez7C/0UtYSy9S9yBvvv5+w6J1W5yRQYQPNAKrSY9QGUuZ1ofBdyF3 FiAY3oxNcJ5YXeGYUwTeqEV37HinEIKQHlGwE= Received: by 10.65.214.19 with SMTP id r19mr8333954qbq.70.1224684571088; Wed, 22 Oct 2008 07:09:31 -0700 (PDT) Received: by 10.64.201.9 with HTTP; Wed, 22 Oct 2008 07:09:31 -0700 (PDT) Message-ID: Date: Wed, 22 Oct 2008 12:09:31 -0200 From: "Eduardo Meyer" To: pluknet In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: Cc: stable@freebsd.org 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 14:09:33 -0000 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 I would love to see for wired NICs something like: ifconfig -m ath0 list caps ath0=6783edcf Amazing stuff :-) I wish I could hack that. -- =========== Eduardo Meyer pessoal: dudu.meyer@gmail.com profissional: ddm.farmaciap@saude.gov.br