Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Nov 1995 14:29:47 +0100
From:      Andres Vega Garcia <Andres.Vega_Garcia@sophia.inria.fr>
To:        hackers@freebsd.org
Subject:   Re: Notion of time in kernel + malloc + new comment
Message-ID:  <199511211329.OAA18209@fun.inria.fr>
In-Reply-To: your message of Mon, 20 Nov 1995 20:35:33 %2B0100.

next in thread | raw e-mail | index | archive | help
: Andres Vega Garcia <Andres.Vega_Garcia@sophia.inria.fr> wrote:
 
	OK, thank you for all your answers.
 
> I 
>need to have a notion of time (seconds (or tens of seconds) elapsed 
>since ...).

	I'm keeping the solution:

	#include <sys/kernel.h>

 	int s = splclock();
 	long  cur_time = time.tv_sec;
 	splx(s);

>
>	I have realized that in order to do malloc I need the "kernel" call 
>to malloc. As this is related with the ethernet drivers (and ppp), I 
>decided to use:

	For malloc, I do the way if_attach does (M_WAITOK):

	malloc(sizeof(fs_ctx_t),M_DEVBUF,M_WAITOK) for the per interface 
structures.

and 
	malloc(sizeof(fs_ses_t),M_DEVBUF,M_NOWAIT) for the dynamic 
srtuctures.

	=> The new comment:

	By now I'm replacing (some) calls to IF_ENQUEUE & IF_DEQUEUE, but I 
do that for every driver I want to modify. It would be very nice just 
to modify IF_ENQUEUE and IF_DEQUEUE and let the new policy take 
effect automatically in every driver, but:

	* I need to retrive a context information, which now, I get by 
indexing with `if_unit' and then calling the new function (e.g. 
fs_enqueue) with the pointer to the structure (the context) (as well 
as the old parameters).

	* I need to distinguish the different sessions (for IP, source and 
destination address and port), then, I need a lookup with the 
sockaddr structure. By now, that has to be done for every driver too.

	Do you see a way of not having to modify every driver?

	Does modifying IF_ENQUEUE and IF_DEQUEUE can have side effects for 
other code? Remember with fair queueing I want to give every session 
the same bandwidth, but what happens with drivers which control a 
device, where the notion of several conexions passing trough doesn't 
exist?

	Thank you in advance.

Andres

------------------------------
INRIA Sophia-Antipolis, France
      avega@fun.inria.fr




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199511211329.OAA18209>