git: ca7af63e88f8 - stable/12 - if_epair: fix build with RSS and INET or INET6 disabled

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Thu, 10 Mar 2022 13:32:51 UTC
The branch stable/12 has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=ca7af63e88f8cc96865d45e020a57b3062631388

commit ca7af63e88f8cc96865d45e020a57b3062631388
Author:     Santiago Martinez <sm@codenetworks.net>
AuthorDate: 2022-03-03 09:44:43 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2022-03-10 08:51:54 +0000

    if_epair: fix build with RSS and INET or INET6 disabled
    
    Reviewed by:    kp
    MFC after:      1 week
    
    (cherry picked from commit 52bcdc5b809ea56cbdce0bd36499e4ae74780d2b)
---
 sys/modules/if_epair/Makefile |  2 +-
 sys/net/if_epair.c            | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/sys/modules/if_epair/Makefile b/sys/modules/if_epair/Makefile
index 3e102413bfe2..8b063623f2e8 100644
--- a/sys/modules/if_epair/Makefile
+++ b/sys/modules/if_epair/Makefile
@@ -3,6 +3,6 @@
 .PATH: ${SRCTOP}/sys/net
 
 KMOD=	if_epair
-SRCS=	bus_if.h device_if.h if_epair.c
+SRCS=	bus_if.h device_if.h if_epair.c opt_rss.h opt_inet.h opt_inet6.h
 
 .include <bsd.kmod.mk>
diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c
index 87d8fd969db8..b95418e29071 100644
--- a/sys/net/if_epair.c
+++ b/sys/net/if_epair.c
@@ -42,6 +42,8 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_rss.h"
+#include "opt_inet.h"
+#include "opt_inet6.h"
 
 #include <sys/param.h>
 #include <sys/hash.h>
@@ -74,9 +76,13 @@ __FBSDID("$FreeBSD$");
 #include <net/netisr.h>
 #ifdef RSS
 #include <net/rss_config.h>
+#ifdef INET
 #include <netinet/in_rss.h>
+#endif
+#ifdef INET6
 #include <netinet6/in6_rss.h>
 #endif
+#endif
 #include <net/vnet.h>
 
 static int epair_clone_match(struct if_clone *, const char *);
@@ -213,12 +219,16 @@ epair_menq(struct mbuf *m, struct epair_softc *osc)
 		eh = mtod(m, struct ether_header *);
 
 		switch (ntohs(eh->ether_type)) {
+#ifdef INET
 		case ETHERTYPE_IP:
 			rss_soft_m2cpuid_v4(m, 0, &bucket);
 			break;
+#endif
+#ifdef INET6
 		case ETHERTYPE_IPV6:
 			rss_soft_m2cpuid_v6(m, 0, &bucket);
 			break;
+#endif
 		default:
 			bucket = 0;
 			break;