| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * net busy poll support |
|---|
| 3 | 4 | * 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. |
|---|
| 17 | 5 | * |
|---|
| 18 | 6 | * Author: Eliezer Tamir |
|---|
| 19 | 7 | * |
|---|
| .. | .. |
|---|
| 43 | 31 | |
|---|
| 44 | 32 | static inline bool net_busy_loop_on(void) |
|---|
| 45 | 33 | { |
|---|
| 46 | | - return sysctl_net_busy_poll; |
|---|
| 34 | + return READ_ONCE(sysctl_net_busy_poll); |
|---|
| 47 | 35 | } |
|---|
| 48 | 36 | |
|---|
| 49 | 37 | static inline bool sk_can_busy_loop(const struct sock *sk) |
|---|
| .. | .. |
|---|
| 126 | 114 | struct napi_struct *napi) |
|---|
| 127 | 115 | { |
|---|
| 128 | 116 | #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; |
|---|
| 130 | 122 | #endif |
|---|
| 131 | 123 | } |
|---|
| 132 | 124 | |
|---|