From owner-freebsd-stable@FreeBSD.ORG Tue Oct 21 21:29: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 AEF321065672 for ; Tue, 21 Oct 2008 21:29:31 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from el-out-1112.google.com (el-out-1112.google.com [209.85.162.181]) by mx1.freebsd.org (Postfix) with ESMTP id 66CB78FC12 for ; Tue, 21 Oct 2008 21:29:31 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: by el-out-1112.google.com with SMTP id v27so624611ele.13 for ; Tue, 21 Oct 2008 14:29:30 -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=tHlWLq4YE/juXFsdeSdHKBVtAhRnXHXIsO6E0mKR8pc=; b=t5ScLhA4LxeiRJfA3ACQyjVWtaAFH/hYMvL9f8ArKW+aMTen6pQqoNV2Rr6r91Ay/T oSrVyWCLDU1P/nMIO3BBxu22i/dFIanrAPLn84CC7rVAct910YL9jYn0tJh6PJVGHMEJ 5PpO3d9menY2aWSflWzrjZGWAkGm4APkUAB8M= 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=RSDXu2Td+ZJ78JwSCZzk4JxRst8hgzcNuVs0EG+RE/BhcivVLHdjTAk0SUOLmZW6q4 QT1BnOstf7SwSRPcVMrUjXjqHfdz6O0Frdr8YnbAEb/xOWxmsktdR+rLkR5/M5zqDEy7 3vkGbKry6sPG5GBKUh+2XgHJuspYLzOZ6GouY= Received: by 10.90.94.3 with SMTP id r3mr9425648agb.62.1224624570568; Tue, 21 Oct 2008 14:29:30 -0700 (PDT) Received: by 10.90.81.10 with HTTP; Tue, 21 Oct 2008 14:29:30 -0700 (PDT) Message-ID: Date: Wed, 22 Oct 2008 01:29:30 +0400 From: pluknet To: "Eduardo Meyer" 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: Tue, 21 Oct 2008 21:29:31 -0000 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