PERFORCE change 147524 for review
Marko Zec
zec at FreeBSD.org
Sat Aug 16 12:03:36 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=147524
Change 147524 by zec at zec_tpx32 on 2008/08/16 12:02:49
Merge vimage -> vimage-devel
Affected files ...
.. //depot/projects/vimage-devel/src/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c#2 integrate
.. //depot/projects/vimage-devel/src/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#6 integrate
.. //depot/projects/vimage-devel/src/sys/geom/vinum/geom_vinum_drive.c#3 integrate
.. //depot/projects/vimage-devel/src/sys/kern/uipc_accf.c#2 integrate
.. //depot/projects/vimage-devel/src/sys/netgraph/ng_source.c#2 integrate
.. //depot/projects/vimage-devel/src/sys/netinet/accf_http.c#2 integrate
.. //depot/projects/vimage-devel/src/sys/netinet/sctp_os_bsd.h#5 integrate
.. //depot/projects/vimage-devel/src/sys/sys/socketvar.h#5 integrate
.. //depot/projects/vimage-devel/src/sys/sys/vimage.h#10 integrate
Differences ...
==== //depot/projects/vimage-devel/src/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c#2 (text+ko) ====
@@ -53,7 +53,9 @@
#include <sys/taskqueue.h>
#include <sys/proc.h>
#include <sys/eventhandler.h>
+#include <sys/vimage.h>
+#include <net/vnet.h>
#include <net/if.h>
#include <net/if_var.h>
@@ -237,9 +239,12 @@
/* Register existing TOE interfaces by walking the ifnet chain */
IFNET_RLOCK();
- TAILQ_FOREACH(ifp, &ifnet, if_link) {
+ VNET_ITERLOOP_BEGIN();
+ INIT_VNET_NET(curvnet);
+ TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
(void)ifaddr_event_handler(NULL, ifp);
}
+ VNET_ITERLOOP_END();
IFNET_RUNLOCK();
return 0;
}
==== //depot/projects/vimage-devel/src/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#6 (text+ko) ====
@@ -48,10 +48,12 @@
#include <sys/syslog.h>
#include <sys/protosw.h>
#include <sys/priv.h>
+#include <sys/vimage.h>
#include <net/if.h>
#include <net/route.h>
+#include <netinet/vinet.h>
#include <netinet/in.h>
#include <netinet/in_pcb.h>
#include <netinet/in_systm.h>
@@ -262,6 +264,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;
@@ -289,8 +292,8 @@
/* Sendbuffer is in units of 32KB.
*/
- if (tcp_do_autosndbuf && snd->sb_flags & SB_AUTOSIZE)
- req->param |= htonl(V_TX_SNDBUF(tcp_autosndbuf_max >> 15));
+ if (V_tcp_do_autosndbuf && snd->sb_flags & SB_AUTOSIZE)
+ req->param |= htonl(V_TX_SNDBUF(V_tcp_autosndbuf_max >> 15));
else {
req->param |= htonl(V_TX_SNDBUF(snd->sb_hiwat >> 15));
}
@@ -1223,6 +1226,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;
@@ -1230,8 +1234,8 @@
rcv = so_sockbuf_rcv(so);
- if (tcp_do_autorcvbuf)
- wnd = tcp_autorcvbuf_max;
+ if (V_tcp_do_autorcvbuf)
+ wnd = V_tcp_autorcvbuf_max;
else
wnd = rcv->sb_hiwat;
@@ -3768,6 +3772,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);
@@ -3817,7 +3822,7 @@
#endif
toep->tp_state = tp->t_state;
- tcpstat.tcps_connects++;
+ V_tcpstat.tcps_connects++;
}
==== //depot/projects/vimage-devel/src/sys/geom/vinum/geom_vinum_drive.c#3 (text+ko) ====
@@ -41,6 +41,7 @@
#include <sys/sbuf.h>
#include <sys/systm.h>
#include <sys/time.h>
+#include <sys/vimage.h>
#include <geom/geom.h>
#include <geom/vinum/geom_vinum_var.h>
@@ -63,7 +64,7 @@
vhdr->config_length = GV_CFG_LEN;
mtx_lock(&hostname_mtx);
- bcopy(hostname, vhdr->label.sysname, GV_HOSTNAME_LEN);
+ bcopy(G_hostname, vhdr->label.sysname, GV_HOSTNAME_LEN);
mtx_unlock(&hostname_mtx);
strncpy(vhdr->label.name, d->name, GV_MAXDRIVENAME);
microtime(&vhdr->label.date_of_birth);
==== //depot/projects/vimage-devel/src/sys/kern/uipc_accf.c#2 (text+ko) ====
@@ -58,11 +58,12 @@
MALLOC_DEFINE(M_ACCF, "accf", "accept filter data");
-static int unloadable = 0;
+int accf_unloadable = 0;
SYSCTL_DECL(_net_inet); /* XXX: some header should do this for me */
SYSCTL_NODE(_net_inet, OID_AUTO, accf, CTLFLAG_RW, 0, "Accept filters");
-SYSCTL_INT(_net_inet_accf, OID_AUTO, unloadable, CTLFLAG_RW, &unloadable, 0,
+SYSCTL_INT(_net_inet_accf, OID_AUTO, unloadable, CTLFLAG_RW,
+ &accf_unloadable, 0,
"Allow unload of accept filters (not recommended)");
/*
@@ -144,7 +145,7 @@
* having it called is a bad thing. A simple fix would be to
* track the refcount in the struct accept_filter.
*/
- if (unloadable != 0) {
+ if (accf_unloadable != 0) {
error = accept_filt_del(accfp->accf_name);
} else
error = EOPNOTSUPP;
==== //depot/projects/vimage-devel/src/sys/netgraph/ng_source.c#2 (text+ko) ====
@@ -615,7 +615,7 @@
ifp = ifunit(ifname);
if (ifp == NULL) {
- printf("%s: can't find interface %d\n", __func__, if_index);
+ printf("%s: can't find interface %s\n", __func__, ifname);
return (EINVAL);
}
sc->output_ifp = ifp;
==== //depot/projects/vimage-devel/src/sys/netinet/accf_http.c#2 (text+ko) ====
@@ -37,6 +37,7 @@
#include <sys/signalvar.h>
#include <sys/sysctl.h>
#include <sys/socketvar.h>
+#include <sys/vimage.h>
/* check for GET/HEAD */
static void sohashttpget(struct socket *so, void *arg, int waitflag);
@@ -51,6 +52,8 @@
int max, char *cmp);
/* socketbuffer is full */
static int sbfull(struct sockbuf *sb);
+static int
+accept_filt_http_mod_event(module_t mod, int event, void *data);
static struct accept_filter accf_http_filter = {
"httpready",
@@ -61,19 +64,42 @@
static moduledata_t accf_http_mod = {
"accf_http",
- accept_filt_generic_mod_event,
- &accf_http_filter
+ accept_filt_http_mod_event,
+ NULL,
};
DECLARE_MODULE(accf_http, accf_http_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
-static int parse_http_version = 1;
+#ifndef VIMAGE
+static int parse_http_version;
+#endif
+
+/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
+struct vnet_accf_http {
+ int _parse_http_version;
+};
+
+#define INIT_VNET_ACCF_HTTP(vnet) \
+ INIT_FROM_VNET(vnet, VNET_MOD_ACCF_HTTP, struct vnet_accf_http, vnet_accf_http)
+
+#define VNET_ACCF_HTTP(sym) VSYM(vnet_accf_http, sym)
+
+#define V_parse_http_version VNET_ACCF_HTTP(parse_http_version)
+
+#define V_MOD_vnet_accf_http VNET_MOD_ACCF_HTTP
+
+static vnet_attach_fn vnet_accf_http_iattach;
+
+VNET_MOD_DECLARE(ACCF_HTTP, accf_http, vnet_accf_http_iattach,
+ NULL, INET, NULL)
+
+/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
SYSCTL_NODE(_net_inet_accf, OID_AUTO, http, CTLFLAG_RW, 0,
"HTTP accept filter");
-SYSCTL_INT(_net_inet_accf_http, OID_AUTO, parsehttpversion, CTLFLAG_RW,
-&parse_http_version, 1,
-"Parse http version so that non 1.x requests work");
+SYSCTL_V_INT(V_NET, vnet_accf_http, _net_inet_accf_http, OID_AUTO,
+ parsehttpversion, CTLFLAG_RW, parse_http_version, 1,
+ "Parse http version so that non 1.x requests work");
#ifdef ACCF_HTTP_DEBUG
#define DPRINT(fmt, args...) \
@@ -161,6 +187,7 @@
static void
sohashttpget(struct socket *so, void *arg, int waitflag)
{
+ INIT_VNET_ACCF_HTTP(so->so_vnet);
if ((so->so_rcv.sb_state & SBS_CANTRCVMORE) == 0 && !sbfull(&so->so_rcv)) {
struct mbuf *m;
@@ -192,7 +219,7 @@
}
if (mbufstrcmp(m, m->m_nextpkt, 1, cmp) == 1) {
DPRINT("mbufstrcmp ok");
- if (parse_http_version == 0)
+ if (V_parse_http_version == 0)
soishttpconnected(so, arg, waitflag);
else
soparsehttpvers(so, arg, waitflag);
@@ -360,3 +387,58 @@
soisconnected(so);
return;
}
+
+static int
+accept_filt_http_mod_event(module_t mod, int event, void *data)
+{
+ struct accept_filter *p;
+ int error;
+
+ switch (event) {
+ case MOD_LOAD:
+#ifdef VIMAGE
+ vnet_mod_register(&vnet_accf_http_modinfo);
+#else
+ vnet_accf_http_iattach(NULL);
+#endif /* !VIMAGE */
+
+ MALLOC(p, struct accept_filter *, sizeof(*p), M_ACCF,
+ M_WAITOK);
+ bcopy(&accf_http_filter, p, sizeof(*p));
+ error = accept_filt_add(p);
+ break;
+
+ case MOD_UNLOAD:
+ /*
+ * Do not support unloading yet. we don't keep track of
+ * refcounts and unloading an accept filter callback and then
+ * having it called is a bad thing. A simple fix would be to
+ * track the refcount in the struct accept_filter.
+ */
+ if (accf_unloadable != 0) {
+ error = accept_filt_del(accf_http_filter.accf_name);
+ } else
+ error = EOPNOTSUPP;
+ break;
+
+ case MOD_SHUTDOWN:
+ error = 0;
+ break;
+
+ default:
+ error = EOPNOTSUPP;
+ break;
+ }
+
+ return (error);
+}
+
+static int vnet_accf_http_iattach(const void *unused)
+{
+ INIT_VNET_ACCF_HTTP(curvnet);
+
+ V_parse_http_version = 1;
+
+ return 0;
+}
+
==== //depot/projects/vimage-devel/src/sys/netinet/sctp_os_bsd.h#5 (text+ko) ====
==== //depot/projects/vimage-devel/src/sys/sys/socketvar.h#5 (text+ko) ====
@@ -295,6 +295,7 @@
MALLOC_DECLARE(M_SONAME);
#endif
+extern int accf_unloadable;
extern int maxsockets;
extern u_long sb_max;
extern struct uma_zone *socket_zone;
==== //depot/projects/vimage-devel/src/sys/sys/vimage.h#10 (text+ko) ====
@@ -28,8 +28,8 @@
* SUCH DAMAGE.
*/
-#ifndef _NET_VIMAGE_H_
-#define _NET_VIMAGE_H_
+#ifndef _SYS_VIMAGE_H_
+#define _SYS_VIMAGE_H_
#include <sys/lock.h>
#include <sys/proc.h>
@@ -78,6 +78,7 @@
#define VNET_MOD_ALTQ 8
#define VNET_MOD_IPX 9
#define VNET_MOD_ATALK 10
+#define VNET_MOD_ACCF_HTTP 11
/* stateless modules */
#define VNET_MOD_NG_WORMHOLE 19
#define VNET_MOD_NG_ETHER 20
@@ -501,4 +502,4 @@
#define VI_SET_CHROOT 0x00200000
-#endif /* _NET_VIMAGE_H_ */
+#endif /* !_SYS_VIMAGE_H_ */
More information about the p4-projects
mailing list