git: d3e338662f25 - stable/13 - netinet: simplify RSS ifdef statements

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Thu, 03 Mar 2022 16:08:03 UTC
The branch stable/13 has been updated by kbowling (ports committer):

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

commit d3e338662f25ced875116959cc9e48dd7b66b6f2
Author:     Franco Fichtner <franco@opnsense.org>
AuthorDate: 2022-02-08 02:22:03 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2022-03-03 15:56:22 +0000

    netinet: simplify RSS ifdef statements
    
    Approved by:    transport (rrs)
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D31583
    
    (cherry picked from commit 47ded797ce9620f055f005e9dccfcd03613b1804)
---
 sys/netinet/tcp_hpts.c  |  5 ++---
 sys/netinet/tcp_timer.c | 12 +++---------
 2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/sys/netinet/tcp_hpts.c b/sys/netinet/tcp_hpts.c
index 9ec092f703ec..d18c9db358d2 100644
--- a/sys/netinet/tcp_hpts.c
+++ b/sys/netinet/tcp_hpts.c
@@ -1165,7 +1165,7 @@ static uint16_t
 hpts_cpuid(struct inpcb *inp, int *failed)
 {
 	u_int cpuid;
-#if !defined(RSS) && defined(NUMA)
+#ifdef NUMA
 	struct hpts_domain_info *di;
 #endif
 
@@ -1197,7 +1197,7 @@ hpts_cpuid(struct inpcb *inp, int *failed)
 		return (hpts_random_cpu(inp));
 	else
 		return (cpuid);
-#else
+#endif
 	/*
 	 * We don't have a flowid -> cpuid mapping, so cheat and just map
 	 * unknown cpuids to curcpu.  Not the best, but apparently better
@@ -1220,7 +1220,6 @@ hpts_cpuid(struct inpcb *inp, int *failed)
 		cpuid = inp->inp_flowid % mp_ncpus;
 	counter_u64_add(cpu_uses_flowid, 1);
 	return (cpuid);
-#endif
 }
 
 static void
diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c
index 139e32172531..96b95ab1c15f 100644
--- a/sys/netinet/tcp_timer.c
+++ b/sys/netinet/tcp_timer.c
@@ -210,17 +210,14 @@ inp_to_cpuid(struct inpcb *inp)
 {
 	u_int cpuid;
 
-#ifdef	RSS
 	if (per_cpu_timers) {
+#ifdef	RSS
 		cpuid = rss_hash2cpuid(inp->inp_flowid, inp->inp_flowtype);
 		if (cpuid == NETISR_CPUID_NONE)
 			return (curcpu);	/* XXX */
 		else
 			return (cpuid);
-	}
-#else
-	/* Legacy, pre-RSS behaviour */
-	if (per_cpu_timers) {
+#endif
 		/*
 		 * We don't have a flowid -> cpuid mapping, so cheat and
 		 * just map unknown cpuids to curcpu.  Not the best, but
@@ -230,10 +227,7 @@ inp_to_cpuid(struct inpcb *inp)
 		if (! CPU_ABSENT(cpuid))
 			return (cpuid);
 		return (curcpu);
-	}
-#endif
-	/* Default for RSS and non-RSS - cpuid 0 */
-	else {
+	} else {
 		return (0);
 	}
 }