Project

General

Profile

patch

bad commit revert patch - masu, 05/10/2017 09:36 AM

Download (2.75 KB)

 
1
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
2
index 9d61b5345f..40a4ed52d4 100644
3
--- a/sys/netinet/udp_usrreq.c
4
+++ b/sys/netinet/udp_usrreq.c
5
@@ -198,7 +198,7 @@ static void udp_remwildcardhash(struct inpcb *inp);
6
 static __inline int
7
 udp_lportcpu(short lport)
8
 {
9
-	return (ntohs(lport) % netisr_ncpus);
10
+	return (ntohs(lport) & ncpus2_mask);
11
 }
12
 
13
 void
14
@@ -207,10 +207,10 @@ udp_init(void)
15
 	struct inpcbportinfo *portinfo;
16
 	int cpu;
17
 
18
-	portinfo = kmalloc_cachealign(sizeof(*portinfo) * netisr_ncpus, M_PCB,
19
+	portinfo = kmalloc_cachealign(sizeof(*portinfo) * ncpus2, M_PCB,
20
 	    M_WAITOK);
21
 
22
-	for (cpu = 0; cpu < netisr_ncpus; cpu++) {
23
+	for (cpu = 0; cpu < ncpus2; cpu++) {
24
 		struct inpcbinfo *uicb = &udbinfo[cpu];
25
 
26
 		/*
27
@@ -750,7 +750,7 @@ udp_notifyall_oncpu(netmsg_t msg)
28
 	in_pcbnotifyall(&udbinfo[cpu], nm->nm_faddr, nm->nm_arg, nm->nm_notify);
29
 
30
 	nextcpu = cpu + 1;
31
-	if (nextcpu < netisr_ncpus)
32
+	if (nextcpu < ncpus2)
33
 		lwkt_forwardmsg(netisr_cpuport(nextcpu), &nm->base.lmsg);
34
 	else
35
 		lwkt_replymsg(&nm->base.lmsg, 0);
36
@@ -824,7 +824,7 @@ udp_ctlinput(netmsg_t msg)
37
 	} else if (msg->ctlinput.nm_direct) {
38
 		if (cpuid != ncpus && cpuid != mycpuid)
39
 			goto done;
40
-		if (mycpuid >= netisr_ncpus)
41
+		if (mycpuid >= ncpus2)
42
 			goto done;
43
 
44
 		in_pcbnotifyall(&udbinfo[mycpuid], faddr, inetctlerrmap[cmd],
45
@@ -1281,7 +1281,7 @@ udp_inswildcardhash_oncpu(struct inpcb *inp, struct netmsg_base *msg)
46
 	    ("not on owner cpu"));
47
 
48
 	in_pcbinswildcardhash(inp);
49
-	for (cpu = 0; cpu < netisr_ncpus; ++cpu) {
50
+	for (cpu = 0; cpu < ncpus2; ++cpu) {
51
 		if (cpu == mycpuid) {
52
 			/*
53
 			 * This inpcb has been inserted by the above
54
@@ -1297,7 +1297,7 @@ udp_inswildcardhash_oncpu(struct inpcb *inp, struct netmsg_base *msg)
55
 		 * For SO_REUSEPORT socket, redistribute it based on its
56
 		 * local group index.
57
 		 */
58
-		cpu = inp->inp_lgrpindex % netisr_ncpus;
59
+		cpu = inp->inp_lgrpindex & ncpus2_mask;
60
 		if (cpu != mycpuid) {
61
 			struct lwkt_port *port = netisr_cpuport(cpu);
62
 			lwkt_msg_t lmsg = &msg->lmsg;
63
@@ -1643,7 +1643,7 @@ udp_remwildcardhash(struct inpcb *inp)
64
 	KASSERT(inp->inp_pcbinfo == &udbinfo[mycpuid],
65
 	    ("not on owner cpu"));
66
 
67
-	for (cpu = 0; cpu < netisr_ncpus; ++cpu) {
68
+	for (cpu = 0; cpu < ncpus2; ++cpu) {
69
 		if (cpu == mycpuid) {
70
 			/*
71
 			 * This inpcb will be removed by the later
72
@@ -1738,7 +1738,7 @@ udp_detach_oncpu_dispatch(netmsg_t msg)
73
 	}
74
 
75
 	nextcpu = cpuid + 1;
76
-	if (nextcpu < netisr_ncpus) {
77
+	if (nextcpu < ncpus2) {
78
 		lwkt_forwardmsg(netisr_cpuport(nextcpu), &clomsg->lmsg);
79
 	} else {
80
 		/*
81
@@ -1785,7 +1785,7 @@ udp_detach(netmsg_t msg)
82
 	 */
83
 	lwkt_replymsg(&msg->detach.base.lmsg, EJUSTRETURN);
84
 
85
-	if (netisr_ncpus == 1) {
86
+	if (ncpus2 == 1) {
87
 		/* Only one CPU, detach the inpcb directly. */
88
 		udp_detach2(so);
89
 		return;