aboutsummaryrefslogtreecommitdiff
path: root/sys/netipx
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2009-05-25 11:50:58 +0000
committerRobert Watson <rwatson@FreeBSD.org>2009-05-25 11:50:58 +0000
commit905220d58e98031c4b9ff3aa41a680fede046876 (patch)
tree817bde8815924bccf9b571d23b28dcc678ddc0a3 /sys/netipx
parent040eca7b0448d76144600bb716f46ac83d2ea2b8 (diff)
downloadsrc-905220d58e98031c4b9ff3aa41a680fede046876.tar.gz
src-905220d58e98031c4b9ff3aa41a680fede046876.zip
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
Notes
Notes: svn path=/head/; revision=192754
Diffstat (limited to 'sys/netipx')
-rw-r--r--sys/netipx/spx.h4
-rw-r--r--sys/netipx/spx_usrreq.c23
2 files changed, 15 insertions, 12 deletions
diff --git a/sys/netipx/spx.h b/sys/netipx/spx.h
index 044b6d4e8df5..2f4d21088312 100644
--- a/sys/netipx/spx.h
+++ b/sys/netipx/spx.h
@@ -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 */
diff --git a/sys/netipx/spx_usrreq.c b/sys/netipx/spx_usrreq.c
index 67612f94b3fa..8717a2d131c7 100644
--- a/sys/netipx/spx_usrreq.c
+++ b/sys/netipx/spx_usrreq.c
@@ -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 mbuf *m0)
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, struct thread *td)
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)