hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/include/net/busy_poll.h
....@@ -1,19 +1,7 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * net busy poll support
34 * Copyright(c) 2013 Intel Corporation.
4
- *
5
- * This program is free software; you can redistribute it and/or modify it
6
- * under the terms and conditions of the GNU General Public License,
7
- * version 2, as published by the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope it will be useful, but WITHOUT
10
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
- * more details.
13
- *
14
- * You should have received a copy of the GNU General Public License along with
15
- * this program; if not, write to the Free Software Foundation, Inc.,
16
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
175 *
186 * Author: Eliezer Tamir
197 *
....@@ -43,7 +31,7 @@
4331
4432 static inline bool net_busy_loop_on(void)
4533 {
46
- return sysctl_net_busy_poll;
34
+ return READ_ONCE(sysctl_net_busy_poll);
4735 }
4836
4937 static inline bool sk_can_busy_loop(const struct sock *sk)
....@@ -126,7 +114,11 @@
126114 struct napi_struct *napi)
127115 {
128116 #ifdef CONFIG_NET_RX_BUSY_POLL
129
- skb->napi_id = napi->napi_id;
117
+ /* If the skb was already marked with a valid NAPI ID, avoid overwriting
118
+ * it.
119
+ */
120
+ if (skb->napi_id < MIN_NAPI_ID)
121
+ skb->napi_id = napi->napi_id;
130122 #endif
131123 }
132124