[MTHCA] removed unused files
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sun, 23 Sep 2007 12:55:01 +0000 (12:55 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sun, 23 Sep 2007 12:55:01 +0000 (12:55 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@831 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

hw/mthca/kernel/mt_fmr_pool.c [deleted file]
hw/mthca/kernel/mt_fmr_pool.h [deleted file]
hw/mthca/user/mlnx_uvp_kern_abi.h [deleted file]

diff --git a/hw/mthca/kernel/mt_fmr_pool.c b/hw/mthca/kernel/mt_fmr_pool.c
deleted file mode 100644 (file)
index 13ef9a5..0000000
+++ /dev/null
@@ -1,511 +0,0 @@
-/*
- * Copyright (c) 2004 Topspin Communications.  All rights reserved.
- * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
- *
- * This software is available to you under a choice of one of two
- * licenses.  You may choose to be licensed under the terms of the GNU
- * General Public License (GPL) Version 2, available from the file
- * COPYING in the main directory of this source tree, or the
- * OpenIB.org BSD license below:
- *
- *     Redistribution and use in source and binary forms, with or
- *     without modification, are permitted provided that the following
- *     conditions are met:
- *
- *      - Redistributions of source code must retain the above
- *        copyright notice, this list of conditions and the following
- *        disclaimer.
- *
- *      - Redistributions in binary form must reproduce the above
- *        copyright notice, this list of conditions and the following
- *        disclaimer in the documentation and/or other materials
- *        provided with the distribution.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * $Id$
- */
-
-#include <linux/errno.h>
-#include <linux/spinlock.h>
-#include <linux/slab.h>
-#include <linux/jhash.h>
-#include <linux/kthread.h>
-
-#include <rdma/ib_fmr_pool.h>
-
-#include "core_priv.h"
-
-enum {
-       IB_FMR_MAX_REMAPS = 32,
-
-       IB_FMR_HASH_BITS  = 8,
-       IB_FMR_HASH_SIZE  = 1 << IB_FMR_HASH_BITS,
-       IB_FMR_HASH_MASK  = IB_FMR_HASH_SIZE - 1
-};
-
-/*
- * If an FMR is not in use, then the list member will point to either
- * its pool's free_list (if the FMR can be mapped again; that is,
- * remap_count < IB_FMR_MAX_REMAPS) or its pool's dirty_list (if the
- * FMR needs to be unmapped before being remapped).  In either of
- * these cases it is a bug if the ref_count is not 0.  In other words,
- * if ref_count is > 0, then the list member must not be linked into
- * either free_list or dirty_list.
- *
- * The cache_node member is used to link the FMR into a cache bucket
- * (if caching is enabled).  This is independent of the reference
- * count of the FMR.  When a valid FMR is released, its ref_count is
- * decremented, and if ref_count reaches 0, the FMR is placed in
- * either free_list or dirty_list as appropriate.  However, it is not
- * removed from the cache and may be "revived" if a call to
- * ib_fmr_register_physical() occurs before the FMR is remapped.  In
- * this case we just increment the ref_count and remove the FMR from
- * free_list/dirty_list.
- *
- * Before we remap an FMR from free_list, we remove it from the cache
- * (to prevent another user from obtaining a stale FMR).  When an FMR
- * is released, we add it to the tail of the free list, so that our
- * cache eviction policy is "least recently used."
- *
- * All manipulation of ref_count, list and cache_node is protected by
- * pool_lock to maintain consistency.
- */
-
-struct ib_fmr_pool {
-       spinlock_t                pool_lock;
-
-       int                       pool_size;
-       int                       max_pages;
-       int                       dirty_watermark;
-       int                       dirty_len;
-       struct list_head          free_list;
-       struct list_head          dirty_list;
-       struct hlist_head        *cache_bucket;
-
-       void                     (*flush_function)(struct ib_fmr_pool *pool,
-                                                  void *              arg);
-       void                     *flush_arg;
-
-       struct task_struct       *thread;
-
-       atomic_t                  req_ser;
-       atomic_t                  flush_ser;
-
-       wait_queue_head_t         force_wait;
-};
-
-static inline u32 ib_fmr_hash(u64 first_page)
-{
-       return jhash_2words((u32) first_page, (u32) (first_page >> 32), 0) &
-               (IB_FMR_HASH_SIZE - 1);
-}
-
-/* Caller must hold pool_lock */
-static inline struct ib_pool_fmr *ib_fmr_cache_lookup(struct ib_fmr_pool *pool,
-                                                     u64 *page_list,
-                                                     int  page_list_len,
-                                                     u64  io_virtual_address)
-{
-       struct hlist_head *bucket;
-       struct ib_pool_fmr *fmr;
-       struct hlist_node *pos;
-
-       if (!pool->cache_bucket)
-               return NULL;
-
-       bucket = pool->cache_bucket + ib_fmr_hash(*page_list);
-
-       hlist_for_each_entry(fmr, pos, bucket, cache_node)
-               if (io_virtual_address == fmr->io_virtual_address &&
-                   page_list_len      == fmr->page_list_len      &&
-                   !memcmp(page_list, fmr->page_list,
-                           page_list_len * sizeof *page_list))
-                       return fmr;
-
-       return NULL;
-}
-
-static void ib_fmr_batch_release(struct ib_fmr_pool *pool)
-{
-       int                 ret;
-       struct ib_pool_fmr *fmr;
-       LIST_HEAD(unmap_list);
-       LIST_HEAD(fmr_list);
-
-       spin_lock_irq(&pool->pool_lock);
-
-       list_for_each_entry(fmr, &pool->dirty_list, list) {
-               hlist_del_init(&fmr->cache_node);
-               fmr->remap_count = 0;
-               list_add_tail(&fmr->fmr->list, &fmr_list);
-
-#ifdef DEBUG
-               if (fmr->ref_count !=0) {
-                       printk(KERN_WARNING "Unmapping FMR 0x%08x with ref count %d",
-                              fmr, fmr->ref_count);
-               }
-#endif
-       }
-
-       list_splice(&pool->dirty_list, &unmap_list);
-       INIT_LIST_HEAD(&pool->dirty_list);
-       pool->dirty_len = 0;
-
-       spin_unlock_irq(&pool->pool_lock);
-
-       if (list_empty(&unmap_list)) {
-               return;
-       }
-
-       ret = ib_unmap_fmr(&fmr_list);
-       if (ret)
-               printk(KERN_WARNING "ib_unmap_fmr returned %d", ret);
-
-       spin_lock_irq(&pool->pool_lock);
-       list_splice(&unmap_list, &pool->free_list);
-       spin_unlock_irq(&pool->pool_lock);
-}
-
-static int ib_fmr_cleanup_thread(void *pool_ptr)
-{
-       struct ib_fmr_pool *pool = pool_ptr;
-
-       do {
-               if (pool->dirty_len >= pool->dirty_watermark ||
-                   atomic_read(&pool->flush_ser) - atomic_read(&pool->req_ser) < 0) {
-                       ib_fmr_batch_release(pool);
-
-                       atomic_inc(&pool->flush_ser);
-                       wake_up_interruptible(&pool->force_wait);
-
-                       if (pool->flush_function)
-                               pool->flush_function(pool, pool->flush_arg);
-               }
-
-               set_current_state(TASK_INTERRUPTIBLE);
-               if (pool->dirty_len < pool->dirty_watermark &&
-                   atomic_read(&pool->flush_ser) - atomic_read(&pool->req_ser) >= 0 &&
-                   !kthread_should_stop())
-                       schedule();
-               __set_current_state(TASK_RUNNING);
-       } while (!kthread_should_stop());
-
-       return 0;
-}
-
-/**
- * ib_create_fmr_pool - Create an FMR pool
- * @pd:Protection domain for FMRs
- * @params:FMR pool parameters
- *
- * Create a pool of FMRs.  Return value is pointer to new pool or
- * error code if creation failed.
- */
-struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd             *pd,
-                                      struct ib_fmr_pool_param *params)
-{
-       struct ib_device   *device;
-       struct ib_fmr_pool *pool;
-       int i;
-       int ret;
-
-       if (!params)
-               return ERR_PTR(-EINVAL);
-
-       device = pd->device;
-       if (!device->alloc_fmr    || !device->dealloc_fmr  ||
-           !device->map_phys_fmr || !device->unmap_fmr) {
-               printk(KERN_WARNING "Device %s does not support fast memory regions",
-                      device->name);
-               return ERR_PTR(-ENOSYS);
-       }
-
-       pool = kmalloc(sizeof *pool, GFP_KERNEL);
-       if (!pool) {
-               printk(KERN_WARNING "couldn't allocate pool struct");
-               return ERR_PTR(-ENOMEM);
-       }
-
-       pool->cache_bucket   = NULL;
-
-       pool->flush_function = params->flush_function;
-       pool->flush_arg      = params->flush_arg;
-
-       INIT_LIST_HEAD(&pool->free_list);
-       INIT_LIST_HEAD(&pool->dirty_list);
-
-       if (params->cache) {
-               pool->cache_bucket =
-                       kmalloc(IB_FMR_HASH_SIZE * sizeof *pool->cache_bucket,
-                               GFP_KERNEL);
-               if (!pool->cache_bucket) {
-                       printk(KERN_WARNING "Failed to allocate cache in pool");
-                       ret = -ENOMEM;
-                       goto out_free_pool;
-               }
-
-               for (i = 0; i < IB_FMR_HASH_SIZE; ++i)
-                       INIT_HLIST_HEAD(pool->cache_bucket + i);
-       }
-
-       pool->pool_size       = 0;
-       pool->max_pages       = params->max_pages_per_fmr;
-       pool->dirty_watermark = params->dirty_watermark;
-       pool->dirty_len       = 0;
-       spin_lock_init(&pool->pool_lock);
-       atomic_set(&pool->req_ser,   0);
-       atomic_set(&pool->flush_ser, 0);
-       init_waitqueue_head(&pool->force_wait);
-
-       pool->thread = kthread_create(ib_fmr_cleanup_thread,
-                                     pool,
-                                     "ib_fmr(%s)",
-                                     device->name);
-       if (IS_ERR(pool->thread)) {
-               printk(KERN_WARNING "couldn't start cleanup thread");
-               ret = PTR_ERR(pool->thread);
-               goto out_free_pool;
-       }
-
-       {
-               struct ib_pool_fmr *fmr;
-               struct ib_fmr_attr attr = {
-                       .max_pages  = params->max_pages_per_fmr,
-                       .max_maps   = IB_FMR_MAX_REMAPS,
-                       .page_shift = params->page_shift
-               };
-
-               for (i = 0; i < params->pool_size; ++i) {
-                       fmr = kmalloc(sizeof *fmr + params->max_pages_per_fmr * sizeof (u64),
-                                     GFP_KERNEL);
-                       if (!fmr) {
-                               printk(KERN_WARNING "failed to allocate fmr struct "
-                                      "for FMR %d", i);
-                               goto out_fail;
-                       }
-
-                       fmr->pool             = pool;
-                       fmr->remap_count      = 0;
-                       fmr->ref_count        = 0;
-                       INIT_HLIST_NODE(&fmr->cache_node);
-
-                       fmr->fmr = ib_alloc_fmr(pd, params->access, &attr);
-                       if (IS_ERR(fmr->fmr)) {
-                               printk(KERN_WARNING "fmr_create failed for FMR %d", i);
-                               kfree(fmr);
-                               goto out_fail;
-                       }
-
-                       list_add_tail(&fmr->list, &pool->free_list);
-                       ++pool->pool_size;
-               }
-       }
-
-       return pool;
-
- out_free_pool:
-       kfree(pool->cache_bucket);
-       kfree(pool);
-
-       return ERR_PTR(ret);
-
- out_fail:
-       ib_destroy_fmr_pool(pool);
-
-       return ERR_PTR(-ENOMEM);
-}
-EXPORT_SYMBOL(ib_create_fmr_pool);
-
-/**
- * ib_destroy_fmr_pool - Free FMR pool
- * @pool:FMR pool to free
- *
- * Destroy an FMR pool and free all associated resources.
- */
-void ib_destroy_fmr_pool(struct ib_fmr_pool *pool)
-{
-       struct ib_pool_fmr *fmr;
-       struct ib_pool_fmr *tmp;
-       LIST_HEAD(fmr_list);
-       int                 i;
-
-       kthread_stop(pool->thread);
-       ib_fmr_batch_release(pool);
-
-       i = 0;
-       list_for_each_entry_safe(fmr, tmp, &pool->free_list, list) {
-               if (fmr->remap_count) {
-                       INIT_LIST_HEAD(&fmr_list);
-                       list_add_tail(&fmr->fmr->list, &fmr_list);
-                       ib_unmap_fmr(&fmr_list);
-               }
-               ib_dealloc_fmr(fmr->fmr);
-               list_del(&fmr->list);
-               kfree(fmr);
-               ++i;
-       }
-
-       if (i < pool->pool_size)
-               printk(KERN_WARNING "pool still has %d regions registered",
-                      pool->pool_size - i);
-
-       kfree(pool->cache_bucket);
-       kfree(pool);
-}
-EXPORT_SYMBOL(ib_destroy_fmr_pool);
-
-/**
- * ib_flush_fmr_pool - Invalidate all unmapped FMRs
- * @pool:FMR pool to flush
- *
- * Ensure that all unmapped FMRs are fully invalidated.
- */
-int ib_flush_fmr_pool(struct ib_fmr_pool *pool)
-{
-       int serial;
-
-       atomic_inc(&pool->req_ser);
-       /*
-        * It's OK if someone else bumps req_ser again here -- we'll
-        * just wait a little longer.
-        */
-       serial = atomic_read(&pool->req_ser);
-
-       wake_up_process(pool->thread);
-
-       if (wait_event_interruptible(pool->force_wait,
-                                    atomic_read(&pool->flush_ser) -
-                                    atomic_read(&pool->req_ser) >= 0))
-               return -EINTR;
-
-       return 0;
-}
-EXPORT_SYMBOL(ib_flush_fmr_pool);
-
-/**
- * ib_fmr_pool_map_phys -
- * @pool:FMR pool to allocate FMR from
- * @page_list:List of pages to map
- * @list_len:Number of pages in @page_list
- * @io_virtual_address:I/O virtual address for new FMR
- *
- * Map an FMR from an FMR pool.
- */
-struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle,
-                                        u64                *page_list,
-                                        int                 list_len,
-                                        u64                *io_virtual_address)
-{
-       struct ib_fmr_pool *pool = pool_handle;
-       struct ib_pool_fmr *fmr;
-       unsigned long       flags;
-       int                 result;
-
-       if (list_len < 1 || list_len > pool->max_pages)
-               return ERR_PTR(-EINVAL);
-
-       spin_lock_irqsave(&pool->pool_lock, flags);
-       fmr = ib_fmr_cache_lookup(pool,
-                                 page_list,
-                                 list_len,
-                                 *io_virtual_address);
-       if (fmr) {
-               /* found in cache */
-               ++fmr->ref_count;
-               if (fmr->ref_count == 1) {
-                       list_del(&fmr->list);
-               }
-
-               spin_unlock_irqrestore(&pool->pool_lock, flags);
-
-               return fmr;
-       }
-
-       if (list_empty(&pool->free_list)) {
-               spin_unlock_irqrestore(&pool->pool_lock, flags);
-               return ERR_PTR(-EAGAIN);
-       }
-
-       fmr = list_entry(pool->free_list.next, struct ib_pool_fmr, list);
-       list_del(&fmr->list);
-       hlist_del_init(&fmr->cache_node);
-       spin_unlock_irqrestore(&pool->pool_lock, flags);
-
-       result = ib_map_phys_fmr(fmr->fmr, page_list, list_len,
-                                *io_virtual_address);
-
-       if (result) {
-               spin_lock_irqsave(&pool->pool_lock, flags);
-               list_add(&fmr->list, &pool->free_list);
-               spin_unlock_irqrestore(&pool->pool_lock, flags);
-
-               printk(KERN_WARNING "fmr_map returns %d\n",
-                      result);
-
-               return ERR_PTR(result);
-       }
-
-       ++fmr->remap_count;
-       fmr->ref_count = 1;
-
-       if (pool->cache_bucket) {
-               fmr->io_virtual_address = *io_virtual_address;
-               fmr->page_list_len      = list_len;
-               memcpy(fmr->page_list, page_list, list_len * sizeof(*page_list));
-
-               spin_lock_irqsave(&pool->pool_lock, flags);
-               hlist_add_head(&fmr->cache_node,
-                              pool->cache_bucket + ib_fmr_hash(fmr->page_list[0]));
-               spin_unlock_irqrestore(&pool->pool_lock, flags);
-       }
-
-       return fmr;
-}
-EXPORT_SYMBOL(ib_fmr_pool_map_phys);
-
-/**
- * ib_fmr_pool_unmap - Unmap FMR
- * @fmr:FMR to unmap
- *
- * Unmap an FMR.  The FMR mapping may remain valid until the FMR is
- * reused (or until ib_flush_fmr_pool() is called).
- */
-int ib_fmr_pool_unmap(struct ib_pool_fmr *fmr)
-{
-       struct ib_fmr_pool *pool;
-       unsigned long flags;
-
-       pool = fmr->pool;
-
-       spin_lock_irqsave(&pool->pool_lock, flags);
-
-       --fmr->ref_count;
-       if (!fmr->ref_count) {
-               if (fmr->remap_count < IB_FMR_MAX_REMAPS) {
-                       list_add_tail(&fmr->list, &pool->free_list);
-               } else {
-                       list_add_tail(&fmr->list, &pool->dirty_list);
-                       ++pool->dirty_len;
-                       wake_up_process(pool->thread);
-               }
-       }
-
-#ifdef DEBUG
-       if (fmr->ref_count < 0)
-               printk(KERN_WARNING "FMR %p has ref count %d < 0",
-                      fmr, fmr->ref_count);
-#endif
-
-       spin_unlock_irqrestore(&pool->pool_lock, flags);
-
-       return 0;
-}
-EXPORT_SYMBOL(ib_fmr_pool_unmap);
diff --git a/hw/mthca/kernel/mt_fmr_pool.h b/hw/mthca/kernel/mt_fmr_pool.h
deleted file mode 100644 (file)
index 5cca5cb..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2004 Topspin Corporation.  All rights reserved.
- * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
- *
- * This software is available to you under a choice of one of two
- * licenses.  You may choose to be licensed under the terms of the GNU
- * General Public License (GPL) Version 2, available from the file
- * COPYING in the main directory of this source tree, or the
- * OpenIB.org BSD license below:
- *
- *     Redistribution and use in source and binary forms, with or
- *     without modification, are permitted provided that the following
- *     conditions are met:
- *
- *      - Redistributions of source code must retain the above
- *        copyright notice, this list of conditions and the following
- *        disclaimer.
- *
- *      - Redistributions in binary form must reproduce the above
- *        copyright notice, this list of conditions and the following
- *        disclaimer in the documentation and/or other materials
- *        provided with the distribution.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * $Id$
- */
-
-#if !defined(IB_FMR_POOL_H)
-#define IB_FMR_POOL_H
-
-#include <rdma/ib_verbs.h>
-
-struct ib_fmr_pool;
-
-/**
- * struct ib_fmr_pool_param - Parameters for creating FMR pool
- * @max_pages_per_fmr:Maximum number of pages per map request.
- * @page_shift: Log2 of sizeof "pages" mapped by this fmr
- * @access:Access flags for FMRs in pool.
- * @pool_size:Number of FMRs to allocate for pool.
- * @dirty_watermark:Flush is triggered when @dirty_watermark dirty
- *     FMRs are present.
- * @flush_function:Callback called when unmapped FMRs are flushed and
- *     more FMRs are possibly available for mapping
- * @flush_arg:Context passed to user's flush function.
- * @cache:If set, FMRs may be reused after unmapping for identical map
- *     requests.
- */
-struct ib_fmr_pool_param {
-       int                     max_pages_per_fmr;
-       int                     page_shift;
-       enum ib_access_flags    access;
-       int                     pool_size;
-       int                     dirty_watermark;
-       void                  (*flush_function)(struct ib_fmr_pool *pool,
-                                               void *              arg);
-       void                   *flush_arg;
-       unsigned                cache:1;
-};
-
-struct ib_pool_fmr {
-       struct ib_fmr      *fmr;
-       struct ib_fmr_pool *pool;
-       struct list_head    list;
-       struct hlist_node   cache_node;
-       int                 ref_count;
-       int                 remap_count;
-       u64                 io_virtual_address;
-       int                 page_list_len;
-       u64                 page_list[0];
-};
-
-struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd             *pd,
-                                      struct ib_fmr_pool_param *params);
-
-void ib_destroy_fmr_pool(struct ib_fmr_pool *pool);
-
-int ib_flush_fmr_pool(struct ib_fmr_pool *pool);
-
-struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle,
-                                        u64                *page_list,
-                                        int                 list_len,
-                                        u64                *io_virtual_address);
-
-int ib_fmr_pool_unmap(struct ib_pool_fmr *fmr);
-
-#endif /* IB_FMR_POOL_H */
diff --git a/hw/mthca/user/mlnx_uvp_kern_abi.h b/hw/mthca/user/mlnx_uvp_kern_abi.h
deleted file mode 100644 (file)
index 093c8b0..0000000
+++ /dev/null
@@ -1,644 +0,0 @@
-/*
- * Copyright (c) 2005 Topspin Communications.  All rights reserved.
- * Copyright (c) 2005 Cisco Systems.  All rights reserved.
- * Copyright (c) 2005 PathScale, Inc.  All rights reserved.
- *
- * This software is available to you under a choice of one of two
- * licenses.  You may choose to be licensed under the terms of the GNU
- * General Public License (GPL) Version 2, available from the file
- * COPYING in the main directory of this source tree, or the
- * OpenIB.org BSD license below:
- *
- *     Redistribution and use in source and binary forms, with or
- *     without modification, are permitted provided that the following
- *     conditions are met:
- *
- *      - Redistributions of source code must retain the above
- *        copyright notice, this list of conditions and the following
- *        disclaimer.
- *
- *      - Redistributions in binary form must reproduce the above
- *        copyright notice, this list of conditions and the following
- *        disclaimer in the documentation and/or other materials
- *        provided with the distribution.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * $Id$
- */
-
-#ifndef KERN_ABI_H
-#define KERN_ABI_H
-
-/*
- * This file must be kept in sync with the kernel's version of
- * drivers/infiniband/include/ib_user_verbs.h
- */
-
-/*
- * Make sure that all structs defined in this file remain laid out so
- * that they pack the same way on 32-bit and 64-bit architectures (to
- * avoid incompatibility between 32-bit userspace and 64-bit kernels).
- * Specifically:
- *  - Do not use pointer types -- pass pointers in uint64_t instead.
- *  - Make sure that any structure larger than 4 bytes is padded to a
- *    multiple of 8 bytes.  Otherwise the structure size will be
- *    different between 32-bit and 64-bit architectures.
- */
-
-struct ibv_kern_async_event {
-       uint64_t element;
-       uint32_t event_type;
-       uint32_t reserved;
-};
-
-struct ibv_comp_event {
-       uint64_t cq_handle;
-};
-
-/*
- * All commands from userspace should start with a uint32_t command field
- * followed by uint16_t in_words and out_words fields (which give the
- * length of the command block and response buffer if any in 32-bit
- * words).  The kernel driver will read these fields first and read
- * the rest of the command struct based on these value.
- */
-
-struct ibv_query_params {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint64_t response;
-};
-
-struct ibv_query_params_resp {
-       uint32_t num_cq_events;
-};
-
-struct ibv_get_context_resp {
-       uint64_t uar_addr;
-       uint64_t pd_handle;
-       uint32_t pdn;
-       uint32_t qp_tab_size;
-       uint32_t uarc_size;
-       uint32_t vend_id;
-       uint16_t dev_id;
-};
-
-struct ibv_query_device {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint64_t response;
-       uint64_t driver_data[0];
-};
-
-struct ibv_query_device_resp {
-       uint64_t fw_ver;
-       uint64_t node_guid;
-       uint64_t sys_image_guid;
-       uint64_t max_mr_size;
-       uint64_t page_size_cap;
-       uint32_t vendor_id;
-       uint32_t vendor_part_id;
-       uint32_t hw_ver;
-       uint32_t max_qp;
-       uint32_t max_qp_wr;
-       uint32_t device_cap_flags;
-       uint32_t max_sge;
-       uint32_t max_sge_rd;
-       uint32_t max_cq;
-       uint32_t max_cqe;
-       uint32_t max_mr;
-       uint32_t max_pd;
-       uint32_t max_qp_rd_atom;
-       uint32_t max_ee_rd_atom;
-       uint32_t max_res_rd_atom;
-       uint32_t max_qp_init_rd_atom;
-       uint32_t max_ee_init_rd_atom;
-       uint32_t atomic_cap;
-       uint32_t max_ee;
-       uint32_t max_rdd;
-       uint32_t max_mw;
-       uint32_t max_raw_ipv6_qp;
-       uint32_t max_raw_ethy_qp;
-       uint32_t max_mcast_grp;
-       uint32_t max_mcast_qp_attach;
-       uint32_t max_total_mcast_qp_attach;
-       uint32_t max_ah;
-       uint32_t max_fmr;
-       uint32_t max_map_per_fmr;
-       uint32_t max_srq;
-       uint32_t max_srq_wr;
-       uint32_t max_srq_sge;
-       uint16_t max_pkeys;
-       uint8_t  local_ca_ack_delay;
-       uint8_t  phys_port_cnt;
-       uint8_t  reserved[4];
-};
-
-struct ibv_query_port {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint64_t response;
-       uint8_t  port_num;
-       uint8_t  reserved[7];
-       uint64_t driver_data[0];
-};
-
-struct ibv_query_port_resp {
-       uint32_t port_cap_flags;
-       uint32_t max_msg_sz;
-       uint32_t bad_pkey_cntr;
-       uint32_t qkey_viol_cntr;
-       uint32_t gid_tbl_len;
-       uint16_t pkey_tbl_len;
-       uint16_t lid;
-       uint16_t sm_lid;
-       uint8_t  state;
-       uint8_t  max_mtu;
-       uint8_t  active_mtu;
-       uint8_t  lmc;
-       uint8_t  max_vl_num;
-       uint8_t  sm_sl;
-       uint8_t  subnet_timeout;
-       uint8_t  init_type_reply;
-       uint8_t  active_width;
-       uint8_t  active_speed;
-       uint8_t  phys_state;
-       uint8_t  reserved[3];
-};
-
-struct ibv_alloc_pd_resp {
-       uint64_t pd_handle;
-       uint32_t pdn;
-       uint32_t reserved;
-};
-
-struct ibv_reg_mr {
-       uint64_t start;
-       uint64_t length;
-       uint64_t hca_va;
-       uint32_t access_flags;
-       uint32_t pdn;
-       uint64_t pd_handle;
-};
-
-struct ibv_reg_mr_resp {
-       uint64_t mr_handle;
-       uint32_t lkey;
-       uint32_t rkey;
-};
-
-struct ibv_create_cq {
-       struct ibv_reg_mr mr;   
-       uint64_t arm_db_page;
-       uint64_t set_db_page;
-       uint32_t arm_db_index;
-       uint32_t set_db_index;
-       uint64_t user_handle;
-       uint32_t cqe;
-       uint32_t lkey;          /* used only by kernel */
-};
-struct ibv_create_cq_resp {
-       uint64_t user_handle;
-       uint64_t cq_handle;
-       struct ibv_reg_mr_resp mr;
-       uint32_t cqe;
-       uint32_t cqn;
-};
-
-struct ibv_kern_wc {
-       uint64_t  wr_id;
-       uint32_t  status;
-       uint32_t  opcode;
-       uint32_t  vendor_err;
-       uint32_t  byte_len;
-       uint32_t  imm_data;
-       uint32_t  qp_num;
-       uint32_t  src_qp;
-       uint32_t  wc_flags;
-       uint16_t  pkey_index;
-       uint16_t  slid;
-       uint8_t   sl;
-       uint8_t   dlid_path_bits;
-       uint8_t   port_num;
-       uint8_t   reserved;
-};
-
-struct ibv_poll_cq {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint64_t response;
-       uint32_t cq_handle;
-       uint32_t ne;
-};
-
-struct ibv_poll_cq_resp {
-       uint32_t count;
-       uint32_t reserved;
-       struct ibv_kern_wc wc[];
-};
-
-struct ibv_req_notify_cq {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint32_t cq_handle;
-       uint32_t solicited;
-};
-
-struct ibv_destroy_cq {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint64_t response;
-       uint32_t cq_handle;
-       uint32_t reserved;
-};
-
-struct ibv_destroy_cq_resp {
-       uint32_t comp_events_reported;
-       uint32_t async_events_reported;
-};
-
-struct ibv_kern_global_route {
-       uint8_t  dgid[16];
-       uint32_t flow_label;
-       uint8_t  sgid_index;
-       uint8_t  hop_limit;
-       uint8_t  traffic_class;
-       uint8_t  reserved;
-};
-
-struct ibv_kern_ah_attr {
-       struct ibv_kern_global_route grh;
-       uint16_t dlid;
-       uint8_t  sl;
-       uint8_t  src_path_bits;
-       uint8_t  static_rate;
-       uint8_t  is_global;
-       uint8_t  port_num;
-       uint8_t  reserved;
-};
-
-struct ibv_kern_qp_attr {
-       uint32_t        qp_attr_mask;
-       uint32_t        qp_state;
-       uint32_t        cur_qp_state;
-       uint32_t        path_mtu;
-       uint32_t        path_mig_state;
-       uint32_t        qkey;
-       uint32_t        rq_psn;
-       uint32_t        sq_psn;
-       uint32_t        dest_qp_num;
-       uint32_t        qp_access_flags;
-
-       struct ibv_kern_ah_attr ah_attr;
-       struct ibv_kern_ah_attr alt_ah_attr;
-
-       /* ib_qp_cap */
-       uint32_t        max_send_wr;
-       uint32_t        max_recv_wr;
-       uint32_t        max_send_sge;
-       uint32_t        max_recv_sge;
-       uint32_t        max_inline_data;
-
-       uint16_t        pkey_index;
-       uint16_t        alt_pkey_index;
-       uint8_t en_sqd_async_notify;
-       uint8_t sq_draining;
-       uint8_t max_rd_atomic;
-       uint8_t max_dest_rd_atomic;
-       uint8_t min_rnr_timer;
-       uint8_t port_num;
-       uint8_t timeout;
-       uint8_t retry_cnt;
-       uint8_t rnr_retry;
-       uint8_t alt_port_num;
-       uint8_t alt_timeout;
-       uint8_t reserved[5];
-};
-
-struct ibv_create_qp {
-       uint64_t sq_db_page;
-       uint64_t rq_db_page;
-       uint32_t sq_db_index;
-       uint32_t rq_db_index;
-       struct ibv_reg_mr mr;
-       uint64_t user_handle;
-       uint64_t send_cq_handle;
-       uint64_t recv_cq_handle;
-       uint64_t srq_handle;
-       uint32_t max_send_wr;
-       uint32_t max_recv_wr;
-       uint32_t max_send_sge;
-       uint32_t max_recv_sge;
-       uint32_t max_inline_data;
-       uint32_t lkey;  /* used only in kernel */
-       uint8_t  sq_sig_all;
-       uint8_t  qp_type;
-       uint8_t  is_srq;
-       uint8_t  reserved[5];
-};
-
-struct ibv_create_qp_resp {
-       struct ibv_reg_mr_resp mr;
-       uint64_t user_handle;
-       uint64_t qp_handle;
-       uint32_t qpn;
-       uint32_t max_send_wr;
-       uint32_t max_recv_wr;
-       uint32_t max_send_sge;
-       uint32_t max_recv_sge;
-       uint32_t max_inline_data;
-};
-
-struct ibv_modify_qp_resp {
-       enum ibv_qp_attr_mask attr_mask;
-       uint8_t qp_state;
-       uint8_t reserved[3];
-};
-
-struct ibv_kern_send_wr {
-       uint64_t wr_id;
-       uint32_t num_sge;
-       uint32_t opcode;
-       uint32_t send_flags;
-       uint32_t imm_data;
-       union {
-               struct {
-                       uint64_t remote_addr;
-                       uint32_t rkey;
-                       uint32_t reserved;
-               } rdma;
-               struct {
-                       uint64_t remote_addr;
-                       uint64_t compare_add;
-                       uint64_t swap;
-                       uint32_t rkey;
-                       uint32_t reserved;
-               } atomic;
-               struct {
-                       uint32_t ah;
-                       uint32_t remote_qpn;
-                       uint32_t remote_qkey;
-                       uint32_t reserved;
-               } ud;
-       } wr;
-};
-
-struct ibv_post_send {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint64_t response;
-       uint32_t qp_handle;
-       uint32_t wr_count;
-       uint32_t sge_count;
-       uint32_t wqe_size;
-       struct ibv_kern_send_wr send_wr[];
-};
-
-struct ibv_post_send_resp {
-       uint32_t bad_wr;
-};
-
-struct ibv_kern_recv_wr {
-       uint64_t wr_id;
-       uint32_t num_sge;
-       uint32_t reserved;
-};
-
-struct ibv_post_recv {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint64_t response;
-       uint32_t qp_handle;
-       uint32_t wr_count;
-       uint32_t sge_count;
-       uint32_t wqe_size;
-       struct ibv_kern_recv_wr recv_wr[];
-};
-
-struct ibv_post_recv_resp {
-       uint32_t bad_wr;
-};
-
-struct ibv_post_srq_recv {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint64_t response;
-       uint32_t srq_handle;
-       uint32_t wr_count;
-       uint32_t sge_count;
-       uint32_t wqe_size;
-       struct ibv_kern_recv_wr recv_wr[];
-};
-
-struct ibv_post_srq_recv_resp {
-       uint32_t bad_wr;
-};
-
-struct ibv_create_ah {
-       struct ibv_reg_mr mr;   
-};
-
-struct ibv_create_ah_resp {
-       uint64_t start;
-       struct ibv_reg_mr_resp mr;
-       ib_av_attr_t            av_attr;
-};
-
-struct ibv_destroy_ah {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint32_t ah_handle;
-};
-
-struct ibv_attach_mcast {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint8_t  gid[16];
-       uint32_t qp_handle;
-       uint16_t mlid;
-       uint16_t reserved;
-       uint64_t driver_data[];
-};
-
-struct ibv_detach_mcast {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint8_t  gid[16];
-       uint32_t qp_handle;
-       uint16_t mlid;
-       uint16_t reserved;
-       uint64_t driver_data[];
-};
-
-struct ibv_create_srq {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint64_t response;
-       uint64_t user_handle;
-       uint32_t pd_handle;
-       uint32_t max_wr;
-       uint32_t max_sge;
-       uint32_t srq_limit;
-       uint64_t driver_data[];
-};
-
-struct ibv_create_srq_resp {
-       uint32_t srq_handle;
-};
-
-struct ibv_modify_srq {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint32_t srq_handle;
-       uint32_t attr_mask;
-       uint32_t max_wr;
-       uint32_t srq_limit;
-       uint64_t driver_data[];
-};
-
-struct ibv_destroy_srq {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint64_t response;
-       uint32_t srq_handle;
-       uint32_t reserved;
-};
-
-struct ibv_destroy_srq_resp {
-       uint32_t events_reported;
-};
-
-/*
- * Compatibility with older ABI versions
- */
-
-enum {
-       IB_USER_VERBS_CMD_QUERY_PARAMS_V2,
-       IB_USER_VERBS_CMD_GET_CONTEXT_V2,
-       IB_USER_VERBS_CMD_QUERY_DEVICE_V2,
-       IB_USER_VERBS_CMD_QUERY_PORT_V2,
-       IB_USER_VERBS_CMD_QUERY_GID_V2,
-       IB_USER_VERBS_CMD_QUERY_PKEY_V2,
-       IB_USER_VERBS_CMD_ALLOC_PD_V2,
-       IB_USER_VERBS_CMD_DEALLOC_PD_V2,
-       IB_USER_VERBS_CMD_CREATE_AH_V2,
-       IB_USER_VERBS_CMD_MODIFY_AH_V2,
-       IB_USER_VERBS_CMD_QUERY_AH_V2,
-       IB_USER_VERBS_CMD_DESTROY_AH_V2,
-       IB_USER_VERBS_CMD_REG_MR_V2,
-       IB_USER_VERBS_CMD_REG_SMR_V2,
-       IB_USER_VERBS_CMD_REREG_MR_V2,
-       IB_USER_VERBS_CMD_QUERY_MR_V2,
-       IB_USER_VERBS_CMD_DEREG_MR_V2,
-       IB_USER_VERBS_CMD_ALLOC_MW_V2,
-       IB_USER_VERBS_CMD_BIND_MW_V2,
-       IB_USER_VERBS_CMD_DEALLOC_MW_V2,
-       IB_USER_VERBS_CMD_CREATE_CQ_V2,
-       IB_USER_VERBS_CMD_RESIZE_CQ_V2,
-       IB_USER_VERBS_CMD_DESTROY_CQ_V2,
-       IB_USER_VERBS_CMD_POLL_CQ_V2,
-       IB_USER_VERBS_CMD_PEEK_CQ_V2,
-       IB_USER_VERBS_CMD_REQ_NOTIFY_CQ_V2,
-       IB_USER_VERBS_CMD_CREATE_QP_V2,
-       IB_USER_VERBS_CMD_QUERY_QP_V2,
-       IB_USER_VERBS_CMD_MODIFY_QP_V2,
-       IB_USER_VERBS_CMD_DESTROY_QP_V2,
-       IB_USER_VERBS_CMD_POST_SEND_V2,
-       IB_USER_VERBS_CMD_POST_RECV_V2,
-       IB_USER_VERBS_CMD_ATTACH_MCAST_V2,
-       IB_USER_VERBS_CMD_DETACH_MCAST_V2,
-       IB_USER_VERBS_CMD_CREATE_SRQ_V2,
-       IB_USER_VERBS_CMD_MODIFY_SRQ_V2,
-       IB_USER_VERBS_CMD_QUERY_SRQ_V2,
-       IB_USER_VERBS_CMD_DESTROY_SRQ_V2,
-       IB_USER_VERBS_CMD_POST_SRQ_RECV_V2,
-       /*
-        * Set commands that didn't exist to -1 so our compile-time
-        * trick opcodes in IBV_INIT_CMD() doesn't break.
-        */
-       IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL_V2 = -1,
-};
-
-struct ibv_destroy_cq_v1 {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint32_t cq_handle;
-};
-
-struct ibv_destroy_qp_v1 {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint32_t qp_handle;
-};
-
-struct ibv_destroy_srq_v1 {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint32_t srq_handle;
-};
-
-struct ibv_get_context_v2 {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint64_t response;
-       uint64_t cq_fd_tab;
-       uint64_t driver_data[];
-};
-
-struct ibv_create_cq_v2 {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint64_t response;
-       uint64_t user_handle;
-       uint32_t cqe;
-       uint32_t event_handler;
-       uint64_t driver_data[];
-};
-
-struct ibv_modify_srq_v3 {
-       uint32_t command;
-       uint16_t in_words;
-       uint16_t out_words;
-       uint32_t srq_handle;
-       uint32_t attr_mask;
-       uint32_t max_wr;
-       uint32_t max_sge;
-       uint32_t srq_limit;
-       uint32_t reserved;
-       uint64_t driver_data[];
-};
-
-struct ibv_create_qp_resp_v3 {
-       uint32_t qp_handle;
-       uint32_t qpn;
-};
-
-#endif /* KERN_ABI_H */