#include <sys/mbuf.h>
#include <sys/ioctl.h>
#include <sys/malloc.h>
+#include <kern/locks.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
void rtmp_timeout();
void rtmp_send_port();
-void rtmp_send_port_funnel();
+void rtmp_send_port_locked();
void rtmp_dropper(void *);
void rtmp_shutdown();
static void rtmp_update();
extern pktsIn, pktsOut, pktsDropped, pktsHome;
extern short ErrorRTMPoverflow, ErrorZIPoverflow;
extern atlock_t ddpinp_lock;
+extern lck_mtx_t * atalk_mutex;
/*
* rtmp_router_input: function called by DDP (in router mode) to handle
register unsigned int s;
short i;
RT_entry *en = &RT_table[0];
- boolean_t funnel_state;
- funnel_state = thread_funnel_set(network_flock, TRUE);
+ atalk_lock();
if (ifID->ifRoutingState < PORT_ONLINE) {
- (void) thread_funnel_set(network_flock, FALSE);
+ atalk_unlock();
return;
}
ATENABLE(s, ddpinp_lock);
timeout(rtmp_timeout, (caddr_t) ifID, 20*SYS_HZ);
- (void) thread_funnel_set(network_flock, FALSE);
+ atalk_unlock();
}
/*
}
-/* funnel version of rtmp_send_port */
-void rtmp_send_port_funnel(ifID)
+/* locked version of rtmp_send_port */
+void rtmp_send_port_locked(ifID)
register at_ifaddr_t *ifID;
{
- thread_funnel_set(network_flock, TRUE);
+ atalk_lock();
rtmp_send_port(ifID);
- thread_funnel_set(network_flock, FALSE);
+ atalk_unlock();
}
dPrintf(D_M_RTMP_LOW, D_L_TRACE,
("rtmp_send_port: func=0x%x, ifID=0x%x\n",
(u_int) rtmp_send_port, (u_int) ifID));
- timeout (rtmp_send_port_funnel, (caddr_t)ifID, 10 * SYS_HZ);
+ timeout (rtmp_send_port_locked, (caddr_t)ifID, 10 * SYS_HZ);
}
void rtmp_dropper(void *arg)
{
- boolean_t funnel_state;
- funnel_state = thread_funnel_set(network_flock, TRUE);
+ atalk_lock();
pktsIn = pktsOut = pktsHome = pktsDropped = 0;
timeout(rtmp_dropper, NULL, 2*SYS_HZ);
- (void) thread_funnel_set(network_flock, FALSE);
+ atalk_unlock();
}
/*
register short Index, router_starting_timer = 0;
register RT_entry *Entry;
register at_net_al netStart, netStop;
- boolean_t funnel_state;
+ struct timespec ts;
- funnel_state = thread_funnel_set(network_flock, TRUE);
/* clear the static structure used to record routing errors */
bzero(&ke, sizeof(ke));
goto error;
}
- /* sleep for 10 seconds */
+ /* sleep for 11 seconds */
+ ts.tv_sec = 11;
+ ts.tv_nsec = 0;
if ((err =
/* *** eventually this will be the ifID for the interface
being brought up in router mode *** */
/* *** router sends rtmp packets every 10 seconds *** */
- tsleep(&ifID_home->startup_inprogress,
- PSOCK | PCATCH, "router_start1", (10+1) * SYS_HZ))
+ msleep(&ifID_home->startup_inprogress, atalk_mutex,
+ PSOCK | PCATCH, "router_start1", &ts))
!= EWOULDBLOCK) {
goto error;
}
dPrintf(D_M_RTMP, D_L_STARTUP,
("rtmp_router_start: waiting for zone info to complete\n"));
/* sleep for 10 seconds */
+ ts.tv_sec = 10;
+ ts.tv_nsec = 0;
if ((err =
/* *** eventually this will be the ifID for the
interface being brought up in router mode *** */
- tsleep(&ifID_home->startup_inprogress,
- PSOCK | PCATCH, "router_start2", 10 * SYS_HZ))
+ msleep(&ifID_home->startup_inprogress, atalk_mutex,
+ PSOCK | PCATCH, "router_start2", &ts))
!= EWOULDBLOCK) {
goto error;
}
/* prepare the packet dropper timer */
timeout (rtmp_dropper, NULL, 1*SYS_HZ);
- (void) thread_funnel_set(network_flock, funnel_state);
return(0);
error:
dPrintf(D_M_RTMP,D_L_ERROR,
- ("rtmp_router_start: error type=%d occured on port %d\n",
+ ("rtmp_router_start: error type=%d occurred on port %d\n",
ifID->ifRoutingState, ifID->ifPort));
/* if there's no keP->error, copy the local ke structure,
- since the error occured asyncronously */
+ since the error occurred asyncronously */
if ((!keP->error) && ke.error)
bcopy(&ke, keP, sizeof(ke));
rtmp_shutdown();
/* to return the error in keP, the ioctl has to return 0 */
- (void) thread_funnel_set(network_flock, funnel_state);
return((keP->error)? 0: err);
} /* rtmp_router_start */
TAILQ_FOREACH(ifID, &at_ifQueueHd, aa_link) {
if (ifID->ifRoutingState > PORT_OFFLINE ) {
if (ifID->ifRoutingState == PORT_ONLINE) {
- untimeout(rtmp_send_port_funnel, (caddr_t)ifID);
+ untimeout(rtmp_send_port_locked, (caddr_t)ifID);
untimeout(rtmp_timeout, (caddr_t) ifID);
}
/*