summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authornp <np@FreeBSD.org>2014-08-21 19:42:03 +0000
committernp <np@FreeBSD.org>2014-08-21 19:42:03 +0000
commitc11c6b79511d6994540355e671cd715fba04af23 (patch)
tree90fe0cc61ebe3bf65b7031199842654bb0ef5d24 /sys/net
parentc4304b5b4af4fba2337dabfc4d6f9cb8e651ff82 (diff)
downloadFreeBSD-src-c11c6b79511d6994540355e671cd715fba04af23.zip
FreeBSD-src-c11c6b79511d6994540355e671cd715fba04af23.tar.gz
Update a couple of header files that were missed in r270252. This is a
direct commit to stable/10. Submitted by: luigi
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/netmap.h24
-rw-r--r--sys/net/netmap_user.h22
2 files changed, 33 insertions, 13 deletions
diff --git a/sys/net/netmap.h b/sys/net/netmap.h
index 15ebf73..1203bfb 100644
--- a/sys/net/netmap.h
+++ b/sys/net/netmap.h
@@ -445,6 +445,13 @@ struct netmap_if {
* Set the virtio-net header length used by the client
* of a VALE switch port.
*
+ * NETMAP_BDG_NEWIF
+ * create a persistent VALE port with name nr_name.
+ * Used by vale-ctl -n ...
+ *
+ * NETMAP_BDG_DELIF
+ * delete a persistent VALE port. Used by vale-ctl -d ...
+ *
* nr_arg1, nr_arg2, nr_arg3 (in/out) command specific
*
*
@@ -478,11 +485,12 @@ struct nmreq {
uint16_t nr_cmd;
#define NETMAP_BDG_ATTACH 1 /* attach the NIC */
#define NETMAP_BDG_DETACH 2 /* detach the NIC */
-#define NETMAP_BDG_LOOKUP_REG 3 /* register lookup function */
+#define NETMAP_BDG_REGOPS 3 /* register bridge callbacks */
#define NETMAP_BDG_LIST 4 /* get bridge's info */
#define NETMAP_BDG_VNET_HDR 5 /* set the port virtio-net-hdr length */
#define NETMAP_BDG_OFFSET NETMAP_BDG_VNET_HDR /* deprecated alias */
-
+#define NETMAP_BDG_NEWIF 6 /* create a virtual port */
+#define NETMAP_BDG_DELIF 7 /* destroy a virtual port */
uint16_t nr_arg1; /* reserve extra rings in NIOCREGIF */
#define NETMAP_BDG_HOST 1 /* attach the host stack on ATTACH */
@@ -517,6 +525,7 @@ enum { NR_REG_DEFAULT = 0, /* backward compat, should not be used. */
#define NIOCREGIF _IOWR('i', 146, struct nmreq) /* interface register */
#define NIOCTXSYNC _IO('i', 148) /* sync tx queues */
#define NIOCRXSYNC _IO('i', 149) /* sync rx queues */
+#define NIOCCONFIG _IOWR('i',150, struct nm_ifreq) /* for ext. modules */
#endif /* !NIOCREGIF */
@@ -533,4 +542,15 @@ nm_ring_empty(struct netmap_ring *ring)
return (ring->cur == ring->tail);
}
+/*
+ * Opaque structure that is passed to an external kernel
+ * module via ioctl(fd, NIOCCONFIG, req) for a user-owned
+ * bridge port (at this point ephemeral VALE interface).
+ */
+#define NM_IFRDATA_LEN 256
+struct nm_ifreq {
+ char nifr_name[IFNAMSIZ];
+ char data[NM_IFRDATA_LEN];
+};
+
#endif /* _NET_NETMAP_H_ */
diff --git a/sys/net/netmap_user.h b/sys/net/netmap_user.h
index 9e0ab43..5faf671 100644
--- a/sys/net/netmap_user.h
+++ b/sys/net/netmap_user.h
@@ -149,21 +149,21 @@ nm_ring_space(struct netmap_ring *ring)
#define ND(_fmt, ...) do {} while(0)
#define D(_fmt, ...) \
do { \
- struct timeval t0; \
- gettimeofday(&t0, NULL); \
+ struct timeval _t0; \
+ gettimeofday(&_t0, NULL); \
fprintf(stderr, "%03d.%06d %s [%d] " _fmt "\n", \
- (int)(t0.tv_sec % 1000), (int)t0.tv_usec, \
+ (int)(_t0.tv_sec % 1000), (int)_t0.tv_usec, \
__FUNCTION__, __LINE__, ##__VA_ARGS__); \
} while (0)
/* Rate limited version of "D", lps indicates how many per second */
#define RD(lps, format, ...) \
do { \
- static int t0, __cnt; \
+ static int __t0, __cnt; \
struct timeval __xxts; \
gettimeofday(&__xxts, NULL); \
- if (t0 != __xxts.tv_sec) { \
- t0 = __xxts.tv_sec; \
+ if (__t0 != __xxts.tv_sec) { \
+ __t0 = __xxts.tv_sec; \
__cnt = 0; \
} \
if (__cnt++ < lps) { \
@@ -495,23 +495,23 @@ nm_open(const char *ifname, const struct nmreq *req,
(char *)d->mem + d->memsize;
}
- if (nr_flags == NR_REG_SW) { /* host stack */
+ if (d->req.nr_flags == NR_REG_SW) { /* host stack */
d->first_tx_ring = d->last_tx_ring = d->req.nr_tx_rings;
d->first_rx_ring = d->last_rx_ring = d->req.nr_rx_rings;
- } else if (nr_flags == NR_REG_ALL_NIC) { /* only nic */
+ } else if (d->req.nr_flags == NR_REG_ALL_NIC) { /* only nic */
d->first_tx_ring = 0;
d->first_rx_ring = 0;
d->last_tx_ring = d->req.nr_tx_rings - 1;
d->last_rx_ring = d->req.nr_rx_rings - 1;
- } else if (nr_flags == NR_REG_NIC_SW) {
+ } else if (d->req.nr_flags == NR_REG_NIC_SW) {
d->first_tx_ring = 0;
d->first_rx_ring = 0;
d->last_tx_ring = d->req.nr_tx_rings;
d->last_rx_ring = d->req.nr_rx_rings;
- } else if (nr_flags == NR_REG_ONE_NIC) {
+ } else if (d->req.nr_flags == NR_REG_ONE_NIC) {
/* XXX check validity */
d->first_tx_ring = d->last_tx_ring =
- d->first_rx_ring = d->last_rx_ring = nr_ringid;
+ d->first_rx_ring = d->last_rx_ring = d->req.nr_ringid & NETMAP_RING_MASK;
} else { /* pipes */
d->first_tx_ring = d->last_tx_ring = 0;
d->first_rx_ring = d->last_rx_ring = 0;
OpenPOWER on IntegriCloud