看板 DFBSD_bugs 關於我們 聯絡資訊
George Georgalis wrote: > On Wed, Jan 26, 2005 at 07:37:02PM +0000, Gary Allan wrote: > >>I've noticed that polling support for the vr device can not be >>controlled or displayed from ifconfig (Unlike in FreeBSD). Adding the >>following seems to enable that support. No guarantees on correctness but >>maybe someone else can take a look. >> >>cd /usr/src/sys/dev/netif/vr/ >>diff -ruN if_vr.c if_vr.c.new >>--- if_vr.c 2005-01-26 19:19:42.000000000 +0000 >>+++ if_vr.c.new 2005-01-26 19:26:04.000000000 +0000 >>@@ -880,6 +880,10 @@ >> ifp->if_init = vr_init; >> ifp->if_baudrate = 10000000; >> ifp->if_snd.ifq_maxlen = VR_TX_LIST_CNT - 1; >>+#ifdef DEVICE_POLLING >>+ ifp->if_capabilities |= IFCAP_POLLING; >>+#endif >>+ ifp->if_capenable = ifp->if_capabilities; >> >> /* >> * Do MII setup. >>@@ -1690,6 +1694,11 @@ >> mii = device_get_softc(sc->vr_miibus); >> error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); >> break; >>+ case SIOCSIFCAP: >>+ ifp->if_capenable &= ~IFCAP_POLLING; >>+ ifp->if_capenable |= ifr->ifr_reqcap & IFCAP_POLLING; >>+ break; >>+ >> default: >> error = EINVAL; >> break; >> >> >>After the modifications with DEVICE_POLLING kernel support and >>kern.polling.enable=1. > > > Neat, now I can see that polling is really on... > > # ifconfig vr0 -polling && ifconfig vr0 > vr0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 > inet6 fe80::230:1bff:feb4:99a8%vr0 prefixlen 64 scopeid 0x3 > inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255 > ether 00:30:1b:b4:99:a8 > media: Ethernet none (10baseT/UTP) > status: no carrier > # ifconfig vr0 polling && ifconfig vr0 > vr0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 > options=40<polling> > inet6 fe80::230:1bff:feb4:99a8%vr0 prefixlen 64 scopeid 0x3 > inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255 > ether 00:30:1b:b4:99:a8 > media: Ethernet none (10baseT/UTP) > status: no carrier > > And I know exactly what people mean by vr0 code stinks, what a mess. > > BTW - would it be reasonable to teach patch that tabs and spaces are > both whitespace? > > // George > I think this could be a bug. The vr device has polling support I'm not sure that it can actually be enabled. I think this patch (or similar) is needed to set ifp->if_capabilities |= IFCAP_POLLING; and set/clear the IFCAP_POLLING flag in ifp->if_capenable. As it stands I can't see how ifp->if_capenable can ever have this option enabled. Also the code only tests against ifp.if_flags & IFF_POLLING and again I can't see where this flag is set/cleared. Other similar code (rl) tests against ifp->if_capenable & IFCAP_POLLING and ifp.if_flags & IFF_POLLING but only modifies the if_capenable flags. Can someone explain how if_capenable and if_flags operate? Regards G.Allan