Author: bz
Date: Wed May 18 14:18:03 2016
New Revision: 300147
URL: https://svnweb.freebsd.org/changeset/base/300147

Log:
  Make compile without INET or without IP support in the kernel by hiding
  variables and lro function calls behind approriate #ifdefs.
  
  Also move the #includes for "opt_*" to the place where they should be.

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==============================================================================
--- head/sys/net/iflib.c        Wed May 18 14:09:56 2016        (r300146)
+++ head/sys/net/iflib.c        Wed May 18 14:18:03 2016        (r300147)
@@ -28,6 +28,10 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#include "opt_inet.h"
+#include "opt_inet6.h"
+#include "opt_acpi.h"
+
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/bus.h>
@@ -77,11 +81,6 @@ __FBSDID("$FreeBSD$");
 
 #include <net/iflib.h>
 
-
-#include "opt_inet.h"
-#include "opt_inet6.h"
-#include "opt_acpi.h"
-
 #include "ifdi_if.h"
 
 #if defined(__i386__) || defined(__amd64__)
@@ -2158,8 +2157,10 @@ iflib_rxeof(iflib_rxq_t rxq, int budget)
                m->m_nextpkt = NULL;
                rx_bytes += m->m_pkthdr.len;
                rx_pkts++;
+#if defined(INET6) || defined(INET)
                if (lro_enabled && tcp_lro_rx(&rxq->ifr_lc, m, 0) == 0)
                        continue;
+#endif
                DBG_COUNTER_INC(rx_if_input);
                ifp->if_input(ifp, m);
        }
@@ -2171,7 +2172,9 @@ iflib_rxeof(iflib_rxq_t rxq, int budget)
         */
        while ((queued = LIST_FIRST(&rxq->ifr_lc.lro_active)) != NULL) {
                LIST_REMOVE(queued, next);
+#if defined(INET6) || defined(INET)
                tcp_lro_flush(&rxq->ifr_lc, queued);
+#endif
        }
        return (iflib_rxd_avail(ctx, rxq, *cidxp));
 }
@@ -2232,7 +2235,7 @@ static int
 iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, struct mbuf **mp)
 {
        struct ether_vlan_header *eh;
-       struct mbuf *m, *n;
+       struct mbuf *m;
 
        m = *mp;
        /*
@@ -2260,6 +2263,7 @@ iflib_parse_header(iflib_txq_t txq, if_p
        {
                struct ip *ip = NULL;
                struct tcphdr *th = NULL;
+               struct mbuf *n;
                int minthlen;
 
                minthlen = min(m->m_pkthdr.len, pi->ipi_ehdrlen + sizeof(*ip) + 
sizeof(*th));
@@ -4085,9 +4089,13 @@ static int
 iflib_rx_structures_setup(if_ctx_t ctx)
 {
        iflib_rxq_t rxq = ctx->ifc_rxqs;
-       int i,  q, err;
+       int q;
+#if defined(INET6) || defined(INET)
+       int i, err;
+#endif
 
        for (q = 0; q < ctx->ifc_softc_ctx.isc_nrxqsets; q++, rxq++) {
+#if defined(INET6) || defined(INET)
                tcp_lro_free(&rxq->ifr_lc);
                if ((err = tcp_lro_init(&rxq->ifr_lc)) != 0) {
                        device_printf(ctx->ifc_dev, "LRO Initialization 
failed!\n");
@@ -4095,9 +4103,11 @@ iflib_rx_structures_setup(if_ctx_t ctx)
                }
                rxq->ifr_lro_enabled = TRUE;
                rxq->ifr_lc.ifp = ctx->ifc_ifp;
+#endif
                IFDI_RXQ_SETUP(ctx, rxq->ifr_id);
        }
        return (0);
+#if defined(INET6) || defined(INET)
 fail:
        /*
         * Free RX software descriptors allocated so far, we will only handle
@@ -4110,6 +4120,7 @@ fail:
                rxq->ifr_cq_gen = rxq->ifr_cq_cidx = rxq->ifr_cq_pidx = 0;
        }
        return (err);
+#endif
 }
 
 /*********************************************************************
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to