public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: "luwei (O)" <luwei32@huawei.com>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>,
	"Andrii Nakryiko" <andrii.nakryiko@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Networking <netdev@vger.kernel.org>,
	David Ahern <dahern@digitalocean.com>
Subject: Re: Ask for help about bpf map
Date: Wed, 14 Jul 2021 16:23:52 +0800	[thread overview]
Message-ID: <189e4437-bb2c-2573-be96-0d6776feb5dd@huawei.com> (raw)
In-Reply-To: <26db412c-a8b7-6d37-844f-7909a0c5744b@huawei.com>

Hi Andrii and toke,

     I have sovled this issue. The reason is that my iproute2 does not 
support libbpf, once I compile iproute2 with libbpf, it works. Thanks 
for reply!

在 2021/7/14 10:02 AM, luwei (O) 写道:
> I tried 5.13 version in this page: 
> https://git.kernel.org/pub/scm/network/iproute2/iproute2.git , still 
> failed with the same error.
>
> 在 2021/7/14 9:05 AM, luwei (O) 写道:
>> I have updated the iproute2 according this page: 
>> https://github.com/cilium/cilium/issues/7446
>>
>> Now I use this version of iproute2: 
>> https://github.com/shemminger/iproute2
>>
>> The version of iproute2 is 5.11, and the kernel version is 5.13(the 
>> latest version).
>>
>>
>> 在 2021/7/14 1:07 AM, Toke Høiland-Jørgensen 写道:
>>> Andrii Nakryiko <andrii.nakryiko@gmail.com> writes:
>>>
>>>> On Mon, Jul 12, 2021 at 11:35 PM luwei (O) <luwei32@huawei.com> wrote:
>>>>> Hi, List:
>>>>>
>>>>>         I am a beginner about bpf and working on XDP now. I meet a
>>>>> problem and feel difficult to figure it out.
>>>>>
>>>>>         In my following codes, I use two ways to define my_map: in 
>>>>> SEC
>>>>> maps and SEC .maps respectively. When I load the xdp_kern.o file,
>>>>>
>>>>> It has different results. The way I load is: ip link set dev ens3 xdp
>>>>> obj xdp1_kern.o sec xdp1.
>>>>>
>>>>>         when I define my_map using SEC maps, it loads successfully 
>>>>> but
>>>>> fails to load using SEC .maps, it reports:
>>>>>
>>>>> "
>>>>>
>>>>> [12] TYPEDEF __u32 type_id=13
>>>>> [13] INT unsigned int size=4 bits_offset=0 nr_bits=32 encoding=(none)
>>>>> [14] FUNC_PROTO (anon) return=2 args=(10 ctx)
>>>>> [15] FUNC xdp_prog1 type_id=14
>>>>> [16] INT char size=1 bits_offset=0 nr_bits=8 encoding=SIGNED
>>>>> [17] ARRAY (anon) type_id=16 index_type_id=4 nr_elems=4
>>>>> [18] VAR _license type_id=17 linkage=1
>>>>> [19] DATASEC .maps size=0 vlen=1 size == 0
>>>>>
>>>>>
>>>>> Prog section 'xdp1' rejected: Permission denied (13)!
>>>>>    - Type:         6
>>>>>    - Instructions: 9 (0 over limit)
>>>>>    - License:      GPL
>>>>>
>>>>> Verifier analysis:
>>>>>
>>>>> 0: (b7) r1 = 0
>>>>> 1: (63) *(u32 *)(r10 -4) = r1
>>>>> last_idx 1 first_idx 0
>>>>> regs=2 stack=0 before 0: (b7) r1 = 0
>>>>> 2: (bf) r2 = r10
>>>>> 3: (07) r2 += -4
>>>>> 4: (18) r1 = 0x0
>>>> this shouldn't be 0x0.
>>>>
>>>> I suspect you have an old iproute2 which doesn't yet use libbpf to
>>>> load BPF programs, so .maps definition is not yet supported. cc'ing
>>>> netdev@vger, David and Toke
>>> That would be my guess as well; what's the output of 'ip -V'?
>>>
>>> -Toke
>>>
>>> .
>>
-- 
Best Regards,
Lu Wei


  reply	other threads:[~2021-07-14  8:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13  6:34 Ask for help about bpf map luwei (O)
2021-07-13 16:16 ` Andrii Nakryiko
2021-07-13 17:07   ` Toke Høiland-Jørgensen
2021-07-14  1:05     ` luwei (O)
2021-07-14  2:02       ` luwei (O)
2021-07-14  8:23         ` luwei (O) [this message]
2021-07-14 14:15           ` Toke Høiland-Jørgensen
2021-07-14 14:48           ` Alexei Starovoitov
2021-07-15  1:44             ` luwei (O)
2021-07-19 12:38               ` Toke Høiland-Jørgensen
2021-07-20 13:05                 ` luwei (O)
2021-07-20 14:50                   ` Toke Høiland-Jørgensen
2021-07-23  2:07                     ` luwei (O)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=189e4437-bb2c-2573-be96-0d6776feb5dd@huawei.com \
    --to=luwei32@huawei.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=dahern@digitalocean.com \
    --cc=netdev@vger.kernel.org \
    --cc=toke@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox