summaryrefslogtreecommitdiffstats
path: root/sys/dev/netmap/netmap.c
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2011-12-23 16:03:57 +0000
committerluigi <luigi@FreeBSD.org>2011-12-23 16:03:57 +0000
commitb24bbc2146be01e81cdac625d127f4f93cf9219e (patch)
tree08ec6e9f911af44114ff9faae94c52aca7dbd7e8 /sys/dev/netmap/netmap.c
parentd3862fbdd3031ebc7da424d3ee6d851bc5a0fb09 (diff)
downloadFreeBSD-src-b24bbc2146be01e81cdac625d127f4f93cf9219e.zip
FreeBSD-src-b24bbc2146be01e81cdac625d127f4f93cf9219e.tar.gz
1. don't use if_pspare directly, but through a macro WMA()
2. move a variable declaration at the beginning of a block
Diffstat (limited to 'sys/dev/netmap/netmap.c')
-rw-r--r--sys/dev/netmap/netmap.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c
index 53a2729..5c960ac 100644
--- a/sys/dev/netmap/netmap.c
+++ b/sys/dev/netmap/netmap.c
@@ -1039,7 +1039,7 @@ netmap_poll(__unused struct cdev *dev, int events, struct thread *td)
struct netmap_adapter *na;
struct ifnet *ifp;
struct netmap_kring *kring;
- u_int i, check_all, want_tx, want_rx, revents = 0;
+ u_int core_lock, i, check_all, want_tx, want_rx, revents = 0;
void *adapter;
if (devfs_get_cdevpriv((void **)&priv) != 0 || priv == NULL)
@@ -1116,8 +1116,7 @@ netmap_poll(__unused struct cdev *dev, int events, struct thread *td)
* LOCKED_CL core lock is set, so we need to release it.
*/
enum {NO_CL, NEED_CL, LOCKED_CL };
- int core_lock = (check_all || !na->separate_locks) ?
- NEED_CL:NO_CL;
+ core_lock = (check_all || !na->separate_locks) ? NEED_CL:NO_CL;
/*
* We start with a lock free round which is good if we have
* data available. If this fails, then lock and call the sync
@@ -1246,7 +1245,7 @@ netmap_attach(struct netmap_adapter *na, int num_queues)
buf = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO);
if (buf) {
- ifp->if_pspare[0] = buf;
+ WNA(ifp) = buf;
na->tx_rings = (void *)((char *)buf + sizeof(*na));
na->rx_rings = na->tx_rings + n;
bcopy(na, buf, sizeof(*na));
@@ -1276,7 +1275,7 @@ netmap_detach(struct ifnet *ifp)
knlist_destroy(&na->rx_rings[i].si.si_note);
}
bzero(na, sizeof(*na));
- ifp->if_pspare[0] = NULL;
+ WNA(ifp) = NULL;
free(na, M_DEVBUF);
}
OpenPOWER on IntegriCloud