aboutsummaryrefslogtreecommitdiff
path: root/sys/net/netmap_user.h
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2012-10-03 21:41:20 +0000
committerEd Maste <emaste@FreeBSD.org>2012-10-03 21:41:20 +0000
commit104d9fc77678c899a26ed33e30e23a79386caeb5 (patch)
tree839ee148464ce76a273ba161828b410e385a1938 /sys/net/netmap_user.h
parentff12c59d9c07504cb46ccbbfbdebdadd6eb15a6d (diff)
downloadsrc-104d9fc77678c899a26ed33e30e23a79386caeb5.tar.gz
src-104d9fc77678c899a26ed33e30e23a79386caeb5.zip
Cast through void * to silence compiler warning
The base netmap pointer and offsets involved are provided by the kernel side of the netmap interface and will have appropriate alignment. Sponsored by: ADARA Networks MFC After: 2 weeks
Notes
Notes: svn path=/head/; revision=241166
Diffstat (limited to 'sys/net/netmap_user.h')
-rw-r--r--sys/net/netmap_user.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/net/netmap_user.h b/sys/net/netmap_user.h
index 743ec322aa19..cefbec773e07 100644
--- a/sys/net/netmap_user.h
+++ b/sys/net/netmap_user.h
@@ -62,15 +62,16 @@
#ifndef _NET_NETMAP_USER_H_
#define _NET_NETMAP_USER_H_
-#define NETMAP_IF(b, o) (struct netmap_if *)((char *)(b) + (o))
+#define _NETMAP_OFFSET(type, ptr, offset) \
+ ((type)(void *)((char *)(ptr) + (offset)))
-#define NETMAP_TXRING(nifp, index) \
- ((struct netmap_ring *)((char *)(nifp) + \
- (nifp)->ring_ofs[index] ) )
+#define NETMAP_IF(b, o) _NETMAP_OFFSET(struct netmap_if *, b, o)
-#define NETMAP_RXRING(nifp, index) \
- ((struct netmap_ring *)((char *)(nifp) + \
- (nifp)->ring_ofs[index + (nifp)->ni_tx_rings + 1] ) )
+#define NETMAP_TXRING(nifp, index) _NETMAP_OFFSET(struct netmap_ring *, \
+ nifp, (nifp)->ring_ofs[index] )
+
+#define NETMAP_RXRING(nifp, index) _NETMAP_OFFSET(struct netmap_ring *, \
+ nifp, (nifp)->ring_ofs[index + (nifp)->ni_tx_rings + 1] )
#define NETMAP_BUF(ring, index) \
((char *)(ring) + (ring)->buf_ofs + ((index)*(ring)->nr_buf_size))