All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
To: Tariq Toukan <ttoukan.linux@gmail.com>
Cc: Lorenzo Bianconi <lorenzo@kernel.org>,
	netdev@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, saeedm@nvidia.com, leon@kernel.org,
	shayagr@amazon.com, akiyano@amazon.com, darinzon@amazon.com,
	sgoutham@marvell.com, toke@redhat.com, teknoraver@meta.com,
	Tariq Toukan <tariqt@nvidia.com>
Subject: Re: [PATCH net-next 7/8] net/mlx5e: take into account device reconfiguration for xdp_features flag
Date: Thu, 9 Mar 2023 09:43:34 +0100	[thread overview]
Message-ID: <ZAmcNtcP7CbkgCC0@lore-desk> (raw)
In-Reply-To: <03095151-3659-0b1b-8e67-a416b8eafa2b@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 8225 bytes --]

> 
> 
> On 08/03/2023 17:47, Lorenzo Bianconi wrote:
> > > 
> > > 
> > > On 07/03/2023 16:54, Lorenzo Bianconi wrote:
> > > > Take into account LRO and GRO configuration setting device xdp_features
> > > > flag. Moreover consider channel rq_wq_type enabling rx scatter-gatter
> > > > support in xdp_features flag.
> > > > 
> > > > Fixes: 66c0e13ad236 ("drivers: net: turn on XDP features")
> > > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > > > ---
> > > >    drivers/net/ethernet/mellanox/mlx5/core/en.h  |  1 +
> > > >    .../ethernet/mellanox/mlx5/core/en_ethtool.c  | 10 ++++-
> > > >    .../net/ethernet/mellanox/mlx5/core/en_main.c | 45 ++++++++++++++++---
> > > >    .../net/ethernet/mellanox/mlx5/core/en_rep.c  |  3 ++
> > > >    4 files changed, 51 insertions(+), 8 deletions(-)
> > > > 
> > > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
> > > > index 88460b7796e5..4276c6eb6820 100644
> > > > --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
> > > > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
> > > > @@ -1243,6 +1243,7 @@ void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, u16
> > > >    void mlx5e_rx_dim_work(struct work_struct *work);
> > > >    void mlx5e_tx_dim_work(struct work_struct *work);
> > > > +void mlx5e_set_xdp_feature(struct net_device *netdev);
> > > >    netdev_features_t mlx5e_features_check(struct sk_buff *skb,
> > > >    				       struct net_device *netdev,
> > > >    				       netdev_features_t features);
> > > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> > > > index 7708acc9b2ab..79fd21ecb9cb 100644
> > > > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> > > > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> > > > @@ -1985,6 +1985,7 @@ static int set_pflag_rx_striding_rq(struct net_device *netdev, bool enable)
> > > >    	struct mlx5e_priv *priv = netdev_priv(netdev);
> > > >    	struct mlx5_core_dev *mdev = priv->mdev;
> > > >    	struct mlx5e_params new_params;
> > > > +	int err;
> > > >    	if (enable) {
> > > >    		/* Checking the regular RQ here; mlx5e_validate_xsk_param called
> > > > @@ -2005,7 +2006,14 @@ static int set_pflag_rx_striding_rq(struct net_device *netdev, bool enable)
> > > >    	MLX5E_SET_PFLAG(&new_params, MLX5E_PFLAG_RX_STRIDING_RQ, enable);
> > > >    	mlx5e_set_rq_type(mdev, &new_params);
> > > > -	return mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, true);
> > > > +	err = mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, true);
> > > > +	if (err)
> > > > +		return err;
> > > > +
> > > > +	/* update XDP supported features */
> > > > +	mlx5e_set_xdp_feature(netdev);
> > > > +
> > > > +	return 0;
> > > >    }
> > > >    static int set_pflag_rx_no_csum_complete(struct net_device *netdev, bool enable)
> > > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> > > > index 76a9c5194a70..1b68dd2be2c5 100644
> > > > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> > > > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> > > > @@ -4004,6 +4004,30 @@ static int mlx5e_handle_feature(struct net_device *netdev,
> > > >    	return 0;
> > > >    }
> > > > +void mlx5e_set_xdp_feature(struct net_device *netdev)
> > > > +{
> > > > +	struct mlx5e_priv *priv = netdev_priv(netdev);
> > > > +	bool ndo_xmit = test_bit(MLX5E_STATE_XDP_ACTIVE, &priv->state);
> > > 
> > > Our driver doesn't require loading a dummy XDP program to have the
> > > redirect-in ability. It's always there.
> > > 
> > > I actually have a bug fix under internal review with Saeed that addresses
> > > this.
> > > 
> > > In addition, it cleans up the NETDEV_XDP_ACT_NDO_XMIT_SG as we do not
> > > support it yet. I have a series that's adding support and will submit it
> > > soon.
> > > 
> > > Any reason you're submitting these fixes to net-next rather than net?
> > 
> > Hi Tariq,
> > 
> > I am fine to repost this series for net instead of net-next. Any downsides about
> > it?
> 
> Let's repost to net.
> It's a fixes series, and 6.3 is still in its RCs.
> If you don't post it to net then the xdp-features in 6.3 will be broken.

ack, fine.

> 
> > 
> > > Maybe it'd be better if we integrate the patches, here's my fix (still under
> > > review...):
> > > 
> > > Author: Tariq Toukan <tariqt@nvidia.com>
> > > Date:   Thu Feb 23 08:58:04 2023 +0200
> > > 
> > >      net/mlx5e: Fix exposed xdp_features
> > > 
> > >      Always declare NETDEV_XDP_ACT_NDO_XMIT as the ndo_xdp_xmit callback
> > >      is always functional per our design, and does not require loading
> > >      a dummy xdp program.
> > > 
> > >      Although non-linear XDP buffer is supported for XDP_TX flow, do not
> > >      declare NETDEV_XDP_ACT_NDO_XMIT_SG as it is yet supported for
> > >      redirected-in frames.
> > > 
> > >      Fixes: 66c0e13ad236 ("drivers: net: turn on XDP features")
> > >      Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> > > 
> > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> > > b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> > > index 53feb0529943..9a5d3ce1fbcd 100644
> > > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> > > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> > > @@ -4741,13 +4741,6 @@ static int mlx5e_xdp_set(struct net_device *netdev,
> > > struct bpf_prog *prog)
> > >          if (old_prog)
> > >                  bpf_prog_put(old_prog);
> > > 
> > > -       if (reset) {
> > > -               if (prog)
> > > -                       xdp_features_set_redirect_target(netdev, true);
> > > -               else
> > > -                       xdp_features_clear_redirect_target(netdev);
> > > -       }
> > > -
> > >          if (!test_bit(MLX5E_STATE_OPENED, &priv->state) || reset)
> > >                  goto unlock;
> > > 
> > > @@ -5144,6 +5137,7 @@ static void mlx5e_build_nic_netdev(struct net_device
> > > *netdev)
> > >          netdev->features         |= NETIF_F_HW_VLAN_STAG_FILTER;
> > > 
> > >          netdev->xdp_features = NETDEV_XDP_ACT_BASIC |
> > > NETDEV_XDP_ACT_REDIRECT |
> > > +                              NETDEV_XDP_ACT_NDO_XMIT |
> > >                                 NETDEV_XDP_ACT_XSK_ZEROCOPY |
> > >                                 NETDEV_XDP_ACT_RX_SG;
> > 
> > I am fine to drop this my patch and rely on the one you provided but it depends
> > on the eta about the described patches because otherwise real capabilities and
> > xdp-features will not be aligned. Any inputs on it?
> > 
> 
> My patch doesn't replace yours, as it doesn't fix the missing
> features_update according to striding RQ and HW LRO/GRO.
> 
> I think we should combine them, either take mine as-is into your series, or
> squash it into this patch. I'm fine with both.

ack fine, I will squash your changes into the patch posting a new version, thx.

Regards,
Lorenzo

> 
> > > 
> > > 
> > > > +	struct mlx5e_params *params = &priv->channels.params;
> > > > +	xdp_features_t val;
> > > > +
> > > > +	if (params->packet_merge.type != MLX5E_PACKET_MERGE_NONE) {
> > > > +		xdp_clear_features_flag(netdev);
> > > > +		return;
> > > > +	}
> > > > +
> > > > +	val = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT |
> > > > +	      NETDEV_XDP_ACT_XSK_ZEROCOPY;
> > > > +	if (ndo_xmit)
> > > > +		val |= NETDEV_XDP_ACT_NDO_XMIT;
> > > > +	if (params->rq_wq_type == MLX5_WQ_TYPE_CYCLIC) {
> > > > +		val |= NETDEV_XDP_ACT_RX_SG;
> > > > +		if (ndo_xmit)
> > > > +			val |= NETDEV_XDP_ACT_NDO_XMIT_SG;
> > > 
> > > This NETDEV_XDP_ACT_NDO_XMIT_SG capability is not related to the RQ type.
> > > It's still not supported at this point.
> > 
> > ack, I will fix it.
> > 
> > > 
> > > BTW, I have a series completing all the missing capabilities (multibuf on
> > > Striding + multibuf redirect-in), should be submitted in this kernel.
> > 
> > cool :)
> > 
> > Regards,
> > Lorenzo
> > 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  parent reply	other threads:[~2023-03-09  8:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07 14:53 [PATCH net-next 0/8] update xdp_features flag according to NIC re-configuration Lorenzo Bianconi
2023-03-07 14:53 ` [PATCH net-next 1/8] tools: ynl: fix render-max for flags definition Lorenzo Bianconi
2023-03-08  8:06   ` Jakub Kicinski
2023-03-08 10:28     ` Lorenzo Bianconi
2023-03-07 14:53 ` [PATCH net-next 2/8] tools: ynl: fix get_mask utility routine Lorenzo Bianconi
2023-03-07 14:54 ` [PATCH net-next 3/8] xdp: add xdp_set_features_flag " Lorenzo Bianconi
2023-03-07 14:54 ` [PATCH net-next 4/8] net: thunderx: take into account xdp_features setting tx/rx queues Lorenzo Bianconi
2023-03-07 14:54 ` [PATCH net-next 5/8] net: ena: " Lorenzo Bianconi
2023-03-08 10:25   ` Shay Agroskin
2023-03-07 14:54 ` [PATCH net-next 6/8] veth: take into account device reconfiguration for xdp_features flag Lorenzo Bianconi
2023-03-07 14:54 ` [PATCH net-next 7/8] net/mlx5e: " Lorenzo Bianconi
2023-03-08 10:33   ` Tariq Toukan
2023-03-08 15:47     ` Lorenzo Bianconi
2023-03-09  7:23       ` Tariq Toukan
2023-03-09  7:32         ` Jakub Kicinski
2023-03-09  8:40           ` Lorenzo Bianconi
2023-03-09  8:43         ` Lorenzo Bianconi [this message]
2023-03-07 14:54 ` [PATCH net-next 8/8] mvpp2: take care of xdp_features when reconfiguring queues Lorenzo Bianconi

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=ZAmcNtcP7CbkgCC0@lore-desk \
    --to=lorenzo.bianconi@redhat.com \
    --cc=akiyano@amazon.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=darinzon@amazon.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=sgoutham@marvell.com \
    --cc=shayagr@amazon.com \
    --cc=tariqt@nvidia.com \
    --cc=teknoraver@meta.com \
    --cc=toke@redhat.com \
    --cc=ttoukan.linux@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.