From: Sepherosa Ziehau Date: Fri, 26 May 2017 11:01:52 +0000 (+0800) Subject: ifnet: Split ringmap declaration into their own header. X-Git-Tag: v5.1.0~509 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/afc5d5f33fc4f8647a40c2c9d9c1bbcac2aff683 ifnet: Split ringmap declaration into their own header. Avoid bus.h -> device_if.h+bus_if.h pollution. Suggested-by: swildner --- diff --git a/sys/dev/netif/bnx/if_bnx.c b/sys/dev/netif/bnx/if_bnx.c index 4d25d05152..6008db879f 100644 --- a/sys/dev/netif/bnx/if_bnx.c +++ b/sys/dev/netif/bnx/if_bnx.c @@ -62,6 +62,7 @@ #include #include #include +#include #include #include #include diff --git a/sys/dev/netif/emx/if_emx.c b/sys/dev/netif/emx/if_emx.c index e54e62010f..397fb874d7 100644 --- a/sys/dev/netif/emx/if_emx.c +++ b/sys/dev/netif/emx/if_emx.c @@ -91,6 +91,7 @@ #include #include #include +#include #include #include #include diff --git a/sys/dev/netif/igb/if_igb.c b/sys/dev/netif/igb/if_igb.c index 82d55fad05..f33bb4b1b8 100644 --- a/sys/dev/netif/igb/if_igb.c +++ b/sys/dev/netif/igb/if_igb.c @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include diff --git a/sys/dev/netif/ix/if_ix.c b/sys/dev/netif/ix/if_ix.c index 2604b34341..626539f773 100644 --- a/sys/dev/netif/ix/if_ix.c +++ b/sys/dev/netif/ix/if_ix.c @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include diff --git a/sys/dev/netif/mxge/if_mxge.c b/sys/dev/netif/mxge/if_mxge.c index fb51a9a78d..318b746740 100644 --- a/sys/dev/netif/mxge/if_mxge.c +++ b/sys/dev/netif/mxge/if_mxge.c @@ -50,6 +50,7 @@ $FreeBSD: head/sys/dev/mxge/if_mxge.c 254263 2013-08-12 23:30:01Z scottl $ #include #include #include +#include #include #include #include diff --git a/sys/net/if.c b/sys/net/if.c index 82c21b959c..2825d1de89 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -64,6 +64,7 @@ #include #include #include +#include #include #include #include diff --git a/sys/net/if_ringmap.h b/sys/net/if_ringmap.h new file mode 100644 index 0000000000..956a2c2a8a --- /dev/null +++ b/sys/net/if_ringmap.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2017 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Sepherosa Ziehau + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _NET_IF_RINGMAP_H_ +#define _NET_IF_RINGMAP_H_ + +#ifndef _KERNEL +#error "kernel only header file" +#endif + +#include +#include + +struct if_ringmap; + +struct if_ringmap *if_ringmap_alloc(device_t dev, int cnt, int cnt_max); +void if_ringmap_free(struct if_ringmap *rm); +void if_ringmap_match(device_t dev, struct if_ringmap *rm0, + struct if_ringmap *rm1); +void if_ringmap_align(device_t dev, struct if_ringmap *rm0, + struct if_ringmap *rm1); +int if_ringmap_count(const struct if_ringmap *rm); +int if_ringmap_cpumap(const struct if_ringmap *rm, int ring); +void if_ringmap_rdrtable(const struct if_ringmap *rm, int table[], + int table_nent); +int if_ringmap_cpumap_sysctl(SYSCTL_HANDLER_ARGS); + +#endif /* !_NET_IF_RINGMAP_H_ */ diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 7a955f56c4..4021554bdf 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -659,9 +659,6 @@ struct ifmultiaddr { #ifdef _KERNEL -#include -#include - struct ifaddr_marker { struct ifaddr ifa; struct ifaddr_container ifac; @@ -974,19 +971,6 @@ int if_simloop(struct ifnet *ifp, struct mbuf *m, int af, int hlen); void if_devstart(struct ifnet *ifp); /* COMPAT */ void if_devstart_sched(struct ifnet *ifp); /* COMPAT */ -struct if_ringmap; - -struct if_ringmap *if_ringmap_alloc(device_t dev, int cnt, int cnt_max); -void if_ringmap_free(struct if_ringmap *rm); -void if_ringmap_match(device_t dev, struct if_ringmap *rm0, - struct if_ringmap *rm1); -void if_ringmap_align(device_t dev, struct if_ringmap *rm0, - struct if_ringmap *rm1); -int if_ringmap_count(const struct if_ringmap *rm); -int if_ringmap_cpumap(const struct if_ringmap *rm, int ring); -void if_ringmap_rdrtable(const struct if_ringmap *rm, int table[], - int table_nent); -int if_ringmap_cpumap_sysctl(SYSCTL_HANDLER_ARGS); int if_ring_count2(int cnt, int cnt_max); void ifnet_lock(void); diff --git a/tools/tools/netrate/pktgen/Makefile b/tools/tools/netrate/pktgen/Makefile index 7716878bf2..b5430cb0c9 100644 --- a/tools/tools/netrate/pktgen/Makefile +++ b/tools/tools/netrate/pktgen/Makefile @@ -1,5 +1,5 @@ KMOD= pktgen -SRCS= pktgen.c device_if.h bus_if.h +SRCS= pktgen.c KCFLAGS+= -g KCFLAGS+= -DINVARIANTS