From owner-freebsd-net Wed Oct 24 18:35:54 2001 Delivered-To: freebsd-net@freebsd.org Received: from prism.flugsvamp.com (cb58709-a.mdsn1.wi.home.com [24.17.241.9]) by hub.freebsd.org (Postfix) with ESMTP id D70FC37B405 for ; Wed, 24 Oct 2001 18:35:50 -0700 (PDT) Received: (from jlemon@localhost) by prism.flugsvamp.com (8.11.0/8.11.0) id f9P1YJt18085; Wed, 24 Oct 2001 20:34:19 -0500 (CDT) (envelope-from jlemon) Date: Wed, 24 Oct 2001 20:34:19 -0500 (CDT) From: Jonathan Lemon Message-Id: <200110250134.f9P1YJt18085@prism.flugsvamp.com> To: rizzo@aciri.org, net@freebsd.org Subject: Re: struct ifnet changes X-Newsgroups: local.mail.freebsd-stable In-Reply-To: Organization: Cc: Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org In article you write: >Hi, >in order to add polling support to network interfaces >i need to add one more flag to network interface descriptors, >but the relevant field in struct ifnet (if_flags) is only 16 bit >wide and already fully used. > >I would like to extend it to 32 bit, which is not a problem in >CURRENT, but doing this in STABLE will break binary compatibility >with older drivers (presumably up to FreeBSD 4.2, as between 4.1 >and 4.2 there were other changes that probably prevent the use of >old binary drivers). > >Are there strong objections to this change ? > >I can avoid breaking binary compatibility by using some other unused >field (e.g. if_ipending, which is currently unused), but i'd rather >not have to, because we risk to carry this dirty hack forever. > >If I am allowed to make changes to the structure, I would do the following: > > + change if_flags to an u_int32_t to accommodate more flags, > and move it to the beginning of the structure -- this is > accessed very very frequently, and this change makes the > kernel 200 bytes smaller, and possibly a bit faster; > > + remove if_ipending -- noone is using it; > > + change if_index to u_int32_t (mostly to preserve alignment > of the remaining fields); > > + maybe change if_unit and if_timer to 32 bit, for better alignment > and code efficiency > > + redefine some of the (currently unused) fields for polling > support. This does not compromise binary compatibility > because the field size and position will remain the same, > only the type will change. > >Comments ? Hmm, I think you would be better off sending this to -net, not -stable. :-) A few things: - I've been kicking around the idea of splitting if_flags into two fields, to better handle locking issues. Some of the fields are accessed by the driver frequently (OACTIVE), while others are more static. However, I haven't figured out whether this is needed or not. - I also have a few changes for polling support of my own, I use the poll_xmit/poll_recv slots in the dispatch table - You mention moving if_flags to the first element, is there any code that assumes that if_softc is the first element in the ifnet? Putting at the start of the second cache line might be another option. -- Jonathan To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message