Page MenuHomeFreeBSD

D62254.1796178604.diff
No OneTemporary

Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None

D62254.1796178604.diff

diff --git a/sys/net/netisr.h b/sys/net/netisr.h
--- a/sys/net/netisr.h
+++ b/sys/net/netisr.h
@@ -62,18 +62,22 @@
* Protocol ordering and affinity policy constants. See the detailed
* discussion of policies later in the file.
*/
-#define NETISR_POLICY_SOURCE 1 /* Maintain source ordering. */
-#define NETISR_POLICY_FLOW 2 /* Maintain flow ordering. */
-#define NETISR_POLICY_CPU 3 /* Protocol determines CPU placement. */
+typedef enum {
+ NETISR_POLICY_SOURCE = 1, /* Maintain source ordering. */
+ NETISR_POLICY_FLOW, /* Maintain flow ordering. */
+ NETISR_POLICY_CPU, /* Protocol determines CPU placement. */
+} netisr_policy_t;
/*
* Protocol dispatch policy constants; selects whether and when direct
* dispatch is permitted.
*/
-#define NETISR_DISPATCH_DEFAULT 0 /* Use global default. */
-#define NETISR_DISPATCH_DEFERRED 1 /* Always defer dispatch. */
-#define NETISR_DISPATCH_HYBRID 2 /* Allow hybrid dispatch. */
-#define NETISR_DISPATCH_DIRECT 3 /* Always direct dispatch. */
+typedef enum {
+ NETISR_DISPATCH_DEFAULT = 0, /* Use global default. */
+ NETISR_DISPATCH_DEFERRED, /* Always defer dispatch. */
+ NETISR_DISPATCH_HYBRID, /* Allow hybrid dispatch. */
+ NETISR_DISPATCH_DIRECT, /* Always direct dispatch. */
+} netisr_dispatch_t;
/*
* Monitoring data structures, exported by sysctl(2).
@@ -87,9 +91,9 @@
char snp_name[NETISR_NAMEMAXLEN]; /* nh_name */
u_int snp_proto; /* nh_proto */
u_int snp_qlimit; /* nh_qlimit */
- u_int snp_policy; /* nh_policy */
+ netisr_policy_t snp_policy; /* nh_policy */
u_int snp_flags; /* Various flags. */
- u_int snp_dispatch; /* Dispatch policy. */
+ netisr_dispatch_t snp_dispatch; /* Dispatch policy. */
u_int _snp_ispare[6];
};
@@ -192,8 +196,8 @@
netisr_drainedcpu_t *nh_drainedcpu; /* Callback when drained a queue. */
u_int nh_proto; /* Integer protocol ID. */
u_int nh_qlimit; /* Maximum per-CPU queue depth. */
- u_int nh_policy; /* Work placement policy. */
- u_int nh_dispatch; /* Dispatch policy. */
+ netisr_policy_t nh_policy; /* Work placement policy. */
+ netisr_dispatch_t nh_dispatch; /* Dispatch policy. */
u_int nh_ispare[4]; /* For future use. */
void *nh_pspare[4]; /* For future use. */
};
diff --git a/sys/net/netisr.c b/sys/net/netisr.c
--- a/sys/net/netisr.c
+++ b/sys/net/netisr.c
@@ -467,11 +467,6 @@
("%s: nh_name NULL for %u", __func__, proto));
KASSERT(nhp->nh_handler != NULL,
("%s: nh_handler NULL for %s", __func__, name));
- KASSERT(nhp->nh_policy == NETISR_POLICY_SOURCE ||
- nhp->nh_policy == NETISR_POLICY_FLOW ||
- nhp->nh_policy == NETISR_POLICY_CPU,
- ("%s: unsupported nh_policy %u for %s", __func__,
- nhp->nh_policy, name));
KASSERT(nhp->nh_policy == NETISR_POLICY_FLOW ||
nhp->nh_m2flow == NULL,
("%s: nh_policy != FLOW but m2flow defined for %s", __func__,
@@ -482,11 +477,6 @@
KASSERT(nhp->nh_policy != NETISR_POLICY_CPU || nhp->nh_m2cpuid != NULL,
("%s: nh_policy == CPU but m2cpuid not defined for %s", __func__,
name));
- KASSERT(nhp->nh_dispatch == NETISR_DISPATCH_DEFAULT ||
- nhp->nh_dispatch == NETISR_DISPATCH_DEFERRED ||
- nhp->nh_dispatch == NETISR_DISPATCH_HYBRID ||
- nhp->nh_dispatch == NETISR_DISPATCH_DIRECT,
- ("%s: invalid nh_dispatch (%u)", __func__, nhp->nh_dispatch));
KASSERT(proto < NETISR_MAXPROT,
("%s(%u, %s): protocol too big", __func__, proto, name));

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 2, 2:30 AM (22 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42135769
Default Alt Text
D62254.1796178604.diff (3 KB)

Event Timeline