The branch main has been updated by kbowling (ports committer):

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

commit bb250fae9e9e278b681cf3a71ced718700ecf74c
Author:     Franco Fichtner <[email protected]>
AuthorDate: 2021-08-18 17:05:29 +0000
Commit:     Kevin Bowling <[email protected]>
CommitDate: 2021-08-18 17:05:29 +0000

    gre: simplify RSS ifdefs
    
    Use the early break to avoid else definitions. When RSS gains a
    runtime option previous constructs would duplicate and convolute
    the existing code.
    
    While here init flowid and skip magic numbers and late default
    assignment.
    
    Reviewed by:    melifaro, kbowling
    Obtained from:  OPNsense
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D31584
---
 sys/net/if_gre.c | 35 +++++++++++++----------------------
 1 file changed, 13 insertions(+), 22 deletions(-)

diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index aa3e4062b060..19014f9fd3de 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -643,46 +643,37 @@ gre_setseqn(struct grehdr *gh, uint32_t seq)
 static uint32_t
 gre_flowid(struct gre_softc *sc, struct mbuf *m, uint32_t af)
 {
-       uint32_t flowid;
+       uint32_t flowid = 0;
 
        if ((sc->gre_options & GRE_UDPENCAP) == 0 || sc->gre_port != 0)
-               return (0);
-#ifndef RSS
-       switch (af) {
-#ifdef INET
-       case AF_INET:
-               flowid = mtod(m, struct ip *)->ip_src.s_addr ^
-                   mtod(m, struct ip *)->ip_dst.s_addr;
-               break;
-#endif
-#ifdef INET6
-       case AF_INET6:
-               flowid = mtod(m, struct ip6_hdr *)->ip6_src.s6_addr32[3] ^
-                   mtod(m, struct ip6_hdr *)->ip6_dst.s6_addr32[3];
-               break;
-#endif
-       default:
-               flowid = 0;
-       }
-#else /* RSS */
+               return (flowid);
        switch (af) {
 #ifdef INET
        case AF_INET:
+#ifdef RSS
                flowid = rss_hash_ip4_2tuple(mtod(m, struct ip *)->ip_src,
                    mtod(m, struct ip *)->ip_dst);
                break;
+#endif
+               flowid = mtod(m, struct ip *)->ip_src.s_addr ^
+                   mtod(m, struct ip *)->ip_dst.s_addr;
+               break;
 #endif
 #ifdef INET6
        case AF_INET6:
+#ifdef RSS
                flowid = rss_hash_ip6_2tuple(
                    &mtod(m, struct ip6_hdr *)->ip6_src,
                    &mtod(m, struct ip6_hdr *)->ip6_dst);
                break;
+#endif
+               flowid = mtod(m, struct ip6_hdr *)->ip6_src.s6_addr32[3] ^
+                   mtod(m, struct ip6_hdr *)->ip6_dst.s6_addr32[3];
+               break;
 #endif
        default:
-               flowid = 0;
+               break;
        }
-#endif
        return (flowid);
 }
 
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "[email protected]"

Reply via email to