All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] Fix IFE meta modules loading
@ 2017-10-11 14:50 Roman Mashak
  2017-10-11 14:50 ` [PATCH net-next 1/2] net sched actions: change IFE modules alias names Roman Mashak
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Roman Mashak @ 2017-10-11 14:50 UTC (permalink / raw)
  To: davem; +Cc: netdev, jhs, Roman Mashak

Adjust module alias names of IFE meta modules and fix the bug that
prevented auto-loading IFE modules in run-time.

Roman Mashak (2):
  net sched actions: change IFE modules alias names
  net sched actions: fix module auto-loading

 include/net/tc_act/tc_ife.h     |  2 +-
 net/sched/act_ife.c             | 16 +++++++++++++++-
 net/sched/act_meta_mark.c       |  2 +-
 net/sched/act_meta_skbprio.c    |  2 +-
 net/sched/act_meta_skbtcindex.c |  2 +-
 5 files changed, 19 insertions(+), 5 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH net-next 1/2] net sched actions: change IFE modules alias names
  2017-10-11 14:50 [PATCH net-next 0/2] Fix IFE meta modules loading Roman Mashak
@ 2017-10-11 14:50 ` Roman Mashak
  2017-10-11 14:50 ` [PATCH net-next 2/2] net sched actions: fix module auto-loading Roman Mashak
  2017-10-12 19:23 ` [PATCH net-next 0/2] Fix IFE meta modules loading David Miller
  2 siblings, 0 replies; 7+ messages in thread
From: Roman Mashak @ 2017-10-11 14:50 UTC (permalink / raw)
  To: davem; +Cc: netdev, jhs, Roman Mashak

Make style of module alias name consistent with other subsystems in kernel,
for example net devices.

Fixes: 084e2f6566d2 ("Support to encoding decoding skb mark on IFE action")
Fixes: 200e10f46936 ("Support to encoding decoding skb prio on IFE action")
Fixes: 408fbc22ef1e ("net sched ife action: Introduce skb tcindex metadata encap decap")
Signed-off-by: Roman Mashak <mrv@mojatatu.com>
---
 include/net/tc_act/tc_ife.h     | 2 +-
 net/sched/act_ife.c             | 2 +-
 net/sched/act_meta_mark.c       | 2 +-
 net/sched/act_meta_skbprio.c    | 2 +-
 net/sched/act_meta_skbtcindex.c | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/net/tc_act/tc_ife.h b/include/net/tc_act/tc_ife.h
index 30ba459..104578f 100644
--- a/include/net/tc_act/tc_ife.h
+++ b/include/net/tc_act/tc_ife.h
@@ -40,7 +40,7 @@ struct tcf_meta_ops {
 	struct module	*owner;
 };
 
-#define MODULE_ALIAS_IFE_META(metan)   MODULE_ALIAS("ifemeta" __stringify_1(metan))
+#define MODULE_ALIAS_IFE_META(metan)   MODULE_ALIAS("ife-meta-" metan)
 
 int ife_get_meta_u32(struct sk_buff *skb, struct tcf_meta_info *mi);
 int ife_get_meta_u16(struct sk_buff *skb, struct tcf_meta_info *mi);
diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c
index 8ccd358..791aeee 100644
--- a/net/sched/act_ife.c
+++ b/net/sched/act_ife.c
@@ -263,7 +263,7 @@ static int load_metaops_and_vet(struct tcf_ife_info *ife, u32 metaid,
 		if (exists)
 			spin_unlock_bh(&ife->tcf_lock);
 		rtnl_unlock();
-		request_module("ifemeta%u", metaid);
+		request_module("ife-meta-%u", metaid);
 		rtnl_lock();
 		if (exists)
 			spin_lock_bh(&ife->tcf_lock);
diff --git a/net/sched/act_meta_mark.c b/net/sched/act_meta_mark.c
index 8289217..1e3f10e 100644
--- a/net/sched/act_meta_mark.c
+++ b/net/sched/act_meta_mark.c
@@ -76,4 +76,4 @@ static void __exit ifemark_cleanup_module(void)
 MODULE_AUTHOR("Jamal Hadi Salim(2015)");
 MODULE_DESCRIPTION("Inter-FE skb mark metadata module");
 MODULE_LICENSE("GPL");
-MODULE_ALIAS_IFE_META(IFE_META_SKBMARK);
+MODULE_ALIAS_IFE_META("skbmark");
diff --git a/net/sched/act_meta_skbprio.c b/net/sched/act_meta_skbprio.c
index 26bf4d8..4033f9f 100644
--- a/net/sched/act_meta_skbprio.c
+++ b/net/sched/act_meta_skbprio.c
@@ -73,4 +73,4 @@ static void __exit ifeprio_cleanup_module(void)
 MODULE_AUTHOR("Jamal Hadi Salim(2015)");
 MODULE_DESCRIPTION("Inter-FE skb prio metadata action");
 MODULE_LICENSE("GPL");
-MODULE_ALIAS_IFE_META(IFE_META_PRIO);
+MODULE_ALIAS_IFE_META("skbprio");
diff --git a/net/sched/act_meta_skbtcindex.c b/net/sched/act_meta_skbtcindex.c
index 3b35774..2ea1f26 100644
--- a/net/sched/act_meta_skbtcindex.c
+++ b/net/sched/act_meta_skbtcindex.c
@@ -76,4 +76,4 @@ static void __exit ifetc_index_cleanup_module(void)
 MODULE_AUTHOR("Jamal Hadi Salim(2016)");
 MODULE_DESCRIPTION("Inter-FE skb tc_index metadata module");
 MODULE_LICENSE("GPL");
-MODULE_ALIAS_IFE_META(IFE_META_SKBTCINDEX);
+MODULE_ALIAS_IFE_META("tcindex");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next 2/2] net sched actions: fix module auto-loading
  2017-10-11 14:50 [PATCH net-next 0/2] Fix IFE meta modules loading Roman Mashak
  2017-10-11 14:50 ` [PATCH net-next 1/2] net sched actions: change IFE modules alias names Roman Mashak
@ 2017-10-11 14:50 ` Roman Mashak
  2017-10-11 17:30   ` Cong Wang
  2017-10-12 19:23 ` [PATCH net-next 0/2] Fix IFE meta modules loading David Miller
  2 siblings, 1 reply; 7+ messages in thread
From: Roman Mashak @ 2017-10-11 14:50 UTC (permalink / raw)
  To: davem; +Cc: netdev, jhs, Roman Mashak

Macro __stringify_1() can stringify a macro argument, however IFE_META_*
are enums, so they never expand, however request_module expects an integer
in IFE module name, so as a result it always fails to auto-load.

Fixes: ef6980b6becb ("introduce IFE action")
Signed-off-by: Roman Mashak <mrv@mojatatu.com>
---
 net/sched/act_ife.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c
index 791aeee..e0bc228 100644
--- a/net/sched/act_ife.c
+++ b/net/sched/act_ife.c
@@ -248,6 +248,20 @@ static int ife_validate_metatype(struct tcf_meta_ops *ops, void *val, int len)
 	return ret;
 }
 
+static const char *ife_meta_id2name(u32 metaid)
+{
+	switch (metaid) {
+	case IFE_META_SKBMARK:
+		return "skbmark";
+	case IFE_META_PRIO:
+		return "skbprio";
+	case IFE_META_TCINDEX:
+		return "tcindex";
+	default:
+		return "unknown";
+	}
+}
+
 /* called when adding new meta information
  * under ife->tcf_lock for existing action
 */
@@ -263,7 +277,7 @@ static int load_metaops_and_vet(struct tcf_ife_info *ife, u32 metaid,
 		if (exists)
 			spin_unlock_bh(&ife->tcf_lock);
 		rtnl_unlock();
-		request_module("ife-meta-%u", metaid);
+		request_module("ife-meta-%s", ife_meta_id2name(metaid));
 		rtnl_lock();
 		if (exists)
 			spin_lock_bh(&ife->tcf_lock);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 2/2] net sched actions: fix module auto-loading
  2017-10-11 14:50 ` [PATCH net-next 2/2] net sched actions: fix module auto-loading Roman Mashak
@ 2017-10-11 17:30   ` Cong Wang
  0 siblings, 0 replies; 7+ messages in thread
From: Cong Wang @ 2017-10-11 17:30 UTC (permalink / raw)
  To: Roman Mashak
  Cc: David Miller, Linux Kernel Network Developers, Jamal Hadi Salim

