the contrib part of thread priority patch by floriZ.Also take out unused unix netifs from unixsim makefile for now

This commit is contained in:
jani 2003-03-19 15:28:31 +00:00
parent 1b789f74aa
commit 0749599eab
20 changed files with 39 additions and 35 deletions

View File

@ -114,7 +114,7 @@ sys_arch_timeouts(void)
}
/*-----------------------------------------------------------------------------------*/
sys_thread_t
sys_thread_new(void (* function)(void *arg), void *arg)
sys_thread_new(void (* function)(void *arg), void *arg, int prio)
{
return 0;
}

View File

@ -741,7 +741,7 @@ etharp_timer_thread(void *arg)
static void
etharp_timer_init(void *arg)
{
sys_thread_new((void *)etharp_timer_thread, arg);
sys_thread_new((void *)etharp_timer_thread, arg, DEFAULT_THREAD_PRIO);
}

View File

@ -200,4 +200,17 @@ a lot of data that needs to be copied, this should be set high. */
#define LWIP_COMPAT_SOCKETS 1
#define LWIP_PROVIDE_ERRNO 1
/* People often make a mistake on the priority of their communications task.
The TCP/IP stack should be at a relatively low priority if it is an endpoint
(not a router) on a somewhat underpowered CPU. You are'nt going to keep up
with network traffic during a denial of service attack or misconfigured network
and you don't want an overburdened network task to cause other important tasks
(including your UI) to stop working. Drop packets! It forces flow control and
lets the rest of your system run.
*/
#define TCPIP_THREAD_PRIO 220 // Relatively low priority
#define DEFAULT_THREAD_PRIO 240
#endif /* __LWIPOPTS_H__ */

View File

@ -73,15 +73,6 @@ static struct sys_hisr *hisrs = NULL;
#define SYS_MBOX_SIZE 128 // Number of elements in mbox queue
#define SYS_STACK_SIZE 2048 // A minimum Nucleus stack for coldfire
#define SYS_HISR_STACK_SIZE 2048 // A minimum Nucleus stack for coldfire
/* People often make a mistake on the priority of their communications task.
The TCP/IP stack should be at a relatively low priority if it is an endpoint
(not a router) on a somewhat underpowered CPU. You are'nt going to keep up
with network traffic during a denial of service attack or misconfigured network
and you don't want an overburdened network task to cause other important tasks
(including your UI) to stop working. Drop packets! It forces flow control and
lets the rest of your system run.
*/
#define SYS_THREAD_PRIORITY 220 // Relatively low priority
/*---------------------------------------------------------------------------------*/
void
@ -127,7 +118,7 @@ introduce_thread(NU_TASK *id, void (*function)(void *arg), void *arg)
/* We use Nucleus task as thread. Create one with a standard size stack at a standard
* priority. */
sys_thread_t
sys_thread_new(void (*function)(void *arg), void *arg)
sys_thread_new(void (*function)(void *arg), void *arg, int prio)
{
NU_TASK *p_thread;
u8_t *p_stack;
@ -156,7 +147,7 @@ sys_thread_new(void (*function)(void *arg), void *arg)
st,
p_stack,
SYS_STACK_SIZE,
SYS_THREAD_PRIORITY,
prio,
0, //Disable timeslicing
NU_PREEMPT,
NU_START);

View File

@ -164,7 +164,7 @@ sioslipif_init(struct netif *netif)
netif->output = sioslipif_output;
netif_pass = netif;
sys_thread_new((void *)sioslipif_loop, NULL);
sys_thread_new((void *)sioslipif_loop, NULL, DEFAULT_THREAD_PRIO);
/* Do some magic to make it possible to receive data from the serial I/O device. */
}
/*-----------------------------------------------------------------------------------*/

View File

@ -242,10 +242,10 @@ sys_thread(void)
}
/*-----------------------------------------------------------------------------------*/
sys_thread_t
sys_thread_new(void (* function)(void *arg), void *arg)
sys_thread_new(void (* function)(void *arg), void *arg, int prio)
{
TASK newtask;
PRIORITY pri = 2; /* This may have to be changed. */
PRIORITY pri = prio; /* This may have to be changed. */
char *stack;
int stacksize = 512; /* This may have to be changed. */
struct sys_thread_arg threadarg;

View File

@ -36,9 +36,9 @@
#include <string.h>
/* Define platform endianness */
#ifndef BYTE_ORDER
#define BYTE_ORDER LITTLE_ENDIAN
#endif /* BYTE_ORDER */
//#ifndef BYTE_ORDER
//#define BYTE_ORDER LITTLE_ENDIAN
//#endif /* BYTE_ORDER */
/* Define generic types used in lwIP */
typedef unsigned char u8_t;

View File

@ -314,7 +314,7 @@ delif_init_thread(struct netif *netif)
del->netif->netmask = netif->netmask;
del->input = netif->input;
del->netif->input = delif_input;
sys_thread_new(delif_thread, netif);
sys_thread_new(delif_thread, netif, DEFAULT_THREAD_PRIO);
return ERR_OK;
}

