mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-25 11:37:56 +00:00
Implemented per-interface polling(4) control.
This commit is contained in:
parent
054b4ce6e5
commit
43de1cf4be
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=128118
@ -849,6 +849,10 @@ vr_attach(dev)
|
||||
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.
|
||||
@ -1265,6 +1269,10 @@ vr_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
|
||||
struct vr_softc *sc = ifp->if_softc;
|
||||
|
||||
VR_LOCK(sc);
|
||||
if (!(ifp->if_capenable & IFCAP_POLLING)) {
|
||||
ether_poll_deregister(ifp);
|
||||
cmd = POLL_DEREGISTER;
|
||||
}
|
||||
if (cmd == POLL_DEREGISTER) { /* final call, enable interrupts */
|
||||
CSR_WRITE_2(sc, VR_IMR, VR_INTRS);
|
||||
goto done;
|
||||
@ -1343,7 +1351,8 @@ vr_intr(arg)
|
||||
#ifdef DEVICE_POLLING
|
||||
if (ifp->if_flags & IFF_POLLING)
|
||||
goto done;
|
||||
if (ether_poll_register(vr_poll, ifp)) { /* ok, disable interrupts */
|
||||
if ((ifp->if_capenable & IFCAP_POLLING) &&
|
||||
ether_poll_register(vr_poll, ifp)) { /* ok, disable interrupts */
|
||||
CSR_WRITE_2(sc, VR_IMR, 0x0000);
|
||||
vr_poll(ifp, 0, 1);
|
||||
goto done;
|
||||
@ -1721,6 +1730,9 @@ vr_ioctl(ifp, command, data)
|
||||
mii = device_get_softc(sc->vr_miibus);
|
||||
error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command);
|
||||
break;
|
||||
case SIOCSIFCAP:
|
||||
ifp->if_capenable = ifr->ifr_reqcap;
|
||||
break;
|
||||
default:
|
||||
error = ether_ioctl(ifp, command, data);
|
||||
break;
|
||||
|
@ -849,6 +849,10 @@ vr_attach(dev)
|
||||
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.
|
||||
@ -1265,6 +1269,10 @@ vr_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
|
||||
struct vr_softc *sc = ifp->if_softc;
|
||||
|
||||
VR_LOCK(sc);
|
||||
if (!(ifp->if_capenable & IFCAP_POLLING)) {
|
||||
ether_poll_deregister(ifp);
|
||||
cmd = POLL_DEREGISTER;
|
||||
}
|
||||
if (cmd == POLL_DEREGISTER) { /* final call, enable interrupts */
|
||||
CSR_WRITE_2(sc, VR_IMR, VR_INTRS);
|
||||
goto done;
|
||||
@ -1343,7 +1351,8 @@ vr_intr(arg)
|
||||
#ifdef DEVICE_POLLING
|
||||
if (ifp->if_flags & IFF_POLLING)
|
||||
goto done;
|
||||
if (ether_poll_register(vr_poll, ifp)) { /* ok, disable interrupts */
|
||||
if ((ifp->if_capenable & IFCAP_POLLING) &&
|
||||
ether_poll_register(vr_poll, ifp)) { /* ok, disable interrupts */
|
||||
CSR_WRITE_2(sc, VR_IMR, 0x0000);
|
||||
vr_poll(ifp, 0, 1);
|
||||
goto done;
|
||||
@ -1721,6 +1730,9 @@ vr_ioctl(ifp, command, data)
|
||||
mii = device_get_softc(sc->vr_miibus);
|
||||
error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command);
|
||||
break;
|
||||
case SIOCSIFCAP:
|
||||
ifp->if_capenable = ifr->ifr_reqcap;
|
||||
break;
|
||||
default:
|
||||
error = ether_ioctl(ifp, command, data);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user