-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: extend drop reasons for multiple subsystems
Extend drop reasons to make them usable by subsystems other than core by reserving the high 16 bits for a new subsystem ID, of which 0 of course is used for the existing reasons immediately. To still be able to have string reasons, restructure that code a bit to make the loopup under RCU, the only user of this (right now) is drop_monitor. Link: https://lore.kernel.org/netdev/00659771ed54353f92027702c5bbb84702da62ce.camel@sipsolutions.net Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
- Loading branch information
Johannes Berg
authored and
Jakub Kicinski
committed
Apr 21, 2023
1 parent
5b8285c
commit 071c0fc
Showing
4 changed files
with
121 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
|
||
#ifndef _LINUX_DROPREASON_H | ||
#define _LINUX_DROPREASON_H | ||
#include <net/dropreason-core.h> | ||
|
||
/** | ||
* enum skb_drop_reason_subsys - subsystem tag for (extended) drop reasons | ||
*/ | ||
enum skb_drop_reason_subsys { | ||
/** @SKB_DROP_REASON_SUBSYS_CORE: core drop reasons defined above */ | ||
SKB_DROP_REASON_SUBSYS_CORE, | ||
|
||
/** @SKB_DROP_REASON_SUBSYS_NUM: number of subsystems defined */ | ||
SKB_DROP_REASON_SUBSYS_NUM | ||
}; | ||
|
||
struct drop_reason_list { | ||
const char * const *reasons; | ||
size_t n_reasons; | ||
}; | ||
|
||
/* Note: due to dynamic registrations, access must be under RCU */ | ||
extern const struct drop_reason_list __rcu * | ||
drop_reasons_by_subsys[SKB_DROP_REASON_SUBSYS_NUM]; | ||
|
||
void drop_reasons_register_subsys(enum skb_drop_reason_subsys subsys, | ||
const struct drop_reason_list *list); | ||
void drop_reasons_unregister_subsys(enum skb_drop_reason_subsys subsys); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters