summaryrefslogtreecommitdiffstats
path: root/sys/dev/musycc
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2001-01-06 00:46:47 +0000
committerjulian <julian@FreeBSD.org>2001-01-06 00:46:47 +0000
commitf0c46a9d00fc9fe4644cef5784e76b360f5036c7 (patch)
tree561902279f2f361f3e137f7fc029ce2714981289 /sys/dev/musycc
parente06f071f56cf6badae9215f8a14ccc66a3fc0f5a (diff)
downloadFreeBSD-src-f0c46a9d00fc9fe4644cef5784e76b360f5036c7.zip
FreeBSD-src-f0c46a9d00fc9fe4644cef5784e76b360f5036c7.tar.gz
Rewrite of netgraph to start getting ready for SMP.
This version is functional and is aproaching solid.. notice I said APROACHING. There are many node types I cannot test I have tested: echo hole ppp socket vjc iface tee bpf async tty The rest compile and "Look" right. More changes to follow. DEBUGGING is enabled in this code to help if people have problems.
Diffstat (limited to 'sys/dev/musycc')
-rw-r--r--sys/dev/musycc/musycc.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/sys/dev/musycc/musycc.c b/sys/dev/musycc/musycc.c
index 98d5334..e1817fa 100644
--- a/sys/dev/musycc/musycc.c
+++ b/sys/dev/musycc/musycc.c
@@ -834,7 +834,7 @@ musycc_intr1(void *arg)
*/
static int
-musycc_constructor(node_p *nodep)
+musycc_constructor(node_p node)
{
return (EINVAL);
@@ -929,21 +929,19 @@ barf:
/*
* Handle status and config enquiries.
* Respond with a synchronous response.
- * [JRE] -this would be easier to read with the usual 'switch' structure-
*/
static int
-musycc_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr,
- struct ng_mesg **rptr, hook_p lasthook)
+musycc_rcvmsg(node_p node, item_p item, hook_p lasthook)
{
struct softc *sc;
struct ng_mesg *resp = NULL;
char *s, *r;
int error = 0;
+ struct ng_mesg *msg;
+
+ NGI_GET_MSG(item, msg);
sc = node->private;
- if (rptr)
- *rptr = NULL; /* default answer in case of errors */
-
if (msg->header.typecookie != NGM_GENERIC_COOKIE)
goto out;
@@ -957,7 +955,7 @@ musycc_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr,
s = (char *)resp->data;
status_8370(sc, s);
resp->header.arglen = strlen(s) + 1;
- FREE(msg, M_NETGRAPH);
+ NG_FREE_MSG(msg);
} else if (msg->header.cmd == NGM_TEXT_CONFIG) {
if (msg->header.arglen) {
@@ -976,19 +974,15 @@ musycc_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr,
*r = '\0';
musycc_config(node, s, r);
resp->header.arglen = strlen(r) + 1;
- FREE(msg, M_NETGRAPH);
+ NG_FREE_MSG(msg);
} else {
error = EINVAL;
}
out:
/* Take care of synchronous response, if any */
- if (rptr)
- *rptr = resp;
- else if (resp)
- FREE(resp, M_NETGRAPH); /* eventually 'send' the response */
-
- FREE(msg, M_NETGRAPH);
+ NG_RESPOND_MSG(error, node, item, resp);
+ NG_FREE_MSG(msg);
return (error);
}
@@ -1044,8 +1038,7 @@ musycc_newhook(node_p node, hook_p hook, const char *name)
}
static int
-musycc_rcvdata(hook_p hook, struct mbuf *m, meta_p meta,
- struct mbuf **ret_m, meta_p *ret_meta, struct ng_mesg **resp)
+musycc_rcvdata(hook_p hook, item_p item)
{
struct softc *sc;
@@ -1054,6 +1047,7 @@ musycc_rcvdata(hook_p hook, struct mbuf *m, meta_p meta,
struct mdesc *md;
u_int32_t ch, u, len;
struct mbuf *m2;
+ struct mbuf *m;
sch = hook->private;
sc = sch->sc;
@@ -1062,24 +1056,26 @@ musycc_rcvdata(hook_p hook, struct mbuf *m, meta_p meta,
if (csc->state != C_RUNNING) {
printf("csc->state = %d\n", csc->state);
- NG_FREE_DATA(m, meta);
+ NG_FREE_ITEM(item);
return (0);
}
- NG_FREE_META(meta);
- meta = NULL;
if (sch->state != UP) {
printf("sch->state = %d\n", sch->state);
- NG_FREE_DATA(m, meta);
+ NG_FREE_ITEM(item);
return (0);
}
+ NGI_GET_M(item, m);
+ NG_FREE_ITEM(item);
if (sch->tx_pending + m->m_pkthdr.len > sch->tx_limit * maxlatency) {
- printf("pend %ld len %d lim %ld\n", sch->tx_pending, m->m_pkthdr.len, sch->tx_limit * maxlatency);
- NG_FREE_DATA(m, meta);
+ printf("pend %ld len %d lim %ld\n", sch->tx_pending,
+ m->m_pkthdr.len, sch->tx_limit * maxlatency);
+ NG_FREE_M(m);
return (0);
}
+
m2 = m;
len = m->m_pkthdr.len;
while (len) {
OpenPOWER on IntegriCloud