Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Feb 2015 19:01:43 +0000 (UTC)
From:      Andrew Rybchenko <arybchik@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r279398 - in head/sys: dev/sfxge modules/sfxge
Message-ID:  <201502281901.t1SJ1h3f028778@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: arybchik
Date: Sat Feb 28 19:01:43 2015
New Revision: 279398
URL: https://svnweb.freebsd.org/changeset/base/279398

Log:
  sfxge: compile out LRO if kernel is compiled without IPv4 and IPv6
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:    gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge_rx.c
  head/sys/dev/sfxge/sfxge_rx.h
  head/sys/modules/sfxge/Makefile

Modified: head/sys/dev/sfxge/sfxge_rx.c
==============================================================================
--- head/sys/dev/sfxge/sfxge_rx.c	Sat Feb 28 18:22:10 2015	(r279397)
+++ head/sys/dev/sfxge/sfxge_rx.c	Sat Feb 28 19:01:43 2015	(r279398)
@@ -56,6 +56,8 @@ __FBSDID("$FreeBSD$");
 
 #define	RX_REFILL_THRESHOLD(_entries)	(EFX_RXQ_LIMIT(_entries) * 9 / 10)
 
+#ifdef SFXGE_LRO
+
 /* Size of the LRO hash table.  Must be a power of 2.  A larger table
  * means we can accelerate a larger number of streams.
  */
@@ -107,6 +109,8 @@ static unsigned long ipv6_addr_cmp(const
 #endif
 }
 
+#endif	/* SFXGE_LRO */
+
 void
 sfxge_rx_qflush_done(struct sfxge_rxq *rxq)
 {
@@ -315,6 +319,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)
 {
@@ -734,6 +740,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)
 {
@@ -1014,6 +1034,8 @@ fail:
 	return (rc);
 }
 
+#ifdef SFXGE_LRO
+
 static void sfxge_lro_init(struct sfxge_rxq *rxq)
 {
 	struct sfxge_lro_state *st = &rxq->lro;
@@ -1066,6 +1088,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)
 {
@@ -1136,6 +1172,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),
@@ -1144,6 +1181,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
@@ -1200,8 +1238,10 @@ sfxge_rx_init(struct sfxge_softc *sc)
 	int index;
 	int rc;
 
+#ifdef SFXGE_LRO
 	if (lro_idle_ticks == 0)
 		lro_idle_ticks = hz / 10 + 1; /* 100 ms */
+#endif
 
 	intr = &sc->intr;
 

Modified: head/sys/dev/sfxge/sfxge_rx.h
==============================================================================
--- head/sys/dev/sfxge/sfxge_rx.h	Sat Feb 28 18:22:10 2015	(r279397)
+++ head/sys/dev/sfxge/sfxge_rx.h	Sat Feb 28 19:01:43 2015	(r279398)
@@ -32,6 +32,14 @@
 #ifndef _SFXGE_RX_H
 #define	_SFXGE_RX_H
 
+#include "opt_inet.h"
+#include "opt_inet6.h"
+
+#if defined(INET) || defined(INET6)
+#error LRO
+#define	SFXGE_LRO	1
+#endif
+
 #define	SFXGE_MAGIC_RESERVED	0x8000
 
 #define	SFXGE_MAGIC_DMAQ_LABEL_WIDTH	6
@@ -59,6 +67,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 +149,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 +179,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: head/sys/modules/sfxge/Makefile
==============================================================================
--- head/sys/modules/sfxge/Makefile	Sat Feb 28 18:22:10 2015	(r279397)
+++ head/sys/modules/sfxge/Makefile	Sat Feb 28 19:01:43 2015	(r279398)
@@ -5,7 +5,7 @@ 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502281901.t1SJ1h3f028778>