Netdev List
 help / color / mirror / Atom feed
From: Tariq Toukan <ttoukan.linux@gmail.com>
To: Daniel Machon <daniel.machon@microchip.com>,
	Tariq Toukan <tariqt@nvidia.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	netdev@vger.kernel.org, Saeed Mahameed <saeedm@nvidia.com>,
	Gal Pressman <gal@nvidia.com>,
	Leon Romanovsky <leonro@nvidia.com>, William Tu <witu@nvidia.com>,
	Parav Pandit <parav@nvidia.com>
Subject: Re: [PATCH net-next 5/5] net/mlx5e: do not create xdp_redirect for non-uplink rep
Date: Sun, 3 Nov 2024 09:33:45 +0200	[thread overview]
Message-ID: <f1b53677-7432-4343-af63-b29bf5b17e0d@gmail.com> (raw)
In-Reply-To: <20241101132214.7m65kp434b364apl@DEN-DL-M70577>



On 01/11/2024 15:22, Daniel Machon wrote:
> Hi Tariq, William
> 
>> From: William Tu <witu@nvidia.com>
>>
>> XDP and XDP socket require extra SQ/RQ/CQs. Most of these resources
>> are dynamically created: no XDP program loaded, no resources are
>> created. One exception is the SQ/CQ created for XDP_REDRIECT, used
>> for other netdev to forward packet to mlx5 for transmit. The patch
>> disables creation of SQ and CQ used for egress XDP_REDIRECT, by
>> checking whether ndo_xdp_xmit is set or not.
>>
>> For netdev without XDP support such as non-uplink representor, this
>> saves around 0.35MB of memory, per representor netdevice per channel.
>>
>> Signed-off-by: William Tu <witu@nvidia.com>
>> Reviewed-by: Parav Pandit <parav@nvidia.com>
>> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
>> ---
>>   .../net/ethernet/mellanox/mlx5/core/en_main.c   | 17 +++++++++++------
>>   1 file changed, 11 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>> index 2f609b92d29b..59d7a0e28f24 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>> @@ -2514,6 +2514,7 @@ static int mlx5e_open_queues(struct mlx5e_channel *c,
>>                               struct mlx5e_params *params,
>>                               struct mlx5e_channel_param *cparam)
>>   {
>> +       const struct net_device_ops *netdev_ops = c->netdev->netdev_ops;
>>          struct dim_cq_moder icocq_moder = {0, 0};
>>          struct mlx5e_create_cq_param ccp;
>>          int err;
>> @@ -2534,10 +2535,12 @@ static int mlx5e_open_queues(struct mlx5e_channel *c,
>>          if (err)
>>                  goto err_close_icosq_cq;
>>
>> -       c->xdpsq = mlx5e_open_xdpredirect_sq(c, params, cparam, &ccp);
>> -       if (IS_ERR(c->xdpsq)) {
>> -               err = PTR_ERR(c->xdpsq);
>> -               goto err_close_tx_cqs;
>> +       if (netdev_ops->ndo_xdp_xmit) {
> 
> Is it possible to have ndo_xdp_xmit() set, but *not* have an XDP prog attached
> to the netdevice? I see that c->xdp = !!params->xdp_prog - could that be
> used instead?
> 
> /Daniel
> 

Hi Daniel,

Unlike drivers of other vendors, in mlx5e we have the 
egress-xdp-redirect feature enabled without the need to load a dummy xdp 
program in rx.

  reply	other threads:[~2024-11-03  7:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-31 12:58 [PATCH net-next 0/5] mlx5 misc patches 2024-10-31 Tariq Toukan
2024-10-31 12:58 ` [PATCH net-next 1/5] net/mlx5: Rework esw qos domain init and cleanup Tariq Toukan
2024-10-31 12:58 ` [PATCH net-next 2/5] net/mlx5: DR, moved all the SWS code into a separate directory Tariq Toukan
2024-10-31 12:58 ` [PATCH net-next 3/5] net/mlx5: HWS, renamed the files in accordance with naming convention Tariq Toukan
2024-10-31 12:58 ` [PATCH net-next 4/5] net/mlx5e: move XDP_REDIRECT sq to dynamic allocation Tariq Toukan
2024-10-31 12:58 ` [PATCH net-next 5/5] net/mlx5e: do not create xdp_redirect for non-uplink rep Tariq Toukan
2024-11-01 13:22   ` Daniel Machon
2024-11-03  7:33     ` Tariq Toukan [this message]
2024-11-03 23:50 ` [PATCH net-next 0/5] mlx5 misc patches 2024-10-31 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=f1b53677-7432-4343-af63-b29bf5b17e0d@gmail.com \
    --to=ttoukan.linux@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=daniel.machon@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leonro@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=parav@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=witu@nvidia.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