[Openib-windows] [PATCH] Support 32-bit kernel bypass on 64-bit kernel
Fab Tillier
ftillier at silverstorm.com
Wed Jan 25 21:09:27 PST 2006
Hi Tzachi,
Here's a patch that adds support for a 32-bit app taking advantage of kernel
bypass functionality when running on a 64-bit kernel.
This patch changes the structure definitions for any structures that are
exchanged between user-mode and kernel-mode so that they are the same size
regardless of architecture. Most of the changes take advantage of the unnamed
union support so that the original type doesn't have to change, avoiding a
myriad of truncation cast errors. All embedded pointers in these structures are
decorated with the __ptr64 keyword, which makes them 64-bits wide even on 32-bit
platforms.
Please take a look and commit as you see fit.
- Fab
Signed-off-by: Fab Tillier (ftillier at silverstorm.com)
Index: hw/mt23108/vapi/Hca/hcahal/hh.h
===================================================================
--- hw/mt23108/vapi/Hca/hcahal/hh.h (revision 215)
+++ hw/mt23108/vapi/Hca/hcahal/hh.h (working copy)
@@ -62,28 +62,48 @@
* Device information (public object/context)
*
*/
-
+#pragma warning( disable : 4201 )
typedef struct HH_hca_dev_st {
- char *dev_desc; /* Device description (name, etc.) */
- char *user_lib; /* User level library (dyn-link) */
+ char * __ptr64 dev_desc; /* Device description (name,
etc.) */
+ char * __ptr64 user_lib; /* User level library
(dyn-link) */
u_int32_t vendor_id; /* IEEE's 24 bit Device Vendor ID */
u_int32_t dev_id; /* Device ID */
u_int32_t hw_ver; /* Hardware version (step/rev) */
u_int64_t fw_ver;
- struct hh_if_ops* if_ops; /* Interface operations */
+ struct hh_if_ops* __ptr64 if_ops; /* Interface operations */
/* Size (bytes) of user-level ... */
+ union
+ {
MT_size_t hca_ul_resources_sz; /* .. resources context for an HCA */
+ void* __ptr64 resv0;
+ };
+ union
+ {
MT_size_t pd_ul_resources_sz; /* .. resources context for a PD */
+ void* __ptr64 resv1;
+ };
+ union
+ {
MT_size_t cq_ul_resources_sz; /* .. resources context for a CQ */
+ void* __ptr64 resv2;
+ };
+ union
+ {
MT_size_t srq_ul_resources_sz; /* .. resources context for a SRQ */
+ void* __ptr64 resv3;
+ };
+ union
+ {
MT_size_t qp_ul_resources_sz; /* .. resources context for a QP */
+ void* __ptr64 resv4;
+ };
- void* device; /* Device private data */
+ void* __ptr64 device; /* Device private data */
HH_hca_status_t status; /* Device Status */
} HH_hca_dev_t;
+#pragma warning( default : 4201 )
-
typedef enum {
HH_TPT_PAGE,
HH_TPT_BUF,
Index: hw/mt23108/vapi/Hca/hcahal/tavor/thh_common.h
===================================================================
--- hw/mt23108/vapi/Hca/hcahal/tavor/thh_common.h (revision 215)
+++ hw/mt23108/vapi/Hca/hcahal/tavor/thh_common.h (working copy)
@@ -54,6 +54,8 @@
typedef struct THH_uar_st *THH_uar_t;
+#pragma warning( disable : 4201 )
+
/* VERSION INFORMATION: used in order to retrieve major version numbers
in order to deal with differences in different versions. */
typedef struct THH_ver_info_st {
@@ -68,12 +70,16 @@
HH_hca_hndl_t hh_hca_hndl;
THH_ver_info_t version;
THH_uar_index_t uar_index;
+ union
+ {
MT_virt_addr_t uar_map;
+ void* __ptr64 resv0;
+ };
/* HCA capabilities to validate or use in THHUL */
MT_bool priv_ud_av; /* Privileged UD AV are enforced ? */
u_int32_t log2_mpt_size;
- char *av_ddr_base;
- char *av_host_base;
+ char * __ptr64 av_ddr_base;
+ char * __ptr64 av_host_base;
u_int32_t max_qp_ous_wr; /* Maximum Number of oustanding WR on
any WQ. */
u_int32_t max_srq_ous_wr; /* Maximum Number of oustanding WR on
any WQ. */
@@ -90,34 +96,71 @@
* needed. Therefore, the udavm_buf_size value is the size of the actual
udavm
* table, not the size of the malloc'ed buffer.
*/
+ union
+ {
MT_virt_addr_t udavm_buf; /* IN */
+ void* __ptr64 resv0;
+ };
+ union
+ {
MT_size_t udavm_buf_sz; /* IN */
+ void* __ptr64 resv1;
+ };
HH_pdm_pd_flags_t pd_flags; /* IN - if non-zero, is a PD for a
special QP*/
VAPI_lkey_t udavm_buf_memkey; /* OUT - set by THH_uldm */
} THH_pd_ul_resources_t;
typedef struct
{
+ union
+ {
MT_virt_addr_t cqe_buf; /* CQE buffer virtual addr. CQE size aligned
*/
+ void* __ptr64 resv0;
+ };
+ union
+ {
MT_size_t cqe_buf_sz; /* Buffer size in bytes (mult of CQE size) */
+ void* __ptr64 resv1;
+ };
THH_uar_index_t uar_index; /* Index of UAR used for this CQ. */
u_int32_t new_producer_index; /* New producer index after
"resize_cq" (OUT)*/
} THH_cq_ul_resources_t;
typedef struct
{
+ union
+ {
MT_virt_addr_t wqes_buf; /* WQEs buffer virtual address */
+ void* __ptr64 resv0;
+ };
+ union
+ {
MT_size_t wqes_buf_sz; /* Buffer size in bytes */
+ void* __ptr64 resv1;
+ };
THH_uar_index_t uar_index; /* index of UAR used for this QP */
/* ER: Not used anywhere: MT_virt_addr_t uar_map; */ /* Address in
user space of UAR */
} THH_qp_ul_resources_t;
typedef struct
{
+ union
+ {
MT_virt_addr_t wqes_buf; /* WQEs buffer virtual address */
+ void* __ptr64 resv0;
+ };
+ union
+ {
MT_size_t wqes_buf_sz; /* Buffer size in bytes */
+ void* __ptr64 resv1;
+ };
+ union
+ {
MT_size_t wqe_sz; /* WQE (descriptor) size in bytes */
+ void* __ptr64 resv2;
+ };
THH_uar_index_t uar_index; /* index of UAR used for this QP */
} THH_srq_ul_resources_t;
+#pragma warning( default : 4201 )
#endif /* H_THH_COMMON_H */
Index: hw/mt23108/vapi/Hca/hcahal/tavor/thh_hob/thh_hob.h
===================================================================
--- hw/mt23108/vapi/Hca/hcahal/tavor/thh_hob/thh_hob.h (revision 215)
+++ hw/mt23108/vapi/Hca/hcahal/tavor/thh_hob/thh_hob.h (working copy)
@@ -336,8 +336,8 @@
DLL_API HH_ret_t THH_hob_free_ul_res(HH_hca_hndl_t hca_hndl,void
*hca_ul_resources_p);
DLL_API HH_ret_t THH_hob_alloc_pd(HH_hca_hndl_t hca_hndl,
MOSAL_protection_ctx_t prot_ctx, void * pd_ul_resources_p,HH_pd_hndl_t
*pd_num_p);
DLL_API HH_ret_t THH_hob_free_pd(HH_hca_hndl_t hca_hndl, HH_pd_hndl_t pd_num);
-DLL_API HH_ret_t THH_hob_alloc_rdd(HH_hca_dev_t *hh_dev_p, HH_rdd_hndl_t
*rdd_p);
-DLL_API HH_ret_t THH_hob_free_rdd(HH_hca_dev_t *hh_dev_p, HH_rdd_hndl_t rdd);
+DLL_API HH_ret_t THH_hob_alloc_rdd(HH_hca_hndl_t hh_dev_p, HH_rdd_hndl_t
*rdd_p);
+DLL_API HH_ret_t THH_hob_free_rdd(HH_hca_hndl_t hh_dev_p, HH_rdd_hndl_t rdd);
DLL_API HH_ret_t THH_hob_create_ud_av(HH_hca_hndl_t hca_hndl,HH_pd_hndl_t
pd,VAPI_ud_av_t *av_p, HH_ud_av_hndl_t *ah_p);
DLL_API HH_ret_t THH_hob_modify_ud_av(HH_hca_hndl_t hca_hndl, HH_ud_av_hndl_t
ah,VAPI_ud_av_t *av_p);
DLL_API HH_ret_t THH_hob_query_ud_av(HH_hca_hndl_t hca_hndl, HH_ud_av_hndl_t
ah,VAPI_ud_av_t *av_p);
Index: hw/mt23108/vapi/Hca/hcahal/tavor/thh_hob/thh_hob.c
===================================================================
--- hw/mt23108/vapi/Hca/hcahal/tavor/thh_hob/thh_hob.c (revision 215)
+++ hw/mt23108/vapi/Hca/hcahal/tavor/thh_hob/thh_hob.c (working copy)
@@ -5000,7 +5000,7 @@
/******************************************************************************
* Function: THH_hob_alloc_rdd <==> THH_eecm_alloc_rdd
*****************************************************************************/
-HH_ret_t THH_hob_alloc_rdd(HH_hca_dev_t *hh_dev_p,
+HH_ret_t THH_hob_alloc_rdd(HH_hca_hndl_t hh_dev_p,
HH_rdd_hndl_t *rdd_p)
{
#if 0
@@ -5039,7 +5039,7 @@
/******************************************************************************
* Function: THH_hob_free_rdd <==> THH_eecm_free_rdd
*****************************************************************************/
-HH_ret_t THH_hob_free_rdd(HH_hca_dev_t *hh_dev_p, HH_rdd_hndl_t rdd)
+HH_ret_t THH_hob_free_rdd(HH_hca_hndl_t hh_dev_p, HH_rdd_hndl_t rdd)
{
#if 0
THH_hob_t thh_hob_p;
Index: hw/mt23108/vapi/Hca/hcahal/hh_common.h
===================================================================
--- hw/mt23108/vapi/Hca/hcahal/hh_common.h (revision 215)
+++ hw/mt23108/vapi/Hca/hcahal/hh_common.h (working copy)
@@ -44,7 +44,7 @@
*
*/
-typedef struct HH_hca_dev_st* HH_hca_hndl_t;
+typedef struct HH_hca_dev_st* __ptr64 HH_hca_hndl_t;
typedef struct HHUL_sr_wqe_st HHUL_sr_wqe_t;
typedef struct HHUL_rr_wqe_st HHUL_rr_wqe_t;
Index: hw/mt23108/user/hca_data.h
===================================================================
--- hw/mt23108/user/hca_data.h (revision 215)
+++ hw/mt23108/user/hca_data.h (working copy)
@@ -35,7 +35,7 @@
typedef struct _ib_ca
{
- HH_hca_dev_t *p_hca_ul_info;
+ HH_hca_dev_t * __ptr64 p_hca_ul_info;
void *p_hca_ul_resources;
ib_ca_attr_t *p_hca_attr;
HHUL_hca_hndl_t hhul_hca_hndl;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uvp32_64.patch
Type: application/octet-stream
Size: 8425 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20060125/db15e294/attachment.obj>
More information about the ofw
mailing list