diff options
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/uts/common/io/mac/mac.c | 8 | ||||
-rw-r--r-- | usr/src/uts/common/sys/mac_provider.h | 14 |
2 files changed, 18 insertions, 4 deletions
diff --git a/usr/src/uts/common/io/mac/mac.c b/usr/src/uts/common/io/mac/mac.c index e0884e41f4..91d7aab331 100644 --- a/usr/src/uts/common/io/mac/mac.c +++ b/usr/src/uts/common/io/mac/mac.c @@ -417,11 +417,11 @@ mac_init(void) /* * Allocate an id space to manage minor numbers. The range of the - * space will be from MAC_MAX_MINOR+1 to MAXMIN32 (maximum legal - * minor number is MAXMIN, but id_t is type of integer and does not - * allow MAXMIN). + * space will be from MAC_MAX_MINOR+1 to MAC_PRIVATE_MINOR-1. This + * leaves half of the 32-bit minors available for driver private use. */ - minor_ids = id_space_create("mac_minor_ids", MAC_MAX_MINOR+1, MAXMIN32); + minor_ids = id_space_create("mac_minor_ids", MAC_MAX_MINOR+1, + MAC_PRIVATE_MINOR-1); ASSERT(minor_ids != NULL); minor_count = 0; diff --git a/usr/src/uts/common/sys/mac_provider.h b/usr/src/uts/common/sys/mac_provider.h index f56147eebb..9caf0db25b 100644 --- a/usr/src/uts/common/sys/mac_provider.h +++ b/usr/src/uts/common/sys/mac_provider.h @@ -31,6 +31,7 @@ #include <sys/ddi.h> #include <sys/sunddi.h> #include <sys/stream.h> +#include <sys/mkdev.h> #include <sys/mac_flow.h> #include <sys/mac.h> @@ -49,6 +50,19 @@ extern "C" { #define MAC_VERSION 0x2 /* + * This is the first minor number available for MAC provider private + * use. This makes it possible to deliver a driver that is both a MAC + * provider and a regular character/block device. See PSARC 2009/380 + * for more detail about the construction of such devices. The value + * chosen leaves half of the 32-bit minor numbers (which are really + * only 18 bits wide) available for driver private use. Drivers can + * easily identify their private number by the presence of this value + * in the bits that make up the minor number, since its just the + * highest bit available for such minor numbers. + */ +#define MAC_PRIVATE_MINOR ((MAXMIN32 + 1) / 2) + +/* * Opaque handle types */ typedef struct __mac_rule_handle *mac_rule_handle_t; |