public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: netdev@vger.kernel.org
Cc: 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, tariqt@nvidia.com, leon@kernel.org,
	shayagr@amazon.com, akiyano@amazon.com, darinzon@amazon.com,
	sgoutham@marvell.com, lorenzo.bianconi@redhat.com,
	toke@redhat.com, teknoraver@meta.com
Subject: [PATCH net-next 8/8] mvpp2: take care of xdp_features when reconfiguring queues
Date: Tue,  7 Mar 2023 15:54:05 +0100	[thread overview]
Message-ID: <fe34ea957afb95ce255a17ec79df08d9647b72c7.1678200041.git.lorenzo@kernel.org> (raw)
In-Reply-To: <cover.1678200041.git.lorenzo@kernel.org>

From: Matteo Croce <teknoraver@meta.com>

XDP is supported only if enough queues are present, so when reconfiguring
the queues set xdp_features accordingly.

Fixes: 66c0e13ad236 ("drivers: net: turn on XDP features")
Suggested-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Matteo Croce <teknoraver@meta.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 9b4ecbe4f36d..3ea00bc9b91c 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -4996,6 +4996,14 @@ static int mvpp2_bm_switch_buffers(struct mvpp2 *priv, bool percpu)
 
 	for (i = 0; i < priv->port_count; i++) {
 		port = priv->port_list[i];
+		if (percpu && port->ntxqs >= num_possible_cpus() * 2)
+			xdp_set_features_flag(port->dev,
+					      NETDEV_XDP_ACT_BASIC |
+					      NETDEV_XDP_ACT_REDIRECT |
+					      NETDEV_XDP_ACT_NDO_XMIT);
+		else
+			xdp_clear_features_flag(port->dev);
+
 		mvpp2_swf_bm_pool_init(port);
 		if (status[i])
 			mvpp2_open(port->dev);
@@ -6863,13 +6871,14 @@ static int mvpp2_port_probe(struct platform_device *pdev,
 
 	if (!port->priv->percpu_pools)
 		mvpp2_set_hw_csum(port, port->pool_long->id);
+	else if (port->ntxqs >= num_possible_cpus() * 2)
+		dev->xdp_features = NETDEV_XDP_ACT_BASIC |
+				    NETDEV_XDP_ACT_REDIRECT |
+				    NETDEV_XDP_ACT_NDO_XMIT;
 
 	dev->vlan_features |= features;
 	netif_set_tso_max_segs(dev, MVPP2_MAX_TSO_SEGS);
 
-	dev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT |
-			    NETDEV_XDP_ACT_NDO_XMIT;
-
 	dev->priv_flags |= IFF_UNICAST_FLT;
 
 	/* MTU range: 68 - 9704 */
-- 
2.39.2


      parent reply	other threads:[~2023-03-07 15:03 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
2023-03-07 14:54 ` Lorenzo Bianconi [this message]

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=fe34ea957afb95ce255a17ec79df08d9647b72c7.1678200041.git.lorenzo@kernel.org \
    --to=lorenzo@kernel.org \
    --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.bianconi@redhat.com \
    --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 \
    /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