All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Joyner <eric.joyner@amd.com>
To: <netdev@vger.kernel.org>, <linux-rdma@vger.kernel.org>
Cc: Brett Creeley <brett.creeley@amd.com>,
	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>,
	Abhijit Gangurde <abhijit.gangurde@amd.com>,
	Allen Hubbe <allen.hubbe@amd.com>, Jason Gunthorpe <jgg@ziepe.ca>,
	Leon Romanovsky <leon@kernel.org>,
	Eric Joyner <eric.joyner@amd.com>
Subject: [PATCH net-next 2/4] net/ionic: Add devlink parameter for RDMA
Date: Tue, 5 May 2026 21:19:33 -0700	[thread overview]
Message-ID: <20260506041935.1061-3-eric.joyner@amd.com> (raw)
In-Reply-To: <20260506041935.1061-1-eric.joyner@amd.com>

From: Abhijit Gangurde <abhijit.gangurde@amd.com>

Provides a devlink parameter to the ionic Ethernet driver to
enable/disable the RDMA feature.

Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com>
Signed-off-by: Eric Joyner <eric.joyner@amd.com>
---
 .../net/ethernet/pensando/ionic/ionic_aux.c   |  3 +-
 .../ethernet/pensando/ionic/ionic_devlink.c   | 75 +++++++++++++++++++
 2 files changed, 77 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_aux.c b/drivers/net/ethernet/pensando/ionic/ionic_aux.c
index 4f193d0ee87a..689624f19f45 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_aux.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_aux.c
@@ -23,7 +23,8 @@ int ionic_auxbus_register(struct ionic_lif *lif)
 	struct auxiliary_device *aux_dev;
 	int err, id;
 
-	if (!(le64_to_cpu(lif->ionic->ident.lif.capabilities) & IONIC_LIF_CAP_RDMA))
+	if (!IS_ENABLED(CONFIG_INFINIBAND_IONIC) ||
+	    !(le64_to_cpu(lif->ionic->ident.lif.capabilities) & IONIC_LIF_CAP_RDMA))
 		return 0;
 
 	ionic_adev = kzalloc_obj(*ionic_adev);
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_devlink.c b/drivers/net/ethernet/pensando/ionic/ionic_devlink.c
index 4ec66a6be073..ab4f6a37c7f8 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_devlink.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_devlink.c
@@ -8,6 +8,7 @@
 #include "ionic_bus.h"
 #include "ionic_lif.h"
 #include "ionic_devlink.h"
+#include "ionic_aux.h"
 
 static int ionic_dl_flash_update(struct devlink *dl,
 				 struct devlink_flash_update_params *params,
@@ -56,6 +57,72 @@ static const struct devlink_ops ionic_dl_ops = {
 	.flash_update	= ionic_dl_flash_update,
 };
 
+static bool is_aux_enabled(struct ionic *ionic)
+{
+	return !!ionic->lif->ionic_adev;
+}
+
+static int ionic_devlink_enable_rdma_get(struct devlink *dl, u32 id,
+					 struct devlink_param_gset_ctx *ctx,
+					 struct netlink_ext_ack *extack)
+{
+	ctx->val.vbool = is_aux_enabled(devlink_priv(dl));
+	return 0;
+}
+
+static int ionic_devlink_enable_rdma_set(struct devlink *dl, u32 id,
+					 struct devlink_param_gset_ctx *ctx,
+					 struct netlink_ext_ack *extack)
+{
+	struct ionic *ionic = devlink_priv(dl);
+	int err = 0;
+
+	if (ctx->val.vbool == is_aux_enabled(ionic))
+		return err;
+
+	if (ctx->val.vbool)
+		err = ionic_auxbus_register(ionic->lif);
+	else
+		ionic_auxbus_unregister(ionic->lif);
+
+	return err;
+}
+
+static int ionic_devlink_enable_rdma_validate(struct devlink *dl, u32 id,
+					      union devlink_param_value val,
+					      struct netlink_ext_ack *extack)
+{
+	struct ionic *ionic = devlink_priv(dl);
+	bool new_state = val.vbool;
+
+	if (new_state &&
+	    !(le64_to_cpu(ionic->ident.lif.capabilities) & IONIC_LIF_CAP_RDMA))
+		return -EOPNOTSUPP;
+
+	return 0;
+}
+
+static const struct devlink_param ionic_dl_rdma_params[] = {
+	DEVLINK_PARAM_GENERIC(ENABLE_RDMA, BIT(DEVLINK_PARAM_CMODE_RUNTIME),
+			      ionic_devlink_enable_rdma_get, ionic_devlink_enable_rdma_set,
+			      ionic_devlink_enable_rdma_validate),
+};
+
+static int ionic_dl_rdma_params_register(struct devlink *dl)
+{
+	if (!IS_ENABLED(CONFIG_INFINIBAND_IONIC))
+		return 0;
+
+	return devlink_params_register(dl, ionic_dl_rdma_params,
+				       ARRAY_SIZE(ionic_dl_rdma_params));
+}
+
+static void ionic_devlink_rdma_params_unregister(struct devlink *dl)
+{
+	devlink_params_unregister(dl, ionic_dl_rdma_params,
+				  ARRAY_SIZE(ionic_dl_rdma_params));
+}
+
 struct ionic *ionic_devlink_alloc(struct device *dev)
 {
 	struct devlink *dl;
@@ -82,9 +149,17 @@ int ionic_devlink_register(struct ionic *ionic)
 
 	attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL;
 	devlink_port_attrs_set(&ionic->dl_port, &attrs);
+
+	err = ionic_dl_rdma_params_register(dl);
+	if (err) {
+		dev_err(ionic->dev, "ionic_dl_rdma_params_register failed: %d\n", err);
+		return err;
+	}
+
 	err = devlink_port_register(dl, &ionic->dl_port, 0);
 	if (err) {
 		dev_err(ionic->dev, "devlink_port_register failed: %d\n", err);
+		ionic_devlink_rdma_params_unregister(dl);
 		return err;
 	}
 
-- 
2.17.1


  parent reply	other threads:[~2026-05-06  4:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06  4:19 [PATCH net-next 0/4] RDMA/net/ionic: Misc updates Eric Joyner
2026-05-06  4:19 ` [PATCH net-next 1/4] RDMA/ionic: Update copyright year to 2026 Eric Joyner
2026-05-06  4:19 ` Eric Joyner [this message]
2026-05-06  4:19 ` [PATCH net-next 3/4] RDMA/ionic: Add debugfs support Eric Joyner
2026-05-13  7:21   ` Leon Romanovsky
2026-05-14  0:23     ` Jakub Kicinski
2026-05-14  6:00       ` Leon Romanovsky
2026-05-14  7:04         ` Greg Kroah-Hartman
2026-05-14 16:35           ` Leon Romanovsky
2026-05-06  4:19 ` [PATCH net-next 4/4] RDMA/ionic: Add DCQCN parameter configuration via debugfs Eric Joyner
2026-05-06 22:59 ` [PATCH net-next 0/4] RDMA/net/ionic: Misc updates Jakub Kicinski
2026-05-14 14:33   ` Abhijit Gangurde
2026-05-14 16:40     ` Leon Romanovsky
2026-05-14 17:19       ` Creeley, Brett

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=20260506041935.1061-3-eric.joyner@amd.com \
    --to=eric.joyner@amd.com \
    --cc=abhijit.gangurde@amd.com \
    --cc=allen.hubbe@amd.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=brett.creeley@amd.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jgg@ziepe.ca \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-rdma@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 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.