xdp-newbies.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Deacon <gamemann@gflclan.com>
To: Jesper Dangaard Brouer <brouer@redhat.com>
Cc: xdp-newbies@vger.kernel.org
Subject: Re: XDP BPF Stack Limit Issues
Date: Thu, 17 Dec 2020 20:42:15 -0600	[thread overview]
Message-ID: <992798d6-2f41-afbe-608c-3987dd90593b@gflclan.com> (raw)
In-Reply-To: <20201217095016.1f38e06c@carbon>

Thank you for pointing this out Jesper! I'm honestly surprised I didn't 
realize this before.


I've made this change and I'm able to compile the XDP/BPF program 
without any issues now.


Thank you again!

On 12/17/2020 2:50 AM, Jesper Dangaard Brouer wrote:
> I have to look elsewhere[2] to see that:
>   #define MAX_FILTERS 55
>
> Your problem is that you create an array with 55 pointers each 8 bytes
> equal 440 bytes on the stack (max stack is 512).  Why do you need to
> lookup all 55 map elements in a loop before using them?
>
> https://gist.github.com/gamemann/663674924e16286b02a835637912c2a5#file-xdp_fw_ipv6_maps-c-L267
>
>   struct filter *filter[MAX_FILTERS];
>   for (uint8_t i = 0; i < MAX_FILTERS; i++)
>      {
>          key = i;
>          
>          filter[i] = bpf_map_lookup_elem(&filters_map, &key);
>      }
>   [...]
>   for (uint8_t i = 0; i < MAX_FILTERS; i++)
>      {
>          // Check if ID is above 0 (if 0, it's an invalid rule).
>          if (!filter[i] || filter[i]->id < 1)
>    [...]

      reply	other threads:[~2020-12-18  2:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-16 15:29 XDP BPF Stack Limit Issues Christian Deacon
2020-12-17  8:50 ` Jesper Dangaard Brouer
2020-12-18  2:42   ` Christian Deacon [this message]

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=992798d6-2f41-afbe-608c-3987dd90593b@gflclan.com \
    --to=gamemann@gflclan.com \
    --cc=brouer@redhat.com \
    --cc=xdp-newbies@vger.kernel.org \
    /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).