svn commit: r280615 - in stable/10/sys: dev/sfxge modules/sfxge

Andrew Rybchenko arybchik at FreeBSD.org
Wed Mar 25 14:10:22 UTC 2015


Author: arybchik
Date: Wed Mar 25 14:10:20 2015
New Revision: 280615
URL: https://svnweb.freebsd.org/changeset/base/280615

Log:
  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

Modified:
  stable/10/sys/dev/sfxge/sfxge_rx.c
  stable/10/sys/dev/sfxge/sfxge_rx.h
  stable/10/sys/modules/sfxge/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_rx.c
==============================================================================
--- stable/10/sys/dev/sfxge/sfxge_rx.c	Wed Mar 25 14:05:51 2015	(r280614)
+++ stable/10/sys/dev/sfxge/sfxge_rx.c	Wed Mar 25 14:10:20 2015	(r280615)
@@ -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
 #endif
 }
 
+#endif	/* SFXGE_LRO */
+
 void
 sfxge_rx_qflush_done(struct sfxge_rxq *rxq)
 {
@@ -342,6 +346,8 @@ sfxge_rx_deliver(struct sfxge_softc *sc,
 	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(struc
 		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_
 	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);
 }

Modified: stable/10/sys/dev/sfxge/sfxge_rx.h
==============================================================================
--- stable/10/sys/dev/sfxge/sfxge_rx.h	Wed Mar 25 14:05:51 2015	(r280614)
+++ stable/10/sys/dev/sfxge/sfxge_rx.h	Wed Mar 25 14:10:20 2015	(r280615)
@@ -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;

Modified: stable/10/sys/modules/sfxge/Makefile
==============================================================================
--- stable/10/sys/modules/sfxge/Makefile	Wed Mar 25 14:05:51 2015	(r280614)
+++ stable/10/sys/modules/sfxge/Makefile	Wed Mar 25 14:10:20 2015	(r280615)
@@ -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>


More information about the svn-src-all mailing list