Author: glebius
Date: Thu Nov  7 20:40:44 2019
New Revision: 354474
URL: https://svnweb.freebsd.org/changeset/base/354474

Log:
  Remove unnecessary recursive epoch enter via INP_INFO_RLOCK
  macro in raw input functions for IPv4 and IPv6.  They shall
  always run in the network epoch.

Modified:
  head/sys/netinet/raw_ip.c
  head/sys/netinet6/raw_ip6.c

Modified: head/sys/netinet/raw_ip.c
==============================================================================
--- head/sys/netinet/raw_ip.c   Thu Nov  7 20:38:53 2019        (r354473)
+++ head/sys/netinet/raw_ip.c   Thu Nov  7 20:40:44 2019        (r354474)
@@ -284,9 +284,10 @@ rip_input(struct mbuf **mp, int *offp, int proto)
        struct ip *ip = mtod(m, struct ip *);
        struct inpcb *inp, *last;
        struct sockaddr_in ripsrc;
-       struct epoch_tracker et;
        int hash;
 
+       NET_EPOCH_ASSERT();
+
        *mp = NULL;
 
        bzero(&ripsrc, sizeof(ripsrc));
@@ -299,7 +300,6 @@ rip_input(struct mbuf **mp, int *offp, int proto)
 
        hash = INP_PCBHASH_RAW(proto, ip->ip_src.s_addr,
            ip->ip_dst.s_addr, V_ripcbinfo.ipi_hashmask);
-       INP_INFO_RLOCK_ET(&V_ripcbinfo, et);
        CK_LIST_FOREACH(inp, &V_ripcbinfo.ipi_hashbase[hash], inp_hash) {
                if (inp->inp_ip_p != proto)
                        continue;
@@ -422,7 +422,6 @@ rip_input(struct mbuf **mp, int *offp, int proto)
        skip_2:
                INP_RUNLOCK(inp);
        }
-       INP_INFO_RUNLOCK_ET(&V_ripcbinfo, et);
        if (last != NULL) {
                if (rip_append(last, ip, m, &ripsrc) != 0)
                        IPSTAT_INC(ips_delivered);

Modified: head/sys/netinet6/raw_ip6.c
==============================================================================
--- head/sys/netinet6/raw_ip6.c Thu Nov  7 20:38:53 2019        (r354473)
+++ head/sys/netinet6/raw_ip6.c Thu Nov  7 20:40:44 2019        (r354474)
@@ -165,15 +165,15 @@ rip6_input(struct mbuf **mp, int *offp, int proto)
        struct inpcb *last = NULL;
        struct mbuf *opts = NULL;
        struct sockaddr_in6 fromsa;
-       struct epoch_tracker et;
 
+       NET_EPOCH_ASSERT();
+
        RIP6STAT_INC(rip6s_ipackets);
 
        init_sin6(&fromsa, m, 0); /* general init */
 
        ifp = m->m_pkthdr.rcvif;
 
-       INP_INFO_RLOCK_ET(&V_ripcbinfo, et);
        CK_LIST_FOREACH(inp, &V_ripcb, inp_list) {
                /* XXX inp locking */
                if ((inp->inp_vflag & INP_IPV6) == 0)
@@ -303,7 +303,6 @@ rip6_input(struct mbuf **mp, int *offp, int proto)
 skip_2:
                INP_RUNLOCK(inp);
        }
-       INP_INFO_RUNLOCK_ET(&V_ripcbinfo, et);
 #if defined(IPSEC) || defined(IPSEC_SUPPORT)
        /*
         * Check AH/ESP integrity.
_______________________________________________
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