netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Horatiu Vultur <horatiu.vultur@microchip.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<bpf@vger.kernel.org>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<ast@kernel.org>, <daniel@iogearbox.net>, <hawk@kernel.org>,
	<john.fastabend@gmail.com>, <alexandr.lobakin@intel.com>,
	<UNGLinuxDriver@microchip.com>
Subject: Re: [PATCH net-next v4 4/7] net: lan966x: Update rxq memory model
Date: Tue, 22 Nov 2022 23:01:20 +0100	[thread overview]
Message-ID: <Y31GsPEhDOsCB70i@boxer> (raw)
In-Reply-To: <20221122214413.3446006-5-horatiu.vultur@microchip.com>

On Tue, Nov 22, 2022 at 10:44:10PM +0100, Horatiu Vultur wrote:
> By default the rxq memory model is MEM_TYPE_PAGE_SHARED but to be able
> to reuse pages on the TX side, when the XDP action XDP_TX it is required
> to update the memory model to PAGE_POOL.
> 
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> ---
>  .../net/ethernet/microchip/lan966x/lan966x_fdma.c  | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
> index 384ed34197d58..483d1470c8362 100644
> --- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
> +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
> @@ -78,8 +78,22 @@ static int lan966x_fdma_rx_alloc_page_pool(struct lan966x_rx *rx)
>  		.max_len = rx->max_mtu -
>  			   SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
>  	};
> +	struct lan966x_port *port;

port can be scoped only for the loop below?

> +	int i;
>  
>  	rx->page_pool = page_pool_create(&pp_params);
> +
> +	for (i = 0; i < lan966x->num_phys_ports; ++i) {

Quoting Alex from some other thread:

"Since we're on -std=gnu11 for a bunch of releases already, all new
loops are expected to go with the iterator declarations inside them."

TBH I wasn't aware of that personally :)

> +		if (!lan966x->ports[i])
> +			continue;
> +
> +		port = lan966x->ports[i];
> +
> +		xdp_rxq_info_unreg_mem_model(&port->xdp_rxq);
> +		xdp_rxq_info_reg_mem_model(&port->xdp_rxq, MEM_TYPE_PAGE_POOL,
> +					   rx->page_pool);
> +	}
> +
>  	return PTR_ERR_OR_ZERO(rx->page_pool);
>  }
>  
> -- 
> 2.38.0
> 

  reply	other threads:[~2022-11-22 22:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22 21:44 [PATCH net-next v4 0/7] net: lan966x: Extend xdp support Horatiu Vultur
2022-11-22 21:44 ` [PATCH net-next v4 1/7] net: lan966x: Add XDP_PACKET_HEADROOM Horatiu Vultur
2022-11-22 21:44 ` [PATCH net-next v4 2/7] net: lan966x: Introduce helper functions Horatiu Vultur
2022-11-22 21:44 ` [PATCH net-next v4 3/7] net: lan966x: Add len field to lan966x_tx_dcb_buf Horatiu Vultur
2022-11-22 21:44 ` [PATCH net-next v4 4/7] net: lan966x: Update rxq memory model Horatiu Vultur
2022-11-22 22:01   ` Maciej Fijalkowski [this message]
2022-11-23 19:59     ` Horatiu Vultur
2022-11-22 21:44 ` [PATCH net-next v4 5/7] net: lan966x: Update dma_dir of page_pool_params Horatiu Vultur
2022-11-22 21:44 ` [PATCH net-next v4 6/7] net: lan966x: Add support for XDP_TX Horatiu Vultur
2022-11-22 22:27   ` Maciej Fijalkowski
2022-11-23 20:19     ` Horatiu Vultur
2022-11-22 21:44 ` [PATCH net-next v4 7/7] net: lan966x: Add support for XDP_REDIRECT Horatiu Vultur

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=Y31GsPEhDOsCB70i@boxer \
    --to=maciej.fijalkowski@intel.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandr.lobakin@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=horatiu.vultur@microchip.com \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@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).