]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: ionic: Provide RDMA reset support for the RDMA driver
authorAbhijit Gangurde <abhijit.gangurde@amd.com>
Wed, 3 Sep 2025 06:15:56 +0000 (11:45 +0530)
committerLeon Romanovsky <leon@kernel.org>
Thu, 11 Sep 2025 06:18:36 +0000 (02:18 -0400)
The Ethernet driver holds the privilege to execute the device commands.
Export the function to execute RDMA reset command for use by RDMA driver.

Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com>
Link: https://patch.msgid.link/20250903061606.4139957-5-abhijit.gangurde@amd.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/net/ethernet/pensando/ionic/ionic_api.h
drivers/net/ethernet/pensando/ionic/ionic_aux.c

index d75902ca34af3bfd0da3589b3ba9bb8a819d8493..e0b766d1769f54ae1cc3ed09dc18849f2db05d2c 100644 (file)
@@ -54,4 +54,13 @@ int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
  */
 int ionic_error_to_errno(enum ionic_status_code code);
 
+/**
+ * ionic_request_rdma_reset - request reset or disable the device or lif
+ * @lif:        Logical interface
+ *
+ * The reset is triggered asynchronously. It will wait until reset request
+ * completes or times out.
+ */
+void ionic_request_rdma_reset(struct ionic_lif *lif);
+
 #endif /* _IONIC_API_H_ */
index f3c2a5227b363ea4839441997624376ab56a549e..a2be338eb3e5f99052ff47e4a51113996a8b39d6 100644 (file)
@@ -78,3 +78,25 @@ void ionic_auxbus_unregister(struct ionic_lif *lif)
 out:
        mutex_unlock(&lif->adev_lock);
 }
+
+void ionic_request_rdma_reset(struct ionic_lif *lif)
+{
+       struct ionic *ionic = lif->ionic;
+       int err;
+
+       union ionic_dev_cmd cmd = {
+               .cmd.opcode = IONIC_CMD_RDMA_RESET_LIF,
+               .cmd.lif_index = cpu_to_le16(lif->index),
+       };
+
+       mutex_lock(&ionic->dev_cmd_lock);
+
+       ionic_dev_cmd_go(&ionic->idev, &cmd);
+       err = ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT);
+
+       mutex_unlock(&ionic->dev_cmd_lock);
+
+       if (err)
+               pr_warn("%s request_reset: error %d\n", __func__, err);
+}
+EXPORT_SYMBOL_NS(ionic_request_rdma_reset, "NET_IONIC");