linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Donald Hunter <donald.hunter@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf@vger.kernel.org, linux-doc@vger.kernel.org,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Dave Tucker <dave@dtucker.co.uk>,
	Maryam Tahhan <mtahhan@redhat.com>
Subject: Re: [PATCH bpf-next v10 1/1] bpf, docs: document BPF_MAP_TYPE_ARRAY
Date: Mon, 14 Nov 2022 10:18:04 +0000	[thread overview]
Message-ID: <m24jv17sbn.fsf@gmail.com> (raw)
In-Reply-To: <CAEf4Bzak4A-vP=NeJheA0poiu_8fK53cvbq1EnnSHC78FB7mtQ@mail.gmail.com> (Andrii Nakryiko's message of "Fri, 11 Nov 2022 11:39:51 -0800")

Andrii Nakryiko <andrii.nakryiko@gmail.com> writes:

> On Wed, Nov 9, 2022 at 9:46 AM Donald Hunter <donald.hunter@gmail.com> wrote:
>>
>> +This example BPF program shows how to access an array element.
>> +
>> +.. code-block:: c
>> +
>> +    int bpf_prog(struct __sk_buff *skb)
>> +    {
>> +            struct iphdr ip;
>> +            int index;
>> +            long *value;
>> +
>> +            if (bpf_skb_load_bytes(skb, ETH_HLEN, &ip, sizeof(ip)) < 0)
>> +                    return 0;
>> +
>> +            index = ip.protocol;
>> +            value = bpf_map_lookup_elem(&my_map, &index);
>> +            if (value)
>> +                    __sync_fetch_and_add(value, skb->len);
>
> should be &value
>
> I fixed it up and applied to bpf-next, thanks.

I double checked and it really should be value, which is already a
pointer.

Do you want me to send a patch to fix it up?

  reply	other threads:[~2022-11-14 10:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09 17:46 [PATCH bpf-next v10 0/1] Document BPF_MAP_TYPE_ARRAY Donald Hunter
2022-11-09 17:46 ` [PATCH bpf-next v10 1/1] bpf, docs: document BPF_MAP_TYPE_ARRAY Donald Hunter
2022-11-11  1:52   ` Bagas Sanjaya
2022-11-11 19:39   ` Andrii Nakryiko
2022-11-14 10:18     ` Donald Hunter [this message]
2022-11-14 19:44       ` Andrii Nakryiko
2022-11-11 19:40 ` [PATCH bpf-next v10 0/1] Document BPF_MAP_TYPE_ARRAY patchwork-bot+netdevbpf

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=m24jv17sbn.fsf@gmail.com \
    --to=donald.hunter@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=daniel@iogearbox.net \
    --cc=dave@dtucker.co.uk \
    --cc=linux-doc@vger.kernel.org \
    --cc=mtahhan@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;
as well as URLs for NNTP newsgroup(s).