Deleted Added
full compact
spx_usrreq.c (97658) spx_usrreq.c (109623)
1/*
2 * Copyright (c) 1995, Mike Mitchell
3 * Copyright (c) 1984, 1985, 1986, 1987, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 19 unchanged lines hidden (view full) ---

28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)spx_usrreq.h
35 *
1/*
2 * Copyright (c) 1995, Mike Mitchell
3 * Copyright (c) 1984, 1985, 1986, 1987, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 19 unchanged lines hidden (view full) ---

28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)spx_usrreq.h
35 *
36 * $FreeBSD: head/sys/netipx/spx_usrreq.c 97658 2002-05-31 11:52:35Z tanimura $
36 * $FreeBSD: head/sys/netipx/spx_usrreq.c 109623 2003-01-21 08:56:16Z alfred $
37 */
38
39#include <sys/param.h>
40#include <sys/lock.h>
41#include <sys/malloc.h>
42#include <sys/mbuf.h>
43#include <sys/mutex.h>
44#include <sys/proc.h>

--- 529 unchanged lines hidden (view full) ---

574 spxstat.spxs_rcvpack++;
575#ifdef SF_NEWCALL
576 if (cb->s_flags2 & SF_NEWCALL) {
577 struct spxhdr *sp = mtod(m, struct spxhdr *);
578 u_char dt = sp->spx_dt;
579 spx_newchecks[4]++;
580 if (dt != cb->s_rhdr.spx_dt) {
581 struct mbuf *mm =
37 */
38
39#include <sys/param.h>
40#include <sys/lock.h>
41#include <sys/malloc.h>
42#include <sys/mbuf.h>
43#include <sys/mutex.h>
44#include <sys/proc.h>

--- 529 unchanged lines hidden (view full) ---

574 spxstat.spxs_rcvpack++;
575#ifdef SF_NEWCALL
576 if (cb->s_flags2 & SF_NEWCALL) {
577 struct spxhdr *sp = mtod(m, struct spxhdr *);
578 u_char dt = sp->spx_dt;
579 spx_newchecks[4]++;
580 if (dt != cb->s_rhdr.spx_dt) {
581 struct mbuf *mm =
582 m_getclr(M_DONTWAIT, MT_CONTROL);
582 m_getclr(M_NOWAIT, MT_CONTROL);
583 spx_newchecks[0]++;
584 if (mm != NULL) {
585 u_short *s =
586 mtod(mm, u_short *);
587 cb->s_rhdr.spx_dt = dt;
588 mm->m_len = 5; /*XXX*/
589 s[0] = 5;
590 s[1] = 1;

--- 159 unchanged lines hidden (view full) ---

750
751 cb->s_cc &= ~SPX_EM;
752 while (len > mtu) {
753 /*
754 * Here we are only being called
755 * from usrreq(), so it is OK to
756 * block.
757 */
583 spx_newchecks[0]++;
584 if (mm != NULL) {
585 u_short *s =
586 mtod(mm, u_short *);
587 cb->s_rhdr.spx_dt = dt;
588 mm->m_len = 5; /*XXX*/
589 s[0] = 5;
590 s[1] = 1;

--- 159 unchanged lines hidden (view full) ---

750
751 cb->s_cc &= ~SPX_EM;
752 while (len > mtu) {
753 /*
754 * Here we are only being called
755 * from usrreq(), so it is OK to
756 * block.
757 */
758 m = m_copym(m0, 0, mtu, M_TRYWAIT);
758 m = m_copym(m0, 0, mtu, 0);
759 if (cb->s_flags & SF_NEWCALL) {
760 struct mbuf *mm = m;
761 spx_newchecks[7]++;
762 while (mm != NULL) {
763 mm->m_flags &= ~M_EOR;
764 mm = mm->m_next;
765 }
766 }

--- 13 unchanged lines hidden (view full) ---

780 * Force length even, by adding a "garbage byte" if
781 * necessary.
782 */
783 if (len & 1) {
784 m = mprev;
785 if (M_TRAILINGSPACE(m) >= 1)
786 m->m_len++;
787 else {
759 if (cb->s_flags & SF_NEWCALL) {
760 struct mbuf *mm = m;
761 spx_newchecks[7]++;
762 while (mm != NULL) {
763 mm->m_flags &= ~M_EOR;
764 mm = mm->m_next;
765 }
766 }

--- 13 unchanged lines hidden (view full) ---

780 * Force length even, by adding a "garbage byte" if
781 * necessary.
782 */
783 if (len & 1) {
784 m = mprev;
785 if (M_TRAILINGSPACE(m) >= 1)
786 m->m_len++;
787 else {
788 struct mbuf *m1 = m_get(M_DONTWAIT, MT_DATA);
788 struct mbuf *m1 = m_get(M_NOWAIT, MT_DATA);
789
790 if (m1 == NULL) {
791 m_freem(m0);
792 return (ENOBUFS);
793 }
794 m1->m_len = 1;
795 *(mtod(m1, u_char *)) = 0;
796 m->m_next = m1;
797 }
798 }
789
790 if (m1 == NULL) {
791 m_freem(m0);
792 return (ENOBUFS);
793 }
794 m1->m_len = 1;
795 *(mtod(m1, u_char *)) = 0;
796 m->m_next = m1;
797 }
798 }
799 m = m_gethdr(M_DONTWAIT, MT_HEADER);
799 m = m_gethdr(M_NOWAIT, MT_HEADER);
800 if (m == NULL) {
801 m_freem(m0);
802 return (ENOBUFS);
803 }
804 /*
805 * Fill in mbuf with extended SP header
806 * and addresses and length put into network format.
807 */

--- 196 unchanged lines hidden (view full) ---

1004 } else if (cb->s_force || cb->s_flags & SF_ACKNOW) {
1005 /*
1006 * Must send an acknowledgement or a probe
1007 */
1008 if (cb->s_force)
1009 spxstat.spxs_sndprobe++;
1010 if (cb->s_flags & SF_ACKNOW)
1011 spxstat.spxs_sndacks++;
800 if (m == NULL) {
801 m_freem(m0);
802 return (ENOBUFS);
803 }
804 /*
805 * Fill in mbuf with extended SP header
806 * and addresses and length put into network format.
807 */

--- 196 unchanged lines hidden (view full) ---

1004 } else if (cb->s_force || cb->s_flags & SF_ACKNOW) {
1005 /*
1006 * Must send an acknowledgement or a probe
1007 */
1008 if (cb->s_force)
1009 spxstat.spxs_sndprobe++;
1010 if (cb->s_flags & SF_ACKNOW)
1011 spxstat.spxs_sndacks++;
1012 m = m_gethdr(M_DONTWAIT, MT_HEADER);
1012 m = m_gethdr(M_NOWAIT, MT_HEADER);
1013 if (m == NULL)
1014 return (ENOBUFS);
1015 /*
1016 * Fill in mbuf with extended SP header
1017 * and addresses and length put into network format.
1018 */
1019 MH_ALIGN(m, sizeof(struct spx));
1020 m->m_len = sizeof(*si);

--- 316 unchanged lines hidden (view full) ---

1337 MALLOC(cb, struct spxpcb *, sizeof *cb, M_PCB, M_NOWAIT | M_ZERO);
1338
1339 if (cb == NULL) {
1340 error = ENOBUFS;
1341 goto spx_attach_end;
1342 }
1343 sb = &so->so_snd;
1344
1013 if (m == NULL)
1014 return (ENOBUFS);
1015 /*
1016 * Fill in mbuf with extended SP header
1017 * and addresses and length put into network format.
1018 */
1019 MH_ALIGN(m, sizeof(struct spx));
1020 m->m_len = sizeof(*si);

--- 316 unchanged lines hidden (view full) ---

1337 MALLOC(cb, struct spxpcb *, sizeof *cb, M_PCB, M_NOWAIT | M_ZERO);
1338
1339 if (cb == NULL) {
1340 error = ENOBUFS;
1341 goto spx_attach_end;
1342 }
1343 sb = &so->so_snd;
1344
1345 mm = m_getclr(M_DONTWAIT, MT_HEADER);
1345 mm = m_getclr(M_NOWAIT, MT_HEADER);
1346 if (mm == NULL) {
1347 FREE(cb, M_PCB);
1348 error = ENOBUFS;
1349 goto spx_attach_end;
1350 }
1351 cb->s_ipx = mtod(mm, struct ipx *);
1352 cb->s_state = TCPS_LISTEN;
1353 cb->s_smax = -1;

--- 552 unchanged lines hidden ---
1346 if (mm == NULL) {
1347 FREE(cb, M_PCB);
1348 error = ENOBUFS;
1349 goto spx_attach_end;
1350 }
1351 cb->s_ipx = mtod(mm, struct ipx *);
1352 cb->s_state = TCPS_LISTEN;
1353 cb->s_smax = -1;

--- 552 unchanged lines hidden ---