aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ce
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ce')
-rw-r--r--sys/dev/ce/ceddk.h1
-rw-r--r--sys/dev/ce/if_ce.c19
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;