From: Alexander Lobakin <aleksander.lobakin@intel•com>
To: Petr Machata <petrm@nvidia•com>, Amit Cohen <amcohen@nvidia•com>
Cc: <netdev@vger•kernel.org>, Andrew Lunn <andrew+netdev@lunn•ch>,
"David S. Miller" <davem@davemloft•net>,
Eric Dumazet <edumazet@google•com>,
"Jakub Kicinski" <kuba@kernel•org>,
Paolo Abeni <pabeni@redhat•com>, Simon Horman <horms@kernel•org>,
Danielle Ratson <danieller@nvidia•com>,
Ido Schimmel <idosch@nvidia•com>, <mlxsw@nvidia•com>,
Jiri Pirko <jiri@resnulli•us>
Subject: Re: [PATCH net 3/5] mlxsw: pci: Sync Rx buffers for device
Date: Fri, 25 Oct 2024 17:02:44 +0200 [thread overview]
Message-ID: <a68cedfb-cd9e-4b93-a99e-ae30b9c837eb@intel.com> (raw)
In-Reply-To: <92e01f05c4f506a4f0a9b39c10175dcc01994910.1729866134.git.petrm@nvidia.com>
From: Petr Machata <petrm@nvidia•com>
Date: Fri, 25 Oct 2024 16:26:27 +0200
> From: Amit Cohen <amcohen@nvidia•com>
>
> Non-coherent architectures, like ARM, may require invalidating caches
> before the device can use the DMA mapped memory, which means that before
> posting pages to device, drivers should sync the memory for device.
>
> Sync for device can be configured as page pool responsibility. Set the
> relevant flag and define max_len for sync.
>
> Cc: Jiri Pirko <jiri@resnulli•us>
> Fixes: b5b60bb491b2 ("mlxsw: pci: Use page pool for Rx buffers allocation")
> Signed-off-by: Amit Cohen <amcohen@nvidia•com>
> Reviewed-by: Ido Schimmel <idosch@nvidia•com>
> Signed-off-by: Petr Machata <petrm@nvidia•com>
> ---
> drivers/net/ethernet/mellanox/mlxsw/pci.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c
> index 2320a5f323b4..d6f37456fb31 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/pci.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c
> @@ -996,12 +996,13 @@ static int mlxsw_pci_cq_page_pool_init(struct mlxsw_pci_queue *q,
> if (cq_type != MLXSW_PCI_CQ_RDQ)
> return 0;
>
> - pp_params.flags = PP_FLAG_DMA_MAP;
> + pp_params.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV;
> pp_params.pool_size = MLXSW_PCI_WQE_COUNT * mlxsw_pci->num_sg_entries;
> pp_params.nid = dev_to_node(&mlxsw_pci->pdev->dev);
> pp_params.dev = &mlxsw_pci->pdev->dev;
> pp_params.napi = &q->u.cq.napi;
> pp_params.dma_dir = DMA_FROM_DEVICE;
> + pp_params.max_len = PAGE_SIZE;
max_len is the maximum HW-writable area of a buffer. Headroom and
tailroom must be excluded. In your case
pp_params.max_len = PAGE_SIZE - MLXSW_PCI_RX_BUF_SW_OVERHEAD;
>
> page_pool = page_pool_create(&pp_params);
> if (IS_ERR(page_pool))
Thanks,
Olek
next prev parent reply other threads:[~2024-10-25 15:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-25 14:26 [PATCH net 0/5] mlxsw: Fixes Petr Machata
2024-10-25 14:26 ` [PATCH net 1/5] mlxsw: spectrum_ptp: Add missing verification before pushing Tx header Petr Machata
2024-10-25 14:26 ` [PATCH net 2/5] mlxsw: pci: Sync Rx buffers for CPU Petr Machata
2024-10-25 15:00 ` Alexander Lobakin
2024-10-27 7:29 ` Amit Cohen
2024-10-25 14:26 ` [PATCH net 3/5] mlxsw: pci: Sync Rx buffers for device Petr Machata
2024-10-25 15:02 ` Alexander Lobakin [this message]
2024-10-27 6:51 ` Amit Cohen
2024-10-29 15:12 ` Alexander Lobakin
2024-10-25 14:26 ` [PATCH net 4/5] mlxsw: spectrum_ipip: Fix memory leak when changing remote IPv6 address Petr Machata
2024-10-25 14:26 ` [PATCH net 5/5] selftests: forwarding: Add IPv6 GRE remote change tests Petr Machata
2024-10-31 1:30 ` [PATCH net 0/5] mlxsw: Fixes patchwork-bot+netdevbpf
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=a68cedfb-cd9e-4b93-a99e-ae30b9c837eb@intel.com \
--to=aleksander.lobakin@intel$(echo .)com \
--cc=amcohen@nvidia$(echo .)com \
--cc=andrew+netdev@lunn$(echo .)ch \
--cc=danieller@nvidia$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=edumazet@google$(echo .)com \
--cc=horms@kernel$(echo .)org \
--cc=idosch@nvidia$(echo .)com \
--cc=jiri@resnulli$(echo .)us \
--cc=kuba@kernel$(echo .)org \
--cc=mlxsw@nvidia$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
--cc=petrm@nvidia$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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