Author: jhb
Date: Thu Nov 29 23:14:54 2018
New Revision: 341270
URL: https://svnweb.freebsd.org/changeset/base/341270

Log:
  Make most of the CLIP code conditional on #ifdef INET6.
  
  This fixes builds of kernels without INET6 such as LINT-NOINET6.
  
  Reported by:  arybchik
  Reviewed by:  np
  Sponsored by: Chelsio Communications
  Differential Revision:        https://reviews.freebsd.org/D18384

Modified:
  head/sys/dev/cxgbe/t4_clip.c
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/t4_clip.c
==============================================================================
--- head/sys/dev/cxgbe/t4_clip.c        Thu Nov 29 22:36:36 2018        
(r341269)
+++ head/sys/dev/cxgbe/t4_clip.c        Thu Nov 29 23:14:54 2018        
(r341270)
@@ -30,6 +30,9 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#include "opt_inet.h"
+#include "opt_inet6.h"
+
 #include <sys/types.h>
 #include <sys/ck.h>
 #include <sys/eventhandler.h>
@@ -47,6 +50,7 @@ __FBSDID("$FreeBSD$");
 #include "common/common.h"
 #include "t4_clip.h"
 
+#if defined(INET6)
 static int add_lip(struct adapter *, struct in6_addr *);
 static int delete_lip(struct adapter *, struct in6_addr *);
 static struct clip_entry *search_lip(struct adapter *, struct in6_addr *);
@@ -108,11 +112,13 @@ search_lip(struct adapter *sc, struct in6_addr *lip)
 
        return (NULL);
 }
+#endif
 
 struct clip_entry *
 t4_hold_lip(struct adapter *sc, struct in6_addr *lip, struct clip_entry *ce)
 {
 
+#ifdef INET6
        mtx_lock(&sc->clip_table_lock);
        if (ce == NULL)
                ce = search_lip(sc, lip);
@@ -121,12 +127,16 @@ t4_hold_lip(struct adapter *sc, struct in6_addr *lip, 
        mtx_unlock(&sc->clip_table_lock);
 
        return (ce);
+#else
+       return (NULL);
+#endif
 }
 
 void
 t4_release_lip(struct adapter *sc, struct clip_entry *ce)
 {
 
+#ifdef INET6
        mtx_lock(&sc->clip_table_lock);
        KASSERT(search_lip(sc, &ce->lip) == ce,
            ("%s: CLIP entry %p p not in CLIP table.", __func__, ce));
@@ -134,8 +144,10 @@ t4_release_lip(struct adapter *sc, struct clip_entry *
            ("%s: CLIP entry %p has refcount 0", __func__, ce));
        --ce->refcount;
        mtx_unlock(&sc->clip_table_lock);
+#endif
 }
 
+#ifdef INET6
 void
 t4_init_clip_table(struct adapter *sc)
 {
@@ -380,3 +392,4 @@ t4_clip_modunload(void)
        EVENTHANDLER_DEREGISTER(ifaddr_event, ifaddr_evhandler);
        taskqueue_cancel_timeout(taskqueue_thread, &clip_task, NULL);
 }
+#endif

Modified: head/sys/dev/cxgbe/t4_main.c
==============================================================================
--- head/sys/dev/cxgbe/t4_main.c        Thu Nov 29 22:36:36 2018        
(r341269)
+++ head/sys/dev/cxgbe/t4_main.c        Thu Nov 29 23:14:54 2018        
(r341270)
@@ -1222,7 +1222,9 @@ t4_attach(device_t dev)
 #ifdef RATELIMIT
        t4_init_etid_table(sc);
 #endif
+#ifdef INET6
        t4_init_clip_table(sc);
+#endif
        if (sc->vres.key.size != 0)
                sc->key_map = vmem_create("T4TLS key map", sc->vres.key.start,
                    sc->vres.key.size, 32, 0, M_FIRSTFIT | M_WAITOK);
@@ -1513,7 +1515,9 @@ t4_detach_common(device_t dev)
 #endif
        if (sc->key_map)
                vmem_destroy(sc->key_map);
+#ifdef INET6
        t4_destroy_clip_table(sc);
+#endif
 
 #if defined(TCP_OFFLOAD) || defined(RATELIMIT)
        free(sc->sge.ofld_txq, M_CXGBE);
@@ -5967,9 +5971,11 @@ t4_sysctls(struct adapter *sc)
            CTLTYPE_STRING | CTLFLAG_RD, sc, 0,
            sysctl_smt, "A", "hardware source MAC table");
 
+#ifdef INET6
        SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "clip",
            CTLTYPE_STRING | CTLFLAG_RD, sc, 0,
            sysctl_clip, "A", "active CLIP table entries");
+#endif
 
        SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "lb_stats",
            CTLTYPE_STRING | CTLFLAG_RD, sc, 0,
@@ -10527,7 +10533,9 @@ mod_event(module_t mod, int cmd, void *arg)
                        sx_init(&t4_uld_list_lock, "T4/T5 ULDs");
                        SLIST_INIT(&t4_uld_list);
 #endif
+#ifdef INET6
                        t4_clip_modload();
+#endif
                        t4_tracer_modload();
                        tweak_tunables();
                }
@@ -10567,7 +10575,9 @@ mod_event(module_t mod, int cmd, void *arg)
 
                        if (t4_sge_extfree_refs() == 0) {
                                t4_tracer_modunload();
+#ifdef INET6
                                t4_clip_modunload();
+#endif
 #ifdef TCP_OFFLOAD
                                sx_destroy(&t4_uld_list_lock);
 #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