Teach netisr_get_cpuid() to limit a given value to supported by netisr.
Use netisr_get_cpuid() in netisr_select_cpuid() to limit cpuid value returned by protocol to be sure that it is not greather than nws_count. PR: 211836 Reviewed by: adrian MFC after: 3 days
This commit is contained in:
parent
5f6c2d55db
commit
7c39e88ba6
@ -807,9 +807,9 @@ epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params)
|
||||
* cache locality but we can at least allow parallelism.
|
||||
*/
|
||||
sca->cpuid =
|
||||
netisr_get_cpuid(sca->ifp->if_index % netisr_get_cpucount());
|
||||
netisr_get_cpuid(sca->ifp->if_index);
|
||||
scb->cpuid =
|
||||
netisr_get_cpuid(scb->ifp->if_index % netisr_get_cpucount());
|
||||
netisr_get_cpuid(scb->ifp->if_index);
|
||||
|
||||
/* Initialise pseudo media types. */
|
||||
ifmedia_init(&sca->media, 0, epair_media_change, epair_media_status);
|
||||
|
@ -272,10 +272,7 @@ u_int
|
||||
netisr_get_cpuid(u_int cpunumber)
|
||||
{
|
||||
|
||||
KASSERT(cpunumber < nws_count, ("%s: %u > %u", __func__, cpunumber,
|
||||
nws_count));
|
||||
|
||||
return (nws_array[cpunumber]);
|
||||
return (nws_array[cpunumber % nws_count]);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -810,10 +807,12 @@ netisr_select_cpuid(struct netisr_proto *npp, u_int dispatch_policy,
|
||||
* dispatch. In the queued case, fall back on the SOURCE
|
||||
* policy.
|
||||
*/
|
||||
if (*cpuidp != NETISR_CPUID_NONE)
|
||||
if (*cpuidp != NETISR_CPUID_NONE) {
|
||||
*cpuidp = netisr_get_cpuid(*cpuidp);
|
||||
return (m);
|
||||
}
|
||||
if (dispatch_policy == NETISR_DISPATCH_HYBRID) {
|
||||
*cpuidp = curcpu;
|
||||
*cpuidp = netisr_get_cpuid(curcpu);
|
||||
return (m);
|
||||
}
|
||||
policy = NETISR_POLICY_SOURCE;
|
||||
|
Loading…
Reference in New Issue
Block a user