[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191210004254.m5cicj3tkc2bhlrd@kafai-mbp>
Date: Tue, 10 Dec 2019 00:42:58 +0000
From: Martin Lau <kafai@...com>
To: Magnus Karlsson <magnus.karlsson@...el.com>
CC: "bjorn.topel@...el.com" <bjorn.topel@...el.com>,
"ast@...nel.org" <ast@...nel.org>,
"daniel@...earbox.net" <daniel@...earbox.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"jonathan.lemon@...il.com" <jonathan.lemon@...il.com>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>,
"saeedm@...lanox.com" <saeedm@...lanox.com>,
"jeffrey.t.kirsher@...el.com" <jeffrey.t.kirsher@...el.com>,
"maciej.fijalkowski@...el.com" <maciej.fijalkowski@...el.com>,
"maciejromanfijalkowski@...il.com" <maciejromanfijalkowski@...il.com>
Subject: Re: [PATCH bpf-next 02/12] xsk: consolidate to one single cached
producer pointer
On Mon, Dec 09, 2019 at 08:56:19AM +0100, Magnus Karlsson wrote:
> Currently, the xsk ring code has two cached producer pointers:
> prod_head and prod_tail. This patch consolidates these two into a
> single one called cached_prod to make the code simpler and easier to
> maintain. This will be in line with the user space part of the the
> code found in libbpf, that only uses a single cached pointer.
>
> The Rx path only uses the two top level functions
> xskq_produce_batch_desc and xskq_produce_flush_desc and they both use
> prod_head and never prod_tail. So just move them over to
> cached_prod.
>
> The Tx XDP_DRV path uses xskq_produce_addr_lazy and
> xskq_produce_flush_addr_n and unnecessarily operates on both prod_tail
> and prod_cons, so move them over to just use cached_prod by skipping
prod_cons or prod_head?
> the intermediate step of updating prod_tail.
>
> The Tx path in XDP_SKB mode uses xskq_reserve_addr and
> xskq_produce_addr. They currently use both cached pointers, but we can
> operate on the global producer pointer in xskq_produce_addr since it
> has to be updated anyway, thus eliminating the use of both cached
> pointers. We can also remove the xskq_nb_free in xskq_produce_addr
> since it is already called in xskq_reserve_addr. No need to do it
> twice.
>
> When there is only one cached producer pointer, we can also simplify
> xskq_nb_free by removing one argument.
Powered by blists - more mailing lists