PERFORCE change 150155 for review
Marko Zec
zec at FreeBSD.org
Sat Sep 20 09:33:46 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=150155
Change 150155 by zec at zec_tpx32 on 2008/09/20 09:33:42
Diff redux against the vimage branch: bring in a bunch of
benign INIT_VNET_* initializers.
Affected files ...
.. //depot/projects/vimage-commit2/src/sys/compat/linux/linux_socket.c#7 edit
.. //depot/projects/vimage-commit2/src/sys/compat/svr4/svr4_sockio.c#8 edit
.. //depot/projects/vimage-commit2/src/sys/contrib/pf/net/pf.c#8 edit
.. //depot/projects/vimage-commit2/src/sys/contrib/pf/net/pf_if.c#6 edit
.. //depot/projects/vimage-commit2/src/sys/contrib/pf/net/pf_ioctl.c#8 edit
.. //depot/projects/vimage-commit2/src/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#11 edit
.. //depot/projects/vimage-commit2/src/sys/kern/kern_xxx.c#9 edit
.. //depot/projects/vimage-commit2/src/sys/net/bridgestp.c#7 edit
.. //depot/projects/vimage-commit2/src/sys/net/if.c#16 edit
.. //depot/projects/vimage-commit2/src/sys/net/if_bridge.c#9 edit
.. //depot/projects/vimage-commit2/src/sys/net/if_spppsubr.c#9 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/igmp.c#10 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/in_mcast.c#8 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/in_pcb.c#15 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/ip_divert.c#8 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/ip_input.c#13 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/tcp_input.c#15 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/tcp_offload.c#7 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/tcp_subr.c#15 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/tcp_timewait.c#8 edit
.. //depot/projects/vimage-commit2/src/sys/netinet6/in6_rmx.c#10 edit
.. //depot/projects/vimage-commit2/src/sys/netinet6/ip6_input.c#9 edit
.. //depot/projects/vimage-commit2/src/sys/netinet6/nd6.c#13 edit
Differences ...
==== //depot/projects/vimage-commit2/src/sys/compat/linux/linux_socket.c#7 (text+ko) ====
@@ -546,6 +546,9 @@
static int
linux_socket(struct thread *td, struct linux_socket_args *args)
{
+#ifdef INET6
+ INIT_VNET_INET6(curvnet);
+#endif
struct socket_args /* {
int domain;
int type;
==== //depot/projects/vimage-commit2/src/sys/compat/svr4/svr4_sockio.c#8 (text+ko) ====
@@ -88,6 +88,7 @@
switch (cmd) {
case SVR4_SIOCGIFNUM:
{
+ INIT_VNET_NET(curvnet);
struct ifnet *ifp;
struct ifaddr *ifa;
int ifnum = 0;
==== //depot/projects/vimage-commit2/src/sys/contrib/pf/net/pf.c#8 (text+ko) ====
@@ -1759,6 +1759,7 @@
u_int8_t flags, u_int16_t win, u_int16_t mss, u_int8_t ttl, int tag,
u_int16_t rtag, struct ether_header *eh, struct ifnet *ifp)
{
+ INIT_VNET_INET(curvnet);
struct mbuf *m;
int len, tlen;
#ifdef INET
@@ -2922,6 +2923,7 @@
pf_socket_lookup(int direction, struct pf_pdesc *pd)
#endif
{
+ INIT_VNET_INET(curvnet);
struct pf_addr *saddr, *daddr;
u_int16_t sport, dport;
#ifdef __FreeBSD__
@@ -3101,6 +3103,7 @@
u_int16_t
pf_get_mss(struct mbuf *m, int off, u_int16_t th_off, sa_family_t af)
{
+ INIT_VNET_INET(curvnet);
int hlen;
u_int8_t hdr[60];
u_int8_t *opt, optlen;
@@ -3140,6 +3143,7 @@
pf_calc_mss(struct pf_addr *addr, sa_family_t af, u_int16_t offer)
{
#ifdef INET
+ INIT_VNET_INET(curvnet);
struct sockaddr_in *dst;
struct route ro;
#endif /* INET */
@@ -3242,6 +3246,7 @@
struct ifqueue *ifq)
#endif
{
+ INIT_VNET_INET(curvnet);
struct pf_rule *nr = NULL;
struct pf_addr *saddr = pd->src, *daddr = pd->dst;
struct tcphdr *th = pd->hdr.tcp;
@@ -6096,6 +6101,7 @@
pf_route(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp,
struct pf_state *s, struct pf_pdesc *pd)
{
+ INIT_VNET_INET(curvnet);
struct mbuf *m0, *m1;
struct route iproute;
struct route *ro = NULL;
@@ -6633,18 +6639,30 @@
if (sum) {
switch (p) {
case IPPROTO_TCP:
+ {
+ INIT_VNET_INET(curvnet);
V_tcpstat.tcps_rcvbadsum++;
break;
+ }
case IPPROTO_UDP:
+ {
+ INIT_VNET_INET(curvnet);
V_udpstat.udps_badsum++;
break;
+ }
case IPPROTO_ICMP:
+ {
+ INIT_VNET_INET(curvnet);
V_icmpstat.icps_checksum++;
break;
+ }
#ifdef INET6
case IPPROTO_ICMPV6:
+ {
+ INIT_VNET_INET6(curvnet);
V_icmp6stat.icp6s_checksum++;
break;
+ }
#endif /* INET6 */
}
return (1);
==== //depot/projects/vimage-commit2/src/sys/contrib/pf/net/pf_if.c#6 (text+ko) ====
@@ -122,6 +122,8 @@
void
pfi_initialize(void)
{
+ INIT_VNET_NET(curvnet);
+
if (pfi_all != NULL) /* already initialized */
return;
==== //depot/projects/vimage-commit2/src/sys/contrib/pf/net/pf_ioctl.c#8 (text+ko) ====
@@ -3704,6 +3704,8 @@
pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir,
struct inpcb *inp)
{
+ INIT_VNET_NET(curvnet);
+
/*
* IPv6 is not affected by ip_len/ip_off byte order changes.
*/
==== //depot/projects/vimage-commit2/src/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#11 (text+ko) ====
@@ -266,6 +266,7 @@
static inline void
make_tx_data_wr(struct socket *so, struct mbuf *m, int len, struct mbuf *tail)
{
+ INIT_VNET_INET(so->so_vnet);
struct tcpcb *tp = so_sototcpcb(so);
struct toepcb *toep = tp->t_toe;
struct tx_data_wr *req;
@@ -1210,6 +1211,7 @@
static __inline int
select_rcv_wscale(int space)
{
+ INIT_VNET_INET(so->so_vnet);
int wscale = 0;
if (space > MAX_RCV_WND)
@@ -1227,6 +1229,7 @@
static unsigned long
select_rcv_wnd(struct toedev *dev, struct socket *so)
{
+ INIT_VNET_INET(so->so_vnet);
struct tom_data *d = TOM_DATA(dev);
unsigned int wnd;
unsigned int max_rcv_wnd;
@@ -3773,6 +3776,7 @@
static void
socket_act_establish(struct socket *so, struct mbuf *m)
{
+ INIT_VNET_INET(so->so_vnet);
struct cpl_act_establish *req = cplhdr(m);
u32 rcv_isn = ntohl(req->rcv_isn); /* real RCV_ISN + 1 */
struct tcpcb *tp = so_sototcpcb(so);
==== //depot/projects/vimage-commit2/src/sys/kern/kern_xxx.c#9 (text+ko) ====
@@ -286,7 +286,7 @@
if (error == 0) {
tmpdomainname[domainnamelen] = 0;
mtx_lock(&hostname_mtx);
- bcopy(tmpdomainname, V_domainname, sizeof(domainname));
+ bcopy(tmpdomainname, V_domainname, sizeof(V_domainname));
mtx_unlock(&hostname_mtx);
}
return (error);
==== //depot/projects/vimage-commit2/src/sys/net/bridgestp.c#7 (text+ko) ====
@@ -2017,6 +2017,7 @@
void
bstp_reinit(struct bstp_state *bs)
{
+ INIT_VNET_NET(curvnet);
struct bstp_port *bp;
struct ifnet *ifp, *mif;
u_char *e_addr;
==== //depot/projects/vimage-commit2/src/sys/net/if.c#16 (text+ko) ====
@@ -168,6 +168,7 @@
struct ifnet *
ifnet_byindex(u_short idx)
{
+ INIT_VNET_NET(curvnet);
struct ifnet *ifp;
IFNET_RLOCK();
@@ -179,6 +180,7 @@
static void
ifnet_setbyindex(u_short idx, struct ifnet *ifp)
{
+ INIT_VNET_NET(curvnet);
IFNET_WLOCK_ASSERT();
@@ -188,6 +190,7 @@
struct ifaddr *
ifaddr_byindex(u_short idx)
{
+ INIT_VNET_NET(curvnet);
struct ifaddr *ifa;
IFNET_RLOCK();
@@ -199,6 +202,7 @@
struct cdev *
ifdev_byindex(u_short idx)
{
+ INIT_VNET_NET(curvnet);
struct cdev *cdev;
IFNET_RLOCK();
@@ -210,6 +214,7 @@
static void
ifdev_setbyindex(u_short idx, struct cdev *cdev)
{
+ INIT_VNET_NET(curvnet);
IFNET_WLOCK();
V_ifindex_table[idx].ife_dev = cdev;
@@ -349,6 +354,7 @@
static void
if_init(void *dummy __unused)
{
+ INIT_VNET_NET(curvnet);
IFNET_LOCK_INIT();
TAILQ_INIT(&V_ifnet);
@@ -363,6 +369,7 @@
static void
if_grow(void)
{
+ INIT_VNET_NET(curvnet);
u_int n;
struct ifindex_entry *e;
@@ -2536,6 +2543,9 @@
void
if_delmulti_ifma(struct ifmultiaddr *ifma)
{
+#ifdef DIAGNOSTIC
+ INIT_VNET_NET(curvnet);
+#endif
struct ifnet *ifp;
int lastref;
==== //depot/projects/vimage-commit2/src/sys/net/if_bridge.c#9 (text+ko) ====
@@ -3039,6 +3039,8 @@
}
if (IPFW_LOADED && pfil_ipfw != 0 && dir == PFIL_OUT && ifp != NULL) {
+ INIT_VNET_IPFW(curvnet);
+
error = -1;
args.rule = ip_dn_claim_rule(*mp);
if (args.rule != NULL && V_fw_one_pass)
@@ -3223,6 +3225,7 @@
static int
bridge_ip_checkbasic(struct mbuf **mp)
{
+ INIT_VNET_INET(curvnet);
struct mbuf *m = *mp;
struct ip *ip;
int len, hlen;
@@ -3318,6 +3321,7 @@
static int
bridge_ip6_checkbasic(struct mbuf **mp)
{
+ INIT_VNET_INET6(curvnet);
struct mbuf *m = *mp;
struct ip6_hdr *ip6;
@@ -3372,6 +3376,7 @@
bridge_fragment(struct ifnet *ifp, struct mbuf *m, struct ether_header *eh,
int snap, struct llc *llc)
{
+ INIT_VNET_INET(curvnet);
struct mbuf *m0;
struct ip *ip;
int error = -1;
==== //depot/projects/vimage-commit2/src/sys/net/if_spppsubr.c#9 (text+ko) ====
@@ -4875,6 +4875,7 @@
static void
sppp_set_ip_addr(struct sppp *sp, u_long src)
{
+ INIT_VNET_INET(curvnet);
STDDCL;
struct ifaddr *ifa;
struct sockaddr_in *si;
==== //depot/projects/vimage-commit2/src/sys/netinet/igmp.c#10 (text+ko) ====
@@ -116,6 +116,7 @@
void
igmp_init(void)
{
+ INIT_VNET_INET(curvnet);
struct ipoption *ra;
/*
==== //depot/projects/vimage-commit2/src/sys/netinet/in_mcast.c#8 (text+ko) ====
==== //depot/projects/vimage-commit2/src/sys/netinet/in_pcb.c#15 (text+ko) ====
@@ -1279,6 +1279,7 @@
void
inp_apply_all(void (*func)(struct inpcb *, void *), void *arg)
{
+ INIT_VNET_INET(curvnet);
struct inpcb *inp;
INP_INFO_RLOCK(&V_tcbinfo);
==== //depot/projects/vimage-commit2/src/sys/netinet/ip_divert.c#8 (text+ko) ====
@@ -148,6 +148,7 @@
void
div_init(void)
{
+ INIT_VNET_INET(curvnet);
INP_INFO_LOCK_INIT(&V_divcbinfo, "div");
LIST_INIT(&V_divcb);
@@ -175,6 +176,8 @@
void
div_input(struct mbuf *m, int off)
{
+ INIT_VNET_INET(curvnet);
+
V_ipstat.ips_noproto++;
m_freem(m);
}
@@ -188,6 +191,7 @@
static void
divert_packet(struct mbuf *m, int incoming)
{
+ INIT_VNET_INET(curvnet);
struct ip *ip;
struct inpcb *inp;
struct socket *sa;
@@ -304,6 +308,7 @@
div_output(struct socket *so, struct mbuf *m, struct sockaddr_in *sin,
struct mbuf *control)
{
+ INIT_VNET_INET(curvnet);
struct m_tag *mtag;
struct divert_tag *dt;
int error = 0;
@@ -456,6 +461,7 @@
static int
div_attach(struct socket *so, int proto, struct thread *td)
{
+ INIT_VNET_INET(so->so_vnet);
struct inpcb *inp;
int error;
@@ -487,6 +493,7 @@
static void
div_detach(struct socket *so)
{
+ INIT_VNET_INET(so->so_vnet);
struct inpcb *inp;
inp = sotoinpcb(so);
@@ -501,6 +508,7 @@
static int
div_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
{
+ INIT_VNET_INET(so->so_vnet);
struct inpcb *inp;
int error;
@@ -541,6 +549,8 @@
div_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam,
struct mbuf *control, struct thread *td)
{
+ INIT_VNET_INET(so->so_vnet);
+
/* Packet must have a header (but that's about it) */
if (m->m_len < sizeof (struct ip) &&
(m = m_pullup(m, sizeof (struct ip))) == 0) {
==== //depot/projects/vimage-commit2/src/sys/netinet/ip_input.c#13 (text+ko) ====
@@ -217,6 +217,7 @@
void
ip_init(void)
{
+ INIT_VNET_INET(curvnet);
struct protosw *pr;
int i;
==== //depot/projects/vimage-commit2/src/sys/netinet/tcp_input.c#15 (text+ko) ====
@@ -256,6 +256,13 @@
void
tcp_input(struct mbuf *m, int off0)
{
+ INIT_VNET_INET(curvnet);
+#ifdef INET6
+ INIT_VNET_INET6(curvnet);
+#endif
+#ifdef IPSEC
+ INIT_VNET_IPSEC(curvnet);
+#endif
struct tcphdr *th;
struct ip *ip = NULL;
struct ipovly *ipov;
==== //depot/projects/vimage-commit2/src/sys/netinet/tcp_offload.c#7 (text+ko) ====
@@ -107,6 +107,7 @@
void
tcp_offload_twstart(struct tcpcb *tp)
{
+ INIT_VNET_INET(curvnet);
INP_INFO_WLOCK(&V_tcbinfo);
INP_WLOCK(tp->t_inpcb);
@@ -117,6 +118,7 @@
struct tcpcb *
tcp_offload_close(struct tcpcb *tp)
{
+ INIT_VNET_INET(curvnet);
INP_INFO_WLOCK(&V_tcbinfo);
INP_WLOCK(tp->t_inpcb);
@@ -131,6 +133,7 @@
struct tcpcb *
tcp_offload_drop(struct tcpcb *tp, int error)
{
+ INIT_VNET_INET(curvnet);
INP_INFO_WLOCK(&V_tcbinfo);
INP_WLOCK(tp->t_inpcb);
==== //depot/projects/vimage-commit2/src/sys/netinet/tcp_subr.c#15 (text+ko) ====
@@ -1522,6 +1522,9 @@
struct inpcb *
tcp_drop_syn_sent(struct inpcb *inp, int errno)
{
+#ifdef INVARIANTS
+ INIT_VNET_INET(inp->inp_vnet);
+#endif
struct tcpcb *tp;
INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
==== //depot/projects/vimage-commit2/src/sys/netinet/tcp_timewait.c#8 (text+ko) ====
@@ -163,6 +163,7 @@
void
tcp_tw_init(void)
{
+ INIT_VNET_INET(curvnet);
tcptw_zone = uma_zcreate("tcptw", sizeof(struct tcptw),
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
==== //depot/projects/vimage-commit2/src/sys/netinet6/in6_rmx.c#10 (text+ko) ====
@@ -242,6 +242,7 @@
static void
in6_clsroute(struct radix_node *rn, struct radix_node_head *head)
{
+ INIT_VNET_INET6(curvnet);
struct rtentry *rt = (struct rtentry *)rn;
RT_LOCK_ASSERT(rt);
@@ -286,6 +287,7 @@
static int
in6_rtqkill(struct radix_node *rn, void *rock)
{
+ INIT_VNET_INET6(curvnet);
struct rtqk_arg *ap = rock;
struct rtentry *rt = (struct rtentry *)rn;
int err;
==== //depot/projects/vimage-commit2/src/sys/netinet6/ip6_input.c#9 (text+ko) ====
@@ -145,6 +145,7 @@
void
ip6_init(void)
{
+ INIT_VNET_INET6(curvnet);
struct ip6protosw *pr;
int i;
==== //depot/projects/vimage-commit2/src/sys/netinet6/nd6.c#13 (text+ko) ====
@@ -125,6 +125,7 @@
void
nd6_init(void)
{
+ INIT_VNET_INET6(curvnet);
static int nd6_init_done = 0;
int i;
More information about the p4-projects
mailing list