Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet6 inet6: pass rcvif to ip6_forward to avoid extra...



details:   https://anonhg.NetBSD.org/src/rev/279470dd6c15
branches:  trunk
changeset: 937855:279470dd6c15
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Fri Aug 28 06:28:58 2020 +0000

description:
inet6: pass rcvif to ip6_forward to avoid extra psref_acquire

diffstat:

 sys/netinet6/ip6_forward.c |  14 +++-----------
 sys/netinet6/ip6_input.c   |   6 +++---
 sys/netinet6/ip6_var.h     |   4 ++--
 3 files changed, 8 insertions(+), 16 deletions(-)

diffs (100 lines):

diff -r 8daabe30f13c -r 279470dd6c15 sys/netinet6/ip6_forward.c
--- a/sys/netinet6/ip6_forward.c        Fri Aug 28 06:27:49 2020 +0000
+++ b/sys/netinet6/ip6_forward.c        Fri Aug 28 06:28:58 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip6_forward.c,v 1.100 2020/08/28 06:19:13 ozaki-r Exp $        */
+/*     $NetBSD: ip6_forward.c,v 1.101 2020/08/28 06:28:58 ozaki-r Exp $        */
 /*     $KAME: ip6_forward.c,v 1.109 2002/09/11 08:10:17 sakane Exp $   */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_forward.c,v 1.100 2020/08/28 06:19:13 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_forward.c,v 1.101 2020/08/28 06:28:58 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_gateway.h"
@@ -116,7 +116,7 @@
  * protocol deal with that.
  */
 void
-ip6_forward(struct mbuf *m, int srcrt)
+ip6_forward(struct mbuf *m, int srcrt, struct ifnet *rcvif)
 {
        struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
        const struct sockaddr_in6 *dst;
@@ -126,8 +126,6 @@
        struct ifnet *origifp;  /* maybe unnecessary */
        uint32_t inzone, outzone;
        struct in6_addr src_in6, dst_in6;
-       struct ifnet *rcvif = NULL;
-       struct psref psref;
        struct route *ro = NULL;
 #ifdef IPSEC
        int needipsec = 0;
@@ -139,10 +137,6 @@
         */
        m->m_pkthdr.csum_flags = 0;
 
-       rcvif = m_get_rcvif_psref(m, &psref);
-       if (__predict_false(rcvif == NULL))
-               goto drop;
-
        /*
         * Do not forward packets to multicast destination (should be handled
         * by ip6_mforward()). Do not forward packets with unspecified source.
@@ -469,7 +463,5 @@
        rtcache_unref(rt, ro);
        if (ro != NULL)
                rtcache_percpu_putref(ip6_forward_rt_percpu);
-       if (rcvif != NULL)
-               m_put_rcvif_psref(rcvif, &psref);
        return;
 }
diff -r 8daabe30f13c -r 279470dd6c15 sys/netinet6/ip6_input.c
--- a/sys/netinet6/ip6_input.c  Fri Aug 28 06:27:49 2020 +0000
+++ b/sys/netinet6/ip6_input.c  Fri Aug 28 06:28:58 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip6_input.c,v 1.220 2020/08/28 06:20:44 ozaki-r Exp $  */
+/*     $NetBSD: ip6_input.c,v 1.221 2020/08/28 06:28:58 ozaki-r Exp $  */
 /*     $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $     */
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.220 2020/08/28 06:20:44 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.221 2020/08/28 06:28:58 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_gateway.h"
@@ -667,7 +667,7 @@
        } else if (!ours) {
                rtcache_unref(rt, ro);
                rtcache_percpu_putref(ip6_forward_rt_percpu);
-               ip6_forward(m, srcrt);
+               ip6_forward(m, srcrt, rcvif);
                return;
        }
 
diff -r 8daabe30f13c -r 279470dd6c15 sys/netinet6/ip6_var.h
--- a/sys/netinet6/ip6_var.h    Fri Aug 28 06:27:49 2020 +0000
+++ b/sys/netinet6/ip6_var.h    Fri Aug 28 06:28:58 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip6_var.h,v 1.85 2020/08/28 06:19:13 ozaki-r Exp $     */
+/*     $NetBSD: ip6_var.h,v 1.86 2020/08/28 06:28:58 ozaki-r Exp $     */
 /*     $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $        */
 
 /*
@@ -295,7 +295,7 @@
                u_int32_t *);
 int    ip6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
 
-void   ip6_forward(struct mbuf *, int);
+void   ip6_forward(struct mbuf *, int, struct ifnet *);
 
 void   ip6_mloopback(struct ifnet *, struct mbuf *,
                      const struct sockaddr_in6 *);



Home | Main Index | Thread Index | Old Index