Date: Wed, 22 Oct 2008 12:09:31 -0200 From: "Eduardo Meyer" <dudu.meyer@gmail.com> To: pluknet <pluknet@gmail.com> Cc: stable@freebsd.org Subject: Re: Check if interface supports Device Polling Message-ID: <d3ea75b30810220709i489525fbgf6a83eca1ff594c9@mail.gmail.com> In-Reply-To: <a31046fc0810211429o145395efxbcf80904f1fb90ec@mail.gmail.com> References: <d3ea75b30810211154kae89e00j57798a34bda78299@mail.gmail.com> <a31046fc0810211429o145395efxbcf80904f1fb90ec@mail.gmail.com>
index | next in thread | previous in thread | raw e-mail
On Tue, Oct 21, 2008 at 7:29 PM, pluknet <pluknet@gmail.com> wrote:
> 2008/10/21 Eduardo Meyer <dudu.meyer@gmail.com>:
>> 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 <nic>
>>
>> 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<WEP,TKIP,AES,AES_CCM,FF,TURBOP,IBSS,HOSTAP,AHDEMO,TXPMGT,SHSLOT,SHPREAMBLE,MONITOR,TKIPMIC,WPA1,WPA2,BURST,WME,BGSCAN,TXFRAG>
Amazing stuff :-) I wish I could hack that.
--
===========
Eduardo Meyer
pessoal: dudu.meyer@gmail.com
profissional: ddm.farmaciap@saude.gov.br
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d3ea75b30810220709i489525fbgf6a83eca1ff594c9>
