summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2014-03-21 15:15:30 +0000
committerglebius <glebius@FreeBSD.org>2014-03-21 15:15:30 +0000
commit03fdc2934eb61c44c049a02b02aa974cfdd8a0eb (patch)
treecc0fec78da85e9575659f55226fa9d0d7e1fb82c /sys/netinet
parenta528b1ed30bfe465bfdd83f8e18449b8bf399429 (diff)
downloadFreeBSD-src-03fdc2934eb61c44c049a02b02aa974cfdd8a0eb.zip
FreeBSD-src-03fdc2934eb61c44c049a02b02aa974cfdd8a0eb.tar.gz
Merge r262763, r262767, r262771, r262806 from head:
- Remove rt_metrics_lite and simply put its members into rtentry. - Use counter(9) for rt_pksent (former rt_rmx.rmx_pksent). This removes another cache trashing ++ from packet forwarding path. - Create zini/fini methods for the rtentry UMA zone. Via initialize mutex and counter in them. - Fix reporting of rmx_pksent to routing socket. - Fix netstat(1) to report "Use" both in kvm(3) and sysctl(3) mode.
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/in_rmx.c20
-rw-r--r--sys/netinet/ip_fastfwd.c9
-rw-r--r--sys/netinet/ip_input.c2
-rw-r--r--sys/netinet/ip_ipsec.c4
-rw-r--r--sys/netinet/ip_output.c8
-rw-r--r--sys/netinet/sctp_os_bsd.h4
-rw-r--r--sys/netinet/tcp_output.c4
-rw-r--r--sys/netinet/tcp_subr.c8
8 files changed, 26 insertions, 33 deletions
diff --git a/sys/netinet/in_rmx.c b/sys/netinet/in_rmx.c
index d09805d..9b89fbd 100644
--- a/sys/netinet/in_rmx.c
+++ b/sys/netinet/in_rmx.c
@@ -93,8 +93,8 @@ in_addroute(void *v_arg, void *n_arg, struct radix_node_head *head,
if (IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
rt->rt_flags |= RTF_MULTICAST;
- if (!rt->rt_rmx.rmx_mtu && rt->rt_ifp)
- rt->rt_rmx.rmx_mtu = rt->rt_ifp->if_mtu;
+ if (rt->rt_mtu == 0 && rt->rt_ifp != NULL)
+ rt->rt_mtu = rt->rt_ifp->if_mtu;
return (rn_addroute(v_arg, n_arg, head, treenodes));
}
@@ -114,7 +114,7 @@ in_matroute(void *v_arg, struct radix_node_head *head)
RT_LOCK(rt);
if (rt->rt_flags & RTPRF_OURS) {
rt->rt_flags &= ~RTPRF_OURS;
- rt->rt_rmx.rmx_expire = 0;
+ rt->rt_expire = 0;
}
RT_UNLOCK(rt);
}
@@ -167,7 +167,7 @@ in_clsroute(struct radix_node *rn, struct radix_node_head *head)
*/
if (V_rtq_reallyold != 0) {
rt->rt_flags |= RTPRF_OURS;
- rt->rt_rmx.rmx_expire = time_uptime + V_rtq_reallyold;
+ rt->rt_expire = time_uptime + V_rtq_reallyold;
} else {
rtexpunge(rt);
}
@@ -199,7 +199,7 @@ in_rtqkill(struct radix_node *rn, void *rock)
if (rt->rt_flags & RTPRF_OURS) {
ap->found++;
- if (ap->draining || rt->rt_rmx.rmx_expire <= time_uptime) {
+ if (ap->draining || rt->rt_expire <= time_uptime) {
if (rt->rt_refcnt > 0)
panic("rtqkill route really not free");
@@ -215,13 +215,9 @@ in_rtqkill(struct radix_node *rn, void *rock)
}
} else {
if (ap->updating &&
- (rt->rt_rmx.rmx_expire - time_uptime >
- V_rtq_reallyold)) {
- rt->rt_rmx.rmx_expire =
- time_uptime + V_rtq_reallyold;
- }
- ap->nextstop = lmin(ap->nextstop,
- rt->rt_rmx.rmx_expire);
+ (rt->rt_expire - time_uptime > V_rtq_reallyold))
+ rt->rt_expire = time_uptime + V_rtq_reallyold;
+ ap->nextstop = lmin(ap->nextstop, rt->rt_expire);
}
}
diff --git a/sys/netinet/ip_fastfwd.c b/sys/netinet/ip_fastfwd.c
index 7d81475..c5405d5 100644
--- a/sys/netinet/ip_fastfwd.c
+++ b/sys/netinet/ip_fastfwd.c
@@ -491,8 +491,7 @@ passout:
* Check if route is dampned (when ARP is unable to resolve)
*/
if ((ro.ro_rt->rt_flags & RTF_REJECT) &&
- (ro.ro_rt->rt_rmx.rmx_expire == 0 ||
- time_uptime < ro.ro_rt->rt_rmx.rmx_expire)) {
+ (ro.ro_rt->rt_expire == 0 || time_uptime < ro.ro_rt->rt_expire)) {
icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, 0);
goto consumed;
}
@@ -520,8 +519,8 @@ passout:
/*
* Check if packet fits MTU or if hardware will fragment for us
*/
- if (ro.ro_rt->rt_rmx.rmx_mtu)
- mtu = min(ro.ro_rt->rt_rmx.rmx_mtu, ifp->if_mtu);
+ if (ro.ro_rt->rt_mtu)
+ mtu = min(ro.ro_rt->rt_mtu, ifp->if_mtu);
else
mtu = ifp->if_mtu;
@@ -586,7 +585,7 @@ passout:
if (error != 0)
IPSTAT_INC(ips_odropped);
else {
- ro.ro_rt->rt_rmx.rmx_pksent++;
+ counter_u64_add(ro.ro_rt->rt_pksent, 1);
IPSTAT_INC(ips_forward);
IPSTAT_INC(ips_fastforward);
}
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 49281d5..26b9dfa 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1471,7 +1471,7 @@ ip_forward(struct mbuf *m, int srcrt)
error = ip_output(m, NULL, &ro, IP_FORWARDING, NULL, NULL);
if (error == EMSGSIZE && ro.ro_rt)
- mtu = ro.ro_rt->rt_rmx.rmx_mtu;
+ mtu = ro.ro_rt->rt_mtu;
RO_RTFREE(&ro);
if (error)
diff --git a/sys/netinet/ip_ipsec.c b/sys/netinet/ip_ipsec.c
index 526a6de..28b899d 100644
--- a/sys/netinet/ip_ipsec.c
+++ b/sys/netinet/ip_ipsec.c
@@ -236,9 +236,7 @@ ip_ipsec_mtu(struct mbuf *m, int mtu)
sp->req->sav->sah != NULL) {
ro = &sp->req->sav->sah->route_cache.sa_route;
if (ro->ro_rt && ro->ro_rt->rt_ifp) {
- mtu =
- ro->ro_rt->rt_rmx.rmx_mtu ?
- ro->ro_rt->rt_rmx.rmx_mtu :
+ mtu = ro->ro_rt->rt_mtu ? ro->ro_rt->rt_mtu :
ro->ro_rt->rt_ifp->if_mtu;
mtu -= ipsechdr;
}
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index bee37a7..69832d4 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -296,7 +296,7 @@ again:
}
ia = ifatoia(rte->rt_ifa);
ifp = rte->rt_ifp;
- rte->rt_rmx.rmx_pksent++;
+ counter_u64_add(rte->rt_pksent, 1);
if (rte->rt_flags & RTF_GATEWAY)
gw = (struct sockaddr_in *)rte->rt_gateway;
if (rte->rt_flags & RTF_HOST)
@@ -316,9 +316,9 @@ again:
* them, there is no way for one to update all its
* routes when the MTU is changed.
*/
- if (rte->rt_rmx.rmx_mtu > ifp->if_mtu)
- rte->rt_rmx.rmx_mtu = ifp->if_mtu;
- mtu = rte->rt_rmx.rmx_mtu;
+ if (rte->rt_mtu > ifp->if_mtu)
+ rte->rt_mtu = ifp->if_mtu;
+ mtu = rte->rt_mtu;
} else {
mtu = ifp->if_mtu;
}
diff --git a/sys/netinet/sctp_os_bsd.h b/sys/netinet/sctp_os_bsd.h
index 2159bbc..855b411 100644
--- a/sys/netinet/sctp_os_bsd.h
+++ b/sys/netinet/sctp_os_bsd.h
@@ -328,11 +328,11 @@ typedef struct callout sctp_os_timer_t;
/* MTU */
/*************************/
#define SCTP_GATHER_MTU_FROM_IFN_INFO(ifn, ifn_index, af) ((struct ifnet *)ifn)->if_mtu
-#define SCTP_GATHER_MTU_FROM_ROUTE(sctp_ifa, sa, rt) ((rt != NULL) ? rt->rt_rmx.rmx_mtu : 0)
+#define SCTP_GATHER_MTU_FROM_ROUTE(sctp_ifa, sa, rt) ((rt != NULL) ? rt->rt_mtu : 0)
#define SCTP_GATHER_MTU_FROM_INTFC(sctp_ifn) ((sctp_ifn->ifn_p != NULL) ? ((struct ifnet *)(sctp_ifn->ifn_p))->if_mtu : 0)
#define SCTP_SET_MTU_OF_ROUTE(sa, rt, mtu) do { \
if (rt != NULL) \
- rt->rt_rmx.rmx_mtu = mtu; \
+ rt->rt_mtu = mtu; \
} while(0)
/* (de-)register interface event notifications */
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index f80a20e..8c97c12 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -1195,7 +1195,7 @@ send:
NULL, NULL, tp->t_inpcb);
if (error == EMSGSIZE && ro.ro_rt != NULL)
- mtu = ro.ro_rt->rt_rmx.rmx_mtu;
+ mtu = ro.ro_rt->rt_mtu;
RO_RTFREE(&ro);
}
#endif /* INET6 */
@@ -1233,7 +1233,7 @@ send:
tp->t_inpcb);
if (error == EMSGSIZE && ro.ro_rt != NULL)
- mtu = ro.ro_rt->rt_rmx.rmx_mtu;
+ mtu = ro.ro_rt->rt_mtu;
RO_RTFREE(&ro);
}
#endif /* INET */
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 2400c80..4a9cece 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -1797,10 +1797,10 @@ tcp_maxmtu(struct in_conninfo *inc, struct tcp_ifcap *cap)
}
if (sro.ro_rt != NULL) {
ifp = sro.ro_rt->rt_ifp;
- if (sro.ro_rt->rt_rmx.rmx_mtu == 0)
+ if (sro.ro_rt->rt_mtu == 0)
maxmtu = ifp->if_mtu;
else
- maxmtu = min(sro.ro_rt->rt_rmx.rmx_mtu, ifp->if_mtu);
+ maxmtu = min(sro.ro_rt->rt_mtu, ifp->if_mtu);
/* Report additional interface capabilities. */
if (cap != NULL) {
@@ -1834,10 +1834,10 @@ tcp_maxmtu6(struct in_conninfo *inc, struct tcp_ifcap *cap)
}
if (sro6.ro_rt != NULL) {
ifp = sro6.ro_rt->rt_ifp;
- if (sro6.ro_rt->rt_rmx.rmx_mtu == 0)
+ if (sro6.ro_rt->rt_mtu == 0)
maxmtu = IN6_LINKMTU(sro6.ro_rt->rt_ifp);
else
- maxmtu = min(sro6.ro_rt->rt_rmx.rmx_mtu,
+ maxmtu = min(sro6.ro_rt->rt_mtu,
IN6_LINKMTU(sro6.ro_rt->rt_ifp));
/* Report additional interface capabilities. */
OpenPOWER on IntegriCloud