Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / infiniband / hw / ehca / ehca_classes.h
index 043e4fb23fb093bb92f800518d38e8bd1f6dbc4b..2d660ae189e544b54b3895cc4f0fc2f7d58312ea 100644 (file)
@@ -43,7 +43,6 @@
 #ifndef __EHCA_CLASSES_H__
 #define __EHCA_CLASSES_H__
 
-
 struct ehca_module;
 struct ehca_qp;
 struct ehca_cq;
@@ -54,6 +53,7 @@ struct ehca_pd;
 struct ehca_av;
 
 #include <linux/wait.h>
+#include <linux/mutex.h>
 
 #include <rdma/ib_verbs.h>
 #include <rdma/ib_user_verbs.h>
@@ -100,9 +100,14 @@ struct ehca_sport {
        struct ehca_sma_attr saved_attr;
 };
 
+#define HCA_CAP_MR_PGSIZE_4K  0x80000000
+#define HCA_CAP_MR_PGSIZE_64K 0x40000000
+#define HCA_CAP_MR_PGSIZE_1M  0x20000000
+#define HCA_CAP_MR_PGSIZE_16M 0x10000000
+
 struct ehca_shca {
        struct ib_device ib_device;
-       struct ibmebus_dev *ibmebus_dev;
+       struct of_device *ofdev;
        u8 num_ports;
        int hw_level;
        struct list_head shca_list;
@@ -115,6 +120,8 @@ struct ehca_shca {
        struct h_galpas galpas;
        struct mutex modify_mutex;
        u64 hca_cap;
+       /* MR pgsize: bit 0-3 means 4K, 64K, 1M, 16M respectively */
+       u32 hca_cap_mr_pgsize;
        int max_mtu;
 };
 
@@ -122,6 +129,10 @@ struct ehca_pd {
        struct ib_pd ib_pd;
        struct ipz_pd fw_pd;
        u32 ownpid;
+       /* small queue mgmt */
+       struct mutex lock;
+       struct list_head free[2];
+       struct list_head full[2];
 };
 
 enum ehca_ext_qp_type {
@@ -206,6 +217,7 @@ struct ehca_mr {
        enum ehca_mr_flag flags;
        u32 num_kpages;         /* number of kernel pages */
        u32 num_hwpages;        /* number of hw pages to form MR */
+       u64 hwpage_size;        /* hw page size used for this MR */
        int acl;                /* ACL (stored here for usage in reregister) */
        u64 *start;             /* virtual start address (stored here for */
                                /* usage in reregister) */
@@ -240,6 +252,7 @@ struct ehca_mr_pginfo {
        enum ehca_mr_pgi_type type;
        u64 num_kpages;
        u64 kpage_cnt;
+       u64 hwpage_size;     /* hw page size used for this MR */
        u64 num_hwpages;     /* number of hw pages */
        u64 hwpage_cnt;      /* counter for hw pages */
        u64 next_hwpage;     /* next hw page in buffer/chunk/listelem */
@@ -298,6 +311,8 @@ int ehca_init_av_cache(void);
 void ehca_cleanup_av_cache(void);
 int ehca_init_mrmw_cache(void);
 void ehca_cleanup_mrmw_cache(void);
+int ehca_init_small_qp_cache(void);
+void ehca_cleanup_small_qp_cache(void);
 
 extern rwlock_t ehca_qp_idr_lock;
 extern rwlock_t ehca_cq_idr_lock;
@@ -315,13 +330,15 @@ struct ipzu_queue_resp {
        u32 queue_length; /* queue length allocated in bytes */
        u32 pagesize;
        u32 toggle_state;
-       u32 dummy; /* padding for 8 byte alignment */
+       u32 offset; /* save offset within a page for small_qp */
 };
 
 struct ehca_create_cq_resp {
        u32 cq_number;
        u32 token;
        struct ipzu_queue_resp ipz_queue;
+       u32 fw_handle_ofs;
+       u32 dummy;
 };
 
 struct ehca_create_qp_resp {
@@ -332,7 +349,8 @@ struct ehca_create_qp_resp {
        u32 qkey;
        /* qp_num assigned by ehca: sqp0/1 may have got different numbers */
        u32 real_qp_num;
-       u32 dummy; /* padding for 8 byte alignment */
+       u32 fw_handle_ofs;
+       u32 dummy;
        struct ipzu_queue_resp ipz_squeue;
        struct ipzu_queue_resp ipz_rqueue;
 };
@@ -357,15 +375,29 @@ enum ehca_ll_comp_flags {
        LLQP_COMP_MASK = 0x60,
 };
 
+struct ehca_alloc_queue_parms {
+       /* input parameters */
+       int max_wr;
+       int max_sge;
+       int page_size;
+       int is_small;
+
+       /* output parameters */
+       u16 act_nr_wqes;
+       u8  act_nr_sges;
+       u32 queue_size; /* bytes for small queues, pages otherwise */
+};
+
 struct ehca_alloc_qp_parms {
-/* input parameters */
+       struct ehca_alloc_queue_parms squeue;
+       struct ehca_alloc_queue_parms rqueue;
+
+       /* input parameters */
        enum ehca_service_type servicetype;
+       int qp_storage;
        int sigtype;
        enum ehca_ext_qp_type ext_type;
        enum ehca_ll_comp_flags ll_comp_flags;
-
-       int max_send_wr, max_recv_wr;
-       int max_send_sge, max_recv_sge;
        int ud_av_l_key_ctl;
 
        u32 token;
@@ -375,18 +407,10 @@ struct ehca_alloc_qp_parms {
 
        u32 srq_qpn, srq_token, srq_limit;
 
-/* output parameters */
+       /* output parameters */
        u32 real_qp_num;
        struct ipz_qp_handle qp_handle;
        struct h_galpas galpas;
-
-       u16 act_nr_send_wqes;
-       u16 act_nr_recv_wqes;
-       u8  act_nr_recv_sges;
-       u8  act_nr_send_sges;
-
-       u32 nr_rq_pages;
-       u32 nr_sq_pages;
 };
 
 int ehca_cq_assign_qp(struct ehca_cq *cq, struct ehca_qp *qp);