Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F154072532
D27914.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D27914.id.diff
View Options
Index: sys/dev/virtio/network/if_vtnet.c
===================================================================
--- sys/dev/virtio/network/if_vtnet.c
+++ sys/dev/virtio/network/if_vtnet.c
@@ -112,6 +112,7 @@
static int vtnet_alloc_virtqueues(struct vtnet_softc *);
static int vtnet_setup_interface(struct vtnet_softc *);
static int vtnet_ioctl_mtu(struct vtnet_softc *, int);
+static int vtnet_ioctl_ifflags(struct vtnet_softc *);
static int vtnet_ioctl(struct ifnet *, u_long, caddr_t);
static uint64_t vtnet_get_counter(struct ifnet *, ift_counter);
@@ -1155,6 +1156,40 @@
return (0);
}
+static int
+vtnet_ioctl_ifflags(struct vtnet_softc *sc)
+{
+ struct ifnet *ifp;
+ int drv_running;
+
+ ifp = sc->vtnet_ifp;
+ drv_running = (ifp->if_drv_flags & IFF_DRV_RUNNING) != 0;
+
+ VTNET_CORE_LOCK_ASSERT(sc);
+
+ if ((ifp->if_flags & IFF_UP) == 0) {
+ if (drv_running)
+ vtnet_stop(sc);
+ goto out;
+ }
+
+ if (!drv_running) {
+ vtnet_init_locked(sc, 0);
+ goto out;
+ }
+
+ if ((ifp->if_flags ^ sc->vtnet_if_flags) &
+ (IFF_PROMISC | IFF_ALLMULTI)) {
+ if ((sc->vtnet_flags & VTNET_FLAG_CTRL_RX) == 0)
+ return (ENOTSUP);
+ vtnet_rx_filter(sc);
+ }
+
+out:
+ sc->vtnet_if_flags = ifp->if_flags;
+ return (0);
+}
+
static int
vtnet_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
@@ -1175,26 +1210,7 @@
case SIOCSIFFLAGS:
VTNET_CORE_LOCK(sc);
- if ((ifp->if_flags & IFF_UP) == 0) {
- if (ifp->if_drv_flags & IFF_DRV_RUNNING)
- vtnet_stop(sc);
- } else if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
- if ((ifp->if_flags ^ sc->vtnet_if_flags) &
- (IFF_PROMISC | IFF_ALLMULTI)) {
- if (sc->vtnet_flags & VTNET_FLAG_CTRL_RX)
- vtnet_rx_filter(sc);
- else {
- ifp->if_flags |= IFF_PROMISC;
- if ((ifp->if_flags ^ sc->vtnet_if_flags)
- & IFF_ALLMULTI)
- error = ENOTSUP;
- }
- }
- } else
- vtnet_init_locked(sc, 0);
-
- if (error == 0)
- sc->vtnet_if_flags = ifp->if_flags;
+ error = vtnet_ioctl_ifflags(sc);
VTNET_CORE_UNLOCK(sc);
break;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 26, 11:09 PM (17 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32146024
Default Alt Text
D27914.id.diff (1 KB)
Attached To
Mode
D27914: if_vtnet: move IFFLAGS ioctl handler to separate function
Attached
Detach File
Event Timeline
Log In to Comment