diff options
author | Roman Kurakin <rik@FreeBSD.org> | 2008-06-30 21:18:27 +0000 |
---|---|---|
committer | Roman Kurakin <rik@FreeBSD.org> | 2008-06-30 21:18:27 +0000 |
commit | 259edd28004b03c4ea35891a5f2a8728adbd23ac (patch) | |
tree | fc0d5f8df2864c985a23cc83800e237fc998a308 /sys/dev/ce | |
parent | 2a61d63038c56cc5f103ff3a3fa4146480c32c92 (diff) | |
download | src-259edd28004b03c4ea35891a5f2a8728adbd23ac.tar.gz src-259edd28004b03c4ea35891a5f2a8728adbd23ac.zip |
Do not set IFF_DEBUG directly from the driver.
MFC after: 1 month.
Notes
Notes:
svn path=/head/; revision=180132
Diffstat (limited to 'sys/dev/ce')
-rw-r--r-- | sys/dev/ce/ceddk.h | 1 | ||||
-rw-r--r-- | sys/dev/ce/if_ce.c | 19 |
2 files changed, 13 insertions, 7 deletions
diff --git a/sys/dev/ce/ceddk.h b/sys/dev/ce/ceddk.h index 8cd8c67774bb..f5844005d754 100644 --- a/sys/dev/ce/ceddk.h +++ b/sys/dev/ce/ceddk.h @@ -72,6 +72,7 @@ typedef struct _ce_chan_t { TAU32_UserRequest *rx_queue; TAU32_UserRequest *tx_queue; unsigned char debug; + unsigned char debug_shadow; void (*transmit) (struct _ce_chan_t*, void*, int); void (*receive) (struct _ce_chan_t*, unsigned char*, int); void (*error) (struct _ce_chan_t*, int); diff --git a/sys/dev/ce/if_ce.c b/sys/dev/ce/if_ce.c index 8f93667cdc5c..396d670355e1 100644 --- a/sys/dev/ce/if_ce.c +++ b/sys/dev/ce/if_ce.c @@ -962,8 +962,8 @@ static int ce_sioctl (struct ifnet *ifp, u_long cmd, caddr_t data) if (! (ifp->if_flags & IFF_DEBUG)) d->chan->debug = 0; - else if (! d->chan->debug) - d->chan->debug = 1; + else + d->chan->debug = d->chan->debug_shadow; switch (cmd) { default: CE_DEBUG2 (d, ("ioctl 0x%lx\n", cmd)); return 0; @@ -1621,12 +1621,17 @@ static int ce_ioctl (struct cdev *dev, u_long cmd, caddr_t data, int flag, struc #endif if (error) return error; - d->chan->debug = *(int*)data; #ifndef NETGRAPH - if (d->chan->debug) - d->ifp->if_flags |= IFF_DEBUG; - else - d->ifp->if_flags &= ~IFF_DEBUG; + /* + * The debug_shadow is always greater than zero for logic + * simplicity. For switching debug off the IFF_DEBUG is + * responsible. + */ + d->chan->debug_shadow = (*(int*)data) ? (*(int*)data) : 1; + if (d->ifp->if_flags & IFF_DEBUG) + d->chan->debug = d->chan->debug_shadow; +#else + d->chan->debug = *(int*)data; #endif return 0; |