XDP-Newbies Archive mirror
 help / color / mirror / Atom feed
From: Marco <ctxspi@gmail.com>
To: xdp-newbies@vger.kernel.org
Subject: Re: Global static volatile
Date: Sat, 30 Mar 2024 17:11:02 +0100	[thread overview]
Message-ID: <CAAVAo4O6kSEv2LqQrQSBa6Qk188NewdGgazQiZUrj6bJGXXtcw@mail.gmail.com> (raw)
In-Reply-To: <CAAVAo4MxNCmEi3A=V+oqyK9_qZ2CBSQAC28g6tAH2t535cSZ4Q@mail.gmail.com>

I apologize because I was wrong.

I have identified how my program behaves and in the next few days I
will (with pleasure) remove the structure declared "volatile static"
by modifying the parts of code that make use of it...

Thanks anyway

Il giorno sab 30 mar 2024 alle ore 15:08 Marco <ctxspi@gmail.com> ha scritto:
>
> Helo
>
> I tried to use a secondary variable fib_params_test as a global
> variable at the beginning of my XDP program like this:
>
> static volatile struct bpf_fib_lookup fib_params_test;
> .
> .
> static __always_inline int function_process_packet(struct xdp_md *ctx,
> u32 flags)
> {
>     const __u32 ifingress = ctx->ingress_ifindex;
>     void *data_end = (void *)(long)ctx->data_end;
>     void *data = (void *)(long)ctx->data;
>     void *l3hdr = NULL;
>     struct bpf_fib_lookup fib_params;
>
>     bpf_printk("Ingress interface %d", fib_params_test.ifindex); /*
> the value displayed is always right */
> .
> .
> }
>
>
> Once "fib_params_test" was initialized with the first packet received,
> upon subsequent packets coming from different incoming vlan
> interfaces, "fib_params_test.ifindex" always returned the interface I
> expected.
> Obviously I have always done tests with little traffic so I have the
> doubt that in a real situation there may be unexpected values for the
> fib_params_test.ifindex variable. This is possible?
>
> Thank you.
>
> Marco

      reply	other threads:[~2024-03-30 16:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-30 14:08 Global static volatile Marco
2024-03-30 16:11 ` Marco [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=CAAVAo4O6kSEv2LqQrQSBa6Qk188NewdGgazQiZUrj6bJGXXtcw@mail.gmail.com \
    --to=ctxspi@gmail.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 read-only IMAP folder(s) and NNTP newsgroup(s).