View File

@ -209,7 +209,7 @@ pcapif_init(struct netif *netif)
p->p = NULL;
p->lasttime = 0;
sys_thread_new(pcapif_thread, netif);
sys_thread_new(pcapif_thread, netif, DEFAULT_THREAD_PRIO);
return ERR_OK;
}
/*-----------------------------------------------------------------------------------*/

View File

@ -126,7 +126,7 @@ low_level_init(struct netif *netif)
DEBUGF(TAPIF_DEBUG, ("tapif_init: system(\"%s\");\n", buf));
system(buf);
sys_thread_new(tapif_thread, netif);
sys_thread_new(tapif_thread, netif, DEFAULT_THREAD_PRIO);
}
/*-----------------------------------------------------------------------------------*/

View File

@ -97,7 +97,7 @@ low_level_init(struct netif *netif)
DEBUGF(TUNIF_DEBUG, ("tunif_init: system(\"%s\");\n", buf));
system(buf);
sys_thread_new(tunif_thread, netif);
sys_thread_new(tunif_thread, netif, DEFAULT_THREAD_PRIO);
}
/*-----------------------------------------------------------------------------------*/

View File

@ -452,8 +452,8 @@ unixif_init_server(struct netif *netif)
unixif->fd = fd2;
unixif->sem = sys_sem_new(0);
sys_thread_new(unixif_thread, netif);
sys_thread_new(unixif_thread2, netif);
sys_thread_new(unixif_thread, netif, DEFAULT_THREAD_PRIO);
sys_thread_new(unixif_thread2, netif, DEFAULT_THREAD_PRIO);
return ERR_OK;
}
/*-----------------------------------------------------------------------------------*/
@ -476,8 +476,8 @@ unixif_init_client(struct netif *netif)
}
unixif->q = list_new(UNIXIF_QUEUELEN);
unixif->sem = sys_sem_new(0);
sys_thread_new(unixif_thread, netif);
sys_thread_new(unixif_thread2, netif);
sys_thread_new(unixif_thread, netif, DEFAULT_THREAD_PRIO);
sys_thread_new(unixif_thread2, netif, DEFAULT_THREAD_PRIO);
return ERR_OK;
}
/*-----------------------------------------------------------------------------------*/

View File

@ -66,7 +66,7 @@ NETIFFILES=$(LWIPDIR)/netif/loopif.c \
$(LWIPDIR)/netif/etharp.c $(LWIPDIR)/netif/slipif.c
# ARCHFILES: Architecture specific files.
ARCHFILES=$(wildcard $(LWIPARCH)/*.c $(LWIPARCH)/netif/*.c)
ARCHFILES=$(wildcard $(LWIPARCH)/*.c $(LWIPARCH)/netif/tapif.c $(LWIPARCH)/netif/tcpdump.c)
# APPFILES: Applications.
APPFILES=apps/fs.c apps/httpd.c \

View File

@ -1052,7 +1052,7 @@ shell_thread(void *arg)
void
shell_init(void)
{
sys_thread_new(shell_thread, NULL);
sys_thread_new(shell_thread, NULL, DEFAULT_THREAD_PRIO);
}

View File

@ -80,7 +80,7 @@ tcpecho_thread(void *arg)
void
tcpecho_init(void)
{
sys_thread_new(tcpecho_thread, NULL);
sys_thread_new(tcpecho_thread, NULL, DEFAULT_THREAD_PRIO);
}
/*-----------------------------------------------------------------------------------*/

View File

@ -62,5 +62,5 @@ udpecho_thread(void *arg)
void
udpecho_init(void)
{
sys_thread_new(udpecho_thread, NULL);
sys_thread_new(udpecho_thread, NULL, DEFAULT_THREAD_PRIO);
}

View File

@ -174,7 +174,7 @@ main(int argc, char **argv)
printf("System initialized.\n");
sys_thread_new((void *)(main_thread), NULL);
sys_thread_new((void *)(main_thread), NULL, DEFAULT_THREAD_PRIO);
pause();
return 0;
}

View File

@ -139,7 +139,7 @@ main(int argc, char **argv)
printf("System initialized.\n");
sys_thread_new((void *)(main_thread), NULL);
sys_thread_new((void *)(main_thread), NULL, DEFAULT_THREAD_PRIO);
pause();
return 0;
}

View File

@ -150,7 +150,7 @@ main(int argc, char **argv)
printf("System initialized.\n");
sys_thread_new((void *)(main_thread), NULL);
sys_thread_new((void *)(main_thread), NULL, DEFAULT_THREAD_PRIO);
pause();
return 0;
}

View File

@ -151,7 +151,7 @@ current_thread(void)
}
/*-----------------------------------------------------------------------------------*/
sys_thread_t
sys_thread_new(void (*function)(void *arg), void *arg)
sys_thread_new(void (*function)(void *arg), void *arg, int prio)
{
int code;
pthread_t tmp;