From owner-freebsd-hackers Tue Nov 21 05:36:31 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id FAA20778 for hackers-outgoing; Tue, 21 Nov 1995 05:36:31 -0800 Received: from fun.inria.fr (fun.inria.fr [138.96.24.57]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id FAA20768 for ; Tue, 21 Nov 1995 05:36:26 -0800 Received: by fun.inria.fr (8.6.12/8.6.12) id OAA18209; Tue, 21 Nov 1995 14:29:48 +0100 Message-Id: <199511211329.OAA18209@fun.inria.fr> X-Mailer: exmh version 1.6.2 7/18/95 To: hackers@freebsd.org Subject: Re: Notion of time in kernel + malloc + new comment In-reply-to: your message of Mon, 20 Nov 1995 20:35:33 +0100. Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 21 Nov 1995 14:29:47 +0100 From: Andres Vega Garcia Sender: owner-hackers@freebsd.org Precedence: bulk : Andres Vega Garcia 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 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