* [patch iproute2] devlink: load ifname map on demand from ifname_map_rev_lookup() as well
@ 2022-11-09 12:48 Jiri Pirko
2022-11-21 8:52 ` Jiri Pirko
0 siblings, 1 reply; 9+ messages in thread
From: Jiri Pirko @ 2022-11-09 12:48 UTC (permalink / raw)
To: netdev; +Cc: stephen, dsahern
From: Jiri Pirko <jiri@nvidia.com>
Commit 5cddbb274eab ("devlink: load port-ifname map on demand") changed
the ifname map to be loaded on demand from ifname_map_lookup(). However,
it didn't put this on-demand loading into ifname_map_rev_lookup() which
causes ifname_map_rev_lookup() to return -ENOENT all the time.
Fix this by triggering on-demand ifname map load
from ifname_map_rev_lookup() as well.
Fixes: 5cddbb274eab ("devlink: load port-ifname map on demand")
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
---
devlink/devlink.c | 35 +++++++++++++++++++++++++++--------
1 file changed, 27 insertions(+), 8 deletions(-)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 8aefa101b2f8..150b4e63ead1 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -838,6 +838,23 @@ static int ifname_map_load(struct dl *dl)
return 0;
}
+static int ifname_map_check_load(struct dl *dl)
+{
+ int err;
+
+ if (dl->map_loaded)
+ return 0;
+
+ err = ifname_map_load(dl);
+ if (err) {
+ pr_err("Failed to create index map\n");
+ return err;
+ }
+ dl->map_loaded = true;
+ return 0;
+}
+
+
static int ifname_map_lookup(struct dl *dl, const char *ifname,
char **p_bus_name, char **p_dev_name,
uint32_t *p_port_index)
@@ -845,14 +862,10 @@ static int ifname_map_lookup(struct dl *dl, const char *ifname,
struct ifname_map *ifname_map;
int err;
- if (!dl->map_loaded) {
- err = ifname_map_load(dl);
- if (err) {
- pr_err("Failed to create index map\n");
- return err;
- }
- dl->map_loaded = true;
- }
+ err = ifname_map_check_load(dl);
+ if (err)
+ return err;
+
list_for_each_entry(ifname_map, &dl->ifname_map_list, list) {
if (strcmp(ifname, ifname_map->ifname) == 0) {
*p_bus_name = ifname_map->bus_name;
@@ -870,6 +883,12 @@ static int ifname_map_rev_lookup(struct dl *dl, const char *bus_name,
{
struct ifname_map *ifname_map;
+ int err;
+
+ err = ifname_map_check_load(dl);
+ if (err)
+ return err;
+
list_for_each_entry(ifname_map, &dl->ifname_map_list, list) {
if (strcmp(bus_name, ifname_map->bus_name) == 0 &&
strcmp(dev_name, ifname_map->dev_name) == 0 &&
--
2.37.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [patch iproute2] devlink: load ifname map on demand from ifname_map_rev_lookup() as well
2022-11-09 12:48 [patch iproute2] devlink: load ifname map on demand from ifname_map_rev_lookup() as well Jiri Pirko
@ 2022-11-21 8:52 ` Jiri Pirko
2022-11-21 18:34 ` Stephen Hemminger
0 siblings, 1 reply; 9+ messages in thread
From: Jiri Pirko @ 2022-11-21 8:52 UTC (permalink / raw)
To: stephen; +Cc: netdev, dsahern
Wed, Nov 09, 2022 at 01:48:51PM CET, jiri@resnulli.us wrote:
>From: Jiri Pirko <jiri@nvidia.com>
>
>Commit 5cddbb274eab ("devlink: load port-ifname map on demand") changed
>the ifname map to be loaded on demand from ifname_map_lookup(). However,
>it didn't put this on-demand loading into ifname_map_rev_lookup() which
>causes ifname_map_rev_lookup() to return -ENOENT all the time.
>
>Fix this by triggering on-demand ifname map load
>from ifname_map_rev_lookup() as well.
>
>Fixes: 5cddbb274eab ("devlink: load port-ifname map on demand")
>Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Stephen, its' almost 3 weeks since I sent this. Could you please check
this out? I would like to follow-up with couple of patches to -next
branch which are based on top of this fix.
Thanks!
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch iproute2] devlink: load ifname map on demand from ifname_map_rev_lookup() as well
2022-11-21 8:52 ` Jiri Pirko
@ 2022-11-21 18:34 ` Stephen Hemminger
2022-11-22 12:37 ` Jiri Pirko
2022-11-24 8:28 ` Jiri Pirko
0 siblings, 2 replies; 9+ messages in thread
From: Stephen Hemminger @ 2022-11-21 18:34 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, dsahern
On Mon, 21 Nov 2022 09:52:13 +0100
Jiri Pirko <jiri@resnulli.us> wrote:
> Wed, Nov 09, 2022 at 01:48:51PM CET, jiri@resnulli.us wrote:
> >From: Jiri Pirko <jiri@nvidia.com>
> >
> >Commit 5cddbb274eab ("devlink: load port-ifname map on demand") changed
> >the ifname map to be loaded on demand from ifname_map_lookup(). However,
> >it didn't put this on-demand loading into ifname_map_rev_lookup() which
> >causes ifname_map_rev_lookup() to return -ENOENT all the time.
> >
> >Fix this by triggering on-demand ifname map load
> >from ifname_map_rev_lookup() as well.
> >
> >Fixes: 5cddbb274eab ("devlink: load port-ifname map on demand")
> >Signed-off-by: Jiri Pirko <jiri@nvidia.com>
>
> Stephen, its' almost 3 weeks since I sent this. Could you please check
> this out? I would like to follow-up with couple of patches to -next
> branch which are based on top of this fix.
>
> Thanks!
David applied it to iproute2-next branch already
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch iproute2] devlink: load ifname map on demand from ifname_map_rev_lookup() as well
2022-11-21 18:34 ` Stephen Hemminger
@ 2022-11-22 12:37 ` Jiri Pirko
2022-11-24 8:28 ` Jiri Pirko
1 sibling, 0 replies; 9+ messages in thread
From: Jiri Pirko @ 2022-11-22 12:37 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev, dsahern
Mon, Nov 21, 2022 at 07:34:37PM CET, stephen@networkplumber.org wrote:
>On Mon, 21 Nov 2022 09:52:13 +0100
>Jiri Pirko <jiri@resnulli.us> wrote:
>
>> Wed, Nov 09, 2022 at 01:48:51PM CET, jiri@resnulli.us wrote:
>> >From: Jiri Pirko <jiri@nvidia.com>
>> >
>> >Commit 5cddbb274eab ("devlink: load port-ifname map on demand") changed
>> >the ifname map to be loaded on demand from ifname_map_lookup(). However,
>> >it didn't put this on-demand loading into ifname_map_rev_lookup() which
>> >causes ifname_map_rev_lookup() to return -ENOENT all the time.
>> >
>> >Fix this by triggering on-demand ifname map load
>> >from ifname_map_rev_lookup() as well.
>> >
>> >Fixes: 5cddbb274eab ("devlink: load port-ifname map on demand")
>> >Signed-off-by: Jiri Pirko <jiri@nvidia.com>
>>
>> Stephen, its' almost 3 weeks since I sent this. Could you please check
>> this out? I would like to follow-up with couple of patches to -next
>> branch which are based on top of this fix.
>>
>> Thanks!
>
>David applied it to iproute2-next branch already
Ah. Okay. Thanks!
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch iproute2] devlink: load ifname map on demand from ifname_map_rev_lookup() as well
2022-11-21 18:34 ` Stephen Hemminger
2022-11-22 12:37 ` Jiri Pirko
@ 2022-11-24 8:28 ` Jiri Pirko
2022-11-25 4:02 ` David Ahern
2022-11-25 18:58 ` Stephen Hemminger
1 sibling, 2 replies; 9+ messages in thread
From: Jiri Pirko @ 2022-11-24 8:28 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev, dsahern
Mon, Nov 21, 2022 at 07:34:37PM CET, stephen@networkplumber.org wrote:
>On Mon, 21 Nov 2022 09:52:13 +0100
>Jiri Pirko <jiri@resnulli.us> wrote:
>
>> Wed, Nov 09, 2022 at 01:48:51PM CET, jiri@resnulli.us wrote:
>> >From: Jiri Pirko <jiri@nvidia.com>
>> >
>> >Commit 5cddbb274eab ("devlink: load port-ifname map on demand") changed
>> >the ifname map to be loaded on demand from ifname_map_lookup(). However,
>> >it didn't put this on-demand loading into ifname_map_rev_lookup() which
>> >causes ifname_map_rev_lookup() to return -ENOENT all the time.
>> >
>> >Fix this by triggering on-demand ifname map load
>> >from ifname_map_rev_lookup() as well.
>> >
>> >Fixes: 5cddbb274eab ("devlink: load port-ifname map on demand")
>> >Signed-off-by: Jiri Pirko <jiri@nvidia.com>
>>
>> Stephen, its' almost 3 weeks since I sent this. Could you please check
>> this out? I would like to follow-up with couple of patches to -next
>> branch which are based on top of this fix.
>>
>> Thanks!
>
>David applied it to iproute2-next branch already
Actually, I don't see it in iproute2-next. Am I missing something?
https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/log/
Thanks!
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch iproute2] devlink: load ifname map on demand from ifname_map_rev_lookup() as well
2022-11-24 8:28 ` Jiri Pirko
@ 2022-11-25 4:02 ` David Ahern
2022-11-25 8:21 ` Jiri Pirko
2022-11-25 18:58 ` Stephen Hemminger
1 sibling, 1 reply; 9+ messages in thread
From: David Ahern @ 2022-11-25 4:02 UTC (permalink / raw)
To: Jiri Pirko, Stephen Hemminger; +Cc: netdev
On 11/24/22 1:28 AM, Jiri Pirko wrote:
> Mon, Nov 21, 2022 at 07:34:37PM CET, stephen@networkplumber.org wrote:
>> On Mon, 21 Nov 2022 09:52:13 +0100
>> Jiri Pirko <jiri@resnulli.us> wrote:
>>
>>> Wed, Nov 09, 2022 at 01:48:51PM CET, jiri@resnulli.us wrote:
>>>> From: Jiri Pirko <jiri@nvidia.com>
>>>>
>>>> Commit 5cddbb274eab ("devlink: load port-ifname map on demand") changed
>>>> the ifname map to be loaded on demand from ifname_map_lookup(). However,
>>>> it didn't put this on-demand loading into ifname_map_rev_lookup() which
>>>> causes ifname_map_rev_lookup() to return -ENOENT all the time.
>>>>
>>>> Fix this by triggering on-demand ifname map load
>>> >from ifname_map_rev_lookup() as well.
>>>>
>>>> Fixes: 5cddbb274eab ("devlink: load port-ifname map on demand")
>>>> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
>>>
>>> Stephen, its' almost 3 weeks since I sent this. Could you please check
>>> this out? I would like to follow-up with couple of patches to -next
>>> branch which are based on top of this fix.
>>>
>>> Thanks!
>>
>> David applied it to iproute2-next branch already
>
> Actually, I don't see it in iproute2-next. Am I missing something?
> https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/log/
>
> Thanks!
>
please resend.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch iproute2] devlink: load ifname map on demand from ifname_map_rev_lookup() as well
2022-11-25 4:02 ` David Ahern
@ 2022-11-25 8:21 ` Jiri Pirko
0 siblings, 0 replies; 9+ messages in thread
From: Jiri Pirko @ 2022-11-25 8:21 UTC (permalink / raw)
To: David Ahern; +Cc: Stephen Hemminger, netdev
Fri, Nov 25, 2022 at 05:02:40AM CET, dsahern@gmail.com wrote:
>On 11/24/22 1:28 AM, Jiri Pirko wrote:
>> Mon, Nov 21, 2022 at 07:34:37PM CET, stephen@networkplumber.org wrote:
>>> On Mon, 21 Nov 2022 09:52:13 +0100
>>> Jiri Pirko <jiri@resnulli.us> wrote:
>>>
>>>> Wed, Nov 09, 2022 at 01:48:51PM CET, jiri@resnulli.us wrote:
>>>>> From: Jiri Pirko <jiri@nvidia.com>
>>>>>
>>>>> Commit 5cddbb274eab ("devlink: load port-ifname map on demand") changed
>>>>> the ifname map to be loaded on demand from ifname_map_lookup(). However,
>>>>> it didn't put this on-demand loading into ifname_map_rev_lookup() which
>>>>> causes ifname_map_rev_lookup() to return -ENOENT all the time.
>>>>>
>>>>> Fix this by triggering on-demand ifname map load
>>>> >from ifname_map_rev_lookup() as well.
>>>>>
>>>>> Fixes: 5cddbb274eab ("devlink: load port-ifname map on demand")
>>>>> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
>>>>
>>>> Stephen, its' almost 3 weeks since I sent this. Could you please check
>>>> this out? I would like to follow-up with couple of patches to -next
>>>> branch which are based on top of this fix.
>>>>
>>>> Thanks!
>>>
>>> David applied it to iproute2-next branch already
>>
>> Actually, I don't see it in iproute2-next. Am I missing something?
>> https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/log/
>>
>> Thanks!
>>
>
>please resend.
Well, it is a fix, it should be put into iproute branch, not next. I'm
confused to be honest :/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch iproute2] devlink: load ifname map on demand from ifname_map_rev_lookup() as well
2022-11-24 8:28 ` Jiri Pirko
2022-11-25 4:02 ` David Ahern
@ 2022-11-25 18:58 ` Stephen Hemminger
2022-11-28 9:07 ` Jiri Pirko
1 sibling, 1 reply; 9+ messages in thread
From: Stephen Hemminger @ 2022-11-25 18:58 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, dsahern
On Thu, 24 Nov 2022 09:28:48 +0100
Jiri Pirko <jiri@resnulli.us> wrote:
> Mon, Nov 21, 2022 at 07:34:37PM CET, stephen@networkplumber.org wrote:
> >On Mon, 21 Nov 2022 09:52:13 +0100
> >Jiri Pirko <jiri@resnulli.us> wrote:
> >
> >> Wed, Nov 09, 2022 at 01:48:51PM CET, jiri@resnulli.us wrote:
> >> >From: Jiri Pirko <jiri@nvidia.com>
> >> >
> >> >Commit 5cddbb274eab ("devlink: load port-ifname map on demand") changed
> >> >the ifname map to be loaded on demand from ifname_map_lookup(). However,
> >> >it didn't put this on-demand loading into ifname_map_rev_lookup() which
> >> >causes ifname_map_rev_lookup() to return -ENOENT all the time.
> >> >
> >> >Fix this by triggering on-demand ifname map load
> >> >from ifname_map_rev_lookup() as well.
> >> >
> >> >Fixes: 5cddbb274eab ("devlink: load port-ifname map on demand")
> >> >Signed-off-by: Jiri Pirko <jiri@nvidia.com>
> >>
> >> Stephen, its' almost 3 weeks since I sent this. Could you please check
> >> this out? I would like to follow-up with couple of patches to -next
> >> branch which are based on top of this fix.
> >>
> >> Thanks!
> >
> >David applied it to iproute2-next branch already
>
> Actually, I don't see it in iproute2-next. Am I missing something?
> https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/log/
>
> Thanks!
>
It got confused with something else. Applied to iproute2 now.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch iproute2] devlink: load ifname map on demand from ifname_map_rev_lookup() as well
2022-11-25 18:58 ` Stephen Hemminger
@ 2022-11-28 9:07 ` Jiri Pirko
0 siblings, 0 replies; 9+ messages in thread
From: Jiri Pirko @ 2022-11-28 9:07 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev, dsahern
Fri, Nov 25, 2022 at 07:58:40PM CET, stephen@networkplumber.org wrote:
>On Thu, 24 Nov 2022 09:28:48 +0100
>Jiri Pirko <jiri@resnulli.us> wrote:
>
>> Mon, Nov 21, 2022 at 07:34:37PM CET, stephen@networkplumber.org wrote:
>> >On Mon, 21 Nov 2022 09:52:13 +0100
>> >Jiri Pirko <jiri@resnulli.us> wrote:
>> >
>> >> Wed, Nov 09, 2022 at 01:48:51PM CET, jiri@resnulli.us wrote:
>> >> >From: Jiri Pirko <jiri@nvidia.com>
>> >> >
>> >> >Commit 5cddbb274eab ("devlink: load port-ifname map on demand") changed
>> >> >the ifname map to be loaded on demand from ifname_map_lookup(). However,
>> >> >it didn't put this on-demand loading into ifname_map_rev_lookup() which
>> >> >causes ifname_map_rev_lookup() to return -ENOENT all the time.
>> >> >
>> >> >Fix this by triggering on-demand ifname map load
>> >> >from ifname_map_rev_lookup() as well.
>> >> >
>> >> >Fixes: 5cddbb274eab ("devlink: load port-ifname map on demand")
>> >> >Signed-off-by: Jiri Pirko <jiri@nvidia.com>
>> >>
>> >> Stephen, its' almost 3 weeks since I sent this. Could you please check
>> >> this out? I would like to follow-up with couple of patches to -next
>> >> branch which are based on top of this fix.
>> >>
>> >> Thanks!
>> >
>> >David applied it to iproute2-next branch already
>>
>> Actually, I don't see it in iproute2-next. Am I missing something?
>> https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/log/
>>
>> Thanks!
>>
>
>It got confused with something else. Applied to iproute2 now.
Okay, fine now. Thanks!
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-11-28 9:08 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-09 12:48 [patch iproute2] devlink: load ifname map on demand from ifname_map_rev_lookup() as well Jiri Pirko
2022-11-21 8:52 ` Jiri Pirko
2022-11-21 18:34 ` Stephen Hemminger
2022-11-22 12:37 ` Jiri Pirko
2022-11-24 8:28 ` Jiri Pirko
2022-11-25 4:02 ` David Ahern
2022-11-25 8:21 ` Jiri Pirko
2022-11-25 18:58 ` Stephen Hemminger
2022-11-28 9:07 ` Jiri Pirko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).