diff options
author | arybchik <arybchik@FreeBSD.org> | 2015-03-25 14:10:20 +0000 |
---|---|---|
committer | arybchik <arybchik@FreeBSD.org> | 2015-03-25 14:10:20 +0000 |
commit | bee561cb99b7ab0ba8b7c5dc13a681fb637b808d (patch) | |
tree | ca3adfd9068f01650dbea02c063a226b392496ae | |
parent | 6d64348230193641d8d9fd20b8af6f0c2c77e48d (diff) | |
download | FreeBSD-src-bee561cb99b7ab0ba8b7c5dc13a681fb637b808d.zip FreeBSD-src-bee561cb99b7ab0ba8b7c5dc13a681fb637b808d.tar.gz |
MFC: 279398
sfxge: compile out LRO if kernel is compiled without IPv4 and IPv6
Sponsored by: Solarflare Communications, Inc.
Approved by: gnn (mentor)
MFC: 279411
Unbreak 'make depend' with sfxge by removing debugging code activated in the
INET || INET6 case
X-MFC with: r279398
Pointyhat to: arybchik
-rw-r--r-- | sys/dev/sfxge/sfxge_rx.c | 42 | ||||
-rw-r--r-- | sys/dev/sfxge/sfxge_rx.h | 13 | ||||
-rw-r--r-- | sys/modules/sfxge/Makefile | 16 |
3 files changed, 70 insertions, 1 deletions
diff --git a/sys/dev/sfxge/sfxge_rx.c b/sys/dev/sfxge/sfxge_rx.c index 9f1f734..9b340cb 100644 --- a/sys/dev/sfxge/sfxge_rx.c +++ b/sys/dev/sfxge/sfxge_rx.c @@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$"); #define RX_REFILL_THRESHOLD(_entries) (EFX_RXQ_LIMIT(_entries) * 9 / 10) +#ifdef SFXGE_LRO + SYSCTL_NODE(_hw_sfxge, OID_AUTO, lro, CTLFLAG_RD, NULL, "Large receive offload (LRO) parameters"); @@ -136,6 +138,8 @@ static unsigned long ipv6_addr_cmp(const struct in6_addr *left, #endif } +#endif /* SFXGE_LRO */ + void sfxge_rx_qflush_done(struct sfxge_rxq *rxq) { @@ -342,6 +346,8 @@ sfxge_rx_deliver(struct sfxge_softc *sc, struct sfxge_rx_sw_desc *rx_desc) rx_desc->mbuf = NULL; } +#ifdef SFXGE_LRO + static void sfxge_lro_deliver(struct sfxge_lro_state *st, struct sfxge_lro_conn *c) { @@ -760,6 +766,20 @@ static void sfxge_lro_end_of_burst(struct sfxge_rxq *rxq) sfxge_lro_purge_idle(rxq, t); } +#else /* !SFXGE_LRO */ + +static void +sfxge_lro(struct sfxge_rxq *rxq, struct sfxge_rx_sw_desc *rx_buf) +{ +} + +static void +sfxge_lro_end_of_burst(struct sfxge_rxq *rxq) +{ +} + +#endif /* SFXGE_LRO */ + void sfxge_rx_qcomplete(struct sfxge_rxq *rxq, boolean_t eop) { @@ -1040,6 +1060,8 @@ fail: return (rc); } +#ifdef SFXGE_LRO + static void sfxge_lro_init(struct sfxge_rxq *rxq) { struct sfxge_lro_state *st = &rxq->lro; @@ -1092,6 +1114,20 @@ static void sfxge_lro_fini(struct sfxge_rxq *rxq) st->conns = NULL; } +#else + +static void +sfxge_lro_init(struct sfxge_rxq *rxq) +{ +} + +static void +sfxge_lro_fini(struct sfxge_rxq *rxq) +{ +} + +#endif /* SFXGE_LRO */ + static void sfxge_rx_qfini(struct sfxge_softc *sc, unsigned int index) { @@ -1162,6 +1198,7 @@ static const struct { } sfxge_rx_stats[] = { #define SFXGE_RX_STAT(name, member) \ { #name, offsetof(struct sfxge_rxq, member) } +#ifdef SFXGE_LRO SFXGE_RX_STAT(lro_merges, lro.n_merges), SFXGE_RX_STAT(lro_bursts, lro.n_bursts), SFXGE_RX_STAT(lro_slow_start, lro.n_slow_start), @@ -1170,6 +1207,7 @@ static const struct { SFXGE_RX_STAT(lro_new_stream, lro.n_new_stream), SFXGE_RX_STAT(lro_drop_idle, lro.n_drop_idle), SFXGE_RX_STAT(lro_drop_closed, lro.n_drop_closed) +#endif }; static int @@ -1226,6 +1264,7 @@ sfxge_rx_init(struct sfxge_softc *sc) int index; int rc; +#ifdef SFXGE_LRO if (!ISP2(lro_table_size)) { log(LOG_ERR, "%s=%u must be power of 2", SFXGE_LRO_PARAM(table_size), lro_table_size); @@ -1235,6 +1274,7 @@ sfxge_rx_init(struct sfxge_softc *sc) if (lro_idle_ticks == 0) lro_idle_ticks = hz / 10 + 1; /* 100 ms */ +#endif intr = &sc->intr; @@ -1260,6 +1300,8 @@ fail: sc->rxq_count = 0; +#ifdef SFXGE_LRO fail_lro_table_size: +#endif return (rc); } diff --git a/sys/dev/sfxge/sfxge_rx.h b/sys/dev/sfxge/sfxge_rx.h index 4b3e73a..dae7e08 100644 --- a/sys/dev/sfxge/sfxge_rx.h +++ b/sys/dev/sfxge/sfxge_rx.h @@ -32,6 +32,13 @@ #ifndef _SFXGE_RX_H #define _SFXGE_RX_H +#include "opt_inet.h" +#include "opt_inet6.h" + +#if defined(INET) || defined(INET6) +#define SFXGE_LRO 1 +#endif + #define SFXGE_MAGIC_RESERVED 0x8000 #define SFXGE_MAGIC_DMAQ_LABEL_WIDTH 6 @@ -59,6 +66,8 @@ struct sfxge_rx_sw_desc { int size; }; +#ifdef SFXGE_LRO + /** * struct sfxge_lro_conn - Connection state for software LRO * @link: Link for hash table and free list. @@ -139,6 +148,8 @@ struct sfxge_lro_state { unsigned n_drop_closed; }; +#endif /* SFXGE_LRO */ + enum sfxge_flush_state { SFXGE_FLUSH_DONE = 0, SFXGE_FLUSH_PENDING, @@ -167,7 +178,9 @@ struct sfxge_rxq { unsigned int pending; unsigned int completed; unsigned int loopback; +#ifdef SFXGE_LRO struct sfxge_lro_state lro; +#endif unsigned int refill_threshold; struct callout refill_callout; unsigned int refill_delay; diff --git a/sys/modules/sfxge/Makefile b/sys/modules/sfxge/Makefile index f235762..c627a57 100644 --- a/sys/modules/sfxge/Makefile +++ b/sys/modules/sfxge/Makefile @@ -1,11 +1,13 @@ # $FreeBSD$ +.include <bsd.own.mk> + KMOD= sfxge SFXGE= ${.CURDIR}/../../dev/sfxge SRCS= device_if.h bus_if.h pci_if.h -SRCS+= opt_inet.h opt_sched.h +SRCS+= opt_inet.h opt_inet6.h opt_sched.h .PATH: ${.CURDIR}/../../dev/sfxge SRCS+= sfxge.c sfxge_dma.c sfxge_ev.c @@ -27,4 +29,16 @@ SRCS+= siena_flash.h siena_impl.h DEBUG_FLAGS= -DDEBUG=1 +.if !defined(KERNBUILDDIR) +.if ${MK_INET_SUPPORT} != "no" +opt_inet.h: + @echo "#define INET 1" > ${.TARGET} +.endif + +.if ${MK_INET6_SUPPORT} != "no" +opt_inet6.h: + @echo "#define INET6 1" > ${.TARGET} +.endif +.endif + .include <bsd.kmod.mk> |