From: Simon Horman <simon.horman@corigine.com>
To: Sriram Yagnaraman <sriram.yagnaraman@est.tech>
Cc: intel-wired-lan@lists.osuosl.org, bpf@vger.kernel.org,
netdev@vger.kernel.org,
Jesse Brandeburg <jesse.brandeburg@intel.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>
Subject: Re: [PATCH 3/4] igb: add AF_XDP zero-copy Rx support
Date: Tue, 4 Jul 2023 20:30:59 +0100 [thread overview]
Message-ID: <ZKRzc5aPjVmLQP9k@corigine.com> (raw)
In-Reply-To: <20230704095915.9750-4-sriram.yagnaraman@est.tech>
On Tue, Jul 04, 2023 at 11:59:14AM +0200, Sriram Yagnaraman wrote:
> Add support for AF_XDP zero-copy receive path.
>
> Add IGB_RING_FLAG_AF_XDP_ZC ring flag to indicate that a ring has AF_XDP
> zero-copy support. This flag is used in igb_configure_rx_ring to
> register XSK_BUFF_POOL (if zero-copy is enabled) memory model or the
> default PAGE_SHARED model otherwise.
>
> When AF_XDP zero-copy is enabled, the rx buffers are allocated from the
> xsk buff pool using igb_alloc_rx_buffers_zc.
>
> Signed-off-by: Sriram Yagnaraman <sriram.yagnaraman@est.tech>
...
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index 391c0eb136d9..f4dbb75d6eac 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -2013,7 +2013,9 @@ static void igb_configure(struct igb_adapter *adapter)
> */
> for (i = 0; i < adapter->num_rx_queues; i++) {
> struct igb_ring *ring = adapter->rx_ring[i];
> - igb_alloc_rx_buffers(ring, igb_desc_unused(ring));
> + ring->xsk_pool ?
> + igb_alloc_rx_buffers_zc(ring, igb_desc_unused(ring)) :
> + igb_alloc_rx_buffers(ring, igb_desc_unused(ring));
This construction seems a little unusual (to me) as the result of
the ternary operator is not assigned. I wonder if it it would
be sensible to follow a simple if/else pattern here.o
Flagged by Sparse as:
.../igb_main.c:2016:32: error: incompatible types in conditional expression (different base types):
.../igb_main.c:2016:32: bool
.../igb_main.c:2016:32: void
...
> @@ -4892,7 +4917,9 @@ void igb_txrx_ring_enable(struct igb_adapter *adapter, u16 qid)
> * at least 1 descriptor unused to make sure
> * next_to_use != next_to_clean
> */
> - igb_alloc_rx_buffers(rx_ring, igb_desc_unused(rx_ring));
> + rx_ring->xsk_pool ?
> + igb_alloc_rx_buffers_zc(rx_ring, igb_desc_unused(rx_ring)) :
> + igb_alloc_rx_buffers(rx_ring, igb_desc_unused(rx_ring));
Ditto.
...
> +static int igb_xsk_pool_disable(struct igb_adapter *adapter, u16 qid)
> +{
> + struct igb_ring *rx_ring;
> + struct xsk_buff_pool *pool;
> + bool if_running;
Please use reverse xmas tree - longest line to shortest - for
new Networking code. Likewise elsewhere in this patch.
You can use the tool at the link below to help.
https://github.com/ecree-solarflare/xmastree
...
next prev parent reply other threads:[~2023-07-04 19:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-04 9:59 [PATCH 0/4] igb: Add support for AF_XDP zero-copy Sriram Yagnaraman
2023-07-04 9:59 ` [PATCH 1/4] igb: prepare for AF_XDP zero-copy support Sriram Yagnaraman
2023-07-04 9:59 ` [PATCH 2/4] igb: Introduce txrx ring enable/disable functions Sriram Yagnaraman
2023-07-04 15:38 ` Maciej Fijalkowski
2023-07-04 9:59 ` [PATCH 3/4] igb: add AF_XDP zero-copy Rx support Sriram Yagnaraman
2023-07-04 19:30 ` Simon Horman [this message]
2023-07-05 17:16 ` kernel test robot
2023-07-04 9:59 ` [PATCH 4/4] igb: add AF_XDP zero-copy Tx support Sriram Yagnaraman
2023-07-04 15:37 ` [PATCH 0/4] igb: Add support for AF_XDP zero-copy Maciej Fijalkowski
2023-07-04 18:48 ` Sriram Yagnaraman
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=ZKRzc5aPjVmLQP9k@corigine.com \
--to=simon.horman@corigine.com \
--cc=anthony.l.nguyen@intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jesse.brandeburg@intel.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sriram.yagnaraman@est.tech \
/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).