Commit 241a94ab authored by Michal Koutný's avatar Michal Koutný Committed by Jakub Kicinski
Browse files

net/sched: Add module aliases for cls_,sch_,act_ modules



No functional change intended, aliases will be used in followup commits.
Note for backporters: you may need to add aliases also for modules that
are already removed in mainline kernel but still in your version.

Patches were generated with the help of Coccinelle scripts like:

cat >scripts/coccinelle/misc/tcf_alias.cocci <<EOD
virtual patch
virtual report

@ haskernel @
@@

@ tcf_has_kind depends on report && haskernel @
identifier ops;
constant K;
@@

  static struct tcf_proto_ops ops = {
    .kind = K,
    ...
  };
+char module_alias = K;
EOD

/usr/bin/spatch -D report --cocci-file scripts/coccinelle/misc/tcf_alias.cocci \
        --dir . \
        -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include \
        -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi \
        -I ./include/uapi -I ./include/generated/uapi \
        --include ./include/linux/compiler-version.h --include ./include/linux/kconfig.h \
        --jobs 8 --chunksize 1 2>/dev/null | \
        sed 's/char module_alias = "\([^"]*\)";/MODULE_ALIAS_NET_CLS("\1");/'

And analogously for:

  static struct tc_action_ops ops = {
    .kind = K,

  static struct Qdisc_ops ops = {
    .id = K,

(Someone familiar would be able to fit those into one .cocci file
without sed post processing.)

Signed-off-by: default avatarMichal Koutný <mkoutny@suse.com>
Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20240201130943.19536-3-mkoutny@suse.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent b2657700
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -401,6 +401,7 @@ static struct tc_action_ops act_bpf_ops __read_mostly = {
	.init		=	tcf_bpf_init,
	.size		=	sizeof(struct tcf_bpf),
};
MODULE_ALIAS_NET_ACT("bpf");

static __net_init int bpf_init_net(struct net *net)
{
+1 −0
Original line number Diff line number Diff line
@@ -242,6 +242,7 @@ static struct tc_action_ops act_connmark_ops = {
	.cleanup	=	tcf_connmark_cleanup,
	.size		=	sizeof(struct tcf_connmark_info),
};
MODULE_ALIAS_NET_ACT("connmark");

static __net_init int connmark_init_net(struct net *net)
{
+1 −0
Original line number Diff line number Diff line
@@ -709,6 +709,7 @@ static struct tc_action_ops act_csum_ops = {
	.offload_act_setup = tcf_csum_offload_act_setup,
	.size		= sizeof(struct tcf_csum),
};
MODULE_ALIAS_NET_ACT("csum");

static __net_init int csum_init_net(struct net *net)
{
+1 −0
Original line number Diff line number Diff line
@@ -1600,6 +1600,7 @@ static struct tc_action_ops act_ct_ops = {
	.offload_act_setup =	tcf_ct_offload_act_setup,
	.size		=	sizeof(struct tcf_ct),
};
MODULE_ALIAS_NET_ACT("ct");

static __net_init int ct_init_net(struct net *net)
{
+1 −0
Original line number Diff line number Diff line
@@ -363,6 +363,7 @@ static struct tc_action_ops act_ctinfo_ops = {
	.cleanup= tcf_ctinfo_cleanup,
	.size	= sizeof(struct tcf_ctinfo),
};
MODULE_ALIAS_NET_ACT("ctinfo");

static __net_init int ctinfo_init_net(struct net *net)
{
Loading