Add ifpoll, which support hardware TX/RX queues based polling.
[dragonfly.git] / sys / net / if.c
index f04f771..34c8ab7 100644 (file)
@@ -39,6 +39,7 @@
 #include "opt_inet6.h"
 #include "opt_inet.h"
 #include "opt_polling.h"
+#include "opt_ifpoll.h"
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -714,6 +715,10 @@ if_detach(struct ifnet *ifp)
 #ifdef DEVICE_POLLING
        if (ifp->if_flags & IFF_POLLING)
                ether_poll_deregister(ifp);
+#endif
+#ifdef IFPOLL_ENABLE
+       if (ifp->if_flags & IFF_NPOLLING)
+               ifpoll_deregister(ifp);
 #endif
        if_down(ifp);
 
@@ -1341,6 +1346,14 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct ucred *cred)
                        }
                }
 #endif
+#ifdef IFPOLL_ENABLE
+               if ((new_flags ^ ifp->if_flags) & IFF_NPOLLING) {
+                       if (new_flags & IFF_NPOLLING)
+                               ifpoll_register(ifp);
+                       else
+                               ifpoll_deregister(ifp);
+               }
+#endif
 
                ifp->if_flags = (ifp->if_flags & IFF_CANTCHANGE) |
                        (new_flags &~ IFF_CANTCHANGE);