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][20/27] IB/mthca: add mthca_table_find() function
Date: Fri, 1 Apr 2005 12:49:53 -0800	[thread overview]
Message-ID: <2005411249.Tkvt1lzz8zEHUMmz@topspin.com> (raw)
In-Reply-To: <2005411249.t0DdCtarOabubO3D@topspin.com>

From: Michael S. Tsirkin <mst@mellanox.co.il>

Add mthca_table_find() function, which returns the lowmem address of
an entry in a mem-free HCA's context tables.  This will be used by the
FMR implementation.

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


--- linux-export.orig/drivers/infiniband/hw/mthca/mthca_memfree.c	2005-04-01 12:38:23.500859288 -0800
+++ linux-export/drivers/infiniband/hw/mthca/mthca_memfree.c	2005-04-01 12:38:28.285820606 -0800
@@ -192,6 +192,40 @@
 	up(&table->mutex);
 }
 
+void *mthca_table_find(struct mthca_icm_table *table, int obj)
+{
+	int idx, offset, i;
+	struct mthca_icm_chunk *chunk;
+	struct mthca_icm *icm;
+	struct page *page = NULL;
+
+	if (!table->lowmem)
+		return NULL;
+
+	down(&table->mutex);
+
+	idx = (obj & (table->num_obj - 1)) * table->obj_size;
+	icm = table->icm[idx / MTHCA_TABLE_CHUNK_SIZE];
+	offset = idx % MTHCA_TABLE_CHUNK_SIZE;
+
+	if (!icm)
+		goto out;
+
+	list_for_each_entry(chunk, &icm->chunk_list, list) {
+		for (i = 0; i < chunk->npages; ++i) {
+			if (chunk->mem[i].length >= offset) {
+				page = chunk->mem[i].page;
+				break;
+			}
+			offset -= chunk->mem[i].length;
+		}
+	}
+
+out:
+	up(&table->mutex);
+	return page ? lowmem_page_address(page) + offset : NULL;
+}
+
 int mthca_table_get_range(struct mthca_dev *dev, struct mthca_icm_table *table,
 			  int start, int end)
 {
--- linux-export.orig/drivers/infiniband/hw/mthca/mthca_memfree.h	2005-04-01 12:38:19.895641881 -0800
+++ linux-export/drivers/infiniband/hw/mthca/mthca_memfree.h	2005-04-01 12:38:28.280821691 -0800
@@ -85,6 +85,7 @@
 void mthca_free_icm_table(struct mthca_dev *dev, struct mthca_icm_table *table);
 int mthca_table_get(struct mthca_dev *dev, struct mthca_icm_table *table, int obj);
 void mthca_table_put(struct mthca_dev *dev, struct mthca_icm_table *table, int obj);
+void *mthca_table_find(struct mthca_icm_table *table, int obj);
 int mthca_table_get_range(struct mthca_dev *dev, struct mthca_icm_table *table,
 			  int start, int end);
 void mthca_table_put_range(struct mthca_dev *dev, struct mthca_icm_table *table,


  reply	other threads:[~2005-04-01 21:01 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-01 20:49 [PATCH][1/27] IB/mthca: map MPT/MTT context in mem-free mode Roland Dreier
2005-04-01 20:49 ` [PATCH][2/27] IB/mthca: fill in more device query fields Roland Dreier
2005-04-01 20:49   ` [PATCH][3/27] IB/mthca: fix calculation of RDB shift Roland Dreier
2005-04-01 20:49     ` [PATCH][4/27] IB/mthca: fix posting sends with immediate data Roland Dreier
2005-04-01 20:49       ` [PATCH][5/27] IB/mthca: allow unaligned memory regions Roland Dreier
2005-04-01 20:49         ` [PATCH][6/27] IB/mthca: allocate correct number of doorbell pages Roland Dreier
2005-04-01 20:49           ` [PATCH][7/27] IB/mthca: clean up mthca_dereg_mr() Roland Dreier
2005-04-01 20:49             ` [PATCH][8/27] IB/mthca: fix MR allocation error path Roland Dreier
2005-04-01 20:49               ` [PATCH][9/27] IB/mthca: release mutex on doorbell alloc " Roland Dreier
2005-04-01 20:49                 ` [PATCH][10/27] IB/mthca: print assigned IRQ when interrupt test fails Roland Dreier
2005-04-01 20:49                   ` [PATCH][11/27] IB/mthca: only free doorbell records in mem-free mode Roland Dreier
2005-04-01 20:49                     ` [PATCH][12/27] IB/mthca: fix format of CQ number for CQ events Roland Dreier
2005-04-01 20:49                       ` [PATCH][13/27] IB/mthca: implement RDMA/atomic operations for mem-free mode Roland Dreier
2005-04-01 20:49                         ` [PATCH][14/27] IB/mthca: fix MTT allocation in " Roland Dreier
2005-04-01 20:49                           ` [PATCH][15/27] IB/mthca: fill in opcode field for send completions Roland Dreier
2005-04-01 20:49                             ` [PATCH][16/27] IB/mthca: allow address handle creation in interrupt context Roland Dreier
2005-04-01 20:49                               ` [PATCH][17/27] IB/mthca: encapsulate MTT buddy allocator Roland Dreier
2005-04-01 20:49                                 ` [PATCH][18/27] IB/mthca: add SYNC_TPT firmware command Roland Dreier
2005-04-01 20:49                                   ` [PATCH][19/27] IB/mthca: add mthca_write64_raw() for writing to MTT table directly Roland Dreier
2005-04-01 20:49                                     ` Roland Dreier [this message]
2005-04-01 20:49                                       ` [PATCH][21/27] IB/mthca: split MR key munging routines Roland Dreier
2005-04-01 20:49                                         ` [PATCH][22/27] IB/mthca: add fast memory region implementation Roland Dreier
2005-04-01 20:49                                           ` [PATCH][23/27] IB/mthca: tweaks to mthca_cmd.c Roland Dreier
2005-04-01 20:49                                             ` [PATCH][24/27] IB/mthca: encapsulate mem-free check into mthca_is_memfree() Roland Dreier
2005-04-01 20:49                                               ` [PATCH][25/27] IB/mthca: map context for RDMA responder in mem-free mode Roland Dreier
2005-04-01 20:49                                                 ` [PATCH][26/27] IB/mthca: update receive queue initialization for new HCAs Roland Dreier
2005-04-01 20:49                                                   ` [PATCH][27/27] IB/mthca: add support for new MT25204 HCA Roland Dreier
2005-04-01 22:06                                                     ` [PATCH][26.5/27] Add MT25204 PCI IDs Roland Dreier
2005-04-08  0:10                                                       ` Greg KH

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=2005411249.Tkvt1lzz8zEHUMmz@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®