On Wed, Oct 11, 2017 at 7:50 AM, Roman Mashak <mrv@mojatatu.com> wrote:
> Macro __stringify_1() can stringify a macro argument, however IFE_META_*
> are enums, so they never expand, however request_module expects an integer
> in IFE module name, so as a result it always fails to auto-load.
>
> Fixes: ef6980b6becb ("introduce IFE action")
> Signed-off-by: Roman Mashak <mrv@mojatatu.com>

Good catch!

Alternatively, it seems we can also do this:

...
#define _IFE_META_PRIO 3

enum {
...
        IFE_META_PRIO = _IFE_META_PRIO,
...
};



#define MODULE_ALIAS_IFE_META(metan)   MODULE_ALIAS("ifemeta" ##_
__stringify_1(metan))

But it does _not_ look any better than yours.

So,

Acked-by: Cong Wang <xiyou.wangcong@gmail.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 0/2] Fix IFE meta modules loading
  2017-10-11 14:50 [PATCH net-next 0/2] Fix IFE meta modules loading Roman Mashak
  2017-10-11 14:50 ` [PATCH net-next 1/2] net sched actions: change IFE modules alias names Roman Mashak
  2017-10-11 14:50 ` [PATCH net-next 2/2] net sched actions: fix module auto-loading Roman Mashak
@ 2017-10-12 19:23 ` David Miller
  2017-10-12 20:37   ` Roman Mashak
  2 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2017-10-12 19:23 UTC (permalink / raw)
  To: mrv; +Cc: netdev, jhs

From: Roman Mashak <mrv@mojatatu.com>
Date: Wed, 11 Oct 2017 10:50:28 -0400

> Adjust module alias names of IFE meta modules and fix the bug that
> prevented auto-loading IFE modules in run-time.

Anyone using the existing alises will be broken by these changes
no?

Is it possible to define multiple aliases?  That would be a way to
get the more desirable names whilst not breaking existing users.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 0/2] Fix IFE meta modules loading
  2017-10-12 19:23 ` [PATCH net-next 0/2] Fix IFE meta modules loading David Miller
@ 2017-10-12 20:37   ` Roman Mashak
  2017-10-13  5:13     ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Roman Mashak @ 2017-10-12 20:37 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, jhs

David Miller <davem@davemloft.net> writes:

> From: Roman Mashak <mrv@mojatatu.com>
> Date: Wed, 11 Oct 2017 10:50:28 -0400
>
>> Adjust module alias names of IFE meta modules and fix the bug that
>> prevented auto-loading IFE modules in run-time.
>
> Anyone using the existing alises will be broken by these changes
> no?

Actually aliases never worked, the bug existed since the day act_meta_*
modules have been introduced. I suspect everyone compiles them in-kernel
rather then as modules.

> Is it possible to define multiple aliases?  That would be a way to
> get the more desirable names whilst not breaking existing users.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 0/2] Fix IFE meta modules loading
  2017-10-12 20:37   ` Roman Mashak
@ 2017-10-13  5:13     ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2017-10-13  5:13 UTC (permalink / raw)
  To: mrv; +Cc: netdev, jhs

From: Roman Mashak <mrv@mojatatu.com>
Date: Thu, 12 Oct 2017 16:37:39 -0400

> David Miller <davem@davemloft.net> writes:
> 
>> From: Roman Mashak <mrv@mojatatu.com>
>> Date: Wed, 11 Oct 2017 10:50:28 -0400
>>
>>> Adjust module alias names of IFE meta modules and fix the bug that
>>> prevented auto-loading IFE modules in run-time.
>>
>> Anyone using the existing alises will be broken by these changes
>> no?
> 
> Actually aliases never worked, the bug existed since the day act_meta_*
> modules have been introduced. I suspect everyone compiles them in-kernel
> rather then as modules.

Fair enough, series applied, thanks for explaining.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-10-13  5:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-11 14:50 [PATCH net-next 0/2] Fix IFE meta modules loading Roman Mashak
2017-10-11 14:50 ` [PATCH net-next 1/2] net sched actions: change IFE modules alias names Roman Mashak
2017-10-11 14:50 ` [PATCH net-next 2/2] net sched actions: fix module auto-loading Roman Mashak
2017-10-11 17:30   ` Cong Wang
2017-10-12 19:23 ` [PATCH net-next 0/2] Fix IFE meta modules loading David Miller
2017-10-12 20:37   ` Roman Mashak
2017-10-13  5:13     ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.