spx_reass.c (139443) | spx_reass.c (139444) |
---|---|
1/* | 1/* |
2 * Copyright (c) 2004, Robert N. M. Watson |
|
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: 9 * 1. Redistributions of source code must retain the above copyright --- 20 unchanged lines hidden (view full) --- 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 37#include <sys/cdefs.h> | 3 * Copyright (c) 1995, Mike Mitchell 4 * Copyright (c) 1984, 1985, 1986, 1987, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright --- 20 unchanged lines hidden (view full) --- 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * @(#)spx_usrreq.h 36 */ 37 38#include <sys/cdefs.h> |
38__FBSDID("$FreeBSD: head/sys/netipx/spx_usrreq.c 139443 2004-12-30 17:21:07Z rwatson $"); | 39__FBSDID("$FreeBSD: head/sys/netipx/spx_usrreq.c 139444 2004-12-30 17:49:40Z rwatson $"); |
39 40#include <sys/param.h> 41#include <sys/lock.h> 42#include <sys/malloc.h> 43#include <sys/mbuf.h> 44#include <sys/mutex.h> 45#include <sys/proc.h> 46#include <sys/protosw.h> --- 1258 unchanged lines hidden (view full) --- 1305 struct sockbuf *sb; 1306 1307 ipxp = sotoipxpcb(so); 1308 cb = ipxtospxpcb(ipxp); 1309 1310 if (ipxp != NULL) 1311 return (EISCONN); 1312 s = splnet(); | 40 41#include <sys/param.h> 42#include <sys/lock.h> 43#include <sys/malloc.h> 44#include <sys/mbuf.h> 45#include <sys/mutex.h> 46#include <sys/proc.h> 47#include <sys/protosw.h> --- 1258 unchanged lines hidden (view full) --- 1306 struct sockbuf *sb; 1307 1308 ipxp = sotoipxpcb(so); 1309 cb = ipxtospxpcb(ipxp); 1310 1311 if (ipxp != NULL) 1312 return (EISCONN); 1313 s = splnet(); |
1313 error = ipx_pcballoc(so, &ipxpcb, td); | 1314 error = ipx_pcballoc(so, &ipxpcb_list, td); |
1314 if (error) 1315 goto spx_attach_end; 1316 if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) { 1317 error = soreserve(so, (u_long) 3072, (u_long) 3072); 1318 if (error) 1319 goto spx_attach_end; 1320 } 1321 ipxp = sotoipxpcb(so); --- 404 unchanged lines hidden (view full) --- 1726 */ 1727void 1728spx_fasttimo() 1729{ 1730 register struct ipxpcb *ipxp; 1731 register struct spxpcb *cb; 1732 int s = splnet(); 1733 | 1315 if (error) 1316 goto spx_attach_end; 1317 if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) { 1318 error = soreserve(so, (u_long) 3072, (u_long) 3072); 1319 if (error) 1320 goto spx_attach_end; 1321 } 1322 ipxp = sotoipxpcb(so); --- 404 unchanged lines hidden (view full) --- 1727 */ 1728void 1729spx_fasttimo() 1730{ 1731 register struct ipxpcb *ipxp; 1732 register struct spxpcb *cb; 1733 int s = splnet(); 1734 |
1734 ipxp = ipxpcb.ipxp_next; 1735 if (ipxp != NULL) 1736 for (; ipxp != &ipxpcb; ipxp = ipxp->ipxp_next) | 1735 LIST_FOREACH(ipxp, &ipxpcb_list, ipxp_list) { |
1737 if ((cb = (struct spxpcb *)ipxp->ipxp_pcb) != NULL && 1738 (cb->s_flags & SF_DELACK)) { 1739 cb->s_flags &= ~SF_DELACK; 1740 cb->s_flags |= SF_ACKNOW; 1741 spxstat.spxs_delack++; 1742 spx_output(cb, (struct mbuf *)NULL); 1743 } | 1736 if ((cb = (struct spxpcb *)ipxp->ipxp_pcb) != NULL && 1737 (cb->s_flags & SF_DELACK)) { 1738 cb->s_flags &= ~SF_DELACK; 1739 cb->s_flags |= SF_ACKNOW; 1740 spxstat.spxs_delack++; 1741 spx_output(cb, (struct mbuf *)NULL); 1742 } |
1743 } 1744 |
|
1744 splx(s); 1745} 1746 1747/* 1748 * spx protocol timeout routine called every 500 ms. 1749 * Updates the timers in all active pcb's and 1750 * causes finite state machine actions if timers expire. 1751 */ 1752void 1753spx_slowtimo() 1754{ | 1745 splx(s); 1746} 1747 1748/* 1749 * spx protocol timeout routine called every 500 ms. 1750 * Updates the timers in all active pcb's and 1751 * causes finite state machine actions if timers expire. 1752 */ 1753void 1754spx_slowtimo() 1755{ |
1755 register struct ipxpcb *ip, *ipnxt; | 1756 register struct ipxpcb *ip, *ip_temp; |
1756 register struct spxpcb *cb; 1757 int s = splnet(); 1758 register int i; 1759 1760 /* | 1757 register struct spxpcb *cb; 1758 int s = splnet(); 1759 register int i; 1760 1761 /* |
1761 * Search through tcb's and update active timers. | 1762 * Search through tcb's and update active timers. Note that timers 1763 * may free the ipxpcb, so be sure to handle that case. |
1762 */ | 1764 */ |
1763 ip = ipxpcb.ipxp_next; 1764 if (ip == NULL) { 1765 splx(s); 1766 return; 1767 } 1768 while (ip != &ipxpcb) { | 1765 LIST_FOREACH_SAFE(ip, &ipxpcb_list, ipxp_list, ip_temp) { |
1769 cb = ipxtospxpcb(ip); | 1766 cb = ipxtospxpcb(ip); |
1770 ipnxt = ip->ipxp_next; | |
1771 if (cb == NULL) | 1767 if (cb == NULL) |
1772 goto tpgone; | 1768 continue; |
1773 for (i = 0; i < SPXT_NTIMERS; i++) { 1774 if (cb->s_timer[i] && --cb->s_timer[i] == 0) { | 1769 for (i = 0; i < SPXT_NTIMERS; i++) { 1770 if (cb->s_timer[i] && --cb->s_timer[i] == 0) { |
1775 spx_timers(cb, i); 1776 if (ipnxt->ipxp_prev != ip) 1777 goto tpgone; | 1771 /* 1772 * spx_timers() returns (NULL) if it free'd 1773 * the pcb. 1774 */ 1775 if (spx_timers(cb, i) == NULL) 1776 continue; |
1778 } 1779 } 1780 cb->s_idle++; 1781 if (cb->s_rtt) 1782 cb->s_rtt++; | 1777 } 1778 } 1779 cb->s_idle++; 1780 if (cb->s_rtt) 1781 cb->s_rtt++; |
1783tpgone: 1784 ip = ipnxt; | |
1785 } 1786 spx_iss += SPX_ISSINCR/PR_SLOWHZ; /* increment iss */ 1787 splx(s); 1788} 1789 1790/* 1791 * SPX timer processing. 1792 */ --- 99 unchanged lines hidden --- | 1782 } 1783 spx_iss += SPX_ISSINCR/PR_SLOWHZ; /* increment iss */ 1784 splx(s); 1785} 1786 1787/* 1788 * SPX timer processing. 1789 */ --- 99 unchanged lines hidden --- |