From owner-p4-projects@FreeBSD.ORG Thu Aug 4 12:42:33 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 494AB16A421; Thu, 4 Aug 2005 12:42:33 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 232FE16A41F for ; Thu, 4 Aug 2005 12:42:33 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id CB2A243D46 for ; Thu, 4 Aug 2005 12:42:32 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j74CgWwP077231 for ; Thu, 4 Aug 2005 12:42:32 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j74CgWYP077228 for perforce@freebsd.org; Thu, 4 Aug 2005 12:42:32 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Thu, 4 Aug 2005 12:42:32 GMT Message-Id: <200508041242.j74CgWYP077228@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 81443 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2005 12:42:34 -0000 http://perforce.freebsd.org/chv.cgi?CH=81443 Change 81443 by rwatson@rwatson_zoo on 2005/08/04 12:41:46 Rename IFF_OACTIVE to IFF_DRV_OACTIVE, and IFF_RUNNING to IFF_DRV_RUNNING. Comment on how and why. Make it so kernel code breaks if it uses them, but user code doesn't, for API compatibility reasons. Affected files ... .. //depot/projects/netsmp/src/sys/net/if.h#2 edit Differences ... ==== //depot/projects/netsmp/src/sys/net/if.h#2 (text+ko) ==== @@ -109,17 +109,33 @@ struct timeval ifi_lastchange; /* time of last administrative change */ }; +/* + * Interface flags are of two types: network stack owned flags, and driver + * owned flags. Historically, these values were stored in the same ifnet + * flags field, but with the advent of fine-grained locking, they have been + * broken out such that the network stack is responsible for synchronizing + * the stack-owned fields, and the device driver the device-owned fields. + * Both halves can perform lockless reads of the other half's field, subject + * to accepting the involved races. + * + * Both sets of flags come from the same number space, and should not be + * permitted to conflict, as they are exposed to user space via a single + * field. + * + * For historical reasons, the old flag names for driver flags are exposed to + * user space. + */ #define IFF_UP 0x1 /* interface is up */ #define IFF_BROADCAST 0x2 /* broadcast address valid */ #define IFF_DEBUG 0x4 /* turn on debugging */ #define IFF_LOOPBACK 0x8 /* is a loopback net */ #define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ #define IFF_SMART 0x20 /* interface manages own routes */ -#define IFF_RUNNING 0x40 /* resources allocated */ +#define IFF_DRV_RUNNING 0x40 /* resources allocated */ #define IFF_NOARP 0x80 /* no address resolution protocol */ #define IFF_PROMISC 0x100 /* receive all packets */ #define IFF_ALLMULTI 0x200 /* receive all multicast packets */ -#define IFF_OACTIVE 0x400 /* tx hardware queue is full */ +#define IFF_DRV_OACTIVE 0x400 /* tx hardware queue is full */ #define IFF_SIMPLEX 0x800 /* can't hear own transmissions */ #define IFF_LINK0 0x1000 /* per link layer defined bit */ #define IFF_LINK1 0x2000 /* per link layer defined bit */ @@ -132,6 +148,15 @@ #define IFF_STATICARP 0x80000 /* static ARP */ #define IFF_NEEDSGIANT 0x100000 /* hold Giant over if_start calls */ +/* + * Old names for driver flags so that user space tools can continue to use + * the old names. + */ +#ifndef _KERNEL +#define IFF_RUNNING IFF_DRV_RUNNING +#define IFF_OACTIVE IFF_DRV_OACTIVE +#endif + /* flags set internally only: */ #define IFF_CANTCHANGE \ (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\