diff mbox series

[net] net: add no-op for napi_busy_loop if CONFIG_NET_RX_BUSY_POLL=n

Message ID 20230223012258.1701175-1-jacob.e.keller@intel.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net] net: add no-op for napi_busy_loop if CONFIG_NET_RX_BUSY_POLL=n | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 84 this patch: 84
netdev/cc_maintainers fail 4 blamed authors not CCed: alexander.h.duyck@intel.com edumazet@google.com sridhar.samudrala@intel.com davem@davemloft.net; 6 maintainers not CCed: alexander.h.duyck@intel.com pabeni@redhat.com kuba@kernel.org edumazet@google.com sridhar.samudrala@intel.com davem@davemloft.net
netdev/build_clang success Errors and warnings before: 2 this patch: 2
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 84 this patch: 84
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 13 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jacob Keller Feb. 23, 2023, 1:22 a.m. UTC
Commit 7db6b048da3b ("net: Commonize busy polling code to focus on napi_id
instead of socket") introduced napi_busy_loop and refactored sk_busy_loop
to call this new function. The commit removed the no-op implementation of
sk_busy_loop in the #else block for CONFIG_NET_RX_BUSY_POLL, and placed the
declaration of napi_busy_poll inside the # block where sk_busy_loop used to
be declared.

Because of this, if a module tries to use napi_busy_loop it must wrap the
use inside a IS_ENABLED(CONFIG_NET_RX_BUSY_POLL) check, as the function is
not declared when this is false.

The original sk_busy_loop function had both a declaration and a no-op
variant when the config flag was set to N. Do the same for napi_busy_loop
by adding a no-op implementation in the #else block as expected.

Fixes: 7db6b048da3b ("net: Commonize busy polling code to focus on napi_id instead of socket")
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 include/net/busy_poll.h | 7 +++++++
 1 file changed, 7 insertions(+)


base-commit: 5b7c4cabbb65f5c469464da6c5f614cbd7f730f2

Comments

Jakub Kicinski Feb. 23, 2023, 4:53 a.m. UTC | #1
On Wed, 22 Feb 2023 17:22:58 -0800 Jacob Keller wrote:
> Commit 7db6b048da3b ("net: Commonize busy polling code to focus on napi_id
> instead of socket") introduced napi_busy_loop and refactored sk_busy_loop
> to call this new function. The commit removed the no-op implementation of
> sk_busy_loop in the #else block for CONFIG_NET_RX_BUSY_POLL, and placed the
> declaration of napi_busy_poll inside the # block where sk_busy_loop used to
> be declared.
> 
> Because of this, if a module tries to use napi_busy_loop it must wrap the
> use inside a IS_ENABLED(CONFIG_NET_RX_BUSY_POLL) check, as the function is
> not declared when this is false.
> 
> The original sk_busy_loop function had both a declaration and a no-op
> variant when the config flag was set to N. Do the same for napi_busy_loop
> by adding a no-op implementation in the #else block as expected.
> 
> Fixes: 7db6b048da3b ("net: Commonize busy polling code to focus on napi_id instead of socket")

We need a reference to which module needs this or a Kconfig snippet 
+ build failure output.
Jacob Keller Feb. 23, 2023, 10:47 p.m. UTC | #2
On 2/22/2023 8:53 PM, Jakub Kicinski wrote:
> On Wed, 22 Feb 2023 17:22:58 -0800 Jacob Keller wrote:
>> Commit 7db6b048da3b ("net: Commonize busy polling code to focus on napi_id
>> instead of socket") introduced napi_busy_loop and refactored sk_busy_loop
>> to call this new function. The commit removed the no-op implementation of
>> sk_busy_loop in the #else block for CONFIG_NET_RX_BUSY_POLL, and placed the
>> declaration of napi_busy_poll inside the # block where sk_busy_loop used to
>> be declared.
>>
>> Because of this, if a module tries to use napi_busy_loop it must wrap the
>> use inside a IS_ENABLED(CONFIG_NET_RX_BUSY_POLL) check, as the function is
>> not declared when this is false.
>>
>> The original sk_busy_loop function had both a declaration and a no-op
>> variant when the config flag was set to N. Do the same for napi_busy_loop
>> by adding a no-op implementation in the #else block as expected.
>>
>> Fixes: 7db6b048da3b ("net: Commonize busy polling code to focus on napi_id instead of socket")
> 
> We need a reference to which module needs this or a Kconfig snippet 
> + build failure output.

Hm, fair. I found this while investigating something else with code not
yet submitted that uses this function in the ice driver without checking
CONFIG_NET_RX_BUSY_POLL. I assumed this would be a problem somewhere
else too...

However, I just looked through the current tree and the only user of
napi_busy_loop happens to be under a CONFIG_NET_RX_BUSY_POLL check
already so I don't think this is possible to trigger with any in-tree
code at present.

Thanks,
Jake
diff mbox series

Patch

diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h
index f90f0021f5f2..8f84f6202f1c 100644
--- a/include/net/busy_poll.h
+++ b/include/net/busy_poll.h
@@ -58,6 +58,13 @@  static inline bool sk_can_busy_loop(struct sock *sk)
 	return false;
 }
 
+static inline void
+napi_busy_loop(unsigned int napi_id,
+	       bool (*loop_end)(void *, unsigned long),
+	       void *loop_end_arg, bool prefer_busy_poll, u16 budget)
+{
+}
+
 #endif /* CONFIG_NET_RX_BUSY_POLL */
 
 static inline unsigned long busy_loop_current_time(void)