Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Oct 2001 20:34:19 -0500 (CDT)
From:      Jonathan Lemon <jlemon@flugsvamp.com>
To:        rizzo@aciri.org, net@freebsd.org
Subject:   Re: struct ifnet changes
Message-ID:  <200110250134.f9P1YJt18085@prism.flugsvamp.com>
In-Reply-To: <local.mail.freebsd-stable/20011024171142.A48147@iguana.aciri.org>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <local.mail.freebsd-stable/20011024171142.A48147@iguana.aciri.org> 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




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