Date: Mon, 25 May 2009 11:50:58 +0000 (UTC) From: Robert Watson <rwatson@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r192754 - head/sys/netipx Message-ID: <200905251150.n4PBowse022941@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905251150.n4PBowse022941>