Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
To: jgg@nvidia.com, leon@kernel.org, intel-wired-lan@lists.osuosl.org
Cc: linux-rdma@vger.kernel.org, netdev@vger.kernel.org,
	Joshua Hay <joshua.a.hay@intel.com>,
	Tatyana Nikolova <tatyana.e.nikolova@intel.com>
Subject: [iwl-next v3 05/24] idpf: implement remaining IDC RDMA core callbacks and handlers
Date: Fri,  7 Feb 2025 13:49:12 -0600	[thread overview]
Message-ID: <20250207194931.1569-6-tatyana.e.nikolova@intel.com> (raw)
In-Reply-To: <20250207194931.1569-1-tatyana.e.nikolova@intel.com>

From: Joshua Hay <joshua.a.hay@intel.com>

Implement the idpf_idc_request_reset and idpf_idc_rdma_vc_send_sync
callbacks for the rdma core auxiliary driver to issue reset events to
the idpf and send (synchronous) virtchnl messages to the control plane
respectively.

Implement and plumb the reset handler for the opposite flow as well,
i.e. when the idpf is resetiing and needs to notify the rdma core
auxiliary driver.

Signed-off-by: Joshua Hay <joshua.a.hay@intel.com>
Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
---

v3:
- remove unnecessary iadrv NULL check

 drivers/net/ethernet/intel/idpf/idpf.h        |  1 +
 drivers/net/ethernet/intel/idpf/idpf_idc.c    | 43 ++++++++++++++++++-
 drivers/net/ethernet/intel/idpf/idpf_lib.c    |  2 +
 .../net/ethernet/intel/idpf/idpf_virtchnl.c   | 23 +++++++++-
 drivers/net/ethernet/intel/idpf/virtchnl2.h   |  3 +-
 5 files changed, 69 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/idpf/idpf.h b/drivers/net/ethernet/intel/idpf/idpf.h
index a9c0639f0021..9516e946781a 100644
--- a/drivers/net/ethernet/intel/idpf/idpf.h
+++ b/drivers/net/ethernet/intel/idpf/idpf.h
@@ -872,5 +872,6 @@ int idpf_idc_init_aux_core_dev(struct idpf_adapter *adapter,
 			       enum idc_function_type ftype);
 void idpf_idc_deinit_core_aux_device(struct idc_rdma_core_dev_info *cdev_info);
 void idpf_idc_deinit_vport_aux_device(struct idc_rdma_vport_dev_info *vdev_info);
+void idpf_idc_issue_reset_event(struct idc_rdma_core_dev_info *cdev_info);
 
 #endif /* !_IDPF_H_ */
diff --git a/drivers/net/ethernet/intel/idpf/idpf_idc.c b/drivers/net/ethernet/intel/idpf/idpf_idc.c
index a9049cb616a9..3dbd7e2a7e98 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_idc.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_idc.c
@@ -216,6 +216,38 @@ static void idpf_unplug_aux_dev(struct auxiliary_device *adev)
 	ida_free(&idpf_idc_ida, adev->id);
 }
 
+/**
+ * idpf_idc_issue_reset_event - Function to handle reset IDC event
+ * @cdev_info: IDC core device info pointer
+ */
+void idpf_idc_issue_reset_event(struct idc_rdma_core_dev_info *cdev_info)
+{
+	enum idc_rdma_event_type event_type = IDC_RDMA_EVENT_WARN_RESET;
+	struct idc_rdma_core_auxiliary_drv *iadrv;
+	struct idc_rdma_event event = { };
+	struct auxiliary_device *adev;
+
+	if (!cdev_info)
+		/* RDMA is not enabled */
+		return;
+
+	set_bit(event_type, event.type);
+
+	device_lock(&cdev_info->adev->dev);
+
+	adev = cdev_info->adev;
+	if (!adev || !adev->dev.driver)
+		goto unlock;
+
+	iadrv = container_of(adev->dev.driver,
+			     struct idc_rdma_core_auxiliary_drv,
+			     adrv.driver);
+	if (iadrv->event_handler)
+		iadrv->event_handler(cdev_info, &event);
+unlock:
+	device_unlock(&cdev_info->adev->dev);
+}
+
 /**
  * idpf_idc_vport_dev_up - called when CORE is ready for vport aux devs
  * @adapter: private data struct
@@ -300,7 +332,16 @@ static int
 idpf_idc_request_reset(struct idc_rdma_core_dev_info *cdev_info,
 		       enum idc_rdma_reset_type __always_unused reset_type)
 {
-	return -EOPNOTSUPP;
+	struct idpf_adapter *adapter = pci_get_drvdata(cdev_info->pdev);
+
+	if (!idpf_is_reset_in_prog(adapter)) {
+		set_bit(IDPF_HR_FUNC_RESET, adapter->flags);
+		queue_delayed_work(adapter->vc_event_wq,
+				   &adapter->vc_event_task,
+				   msecs_to_jiffies(10));
+	}
+
+	return 0;
 }
 
 /* Implemented by the Auxiliary Device and called by the Auxiliary Driver */
diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c
index a211fca9e925..88a33c8b18fe 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_lib.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c
@@ -1803,6 +1803,8 @@ static int idpf_init_hard_reset(struct idpf_adapter *adapter)
 	} else if (test_and_clear_bit(IDPF_HR_FUNC_RESET, adapter->flags)) {
 		bool is_reset = idpf_is_reset_detected(adapter);
 
+		idpf_idc_issue_reset_event(adapter->cdev_info);
+
 		idpf_set_vport_state(adapter);
 		idpf_vc_core_deinit(adapter);
 		if (!is_reset)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
index eaffda7a2673..bd20d7b148c2 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
@@ -3754,5 +3754,26 @@ int idpf_idc_rdma_vc_send_sync(struct idc_rdma_core_dev_info *cdev_info,
 			       u8 *send_msg, u16 msg_size,
 			       u8 *recv_msg, u16 *recv_len)
 {
-	return -EOPNOTSUPP;
+	struct idpf_adapter *adapter = pci_get_drvdata(cdev_info->pdev);
+	struct idpf_vc_xn_params xn_params = { };
+	ssize_t reply_sz;
+	u16 recv_size;
+
+	if (!recv_msg || !recv_len || msg_size > IDPF_CTLQ_MAX_BUF_LEN)
+		return -EINVAL;
+
+	recv_size = min_t(u16, *recv_len, IDPF_CTLQ_MAX_BUF_LEN);
+	*recv_len = 0;
+	xn_params.vc_op = VIRTCHNL2_OP_RDMA;
+	xn_params.timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC;
+	xn_params.send_buf.iov_base = send_msg;
+	xn_params.send_buf.iov_len = msg_size;
+	xn_params.recv_buf.iov_base = recv_msg;
+	xn_params.recv_buf.iov_len = recv_size;
+	reply_sz = idpf_vc_xn_exec(adapter, &xn_params);
+	if (reply_sz < 0)
+		return reply_sz;
+	*recv_len = reply_sz;
+
+	return 0;
 }
diff --git a/drivers/net/ethernet/intel/idpf/virtchnl2.h b/drivers/net/ethernet/intel/idpf/virtchnl2.h
index 673a39e6698d..e6541152ca58 100644
--- a/drivers/net/ethernet/intel/idpf/virtchnl2.h
+++ b/drivers/net/ethernet/intel/idpf/virtchnl2.h
@@ -62,8 +62,9 @@ enum virtchnl2_op {
 	VIRTCHNL2_OP_GET_PTYPE_INFO		= 526,
 	/* Opcode 527 and 528 are reserved for VIRTCHNL2_OP_GET_PTYPE_ID and
 	 * VIRTCHNL2_OP_GET_PTYPE_INFO_RAW.
-	 * Opcodes 529, 530, 531, 532 and 533 are reserved.
 	 */
+	VIRTCHNL2_OP_RDMA			= 529,
+	/* Opcodes 530 through 533 are reserved. */
 	VIRTCHNL2_OP_LOOPBACK			= 534,
 	VIRTCHNL2_OP_ADD_MAC_ADDR		= 535,
 	VIRTCHNL2_OP_DEL_MAC_ADDR		= 536,
-- 
2.37.3


  parent reply	other threads:[~2025-02-07 19:50 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-07 19:49 [iwl-next,rdma v3 00/24] Add RDMA support for Intel IPU E2000 (GEN3) Tatyana Nikolova
2025-02-07 19:49 ` [iwl-next v3 01/24] iidc/ice/irdma: Update IDC to support multiple consumers Tatyana Nikolova
2025-02-07 19:49 ` [iwl-next v3 02/24] idpf: use reserved RDMA vectors from control plane Tatyana Nikolova
2025-02-07 19:49 ` [iwl-next v3 03/24] idpf: implement core RDMA auxiliary dev create, init, and destroy Tatyana Nikolova
2025-02-07 19:49 ` [iwl-next v3 04/24] idpf: implement RDMA vport " Tatyana Nikolova
2025-02-07 19:49 ` Tatyana Nikolova [this message]
2025-02-07 19:49 ` [iwl-next v3 06/24] idpf: implement IDC vport aux driver MTU change handler Tatyana Nikolova
2025-02-07 19:49 ` [iwl-next v3 07/24] idpf: implement get LAN mmio memory regions Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 08/24] RDMA/irdma: Refactor GEN2 auxiliary driver Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 09/24] RDMA/irdma: Add GEN3 core driver support Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 10/24] RDMA/irdma: Discover and set up GEN3 hardware register layout Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 11/24] RDMA/irdma: Add GEN3 CQP support with deferred completions Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 12/24] RDMA/irdma: Add GEN3 support for AEQ and CEQ Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 13/24] RDMA/irdma: Add GEN3 HW statistics support Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 14/24] RDMA/irdma: Introduce GEN3 vPort driver support Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 15/24] RDMA/irdma: Add GEN3 virtual QP1 support Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 16/24] RDMA/irdma: Extend QP context programming for GEN3 Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 17/24] RDMA/irdma: Add support for V2 HMC resource management scheme Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 18/24] RDMA/irdma: Support 64-byte CQEs and GEN3 CQE opcode decoding Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 19/24] RDMA/irdma: Add SRQ support Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 20/24] RDMA/irdma: Restrict Memory Window and CQE Timestamping to GEN3 Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 21/24] RDMA/irdma: Add Atomic Operations support Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 22/24] RDMA/irdma: Extend CQE Error and Flush Handling for GEN3 Devices Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 23/24] RDMA/irdma: Add Push Page Support for GEN3 Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 24/24] RDMA/irdma: Update Kconfig Tatyana Nikolova
2025-02-10 10:41 ` [iwl-next,rdma v3 00/24] Add RDMA support for Intel IPU E2000 (GEN3) Przemek Kitszel
2025-02-10 11:09   ` Leon Romanovsky
2025-02-13 16:12     ` Przemek Kitszel
2025-02-16 11:18       ` Leon Romanovsky

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=20250207194931.1569-6-tatyana.e.nikolova@intel.com \
    --to=tatyana.e.nikolova@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jgg@nvidia.com \
    --cc=joshua.a.hay@intel.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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