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
...@@ -401,6 +401,7 @@ static struct tc_action_ops act_bpf_ops __read_mostly = { ...@@ -401,6 +401,7 @@ static struct tc_action_ops act_bpf_ops __read_mostly = {
.init = tcf_bpf_init, .init = tcf_bpf_init,
.size = sizeof(struct tcf_bpf), .size = sizeof(struct tcf_bpf),
}; };
MODULE_ALIAS_NET_ACT("bpf");
static __net_init int bpf_init_net(struct net *net) static __net_init int bpf_init_net(struct net *net)
{ {
......
...@@ -242,6 +242,7 @@ static struct tc_action_ops act_connmark_ops = { ...@@ -242,6 +242,7 @@ static struct tc_action_ops act_connmark_ops = {
.cleanup = tcf_connmark_cleanup, .cleanup = tcf_connmark_cleanup,
.size = sizeof(struct tcf_connmark_info), .size = sizeof(struct tcf_connmark_info),
}; };
MODULE_ALIAS_NET_ACT("connmark");
static __net_init int connmark_init_net(struct net *net) static __net_init int connmark_init_net(struct net *net)
{ {
......
...@@ -709,6 +709,7 @@ static struct tc_action_ops act_csum_ops = { ...@@ -709,6 +709,7 @@ static struct tc_action_ops act_csum_ops = {
.offload_act_setup = tcf_csum_offload_act_setup, .offload_act_setup = tcf_csum_offload_act_setup,
.size = sizeof(struct tcf_csum), .size = sizeof(struct tcf_csum),
}; };
MODULE_ALIAS_NET_ACT("csum");
static __net_init int csum_init_net(struct net *net) static __net_init int csum_init_net(struct net *net)
{ {
......
...@@ -1600,6 +1600,7 @@ static struct tc_action_ops act_ct_ops = { ...@@ -1600,6 +1600,7 @@ static struct tc_action_ops act_ct_ops = {
.offload_act_setup = tcf_ct_offload_act_setup, .offload_act_setup = tcf_ct_offload_act_setup,
.size = sizeof(struct tcf_ct), .size = sizeof(struct tcf_ct),
}; };
MODULE_ALIAS_NET_ACT("ct");
static __net_init int ct_init_net(struct net *net) static __net_init int ct_init_net(struct net *net)
{ {
......
...@@ -363,6 +363,7 @@ static struct tc_action_ops act_ctinfo_ops = { ...@@ -363,6 +363,7 @@ static struct tc_action_ops act_ctinfo_ops = {
.cleanup= tcf_ctinfo_cleanup, .cleanup= tcf_ctinfo_cleanup,
.size = sizeof(struct tcf_ctinfo), .size = sizeof(struct tcf_ctinfo),
}; };
MODULE_ALIAS_NET_ACT("ctinfo");
static __net_init int ctinfo_init_net(struct net *net) static __net_init int ctinfo_init_net(struct net *net)
{ {
......
...@@ -296,6 +296,7 @@ static struct tc_action_ops act_gact_ops = { ...@@ -296,6 +296,7 @@ static struct tc_action_ops act_gact_ops = {
.offload_act_setup = tcf_gact_offload_act_setup, .offload_act_setup = tcf_gact_offload_act_setup,
.size = sizeof(struct tcf_gact), .size = sizeof(struct tcf_gact),
}; };
MODULE_ALIAS_NET_ACT("gact");
static __net_init int gact_init_net(struct net *net) static __net_init int gact_init_net(struct net *net)
{ {
......
...@@ -645,6 +645,7 @@ static struct tc_action_ops act_gate_ops = { ...@@ -645,6 +645,7 @@ static struct tc_action_ops act_gate_ops = {
.offload_act_setup = tcf_gate_offload_act_setup, .offload_act_setup = tcf_gate_offload_act_setup,
.size = sizeof(struct tcf_gate), .size = sizeof(struct tcf_gate),
}; };
MODULE_ALIAS_NET_ACT("gate");
static __net_init int gate_init_net(struct net *net) static __net_init int gate_init_net(struct net *net)
{ {
......
...@@ -889,6 +889,7 @@ static struct tc_action_ops act_ife_ops = { ...@@ -889,6 +889,7 @@ static struct tc_action_ops act_ife_ops = {
.init = tcf_ife_init, .init = tcf_ife_init,
.size = sizeof(struct tcf_ife_info), .size = sizeof(struct tcf_ife_info),
}; };
MODULE_ALIAS_NET_ACT("ife");
static __net_init int ife_init_net(struct net *net) static __net_init int ife_init_net(struct net *net)
{ {
......
...@@ -643,6 +643,7 @@ static struct tc_action_ops act_mirred_ops = { ...@@ -643,6 +643,7 @@ static struct tc_action_ops act_mirred_ops = {
.size = sizeof(struct tcf_mirred), .size = sizeof(struct tcf_mirred),
.get_dev = tcf_mirred_get_dev, .get_dev = tcf_mirred_get_dev,
}; };
MODULE_ALIAS_NET_ACT("mirred");
static __net_init int mirred_init_net(struct net *net) static __net_init int mirred_init_net(struct net *net)
{ {
......
...@@ -452,6 +452,7 @@ static struct tc_action_ops act_mpls_ops = { ...@@ -452,6 +452,7 @@ static struct tc_action_ops act_mpls_ops = {
.offload_act_setup = tcf_mpls_offload_act_setup, .offload_act_setup = tcf_mpls_offload_act_setup,
.size = sizeof(struct tcf_mpls), .size = sizeof(struct tcf_mpls),
}; };
MODULE_ALIAS_NET_ACT("mpls");
static __net_init int mpls_init_net(struct net *net) static __net_init int mpls_init_net(struct net *net)
{ {
......
...@@ -324,6 +324,7 @@ static struct tc_action_ops act_nat_ops = { ...@@ -324,6 +324,7 @@ static struct tc_action_ops act_nat_ops = {
.cleanup = tcf_nat_cleanup, .cleanup = tcf_nat_cleanup,
.size = sizeof(struct tcf_nat), .size = sizeof(struct tcf_nat),
}; };
MODULE_ALIAS_NET_ACT("nat");
static __net_init int nat_init_net(struct net *net) static __net_init int nat_init_net(struct net *net)
{ {
......
...@@ -620,6 +620,7 @@ static struct tc_action_ops act_pedit_ops = { ...@@ -620,6 +620,7 @@ static struct tc_action_ops act_pedit_ops = {
.offload_act_setup = tcf_pedit_offload_act_setup, .offload_act_setup = tcf_pedit_offload_act_setup,
.size = sizeof(struct tcf_pedit), .size = sizeof(struct tcf_pedit),
}; };
MODULE_ALIAS_NET_ACT("pedit");
static __net_init int pedit_init_net(struct net *net) static __net_init int pedit_init_net(struct net *net)
{ {
......
...@@ -502,6 +502,7 @@ static struct tc_action_ops act_police_ops = { ...@@ -502,6 +502,7 @@ static struct tc_action_ops act_police_ops = {
.offload_act_setup = tcf_police_offload_act_setup, .offload_act_setup = tcf_police_offload_act_setup,
.size = sizeof(struct tcf_police), .size = sizeof(struct tcf_police),
}; };
MODULE_ALIAS_NET_ACT("police");
static __net_init int police_init_net(struct net *net) static __net_init int police_init_net(struct net *net)
{ {
......
...@@ -316,6 +316,7 @@ static struct tc_action_ops act_sample_ops = { ...@@ -316,6 +316,7 @@ static struct tc_action_ops act_sample_ops = {
.offload_act_setup = tcf_sample_offload_act_setup, .offload_act_setup = tcf_sample_offload_act_setup,
.size = sizeof(struct tcf_sample), .size = sizeof(struct tcf_sample),
}; };
MODULE_ALIAS_NET_ACT("sample");
static __net_init int sample_init_net(struct net *net) static __net_init int sample_init_net(struct net *net)
{ {
......
...@@ -209,6 +209,7 @@ static struct tc_action_ops act_simp_ops = { ...@@ -209,6 +209,7 @@ static struct tc_action_ops act_simp_ops = {
.init = tcf_simp_init, .init = tcf_simp_init,
.size = sizeof(struct tcf_defact), .size = sizeof(struct tcf_defact),
}; };
MODULE_ALIAS_NET_ACT("simple");
static __net_init int simp_init_net(struct net *net) static __net_init int simp_init_net(struct net *net)
{ {
......
...@@ -426,6 +426,7 @@ static struct tc_action_ops act_skbedit_ops = { ...@@ -426,6 +426,7 @@ static struct tc_action_ops act_skbedit_ops = {
.offload_act_setup = tcf_skbedit_offload_act_setup, .offload_act_setup = tcf_skbedit_offload_act_setup,
.size = sizeof(struct tcf_skbedit), .size = sizeof(struct tcf_skbedit),
}; };
MODULE_ALIAS_NET_ACT("skbedit");
static __net_init int skbedit_init_net(struct net *net) static __net_init int skbedit_init_net(struct net *net)
{ {
......
...@@ -287,6 +287,7 @@ static struct tc_action_ops act_skbmod_ops = { ...@@ -287,6 +287,7 @@ static struct tc_action_ops act_skbmod_ops = {
.cleanup = tcf_skbmod_cleanup, .cleanup = tcf_skbmod_cleanup,
.size = sizeof(struct tcf_skbmod), .size = sizeof(struct tcf_skbmod),
}; };
MODULE_ALIAS_NET_ACT("skbmod");
static __net_init int skbmod_init_net(struct net *net) static __net_init int skbmod_init_net(struct net *net)
{ {
......
...@@ -842,6 +842,7 @@ static struct tc_action_ops act_tunnel_key_ops = { ...@@ -842,6 +842,7 @@ static struct tc_action_ops act_tunnel_key_ops = {
.offload_act_setup = tcf_tunnel_key_offload_act_setup, .offload_act_setup = tcf_tunnel_key_offload_act_setup,
.size = sizeof(struct tcf_tunnel_key), .size = sizeof(struct tcf_tunnel_key),
}; };
MODULE_ALIAS_NET_ACT("tunnel_key");
static __net_init int tunnel_key_init_net(struct net *net) static __net_init int tunnel_key_init_net(struct net *net)
{ {
......
...@@ -427,6 +427,7 @@ static struct tc_action_ops act_vlan_ops = { ...@@ -427,6 +427,7 @@ static struct tc_action_ops act_vlan_ops = {
.offload_act_setup = tcf_vlan_offload_act_setup, .offload_act_setup = tcf_vlan_offload_act_setup,
.size = sizeof(struct tcf_vlan), .size = sizeof(struct tcf_vlan),
}; };
MODULE_ALIAS_NET_ACT("vlan");
static __net_init int vlan_init_net(struct net *net) static __net_init int vlan_init_net(struct net *net)
{ {
......
...@@ -328,6 +328,7 @@ static struct tcf_proto_ops cls_basic_ops __read_mostly = { ...@@ -328,6 +328,7 @@ static struct tcf_proto_ops cls_basic_ops __read_mostly = {
.bind_class = basic_bind_class, .bind_class = basic_bind_class,
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
MODULE_ALIAS_NET_CLS("basic");
static int __init init_basic(void) static int __init init_basic(void)
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment