From owner-svn-src-head@FreeBSD.ORG Mon May 25 11:50:58 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 BE39410656BF; Mon, 25 May 2009 11:50:58 +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 9E60A8FC4A; Mon, 25 May 2009 11:50:58 +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 n4PBowJN022943; Mon, 25 May 2009 11:50:58 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PBowse022941; Mon, 25 May 2009 11:50:58 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200905251150.n4PBowse022941@svn.freebsd.org> From: Robert Watson Date: Mon, 25 May 2009 11:50:58 +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: r192754 - 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 11:51:02 -0000 Author: rwatson Date: Mon May 25 11:50:58 2009 New Revision: 192754 URL: http://svn.freebsd.org/changeset/base/192754 Log: Rather than store a skeleton IPX header in an mbuf hung off the SPX PCB, simply embed it in the PCB, avoiding additional memory overhead, memory allocation overhead, and removing one of the few remaining uses of dtom() in the network stack. Restore misplaced spx_ctlinput() from an earlier commit. MFC after: 1 month Modified: head/sys/netipx/spx.h head/sys/netipx/spx_usrreq.c Modified: head/sys/netipx/spx.h ============================================================================== --- head/sys/netipx/spx.h Mon May 25 10:25:41 2009 (r192753) +++ head/sys/netipx/spx.h Mon May 25 11:50:58 2009 (r192754) @@ -129,7 +129,7 @@ struct spxpcb { u_short s_mtu; /* Max packet size for this stream */ /* use sequence fields in headers to store sequence numbers for this connection */ - struct ipx *s_ipx; + struct ipx s_ipx; struct spxhdr s_shdr; /* prototype header to transmit */ #define s_cc s_shdr.spx_cc /* connection control (for EM bit) */ #define s_dt s_shdr.spx_dt /* datastream type */ @@ -138,7 +138,7 @@ struct spxpcb { #define s_seq s_shdr.spx_seq /* sequence number */ #define s_ack s_shdr.spx_ack /* acknowledge number */ #define s_alo s_shdr.spx_alo /* allocation number */ -#define s_dport s_ipx->ipx_dna.x_port /* where we are sending */ +#define s_dport s_ipx.ipx_dna.x_port /* where we are sending */ struct spxhdr s_rhdr; /* last received header (in effect!)*/ u_short s_rack; /* their acknowledge number */ u_short s_ralo; /* their allocation number */ Modified: head/sys/netipx/spx_usrreq.c ============================================================================== --- head/sys/netipx/spx_usrreq.c Mon May 25 10:25:41 2009 (r192753) +++ head/sys/netipx/spx_usrreq.c Mon May 25 11:50:58 2009 (r192754) @@ -417,6 +417,13 @@ drop: m_freem(m); } +void +spx_ctlinput(int cmd, struct sockaddr *arg_as_sa, void *dummy) +{ + + /* Currently, nothing. */ +} + int spx_output(struct spxpcb *cb, struct mbuf *m0) { @@ -520,7 +527,7 @@ spx_output(struct spxpcb *cb, struct mbu m->m_len = sizeof(struct spx); m->m_next = m0; si = mtod(m, struct spx *); - si->si_i = *cb->s_ipx; + si->si_i = cb->s_ipx; si->si_s = cb->s_shdr; if ((cb->s_flags & SF_PI) && (cb->s_flags & SF_HO)) { struct spxhdr *sh; @@ -729,7 +736,7 @@ send: m->m_len = sizeof(*si); m->m_pkthdr.len = sizeof(*si); si = mtod(m, struct spx *); - si->si_i = *cb->s_ipx; + si->si_i = cb->s_ipx; si->si_s = cb->s_shdr; si->si_seq = cb->s_smax + 1; si->si_len = htons(sizeof(*si)); @@ -1087,7 +1094,6 @@ spx_attach(struct socket *so, int proto, ipxp = sotoipxpcb(so); ipxp->ipxp_flags |= IPXP_SPX; - cb->s_ipx = mtod(mm, struct ipx *); cb->s_state = TCPS_LISTEN; cb->s_smax = -1; cb->s_swl1 = -1; @@ -1124,7 +1130,6 @@ spx_pcbdetach(struct ipxpcb *ipxp) KASSERT(cb != NULL, ("spx_pcbdetach: cb == NULL")); spx_reass_flush(cb); - m_free(dtom(cb->s_ipx)); free(cb, M_PCB); ipxp->ipxp_pcb = NULL; } @@ -1490,14 +1495,13 @@ static void spx_template(struct spxpcb *cb) { struct ipxpcb *ipxp = cb->s_ipxpcb; - struct ipx *ipx = cb->s_ipx; struct sockbuf *sb = &(ipxp->ipxp_socket->so_snd); IPX_LOCK_ASSERT(ipxp); - ipx->ipx_pt = IPXPROTO_SPX; - ipx->ipx_sna = ipxp->ipxp_laddr; - ipx->ipx_dna = ipxp->ipxp_faddr; + cb->s_ipx.ipx_pt = IPXPROTO_SPX; + cb->s_ipx.ipx_sna = ipxp->ipxp_laddr; + cb->s_ipx.ipx_dna = ipxp->ipxp_faddr; SPX_LOCK(); cb->s_sid = htons(spx_iss); spx_iss += SPX_ISSINCR/2; @@ -1519,8 +1523,7 @@ spx_template(struct spxpcb *cb) /* * Close a SPIP control block. Wake up any sleepers. We used to free any - * queued packets and cb->s_ipx here, but now we defer that until the pcb is - * discarded. + * queued packets, but now we defer that until the pcb is discarded. */ void spx_close(struct spxpcb *cb)