mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roland Dreier <roland@topspin.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, openib-general@openib.org
Subject: [PATCH][13/18] InfiniBand/core: add more parameters to process_mad
Date: Wed, 12 Jan 2005 13:48:08 -0800	[thread overview]
Message-ID: <20051121348.cZjtF8ckKVdplJpJ@topspin.com> (raw)
In-Reply-To: <20051121348.Xc0vsayRkBF6BIqu@topspin.com>

Add parameters to process_mad device method to support full Mellanox
firmware capabilities (pass sufficient information for baseboard
management trap generation, etc).

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <roland@topspin.com>

--- linux/drivers/infiniband/include/ib_verbs.h	(revision 1502)
+++ linux/drivers/infiniband/include/ib_verbs.h	(revision 1504)
@@ -684,9 +684,12 @@
 };
 
 struct ib_mad;
+struct ib_grh;
 
 enum ib_process_mad_flags {
-	IB_MAD_IGNORE_MKEY	= 1
+	IB_MAD_IGNORE_MKEY	= 1,
+	IB_MAD_IGNORE_BKEY	= 2,
+	IB_MAD_IGNORE_ALL	= IB_MAD_IGNORE_MKEY | IB_MAD_IGNORE_BKEY
 };
 
 enum ib_mad_result {
@@ -812,7 +815,8 @@
 	int                        (*process_mad)(struct ib_device *device,
 						  int process_mad_flags,
 						  u8 port_num,
-						  u16 source_lid,
+						  struct ib_wc *in_wc,
+						  struct ib_grh *in_grh,
 						  struct ib_mad *in_mad,
 						  struct ib_mad *out_mad);
 
--- linux/drivers/infiniband/core/mad.c	(revision 1502)
+++ linux/drivers/infiniband/core/mad.c	(revision 1504)
@@ -617,6 +617,23 @@
 	spin_unlock_irqrestore(&qp_info->snoop_lock, flags);
 }
 
+static void build_smp_wc(u64 wr_id, u16 slid, u16 pkey_index, u8 port_num,
+			 struct ib_wc *wc)
+{
+	memset(wc, 0, sizeof *wc);
+	wc->wr_id = wr_id;
+	wc->status = IB_WC_SUCCESS;
+	wc->opcode = IB_WC_RECV;
+	wc->pkey_index = pkey_index;
+	wc->byte_len = sizeof(struct ib_mad) + sizeof(struct ib_grh);
+	wc->src_qp = IB_QP0;
+	wc->qp_num = IB_QP0;
+	wc->slid = slid;
+	wc->sl = 0;
+	wc->dlid_path_bits = 0;
+	wc->port_num = port_num;
+}
+
 /*
  * Return 0 if SMP is to be sent
  * Return 1 if SMP was consumed locally (whether or not solicited)
@@ -634,6 +651,7 @@
 	struct ib_mad_agent_private *recv_mad_agent;
 	struct ib_device *device = mad_agent_priv->agent.device;
 	u8 port_num = mad_agent_priv->agent.port_num;
+	struct ib_wc mad_wc;
 
 	if (!smi_handle_dr_smp_send(smp, device->node_type, port_num)) {
 		ret = -EINVAL;
@@ -664,7 +682,12 @@
 		kfree(local);
 		goto out;
 	}
-	ret = device->process_mad(device, 0, port_num, smp->dr_slid,
+	
+	build_smp_wc(send_wr->wr_id, smp->dr_slid, send_wr->wr.ud.pkey_index,
+		     send_wr->wr.ud.port_num, &mad_wc);
+
+	/* No GRH for DR SMP */
+	ret = device->process_mad(device, 0, port_num, &mad_wc, NULL,
 				  (struct ib_mad *)smp,
 				  (struct ib_mad *)&mad_priv->mad);
 	switch (ret)
