From owner-svn-src-head@FreeBSD.ORG Mon May 25 10:25:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B67AA106564A; Mon, 25 May 2009 10:25:41 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A450D8FC16; Mon, 25 May 2009 10:25:41 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PAPfCU021298; Mon, 25 May 2009 10:25:41 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PAPftB021295; Mon, 25 May 2009 10:25:41 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200905251025.n4PAPftB021295@svn.freebsd.org> From: Robert Watson Date: Mon, 25 May 2009 10:25:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192753 - head/sys/netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 10:25:42 -0000 Author: rwatson Date: Mon May 25 10:25:41 2009 New Revision: 192753 URL: http://svn.freebsd.org/changeset/base/192753 Log: Pull SPX reassembly queue init and flush into spx_reass.c. MFC after: 1 month Modified: head/sys/netipx/spx_reass.c head/sys/netipx/spx_usrreq.c head/sys/netipx/spx_var.h Modified: head/sys/netipx/spx_reass.c ============================================================================== --- head/sys/netipx/spx_reass.c Mon May 25 10:22:39 2009 (r192752) +++ head/sys/netipx/spx_reass.c Mon May 25 10:25:41 2009 (r192753) @@ -1,7 +1,7 @@ /*- * Copyright (c) 1984, 1985, 1986, 1987, 1993 * The Regents of the University of California. - * Copyright (c) 2004-2006 Robert N. M. Watson + * Copyright (c) 2004-2009 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -112,6 +112,34 @@ spx_remque(struct spx_q *element) } /* + * Flesh pending queued segments on SPX close. + */ +void +spx_reass_flush(struct spxpcb *cb) +{ + struct spx_q *s; + struct mbuf *m; + + s = cb->s_q.si_next; + while (s != &(cb->s_q)) { + s = s->si_next; + spx_remque(s); + m = dtom(s); + m_freem(m); + } +} + +/* + * Initialize SPX segment reassembly queue on SPX socket open. + */ +void +spx_reass_init(struct spxpcb *cb) +{ + + cb->s_q.si_next = cb->s_q.si_prev = &cb->s_q; +} + +/* * This is structurally similar to the tcp reassembly routine but its * function is somewhat different: it merely queues packets up, and * suppresses duplicates. Modified: head/sys/netipx/spx_usrreq.c ============================================================================== --- head/sys/netipx/spx_usrreq.c Mon May 25 10:22:39 2009 (r192752) +++ head/sys/netipx/spx_usrreq.c Mon May 25 10:25:41 2009 (r192753) @@ -1,7 +1,7 @@ /*- * Copyright (c) 1984, 1985, 1986, 1987, 1993 * The Regents of the University of California. - * Copyright (c) 2004-2006 Robert N. M. Watson + * Copyright (c) 2004-2009 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1091,7 +1091,7 @@ spx_attach(struct socket *so, int proto, cb->s_state = TCPS_LISTEN; cb->s_smax = -1; cb->s_swl1 = -1; - cb->s_q.si_next = cb->s_q.si_prev = &cb->s_q; + spx_reass_init(cb); cb->s_ipxpcb = ipxp; cb->s_mtu = 576 - sizeof(struct spx); sb = &so->so_snd; @@ -1117,21 +1117,13 @@ static void spx_pcbdetach(struct ipxpcb *ipxp) { struct spxpcb *cb; - struct spx_q *s; - struct mbuf *m; IPX_LOCK_ASSERT(ipxp); cb = ipxtospxpcb(ipxp); KASSERT(cb != NULL, ("spx_pcbdetach: cb == NULL")); - s = cb->s_q.si_next; - while (s != &(cb->s_q)) { - s = s->si_next; - spx_remque(s); - m = dtom(s); - m_freem(m); - } + spx_reass_flush(cb); m_free(dtom(cb->s_ipx)); free(cb, M_PCB); ipxp->ipxp_pcb = NULL; Modified: head/sys/netipx/spx_var.h ============================================================================== --- head/sys/netipx/spx_var.h Mon May 25 10:22:39 2009 (r192752) +++ head/sys/netipx/spx_var.h Mon May 25 10:25:41 2009 (r192753) @@ -153,6 +153,8 @@ extern u_short spx_newchecks[50]; int spx_output(struct spxpcb *cb, struct mbuf *m0); int spx_reass(struct spxpcb *cb, struct spx *si); +void spx_reass_flush(struct spxpcb *cb); +void spx_reass_init(struct spxpcb *cb); void spx_remque(struct spx_q *element); #endif