diff mbox series

[bpf-next] bpf_load: add map name to load_maps error message

Message ID 1540847681-3273-1-git-send-email-shannon.nelson@oracle.com
State Accepted, archived
Delegated to: BPF Maintainers
Headers show
Series [bpf-next] bpf_load: add map name to load_maps error message | expand

Commit Message

Shannon Nelson Oct. 29, 2018, 9:14 p.m. UTC
To help when debugging bpf/xdp load issues, have the load_map()
error message include the number and name of the map that
failed.

Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
---
 samples/bpf/bpf_load.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

John Fastabend Oct. 29, 2018, 10:11 p.m. UTC | #1
On 10/29/2018 02:14 PM, Shannon Nelson wrote:
> To help when debugging bpf/xdp load issues, have the load_map()
> error message include the number and name of the map that
> failed.
> 
> Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
> ---
>  samples/bpf/bpf_load.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/samples/bpf/bpf_load.c b/samples/bpf/bpf_load.c
> index 89161c9..5de0357 100644
> --- a/samples/bpf/bpf_load.c
> +++ b/samples/bpf/bpf_load.c
> @@ -282,8 +282,8 @@ static int load_maps(struct bpf_map_data *maps, int nr_maps,
>  							numa_node);
>  		}
>  		if (map_fd[i] < 0) {
> -			printf("failed to create a map: %d %s\n",
> -			       errno, strerror(errno));
> +			printf("failed to create map %d (%s): %d %s\n",
> +			       i, maps[i].name, errno, strerror(errno));
>  			return 1;
>  		}
>  		maps[i].fd = map_fd[i];
> 

LGTM

Acked-by: John Fastabend <john.fastabend@gmail.com>
Song Liu Nov. 7, 2018, 12:26 a.m. UTC | #2
On Mon, Oct 29, 2018 at 3:12 PM John Fastabend <john.fastabend@gmail.com> wrote:
>
> On 10/29/2018 02:14 PM, Shannon Nelson wrote:
> > To help when debugging bpf/xdp load issues, have the load_map()
> > error message include the number and name of the map that
> > failed.
> >
> > Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
> > ---
> >  samples/bpf/bpf_load.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/samples/bpf/bpf_load.c b/samples/bpf/bpf_load.c
> > index 89161c9..5de0357 100644
> > --- a/samples/bpf/bpf_load.c
> > +++ b/samples/bpf/bpf_load.c
> > @@ -282,8 +282,8 @@ static int load_maps(struct bpf_map_data *maps, int nr_maps,
> >                                                       numa_node);
> >               }
> >               if (map_fd[i] < 0) {
> > -                     printf("failed to create a map: %d %s\n",
> > -                            errno, strerror(errno));
> > +                     printf("failed to create map %d (%s): %d %s\n",
> > +                            i, maps[i].name, errno, strerror(errno));
> >                       return 1;
> >               }
> >               maps[i].fd = map_fd[i];
> >
>
> LGTM
>
> Acked-by: John Fastabend <john.fastabend@gmail.com>

Acked-by: Song Liu <songliubraving@fb.com>
Daniel Borkmann Nov. 7, 2018, 9:41 p.m. UTC | #3
On 11/07/2018 01:26 AM, Song Liu wrote:
> On Mon, Oct 29, 2018 at 3:12 PM John Fastabend <john.fastabend@gmail.com> wrote:
>>
>> On 10/29/2018 02:14 PM, Shannon Nelson wrote:
>>> To help when debugging bpf/xdp load issues, have the load_map()
>>> error message include the number and name of the map that
>>> failed.
>>>
>>> Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
>>> ---
>>>  samples/bpf/bpf_load.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/samples/bpf/bpf_load.c b/samples/bpf/bpf_load.c
>>> index 89161c9..5de0357 100644
>>> --- a/samples/bpf/bpf_load.c
>>> +++ b/samples/bpf/bpf_load.c
>>> @@ -282,8 +282,8 @@ static int load_maps(struct bpf_map_data *maps, int nr_maps,
>>>                                                       numa_node);
>>>               }
>>>               if (map_fd[i] < 0) {
>>> -                     printf("failed to create a map: %d %s\n",
>>> -                            errno, strerror(errno));
>>> +                     printf("failed to create map %d (%s): %d %s\n",
>>> +                            i, maps[i].name, errno, strerror(errno));
>>>                       return 1;
>>>               }
>>>               maps[i].fd = map_fd[i];
>>>
>>
>> LGTM
>>
>> Acked-by: John Fastabend <john.fastabend@gmail.com>
> 
> Acked-by: Song Liu <songliubraving@fb.com>

Applied to bpf-next, thanks!
diff mbox series

Patch

diff --git a/samples/bpf/bpf_load.c b/samples/bpf/bpf_load.c
index 89161c9..5de0357 100644
--- a/samples/bpf/bpf_load.c
+++ b/samples/bpf/bpf_load.c
@@ -282,8 +282,8 @@  static int load_maps(struct bpf_map_data *maps, int nr_maps,
 							numa_node);
 		}
 		if (map_fd[i] < 0) {
-			printf("failed to create a map: %d %s\n",
-			       errno, strerror(errno));
+			printf("failed to create map %d (%s): %d %s\n",
+			       i, maps[i].name, errno, strerror(errno));
 			return 1;
 		}
 		maps[i].fd = map_fd[i];