]> err.no Git - linux-2.6/blobdiff - drivers/infiniband/hw/mthca/mthca_provider.h
IB: simplify static rate encoding
[linux-2.6] / drivers / infiniband / hw / mthca / mthca_provider.h
index 1d032791cc8b67a3ad217dc3a235ead72dab1f6b..6676a786d69091118d459ab428c794b829808367 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2004 Topspin Communications.  All rights reserved.
- * Copyright (c) 2005 Cisco Systems.  All rights reserved.
+ * Copyright (c) 2005, 2006 Cisco Systems.  All rights reserved.
+ * Copyright (c) 2005 Mellanox Technologies. 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
@@ -36,8 +37,8 @@
 #ifndef MTHCA_PROVIDER_H
 #define MTHCA_PROVIDER_H
 
-#include <ib_verbs.h>
-#include <ib_pack.h>
+#include <rdma/ib_verbs.h>
+#include <rdma/ib_pack.h>
 
 #define MTHCA_MPT_FLAG_ATOMIC        (1 << 14)
 #define MTHCA_MPT_FLAG_REMOTE_WRITE  (1 << 13)
@@ -50,6 +51,11 @@ struct mthca_buf_list {
        DECLARE_PCI_UNMAP_ADDR(mapping)
 };
 
+union mthca_buf {
+       struct mthca_buf_list direct;
+       struct mthca_buf_list *page_list;
+};
+
 struct mthca_uar {
        unsigned long pfn;
        int           index;
@@ -158,9 +164,11 @@ struct mthca_ah {
  * - wait_event until ref count is zero
  *
  * It is the consumer's responsibilty to make sure that no QP
- * operations (WQE posting or state modification) are pending when the
+ * operations (WQE posting or state modification) are pending when a
  * QP is destroyed.  Also, the consumer must make sure that calls to
- * qp_modify are serialized.
+ * qp_modify are serialized.  Similarly, the consumer is responsible
+ * for ensuring that no CQ resize operations are pending when a CQ
+ * is destroyed.
  *
  * Possible optimizations (wait for profile data to see if/where we
  * have locks bouncing between CPUs):
@@ -170,28 +178,63 @@ struct mthca_ah {
  *   send queue and one for the receive queue)
  */
 
+struct mthca_cq_buf {
+       union mthca_buf         queue;
+       struct mthca_mr         mr;
+       int                     is_direct;
+};
+
+struct mthca_cq_resize {
+       struct mthca_cq_buf     buf;
+       int                     cqe;
+       enum {
+               CQ_RESIZE_ALLOC,
+               CQ_RESIZE_READY,
+               CQ_RESIZE_SWAPPED
+       }                       state;
+};
+
 struct mthca_cq {
-       struct ib_cq           ibcq;
-       spinlock_t             lock;
-       atomic_t               refcount;
-       int                    cqn;
-       u32                    cons_index;
-       int                    is_direct;
-       int                    is_kernel;
+       struct ib_cq            ibcq;
+       spinlock_t              lock;
+       atomic_t                refcount;
+       int                     cqn;
+       u32                     cons_index;
+       struct mthca_cq_buf     buf;
+       struct mthca_cq_resize *resize_buf;
+       int                     is_kernel;
 
        /* Next fields are Arbel only */
-       int                    set_ci_db_index;
-       u32                   *set_ci_db;
-       int                    arm_db_index;
-       u32                   *arm_db;
-       int                    arm_sn;
+       int                     set_ci_db_index;
+       __be32                 *set_ci_db;
+       int                     arm_db_index;
+       __be32                 *arm_db;
+       int                     arm_sn;
 
-       union {
-               struct mthca_buf_list direct;
-               struct mthca_buf_list *page_list;
-       }                      queue;
-       struct mthca_mr        mr;
-       wait_queue_head_t      wait;
+       wait_queue_head_t       wait;
+};
+
+struct mthca_srq {
+       struct ib_srq           ibsrq;
+       spinlock_t              lock;
+       atomic_t                refcount;
+       int                     srqn;
+       int                     max;
+       int                     max_gs;
+       int                     wqe_shift;
+       int                     first_free;
+       int                     last_free;
+       u16                     counter;  /* Arbel only */
+       int                     db_index; /* Arbel only */
+       __be32                 *db;       /* Arbel only */
+       void                   *last;
+
+       int                     is_direct;
+       u64                    *wrid;
+       union mthca_buf         queue;
+       struct mthca_mr         mr;
+
+       wait_queue_head_t       wait;
 };
 
 struct mthca_wq {
@@ -206,7 +249,7 @@ struct mthca_wq {
        int        wqe_shift;
 
        int        db_index;    /* Arbel only */
-       u32       *db;
+       __be32    *db;
 };
 
 struct mthca_qp {
@@ -214,6 +257,8 @@ struct mthca_qp {
        atomic_t               refcount;
        u32                    qpn;
        int                    is_direct;
+       u8                     port; /* for SQP and memfree use only */
+       u8                     alt_port; /* for memfree use only */
        u8                     transport;
        u8                     state;
        u8                     atomic_rd_en;
@@ -225,19 +270,16 @@ struct mthca_qp {
        struct mthca_wq        sq;
        enum ib_sig_type       sq_policy;
        int                    send_wqe_offset;
+       int                    max_inline_data;
 
        u64                   *wrid;
-       union {
-               struct mthca_buf_list direct;
-               struct mthca_buf_list *page_list;
-       }                      queue;
+       union mthca_buf        queue;
 
        wait_queue_head_t      wait;
 };
 
 struct mthca_sqp {
        struct mthca_qp qp;
-       int             port;
        int             pkey_index;
        u32             qkey;
        u32             send_psn;
@@ -277,6 +319,11 @@ static inline struct mthca_cq *to_mcq(struct ib_cq *ibcq)
        return container_of(ibcq, struct mthca_cq, ibcq);
 }
 
+static inline struct mthca_srq *to_msrq(struct ib_srq *ibsrq)
+{
+       return container_of(ibsrq, struct mthca_srq, ibsrq);
+}
+
 static inline struct mthca_qp *to_mqp(struct ib_qp *ibqp)
 {
        return container_of(ibqp, struct mthca_qp, ibqp);