@@ -1622,7 +1645,7 @@
 
 		ret = port_priv->device->process_mad(port_priv->device, 0,
 						     port_priv->port_num,
-						     wc->slid,
+						     wc, &recv->grh,
 						     &recv->mad.mad,
 						     &response->mad.mad);
 		if (ret & IB_MAD_RESULT_SUCCESS) {
@@ -2050,19 +2073,10 @@
 			 * Defined behavior is to complete response
 			 * before request
 			 */
-			wc.wr_id = local->wr_id;
-			wc.status = IB_WC_SUCCESS;
-			wc.opcode = IB_WC_RECV;
-			wc.vendor_err = 0;
-			wc.byte_len = sizeof(struct ib_mad) +
-				      sizeof(struct ib_grh);
-			wc.src_qp = IB_QP0;
-			wc.wc_flags = 0;	/* No GRH */
-			wc.pkey_index = 0;
-			wc.slid = IB_LID_PERMISSIVE;
-			wc.sl = 0;
-			wc.dlid_path_bits = 0;
-			wc.qp_num = IB_QP0;
+			build_smp_wc(local->wr_id, IB_LID_PERMISSIVE,
+				     0 /* pkey index */,
+				     recv_mad_agent->agent.port_num, &wc);
+
 			local->mad_priv->header.recv_wc.wc = &wc;
 			local->mad_priv->header.recv_wc.mad_len =
 						sizeof(struct ib_mad);
--- linux/drivers/infiniband/core/sysfs.c	(revision 1502)
+++ linux/drivers/infiniband/core/sysfs.c	(revision 1504)
@@ -315,8 +315,8 @@
 
 	in_mad->data[41] = p->port_num;	/* PortSelect field */
 
-	if ((p->ibdev->process_mad(p->ibdev, IB_MAD_IGNORE_MKEY, p->port_num, 0xffff,
-				   in_mad, out_mad) &
+	if ((p->ibdev->process_mad(p->ibdev, IB_MAD_IGNORE_MKEY,
+		 p->port_num, NULL, NULL, in_mad, out_mad) &
 	     (IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY)) !=
 	    (IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY)) {
 		ret = -EINVAL;
--- linux/drivers/infiniband/hw/mthca/mthca_dev.h	(revision 1502)
+++ linux/drivers/infiniband/hw/mthca/mthca_dev.h	(revision 1504)
@@ -381,7 +381,8 @@
 int mthca_process_mad(struct ib_device *ibdev,
 		      int mad_flags,
 		      u8 port_num,
-		      u16 slid,
+		      struct ib_wc *in_wc,
+		      struct ib_grh *in_grh,
 		      struct ib_mad *in_mad,
 		      struct ib_mad *out_mad);
 int mthca_create_agents(struct mthca_dev *dev);
--- linux/drivers/infiniband/hw/mthca/mthca_mad.c	(revision 1502)
+++ linux/drivers/infiniband/hw/mthca/mthca_mad.c	(revision 1504)
@@ -185,12 +185,14 @@
 int mthca_process_mad(struct ib_device *ibdev,
 		      int mad_flags,
 		      u8 port_num,
-		      u16 slid,
+		      struct ib_wc *in_wc,
+		      struct ib_grh *in_grh,
 		      struct ib_mad *in_mad,
 		      struct ib_mad *out_mad)
 {
 	int err;
 	u8 status;
+	u16 slid = in_wc ? in_wc->slid : IB_LID_PERMISSIVE;
 
 	/* Forward locally generated traps to the SM */
 	if (in_mad->mad_hdr.method == IB_MGMT_METHOD_TRAP &&


  reply	other threads:[~2005-01-13  0:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-12 21:47 [PATCH][0/18] InfiniBand: updates for 2.6.11-rc1 Roland Dreier
2005-01-12 21:47 ` [PATCH][1/18] InfiniBand/IPoIB: use correct static rate in IpoIB Roland Dreier
2005-01-12 21:47   ` [PATCH][2/18] InfiniBand/mthca: trivial formatting fix Roland Dreier
2005-01-12 21:47     ` [PATCH][3/18] InfiniBand/mthca: support RDMA/atomic attributes in QP modify Roland Dreier
2005-01-12 21:47       ` [PATCH][4/18] InfiniBand/mthca: clean up allocation mapping of HCA context memory Roland Dreier
2005-01-12 21:47         ` [PATCH][5/18] InfiniBand/mthca: add needed rmb() in event queue poll Roland Dreier
2005-01-12 21:47           ` [PATCH][6/18] InfiniBand/core: remove debug printk Roland Dreier
2005-01-12 21:47             ` [PATCH][7/18] InfiniBand: make more code static Roland Dreier
2005-01-12 21:47               ` [PATCH][8/18] InfiniBand/core: set byte_cnt correctly in MAD completion Roland Dreier
2005-01-12 21:47                 ` [PATCH][9/18] InfiniBand/core: add QP number to work completion struct Roland Dreier
2005-01-12 21:47                   ` [PATCH][10/18] InfiniBand/core: add node_type and phys_state sysfs attrs Roland Dreier
2005-01-12 21:48                     ` [PATCH][11/18] InfiniBand/mthca: clean up computation of HCA memory map Roland Dreier
2005-01-12 21:48                       ` [PATCH][12/18] InfiniBand/core: fix handling of 0-hop directed route MADs Roland Dreier
2005-01-12 21:48                         ` Roland Dreier [this message]
2005-01-12 21:48                           ` [PATCH][14/18] InfiniBand/core: add qp_type to struct ib_qp Roland Dreier
2005-01-12 21:48                             ` [PATCH][15/18] InfiniBand/core: add ib_find_cached_gid function Roland Dreier
2005-01-12 21:48                               ` [PATCH][16/18] InfiniBand: update copyrights for new year Roland Dreier
2005-01-12 21:48                                 ` [PATCH][17/18] InfiniBand/ipoib: move structs from stack to device private struct Roland Dreier
2005-01-12 21:48                                   ` [PATCH][18/18] InfiniBand/core: rename handle_outgoing_smp Roland Dreier
2005-01-13  9:45           ` [openib-general] [PATCH][5/18] InfiniBand/mthca: add needed rmb() in event queue poll Michael S. Tsirkin
2005-01-13 15:32             ` Roland Dreier

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=20051121348.cZjtF8ckKVdplJpJ@topspin.com \
    --to=roland@topspin.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openib-general@openib.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

all inboxes | Powered by JetHome®